node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

593
server/node_modules/yup/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,593 @@
## [0.32.9](https://github.com/jquense/yup/compare/v0.32.6...v0.32.9) (2021-02-17)
### Bug Fixes
* **types:** Array required() and defined() will no longer return any ([#1256](https://github.com/jquense/yup/issues/1256)) ([52e5876](https://github.com/jquense/yup/commit/52e5876))
* export MixedSchema to fix ts with --declarations ([#1204](https://github.com/jquense/yup/issues/1204)) ([67c96ae](https://github.com/jquense/yup/commit/67c96ae))
* **types:** add generic to Reference.create() ([#1208](https://github.com/jquense/yup/issues/1208)) ([be3d1b4](https://github.com/jquense/yup/commit/be3d1b4))
* **types:** reach and getIn make last 2 arguments optional ([#1194](https://github.com/jquense/yup/issues/1194)) ([5cf2c48](https://github.com/jquense/yup/commit/5cf2c48))
* do not initialize spec values with undefined ([#1177](https://github.com/jquense/yup/issues/1177)) ([e8e5b46](https://github.com/jquense/yup/commit/e8e5b46)), closes [jquense/yup#1160](https://github.com/jquense/yup/issues/1160) [jquense/yup#1160](https://github.com/jquense/yup/issues/1160)
* **types:** meta() return type ([e41040a](https://github.com/jquense/yup/commit/e41040a))
* array handling in SchemaOf type ([#1169](https://github.com/jquense/yup/issues/1169)) ([e785e1a](https://github.com/jquense/yup/commit/e785e1a))
* **types:** make StringSchema.matches options optional ([#1166](https://github.com/jquense/yup/issues/1166)) ([b53e5f2](https://github.com/jquense/yup/commit/b53e5f2))
* **types:** SchemaOf doesn't produce a union of base schema ([2d71f32](https://github.com/jquense/yup/commit/2d71f32))
## [0.32.6](https://github.com/jquense/yup/compare/v0.32.5...v0.32.6) (2020-12-08)
### Bug Fixes
* mixed() is the the base class ([7f8591d](https://github.com/jquense/yup/commit/7f8591d)), closes [#1156](https://github.com/jquense/yup/issues/1156)
## [0.32.5](https://github.com/jquense/yup/compare/v0.32.4...v0.32.5) (2020-12-07)
### Bug Fixes
* **types:** change base.default() to any ([01c6930](https://github.com/jquense/yup/commit/01c6930))
## [0.32.4](https://github.com/jquense/yup/compare/v0.32.3...v0.32.4) (2020-12-07)
### Bug Fixes
* **types:** rm base pick/omit types as they conflict with more specific ones ([14e2c8c](https://github.com/jquense/yup/commit/14e2c8c))
### Features
* add additional functions to Lazy class ([#1148](https://github.com/jquense/yup/issues/1148)) ([ecad1a3](https://github.com/jquense/yup/commit/ecad1a3))
## [0.32.3](https://github.com/jquense/yup/compare/v0.32.2...v0.32.3) (2020-12-07)
### Bug Fixes
* **types:** AnyObjectSchema anys ([1c54665](https://github.com/jquense/yup/commit/1c54665))
## [0.32.2](https://github.com/jquense/yup/compare/v0.32.1...v0.32.2) (2020-12-07)
### Bug Fixes
* **types:** array type with lazy ([ba92dfc](https://github.com/jquense/yup/commit/ba92dfc)), closes [#1146](https://github.com/jquense/yup/issues/1146)
## [0.32.1](https://github.com/jquense/yup/compare/v0.32.0...v0.32.1) (2020-12-04)
### Bug Fixes
* cyclical import ([d5c5391](https://github.com/jquense/yup/commit/d5c5391)), closes [#1138](https://github.com/jquense/yup/issues/1138)
* some strict fn type improvements ([8092218](https://github.com/jquense/yup/commit/8092218))
# [0.32.0](https://github.com/jquense/yup/compare/v0.31.1...v0.32.0) (2020-12-03)
### Features
* typescript support ([#1134](https://github.com/jquense/yup/issues/1134)) ([b97c39d](https://github.com/jquense/yup/commit/b97c39d))
### BREAKING CHANGES
* `concat` doesn't check for "unset" nullable or presence when merging meaning the nullability and presence will always be the same as the schema passed to `concat()`. They can be overridden if needed after concatenation
* schema factory functions are no longer constructors. The classes are now also exported for extension or whatever else. e.g. `import { StringSchema, string } from 'yup'`
## [0.31.1](https://github.com/jquense/yup/compare/v0.31.0...v0.31.1) (2020-12-01)
### Bug Fixes
* swallowed errors on nested schema with no tests ([5316ab9](https://github.com/jquense/yup/commit/5316ab9)), closes [#1127](https://github.com/jquense/yup/issues/1127)
### Features
* add `isTrue` and `isFalse` checks on boolean ([#910](https://github.com/jquense/yup/issues/910)) ([630a641](https://github.com/jquense/yup/commit/630a641))
# [0.31.0](https://github.com/jquense/yup/compare/v0.30.0...v0.31.0) (2020-11-23)
### Bug Fixes
* path params incorrectly mutated ([ba23eb7](https://github.com/jquense/yup/commit/ba23eb7)), closes [#1122](https://github.com/jquense/yup/issues/1122)
### Features
* add array.length() and treat empty arrays as valid for required() ([fbc158d](https://github.com/jquense/yup/commit/fbc158d))
* add object.pick and object.omit ([425705a](https://github.com/jquense/yup/commit/425705a))
* deprecate the getter overload of `default()` ([#1119](https://github.com/jquense/yup/issues/1119)) ([5dae837](https://github.com/jquense/yup/commit/5dae837))
* more strictly coerce strings, exclude arrays and plain objects ([963d2e8](https://github.com/jquense/yup/commit/963d2e8))
### BREAKING CHANGES
* array().required() will no longer consider an empty array missing and required checks will pass.
To maintain the old behavior change to:
```js
array().required().min(1)
```
* plain objects and arrays are no long cast to strings automatically
to recreate the old behavior:
```js
string().transform((_, input) => input != null && input.toString ? input.toString() : value);
```
# [0.30.0](https://github.com/jquense/yup/compare/v0.29.3...v0.30.0) (2020-11-19)
### Bug Fixes
* defined() so it doesn't mark a schema as nullable ([f08d507](https://github.com/jquense/yup/commit/f08d507))
* IE11 clone() ([#1029](https://github.com/jquense/yup/issues/1029)) ([7fd80aa](https://github.com/jquense/yup/commit/7fd80aa))
* security Fix for Prototype Pollution - huntr.dev ([#1088](https://github.com/jquense/yup/issues/1088)) ([15a0f43](https://github.com/jquense/yup/commit/15a0f43))
* uuid's regexp ([#1112](https://github.com/jquense/yup/issues/1112)) ([57d42a8](https://github.com/jquense/yup/commit/57d42a8))
### Features
* exposes context on mixed.test function and add originalValue to context ([#1021](https://github.com/jquense/yup/issues/1021)) ([6096064](https://github.com/jquense/yup/commit/6096064))
### Performance Improvements
* reduce function calls for shallower stacks ([#1022](https://github.com/jquense/yup/issues/1022)) ([01da7e1](https://github.com/jquense/yup/commit/01da7e1))
### BREAKING CHANGES
* defined() now doesn't automatically allow null, this was a bug. to mimic the old behavior add nullable() to schema with defined()
## [0.29.3](https://github.com/jquense/yup/compare/v0.29.2...v0.29.3) (2020-08-04)
## [0.29.2](https://github.com/jquense/yup/compare/v0.29.1...v0.29.2) (2020-07-27)
### Bug Fixes
* handle sparse array positions as undefined ([#950](https://github.com/jquense/yup/issues/950)) ([4e77348](https://github.com/jquense/yup/commit/4e77348))
### Features
* string UUID validation via a regex ([#909](https://github.com/jquense/yup/issues/909)) ([8f2bd2b](https://github.com/jquense/yup/commit/8f2bd2b))
## [0.29.1](https://github.com/jquense/yup/compare/v0.29.0...v0.29.1) (2020-05-27)
### Bug Fixes
* present checks for array and strings ([ecd8ebe](https://github.com/jquense/yup/commit/ecd8ebe483456805d743c888a82e180394ba8a22)), closes [#913](https://github.com/jquense/yup/issues/913)
### Features
* allow access to parent schema (and unlimited ancestors!) in test context ([#556](https://github.com/jquense/yup/issues/556)) ([db35920](https://github.com/jquense/yup/commit/db35920b1ede4ea41ea90e1204b3da2a39787635))
# [0.29.0](https://github.com/jquense/yup/compare/v0.28.5...v0.29.0) (2020-05-19)
* feat!: update docs to account for changes in types and add additional example (#891) ([e105a71](https://github.com/jquense/yup/commit/e105a71)), closes [#891](https://github.com/jquense/yup/issues/891)
### Bug Fixes
* object bug when nested object has a property with strict ([#871](https://github.com/jquense/yup/issues/871)) ([7f52b8a](https://github.com/jquense/yup/commit/7f52b8a))
### Features
* expose oneOf and notOneOf values on description ([#885](https://github.com/jquense/yup/issues/885)) ([08dad5f](https://github.com/jquense/yup/commit/08dad5f))
### BREAKING CHANGES
* For users of `@types/yup` only, no function changes but the type def change is large enough that it warranted a major bump here
## [0.28.5](https://github.com/jquense/yup/compare/v0.28.4...v0.28.5) (2020-04-30)
### Bug Fixes
- allow passing of function to .matches() options/message param ([#850](https://github.com/jquense/yup/issues/850)) ([16efe88](https://github.com/jquense/yup/commit/16efe88a8953db60438f77f43bd5bf614079803d))
- bug in object.noUnknown for nullish values https://github.com/jquense/yup/issues/854 ([#855](https://github.com/jquense/yup/issues/855)) ([ccb7c7d](https://github.com/jquense/yup/commit/ccb7c7d3c450537dffbb7d589e3111fc1f9a86fd))
## [0.28.4](https://github.com/jquense/yup/compare/v0.28.3...v0.28.4) (2020-04-20)
### Bug Fixes
- array reaching ([81e4058](https://github.com/jquense/yup/commit/81e4058))
### Features
- make schema.type and array.innerType public API's ([8f00d50](https://github.com/jquense/yup/commit/8f00d50))
- provide keys in default noUnknown message ([#579](https://github.com/jquense/yup/issues/579)) ([ad5d015](https://github.com/jquense/yup/commit/ad5d015))
## [0.28.3](https://github.com/jquense/yup/compare/v0.28.2...v0.28.3) (2020-03-06)
### Bug Fixes
- array.ensure ([94659c2](https://github.com/jquense/yup/commit/94659c2)), closes [#343](https://github.com/jquense/yup/issues/343)
- match options ([493cc61](https://github.com/jquense/yup/commit/493cc61)), closes [#802](https://github.com/jquense/yup/issues/802) [#801](https://github.com/jquense/yup/issues/801) [#799](https://github.com/jquense/yup/issues/799) [#798](https://github.com/jquense/yup/issues/798)
# [0.28.0](https://github.com/jquense/yup/compare/v0.26.10...v0.28.0) (2019-12-16)
### Bug Fixes
- [#473](https://github.com/jquense/yup/issues/473) make concat compatible with (not)oneOf ([#492](https://github.com/jquense/yup/issues/492)) ([8d21cc9](https://github.com/jquense/yup/commit/8d21cc9))
- array path resolve for descendants ([#669](https://github.com/jquense/yup/issues/669)) ([d31e34d](https://github.com/jquense/yup/commit/d31e34d))
- change @babel/runtime version to be a range ([#488](https://github.com/jquense/yup/issues/488)) ([1c9b362](https://github.com/jquense/yup/commit/1c9b362)), closes [#486](https://github.com/jquense/yup/issues/486)
- concat of mixed and subtype ([#444](https://github.com/jquense/yup/issues/444)) ([7705972](https://github.com/jquense/yup/commit/7705972))
- default message for test with object ([#453](https://github.com/jquense/yup/issues/453)) ([f1be37f](https://github.com/jquense/yup/commit/f1be37f))
- noUnknown() overriding ([#452](https://github.com/jquense/yup/issues/452)) ([3047b33](https://github.com/jquense/yup/commit/3047b33))
- string.matches() and regex global flag ([#450](https://github.com/jquense/yup/issues/450)) ([a8935b7](https://github.com/jquense/yup/commit/a8935b7))
- synchronous conditional object validation with unknown dependencies ([#598](https://github.com/jquense/yup/issues/598)) ([1081c41](https://github.com/jquense/yup/commit/1081c41))
- typo README (about excludeEmptyString) ([#441](https://github.com/jquense/yup/issues/441)) ([d02ff5e](https://github.com/jquense/yup/commit/d02ff5e))
- unix epoc bug in date parser ([#655](https://github.com/jquense/yup/issues/655)) ([0d14827](https://github.com/jquense/yup/commit/0d14827))
### Features
- add \_isFilled as overrideable `mixed` method to control required behavior ([#459](https://github.com/jquense/yup/issues/459)) ([5b01f18](https://github.com/jquense/yup/commit/5b01f18))
- add function test names to email and url ([#292](https://github.com/jquense/yup/issues/292)) ([7e94395](https://github.com/jquense/yup/commit/7e94395))
- aliases `optional()` and `unknown()` ([#460](https://github.com/jquense/yup/issues/460)) ([51e8661](https://github.com/jquense/yup/commit/51e8661))
- allow toggling strict() ([#457](https://github.com/jquense/yup/issues/457)) ([851d421](https://github.com/jquense/yup/commit/851d421))
- allow withMutation() nesting ([#456](https://github.com/jquense/yup/issues/456)) ([e53ea8c](https://github.com/jquense/yup/commit/e53ea8c))
- do concat in mutation mode ([#461](https://github.com/jquense/yup/issues/461)) ([02be4ca](https://github.com/jquense/yup/commit/02be4ca))
- finalize resolve() ([#447](https://github.com/jquense/yup/issues/447)) ([afc5119](https://github.com/jquense/yup/commit/afc5119))
- replace integer check with Number.isInteger ([#405](https://github.com/jquense/yup/issues/405)) ([1c18442](https://github.com/jquense/yup/commit/1c18442))
- support self references ([#443](https://github.com/jquense/yup/issues/443)) ([1cac515](https://github.com/jquense/yup/commit/1cac515)), closes [/github.com/jquense/yup/blob/d02ff5e59e004b4c5189d1b9fc0055cff45c61df/src/Reference.js#L3](https://github.com//github.com/jquense/yup/blob/d02ff5e59e004b4c5189d1b9fc0055cff45c61df/src/Reference.js/issues/L3)
- use the alternate object index path syntax if the key contains dots (fixes [#536](https://github.com/jquense/yup/issues/536)) ([#539](https://github.com/jquense/yup/issues/539)) ([13e8c76](https://github.com/jquense/yup/commit/13e8c76))
### BREAKING CHANGES
- use Number.isInteger. This works correctly for large numbers.
Related to https://github.com/jquense/yup/pull/147
- reach() no longer resolves the returned schema meaning it's conditions have not been processed yet; prefer validateAt/castAt where it makes sense
- required no longer shows up twice in describe() output for array and strings, which also no longer override required
# [0.27.0](https://github.com/jquense/yup/compare/v0.26.10...v0.27.0) (2019-03-14)
### Bug Fixes
- change @babel/runtime version to be a range ([#488](https://github.com/jquense/yup/issues/488)) ([1c9b362](https://github.com/jquense/yup/commit/1c9b362)), closes [#486](https://github.com/jquense/yup/issues/486)
- concat of mixed and subtype ([#444](https://github.com/jquense/yup/issues/444)) ([7705972](https://github.com/jquense/yup/commit/7705972))
- default message for test with object ([#453](https://github.com/jquense/yup/issues/453)) ([f1be37f](https://github.com/jquense/yup/commit/f1be37f))
- noUnknown() overriding ([#452](https://github.com/jquense/yup/issues/452)) ([3047b33](https://github.com/jquense/yup/commit/3047b33))
- typo README (about excludeEmptyString) ([#441](https://github.com/jquense/yup/issues/441)) ([d02ff5e](https://github.com/jquense/yup/commit/d02ff5e))
### Features
- add \_isFilled as overrideable `mixed` method to control required behavior ([#459](https://github.com/jquense/yup/issues/459)) ([5b01f18](https://github.com/jquense/yup/commit/5b01f18))
- aliases `optional()` and `unknown()` ([#460](https://github.com/jquense/yup/issues/460)) ([51e8661](https://github.com/jquense/yup/commit/51e8661))
- allow toggling strict() ([#457](https://github.com/jquense/yup/issues/457)) ([851d421](https://github.com/jquense/yup/commit/851d421))
- allow withMutation() nesting ([#456](https://github.com/jquense/yup/issues/456)) ([e53ea8c](https://github.com/jquense/yup/commit/e53ea8c))
- do concat in mutation mode ([#461](https://github.com/jquense/yup/issues/461)) ([02be4ca](https://github.com/jquense/yup/commit/02be4ca))
- finalize resolve() ([#447](https://github.com/jquense/yup/issues/447)) ([afc5119](https://github.com/jquense/yup/commit/afc5119))
- support self references ([#443](https://github.com/jquense/yup/issues/443)) ([1cac515](https://github.com/jquense/yup/commit/1cac515)), closes [/github.com/jquense/yup/blob/d02ff5e59e004b4c5189d1b9fc0055cff45c61df/src/Reference.js#L3](https://github.com//github.com/jquense/yup/blob/d02ff5e59e004b4c5189d1b9fc0055cff45c61df/src/Reference.js/issues/L3)
### BREAKING CHANGES
- reach() no longer resolves the returned schema meaning it's conditions have not been processed yet; prefer validateAt/castAt where it makes sense
- required no longer shows up twice in describe() output for array and strings, which also no longer override required
## v0.26.3 - Tue, 28 Aug 2018 15:00:04 GMT
## v0.26.0 - Fri, 20 Jul 2018 15:39:03 GMT
### BREAKING CHANGES
- locale `number` config properties `less` and `more` are now `lessThan` and `moreThan`
## v0.25.1 - Wed, 16 May 2018 23:59:14 GMT
## v0.25.0 - Tue, 15 May 2018 21:43:54 GMT
- remove default export, there are only named exports now!
- fix message defaults for built-in tests, default is only used for `undefined` messages
- fix the `describe()` method so it works with nested schemas
## v0.24.1 - Fri, 09 Feb 2018 19:09:02 GMT
## v0.24.0 - Tue, 16 Jan 2018 14:44:32 GMT
- [f2a0b75](../../commit/f2a0b75), [061e590](../../commit/061e590) [added] number methods lessThan, moreThan
## v0.23.0 - Thu, 12 Oct 2017 17:08:47 GMT
** Probably not breaking but we are being safe about it **
- 🎉 Add Synchronous validation! [#94](https://github.com/jquense/yup/pull/94)
** Features **
- Custom locales without import order [#125](https://github.com/jquense/yup/pull/125)
## v0.22.1 - Thu, 12 Oct 2017 14:49:16 GMT
- Fix bug in browsers without symbol [#132](https://github.com/jquense/yup/pull/132)
## v0.22.0 - Sat, 26 Aug 2017 14:48:57 GMT
** Breaking **
- Use native Set and lodash CloneDeep: [#109](https://github.com/jquense/yup/pull/109)
\*\* Fixes and Features
- Better custom locale support: [#105](https://github.com/jquense/yup/pull/105)
- fix some messages: [#112](https://github.com/jquense/yup/pull/112)
- Clearer errors for common mistakes: [#108](https://github.com/jquense/yup/pull/108)
- New string validation length: [#67](https://github.com/jquense/yup/pull/67)
## v0.21.3 - Wed, 18 Jan 2017 15:39:25 GMT
- [7bc01e0](../../commit/7bc01e0) [added] deep path support for `from`
## v0.21.2 - Fri, 09 Sep 2016 16:52:44 GMT
- [be80413](../../commit/be80413) [fixed] default in concat()
## v0.21.1 - Mon, 29 Aug 2016 18:39:29 GMT
## v0.21.0 - Mon, 29 Aug 2016 18:29:31 GMT
- [8a8cc5b](../../commit/8a8cc5b) [changed] remove case aliases and simplify camelCase
## v0.20.0 - Wed, 20 Jul 2016 02:02:08 GMT
- [f7446d2](../../commit/f7446d2) [fixed] pass path correctly to cast()
- [9b5232a](../../commit/9b5232a) [added] allow function then/otherwise bodies
- [73858fe](../../commit/73858fe) [changed] Don't throw on undefined values in cast()
## v0.19.1 - Mon, 18 Jul 2016 21:53:05 GMT
- [69c0ad4](../../commit/69c0ad4) [fixed] array().concat() incorrectly cleared the sub-schema
## v0.19.0 - Fri, 24 Jun 2016 15:19:48 GMT
- [b0dd021](../../commit/b0dd021) [changed] Split integer(), remove transform
- [758ac51](../../commit/758ac51) [added] string.ensure
- [f2b0078](../../commit/f2b0078) [changed] Less aggressive type coercions
- [ab94510](../../commit/ab94510) [fixed] boxed number allowed NaN
## v0.18.3 - Mon, 09 May 2016 15:50:47 GMT
## v0.18.2 - Mon, 25 Apr 2016 18:23:13 GMT
## v0.18.1 - Mon, 25 Apr 2016 15:01:16 GMT
- [816e607](../../commit/816e607) [added] validation params to ValidationError
## v0.18.0 - Sat, 23 Apr 2016 01:20:27 GMT
- [f827822](../../commit/f827822) [changed] validate() on objects won't cast nested schema with strict()
## v0.17.6 - Thu, 21 Apr 2016 14:59:59 GMT
- [139dd24](../../commit/139dd24) [changed] lazy qualifies as a yup schema
## v0.17.5 - Thu, 21 Apr 2016 11:20:16 GMT
- [c553cc0](../../commit/c553cc0) [added] options to lazy resolve
## v0.17.4 - Wed, 20 Apr 2016 14:15:39 GMT
## v0.17.3 - Tue, 19 Apr 2016 20:24:09 GMT
- [6c309e4](../../commit/6c309e4) [fixed] array.ensure()
## v0.17.2 - Tue, 19 Apr 2016 16:46:54 GMT
## v0.17.1 - Thu, 14 Apr 2016 19:12:22 GMT
- [ab78f54](../../commit/ab78f54) [fixed] reach with lazy()
## v0.17.0 - Thu, 14 Apr 2016 17:13:50 GMT
- [6e9046b](../../commit/6e9046b) [changed] clean up interface, added lazy(), and fixed object strict semantics
## v0.16.5 - Tue, 12 Apr 2016 13:36:38 GMT
- [c3b613b](../../commit/c3b613b) [added] strip() method for objects
- [68fc010](../../commit/68fc010) [added] array.of shorthand
## v0.16.4 - Sat, 09 Apr 2016 20:13:13 GMT
- [f30d1e3](../../commit/f30d1e3) [fixed] bug in date min/max with ref
## v0.16.3 - Thu, 07 Apr 2016 19:13:23 GMT
## v0.16.2 - Thu, 07 Apr 2016 17:57:44 GMT
- [83c0656](../../commit/83c0656) [added] meta() and describe()
## v0.16.1 - Tue, 05 Apr 2016 20:56:45 GMT
- [9d70a7b](../../commit/9d70a7b) [changed] doesn't throw when context is missing.
- [594fa53](../../commit/594fa53) [changed] added reach error
## v0.16.0 - Tue, 05 Apr 2016 20:17:40 GMT
- [75739b8](../../commit/75739b8) [added] context sensitive reach()
## v0.15.0 - Tue, 29 Mar 2016 14:56:15 GMT
- [3ae5fdc](../../commit/3ae5fdc) [changed] `null` is not considered an empty value for isValid
- [9eb42c6](../../commit/9eb42c6) [added] refs!
## v0.14.2 - Tue, 29 Mar 2016 14:48:37 GMT
## v0.14.1 - Tue, 16 Feb 2016 19:51:25 GMT
- [ff19720](../../commit/ff19720) [fixed] noUnknown and stripUnknown work and propagate to children
## v0.14.0 - Mon, 08 Feb 2016 16:17:40 GMT
- [86b6446](../../commit/86b6446) [fixed] camelCase should maintain leading underscores
## v0.13.0 - Mon, 01 Feb 2016 20:49:40 GMT
- [335eb18](../../commit/335eb18) [fixed] pass options to array sub schema
- [f7f631d](../../commit/f7f631d) [changed] oneOf doesn't include empty values
- [0a7b2d4](../../commit/0a7b2d4) [fixed] type and whitelist/blacklist checks threw inconsistent errors
- [1274a45](../../commit/1274a45) [changed] required() to non-exclusive
## v0.12.0 - Tue, 12 Jan 2016 19:12:18 GMT
- [5bc250f](../../commit/5bc250f) [changed] don't clone unspecified object keys
- [069c6fd](../../commit/069c6fd) [added] withMutation() method
- [e1d4891](../../commit/e1d4891) [fixed] don't alias non existent fields
## v0.11.0 - Sun, 08 Nov 2015 17:17:09 GMT
- [686f6b1](../../commit/686f6b1) [changed] concat() allows mixing "mixed" and other type
## 0.9.0
**breaking**
- `test` functions are no longer passed `path` and `context` as arguments, Instead they are now values on `this` inside the test function.
- test functions are longer called with the schema as their `this` value, use `this.schema` instead.
**other changes**
- test functions are call with with a new context object, including, options, parent and `createError` for dynamically altering validation errors.
## 0.8.3
- document `stripUnknown`
- add `recursive` option
- add `noUnknown()` test to objects
## 0.8.2
- default for objects now adds keys for all fields, not just fields with non empty defaults
## 0.8.1
- bug fix
## 0.8.0
**breaking**
- `test` functions are now passed `path` and `context` values along with the field value. Only breaks if using the callback style of defining custom validations
## 0.7.0
**breaking**
- the `validation()` method has been renamed to `test()` and has a new signature requiring a `name` argument
- exclusive validations now trump the previous one instead of defering to it e.g: `string().max(10).max(15)` has a max of `15` instead of `10`
**other changes**
- expose advanced signature for custom validation tests, gives finer grained control over how tests are added
- added the `abortEarly` (default: `true`) option
- transforms are passed an addition parameter: 'originalValue' you allow recovering from a bad transform further up the chain (provided no one mutated the value)
## 0.6.3
- fix `concat()` method and add tests
## 0.6.2
- fix validations where nullable fields were failing due to `null` values e.g `string.max()`
## 0.6.1
- fix export error
## 0.6.0
**breaking**
- Removed the `extend` and `create` methods. Use whatever javascript inheritance patterns you want instead.
- the resolution order of defaults and coercions has changed. as well as the general handling of `null` values.
- Number: `null` will coerce to `false` when `nullable()` is not specified. `NaN` values will now fail `isType()` checks
- String: `null` will coerce to `''` when `nullable()` is not specified
- Date: Invalid dates will not be coerced to `null`, but left as invalid date, This is probably not a problem for anyone as invalid dates will also fail `isType()` checks
- default values are cloned everytime they are returned, so it is impossible to share references to defaults across schemas. No one should be doing that anyway
- stopped pretending that using schemas as conditions in `when()` actually worked (it didn't)
**other changes**
- `transform()` now passes the original value to each transformer. Allowing you to recover from a bad transform.
- added the `equals()` alias for `oneOf`
-
## 0.5.0
**breaking**
- isValid is now async, provide a node style callback, or use the promise the method returns to read the validity. This change allows for more robust validations, specifically remote ones for client code (or db queries for server code). The cast method is still, and will remain, synchronous.
-
**other changes**
- added validate method (also async) which resolves to the value, and rejects with a new ValidationError

21
server/node_modules/yup/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Jason Quense
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1222
server/node_modules/yup/README.md generated vendored Normal file

File diff suppressed because it is too large Load Diff

26
server/node_modules/yup/es/Condition.d.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import Reference from './Reference';
import { SchemaLike } from './types';
export interface ConditionBuilder<T extends SchemaLike> {
(this: T, value: any, schema: T): SchemaLike;
(v1: any, v2: any, schema: T): SchemaLike;
(v1: any, v2: any, v3: any, schema: T): SchemaLike;
(v1: any, v2: any, v3: any, v4: any, schema: T): SchemaLike;
}
export declare type ConditionConfig<T extends SchemaLike> = {
is: any | ((...values: any[]) => boolean);
then?: SchemaLike | ((schema: T) => SchemaLike);
otherwise?: SchemaLike | ((schema: T) => SchemaLike);
};
export declare type ConditionOptions<T extends SchemaLike> = ConditionBuilder<T> | ConditionConfig<T>;
export declare type ResolveOptions<TContext = any> = {
value?: any;
parent?: any;
context?: TContext;
};
declare class Condition<T extends SchemaLike = SchemaLike> {
refs: Reference[];
fn: ConditionBuilder<T>;
constructor(refs: Reference[], options: ConditionOptions<T>);
resolve(base: T, options: ResolveOptions): any;
}
export default Condition;

43
server/node_modules/yup/es/Condition.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
import has from 'lodash/has';
import isSchema from './util/isSchema';
class Condition {
constructor(refs, options) {
this.refs = refs;
this.refs = refs;
if (typeof options === 'function') {
this.fn = options;
return;
}
if (!has(options, 'is')) throw new TypeError('`is:` is required for `when()` conditions');
if (!options.then && !options.otherwise) throw new TypeError('either `then:` or `otherwise:` is required for `when()` conditions');
let {
is,
then,
otherwise
} = options;
let check = typeof is === 'function' ? is : (...values) => values.every(value => value === is);
this.fn = function (...args) {
let options = args.pop();
let schema = args.pop();
let branch = check(...args) ? then : otherwise;
if (!branch) return undefined;
if (typeof branch === 'function') return branch(schema);
return schema.concat(branch.resolve(options));
};
}
resolve(base, options) {
let values = this.refs.map(ref => ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context));
let schema = this.fn.apply(base, values.concat(base, options));
if (schema === undefined || schema === base) return base;
if (!isSchema(schema)) throw new TypeError('conditions must return a schema object');
return schema.resolve(options);
}
}
export default Condition;

28
server/node_modules/yup/es/Lazy.d.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import type { Callback, ValidateOptions } from './types';
import type { ResolveOptions } from './Condition';
import type { AnySchema, CastOptions } from './schema';
import { TypedSchema, TypeOf } from './util/types';
declare type ContextOf<T> = T extends AnySchema<any, infer C> ? C : never;
export declare type LazyBuilder<T extends AnySchema = any> = (value: any, options: ResolveOptions) => T;
export declare function create<T extends AnySchema>(builder: LazyBuilder<T>): Lazy<T, ContextOf<T>>;
export declare type LazyReturnValue<T> = T extends Lazy<infer TSchema> ? TSchema : never;
export declare type LazyType<T> = LazyReturnValue<T> extends TypedSchema ? TypeOf<LazyReturnValue<T>> : never;
declare class Lazy<T extends AnySchema, TContext = ContextOf<T>> implements TypedSchema {
private builder;
type: "lazy";
__isYupSchema__: boolean;
readonly __inputType: T['__inputType'];
readonly __outputType: T['__outputType'];
constructor(builder: LazyBuilder<T>);
private _resolve;
resolve(options: ResolveOptions<TContext>): T;
cast(value: any, options?: CastOptions<TContext>): T['__inputType'];
validate(value: any, options?: ValidateOptions, maybeCb?: Callback): T['__outputType'];
validateSync(value: any, options?: ValidateOptions<TContext>): T['__outputType'];
validateAt(path: string, value: any, options?: ValidateOptions<TContext>): Promise<any>;
validateSyncAt(path: string, value: any, options?: ValidateOptions<TContext>): any;
describe(): any;
isValid(value: any, options?: ValidateOptions<TContext>): Promise<boolean>;
isValidSync(value: any, options?: ValidateOptions<TContext>): boolean;
}
export default Lazy;

59
server/node_modules/yup/es/Lazy.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
import isSchema from './util/isSchema';
export function create(builder) {
return new Lazy(builder);
}
class Lazy {
constructor(builder) {
this.type = 'lazy';
this.__isYupSchema__ = true;
this._resolve = (value, options = {}) => {
let schema = this.builder(value, options);
if (!isSchema(schema)) throw new TypeError('lazy() functions must return a valid schema');
return schema.resolve(options);
};
this.builder = builder;
}
resolve(options) {
return this._resolve(options.value, options);
}
cast(value, options) {
return this._resolve(value, options).cast(value, options);
}
validate(value, options, maybeCb) {
// @ts-expect-error missing public callback on type
return this._resolve(value, options).validate(value, options, maybeCb);
}
validateSync(value, options) {
return this._resolve(value, options).validateSync(value, options);
}
validateAt(path, value, options) {
return this._resolve(value, options).validateAt(path, value, options);
}
validateSyncAt(path, value, options) {
return this._resolve(value, options).validateSyncAt(path, value, options);
}
describe() {
return null;
}
isValid(value, options) {
return this._resolve(value, options).isValid(value, options);
}
isValidSync(value, options) {
return this._resolve(value, options).isValidSync(value, options);
}
}
export default Lazy;

32
server/node_modules/yup/es/Reference.d.ts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import type { SchemaRefDescription } from './schema';
export declare type ReferenceOptions<TValue = unknown> = {
map?: (value: unknown) => TValue;
};
export declare function create<TValue = unknown>(key: string, options?: ReferenceOptions<TValue>): Reference<TValue>;
export default class Reference<TValue = unknown> {
readonly key: string;
readonly isContext: boolean;
readonly isValue: boolean;
readonly isSibling: boolean;
readonly path: any;
readonly getter: (data: unknown) => unknown;
readonly map?: (value: unknown) => TValue;
readonly __isYupRef: boolean;
constructor(key: string, options?: ReferenceOptions<TValue>);
getValue(value: any, parent?: {}, context?: {}): TValue;
/**
*
* @param {*} value
* @param {Object} options
* @param {Object=} options.context
* @param {Object=} options.parent
*/
cast(value: any, options?: {
parent?: {};
context?: {};
}): TValue;
resolve(): this;
describe(): SchemaRefDescription;
toString(): string;
static isRef(value: any): value is Reference;
}

63
server/node_modules/yup/es/Reference.js generated vendored Normal file
View File

@@ -0,0 +1,63 @@
import { getter } from 'property-expr';
const prefixes = {
context: '$',
value: '.'
};
export function create(key, options) {
return new Reference(key, options);
}
export default class Reference {
constructor(key, options = {}) {
if (typeof key !== 'string') throw new TypeError('ref must be a string, got: ' + key);
this.key = key.trim();
if (key === '') throw new TypeError('ref must be a non-empty string');
this.isContext = this.key[0] === prefixes.context;
this.isValue = this.key[0] === prefixes.value;
this.isSibling = !this.isContext && !this.isValue;
let prefix = this.isContext ? prefixes.context : this.isValue ? prefixes.value : '';
this.path = this.key.slice(prefix.length);
this.getter = this.path && getter(this.path, true);
this.map = options.map;
}
getValue(value, parent, context) {
let result = this.isContext ? context : this.isValue ? value : parent;
if (this.getter) result = this.getter(result || {});
if (this.map) result = this.map(result);
return result;
}
/**
*
* @param {*} value
* @param {Object} options
* @param {Object=} options.context
* @param {Object=} options.parent
*/
cast(value, options) {
return this.getValue(value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context);
}
resolve() {
return this;
}
describe() {
return {
type: 'ref',
key: this.key
};
}
toString() {
return `Ref(${this.key})`;
}
static isRef(value) {
return value && value.__isYupRef;
}
} // @ts-ignore
Reference.prototype.__isYupRef = true;

13
server/node_modules/yup/es/ValidationError.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
declare type Params = Record<string, unknown>;
export default class ValidationError extends Error {
value: any;
path?: string;
type?: string;
errors: string[];
params?: Params;
inner: ValidationError[];
static formatError(message: string | ((params: Params) => string) | unknown, params: Params): any;
static isError(err: any): err is ValidationError;
constructor(errorOrErrors: string | ValidationError | ValidationError[], value?: any, field?: string, type?: string);
}
export {};

41
server/node_modules/yup/es/ValidationError.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import printValue from './util/printValue';
import toArray from './util/toArray';
let strReg = /\$\{\s*(\w+)\s*\}/g;
export default class ValidationError extends Error {
static formatError(message, params) {
const path = params.label || params.path || 'this';
if (path !== params.path) params = _extends({}, params, {
path
});
if (typeof message === 'string') return message.replace(strReg, (_, key) => printValue(params[key]));
if (typeof message === 'function') return message(params);
return message;
}
static isError(err) {
return err && err.name === 'ValidationError';
}
constructor(errorOrErrors, value, field, type) {
super();
this.name = 'ValidationError';
this.value = value;
this.path = field;
this.type = type;
this.errors = [];
this.inner = [];
toArray(errorOrErrors).forEach(err => {
if (ValidationError.isError(err)) {
this.errors.push(...err.errors);
this.inner = this.inner.concat(err.inner.length ? err.inner : err);
} else {
this.errors.push(err);
}
});
this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0];
if (Error.captureStackTrace) Error.captureStackTrace(this, ValidationError);
}
}

66
server/node_modules/yup/es/array.d.ts generated vendored Normal file
View File

@@ -0,0 +1,66 @@
import { MixedLocale } from './locale';
import type { AnyObject, InternalOptions, Callback, Message, Maybe, Preserve, Optionals } from './types';
import type Reference from './Reference';
import { Asserts, Defined, If, Thunk, TypeOf } from './util/types';
import BaseSchema, { AnySchema, SchemaInnerTypeDescription, SchemaSpec } from './schema';
import Lazy from './Lazy';
export declare type RejectorFn = (value: any, index: number, array: any[]) => boolean;
export declare function create<C extends AnyObject = AnyObject, T extends AnySchema | Lazy<any, any> = AnySchema>(type?: T): OptionalArraySchema<T, C, TypeOf<T>[] | undefined>;
export declare namespace create {
var prototype: ArraySchema<any, any, any, any>;
}
export default class ArraySchema<T extends AnySchema | Lazy<any, any>, C extends AnyObject = AnyObject, TIn extends Maybe<TypeOf<T>[]> = TypeOf<T>[] | undefined, TOut extends Maybe<Asserts<T>[]> = Asserts<T>[] | Optionals<TIn>> extends BaseSchema<TIn, C, TOut> {
innerType?: T;
constructor(type?: T);
protected _typeCheck(v: any): v is NonNullable<TIn>;
private get _subType();
protected _cast(_value: any, _opts: InternalOptions<C>): any;
protected _validate(_value: any, options: InternalOptions<C> | undefined, callback: Callback): void;
clone(spec?: SchemaSpec<any>): this;
concat<TOther extends ArraySchema<any, any, any, any>>(schema: TOther): TOther;
concat(schema: any): any;
of<TInner extends AnySchema>(schema: TInner): ArraySchema<TInner>;
length(length: number | Reference<number>, message?: Message<{
length: number;
}>): this;
min(min: number | Reference<number>, message?: Message<{
min: number;
}>): this;
max(max: number | Reference<number>, message?: Message<{
max: number;
}>): this;
ensure(): RequiredArraySchema<T, C, TIn>;
compact(rejector?: RejectorFn): this;
describe(): SchemaInnerTypeDescription;
nullable(isNullable?: true): ArraySchema<T, C, TIn | null>;
nullable(isNullable: false): ArraySchema<T, C, Exclude<TIn, null>>;
defined(): DefinedArraySchema<T, C, TIn>;
required(msg?: MixedLocale['required']): RequiredArraySchema<T, C, TIn>;
}
export interface DefinedArraySchema<T extends AnySchema | Lazy<any, any>, TContext extends AnyObject, TIn extends Maybe<TypeOf<T>[]>> extends ArraySchema<T, TContext, TIn, Asserts<T>[] | Preserve<TIn, null>> {
default<D extends Maybe<TIn>>(def: Thunk<D>): If<D, DefinedArraySchema<T, TContext, TIn | undefined>, DefinedArraySchema<T, TContext, Defined<TIn>>>;
defined(msg?: MixedLocale['defined']): this;
required(msg?: MixedLocale['required']): RequiredArraySchema<T, TContext, TIn>;
optional(): ArraySchema<T, TContext, TIn>;
notRequired(): ArraySchema<T, TContext, TIn>;
nullable(isNullable?: true): DefinedArraySchema<T, TContext, TIn | null>;
nullable(isNullable: false): RequiredArraySchema<T, TContext, Exclude<TIn, null>>;
}
export interface RequiredArraySchema<T extends AnySchema | Lazy<any, any>, TContext extends AnyObject, TIn extends Maybe<TypeOf<T>[]>> extends ArraySchema<T, TContext, TIn, Asserts<T>[]> {
default<D extends Maybe<TIn>>(def: Thunk<D>): If<D, RequiredArraySchema<T, TContext, TIn | undefined>, RequiredArraySchema<T, TContext, Defined<TIn>>>;
defined(msg?: MixedLocale['defined']): DefinedArraySchema<T, TContext, TIn>;
required(msg?: MixedLocale['required']): this;
optional(): ArraySchema<T, TContext, TIn>;
notRequired(): ArraySchema<T, TContext, TIn>;
nullable(isNullable?: true): RequiredArraySchema<T, TContext, TIn | null>;
nullable(isNullable: false): RequiredArraySchema<T, TContext, Exclude<TIn, null>>;
}
export interface OptionalArraySchema<T extends AnySchema | Lazy<any, any>, TContext extends AnyObject = AnyObject, TIn extends Maybe<TypeOf<T>[]> = TypeOf<T>[] | undefined> extends ArraySchema<T, TContext, TIn> {
default<D extends Maybe<TIn>>(def: Thunk<D>): If<D, ArraySchema<T, TContext, TIn | undefined>, ArraySchema<T, TContext, Defined<TIn>>>;
defined(msg?: MixedLocale['defined']): DefinedArraySchema<T, TContext, TIn>;
required(msg?: MixedLocale['required']): RequiredArraySchema<T, TContext, TIn>;
optional(): ArraySchema<T, TContext, TIn>;
notRequired(): ArraySchema<T, TContext, TIn>;
nullable(isNullable?: true): OptionalArraySchema<T, TContext, TIn | null>;
nullable(isNullable: false): OptionalArraySchema<T, TContext, Exclude<TIn, null>>;
}

224
server/node_modules/yup/es/array.js generated vendored Normal file
View File

@@ -0,0 +1,224 @@
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import isAbsent from './util/isAbsent';
import isSchema from './util/isSchema';
import printValue from './util/printValue';
import { array as locale } from './locale';
import runTests from './util/runTests';
import ValidationError from './ValidationError';
import BaseSchema from './schema';
export function create(type) {
return new ArraySchema(type);
}
export default class ArraySchema extends BaseSchema {
constructor(type) {
super({
type: 'array'
}); // `undefined` specifically means uninitialized, as opposed to
// "no subtype"
this.innerType = type;
this.withMutation(() => {
this.transform(function (values) {
if (typeof values === 'string') try {
values = JSON.parse(values);
} catch (err) {
values = null;
}
return this.isType(values) ? values : null;
});
});
}
_typeCheck(v) {
return Array.isArray(v);
}
get _subType() {
return this.innerType;
}
_cast(_value, _opts) {
const value = super._cast(_value, _opts); //should ignore nulls here
if (!this._typeCheck(value) || !this.innerType) return value;
let isChanged = false;
const castArray = value.map((v, idx) => {
const castElement = this.innerType.cast(v, _extends({}, _opts, {
path: `${_opts.path || ''}[${idx}]`
}));
if (castElement !== v) {
isChanged = true;
}
return castElement;
});
return isChanged ? castArray : value;
}
_validate(_value, options = {}, callback) {
var _options$abortEarly, _options$recursive;
let errors = [];
let sync = options.sync;
let path = options.path;
let innerType = this.innerType;
let endEarly = (_options$abortEarly = options.abortEarly) != null ? _options$abortEarly : this.spec.abortEarly;
let recursive = (_options$recursive = options.recursive) != null ? _options$recursive : this.spec.recursive;
let originalValue = options.originalValue != null ? options.originalValue : _value;
super._validate(_value, options, (err, value) => {
if (err) {
if (!ValidationError.isError(err) || endEarly) {
return void callback(err, value);
}
errors.push(err);
}
if (!recursive || !innerType || !this._typeCheck(value)) {
callback(errors[0] || null, value);
return;
}
originalValue = originalValue || value; // #950 Ensure that sparse array empty slots are validated
let tests = new Array(value.length);
for (let idx = 0; idx < value.length; idx++) {
let item = value[idx];
let path = `${options.path || ''}[${idx}]`; // object._validate note for isStrict explanation
let innerOptions = _extends({}, options, {
path,
strict: true,
parent: value,
index: idx,
originalValue: originalValue[idx]
});
tests[idx] = (_, cb) => innerType.validate(item, innerOptions, cb);
}
runTests({
sync,
path,
value,
errors,
endEarly,
tests
}, callback);
});
}
clone(spec) {
const next = super.clone(spec);
next.innerType = this.innerType;
return next;
}
concat(schema) {
let next = super.concat(schema);
next.innerType = this.innerType;
if (schema.innerType) next.innerType = next.innerType ? // @ts-expect-error Lazy doesn't have concat()
next.innerType.concat(schema.innerType) : schema.innerType;
return next;
}
of(schema) {
// FIXME: this should return a new instance of array without the default to be
let next = this.clone();
if (!isSchema(schema)) throw new TypeError('`array.of()` sub-schema must be a valid yup schema not: ' + printValue(schema)); // FIXME(ts):
next.innerType = schema;
return next;
}
length(length, message = locale.length) {
return this.test({
message,
name: 'length',
exclusive: true,
params: {
length
},
test(value) {
return isAbsent(value) || value.length === this.resolve(length);
}
});
}
min(min, message) {
message = message || locale.min;
return this.test({
message,
name: 'min',
exclusive: true,
params: {
min
},
// FIXME(ts): Array<typeof T>
test(value) {
return isAbsent(value) || value.length >= this.resolve(min);
}
});
}
max(max, message) {
message = message || locale.max;
return this.test({
message,
name: 'max',
exclusive: true,
params: {
max
},
test(value) {
return isAbsent(value) || value.length <= this.resolve(max);
}
});
}
ensure() {
return this.default(() => []).transform((val, original) => {
// We don't want to return `null` for nullable schema
if (this._typeCheck(val)) return val;
return original == null ? [] : [].concat(original);
});
}
compact(rejector) {
let reject = !rejector ? v => !!v : (v, i, a) => !rejector(v, i, a);
return this.transform(values => values != null ? values.filter(reject) : values);
}
describe() {
let base = super.describe();
if (this.innerType) base.innerType = this.innerType.describe();
return base;
}
nullable(isNullable = true) {
return super.nullable(isNullable);
}
defined() {
return super.defined();
}
required(msg) {
return super.required(msg);
}
}
create.prototype = ArraySchema.prototype; //
// Interfaces
//

42
server/node_modules/yup/es/boolean.d.ts generated vendored Normal file
View File

@@ -0,0 +1,42 @@
import BaseSchema from './schema';
import type { MixedLocale } from './locale';
import type { AnyObject, Maybe, Optionals } from './types';
import type { Defined } from './util/types';
export declare function create(): BooleanSchema<boolean | undefined, Record<string, any>, boolean | undefined>;
export declare namespace create {
var prototype: BooleanSchema<any, any, any>;
}
export default class BooleanSchema<TType extends Maybe<boolean> = boolean | undefined, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
constructor();
protected _typeCheck(v: any): v is NonNullable<TType>;
isTrue(message?: string | Record<string | number | symbol, unknown> | ((params: import("./types").MessageParams) => unknown) | undefined): BooleanSchema<TType | true, TContext, true | Optionals<TOut>>;
isFalse(message?: string | Record<string | number | symbol, unknown> | ((params: import("./types").MessageParams) => unknown) | undefined): BooleanSchema<TType | false, TContext, false | Optionals<TOut>>;
}
export default interface BooleanSchema<TType extends Maybe<boolean>, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
concat<TOther extends BooleanSchema<any, any, any>>(schema: TOther): TOther;
default<TNextDefault extends Maybe<TType>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? BooleanSchema<TType | undefined, TContext> : BooleanSchema<Defined<TType>, TContext>;
defined(msg?: MixedLocale['defined']): DefinedBooleanSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredBooleanSchema<TType, TContext>;
optional(): BooleanSchema<TType, TContext>;
notRequired(): BooleanSchema<TType, TContext>;
nullable(isNullable?: true): BooleanSchema<TType | null>;
nullable(isNullable: false): BooleanSchema<Exclude<TType, null>>;
}
export interface DefinedBooleanSchema<TType extends Maybe<boolean>, TContext extends AnyObject = AnyObject> extends BooleanSchema<TType, TContext, Defined<TType>> {
default<TNextDefault extends Maybe<TType>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? BooleanSchema<TType | undefined, TContext> : BooleanSchema<Defined<TType>, TContext>;
defined(msg?: MixedLocale['defined']): DefinedBooleanSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredBooleanSchema<TType, TContext>;
optional(): BooleanSchema<TType, TContext>;
notRequired(): BooleanSchema<TType, TContext>;
nullable(isNullable?: true): DefinedBooleanSchema<TType | null>;
nullable(isNullable: false): DefinedBooleanSchema<Exclude<TType, null>>;
}
export interface RequiredBooleanSchema<TType extends Maybe<boolean>, TContext extends AnyObject = AnyObject> extends BooleanSchema<TType, TContext, NonNullable<TType>> {
default<TNextDefault extends Maybe<TType>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? BooleanSchema<TType | undefined, TContext> : BooleanSchema<Defined<TType>, TContext>;
defined(msg?: MixedLocale['defined']): DefinedBooleanSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredBooleanSchema<TType, TContext>;
optional(): BooleanSchema<TType, TContext>;
notRequired(): BooleanSchema<TType, TContext>;
nullable(isNullable?: true): RequiredBooleanSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredBooleanSchema<Exclude<TType, null>, TContext>;
}

62
server/node_modules/yup/es/boolean.js generated vendored Normal file
View File

@@ -0,0 +1,62 @@
import BaseSchema from './schema';
import { boolean as locale } from './locale';
import isAbsent from './util/isAbsent';
export function create() {
return new BooleanSchema();
}
export default class BooleanSchema extends BaseSchema {
constructor() {
super({
type: 'boolean'
});
this.withMutation(() => {
this.transform(function (value) {
if (!this.isType(value)) {
if (/^(true|1)$/i.test(String(value))) return true;
if (/^(false|0)$/i.test(String(value))) return false;
}
return value;
});
});
}
_typeCheck(v) {
if (v instanceof Boolean) v = v.valueOf();
return typeof v === 'boolean';
}
isTrue(message = locale.isValue) {
return this.test({
message,
name: 'is-value',
exclusive: true,
params: {
value: 'true'
},
test(value) {
return isAbsent(value) || value === true;
}
});
}
isFalse(message = locale.isValue) {
return this.test({
message,
name: 'is-value',
exclusive: true,
params: {
value: 'false'
},
test(value) {
return isAbsent(value) || value === false;
}
});
}
}
create.prototype = BooleanSchema.prototype;

50
server/node_modules/yup/es/date.d.ts generated vendored Normal file
View File

@@ -0,0 +1,50 @@
import { MixedLocale } from './locale';
import Ref from './Reference';
import type { AnyObject, Maybe } from './types';
import type { Defined, If, Thunk } from './util/types';
import BaseSchema from './schema';
export declare function create(): DateSchema<Date | undefined, Record<string, any>, Date | undefined>;
export declare namespace create {
var prototype: DateSchema<any, any, any>;
var INVALID_DATE: Date;
}
export default class DateSchema<TType extends Maybe<Date> = Date | undefined, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
static INVALID_DATE: Date;
constructor();
protected _typeCheck(v: any): v is NonNullable<TType>;
private prepareParam;
min(min: unknown | Ref<Date>, message?: import("./types").Message<{
min: string | Date;
}>): this;
max(max: unknown | Ref, message?: import("./types").Message<{
max: string | Date;
}>): this;
}
export default interface DateSchema<TType extends Maybe<Date>, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
concat<TOther extends DateSchema<any, any, any>>(schema: TOther): TOther;
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, DateSchema<TType | undefined, TContext>, DateSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): DefinedDateSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredDateSchema<TType, TContext>;
optional(): DateSchema<TType, TContext>;
notRequired(): DateSchema<TType, TContext>;
nullable(isNullable?: true): DateSchema<TType | null, TContext>;
nullable(isNullable: false): DateSchema<Exclude<TType, null>, TContext>;
}
export interface DefinedDateSchema<TType extends Maybe<Date>, TContext extends AnyObject = AnyObject> extends DateSchema<TType, TContext, Defined<TType>> {
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, DefinedDateSchema<TType | undefined, TContext>, DefinedDateSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): this;
required(msg?: MixedLocale['required']): RequiredDateSchema<TType, TContext>;
optional(): DateSchema<TType, TContext>;
notRequired(): DateSchema<TType, TContext>;
nullable(isNullable?: true): RequiredDateSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredDateSchema<Exclude<TType, null>, TContext>;
}
export interface RequiredDateSchema<TType extends Maybe<Date>, TContext extends AnyObject = AnyObject> extends DateSchema<TType, TContext, NonNullable<TType>> {
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, RequiredDateSchema<TType | undefined, TContext>, RequiredDateSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): DefinedDateSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredDateSchema<TType, TContext>;
optional(): DateSchema<TType, TContext>;
notRequired(): DateSchema<TType, TContext>;
nullable(isNullable?: true): RequiredDateSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredDateSchema<Exclude<TType, null>, TContext>;
}

84
server/node_modules/yup/es/date.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
// @ts-ignore
import isoParse from './util/isodate';
import { date as locale } from './locale';
import isAbsent from './util/isAbsent';
import Ref from './Reference';
import BaseSchema from './schema';
let invalidDate = new Date('');
let isDate = obj => Object.prototype.toString.call(obj) === '[object Date]';
export function create() {
return new DateSchema();
}
export default class DateSchema extends BaseSchema {
constructor() {
super({
type: 'date'
});
this.withMutation(() => {
this.transform(function (value) {
if (this.isType(value)) return value;
value = isoParse(value); // 0 is a valid timestamp equivalent to 1970-01-01T00:00:00Z(unix epoch) or before.
return !isNaN(value) ? new Date(value) : invalidDate;
});
});
}
_typeCheck(v) {
return isDate(v) && !isNaN(v.getTime());
}
prepareParam(ref, name) {
let param;
if (!Ref.isRef(ref)) {
let cast = this.cast(ref);
if (!this._typeCheck(cast)) throw new TypeError(`\`${name}\` must be a Date or a value that can be \`cast()\` to a Date`);
param = cast;
} else {
param = ref;
}
return param;
}
min(min, message = locale.min) {
let limit = this.prepareParam(min, 'min');
return this.test({
message,
name: 'min',
exclusive: true,
params: {
min
},
test(value) {
return isAbsent(value) || value >= this.resolve(limit);
}
});
}
max(max, message = locale.max) {
var limit = this.prepareParam(max, 'max');
return this.test({
message,
name: 'max',
exclusive: true,
params: {
max
},
test(value) {
return isAbsent(value) || value <= this.resolve(limit);
}
});
}
}
DateSchema.INVALID_DATE = invalidDate;
create.prototype = DateSchema.prototype;
create.INVALID_DATE = invalidDate;

10
server/node_modules/yup/es/globals.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
declare module 'lodash/has' {
function has<T extends {}, Key extends PropertyKey>(
obj: T,
prop: Key,
): obj is T & Record<Key, unknown> {
return has(obj, prop);
}
export default has;
}

28
server/node_modules/yup/es/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import MixedSchema, { create as mixedCreate } from './mixed';
import BooleanSchema, { create as boolCreate } from './boolean';
import StringSchema, { create as stringCreate } from './string';
import NumberSchema, { create as numberCreate } from './number';
import DateSchema, { create as dateCreate } from './date';
import ObjectSchema, { AnyObject, create as objectCreate } from './object';
import ArraySchema, { create as arrayCreate } from './array';
import { create as refCreate } from './Reference';
import Lazy, { create as lazyCreate } from './Lazy';
import ValidationError from './ValidationError';
import reach from './util/reach';
import isSchema from './util/isSchema';
import setLocale from './setLocale';
import BaseSchema, { AnySchema } from './schema';
import type { TypeOf, Asserts } from './util/types';
import { Maybe } from './types';
declare function addMethod<T extends AnySchema>(schemaType: (...arg: any[]) => T, name: string, fn: (this: T, ...args: any[]) => T): void;
declare function addMethod<T extends new (...args: any) => AnySchema>(schemaType: T, name: string, fn: (this: InstanceType<T>, ...args: any[]) => InstanceType<T>): void;
declare type ObjectSchemaOf<T extends AnyObject> = ObjectSchema<{
[k in keyof T]-?: T[k] extends Array<infer E> ? ArraySchema<SchemaOf<E> | Lazy<SchemaOf<E>>> : T[k] extends AnyObject ? // we can't use ObjectSchema<{ []: SchemaOf<T[k]> }> b/c TS produces a union of two schema
ObjectSchemaOf<T[k]> | ObjectSchemaOf<Lazy<T[k]>> : BaseSchema<Maybe<T[k]>, AnyObject, T[k]>;
}>;
declare type SchemaOf<T> = T extends Array<infer E> ? ArraySchema<SchemaOf<E> | Lazy<SchemaOf<E>>> : T extends AnyObject ? ObjectSchemaOf<T> : BaseSchema<Maybe<T>, AnyObject, T>;
export declare type AnyObjectSchema = ObjectSchema<any, any, any, any>;
export type { SchemaOf, TypeOf, Asserts, Asserts as InferType, AnySchema };
export { mixedCreate as mixed, boolCreate as bool, boolCreate as boolean, stringCreate as string, numberCreate as number, dateCreate as date, objectCreate as object, arrayCreate as array, refCreate as ref, lazyCreate as lazy, reach, isSchema, addMethod, setLocale, ValidationError, };
export { BaseSchema, MixedSchema, BooleanSchema, StringSchema, NumberSchema, DateSchema, ObjectSchema, ArraySchema, };
export type { CreateErrorOptions, TestContext, TestFunction, TestOptions, TestConfig, } from './util/createValidation';

24
server/node_modules/yup/es/index.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import MixedSchema, { create as mixedCreate } from './mixed';
import BooleanSchema, { create as boolCreate } from './boolean';
import StringSchema, { create as stringCreate } from './string';
import NumberSchema, { create as numberCreate } from './number';
import DateSchema, { create as dateCreate } from './date';
import ObjectSchema, { create as objectCreate } from './object';
import ArraySchema, { create as arrayCreate } from './array';
import { create as refCreate } from './Reference';
import { create as lazyCreate } from './Lazy';
import ValidationError from './ValidationError';
import reach from './util/reach';
import isSchema from './util/isSchema';
import setLocale from './setLocale';
import BaseSchema from './schema';
function addMethod(schemaType, name, fn) {
if (!schemaType || !isSchema(schemaType.prototype)) throw new TypeError('You must provide a yup schema constructor function');
if (typeof name !== 'string') throw new TypeError('A Method name must be provided');
if (typeof fn !== 'function') throw new TypeError('Method function must be provided');
schemaType.prototype[name] = fn;
}
export { mixedCreate as mixed, boolCreate as bool, boolCreate as boolean, stringCreate as string, numberCreate as number, dateCreate as date, objectCreate as object, arrayCreate as array, refCreate as ref, lazyCreate as lazy, reach, isSchema, addMethod, setLocale, ValidationError };
export { BaseSchema, MixedSchema, BooleanSchema, StringSchema, NumberSchema, DateSchema, ObjectSchema, ArraySchema };

94
server/node_modules/yup/es/locale.d.ts generated vendored Normal file
View File

@@ -0,0 +1,94 @@
import { Message } from './types';
export interface MixedLocale {
default?: Message;
required?: Message;
oneOf?: Message<{
values: any;
}>;
notOneOf?: Message<{
values: any;
}>;
notType?: Message;
defined?: Message;
}
export interface StringLocale {
length?: Message<{
length: number;
}>;
min?: Message<{
min: number;
}>;
max?: Message<{
max: number;
}>;
matches?: Message<{
regex: RegExp;
}>;
email?: Message<{
regex: RegExp;
}>;
url?: Message<{
regex: RegExp;
}>;
uuid?: Message<{
regex: RegExp;
}>;
trim?: Message;
lowercase?: Message;
uppercase?: Message;
}
export interface NumberLocale {
min?: Message<{
min: number;
}>;
max?: Message<{
max: number;
}>;
lessThan?: Message<{
less: number;
}>;
moreThan?: Message<{
more: number;
}>;
positive?: Message<{
more: number;
}>;
negative?: Message<{
less: number;
}>;
integer?: Message;
}
export interface DateLocale {
min?: Message<{
min: Date | string;
}>;
max?: Message<{
max: Date | string;
}>;
}
export interface ObjectLocale {
noUnknown?: Message;
}
export interface ArrayLocale {
length?: Message<{
length: number;
}>;
min?: Message<{
min: number;
}>;
max?: Message<{
max: number;
}>;
}
export interface BooleanLocale {
isValue?: Message;
}
export declare let mixed: Required<MixedLocale>;
export declare let string: Required<StringLocale>;
export declare let number: Required<NumberLocale>;
export declare let date: Required<DateLocale>;
export declare let boolean: BooleanLocale;
export declare let object: Required<ObjectLocale>;
export declare let array: Required<ArrayLocale>;
declare const _default: any;
export default _default;

68
server/node_modules/yup/es/locale.js generated vendored Normal file
View File

@@ -0,0 +1,68 @@
import printValue from './util/printValue';
export let mixed = {
default: '${path} is invalid',
required: '${path} is a required field',
oneOf: '${path} must be one of the following values: ${values}',
notOneOf: '${path} must not be one of the following values: ${values}',
notType: ({
path,
type,
value,
originalValue
}) => {
let isCast = originalValue != null && originalValue !== value;
let msg = `${path} must be a \`${type}\` type, ` + `but the final value was: \`${printValue(value, true)}\`` + (isCast ? ` (cast from the value \`${printValue(originalValue, true)}\`).` : '.');
if (value === null) {
msg += `\n If "null" is intended as an empty value be sure to mark the schema as \`.nullable()\``;
}
return msg;
},
defined: '${path} must be defined'
};
export let string = {
length: '${path} must be exactly ${length} characters',
min: '${path} must be at least ${min} characters',
max: '${path} must be at most ${max} characters',
matches: '${path} must match the following: "${regex}"',
email: '${path} must be a valid email',
url: '${path} must be a valid URL',
uuid: '${path} must be a valid UUID',
trim: '${path} must be a trimmed string',
lowercase: '${path} must be a lowercase string',
uppercase: '${path} must be a upper case string'
};
export let number = {
min: '${path} must be greater than or equal to ${min}',
max: '${path} must be less than or equal to ${max}',
lessThan: '${path} must be less than ${less}',
moreThan: '${path} must be greater than ${more}',
positive: '${path} must be a positive number',
negative: '${path} must be a negative number',
integer: '${path} must be an integer'
};
export let date = {
min: '${path} field must be later than ${min}',
max: '${path} field must be at earlier than ${max}'
};
export let boolean = {
isValue: '${path} field must be ${value}'
};
export let object = {
noUnknown: '${path} field has unspecified keys: ${unknown}'
};
export let array = {
min: '${path} field must have at least ${min} items',
max: '${path} field must have less than or equal to ${max} items',
length: '${path} must be have ${length} items'
};
export default Object.assign(Object.create(null), {
mixed,
string,
number,
date,
object,
array,
boolean
});

20
server/node_modules/yup/es/mixed.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import type { MixedLocale } from './locale';
import { AnyObject, Maybe, Optionals } from './types';
import type { Defined } from './util/types';
import BaseSchema from './schema';
export declare class MixedSchema<TType = any, TContext = AnyObject, TOut = TType> extends BaseSchema<TType, TContext, TOut> {
default<TNextDefault extends Maybe<TType>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? MixedSchema<TType | undefined, TContext> : MixedSchema<Defined<TType>, TContext>;
concat(schema: this): this;
concat<IT, IC, IO>(schema: BaseSchema<IT, IC, IO>): MixedSchema<TType | IT, TContext & IC, NonNullable<TOut> | IO | Optionals<IO>>;
defined(msg?: MixedLocale['defined']): MixedSchema<TType, TContext, Defined<TOut>>;
required(msg?: MixedLocale['required']): MixedSchema<TType, TContext, NonNullable<TOut>>;
notRequired(): MixedSchema<TType, TContext>;
nullable(isNullable?: true): MixedSchema<TType | null, TContext>;
nullable(isNullable: false): MixedSchema<Exclude<TType, null>, TContext>;
}
declare const Mixed: typeof MixedSchema;
export default Mixed;
export declare function create<TType = any>(): MixedSchema<TType | undefined, Record<string, any>, TType | undefined>;
export declare namespace create {
var prototype: MixedSchema<any, any, any>;
}

8
server/node_modules/yup/es/mixed.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import BaseSchema from './schema';
const Mixed = BaseSchema;
export default Mixed;
export function create() {
return new Mixed();
} // XXX: this is using the Base schema so that `addMethod(mixed)` works as a base class
create.prototype = Mixed.prototype;

62
server/node_modules/yup/es/number.d.ts generated vendored Normal file
View File

@@ -0,0 +1,62 @@
import { MixedLocale } from './locale';
import type { AnyObject, Maybe, Message } from './types';
import type Reference from './Reference';
import type { Defined, If, Thunk } from './util/types';
import BaseSchema from './schema';
export declare function create(): NumberSchema<number | undefined, Record<string, any>, number | undefined>;
export declare namespace create {
var prototype: NumberSchema<any, any, any>;
}
export default class NumberSchema<TType extends Maybe<number> = number | undefined, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
constructor();
protected _typeCheck(value: any): value is NonNullable<TType>;
min(min: number | Reference<number>, message?: Message<{
min: number;
}>): this;
max(max: number | Reference<number>, message?: Message<{
max: number;
}>): this;
lessThan(less: number | Reference<number>, message?: Message<{
less: number;
}>): this;
moreThan(more: number | Reference<number>, message?: Message<{
more: number;
}>): this;
positive(msg?: Message<{
more: number;
}>): this;
negative(msg?: Message<{
less: number;
}>): this;
integer(message?: Message<{}>): this;
truncate(): this;
round(method: 'ceil' | 'floor' | 'round' | 'trunc'): this;
}
export default interface NumberSchema<TType extends Maybe<number> = number | undefined, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
concat<TOther extends NumberSchema<any, any, any>>(schema: TOther): TOther;
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, NumberSchema<TType | undefined, TContext>, NumberSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): DefinedNumberSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredNumberSchema<TType, TContext>;
optional(): NumberSchema<TType, TContext>;
notRequired(): NumberSchema<TType, TContext>;
nullable(isNullable?: true): NumberSchema<TType | null, TContext>;
nullable(isNullable: false): NumberSchema<Exclude<TType, null>, TContext>;
}
export interface DefinedNumberSchema<TType extends Maybe<number>, TContext extends AnyObject = AnyObject> extends NumberSchema<TType, TContext, Defined<TType>> {
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, DefinedNumberSchema<TType | undefined, TContext>, DefinedNumberSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): this;
required(msg?: MixedLocale['required']): RequiredNumberSchema<TType, TContext>;
optional(): NumberSchema<TType, TContext>;
notRequired(): NumberSchema<TType, TContext>;
nullable(isNullable?: true): RequiredNumberSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredNumberSchema<Exclude<TType, null>, TContext>;
}
export interface RequiredNumberSchema<TType extends Maybe<number>, TContext extends AnyObject = AnyObject> extends NumberSchema<TType, TContext, NonNullable<TType>> {
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, RequiredNumberSchema<TType | undefined, TContext>, RequiredNumberSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): DefinedNumberSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredNumberSchema<TType, TContext>;
optional(): NumberSchema<TType, TContext>;
notRequired(): NumberSchema<TType, TContext>;
nullable(isNullable?: true): RequiredNumberSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredNumberSchema<Exclude<TType, null>, TContext>;
}

135
server/node_modules/yup/es/number.js generated vendored Normal file
View File

@@ -0,0 +1,135 @@
import { number as locale } from './locale';
import isAbsent from './util/isAbsent';
import BaseSchema from './schema';
let isNaN = value => value != +value;
export function create() {
return new NumberSchema();
}
export default class NumberSchema extends BaseSchema {
constructor() {
super({
type: 'number'
});
this.withMutation(() => {
this.transform(function (value) {
let parsed = value;
if (typeof parsed === 'string') {
parsed = parsed.replace(/\s/g, '');
if (parsed === '') return NaN; // don't use parseFloat to avoid positives on alpha-numeric strings
parsed = +parsed;
}
if (this.isType(parsed)) return parsed;
return parseFloat(parsed);
});
});
}
_typeCheck(value) {
if (value instanceof Number) value = value.valueOf();
return typeof value === 'number' && !isNaN(value);
}
min(min, message = locale.min) {
return this.test({
message,
name: 'min',
exclusive: true,
params: {
min
},
test(value) {
return isAbsent(value) || value >= this.resolve(min);
}
});
}
max(max, message = locale.max) {
return this.test({
message,
name: 'max',
exclusive: true,
params: {
max
},
test(value) {
return isAbsent(value) || value <= this.resolve(max);
}
});
}
lessThan(less, message = locale.lessThan) {
return this.test({
message,
name: 'max',
exclusive: true,
params: {
less
},
test(value) {
return isAbsent(value) || value < this.resolve(less);
}
});
}
moreThan(more, message = locale.moreThan) {
return this.test({
message,
name: 'min',
exclusive: true,
params: {
more
},
test(value) {
return isAbsent(value) || value > this.resolve(more);
}
});
}
positive(msg = locale.positive) {
return this.moreThan(0, msg);
}
negative(msg = locale.negative) {
return this.lessThan(0, msg);
}
integer(message = locale.integer) {
return this.test({
name: 'integer',
message,
test: val => isAbsent(val) || Number.isInteger(val)
});
}
truncate() {
return this.transform(value => !isAbsent(value) ? value | 0 : value);
}
round(method) {
var _method;
var avail = ['ceil', 'floor', 'round', 'trunc'];
method = ((_method = method) == null ? void 0 : _method.toLowerCase()) || 'round'; // this exists for symemtry with the new Math.trunc
if (method === 'trunc') return this.truncate();
if (avail.indexOf(method.toLowerCase()) === -1) throw new TypeError('Only valid options for round() are: ' + avail.join(', '));
return this.transform(value => !isAbsent(value) ? Math[method](value) : value);
}
}
create.prototype = NumberSchema.prototype; //
// Number Interfaces
//

89
server/node_modules/yup/es/object.d.ts generated vendored Normal file
View File

@@ -0,0 +1,89 @@
import { MixedLocale } from './locale';
import { InternalOptions, Callback, Maybe, Optionals, Preserve } from './types';
import type { TypedSchema, Defined } from './util/types';
import type Reference from './Reference';
import Lazy from './Lazy';
import BaseSchema, { AnySchema, SchemaObjectDescription, SchemaSpec } from './schema';
export declare type Assign<T extends {}, U extends {}> = {
[P in keyof T]: P extends keyof U ? U[P] : T[P];
} & U;
export declare type AnyObject = Record<string, any>;
export declare type ObjectShape = Record<string, AnySchema | Reference | Lazy<any, any>>;
export declare type DefaultFromShape<Shape extends ObjectShape> = {
[K in keyof Shape]: Shape[K] extends ObjectSchema<infer TShape> ? DefaultFromShape<TShape> : Shape[K] extends {
getDefault: () => infer D;
} ? Preserve<D, undefined> extends never ? Defined<D> : Preserve<D, undefined> : undefined;
};
export declare type TypeOfShape<Shape extends ObjectShape> = {
[K in keyof Shape]: Shape[K] extends TypedSchema ? Shape[K]['__inputType'] : Shape[K] extends Reference ? unknown : never;
};
export declare type AssertsShape<Shape extends ObjectShape> = {
[K in keyof Shape]: Shape[K] extends TypedSchema ? Shape[K]['__outputType'] : Shape[K] extends Reference ? unknown : never;
};
export declare type ObjectSchemaSpec = SchemaSpec<any> & {
noUnknown?: boolean;
};
export default class ObjectSchema<TShape extends ObjectShape, TContext extends AnyObject = AnyObject, TIn extends Maybe<TypeOfShape<TShape>> = TypeOfShape<TShape>, TOut extends Maybe<AssertsShape<TShape>> = AssertsShape<TShape> | Optionals<TIn>> extends BaseSchema<TIn, TContext, TOut> {
fields: TShape;
spec: ObjectSchemaSpec;
private _sortErrors;
private _nodes;
private _excludedEdges;
constructor(spec?: TShape);
protected _typeCheck(value: any): value is NonNullable<TIn>;
protected _cast(_value: any, options?: InternalOptions<TContext>): any;
protected _validate(_value: any, opts: InternalOptions<TContext> | undefined, callback: Callback): void;
clone(spec?: ObjectSchemaSpec): this;
concat<TOther extends ObjectSchema<any, any, any>>(schema: TOther): TOther extends ObjectSchema<infer S, infer C, infer IType> ? ObjectSchema<TShape & S, TContext & C, TypeOfShape<TShape & S> | Optionals<IType>> : never;
concat(schema: this): this;
getDefaultFromShape(): DefaultFromShape<TShape>;
protected _getDefault(): any;
shape<TNextShape extends ObjectShape>(additions: TNextShape, excludes?: [string, string][]): ObjectSchema<Assign<TShape, TNextShape>, TContext, TypeOfShape<Assign<TShape, TNextShape>> | Optionals<TIn>>;
pick(keys: string[]): any;
omit(keys: string[]): any;
from(from: string, to: keyof TShape, alias?: boolean): this;
noUnknown(noAllow?: boolean, message?: import("./types").Message<{}>): this;
unknown(allow?: boolean, message?: import("./types").Message<{}>): this;
transformKeys(fn: (key: string) => string): this;
camelCase(): this;
snakeCase(): this;
constantCase(): this;
describe(): SchemaObjectDescription;
}
export declare function create<TShape extends ObjectShape>(spec?: TShape): OptionalObjectSchema<TShape, Record<string, any>, TypeOfShape<TShape>>;
export declare namespace create {
var prototype: ObjectSchema<any, any, any, any>;
}
export interface OptionalObjectSchema<TShape extends ObjectShape, TContext extends AnyObject = AnyObject, TIn extends Maybe<TypeOfShape<TShape>> = TypeOfShape<TShape>> extends ObjectSchema<TShape, TContext, TIn> {
default<TNextDefault extends Maybe<AnyObject>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? ObjectSchema<TShape, TContext, TIn | undefined> : ObjectSchema<TShape, TContext, Defined<TIn>>;
defined(msg?: MixedLocale['defined']): DefinedObjectSchema<TShape, TContext, TIn>;
required(msg?: MixedLocale['required']): RequiredObjectSchema<TShape, TContext, TIn>;
optional(): this;
notRequired(): this;
nullable(isNullable?: true): OptionalObjectSchema<TShape, TContext, TIn | null>;
nullable(isNullable: false): OptionalObjectSchema<TShape, TContext, Exclude<TIn, null>>;
pick<TKey extends keyof TShape>(keys: TKey[]): OptionalObjectSchema<Pick<TShape, TKey>, TContext, TypeOfShape<Pick<TShape, TKey>> | Optionals<TIn>>;
omit<TKey extends keyof TShape>(keys: TKey[]): OptionalObjectSchema<Omit<TShape, TKey>, TContext, TypeOfShape<Omit<TShape, TKey>> | Optionals<TIn>>;
}
export interface DefinedObjectSchema<TShape extends ObjectShape, TContext extends AnyObject, TIn extends Maybe<TypeOfShape<TShape>>> extends ObjectSchema<TShape, TContext, TIn, AssertsShape<TShape> | Extract<TIn, null>> {
default<TNextDefault extends Maybe<AnyObject>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? DefinedObjectSchema<TShape, TContext, TIn | undefined> : DefinedObjectSchema<TShape, TContext, Defined<TIn>>;
defined(msg?: MixedLocale['defined']): this;
required(msg?: MixedLocale['required']): RequiredObjectSchema<TShape, TContext, TIn>;
optional(): OptionalObjectSchema<TShape, TContext, TIn>;
notRequired(): OptionalObjectSchema<TShape, TContext, TIn>;
nullable(isNullable?: true): DefinedObjectSchema<TShape, TContext, TIn | null>;
nullable(isNullable: false): DefinedObjectSchema<TShape, TContext, Exclude<TIn, null>>;
pick<TKey extends keyof TShape>(keys: TKey[]): DefinedObjectSchema<Pick<TShape, TKey>, TContext, TypeOfShape<Pick<TShape, TKey>> | Optionals<TIn>>;
omit<TKey extends keyof TShape>(keys: TKey[]): DefinedObjectSchema<Omit<TShape, TKey>, TContext, TypeOfShape<Omit<TShape, TKey>> | Optionals<TIn>>;
}
export interface RequiredObjectSchema<TShape extends ObjectShape, TContext extends AnyObject, TIn extends Maybe<TypeOfShape<TShape>>> extends ObjectSchema<TShape, TContext, TIn, AssertsShape<TShape>> {
default<TNextDefault extends Maybe<AnyObject>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? RequiredObjectSchema<TShape, TContext, TIn | undefined> : RequiredObjectSchema<TShape, TContext, Defined<TIn>>;
defined(msg?: MixedLocale['defined']): DefinedObjectSchema<TShape, TContext, TIn>;
required(msg?: MixedLocale['required']): this;
optional(): OptionalObjectSchema<TShape, TContext, TIn>;
notRequired(): OptionalObjectSchema<TShape, TContext, TIn>;
nullable(isNullable?: true): RequiredObjectSchema<TShape, TContext, TIn | null>;
nullable(isNullable: false): RequiredObjectSchema<TShape, TContext, Exclude<TIn, null>>;
pick<TKey extends keyof TShape>(keys: TKey[]): RequiredObjectSchema<Pick<TShape, TKey>, TContext, TypeOfShape<Pick<TShape, TKey>> | Optionals<TIn>>;
omit<TKey extends keyof TShape>(keys: TKey[]): RequiredObjectSchema<Omit<TShape, TKey>, TContext, TypeOfShape<Omit<TShape, TKey>> | Optionals<TIn>>;
}

352
server/node_modules/yup/es/object.js generated vendored Normal file
View File

@@ -0,0 +1,352 @@
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import has from 'lodash/has';
import snakeCase from 'lodash/snakeCase';
import camelCase from 'lodash/camelCase';
import mapKeys from 'lodash/mapKeys';
import mapValues from 'lodash/mapValues';
import { getter } from 'property-expr';
import { object as locale } from './locale';
import sortFields from './util/sortFields';
import sortByKeyOrder from './util/sortByKeyOrder';
import runTests from './util/runTests';
import ValidationError from './ValidationError';
import BaseSchema from './schema';
let isObject = obj => Object.prototype.toString.call(obj) === '[object Object]';
function unknown(ctx, value) {
let known = Object.keys(ctx.fields);
return Object.keys(value).filter(key => known.indexOf(key) === -1);
}
const defaultSort = sortByKeyOrder([]);
export default class ObjectSchema extends BaseSchema {
constructor(spec) {
super({
type: 'object'
});
this.fields = Object.create(null);
this._sortErrors = defaultSort;
this._nodes = [];
this._excludedEdges = [];
this.withMutation(() => {
this.transform(function coerce(value) {
if (typeof value === 'string') {
try {
value = JSON.parse(value);
} catch (err) {
value = null;
}
}
if (this.isType(value)) return value;
return null;
});
if (spec) {
this.shape(spec);
}
});
}
_typeCheck(value) {
return isObject(value) || typeof value === 'function';
}
_cast(_value, options = {}) {
var _options$stripUnknown;
let value = super._cast(_value, options); //should ignore nulls here
if (value === undefined) return this.getDefault();
if (!this._typeCheck(value)) return value;
let fields = this.fields;
let strip = (_options$stripUnknown = options.stripUnknown) != null ? _options$stripUnknown : this.spec.noUnknown;
let props = this._nodes.concat(Object.keys(value).filter(v => this._nodes.indexOf(v) === -1));
let intermediateValue = {}; // is filled during the transform below
let innerOptions = _extends({}, options, {
parent: intermediateValue,
__validating: options.__validating || false
});
let isChanged = false;
for (const prop of props) {
let field = fields[prop];
let exists = has(value, prop);
if (field) {
let fieldValue;
let inputValue = value[prop]; // safe to mutate since this is fired in sequence
innerOptions.path = (options.path ? `${options.path}.` : '') + prop; // innerOptions.value = value[prop];
field = field.resolve({
value: inputValue,
context: options.context,
parent: intermediateValue
});
let fieldSpec = 'spec' in field ? field.spec : undefined;
let strict = fieldSpec == null ? void 0 : fieldSpec.strict;
if (fieldSpec == null ? void 0 : fieldSpec.strip) {
isChanged = isChanged || prop in value;
continue;
}
fieldValue = !options.__validating || !strict ? // TODO: use _cast, this is double resolving
field.cast(value[prop], innerOptions) : value[prop];
if (fieldValue !== undefined) {
intermediateValue[prop] = fieldValue;
}
} else if (exists && !strip) {
intermediateValue[prop] = value[prop];
}
if (intermediateValue[prop] !== value[prop]) {
isChanged = true;
}
}
return isChanged ? intermediateValue : value;
}
_validate(_value, opts = {}, callback) {
let errors = [];
let {
sync,
from = [],
originalValue = _value,
abortEarly = this.spec.abortEarly,
recursive = this.spec.recursive
} = opts;
from = [{
schema: this,
value: originalValue
}, ...from]; // this flag is needed for handling `strict` correctly in the context of
// validation vs just casting. e.g strict() on a field is only used when validating
opts.__validating = true;
opts.originalValue = originalValue;
opts.from = from;
super._validate(_value, opts, (err, value) => {
if (err) {
if (!ValidationError.isError(err) || abortEarly) {
return void callback(err, value);
}
errors.push(err);
}
if (!recursive || !isObject(value)) {
callback(errors[0] || null, value);
return;
}
originalValue = originalValue || value;
let tests = this._nodes.map(key => (_, cb) => {
let path = key.indexOf('.') === -1 ? (opts.path ? `${opts.path}.` : '') + key : `${opts.path || ''}["${key}"]`;
let field = this.fields[key];
if (field && 'validate' in field) {
field.validate(value[key], _extends({}, opts, {
// @ts-ignore
path,
from,
// inner fields are always strict:
// 1. this isn't strict so the casting will also have cast inner values
// 2. this is strict in which case the nested values weren't cast either
strict: true,
parent: value,
originalValue: originalValue[key]
}), cb);
return;
}
cb(null);
});
runTests({
sync,
tests,
value,
errors,
endEarly: abortEarly,
sort: this._sortErrors,
path: opts.path
}, callback);
});
}
clone(spec) {
const next = super.clone(spec);
next.fields = _extends({}, this.fields);
next._nodes = this._nodes;
next._excludedEdges = this._excludedEdges;
next._sortErrors = this._sortErrors;
return next;
}
concat(schema) {
let next = super.concat(schema);
let nextFields = next.fields;
for (let [field, schemaOrRef] of Object.entries(this.fields)) {
const target = nextFields[field];
if (target === undefined) {
nextFields[field] = schemaOrRef;
} else if (target instanceof BaseSchema && schemaOrRef instanceof BaseSchema) {
nextFields[field] = schemaOrRef.concat(target);
}
}
return next.withMutation(() => next.shape(nextFields));
}
getDefaultFromShape() {
let dft = {};
this._nodes.forEach(key => {
const field = this.fields[key];
dft[key] = 'default' in field ? field.getDefault() : undefined;
});
return dft;
}
_getDefault() {
if ('default' in this.spec) {
return super._getDefault();
} // if there is no default set invent one
if (!this._nodes.length) {
return undefined;
}
return this.getDefaultFromShape();
}
shape(additions, excludes = []) {
let next = this.clone();
let fields = Object.assign(next.fields, additions);
next.fields = fields;
next._sortErrors = sortByKeyOrder(Object.keys(fields));
if (excludes.length) {
if (!Array.isArray(excludes[0])) excludes = [excludes];
let keys = excludes.map(([first, second]) => `${first}-${second}`);
next._excludedEdges = next._excludedEdges.concat(keys);
}
next._nodes = sortFields(fields, next._excludedEdges);
return next;
}
pick(keys) {
const picked = {};
for (const key of keys) {
if (this.fields[key]) picked[key] = this.fields[key];
}
return this.clone().withMutation(next => {
next.fields = {};
return next.shape(picked);
});
}
omit(keys) {
const next = this.clone();
const fields = next.fields;
next.fields = {};
for (const key of keys) {
delete fields[key];
}
return next.withMutation(() => next.shape(fields));
}
from(from, to, alias) {
let fromGetter = getter(from, true);
return this.transform(obj => {
if (obj == null) return obj;
let newObj = obj;
if (has(obj, from)) {
newObj = _extends({}, obj);
if (!alias) delete newObj[from];
newObj[to] = fromGetter(obj);
}
return newObj;
});
}
noUnknown(noAllow = true, message = locale.noUnknown) {
if (typeof noAllow === 'string') {
message = noAllow;
noAllow = true;
}
let next = this.test({
name: 'noUnknown',
exclusive: true,
message: message,
test(value) {
if (value == null) return true;
const unknownKeys = unknown(this.schema, value);
return !noAllow || unknownKeys.length === 0 || this.createError({
params: {
unknown: unknownKeys.join(', ')
}
});
}
});
next.spec.noUnknown = noAllow;
return next;
}
unknown(allow = true, message = locale.noUnknown) {
return this.noUnknown(!allow, message);
}
transformKeys(fn) {
return this.transform(obj => obj && mapKeys(obj, (_, key) => fn(key)));
}
camelCase() {
return this.transformKeys(camelCase);
}
snakeCase() {
return this.transformKeys(snakeCase);
}
constantCase() {
return this.transformKeys(key => snakeCase(key).toUpperCase());
}
describe() {
let base = super.describe();
base.fields = mapValues(this.fields, value => value.describe());
return base;
}
}
export function create(spec) {
return new ObjectSchema(spec);
}
create.prototype = ObjectSchema.prototype;

143
server/node_modules/yup/es/schema.d.ts generated vendored Normal file
View File

@@ -0,0 +1,143 @@
import { ConditionOptions, ResolveOptions } from './Condition';
import { TestFunction, Test, TestConfig } from './util/createValidation';
import { ValidateOptions, TransformFunction, Message, Callback, InternalOptions, Maybe, ExtraParams, AnyObject } from './types';
import type { Asserts, Thunk } from './util/types';
import ReferenceSet from './util/ReferenceSet';
import Reference from './Reference';
export declare type SchemaSpec<TDefault> = {
nullable: boolean;
presence: 'required' | 'defined' | 'optional';
default?: TDefault | (() => TDefault);
abortEarly?: boolean;
strip?: boolean;
strict?: boolean;
recursive?: boolean;
label?: string | undefined;
meta?: any;
};
export declare type SchemaOptions<TDefault> = {
type?: string;
spec?: SchemaSpec<TDefault>;
};
export declare type AnySchema<Type = any, TContext = any, TOut = any> = BaseSchema<Type, TContext, TOut>;
export interface CastOptions<TContext = {}> {
parent?: any;
context?: TContext;
assert?: boolean;
stripUnknown?: boolean;
path?: string;
}
export interface SchemaRefDescription {
type: 'ref';
key: string;
}
export interface SchemaInnerTypeDescription extends SchemaDescription {
innerType?: SchemaFieldDescription;
}
export interface SchemaObjectDescription extends SchemaDescription {
fields: Record<string, SchemaFieldDescription>;
}
export declare type SchemaFieldDescription = SchemaDescription | SchemaRefDescription | SchemaObjectDescription | SchemaInnerTypeDescription;
export interface SchemaDescription {
type: string;
label?: string;
meta: object;
oneOf: unknown[];
notOneOf: unknown[];
tests: Array<{
name?: string;
params: ExtraParams | undefined;
}>;
}
export default abstract class BaseSchema<TCast = any, TContext = AnyObject, TOutput = any> {
readonly type: string;
readonly __inputType: TCast;
readonly __outputType: TOutput;
readonly __isYupSchema__: boolean;
readonly deps: readonly string[];
tests: Test[];
transforms: TransformFunction<AnySchema>[];
private conditions;
private _mutate?;
private _typeError?;
private _whitelistError?;
private _blacklistError?;
protected _whitelist: ReferenceSet;
protected _blacklist: ReferenceSet;
protected exclusiveTests: Record<string, boolean>;
spec: SchemaSpec<any>;
constructor(options?: SchemaOptions<any>);
get _type(): string;
protected _typeCheck(_value: any): _value is NonNullable<TCast>;
clone(spec?: Partial<SchemaSpec<any>>): this;
label(label: string): this;
meta(): Record<string, unknown> | undefined;
meta(obj: Record<string, unknown>): this;
withMutation<T>(fn: (schema: this) => T): T;
concat(schema: this): this;
concat(schema: AnySchema): AnySchema;
isType(v: any): boolean;
resolve(options: ResolveOptions): this;
/**
*
* @param {*} value
* @param {Object} options
* @param {*=} options.parent
* @param {*=} options.context
*/
cast(value: any, options?: CastOptions<TContext>): TCast;
protected _cast(rawValue: any, _options: CastOptions<TContext>): any;
protected _validate(_value: any, options: InternalOptions<TContext> | undefined, cb: Callback): void;
validate(value: any, options?: ValidateOptions<TContext>): Promise<this['__outputType']>;
validateSync(value: any, options?: ValidateOptions<TContext>): this['__outputType'];
isValid(value: any, options?: ValidateOptions<TContext>): Promise<boolean>;
isValidSync(value: any, options?: ValidateOptions<TContext>): value is Asserts<this>;
protected _getDefault(): any;
getDefault(options?: ResolveOptions): TCast;
default(def: Thunk<any>): any;
strict(isStrict?: boolean): this;
protected _isPresent(value: unknown): boolean;
defined(message?: Message<{}>): any;
required(message?: Message<{}>): any;
notRequired(): any;
nullable(isNullable?: true): any;
nullable(isNullable: false): any;
transform(fn: TransformFunction<this>): this;
/**
* Adds a test function to the schema's queue of tests.
* tests can be exclusive or non-exclusive.
*
* - exclusive tests, will replace any existing tests of the same name.
* - non-exclusive: can be stacked
*
* If a non-exclusive test is added to a schema with an exclusive test of the same name
* the exclusive test is removed and further tests of the same name will be stacked.
*
* If an exclusive test is added to a schema with non-exclusive tests of the same name
* the previous tests are removed and further tests of the same name will replace each other.
*/
test(options: TestConfig<TCast, TContext>): this;
test(test: TestFunction<TCast, TContext>): this;
test(name: string, test: TestFunction<TCast, TContext>): this;
test(name: string, message: Message, test: TestFunction<TCast, TContext>): this;
when(options: ConditionOptions<this>): this;
when(keys: string | string[], options: ConditionOptions<this>): this;
typeError(message: Message): this;
oneOf<U extends TCast>(enums: Array<Maybe<U> | Reference>, message?: Message<{
values: any;
}>): this;
notOneOf<U extends TCast>(enums: Array<Maybe<U> | Reference>, message?: Message<{
values: any;
}>): this;
strip(strip?: boolean): this;
describe(): SchemaDescription;
}
export default interface BaseSchema<TCast, TContext, TOutput> {
validateAt(path: string, value: any, options?: ValidateOptions<TContext>): Promise<TOutput>;
validateSyncAt(path: string, value: any, options?: ValidateOptions<TContext>): TOutput;
equals: BaseSchema['oneOf'];
is: BaseSchema['oneOf'];
not: BaseSchema['notOneOf'];
nope: BaseSchema['notOneOf'];
optional(): any;
}

560
server/node_modules/yup/es/schema.js generated vendored Normal file
View File

@@ -0,0 +1,560 @@
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
// @ts-ignore
import cloneDeep from 'nanoclone';
import { mixed as locale } from './locale';
import Condition from './Condition';
import runTests from './util/runTests';
import createValidation from './util/createValidation';
import printValue from './util/printValue';
import Ref from './Reference';
import { getIn } from './util/reach';
import toArray from './util/toArray';
import ValidationError from './ValidationError';
import ReferenceSet from './util/ReferenceSet';
export default class BaseSchema {
constructor(options) {
this.deps = [];
this.conditions = [];
this._whitelist = new ReferenceSet();
this._blacklist = new ReferenceSet();
this.exclusiveTests = Object.create(null);
this.tests = [];
this.transforms = [];
this.withMutation(() => {
this.typeError(locale.notType);
});
this.type = (options == null ? void 0 : options.type) || 'mixed';
this.spec = _extends({
strip: false,
strict: false,
abortEarly: true,
recursive: true,
nullable: false,
presence: 'optional'
}, options == null ? void 0 : options.spec);
} // TODO: remove
get _type() {
return this.type;
}
_typeCheck(_value) {
return true;
}
clone(spec) {
if (this._mutate) {
if (spec) Object.assign(this.spec, spec);
return this;
} // if the nested value is a schema we can skip cloning, since
// they are already immutable
const next = Object.create(Object.getPrototypeOf(this)); // @ts-expect-error this is readonly
next.type = this.type;
next._typeError = this._typeError;
next._whitelistError = this._whitelistError;
next._blacklistError = this._blacklistError;
next._whitelist = this._whitelist.clone();
next._blacklist = this._blacklist.clone();
next.exclusiveTests = _extends({}, this.exclusiveTests); // @ts-expect-error this is readonly
next.deps = [...this.deps];
next.conditions = [...this.conditions];
next.tests = [...this.tests];
next.transforms = [...this.transforms];
next.spec = cloneDeep(_extends({}, this.spec, spec));
return next;
}
label(label) {
var next = this.clone();
next.spec.label = label;
return next;
}
meta(...args) {
if (args.length === 0) return this.spec.meta;
let next = this.clone();
next.spec.meta = Object.assign(next.spec.meta || {}, args[0]);
return next;
} // withContext<TContext extends AnyObject>(): BaseSchema<
// TCast,
// TContext,
// TOutput
// > {
// return this as any;
// }
withMutation(fn) {
let before = this._mutate;
this._mutate = true;
let result = fn(this);
this._mutate = before;
return result;
}
concat(schema) {
if (!schema || schema === this) return this;
if (schema.type !== this.type && this.type !== 'mixed') throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema.type}`);
let base = this;
let combined = schema.clone();
const mergedSpec = _extends({}, base.spec, combined.spec); // if (combined.spec.nullable === UNSET)
// mergedSpec.nullable = base.spec.nullable;
// if (combined.spec.presence === UNSET)
// mergedSpec.presence = base.spec.presence;
combined.spec = mergedSpec;
combined._typeError || (combined._typeError = base._typeError);
combined._whitelistError || (combined._whitelistError = base._whitelistError);
combined._blacklistError || (combined._blacklistError = base._blacklistError); // manually merge the blacklist/whitelist (the other `schema` takes
// precedence in case of conflicts)
combined._whitelist = base._whitelist.merge(schema._whitelist, schema._blacklist);
combined._blacklist = base._blacklist.merge(schema._blacklist, schema._whitelist); // start with the current tests
combined.tests = base.tests;
combined.exclusiveTests = base.exclusiveTests; // manually add the new tests to ensure
// the deduping logic is consistent
combined.withMutation(next => {
schema.tests.forEach(fn => {
next.test(fn.OPTIONS);
});
});
return combined;
}
isType(v) {
if (this.spec.nullable && v === null) return true;
return this._typeCheck(v);
}
resolve(options) {
let schema = this;
if (schema.conditions.length) {
let conditions = schema.conditions;
schema = schema.clone();
schema.conditions = [];
schema = conditions.reduce((schema, condition) => condition.resolve(schema, options), schema);
schema = schema.resolve(options);
}
return schema;
}
/**
*
* @param {*} value
* @param {Object} options
* @param {*=} options.parent
* @param {*=} options.context
*/
cast(value, options = {}) {
let resolvedSchema = this.resolve(_extends({
value
}, options));
let result = resolvedSchema._cast(value, options);
if (value !== undefined && options.assert !== false && resolvedSchema.isType(result) !== true) {
let formattedValue = printValue(value);
let formattedResult = printValue(result);
throw new TypeError(`The value of ${options.path || 'field'} could not be cast to a value ` + `that satisfies the schema type: "${resolvedSchema._type}". \n\n` + `attempted value: ${formattedValue} \n` + (formattedResult !== formattedValue ? `result of cast: ${formattedResult}` : ''));
}
return result;
}
_cast(rawValue, _options) {
let value = rawValue === undefined ? rawValue : this.transforms.reduce((value, fn) => fn.call(this, value, rawValue, this), rawValue);
if (value === undefined) {
value = this.getDefault();
}
return value;
}
_validate(_value, options = {}, cb) {
let {
sync,
path,
from = [],
originalValue = _value,
strict = this.spec.strict,
abortEarly = this.spec.abortEarly
} = options;
let value = _value;
if (!strict) {
// this._validating = true;
value = this._cast(value, _extends({
assert: false
}, options)); // this._validating = false;
} // value is cast, we can check if it meets type requirements
let args = {
value,
path,
options,
originalValue,
schema: this,
label: this.spec.label,
sync,
from
};
let initialTests = [];
if (this._typeError) initialTests.push(this._typeError);
if (this._whitelistError) initialTests.push(this._whitelistError);
if (this._blacklistError) initialTests.push(this._blacklistError);
runTests({
args,
value,
path,
sync,
tests: initialTests,
endEarly: abortEarly
}, err => {
if (err) return void cb(err, value);
runTests({
tests: this.tests,
args,
path,
sync,
value,
endEarly: abortEarly
}, cb);
});
}
validate(value, options, maybeCb) {
let schema = this.resolve(_extends({}, options, {
value
})); // callback case is for nested validations
return typeof maybeCb === 'function' ? schema._validate(value, options, maybeCb) : new Promise((resolve, reject) => schema._validate(value, options, (err, value) => {
if (err) reject(err);else resolve(value);
}));
}
validateSync(value, options) {
let schema = this.resolve(_extends({}, options, {
value
}));
let result;
schema._validate(value, _extends({}, options, {
sync: true
}), (err, value) => {
if (err) throw err;
result = value;
});
return result;
}
isValid(value, options) {
return this.validate(value, options).then(() => true, err => {
if (ValidationError.isError(err)) return false;
throw err;
});
}
isValidSync(value, options) {
try {
this.validateSync(value, options);
return true;
} catch (err) {
if (ValidationError.isError(err)) return false;
throw err;
}
}
_getDefault() {
let defaultValue = this.spec.default;
if (defaultValue == null) {
return defaultValue;
}
return typeof defaultValue === 'function' ? defaultValue.call(this) : cloneDeep(defaultValue);
}
getDefault(options) {
let schema = this.resolve(options || {});
return schema._getDefault();
}
default(def) {
if (arguments.length === 0) {
return this._getDefault();
}
let next = this.clone({
default: def
});
return next;
}
strict(isStrict = true) {
var next = this.clone();
next.spec.strict = isStrict;
return next;
}
_isPresent(value) {
return value != null;
}
defined(message = locale.defined) {
return this.test({
message,
name: 'defined',
exclusive: true,
test(value) {
return value !== undefined;
}
});
}
required(message = locale.required) {
return this.clone({
presence: 'required'
}).withMutation(s => s.test({
message,
name: 'required',
exclusive: true,
test(value) {
return this.schema._isPresent(value);
}
}));
}
notRequired() {
var next = this.clone({
presence: 'optional'
});
next.tests = next.tests.filter(test => test.OPTIONS.name !== 'required');
return next;
}
nullable(isNullable = true) {
var next = this.clone({
nullable: isNullable !== false
});
return next;
}
transform(fn) {
var next = this.clone();
next.transforms.push(fn);
return next;
}
/**
* Adds a test function to the schema's queue of tests.
* tests can be exclusive or non-exclusive.
*
* - exclusive tests, will replace any existing tests of the same name.
* - non-exclusive: can be stacked
*
* If a non-exclusive test is added to a schema with an exclusive test of the same name
* the exclusive test is removed and further tests of the same name will be stacked.
*
* If an exclusive test is added to a schema with non-exclusive tests of the same name
* the previous tests are removed and further tests of the same name will replace each other.
*/
test(...args) {
let opts;
if (args.length === 1) {
if (typeof args[0] === 'function') {
opts = {
test: args[0]
};
} else {
opts = args[0];
}
} else if (args.length === 2) {
opts = {
name: args[0],
test: args[1]
};
} else {
opts = {
name: args[0],
message: args[1],
test: args[2]
};
}
if (opts.message === undefined) opts.message = locale.default;
if (typeof opts.test !== 'function') throw new TypeError('`test` is a required parameters');
let next = this.clone();
let validate = createValidation(opts);
let isExclusive = opts.exclusive || opts.name && next.exclusiveTests[opts.name] === true;
if (opts.exclusive) {
if (!opts.name) throw new TypeError('Exclusive tests must provide a unique `name` identifying the test');
}
if (opts.name) next.exclusiveTests[opts.name] = !!opts.exclusive;
next.tests = next.tests.filter(fn => {
if (fn.OPTIONS.name === opts.name) {
if (isExclusive) return false;
if (fn.OPTIONS.test === validate.OPTIONS.test) return false;
}
return true;
});
next.tests.push(validate);
return next;
}
when(keys, options) {
if (!Array.isArray(keys) && typeof keys !== 'string') {
options = keys;
keys = '.';
}
let next = this.clone();
let deps = toArray(keys).map(key => new Ref(key));
deps.forEach(dep => {
// @ts-ignore
if (dep.isSibling) next.deps.push(dep.key);
});
next.conditions.push(new Condition(deps, options));
return next;
}
typeError(message) {
var next = this.clone();
next._typeError = createValidation({
message,
name: 'typeError',
test(value) {
if (value !== undefined && !this.schema.isType(value)) return this.createError({
params: {
type: this.schema._type
}
});
return true;
}
});
return next;
}
oneOf(enums, message = locale.oneOf) {
var next = this.clone();
enums.forEach(val => {
next._whitelist.add(val);
next._blacklist.delete(val);
});
next._whitelistError = createValidation({
message,
name: 'oneOf',
test(value) {
if (value === undefined) return true;
let valids = this.schema._whitelist;
return valids.has(value, this.resolve) ? true : this.createError({
params: {
values: valids.toArray().join(', ')
}
});
}
});
return next;
}
notOneOf(enums, message = locale.notOneOf) {
var next = this.clone();
enums.forEach(val => {
next._blacklist.add(val);
next._whitelist.delete(val);
});
next._blacklistError = createValidation({
message,
name: 'notOneOf',
test(value) {
let invalids = this.schema._blacklist;
if (invalids.has(value, this.resolve)) return this.createError({
params: {
values: invalids.toArray().join(', ')
}
});
return true;
}
});
return next;
}
strip(strip = true) {
let next = this.clone();
next.spec.strip = strip;
return next;
}
describe() {
const next = this.clone();
const {
label,
meta
} = next.spec;
const description = {
meta,
label,
type: next.type,
oneOf: next._whitelist.describe(),
notOneOf: next._blacklist.describe(),
tests: next.tests.map(fn => ({
name: fn.OPTIONS.name,
params: fn.OPTIONS.params
})).filter((n, idx, list) => list.findIndex(c => c.name === n.name) === idx)
};
return description;
}
}
// @ts-expect-error
BaseSchema.prototype.__isYupSchema__ = true;
for (const method of ['validate', 'validateSync']) BaseSchema.prototype[`${method}At`] = function (path, value, options = {}) {
const {
parent,
parentPath,
schema
} = getIn(this, path, value, options.context);
return schema[method](parent && parent[parentPath], _extends({}, options, {
parent,
path
}));
};
for (const alias of ['equals', 'is']) BaseSchema.prototype[alias] = BaseSchema.prototype.oneOf;
for (const alias of ['not', 'nope']) BaseSchema.prototype[alias] = BaseSchema.prototype.notOneOf;
BaseSchema.prototype.optional = BaseSchema.prototype.notRequired;

1
server/node_modules/yup/es/setLocale.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export default function setLocale(custom: any): void;

8
server/node_modules/yup/es/setLocale.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import locale from './locale';
export default function setLocale(custom) {
Object.keys(custom).forEach(type => {
Object.keys(custom[type]).forEach(method => {
locale[type][method] = custom[type][method];
});
});
}

73
server/node_modules/yup/es/string.d.ts generated vendored Normal file
View File

@@ -0,0 +1,73 @@
import { MixedLocale } from './locale';
import type Reference from './Reference';
import type { Message, Maybe, AnyObject } from './types';
import type { Defined, If, Thunk } from './util/types';
import BaseSchema from './schema';
export declare type MatchOptions = {
excludeEmptyString?: boolean;
message: Message<{
regex: RegExp;
}>;
name?: string;
};
export declare function create(): StringSchema<string | undefined, Record<string, any>, string | undefined>;
export declare namespace create {
var prototype: StringSchema<any, any, any>;
}
export default class StringSchema<TType extends Maybe<string> = string | undefined, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
constructor();
protected _typeCheck(value: any): value is NonNullable<TType>;
protected _isPresent(value: any): boolean;
length(length: number | Reference<number>, message?: Message<{
length: number;
}>): this;
min(min: number | Reference<number>, message?: Message<{
min: number;
}>): this;
max(max: number | Reference<number>, message?: Message<{
max: number;
}>): this;
matches(regex: RegExp, options?: MatchOptions | MatchOptions['message']): this;
email(message?: Message<{
regex: RegExp;
}>): this;
url(message?: Message<{
regex: RegExp;
}>): this;
uuid(message?: Message<{
regex: RegExp;
}>): this;
ensure(): StringSchema<NonNullable<TType>>;
trim(message?: Message<{}>): this;
lowercase(message?: Message<{}>): this;
uppercase(message?: Message<{}>): this;
}
export interface DefinedStringSchema<TType extends Maybe<string>, TContext extends AnyObject = AnyObject> extends StringSchema<TType, TContext, Defined<TType>> {
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, DefinedStringSchema<TType | undefined, TContext>, DefinedStringSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): this;
required(msg?: MixedLocale['required']): RequiredStringSchema<TType, TContext>;
optional(): StringSchema<TType, TContext>;
notRequired(): StringSchema<TType, TContext>;
nullable(isNullable?: true): RequiredStringSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredStringSchema<Exclude<TType, null>, TContext>;
}
export interface RequiredStringSchema<TType extends Maybe<string>, TContext extends AnyObject = AnyObject> extends StringSchema<TType, TContext, NonNullable<TType>> {
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, RequiredStringSchema<TType | undefined, TContext>, RequiredStringSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): DefinedStringSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredStringSchema<TType, TContext>;
optional(): StringSchema<TType, TContext>;
notRequired(): StringSchema<TType, TContext>;
nullable(isNullable?: true): RequiredStringSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredStringSchema<Exclude<TType, null>, TContext>;
}
export default interface StringSchema<TType extends Maybe<string> = string | undefined, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
concat<TOther extends StringSchema<any, any, any>>(schema: TOther): TOther;
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, StringSchema<TType | undefined, TContext>, StringSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): DefinedStringSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredStringSchema<TType, TContext>;
optional(): StringSchema<TType, TContext>;
notRequired(): StringSchema<TType, TContext>;
nullable(isNullable?: true): StringSchema<TType | null, TContext>;
nullable(isNullable: false): StringSchema<Exclude<TType, null>, TContext>;
withContext<TNextContext extends TContext>(): StringSchema<Exclude<TType, null>, TNextContext>;
}

175
server/node_modules/yup/es/string.js generated vendored Normal file
View File

@@ -0,0 +1,175 @@
import { string as locale } from './locale';
import isAbsent from './util/isAbsent';
import BaseSchema from './schema'; // eslint-disable-next-line
let rEmail = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i; // eslint-disable-next-line
let rUrl = /^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i; // eslint-disable-next-line
let rUUID = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
let isTrimmed = value => isAbsent(value) || value === value.trim();
let objStringTag = {}.toString();
export function create() {
return new StringSchema();
}
export default class StringSchema extends BaseSchema {
constructor() {
super({
type: 'string'
});
this.withMutation(() => {
this.transform(function (value) {
if (this.isType(value)) return value;
if (Array.isArray(value)) return value;
const strValue = value != null && value.toString ? value.toString() : value;
if (strValue === objStringTag) return value;
return strValue;
});
});
}
_typeCheck(value) {
if (value instanceof String) value = value.valueOf();
return typeof value === 'string';
}
_isPresent(value) {
return super._isPresent(value) && !!value.length;
}
length(length, message = locale.length) {
return this.test({
message,
name: 'length',
exclusive: true,
params: {
length
},
test(value) {
return isAbsent(value) || value.length === this.resolve(length);
}
});
}
min(min, message = locale.min) {
return this.test({
message,
name: 'min',
exclusive: true,
params: {
min
},
test(value) {
return isAbsent(value) || value.length >= this.resolve(min);
}
});
}
max(max, message = locale.max) {
return this.test({
name: 'max',
exclusive: true,
message,
params: {
max
},
test(value) {
return isAbsent(value) || value.length <= this.resolve(max);
}
});
}
matches(regex, options) {
let excludeEmptyString = false;
let message;
let name;
if (options) {
if (typeof options === 'object') {
({
excludeEmptyString = false,
message,
name
} = options);
} else {
message = options;
}
}
return this.test({
name: name || 'matches',
message: message || locale.matches,
params: {
regex
},
test: value => isAbsent(value) || value === '' && excludeEmptyString || value.search(regex) !== -1
});
}
email(message = locale.email) {
return this.matches(rEmail, {
name: 'email',
message,
excludeEmptyString: true
});
}
url(message = locale.url) {
return this.matches(rUrl, {
name: 'url',
message,
excludeEmptyString: true
});
}
uuid(message = locale.uuid) {
return this.matches(rUUID, {
name: 'uuid',
message,
excludeEmptyString: false
});
} //-- transforms --
ensure() {
return this.default('').transform(val => val === null ? '' : val);
}
trim(message = locale.trim) {
return this.transform(val => val != null ? val.trim() : val).test({
message,
name: 'trim',
test: isTrimmed
});
}
lowercase(message = locale.lowercase) {
return this.transform(value => !isAbsent(value) ? value.toLowerCase() : value).test({
message,
name: 'string_case',
exclusive: true,
test: value => isAbsent(value) || value === value.toLowerCase()
});
}
uppercase(message = locale.uppercase) {
return this.transform(value => !isAbsent(value) ? value.toUpperCase() : value).test({
message,
name: 'string_case',
exclusive: true,
test: value => isAbsent(value) || value === value.toUpperCase()
});
}
}
create.prototype = StringSchema.prototype; //
// String Interfaces
//

52
server/node_modules/yup/es/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,52 @@
import type { AnySchema } from './schema';
import type Lazy from './Lazy';
export declare type AnyObject = Record<string, any>;
export declare type SchemaLike = AnySchema | Lazy<any>;
export declare type Callback<T = any> = (err: Error | null, value?: T) => void;
export declare type TransformFunction<T extends AnySchema> = (this: T, value: any, originalValue: any, schema: T) => any;
export interface ValidateOptions<TContext = {}> {
/**
* Only validate the input, and skip and coercion or transformation. Default - false
*/
strict?: boolean;
/**
* Return from validation methods on the first error rather than after all validations run. Default - true
*/
abortEarly?: boolean;
/**
* Remove unspecified keys from objects. Default - false
*/
stripUnknown?: boolean;
/**
* When false validations will not descend into nested schema (relevant for objects or arrays). Default - true
*/
recursive?: boolean;
/**
* Any context needed for validating schema conditions (see: when())
*/
context?: TContext;
}
export interface InternalOptions<TContext = {}> extends ValidateOptions<TContext> {
__validating?: boolean;
originalValue?: any;
parent?: any;
path?: string;
sync?: boolean;
from?: {
schema: AnySchema;
value: any;
}[];
}
export interface MessageParams {
path: string;
value: any;
originalValue: any;
label: string;
type: string;
}
export declare type Message<Extra extends Record<string, unknown> = {}> = string | ((params: Extra & MessageParams) => unknown) | Record<PropertyKey, unknown>;
export declare type ExtraParams = Record<string, unknown>;
export declare type AnyMessageParams = MessageParams & ExtraParams;
export declare type Maybe<T> = T | null | undefined;
export declare type Preserve<T, U> = T extends U ? U : never;
export declare type Optionals<T> = Extract<T, null | undefined>;

0
server/node_modules/yup/es/types.js generated vendored Normal file
View File

14
server/node_modules/yup/es/util/ReferenceSet.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import Reference from '../Reference';
export default class ReferenceSet {
list: Set<unknown>;
refs: Map<string, Reference>;
constructor();
get size(): number;
describe(): unknown[];
toArray(): unknown[];
add(value: unknown): void;
delete(value: unknown): void;
has(value: unknown, resolve: (v: unknown) => unknown): boolean;
clone(): ReferenceSet;
merge(newItems: ReferenceSet, removeItems: ReferenceSet): ReferenceSet;
}

60
server/node_modules/yup/es/util/ReferenceSet.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import Reference from '../Reference';
export default class ReferenceSet {
constructor() {
this.list = new Set();
this.refs = new Map();
}
get size() {
return this.list.size + this.refs.size;
}
describe() {
const description = [];
for (const item of this.list) description.push(item);
for (const [, ref] of this.refs) description.push(ref.describe());
return description;
}
toArray() {
return Array.from(this.list).concat(Array.from(this.refs.values()));
}
add(value) {
Reference.isRef(value) ? this.refs.set(value.key, value) : this.list.add(value);
}
delete(value) {
Reference.isRef(value) ? this.refs.delete(value.key) : this.list.delete(value);
}
has(value, resolve) {
if (this.list.has(value)) return true;
let item,
values = this.refs.values();
while (item = values.next(), !item.done) if (resolve(item.value) === value) return true;
return false;
}
clone() {
const next = new ReferenceSet();
next.list = new Set(this.list);
next.refs = new Map(this.refs);
return next;
}
merge(newItems, removeItems) {
const next = this.clone();
newItems.list.forEach(value => next.add(value));
newItems.refs.forEach(value => next.add(value));
removeItems.list.forEach(value => next.delete(value));
removeItems.refs.forEach(value => next.delete(value));
return next;
}
}

52
server/node_modules/yup/es/util/createValidation.d.ts generated vendored Normal file
View File

@@ -0,0 +1,52 @@
import ValidationError from '../ValidationError';
import { ValidateOptions, Message, InternalOptions, Callback, ExtraParams } from '../types';
import Reference from '../Reference';
import type { AnySchema } from '../schema';
export declare type CreateErrorOptions = {
path?: string;
message?: Message<any>;
params?: ExtraParams;
type?: string;
};
export declare type TestContext<TContext = {}> = {
path: string;
options: ValidateOptions<TContext>;
parent: any;
schema: any;
resolve: <T>(value: T | Reference<T>) => T;
createError: (params?: CreateErrorOptions) => ValidationError;
};
export declare type TestFunction<T = unknown, TContext = {}> = (this: TestContext<TContext>, value: T, context: TestContext<TContext>) => boolean | ValidationError | Promise<boolean | ValidationError>;
export declare type TestOptions<TSchema extends AnySchema = AnySchema> = {
value: any;
path?: string;
label?: string;
options: InternalOptions;
originalValue: any;
schema: TSchema;
sync?: boolean;
};
export declare type TestConfig<TValue = unknown, TContext = {}> = {
name?: string;
message?: Message<any>;
test: TestFunction<TValue, TContext>;
params?: ExtraParams;
exclusive?: boolean;
};
export declare type Test = ((opts: TestOptions, cb: Callback) => void) & {
OPTIONS: TestConfig;
};
export default function createValidation(config: {
name?: string;
test: TestFunction;
params?: ExtraParams;
message?: Message<any>;
}): {
<TSchema extends AnySchema<any, any, any> = AnySchema<any, any, any>>({ value, path, label, options, originalValue, sync, ...rest }: TestOptions<TSchema>, cb: Callback): void;
OPTIONS: {
name?: string | undefined;
test: TestFunction;
params?: Record<string, unknown> | undefined;
message?: string | Record<string | number | symbol, unknown> | ((params: any) => unknown) | undefined;
};
};

89
server/node_modules/yup/es/util/createValidation.js generated vendored Normal file
View File

@@ -0,0 +1,89 @@
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import mapValues from 'lodash/mapValues';
import ValidationError from '../ValidationError';
import Ref from '../Reference';
export default function createValidation(config) {
function validate(_ref, cb) {
let {
value,
path = '',
label,
options,
originalValue,
sync
} = _ref,
rest = _objectWithoutPropertiesLoose(_ref, ["value", "path", "label", "options", "originalValue", "sync"]);
const {
name,
test,
params,
message
} = config;
let {
parent,
context
} = options;
function resolve(item) {
return Ref.isRef(item) ? item.getValue(value, parent, context) : item;
}
function createError(overrides = {}) {
const nextParams = mapValues(_extends({
value,
originalValue,
label,
path: overrides.path || path
}, params, overrides.params), resolve);
const error = new ValidationError(ValidationError.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name);
error.params = nextParams;
return error;
}
let ctx = _extends({
path,
parent,
type: name,
createError,
resolve,
options,
originalValue
}, rest);
if (!sync) {
try {
Promise.resolve(test.call(ctx, value, ctx)).then(validOrError => {
if (ValidationError.isError(validOrError)) cb(validOrError);else if (!validOrError) cb(createError());else cb(null, validOrError);
});
} catch (err) {
cb(err);
}
return;
}
let result;
try {
var _ref2;
result = test.call(ctx, value, ctx);
if (typeof ((_ref2 = result) == null ? void 0 : _ref2.then) === 'function') {
throw new Error(`Validation test of type: "${ctx.type}" returned a Promise during a synchronous validate. ` + `This test will finish after the validate call has returned`);
}
} catch (err) {
cb(err);
return;
}
if (ValidationError.isError(result)) cb(result);else if (!result) cb(createError());else cb(null, result);
}
validate.OPTIONS = config;
return validate;
}

2
server/node_modules/yup/es/util/isAbsent.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
declare const _default: (value: any) => value is null | undefined;
export default _default;

1
server/node_modules/yup/es/util/isAbsent.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export default (value => value == null);

3
server/node_modules/yup/es/util/isSchema.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import type { SchemaLike } from '../types';
declare const _default: (obj: any) => obj is SchemaLike;
export default _default;

1
server/node_modules/yup/es/util/isSchema.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export default (obj => obj && obj.__isYupSchema__);

1
server/node_modules/yup/es/util/isodate.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export default function parseIsoDate(date: any): number;

39
server/node_modules/yup/es/util/isodate.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
/* eslint-disable */
/**
*
* Date.parse with progressive enhancement for ISO 8601 <https://github.com/csnover/js-iso8601>
* NON-CONFORMANT EDITION.
* © 2011 Colin Snover <http://zetafleet.com>
* Released under MIT license.
*/
// 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm
var isoReg = /^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;
export default function parseIsoDate(date) {
var numericKeys = [1, 4, 5, 6, 7, 10, 11],
minutesOffset = 0,
timestamp,
struct;
if (struct = isoReg.exec(date)) {
// avoid NaN timestamps caused by “undefined” values being passed to Date.UTC
for (var i = 0, k; k = numericKeys[i]; ++i) struct[k] = +struct[k] || 0; // allow undefined days and months
struct[2] = (+struct[2] || 1) - 1;
struct[3] = +struct[3] || 1; // allow arbitrary sub-second precision beyond milliseconds
struct[7] = struct[7] ? String(struct[7]).substr(0, 3) : 0; // timestamps without timezone identifiers should be considered local time
if ((struct[8] === undefined || struct[8] === '') && (struct[9] === undefined || struct[9] === '')) timestamp = +new Date(struct[1], struct[2], struct[3], struct[4], struct[5], struct[6], struct[7]);else {
if (struct[8] !== 'Z' && struct[9] !== undefined) {
minutesOffset = struct[10] * 60 + struct[11];
if (struct[9] === '+') minutesOffset = 0 - minutesOffset;
}
timestamp = Date.UTC(struct[1], struct[2], struct[3], struct[4], struct[5] + minutesOffset, struct[6], struct[7]);
}
} else timestamp = Date.parse ? Date.parse(date) : NaN;
return timestamp;
}

1
server/node_modules/yup/es/util/printValue.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export default function printValue(value: any, quoteStrings?: boolean): any;

35
server/node_modules/yup/es/util/printValue.js generated vendored Normal file
View File

@@ -0,0 +1,35 @@
const toString = Object.prototype.toString;
const errorToString = Error.prototype.toString;
const regExpToString = RegExp.prototype.toString;
const symbolToString = typeof Symbol !== 'undefined' ? Symbol.prototype.toString : () => '';
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
function printNumber(val) {
if (val != +val) return 'NaN';
const isNegativeZero = val === 0 && 1 / val < 0;
return isNegativeZero ? '-0' : '' + val;
}
function printSimpleValue(val, quoteStrings = false) {
if (val == null || val === true || val === false) return '' + val;
const typeOf = typeof val;
if (typeOf === 'number') return printNumber(val);
if (typeOf === 'string') return quoteStrings ? `"${val}"` : val;
if (typeOf === 'function') return '[Function ' + (val.name || 'anonymous') + ']';
if (typeOf === 'symbol') return symbolToString.call(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
const tag = toString.call(val).slice(8, -1);
if (tag === 'Date') return isNaN(val.getTime()) ? '' + val : val.toISOString(val);
if (tag === 'Error' || val instanceof Error) return '[' + errorToString.call(val) + ']';
if (tag === 'RegExp') return regExpToString.call(val);
return null;
}
export default function printValue(value, quoteStrings) {
let result = printSimpleValue(value, quoteStrings);
if (result !== null) return result;
return JSON.stringify(value, function (key, value) {
let result = printSimpleValue(this[key], quoteStrings);
if (result !== null) return result;
return value;
}, 2);
}

7
server/node_modules/yup/es/util/reach.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export declare function getIn(schema: any, path: string, value?: any, context?: any): {
parent: any;
parentPath: string;
schema: any;
};
declare const reach: (obj: {}, path: string, value?: any, context?: any) => any;
export default reach;

56
server/node_modules/yup/es/util/reach.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
import { forEach } from 'property-expr';
let trim = part => part.substr(0, part.length - 1).substr(1);
export function getIn(schema, path, value, context = value) {
let parent, lastPart, lastPartDebug; // root path: ''
if (!path) return {
parent,
parentPath: path,
schema
};
forEach(path, (_part, isBracket, isArray) => {
let part = isBracket ? trim(_part) : _part;
schema = schema.resolve({
context,
parent,
value
});
if (schema.innerType) {
let idx = isArray ? parseInt(part, 10) : 0;
if (value && idx >= value.length) {
throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path}. ` + `because there is no value at that index. `);
}
parent = value;
value = value && value[idx];
schema = schema.innerType;
} // sometimes the array index part of a path doesn't exist: "nested.arr.child"
// in these cases the current part is the next schema and should be processed
// in this iteration. For cases where the index signature is included this
// check will fail and we'll handle the `child` part on the next iteration like normal
if (!isArray) {
if (!schema.fields || !schema.fields[part]) throw new Error(`The schema does not contain the path: ${path}. ` + `(failed at: ${lastPartDebug} which is a type: "${schema._type}")`);
parent = value;
value = value && value[part];
schema = schema.fields[part];
}
lastPart = part;
lastPartDebug = isBracket ? '[' + _part + ']' : '.' + _part;
});
return {
schema,
parent,
parentPath: lastPart
};
}
const reach = (obj, path, value, context) => getIn(obj, path, value, context).schema;
export default reach;

15
server/node_modules/yup/es/util/runTests.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
import ValidationError from '../ValidationError';
import { TestOptions } from './createValidation';
import { Callback } from '../types';
export declare type RunTest = (opts: TestOptions, cb: Callback) => void;
export declare type TestRunOptions = {
endEarly?: boolean;
tests: RunTest[];
args?: TestOptions;
errors?: ValidationError[];
sort?: (a: ValidationError, b: ValidationError) => number;
path?: string;
value: any;
sync?: boolean;
};
export default function runTests(options: TestRunOptions, cb: Callback): void;

62
server/node_modules/yup/es/util/runTests.js generated vendored Normal file
View File

@@ -0,0 +1,62 @@
import ValidationError from '../ValidationError';
const once = cb => {
let fired = false;
return (...args) => {
if (fired) return;
fired = true;
cb(...args);
};
};
export default function runTests(options, cb) {
let {
endEarly,
tests,
args,
value,
errors,
sort,
path
} = options;
let callback = once(cb);
let count = tests.length;
const nestedErrors = [];
errors = errors ? errors : [];
if (!count) return errors.length ? callback(new ValidationError(errors, value, path)) : callback(null, value);
for (let i = 0; i < tests.length; i++) {
const test = tests[i];
test(args, function finishTestRun(err) {
if (err) {
// always return early for non validation errors
if (!ValidationError.isError(err)) {
return callback(err, value);
}
if (endEarly) {
err.value = value;
return callback(err, value);
}
nestedErrors.push(err);
}
if (--count <= 0) {
if (nestedErrors.length) {
if (sort) nestedErrors.sort(sort); //show parent errors after the nested ones: name.first, name
if (errors.length) nestedErrors.push(...errors);
errors = nestedErrors;
}
if (errors.length) {
callback(new ValidationError(errors, value, path), value);
return;
}
callback(null, value);
}
});
}
}

2
server/node_modules/yup/es/util/sortByKeyOrder.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import ValidationError from '../ValidationError';
export default function sortByKeyOrder(keys: string[]): (a: ValidationError, b: ValidationError) => number;

18
server/node_modules/yup/es/util/sortByKeyOrder.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
function findIndex(arr, err) {
let idx = Infinity;
arr.some((key, ii) => {
var _err$path;
if (((_err$path = err.path) == null ? void 0 : _err$path.indexOf(key)) !== -1) {
idx = ii;
return true;
}
});
return idx;
}
export default function sortByKeyOrder(keys) {
return (a, b) => {
return findIndex(keys, a) - findIndex(keys, b);
};
}

2
server/node_modules/yup/es/util/sortFields.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
import { ObjectShape } from '../object';
export default function sortFields(fields: ObjectShape, excludes?: readonly string[]): string[];

24
server/node_modules/yup/es/util/sortFields.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
import has from 'lodash/has'; // @ts-expect-error
import toposort from 'toposort';
import { split } from 'property-expr';
import Ref from '../Reference';
import isSchema from './isSchema';
export default function sortFields(fields, excludes = []) {
let edges = [];
let nodes = [];
function addNode(depPath, key) {
var node = split(depPath)[0];
if (!~nodes.indexOf(node)) nodes.push(node);
if (!~excludes.indexOf(`${key}-${node}`)) edges.push([key, node]);
}
for (const key in fields) if (has(fields, key)) {
let value = fields[key];
if (!~nodes.indexOf(key)) nodes.push(key);
if (Ref.isRef(value) && value.isSibling) addNode(value.path, key);else if (isSchema(value) && 'deps' in value) value.deps.forEach(path => addNode(path, key));
}
return toposort.array(nodes, edges).reverse();
}

1
server/node_modules/yup/es/util/toArray.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export default function toArray<T>(value?: null | T | T[]): T[];

3
server/node_modules/yup/es/util/toArray.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export default function toArray(value) {
return value == null ? [] : [].concat(value);
}

9
server/node_modules/yup/es/util/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
export declare type Defined<T> = T extends undefined ? never : T;
export declare type TypedSchema = {
__inputType: any;
__outputType: any;
};
export declare type TypeOf<TSchema extends TypedSchema> = TSchema['__inputType'];
export declare type Asserts<TSchema extends TypedSchema> = TSchema['__outputType'];
export declare type Thunk<T> = T | (() => T);
export declare type If<T, Y, N> = T extends undefined ? Y : N;

0
server/node_modules/yup/es/util/types.js generated vendored Normal file
View File

26
server/node_modules/yup/lib/Condition.d.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import Reference from './Reference';
import { SchemaLike } from './types';
export interface ConditionBuilder<T extends SchemaLike> {
(this: T, value: any, schema: T): SchemaLike;
(v1: any, v2: any, schema: T): SchemaLike;
(v1: any, v2: any, v3: any, schema: T): SchemaLike;
(v1: any, v2: any, v3: any, v4: any, schema: T): SchemaLike;
}
export declare type ConditionConfig<T extends SchemaLike> = {
is: any | ((...values: any[]) => boolean);
then?: SchemaLike | ((schema: T) => SchemaLike);
otherwise?: SchemaLike | ((schema: T) => SchemaLike);
};
export declare type ConditionOptions<T extends SchemaLike> = ConditionBuilder<T> | ConditionConfig<T>;
export declare type ResolveOptions<TContext = any> = {
value?: any;
parent?: any;
context?: TContext;
};
declare class Condition<T extends SchemaLike = SchemaLike> {
refs: Reference[];
fn: ConditionBuilder<T>;
constructor(refs: Reference[], options: ConditionOptions<T>);
resolve(base: T, options: ResolveOptions): any;
}
export default Condition;

54
server/node_modules/yup/lib/Condition.js generated vendored Normal file
View File

@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _has = _interopRequireDefault(require("lodash/has"));
var _isSchema = _interopRequireDefault(require("./util/isSchema"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class Condition {
constructor(refs, options) {
this.refs = refs;
this.refs = refs;
if (typeof options === 'function') {
this.fn = options;
return;
}
if (!(0, _has.default)(options, 'is')) throw new TypeError('`is:` is required for `when()` conditions');
if (!options.then && !options.otherwise) throw new TypeError('either `then:` or `otherwise:` is required for `when()` conditions');
let {
is,
then,
otherwise
} = options;
let check = typeof is === 'function' ? is : (...values) => values.every(value => value === is);
this.fn = function (...args) {
let options = args.pop();
let schema = args.pop();
let branch = check(...args) ? then : otherwise;
if (!branch) return undefined;
if (typeof branch === 'function') return branch(schema);
return schema.concat(branch.resolve(options));
};
}
resolve(base, options) {
let values = this.refs.map(ref => ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context));
let schema = this.fn.apply(base, values.concat(base, options));
if (schema === undefined || schema === base) return base;
if (!(0, _isSchema.default)(schema)) throw new TypeError('conditions must return a schema object');
return schema.resolve(options);
}
}
var _default = Condition;
exports.default = _default;

28
server/node_modules/yup/lib/Lazy.d.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import type { Callback, ValidateOptions } from './types';
import type { ResolveOptions } from './Condition';
import type { AnySchema, CastOptions } from './schema';
import { TypedSchema, TypeOf } from './util/types';
declare type ContextOf<T> = T extends AnySchema<any, infer C> ? C : never;
export declare type LazyBuilder<T extends AnySchema = any> = (value: any, options: ResolveOptions) => T;
export declare function create<T extends AnySchema>(builder: LazyBuilder<T>): Lazy<T, ContextOf<T>>;
export declare type LazyReturnValue<T> = T extends Lazy<infer TSchema> ? TSchema : never;
export declare type LazyType<T> = LazyReturnValue<T> extends TypedSchema ? TypeOf<LazyReturnValue<T>> : never;
declare class Lazy<T extends AnySchema, TContext = ContextOf<T>> implements TypedSchema {
private builder;
type: "lazy";
__isYupSchema__: boolean;
readonly __inputType: T['__inputType'];
readonly __outputType: T['__outputType'];
constructor(builder: LazyBuilder<T>);
private _resolve;
resolve(options: ResolveOptions<TContext>): T;
cast(value: any, options?: CastOptions<TContext>): T['__inputType'];
validate(value: any, options?: ValidateOptions, maybeCb?: Callback): T['__outputType'];
validateSync(value: any, options?: ValidateOptions<TContext>): T['__outputType'];
validateAt(path: string, value: any, options?: ValidateOptions<TContext>): Promise<any>;
validateSyncAt(path: string, value: any, options?: ValidateOptions<TContext>): any;
describe(): any;
isValid(value: any, options?: ValidateOptions<TContext>): Promise<boolean>;
isValidSync(value: any, options?: ValidateOptions<TContext>): boolean;
}
export default Lazy;

71
server/node_modules/yup/lib/Lazy.js generated vendored Normal file
View File

@@ -0,0 +1,71 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.create = create;
exports.default = void 0;
var _isSchema = _interopRequireDefault(require("./util/isSchema"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function create(builder) {
return new Lazy(builder);
}
class Lazy {
constructor(builder) {
this.type = 'lazy';
this.__isYupSchema__ = true;
this._resolve = (value, options = {}) => {
let schema = this.builder(value, options);
if (!(0, _isSchema.default)(schema)) throw new TypeError('lazy() functions must return a valid schema');
return schema.resolve(options);
};
this.builder = builder;
}
resolve(options) {
return this._resolve(options.value, options);
}
cast(value, options) {
return this._resolve(value, options).cast(value, options);
}
validate(value, options, maybeCb) {
// @ts-expect-error missing public callback on type
return this._resolve(value, options).validate(value, options, maybeCb);
}
validateSync(value, options) {
return this._resolve(value, options).validateSync(value, options);
}
validateAt(path, value, options) {
return this._resolve(value, options).validateAt(path, value, options);
}
validateSyncAt(path, value, options) {
return this._resolve(value, options).validateSyncAt(path, value, options);
}
describe() {
return null;
}
isValid(value, options) {
return this._resolve(value, options).isValid(value, options);
}
isValidSync(value, options) {
return this._resolve(value, options).isValidSync(value, options);
}
}
var _default = Lazy;
exports.default = _default;

32
server/node_modules/yup/lib/Reference.d.ts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import type { SchemaRefDescription } from './schema';
export declare type ReferenceOptions<TValue = unknown> = {
map?: (value: unknown) => TValue;
};
export declare function create<TValue = unknown>(key: string, options?: ReferenceOptions<TValue>): Reference<TValue>;
export default class Reference<TValue = unknown> {
readonly key: string;
readonly isContext: boolean;
readonly isValue: boolean;
readonly isSibling: boolean;
readonly path: any;
readonly getter: (data: unknown) => unknown;
readonly map?: (value: unknown) => TValue;
readonly __isYupRef: boolean;
constructor(key: string, options?: ReferenceOptions<TValue>);
getValue(value: any, parent?: {}, context?: {}): TValue;
/**
*
* @param {*} value
* @param {Object} options
* @param {Object=} options.context
* @param {Object=} options.parent
*/
cast(value: any, options?: {
parent?: {};
context?: {};
}): TValue;
resolve(): this;
describe(): SchemaRefDescription;
toString(): string;
static isRef(value: any): value is Reference;
}

76
server/node_modules/yup/lib/Reference.js generated vendored Normal file
View File

@@ -0,0 +1,76 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.create = create;
exports.default = void 0;
var _propertyExpr = require("property-expr");
const prefixes = {
context: '$',
value: '.'
};
function create(key, options) {
return new Reference(key, options);
}
class Reference {
constructor(key, options = {}) {
if (typeof key !== 'string') throw new TypeError('ref must be a string, got: ' + key);
this.key = key.trim();
if (key === '') throw new TypeError('ref must be a non-empty string');
this.isContext = this.key[0] === prefixes.context;
this.isValue = this.key[0] === prefixes.value;
this.isSibling = !this.isContext && !this.isValue;
let prefix = this.isContext ? prefixes.context : this.isValue ? prefixes.value : '';
this.path = this.key.slice(prefix.length);
this.getter = this.path && (0, _propertyExpr.getter)(this.path, true);
this.map = options.map;
}
getValue(value, parent, context) {
let result = this.isContext ? context : this.isValue ? value : parent;
if (this.getter) result = this.getter(result || {});
if (this.map) result = this.map(result);
return result;
}
/**
*
* @param {*} value
* @param {Object} options
* @param {Object=} options.context
* @param {Object=} options.parent
*/
cast(value, options) {
return this.getValue(value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context);
}
resolve() {
return this;
}
describe() {
return {
type: 'ref',
key: this.key
};
}
toString() {
return `Ref(${this.key})`;
}
static isRef(value) {
return value && value.__isYupRef;
}
} // @ts-ignore
exports.default = Reference;
Reference.prototype.__isYupRef = true;

13
server/node_modules/yup/lib/ValidationError.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
declare type Params = Record<string, unknown>;
export default class ValidationError extends Error {
value: any;
path?: string;
type?: string;
errors: string[];
params?: Params;
inner: ValidationError[];
static formatError(message: string | ((params: Params) => string) | unknown, params: Params): any;
static isError(err: any): err is ValidationError;
constructor(errorOrErrors: string | ValidationError | ValidationError[], value?: any, field?: string, type?: string);
}
export {};

55
server/node_modules/yup/lib/ValidationError.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _printValue = _interopRequireDefault(require("./util/printValue"));
var _toArray = _interopRequireDefault(require("./util/toArray"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
let strReg = /\$\{\s*(\w+)\s*\}/g;
class ValidationError extends Error {
static formatError(message, params) {
const path = params.label || params.path || 'this';
if (path !== params.path) params = _extends({}, params, {
path
});
if (typeof message === 'string') return message.replace(strReg, (_, key) => (0, _printValue.default)(params[key]));
if (typeof message === 'function') return message(params);
return message;
}
static isError(err) {
return err && err.name === 'ValidationError';
}
constructor(errorOrErrors, value, field, type) {
super();
this.name = 'ValidationError';
this.value = value;
this.path = field;
this.type = type;
this.errors = [];
this.inner = [];
(0, _toArray.default)(errorOrErrors).forEach(err => {
if (ValidationError.isError(err)) {
this.errors.push(...err.errors);
this.inner = this.inner.concat(err.inner.length ? err.inner : err);
} else {
this.errors.push(err);
}
});
this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0];
if (Error.captureStackTrace) Error.captureStackTrace(this, ValidationError);
}
}
exports.default = ValidationError;

66
server/node_modules/yup/lib/array.d.ts generated vendored Normal file
View File

@@ -0,0 +1,66 @@
import { MixedLocale } from './locale';
import type { AnyObject, InternalOptions, Callback, Message, Maybe, Preserve, Optionals } from './types';
import type Reference from './Reference';
import { Asserts, Defined, If, Thunk, TypeOf } from './util/types';
import BaseSchema, { AnySchema, SchemaInnerTypeDescription, SchemaSpec } from './schema';
import Lazy from './Lazy';
export declare type RejectorFn = (value: any, index: number, array: any[]) => boolean;
export declare function create<C extends AnyObject = AnyObject, T extends AnySchema | Lazy<any, any> = AnySchema>(type?: T): OptionalArraySchema<T, C, TypeOf<T>[] | undefined>;
export declare namespace create {
var prototype: ArraySchema<any, any, any, any>;
}
export default class ArraySchema<T extends AnySchema | Lazy<any, any>, C extends AnyObject = AnyObject, TIn extends Maybe<TypeOf<T>[]> = TypeOf<T>[] | undefined, TOut extends Maybe<Asserts<T>[]> = Asserts<T>[] | Optionals<TIn>> extends BaseSchema<TIn, C, TOut> {
innerType?: T;
constructor(type?: T);
protected _typeCheck(v: any): v is NonNullable<TIn>;
private get _subType();
protected _cast(_value: any, _opts: InternalOptions<C>): any;
protected _validate(_value: any, options: InternalOptions<C> | undefined, callback: Callback): void;
clone(spec?: SchemaSpec<any>): this;
concat<TOther extends ArraySchema<any, any, any, any>>(schema: TOther): TOther;
concat(schema: any): any;
of<TInner extends AnySchema>(schema: TInner): ArraySchema<TInner>;
length(length: number | Reference<number>, message?: Message<{
length: number;
}>): this;
min(min: number | Reference<number>, message?: Message<{
min: number;
}>): this;
max(max: number | Reference<number>, message?: Message<{
max: number;
}>): this;
ensure(): RequiredArraySchema<T, C, TIn>;
compact(rejector?: RejectorFn): this;
describe(): SchemaInnerTypeDescription;
nullable(isNullable?: true): ArraySchema<T, C, TIn | null>;
nullable(isNullable: false): ArraySchema<T, C, Exclude<TIn, null>>;
defined(): DefinedArraySchema<T, C, TIn>;
required(msg?: MixedLocale['required']): RequiredArraySchema<T, C, TIn>;
}
export interface DefinedArraySchema<T extends AnySchema | Lazy<any, any>, TContext extends AnyObject, TIn extends Maybe<TypeOf<T>[]>> extends ArraySchema<T, TContext, TIn, Asserts<T>[] | Preserve<TIn, null>> {
default<D extends Maybe<TIn>>(def: Thunk<D>): If<D, DefinedArraySchema<T, TContext, TIn | undefined>, DefinedArraySchema<T, TContext, Defined<TIn>>>;
defined(msg?: MixedLocale['defined']): this;
required(msg?: MixedLocale['required']): RequiredArraySchema<T, TContext, TIn>;
optional(): ArraySchema<T, TContext, TIn>;
notRequired(): ArraySchema<T, TContext, TIn>;
nullable(isNullable?: true): DefinedArraySchema<T, TContext, TIn | null>;
nullable(isNullable: false): RequiredArraySchema<T, TContext, Exclude<TIn, null>>;
}
export interface RequiredArraySchema<T extends AnySchema | Lazy<any, any>, TContext extends AnyObject, TIn extends Maybe<TypeOf<T>[]>> extends ArraySchema<T, TContext, TIn, Asserts<T>[]> {
default<D extends Maybe<TIn>>(def: Thunk<D>): If<D, RequiredArraySchema<T, TContext, TIn | undefined>, RequiredArraySchema<T, TContext, Defined<TIn>>>;
defined(msg?: MixedLocale['defined']): DefinedArraySchema<T, TContext, TIn>;
required(msg?: MixedLocale['required']): this;
optional(): ArraySchema<T, TContext, TIn>;
notRequired(): ArraySchema<T, TContext, TIn>;
nullable(isNullable?: true): RequiredArraySchema<T, TContext, TIn | null>;
nullable(isNullable: false): RequiredArraySchema<T, TContext, Exclude<TIn, null>>;
}
export interface OptionalArraySchema<T extends AnySchema | Lazy<any, any>, TContext extends AnyObject = AnyObject, TIn extends Maybe<TypeOf<T>[]> = TypeOf<T>[] | undefined> extends ArraySchema<T, TContext, TIn> {
default<D extends Maybe<TIn>>(def: Thunk<D>): If<D, ArraySchema<T, TContext, TIn | undefined>, ArraySchema<T, TContext, Defined<TIn>>>;
defined(msg?: MixedLocale['defined']): DefinedArraySchema<T, TContext, TIn>;
required(msg?: MixedLocale['required']): RequiredArraySchema<T, TContext, TIn>;
optional(): ArraySchema<T, TContext, TIn>;
notRequired(): ArraySchema<T, TContext, TIn>;
nullable(isNullable?: true): OptionalArraySchema<T, TContext, TIn | null>;
nullable(isNullable: false): OptionalArraySchema<T, TContext, Exclude<TIn, null>>;
}

244
server/node_modules/yup/lib/array.js generated vendored Normal file
View File

@@ -0,0 +1,244 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.create = create;
exports.default = void 0;
var _isAbsent = _interopRequireDefault(require("./util/isAbsent"));
var _isSchema = _interopRequireDefault(require("./util/isSchema"));
var _printValue = _interopRequireDefault(require("./util/printValue"));
var _locale = require("./locale");
var _runTests = _interopRequireDefault(require("./util/runTests"));
var _ValidationError = _interopRequireDefault(require("./ValidationError"));
var _schema = _interopRequireDefault(require("./schema"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function create(type) {
return new ArraySchema(type);
}
class ArraySchema extends _schema.default {
constructor(type) {
super({
type: 'array'
}); // `undefined` specifically means uninitialized, as opposed to
// "no subtype"
this.innerType = type;
this.withMutation(() => {
this.transform(function (values) {
if (typeof values === 'string') try {
values = JSON.parse(values);
} catch (err) {
values = null;
}
return this.isType(values) ? values : null;
});
});
}
_typeCheck(v) {
return Array.isArray(v);
}
get _subType() {
return this.innerType;
}
_cast(_value, _opts) {
const value = super._cast(_value, _opts); //should ignore nulls here
if (!this._typeCheck(value) || !this.innerType) return value;
let isChanged = false;
const castArray = value.map((v, idx) => {
const castElement = this.innerType.cast(v, _extends({}, _opts, {
path: `${_opts.path || ''}[${idx}]`
}));
if (castElement !== v) {
isChanged = true;
}
return castElement;
});
return isChanged ? castArray : value;
}
_validate(_value, options = {}, callback) {
var _options$abortEarly, _options$recursive;
let errors = [];
let sync = options.sync;
let path = options.path;
let innerType = this.innerType;
let endEarly = (_options$abortEarly = options.abortEarly) != null ? _options$abortEarly : this.spec.abortEarly;
let recursive = (_options$recursive = options.recursive) != null ? _options$recursive : this.spec.recursive;
let originalValue = options.originalValue != null ? options.originalValue : _value;
super._validate(_value, options, (err, value) => {
if (err) {
if (!_ValidationError.default.isError(err) || endEarly) {
return void callback(err, value);
}
errors.push(err);
}
if (!recursive || !innerType || !this._typeCheck(value)) {
callback(errors[0] || null, value);
return;
}
originalValue = originalValue || value; // #950 Ensure that sparse array empty slots are validated
let tests = new Array(value.length);
for (let idx = 0; idx < value.length; idx++) {
let item = value[idx];
let path = `${options.path || ''}[${idx}]`; // object._validate note for isStrict explanation
let innerOptions = _extends({}, options, {
path,
strict: true,
parent: value,
index: idx,
originalValue: originalValue[idx]
});
tests[idx] = (_, cb) => innerType.validate(item, innerOptions, cb);
}
(0, _runTests.default)({
sync,
path,
value,
errors,
endEarly,
tests
}, callback);
});
}
clone(spec) {
const next = super.clone(spec);
next.innerType = this.innerType;
return next;
}
concat(schema) {
let next = super.concat(schema);
next.innerType = this.innerType;
if (schema.innerType) next.innerType = next.innerType ? // @ts-expect-error Lazy doesn't have concat()
next.innerType.concat(schema.innerType) : schema.innerType;
return next;
}
of(schema) {
// FIXME: this should return a new instance of array without the default to be
let next = this.clone();
if (!(0, _isSchema.default)(schema)) throw new TypeError('`array.of()` sub-schema must be a valid yup schema not: ' + (0, _printValue.default)(schema)); // FIXME(ts):
next.innerType = schema;
return next;
}
length(length, message = _locale.array.length) {
return this.test({
message,
name: 'length',
exclusive: true,
params: {
length
},
test(value) {
return (0, _isAbsent.default)(value) || value.length === this.resolve(length);
}
});
}
min(min, message) {
message = message || _locale.array.min;
return this.test({
message,
name: 'min',
exclusive: true,
params: {
min
},
// FIXME(ts): Array<typeof T>
test(value) {
return (0, _isAbsent.default)(value) || value.length >= this.resolve(min);
}
});
}
max(max, message) {
message = message || _locale.array.max;
return this.test({
message,
name: 'max',
exclusive: true,
params: {
max
},
test(value) {
return (0, _isAbsent.default)(value) || value.length <= this.resolve(max);
}
});
}
ensure() {
return this.default(() => []).transform((val, original) => {
// We don't want to return `null` for nullable schema
if (this._typeCheck(val)) return val;
return original == null ? [] : [].concat(original);
});
}
compact(rejector) {
let reject = !rejector ? v => !!v : (v, i, a) => !rejector(v, i, a);
return this.transform(values => values != null ? values.filter(reject) : values);
}
describe() {
let base = super.describe();
if (this.innerType) base.innerType = this.innerType.describe();
return base;
}
nullable(isNullable = true) {
return super.nullable(isNullable);
}
defined() {
return super.defined();
}
required(msg) {
return super.required(msg);
}
}
exports.default = ArraySchema;
create.prototype = ArraySchema.prototype; //
// Interfaces
//

42
server/node_modules/yup/lib/boolean.d.ts generated vendored Normal file
View File

@@ -0,0 +1,42 @@
import BaseSchema from './schema';
import type { MixedLocale } from './locale';
import type { AnyObject, Maybe, Optionals } from './types';
import type { Defined } from './util/types';
export declare function create(): BooleanSchema<boolean | undefined, Record<string, any>, boolean | undefined>;
export declare namespace create {
var prototype: BooleanSchema<any, any, any>;
}
export default class BooleanSchema<TType extends Maybe<boolean> = boolean | undefined, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
constructor();
protected _typeCheck(v: any): v is NonNullable<TType>;
isTrue(message?: string | Record<string | number | symbol, unknown> | ((params: import("./types").MessageParams) => unknown) | undefined): BooleanSchema<TType | true, TContext, true | Optionals<TOut>>;
isFalse(message?: string | Record<string | number | symbol, unknown> | ((params: import("./types").MessageParams) => unknown) | undefined): BooleanSchema<TType | false, TContext, false | Optionals<TOut>>;
}
export default interface BooleanSchema<TType extends Maybe<boolean>, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
concat<TOther extends BooleanSchema<any, any, any>>(schema: TOther): TOther;
default<TNextDefault extends Maybe<TType>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? BooleanSchema<TType | undefined, TContext> : BooleanSchema<Defined<TType>, TContext>;
defined(msg?: MixedLocale['defined']): DefinedBooleanSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredBooleanSchema<TType, TContext>;
optional(): BooleanSchema<TType, TContext>;
notRequired(): BooleanSchema<TType, TContext>;
nullable(isNullable?: true): BooleanSchema<TType | null>;
nullable(isNullable: false): BooleanSchema<Exclude<TType, null>>;
}
export interface DefinedBooleanSchema<TType extends Maybe<boolean>, TContext extends AnyObject = AnyObject> extends BooleanSchema<TType, TContext, Defined<TType>> {
default<TNextDefault extends Maybe<TType>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? BooleanSchema<TType | undefined, TContext> : BooleanSchema<Defined<TType>, TContext>;
defined(msg?: MixedLocale['defined']): DefinedBooleanSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredBooleanSchema<TType, TContext>;
optional(): BooleanSchema<TType, TContext>;
notRequired(): BooleanSchema<TType, TContext>;
nullable(isNullable?: true): DefinedBooleanSchema<TType | null>;
nullable(isNullable: false): DefinedBooleanSchema<Exclude<TType, null>>;
}
export interface RequiredBooleanSchema<TType extends Maybe<boolean>, TContext extends AnyObject = AnyObject> extends BooleanSchema<TType, TContext, NonNullable<TType>> {
default<TNextDefault extends Maybe<TType>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? BooleanSchema<TType | undefined, TContext> : BooleanSchema<Defined<TType>, TContext>;
defined(msg?: MixedLocale['defined']): DefinedBooleanSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredBooleanSchema<TType, TContext>;
optional(): BooleanSchema<TType, TContext>;
notRequired(): BooleanSchema<TType, TContext>;
nullable(isNullable?: true): RequiredBooleanSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredBooleanSchema<Exclude<TType, null>, TContext>;
}

78
server/node_modules/yup/lib/boolean.js generated vendored Normal file
View File

@@ -0,0 +1,78 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.create = create;
exports.default = void 0;
var _schema = _interopRequireDefault(require("./schema"));
var _locale = require("./locale");
var _isAbsent = _interopRequireDefault(require("./util/isAbsent"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function create() {
return new BooleanSchema();
}
class BooleanSchema extends _schema.default {
constructor() {
super({
type: 'boolean'
});
this.withMutation(() => {
this.transform(function (value) {
if (!this.isType(value)) {
if (/^(true|1)$/i.test(String(value))) return true;
if (/^(false|0)$/i.test(String(value))) return false;
}
return value;
});
});
}
_typeCheck(v) {
if (v instanceof Boolean) v = v.valueOf();
return typeof v === 'boolean';
}
isTrue(message = _locale.boolean.isValue) {
return this.test({
message,
name: 'is-value',
exclusive: true,
params: {
value: 'true'
},
test(value) {
return (0, _isAbsent.default)(value) || value === true;
}
});
}
isFalse(message = _locale.boolean.isValue) {
return this.test({
message,
name: 'is-value',
exclusive: true,
params: {
value: 'false'
},
test(value) {
return (0, _isAbsent.default)(value) || value === false;
}
});
}
}
exports.default = BooleanSchema;
create.prototype = BooleanSchema.prototype;

50
server/node_modules/yup/lib/date.d.ts generated vendored Normal file
View File

@@ -0,0 +1,50 @@
import { MixedLocale } from './locale';
import Ref from './Reference';
import type { AnyObject, Maybe } from './types';
import type { Defined, If, Thunk } from './util/types';
import BaseSchema from './schema';
export declare function create(): DateSchema<Date | undefined, Record<string, any>, Date | undefined>;
export declare namespace create {
var prototype: DateSchema<any, any, any>;
var INVALID_DATE: Date;
}
export default class DateSchema<TType extends Maybe<Date> = Date | undefined, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
static INVALID_DATE: Date;
constructor();
protected _typeCheck(v: any): v is NonNullable<TType>;
private prepareParam;
min(min: unknown | Ref<Date>, message?: import("./types").Message<{
min: string | Date;
}>): this;
max(max: unknown | Ref, message?: import("./types").Message<{
max: string | Date;
}>): this;
}
export default interface DateSchema<TType extends Maybe<Date>, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
concat<TOther extends DateSchema<any, any, any>>(schema: TOther): TOther;
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, DateSchema<TType | undefined, TContext>, DateSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): DefinedDateSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredDateSchema<TType, TContext>;
optional(): DateSchema<TType, TContext>;
notRequired(): DateSchema<TType, TContext>;
nullable(isNullable?: true): DateSchema<TType | null, TContext>;
nullable(isNullable: false): DateSchema<Exclude<TType, null>, TContext>;
}
export interface DefinedDateSchema<TType extends Maybe<Date>, TContext extends AnyObject = AnyObject> extends DateSchema<TType, TContext, Defined<TType>> {
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, DefinedDateSchema<TType | undefined, TContext>, DefinedDateSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): this;
required(msg?: MixedLocale['required']): RequiredDateSchema<TType, TContext>;
optional(): DateSchema<TType, TContext>;
notRequired(): DateSchema<TType, TContext>;
nullable(isNullable?: true): RequiredDateSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredDateSchema<Exclude<TType, null>, TContext>;
}
export interface RequiredDateSchema<TType extends Maybe<Date>, TContext extends AnyObject = AnyObject> extends DateSchema<TType, TContext, NonNullable<TType>> {
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, RequiredDateSchema<TType | undefined, TContext>, RequiredDateSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): DefinedDateSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredDateSchema<TType, TContext>;
optional(): DateSchema<TType, TContext>;
notRequired(): DateSchema<TType, TContext>;
nullable(isNullable?: true): RequiredDateSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredDateSchema<Exclude<TType, null>, TContext>;
}

102
server/node_modules/yup/lib/date.js generated vendored Normal file
View File

@@ -0,0 +1,102 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.create = create;
exports.default = void 0;
var _isodate = _interopRequireDefault(require("./util/isodate"));
var _locale = require("./locale");
var _isAbsent = _interopRequireDefault(require("./util/isAbsent"));
var _Reference = _interopRequireDefault(require("./Reference"));
var _schema = _interopRequireDefault(require("./schema"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// @ts-ignore
let invalidDate = new Date('');
let isDate = obj => Object.prototype.toString.call(obj) === '[object Date]';
function create() {
return new DateSchema();
}
class DateSchema extends _schema.default {
constructor() {
super({
type: 'date'
});
this.withMutation(() => {
this.transform(function (value) {
if (this.isType(value)) return value;
value = (0, _isodate.default)(value); // 0 is a valid timestamp equivalent to 1970-01-01T00:00:00Z(unix epoch) or before.
return !isNaN(value) ? new Date(value) : invalidDate;
});
});
}
_typeCheck(v) {
return isDate(v) && !isNaN(v.getTime());
}
prepareParam(ref, name) {
let param;
if (!_Reference.default.isRef(ref)) {
let cast = this.cast(ref);
if (!this._typeCheck(cast)) throw new TypeError(`\`${name}\` must be a Date or a value that can be \`cast()\` to a Date`);
param = cast;
} else {
param = ref;
}
return param;
}
min(min, message = _locale.date.min) {
let limit = this.prepareParam(min, 'min');
return this.test({
message,
name: 'min',
exclusive: true,
params: {
min
},
test(value) {
return (0, _isAbsent.default)(value) || value >= this.resolve(limit);
}
});
}
max(max, message = _locale.date.max) {
var limit = this.prepareParam(max, 'max');
return this.test({
message,
name: 'max',
exclusive: true,
params: {
max
},
test(value) {
return (0, _isAbsent.default)(value) || value <= this.resolve(limit);
}
});
}
}
exports.default = DateSchema;
DateSchema.INVALID_DATE = invalidDate;
create.prototype = DateSchema.prototype;
create.INVALID_DATE = invalidDate;

10
server/node_modules/yup/lib/globals.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
declare module 'lodash/has' {
function has<T extends {}, Key extends PropertyKey>(
obj: T,
prop: Key,
): obj is T & Record<Key, unknown> {
return has(obj, prop);
}
export default has;
}

28
server/node_modules/yup/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import MixedSchema, { create as mixedCreate } from './mixed';
import BooleanSchema, { create as boolCreate } from './boolean';
import StringSchema, { create as stringCreate } from './string';
import NumberSchema, { create as numberCreate } from './number';
import DateSchema, { create as dateCreate } from './date';
import ObjectSchema, { AnyObject, create as objectCreate } from './object';
import ArraySchema, { create as arrayCreate } from './array';
import { create as refCreate } from './Reference';
import Lazy, { create as lazyCreate } from './Lazy';
import ValidationError from './ValidationError';
import reach from './util/reach';
import isSchema from './util/isSchema';
import setLocale from './setLocale';
import BaseSchema, { AnySchema } from './schema';
import type { TypeOf, Asserts } from './util/types';
import { Maybe } from './types';
declare function addMethod<T extends AnySchema>(schemaType: (...arg: any[]) => T, name: string, fn: (this: T, ...args: any[]) => T): void;
declare function addMethod<T extends new (...args: any) => AnySchema>(schemaType: T, name: string, fn: (this: InstanceType<T>, ...args: any[]) => InstanceType<T>): void;
declare type ObjectSchemaOf<T extends AnyObject> = ObjectSchema<{
[k in keyof T]-?: T[k] extends Array<infer E> ? ArraySchema<SchemaOf<E> | Lazy<SchemaOf<E>>> : T[k] extends AnyObject ? // we can't use ObjectSchema<{ []: SchemaOf<T[k]> }> b/c TS produces a union of two schema
ObjectSchemaOf<T[k]> | ObjectSchemaOf<Lazy<T[k]>> : BaseSchema<Maybe<T[k]>, AnyObject, T[k]>;
}>;
declare type SchemaOf<T> = T extends Array<infer E> ? ArraySchema<SchemaOf<E> | Lazy<SchemaOf<E>>> : T extends AnyObject ? ObjectSchemaOf<T> : BaseSchema<Maybe<T>, AnyObject, T>;
export declare type AnyObjectSchema = ObjectSchema<any, any, any, any>;
export type { SchemaOf, TypeOf, Asserts, Asserts as InferType, AnySchema };
export { mixedCreate as mixed, boolCreate as bool, boolCreate as boolean, stringCreate as string, numberCreate as number, dateCreate as date, objectCreate as object, arrayCreate as array, refCreate as ref, lazyCreate as lazy, reach, isSchema, addMethod, setLocale, ValidationError, };
export { BaseSchema, MixedSchema, BooleanSchema, StringSchema, NumberSchema, DateSchema, ObjectSchema, ArraySchema, };
export type { CreateErrorOptions, TestContext, TestFunction, TestOptions, TestConfig, } from './util/createValidation';

179
server/node_modules/yup/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,179 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.addMethod = addMethod;
Object.defineProperty(exports, "MixedSchema", {
enumerable: true,
get: function () {
return _mixed.default;
}
});
Object.defineProperty(exports, "mixed", {
enumerable: true,
get: function () {
return _mixed.create;
}
});
Object.defineProperty(exports, "BooleanSchema", {
enumerable: true,
get: function () {
return _boolean.default;
}
});
Object.defineProperty(exports, "bool", {
enumerable: true,
get: function () {
return _boolean.create;
}
});
Object.defineProperty(exports, "boolean", {
enumerable: true,
get: function () {
return _boolean.create;
}
});
Object.defineProperty(exports, "StringSchema", {
enumerable: true,
get: function () {
return _string.default;
}
});
Object.defineProperty(exports, "string", {
enumerable: true,
get: function () {
return _string.create;
}
});
Object.defineProperty(exports, "NumberSchema", {
enumerable: true,
get: function () {
return _number.default;
}
});
Object.defineProperty(exports, "number", {
enumerable: true,
get: function () {
return _number.create;
}
});
Object.defineProperty(exports, "DateSchema", {
enumerable: true,
get: function () {
return _date.default;
}
});
Object.defineProperty(exports, "date", {
enumerable: true,
get: function () {
return _date.create;
}
});
Object.defineProperty(exports, "ObjectSchema", {
enumerable: true,
get: function () {
return _object.default;
}
});
Object.defineProperty(exports, "object", {
enumerable: true,
get: function () {
return _object.create;
}
});
Object.defineProperty(exports, "ArraySchema", {
enumerable: true,
get: function () {
return _array.default;
}
});
Object.defineProperty(exports, "array", {
enumerable: true,
get: function () {
return _array.create;
}
});
Object.defineProperty(exports, "ref", {
enumerable: true,
get: function () {
return _Reference.create;
}
});
Object.defineProperty(exports, "lazy", {
enumerable: true,
get: function () {
return _Lazy.create;
}
});
Object.defineProperty(exports, "ValidationError", {
enumerable: true,
get: function () {
return _ValidationError.default;
}
});
Object.defineProperty(exports, "reach", {
enumerable: true,
get: function () {
return _reach.default;
}
});
Object.defineProperty(exports, "isSchema", {
enumerable: true,
get: function () {
return _isSchema.default;
}
});
Object.defineProperty(exports, "setLocale", {
enumerable: true,
get: function () {
return _setLocale.default;
}
});
Object.defineProperty(exports, "BaseSchema", {
enumerable: true,
get: function () {
return _schema.default;
}
});
var _mixed = _interopRequireWildcard(require("./mixed"));
var _boolean = _interopRequireWildcard(require("./boolean"));
var _string = _interopRequireWildcard(require("./string"));
var _number = _interopRequireWildcard(require("./number"));
var _date = _interopRequireWildcard(require("./date"));
var _object = _interopRequireWildcard(require("./object"));
var _array = _interopRequireWildcard(require("./array"));
var _Reference = require("./Reference");
var _Lazy = require("./Lazy");
var _ValidationError = _interopRequireDefault(require("./ValidationError"));
var _reach = _interopRequireDefault(require("./util/reach"));
var _isSchema = _interopRequireDefault(require("./util/isSchema"));
var _setLocale = _interopRequireDefault(require("./setLocale"));
var _schema = _interopRequireDefault(require("./schema"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function addMethod(schemaType, name, fn) {
if (!schemaType || !(0, _isSchema.default)(schemaType.prototype)) throw new TypeError('You must provide a yup schema constructor function');
if (typeof name !== 'string') throw new TypeError('A Method name must be provided');
if (typeof fn !== 'function') throw new TypeError('Method function must be provided');
schemaType.prototype[name] = fn;
}

94
server/node_modules/yup/lib/locale.d.ts generated vendored Normal file
View File

@@ -0,0 +1,94 @@
import { Message } from './types';
export interface MixedLocale {
default?: Message;
required?: Message;
oneOf?: Message<{
values: any;
}>;
notOneOf?: Message<{
values: any;
}>;
notType?: Message;
defined?: Message;
}
export interface StringLocale {
length?: Message<{
length: number;
}>;
min?: Message<{
min: number;
}>;
max?: Message<{
max: number;
}>;
matches?: Message<{
regex: RegExp;
}>;
email?: Message<{
regex: RegExp;
}>;
url?: Message<{
regex: RegExp;
}>;
uuid?: Message<{
regex: RegExp;
}>;
trim?: Message;
lowercase?: Message;
uppercase?: Message;
}
export interface NumberLocale {
min?: Message<{
min: number;
}>;
max?: Message<{
max: number;
}>;
lessThan?: Message<{
less: number;
}>;
moreThan?: Message<{
more: number;
}>;
positive?: Message<{
more: number;
}>;
negative?: Message<{
less: number;
}>;
integer?: Message;
}
export interface DateLocale {
min?: Message<{
min: Date | string;
}>;
max?: Message<{
max: Date | string;
}>;
}
export interface ObjectLocale {
noUnknown?: Message;
}
export interface ArrayLocale {
length?: Message<{
length: number;
}>;
min?: Message<{
min: number;
}>;
max?: Message<{
max: number;
}>;
}
export interface BooleanLocale {
isValue?: Message;
}
export declare let mixed: Required<MixedLocale>;
export declare let string: Required<StringLocale>;
export declare let number: Required<NumberLocale>;
export declare let date: Required<DateLocale>;
export declare let boolean: BooleanLocale;
export declare let object: Required<ObjectLocale>;
export declare let array: Required<ArrayLocale>;
declare const _default: any;
export default _default;

88
server/node_modules/yup/lib/locale.js generated vendored Normal file
View File

@@ -0,0 +1,88 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.array = exports.object = exports.boolean = exports.date = exports.number = exports.string = exports.mixed = void 0;
var _printValue = _interopRequireDefault(require("./util/printValue"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let mixed = {
default: '${path} is invalid',
required: '${path} is a required field',
oneOf: '${path} must be one of the following values: ${values}',
notOneOf: '${path} must not be one of the following values: ${values}',
notType: ({
path,
type,
value,
originalValue
}) => {
let isCast = originalValue != null && originalValue !== value;
let msg = `${path} must be a \`${type}\` type, ` + `but the final value was: \`${(0, _printValue.default)(value, true)}\`` + (isCast ? ` (cast from the value \`${(0, _printValue.default)(originalValue, true)}\`).` : '.');
if (value === null) {
msg += `\n If "null" is intended as an empty value be sure to mark the schema as \`.nullable()\``;
}
return msg;
},
defined: '${path} must be defined'
};
exports.mixed = mixed;
let string = {
length: '${path} must be exactly ${length} characters',
min: '${path} must be at least ${min} characters',
max: '${path} must be at most ${max} characters',
matches: '${path} must match the following: "${regex}"',
email: '${path} must be a valid email',
url: '${path} must be a valid URL',
uuid: '${path} must be a valid UUID',
trim: '${path} must be a trimmed string',
lowercase: '${path} must be a lowercase string',
uppercase: '${path} must be a upper case string'
};
exports.string = string;
let number = {
min: '${path} must be greater than or equal to ${min}',
max: '${path} must be less than or equal to ${max}',
lessThan: '${path} must be less than ${less}',
moreThan: '${path} must be greater than ${more}',
positive: '${path} must be a positive number',
negative: '${path} must be a negative number',
integer: '${path} must be an integer'
};
exports.number = number;
let date = {
min: '${path} field must be later than ${min}',
max: '${path} field must be at earlier than ${max}'
};
exports.date = date;
let boolean = {
isValue: '${path} field must be ${value}'
};
exports.boolean = boolean;
let object = {
noUnknown: '${path} field has unspecified keys: ${unknown}'
};
exports.object = object;
let array = {
min: '${path} field must have at least ${min} items',
max: '${path} field must have less than or equal to ${max} items',
length: '${path} must be have ${length} items'
};
exports.array = array;
var _default = Object.assign(Object.create(null), {
mixed,
string,
number,
date,
object,
array,
boolean
});
exports.default = _default;

20
server/node_modules/yup/lib/mixed.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
import type { MixedLocale } from './locale';
import { AnyObject, Maybe, Optionals } from './types';
import type { Defined } from './util/types';
import BaseSchema from './schema';
export declare class MixedSchema<TType = any, TContext = AnyObject, TOut = TType> extends BaseSchema<TType, TContext, TOut> {
default<TNextDefault extends Maybe<TType>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? MixedSchema<TType | undefined, TContext> : MixedSchema<Defined<TType>, TContext>;
concat(schema: this): this;
concat<IT, IC, IO>(schema: BaseSchema<IT, IC, IO>): MixedSchema<TType | IT, TContext & IC, NonNullable<TOut> | IO | Optionals<IO>>;
defined(msg?: MixedLocale['defined']): MixedSchema<TType, TContext, Defined<TOut>>;
required(msg?: MixedLocale['required']): MixedSchema<TType, TContext, NonNullable<TOut>>;
notRequired(): MixedSchema<TType, TContext>;
nullable(isNullable?: true): MixedSchema<TType | null, TContext>;
nullable(isNullable: false): MixedSchema<Exclude<TType, null>, TContext>;
}
declare const Mixed: typeof MixedSchema;
export default Mixed;
export declare function create<TType = any>(): MixedSchema<TType | undefined, Record<string, any>, TType | undefined>;
export declare namespace create {
var prototype: MixedSchema<any, any, any>;
}

22
server/node_modules/yup/lib/mixed.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.create = create;
exports.default = void 0;
var _schema = _interopRequireDefault(require("./schema"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const Mixed = _schema.default;
var _default = Mixed;
exports.default = _default;
function create() {
return new Mixed();
} // XXX: this is using the Base schema so that `addMethod(mixed)` works as a base class
create.prototype = Mixed.prototype;

62
server/node_modules/yup/lib/number.d.ts generated vendored Normal file
View File

@@ -0,0 +1,62 @@
import { MixedLocale } from './locale';
import type { AnyObject, Maybe, Message } from './types';
import type Reference from './Reference';
import type { Defined, If, Thunk } from './util/types';
import BaseSchema from './schema';
export declare function create(): NumberSchema<number | undefined, Record<string, any>, number | undefined>;
export declare namespace create {
var prototype: NumberSchema<any, any, any>;
}
export default class NumberSchema<TType extends Maybe<number> = number | undefined, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
constructor();
protected _typeCheck(value: any): value is NonNullable<TType>;
min(min: number | Reference<number>, message?: Message<{
min: number;
}>): this;
max(max: number | Reference<number>, message?: Message<{
max: number;
}>): this;
lessThan(less: number | Reference<number>, message?: Message<{
less: number;
}>): this;
moreThan(more: number | Reference<number>, message?: Message<{
more: number;
}>): this;
positive(msg?: Message<{
more: number;
}>): this;
negative(msg?: Message<{
less: number;
}>): this;
integer(message?: Message<{}>): this;
truncate(): this;
round(method: 'ceil' | 'floor' | 'round' | 'trunc'): this;
}
export default interface NumberSchema<TType extends Maybe<number> = number | undefined, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
concat<TOther extends NumberSchema<any, any, any>>(schema: TOther): TOther;
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, NumberSchema<TType | undefined, TContext>, NumberSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): DefinedNumberSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredNumberSchema<TType, TContext>;
optional(): NumberSchema<TType, TContext>;
notRequired(): NumberSchema<TType, TContext>;
nullable(isNullable?: true): NumberSchema<TType | null, TContext>;
nullable(isNullable: false): NumberSchema<Exclude<TType, null>, TContext>;
}
export interface DefinedNumberSchema<TType extends Maybe<number>, TContext extends AnyObject = AnyObject> extends NumberSchema<TType, TContext, Defined<TType>> {
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, DefinedNumberSchema<TType | undefined, TContext>, DefinedNumberSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): this;
required(msg?: MixedLocale['required']): RequiredNumberSchema<TType, TContext>;
optional(): NumberSchema<TType, TContext>;
notRequired(): NumberSchema<TType, TContext>;
nullable(isNullable?: true): RequiredNumberSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredNumberSchema<Exclude<TType, null>, TContext>;
}
export interface RequiredNumberSchema<TType extends Maybe<number>, TContext extends AnyObject = AnyObject> extends NumberSchema<TType, TContext, NonNullable<TType>> {
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, RequiredNumberSchema<TType | undefined, TContext>, RequiredNumberSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): DefinedNumberSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredNumberSchema<TType, TContext>;
optional(): NumberSchema<TType, TContext>;
notRequired(): NumberSchema<TType, TContext>;
nullable(isNullable?: true): RequiredNumberSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredNumberSchema<Exclude<TType, null>, TContext>;
}

150
server/node_modules/yup/lib/number.js generated vendored Normal file
View File

@@ -0,0 +1,150 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.create = create;
exports.default = void 0;
var _locale = require("./locale");
var _isAbsent = _interopRequireDefault(require("./util/isAbsent"));
var _schema = _interopRequireDefault(require("./schema"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
let isNaN = value => value != +value;
function create() {
return new NumberSchema();
}
class NumberSchema extends _schema.default {
constructor() {
super({
type: 'number'
});
this.withMutation(() => {
this.transform(function (value) {
let parsed = value;
if (typeof parsed === 'string') {
parsed = parsed.replace(/\s/g, '');
if (parsed === '') return NaN; // don't use parseFloat to avoid positives on alpha-numeric strings
parsed = +parsed;
}
if (this.isType(parsed)) return parsed;
return parseFloat(parsed);
});
});
}
_typeCheck(value) {
if (value instanceof Number) value = value.valueOf();
return typeof value === 'number' && !isNaN(value);
}
min(min, message = _locale.number.min) {
return this.test({
message,
name: 'min',
exclusive: true,
params: {
min
},
test(value) {
return (0, _isAbsent.default)(value) || value >= this.resolve(min);
}
});
}
max(max, message = _locale.number.max) {
return this.test({
message,
name: 'max',
exclusive: true,
params: {
max
},
test(value) {
return (0, _isAbsent.default)(value) || value <= this.resolve(max);
}
});
}
lessThan(less, message = _locale.number.lessThan) {
return this.test({
message,
name: 'max',
exclusive: true,
params: {
less
},
test(value) {
return (0, _isAbsent.default)(value) || value < this.resolve(less);
}
});
}
moreThan(more, message = _locale.number.moreThan) {
return this.test({
message,
name: 'min',
exclusive: true,
params: {
more
},
test(value) {
return (0, _isAbsent.default)(value) || value > this.resolve(more);
}
});
}
positive(msg = _locale.number.positive) {
return this.moreThan(0, msg);
}
negative(msg = _locale.number.negative) {
return this.lessThan(0, msg);
}
integer(message = _locale.number.integer) {
return this.test({
name: 'integer',
message,
test: val => (0, _isAbsent.default)(val) || Number.isInteger(val)
});
}
truncate() {
return this.transform(value => !(0, _isAbsent.default)(value) ? value | 0 : value);
}
round(method) {
var _method;
var avail = ['ceil', 'floor', 'round', 'trunc'];
method = ((_method = method) == null ? void 0 : _method.toLowerCase()) || 'round'; // this exists for symemtry with the new Math.trunc
if (method === 'trunc') return this.truncate();
if (avail.indexOf(method.toLowerCase()) === -1) throw new TypeError('Only valid options for round() are: ' + avail.join(', '));
return this.transform(value => !(0, _isAbsent.default)(value) ? Math[method](value) : value);
}
}
exports.default = NumberSchema;
create.prototype = NumberSchema.prototype; //
// Number Interfaces
//

89
server/node_modules/yup/lib/object.d.ts generated vendored Normal file
View File

@@ -0,0 +1,89 @@
import { MixedLocale } from './locale';
import { InternalOptions, Callback, Maybe, Optionals, Preserve } from './types';
import type { TypedSchema, Defined } from './util/types';
import type Reference from './Reference';
import Lazy from './Lazy';
import BaseSchema, { AnySchema, SchemaObjectDescription, SchemaSpec } from './schema';
export declare type Assign<T extends {}, U extends {}> = {
[P in keyof T]: P extends keyof U ? U[P] : T[P];
} & U;
export declare type AnyObject = Record<string, any>;
export declare type ObjectShape = Record<string, AnySchema | Reference | Lazy<any, any>>;
export declare type DefaultFromShape<Shape extends ObjectShape> = {
[K in keyof Shape]: Shape[K] extends ObjectSchema<infer TShape> ? DefaultFromShape<TShape> : Shape[K] extends {
getDefault: () => infer D;
} ? Preserve<D, undefined> extends never ? Defined<D> : Preserve<D, undefined> : undefined;
};
export declare type TypeOfShape<Shape extends ObjectShape> = {
[K in keyof Shape]: Shape[K] extends TypedSchema ? Shape[K]['__inputType'] : Shape[K] extends Reference ? unknown : never;
};
export declare type AssertsShape<Shape extends ObjectShape> = {
[K in keyof Shape]: Shape[K] extends TypedSchema ? Shape[K]['__outputType'] : Shape[K] extends Reference ? unknown : never;
};
export declare type ObjectSchemaSpec = SchemaSpec<any> & {
noUnknown?: boolean;
};
export default class ObjectSchema<TShape extends ObjectShape, TContext extends AnyObject = AnyObject, TIn extends Maybe<TypeOfShape<TShape>> = TypeOfShape<TShape>, TOut extends Maybe<AssertsShape<TShape>> = AssertsShape<TShape> | Optionals<TIn>> extends BaseSchema<TIn, TContext, TOut> {
fields: TShape;
spec: ObjectSchemaSpec;
private _sortErrors;
private _nodes;
private _excludedEdges;
constructor(spec?: TShape);
protected _typeCheck(value: any): value is NonNullable<TIn>;
protected _cast(_value: any, options?: InternalOptions<TContext>): any;
protected _validate(_value: any, opts: InternalOptions<TContext> | undefined, callback: Callback): void;
clone(spec?: ObjectSchemaSpec): this;
concat<TOther extends ObjectSchema<any, any, any>>(schema: TOther): TOther extends ObjectSchema<infer S, infer C, infer IType> ? ObjectSchema<TShape & S, TContext & C, TypeOfShape<TShape & S> | Optionals<IType>> : never;
concat(schema: this): this;
getDefaultFromShape(): DefaultFromShape<TShape>;
protected _getDefault(): any;
shape<TNextShape extends ObjectShape>(additions: TNextShape, excludes?: [string, string][]): ObjectSchema<Assign<TShape, TNextShape>, TContext, TypeOfShape<Assign<TShape, TNextShape>> | Optionals<TIn>>;
pick(keys: string[]): any;
omit(keys: string[]): any;
from(from: string, to: keyof TShape, alias?: boolean): this;
noUnknown(noAllow?: boolean, message?: import("./types").Message<{}>): this;
unknown(allow?: boolean, message?: import("./types").Message<{}>): this;
transformKeys(fn: (key: string) => string): this;
camelCase(): this;
snakeCase(): this;
constantCase(): this;
describe(): SchemaObjectDescription;
}
export declare function create<TShape extends ObjectShape>(spec?: TShape): OptionalObjectSchema<TShape, Record<string, any>, TypeOfShape<TShape>>;
export declare namespace create {
var prototype: ObjectSchema<any, any, any, any>;
}
export interface OptionalObjectSchema<TShape extends ObjectShape, TContext extends AnyObject = AnyObject, TIn extends Maybe<TypeOfShape<TShape>> = TypeOfShape<TShape>> extends ObjectSchema<TShape, TContext, TIn> {
default<TNextDefault extends Maybe<AnyObject>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? ObjectSchema<TShape, TContext, TIn | undefined> : ObjectSchema<TShape, TContext, Defined<TIn>>;
defined(msg?: MixedLocale['defined']): DefinedObjectSchema<TShape, TContext, TIn>;
required(msg?: MixedLocale['required']): RequiredObjectSchema<TShape, TContext, TIn>;
optional(): this;
notRequired(): this;
nullable(isNullable?: true): OptionalObjectSchema<TShape, TContext, TIn | null>;
nullable(isNullable: false): OptionalObjectSchema<TShape, TContext, Exclude<TIn, null>>;
pick<TKey extends keyof TShape>(keys: TKey[]): OptionalObjectSchema<Pick<TShape, TKey>, TContext, TypeOfShape<Pick<TShape, TKey>> | Optionals<TIn>>;
omit<TKey extends keyof TShape>(keys: TKey[]): OptionalObjectSchema<Omit<TShape, TKey>, TContext, TypeOfShape<Omit<TShape, TKey>> | Optionals<TIn>>;
}
export interface DefinedObjectSchema<TShape extends ObjectShape, TContext extends AnyObject, TIn extends Maybe<TypeOfShape<TShape>>> extends ObjectSchema<TShape, TContext, TIn, AssertsShape<TShape> | Extract<TIn, null>> {
default<TNextDefault extends Maybe<AnyObject>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? DefinedObjectSchema<TShape, TContext, TIn | undefined> : DefinedObjectSchema<TShape, TContext, Defined<TIn>>;
defined(msg?: MixedLocale['defined']): this;
required(msg?: MixedLocale['required']): RequiredObjectSchema<TShape, TContext, TIn>;
optional(): OptionalObjectSchema<TShape, TContext, TIn>;
notRequired(): OptionalObjectSchema<TShape, TContext, TIn>;
nullable(isNullable?: true): DefinedObjectSchema<TShape, TContext, TIn | null>;
nullable(isNullable: false): DefinedObjectSchema<TShape, TContext, Exclude<TIn, null>>;
pick<TKey extends keyof TShape>(keys: TKey[]): DefinedObjectSchema<Pick<TShape, TKey>, TContext, TypeOfShape<Pick<TShape, TKey>> | Optionals<TIn>>;
omit<TKey extends keyof TShape>(keys: TKey[]): DefinedObjectSchema<Omit<TShape, TKey>, TContext, TypeOfShape<Omit<TShape, TKey>> | Optionals<TIn>>;
}
export interface RequiredObjectSchema<TShape extends ObjectShape, TContext extends AnyObject, TIn extends Maybe<TypeOfShape<TShape>>> extends ObjectSchema<TShape, TContext, TIn, AssertsShape<TShape>> {
default<TNextDefault extends Maybe<AnyObject>>(def: TNextDefault | (() => TNextDefault)): TNextDefault extends undefined ? RequiredObjectSchema<TShape, TContext, TIn | undefined> : RequiredObjectSchema<TShape, TContext, Defined<TIn>>;
defined(msg?: MixedLocale['defined']): DefinedObjectSchema<TShape, TContext, TIn>;
required(msg?: MixedLocale['required']): this;
optional(): OptionalObjectSchema<TShape, TContext, TIn>;
notRequired(): OptionalObjectSchema<TShape, TContext, TIn>;
nullable(isNullable?: true): RequiredObjectSchema<TShape, TContext, TIn | null>;
nullable(isNullable: false): RequiredObjectSchema<TShape, TContext, Exclude<TIn, null>>;
pick<TKey extends keyof TShape>(keys: TKey[]): RequiredObjectSchema<Pick<TShape, TKey>, TContext, TypeOfShape<Pick<TShape, TKey>> | Optionals<TIn>>;
omit<TKey extends keyof TShape>(keys: TKey[]): RequiredObjectSchema<Omit<TShape, TKey>, TContext, TypeOfShape<Omit<TShape, TKey>> | Optionals<TIn>>;
}

378
server/node_modules/yup/lib/object.js generated vendored Normal file
View File

@@ -0,0 +1,378 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.create = create;
exports.default = void 0;
var _has = _interopRequireDefault(require("lodash/has"));
var _snakeCase = _interopRequireDefault(require("lodash/snakeCase"));
var _camelCase = _interopRequireDefault(require("lodash/camelCase"));
var _mapKeys = _interopRequireDefault(require("lodash/mapKeys"));
var _mapValues = _interopRequireDefault(require("lodash/mapValues"));
var _propertyExpr = require("property-expr");
var _locale = require("./locale");
var _sortFields = _interopRequireDefault(require("./util/sortFields"));
var _sortByKeyOrder = _interopRequireDefault(require("./util/sortByKeyOrder"));
var _runTests = _interopRequireDefault(require("./util/runTests"));
var _ValidationError = _interopRequireDefault(require("./ValidationError"));
var _schema = _interopRequireDefault(require("./schema"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
let isObject = obj => Object.prototype.toString.call(obj) === '[object Object]';
function unknown(ctx, value) {
let known = Object.keys(ctx.fields);
return Object.keys(value).filter(key => known.indexOf(key) === -1);
}
const defaultSort = (0, _sortByKeyOrder.default)([]);
class ObjectSchema extends _schema.default {
constructor(spec) {
super({
type: 'object'
});
this.fields = Object.create(null);
this._sortErrors = defaultSort;
this._nodes = [];
this._excludedEdges = [];
this.withMutation(() => {
this.transform(function coerce(value) {
if (typeof value === 'string') {
try {
value = JSON.parse(value);
} catch (err) {
value = null;
}
}
if (this.isType(value)) return value;
return null;
});
if (spec) {
this.shape(spec);
}
});
}
_typeCheck(value) {
return isObject(value) || typeof value === 'function';
}
_cast(_value, options = {}) {
var _options$stripUnknown;
let value = super._cast(_value, options); //should ignore nulls here
if (value === undefined) return this.getDefault();
if (!this._typeCheck(value)) return value;
let fields = this.fields;
let strip = (_options$stripUnknown = options.stripUnknown) != null ? _options$stripUnknown : this.spec.noUnknown;
let props = this._nodes.concat(Object.keys(value).filter(v => this._nodes.indexOf(v) === -1));
let intermediateValue = {}; // is filled during the transform below
let innerOptions = _extends({}, options, {
parent: intermediateValue,
__validating: options.__validating || false
});
let isChanged = false;
for (const prop of props) {
let field = fields[prop];
let exists = (0, _has.default)(value, prop);
if (field) {
let fieldValue;
let inputValue = value[prop]; // safe to mutate since this is fired in sequence
innerOptions.path = (options.path ? `${options.path}.` : '') + prop; // innerOptions.value = value[prop];
field = field.resolve({
value: inputValue,
context: options.context,
parent: intermediateValue
});
let fieldSpec = 'spec' in field ? field.spec : undefined;
let strict = fieldSpec == null ? void 0 : fieldSpec.strict;
if (fieldSpec == null ? void 0 : fieldSpec.strip) {
isChanged = isChanged || prop in value;
continue;
}
fieldValue = !options.__validating || !strict ? // TODO: use _cast, this is double resolving
field.cast(value[prop], innerOptions) : value[prop];
if (fieldValue !== undefined) {
intermediateValue[prop] = fieldValue;
}
} else if (exists && !strip) {
intermediateValue[prop] = value[prop];
}
if (intermediateValue[prop] !== value[prop]) {
isChanged = true;
}
}
return isChanged ? intermediateValue : value;
}
_validate(_value, opts = {}, callback) {
let errors = [];
let {
sync,
from = [],
originalValue = _value,
abortEarly = this.spec.abortEarly,
recursive = this.spec.recursive
} = opts;
from = [{
schema: this,
value: originalValue
}, ...from]; // this flag is needed for handling `strict` correctly in the context of
// validation vs just casting. e.g strict() on a field is only used when validating
opts.__validating = true;
opts.originalValue = originalValue;
opts.from = from;
super._validate(_value, opts, (err, value) => {
if (err) {
if (!_ValidationError.default.isError(err) || abortEarly) {
return void callback(err, value);
}
errors.push(err);
}
if (!recursive || !isObject(value)) {
callback(errors[0] || null, value);
return;
}
originalValue = originalValue || value;
let tests = this._nodes.map(key => (_, cb) => {
let path = key.indexOf('.') === -1 ? (opts.path ? `${opts.path}.` : '') + key : `${opts.path || ''}["${key}"]`;
let field = this.fields[key];
if (field && 'validate' in field) {
field.validate(value[key], _extends({}, opts, {
// @ts-ignore
path,
from,
// inner fields are always strict:
// 1. this isn't strict so the casting will also have cast inner values
// 2. this is strict in which case the nested values weren't cast either
strict: true,
parent: value,
originalValue: originalValue[key]
}), cb);
return;
}
cb(null);
});
(0, _runTests.default)({
sync,
tests,
value,
errors,
endEarly: abortEarly,
sort: this._sortErrors,
path: opts.path
}, callback);
});
}
clone(spec) {
const next = super.clone(spec);
next.fields = _extends({}, this.fields);
next._nodes = this._nodes;
next._excludedEdges = this._excludedEdges;
next._sortErrors = this._sortErrors;
return next;
}
concat(schema) {
let next = super.concat(schema);
let nextFields = next.fields;
for (let [field, schemaOrRef] of Object.entries(this.fields)) {
const target = nextFields[field];
if (target === undefined) {
nextFields[field] = schemaOrRef;
} else if (target instanceof _schema.default && schemaOrRef instanceof _schema.default) {
nextFields[field] = schemaOrRef.concat(target);
}
}
return next.withMutation(() => next.shape(nextFields));
}
getDefaultFromShape() {
let dft = {};
this._nodes.forEach(key => {
const field = this.fields[key];
dft[key] = 'default' in field ? field.getDefault() : undefined;
});
return dft;
}
_getDefault() {
if ('default' in this.spec) {
return super._getDefault();
} // if there is no default set invent one
if (!this._nodes.length) {
return undefined;
}
return this.getDefaultFromShape();
}
shape(additions, excludes = []) {
let next = this.clone();
let fields = Object.assign(next.fields, additions);
next.fields = fields;
next._sortErrors = (0, _sortByKeyOrder.default)(Object.keys(fields));
if (excludes.length) {
if (!Array.isArray(excludes[0])) excludes = [excludes];
let keys = excludes.map(([first, second]) => `${first}-${second}`);
next._excludedEdges = next._excludedEdges.concat(keys);
}
next._nodes = (0, _sortFields.default)(fields, next._excludedEdges);
return next;
}
pick(keys) {
const picked = {};
for (const key of keys) {
if (this.fields[key]) picked[key] = this.fields[key];
}
return this.clone().withMutation(next => {
next.fields = {};
return next.shape(picked);
});
}
omit(keys) {
const next = this.clone();
const fields = next.fields;
next.fields = {};
for (const key of keys) {
delete fields[key];
}
return next.withMutation(() => next.shape(fields));
}
from(from, to, alias) {
let fromGetter = (0, _propertyExpr.getter)(from, true);
return this.transform(obj => {
if (obj == null) return obj;
let newObj = obj;
if ((0, _has.default)(obj, from)) {
newObj = _extends({}, obj);
if (!alias) delete newObj[from];
newObj[to] = fromGetter(obj);
}
return newObj;
});
}
noUnknown(noAllow = true, message = _locale.object.noUnknown) {
if (typeof noAllow === 'string') {
message = noAllow;
noAllow = true;
}
let next = this.test({
name: 'noUnknown',
exclusive: true,
message: message,
test(value) {
if (value == null) return true;
const unknownKeys = unknown(this.schema, value);
return !noAllow || unknownKeys.length === 0 || this.createError({
params: {
unknown: unknownKeys.join(', ')
}
});
}
});
next.spec.noUnknown = noAllow;
return next;
}
unknown(allow = true, message = _locale.object.noUnknown) {
return this.noUnknown(!allow, message);
}
transformKeys(fn) {
return this.transform(obj => obj && (0, _mapKeys.default)(obj, (_, key) => fn(key)));
}
camelCase() {
return this.transformKeys(_camelCase.default);
}
snakeCase() {
return this.transformKeys(_snakeCase.default);
}
constantCase() {
return this.transformKeys(key => (0, _snakeCase.default)(key).toUpperCase());
}
describe() {
let base = super.describe();
base.fields = (0, _mapValues.default)(this.fields, value => value.describe());
return base;
}
}
exports.default = ObjectSchema;
function create(spec) {
return new ObjectSchema(spec);
}
create.prototype = ObjectSchema.prototype;

143
server/node_modules/yup/lib/schema.d.ts generated vendored Normal file
View File

@@ -0,0 +1,143 @@
import { ConditionOptions, ResolveOptions } from './Condition';
import { TestFunction, Test, TestConfig } from './util/createValidation';
import { ValidateOptions, TransformFunction, Message, Callback, InternalOptions, Maybe, ExtraParams, AnyObject } from './types';
import type { Asserts, Thunk } from './util/types';
import ReferenceSet from './util/ReferenceSet';
import Reference from './Reference';
export declare type SchemaSpec<TDefault> = {
nullable: boolean;
presence: 'required' | 'defined' | 'optional';
default?: TDefault | (() => TDefault);
abortEarly?: boolean;
strip?: boolean;
strict?: boolean;
recursive?: boolean;
label?: string | undefined;
meta?: any;
};
export declare type SchemaOptions<TDefault> = {
type?: string;
spec?: SchemaSpec<TDefault>;
};
export declare type AnySchema<Type = any, TContext = any, TOut = any> = BaseSchema<Type, TContext, TOut>;
export interface CastOptions<TContext = {}> {
parent?: any;
context?: TContext;
assert?: boolean;
stripUnknown?: boolean;
path?: string;
}
export interface SchemaRefDescription {
type: 'ref';
key: string;
}
export interface SchemaInnerTypeDescription extends SchemaDescription {
innerType?: SchemaFieldDescription;
}
export interface SchemaObjectDescription extends SchemaDescription {
fields: Record<string, SchemaFieldDescription>;
}
export declare type SchemaFieldDescription = SchemaDescription | SchemaRefDescription | SchemaObjectDescription | SchemaInnerTypeDescription;
export interface SchemaDescription {
type: string;
label?: string;
meta: object;
oneOf: unknown[];
notOneOf: unknown[];
tests: Array<{
name?: string;
params: ExtraParams | undefined;
}>;
}
export default abstract class BaseSchema<TCast = any, TContext = AnyObject, TOutput = any> {
readonly type: string;
readonly __inputType: TCast;
readonly __outputType: TOutput;
readonly __isYupSchema__: boolean;
readonly deps: readonly string[];
tests: Test[];
transforms: TransformFunction<AnySchema>[];
private conditions;
private _mutate?;
private _typeError?;
private _whitelistError?;
private _blacklistError?;
protected _whitelist: ReferenceSet;
protected _blacklist: ReferenceSet;
protected exclusiveTests: Record<string, boolean>;
spec: SchemaSpec<any>;
constructor(options?: SchemaOptions<any>);
get _type(): string;
protected _typeCheck(_value: any): _value is NonNullable<TCast>;
clone(spec?: Partial<SchemaSpec<any>>): this;
label(label: string): this;
meta(): Record<string, unknown> | undefined;
meta(obj: Record<string, unknown>): this;
withMutation<T>(fn: (schema: this) => T): T;
concat(schema: this): this;
concat(schema: AnySchema): AnySchema;
isType(v: any): boolean;
resolve(options: ResolveOptions): this;
/**
*
* @param {*} value
* @param {Object} options
* @param {*=} options.parent
* @param {*=} options.context
*/
cast(value: any, options?: CastOptions<TContext>): TCast;
protected _cast(rawValue: any, _options: CastOptions<TContext>): any;
protected _validate(_value: any, options: InternalOptions<TContext> | undefined, cb: Callback): void;
validate(value: any, options?: ValidateOptions<TContext>): Promise<this['__outputType']>;
validateSync(value: any, options?: ValidateOptions<TContext>): this['__outputType'];
isValid(value: any, options?: ValidateOptions<TContext>): Promise<boolean>;
isValidSync(value: any, options?: ValidateOptions<TContext>): value is Asserts<this>;
protected _getDefault(): any;
getDefault(options?: ResolveOptions): TCast;
default(def: Thunk<any>): any;
strict(isStrict?: boolean): this;
protected _isPresent(value: unknown): boolean;
defined(message?: Message<{}>): any;
required(message?: Message<{}>): any;
notRequired(): any;
nullable(isNullable?: true): any;
nullable(isNullable: false): any;
transform(fn: TransformFunction<this>): this;
/**
* Adds a test function to the schema's queue of tests.
* tests can be exclusive or non-exclusive.
*
* - exclusive tests, will replace any existing tests of the same name.
* - non-exclusive: can be stacked
*
* If a non-exclusive test is added to a schema with an exclusive test of the same name
* the exclusive test is removed and further tests of the same name will be stacked.
*
* If an exclusive test is added to a schema with non-exclusive tests of the same name
* the previous tests are removed and further tests of the same name will replace each other.
*/
test(options: TestConfig<TCast, TContext>): this;
test(test: TestFunction<TCast, TContext>): this;
test(name: string, test: TestFunction<TCast, TContext>): this;
test(name: string, message: Message, test: TestFunction<TCast, TContext>): this;
when(options: ConditionOptions<this>): this;
when(keys: string | string[], options: ConditionOptions<this>): this;
typeError(message: Message): this;
oneOf<U extends TCast>(enums: Array<Maybe<U> | Reference>, message?: Message<{
values: any;
}>): this;
notOneOf<U extends TCast>(enums: Array<Maybe<U> | Reference>, message?: Message<{
values: any;
}>): this;
strip(strip?: boolean): this;
describe(): SchemaDescription;
}
export default interface BaseSchema<TCast, TContext, TOutput> {
validateAt(path: string, value: any, options?: ValidateOptions<TContext>): Promise<TOutput>;
validateSyncAt(path: string, value: any, options?: ValidateOptions<TContext>): TOutput;
equals: BaseSchema['oneOf'];
is: BaseSchema['oneOf'];
not: BaseSchema['notOneOf'];
nope: BaseSchema['notOneOf'];
optional(): any;
}

581
server/node_modules/yup/lib/schema.js generated vendored Normal file
View File

@@ -0,0 +1,581 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _nanoclone = _interopRequireDefault(require("nanoclone"));
var _locale = require("./locale");
var _Condition = _interopRequireDefault(require("./Condition"));
var _runTests = _interopRequireDefault(require("./util/runTests"));
var _createValidation = _interopRequireDefault(require("./util/createValidation"));
var _printValue = _interopRequireDefault(require("./util/printValue"));
var _Reference = _interopRequireDefault(require("./Reference"));
var _reach = require("./util/reach");
var _toArray = _interopRequireDefault(require("./util/toArray"));
var _ValidationError = _interopRequireDefault(require("./ValidationError"));
var _ReferenceSet = _interopRequireDefault(require("./util/ReferenceSet"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
class BaseSchema {
constructor(options) {
this.deps = [];
this.conditions = [];
this._whitelist = new _ReferenceSet.default();
this._blacklist = new _ReferenceSet.default();
this.exclusiveTests = Object.create(null);
this.tests = [];
this.transforms = [];
this.withMutation(() => {
this.typeError(_locale.mixed.notType);
});
this.type = (options == null ? void 0 : options.type) || 'mixed';
this.spec = _extends({
strip: false,
strict: false,
abortEarly: true,
recursive: true,
nullable: false,
presence: 'optional'
}, options == null ? void 0 : options.spec);
} // TODO: remove
get _type() {
return this.type;
}
_typeCheck(_value) {
return true;
}
clone(spec) {
if (this._mutate) {
if (spec) Object.assign(this.spec, spec);
return this;
} // if the nested value is a schema we can skip cloning, since
// they are already immutable
const next = Object.create(Object.getPrototypeOf(this)); // @ts-expect-error this is readonly
next.type = this.type;
next._typeError = this._typeError;
next._whitelistError = this._whitelistError;
next._blacklistError = this._blacklistError;
next._whitelist = this._whitelist.clone();
next._blacklist = this._blacklist.clone();
next.exclusiveTests = _extends({}, this.exclusiveTests); // @ts-expect-error this is readonly
next.deps = [...this.deps];
next.conditions = [...this.conditions];
next.tests = [...this.tests];
next.transforms = [...this.transforms];
next.spec = (0, _nanoclone.default)(_extends({}, this.spec, spec));
return next;
}
label(label) {
var next = this.clone();
next.spec.label = label;
return next;
}
meta(...args) {
if (args.length === 0) return this.spec.meta;
let next = this.clone();
next.spec.meta = Object.assign(next.spec.meta || {}, args[0]);
return next;
} // withContext<TContext extends AnyObject>(): BaseSchema<
// TCast,
// TContext,
// TOutput
// > {
// return this as any;
// }
withMutation(fn) {
let before = this._mutate;
this._mutate = true;
let result = fn(this);
this._mutate = before;
return result;
}
concat(schema) {
if (!schema || schema === this) return this;
if (schema.type !== this.type && this.type !== 'mixed') throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema.type}`);
let base = this;
let combined = schema.clone();
const mergedSpec = _extends({}, base.spec, combined.spec); // if (combined.spec.nullable === UNSET)
// mergedSpec.nullable = base.spec.nullable;
// if (combined.spec.presence === UNSET)
// mergedSpec.presence = base.spec.presence;
combined.spec = mergedSpec;
combined._typeError || (combined._typeError = base._typeError);
combined._whitelistError || (combined._whitelistError = base._whitelistError);
combined._blacklistError || (combined._blacklistError = base._blacklistError); // manually merge the blacklist/whitelist (the other `schema` takes
// precedence in case of conflicts)
combined._whitelist = base._whitelist.merge(schema._whitelist, schema._blacklist);
combined._blacklist = base._blacklist.merge(schema._blacklist, schema._whitelist); // start with the current tests
combined.tests = base.tests;
combined.exclusiveTests = base.exclusiveTests; // manually add the new tests to ensure
// the deduping logic is consistent
combined.withMutation(next => {
schema.tests.forEach(fn => {
next.test(fn.OPTIONS);
});
});
return combined;
}
isType(v) {
if (this.spec.nullable && v === null) return true;
return this._typeCheck(v);
}
resolve(options) {
let schema = this;
if (schema.conditions.length) {
let conditions = schema.conditions;
schema = schema.clone();
schema.conditions = [];
schema = conditions.reduce((schema, condition) => condition.resolve(schema, options), schema);
schema = schema.resolve(options);
}
return schema;
}
/**
*
* @param {*} value
* @param {Object} options
* @param {*=} options.parent
* @param {*=} options.context
*/
cast(value, options = {}) {
let resolvedSchema = this.resolve(_extends({
value
}, options));
let result = resolvedSchema._cast(value, options);
if (value !== undefined && options.assert !== false && resolvedSchema.isType(result) !== true) {
let formattedValue = (0, _printValue.default)(value);
let formattedResult = (0, _printValue.default)(result);
throw new TypeError(`The value of ${options.path || 'field'} could not be cast to a value ` + `that satisfies the schema type: "${resolvedSchema._type}". \n\n` + `attempted value: ${formattedValue} \n` + (formattedResult !== formattedValue ? `result of cast: ${formattedResult}` : ''));
}
return result;
}
_cast(rawValue, _options) {
let value = rawValue === undefined ? rawValue : this.transforms.reduce((value, fn) => fn.call(this, value, rawValue, this), rawValue);
if (value === undefined) {
value = this.getDefault();
}
return value;
}
_validate(_value, options = {}, cb) {
let {
sync,
path,
from = [],
originalValue = _value,
strict = this.spec.strict,
abortEarly = this.spec.abortEarly
} = options;
let value = _value;
if (!strict) {
// this._validating = true;
value = this._cast(value, _extends({
assert: false
}, options)); // this._validating = false;
} // value is cast, we can check if it meets type requirements
let args = {
value,
path,
options,
originalValue,
schema: this,
label: this.spec.label,
sync,
from
};
let initialTests = [];
if (this._typeError) initialTests.push(this._typeError);
if (this._whitelistError) initialTests.push(this._whitelistError);
if (this._blacklistError) initialTests.push(this._blacklistError);
(0, _runTests.default)({
args,
value,
path,
sync,
tests: initialTests,
endEarly: abortEarly
}, err => {
if (err) return void cb(err, value);
(0, _runTests.default)({
tests: this.tests,
args,
path,
sync,
value,
endEarly: abortEarly
}, cb);
});
}
validate(value, options, maybeCb) {
let schema = this.resolve(_extends({}, options, {
value
})); // callback case is for nested validations
return typeof maybeCb === 'function' ? schema._validate(value, options, maybeCb) : new Promise((resolve, reject) => schema._validate(value, options, (err, value) => {
if (err) reject(err);else resolve(value);
}));
}
validateSync(value, options) {
let schema = this.resolve(_extends({}, options, {
value
}));
let result;
schema._validate(value, _extends({}, options, {
sync: true
}), (err, value) => {
if (err) throw err;
result = value;
});
return result;
}
isValid(value, options) {
return this.validate(value, options).then(() => true, err => {
if (_ValidationError.default.isError(err)) return false;
throw err;
});
}
isValidSync(value, options) {
try {
this.validateSync(value, options);
return true;
} catch (err) {
if (_ValidationError.default.isError(err)) return false;
throw err;
}
}
_getDefault() {
let defaultValue = this.spec.default;
if (defaultValue == null) {
return defaultValue;
}
return typeof defaultValue === 'function' ? defaultValue.call(this) : (0, _nanoclone.default)(defaultValue);
}
getDefault(options) {
let schema = this.resolve(options || {});
return schema._getDefault();
}
default(def) {
if (arguments.length === 0) {
return this._getDefault();
}
let next = this.clone({
default: def
});
return next;
}
strict(isStrict = true) {
var next = this.clone();
next.spec.strict = isStrict;
return next;
}
_isPresent(value) {
return value != null;
}
defined(message = _locale.mixed.defined) {
return this.test({
message,
name: 'defined',
exclusive: true,
test(value) {
return value !== undefined;
}
});
}
required(message = _locale.mixed.required) {
return this.clone({
presence: 'required'
}).withMutation(s => s.test({
message,
name: 'required',
exclusive: true,
test(value) {
return this.schema._isPresent(value);
}
}));
}
notRequired() {
var next = this.clone({
presence: 'optional'
});
next.tests = next.tests.filter(test => test.OPTIONS.name !== 'required');
return next;
}
nullable(isNullable = true) {
var next = this.clone({
nullable: isNullable !== false
});
return next;
}
transform(fn) {
var next = this.clone();
next.transforms.push(fn);
return next;
}
/**
* Adds a test function to the schema's queue of tests.
* tests can be exclusive or non-exclusive.
*
* - exclusive tests, will replace any existing tests of the same name.
* - non-exclusive: can be stacked
*
* If a non-exclusive test is added to a schema with an exclusive test of the same name
* the exclusive test is removed and further tests of the same name will be stacked.
*
* If an exclusive test is added to a schema with non-exclusive tests of the same name
* the previous tests are removed and further tests of the same name will replace each other.
*/
test(...args) {
let opts;
if (args.length === 1) {
if (typeof args[0] === 'function') {
opts = {
test: args[0]
};
} else {
opts = args[0];
}
} else if (args.length === 2) {
opts = {
name: args[0],
test: args[1]
};
} else {
opts = {
name: args[0],
message: args[1],
test: args[2]
};
}
if (opts.message === undefined) opts.message = _locale.mixed.default;
if (typeof opts.test !== 'function') throw new TypeError('`test` is a required parameters');
let next = this.clone();
let validate = (0, _createValidation.default)(opts);
let isExclusive = opts.exclusive || opts.name && next.exclusiveTests[opts.name] === true;
if (opts.exclusive) {
if (!opts.name) throw new TypeError('Exclusive tests must provide a unique `name` identifying the test');
}
if (opts.name) next.exclusiveTests[opts.name] = !!opts.exclusive;
next.tests = next.tests.filter(fn => {
if (fn.OPTIONS.name === opts.name) {
if (isExclusive) return false;
if (fn.OPTIONS.test === validate.OPTIONS.test) return false;
}
return true;
});
next.tests.push(validate);
return next;
}
when(keys, options) {
if (!Array.isArray(keys) && typeof keys !== 'string') {
options = keys;
keys = '.';
}
let next = this.clone();
let deps = (0, _toArray.default)(keys).map(key => new _Reference.default(key));
deps.forEach(dep => {
// @ts-ignore
if (dep.isSibling) next.deps.push(dep.key);
});
next.conditions.push(new _Condition.default(deps, options));
return next;
}
typeError(message) {
var next = this.clone();
next._typeError = (0, _createValidation.default)({
message,
name: 'typeError',
test(value) {
if (value !== undefined && !this.schema.isType(value)) return this.createError({
params: {
type: this.schema._type
}
});
return true;
}
});
return next;
}
oneOf(enums, message = _locale.mixed.oneOf) {
var next = this.clone();
enums.forEach(val => {
next._whitelist.add(val);
next._blacklist.delete(val);
});
next._whitelistError = (0, _createValidation.default)({
message,
name: 'oneOf',
test(value) {
if (value === undefined) return true;
let valids = this.schema._whitelist;
return valids.has(value, this.resolve) ? true : this.createError({
params: {
values: valids.toArray().join(', ')
}
});
}
});
return next;
}
notOneOf(enums, message = _locale.mixed.notOneOf) {
var next = this.clone();
enums.forEach(val => {
next._blacklist.add(val);
next._whitelist.delete(val);
});
next._blacklistError = (0, _createValidation.default)({
message,
name: 'notOneOf',
test(value) {
let invalids = this.schema._blacklist;
if (invalids.has(value, this.resolve)) return this.createError({
params: {
values: invalids.toArray().join(', ')
}
});
return true;
}
});
return next;
}
strip(strip = true) {
let next = this.clone();
next.spec.strip = strip;
return next;
}
describe() {
const next = this.clone();
const {
label,
meta
} = next.spec;
const description = {
meta,
label,
type: next.type,
oneOf: next._whitelist.describe(),
notOneOf: next._blacklist.describe(),
tests: next.tests.map(fn => ({
name: fn.OPTIONS.name,
params: fn.OPTIONS.params
})).filter((n, idx, list) => list.findIndex(c => c.name === n.name) === idx)
};
return description;
}
}
exports.default = BaseSchema;
// @ts-expect-error
BaseSchema.prototype.__isYupSchema__ = true;
for (const method of ['validate', 'validateSync']) BaseSchema.prototype[`${method}At`] = function (path, value, options = {}) {
const {
parent,
parentPath,
schema
} = (0, _reach.getIn)(this, path, value, options.context);
return schema[method](parent && parent[parentPath], _extends({}, options, {
parent,
path
}));
};
for (const alias of ['equals', 'is']) BaseSchema.prototype[alias] = BaseSchema.prototype.oneOf;
for (const alias of ['not', 'nope']) BaseSchema.prototype[alias] = BaseSchema.prototype.notOneOf;
BaseSchema.prototype.optional = BaseSchema.prototype.notRequired;

1
server/node_modules/yup/lib/setLocale.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export default function setLocale(custom: any): void;

18
server/node_modules/yup/lib/setLocale.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = setLocale;
var _locale = _interopRequireDefault(require("./locale"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function setLocale(custom) {
Object.keys(custom).forEach(type => {
Object.keys(custom[type]).forEach(method => {
_locale.default[type][method] = custom[type][method];
});
});
}

73
server/node_modules/yup/lib/string.d.ts generated vendored Normal file
View File

@@ -0,0 +1,73 @@
import { MixedLocale } from './locale';
import type Reference from './Reference';
import type { Message, Maybe, AnyObject } from './types';
import type { Defined, If, Thunk } from './util/types';
import BaseSchema from './schema';
export declare type MatchOptions = {
excludeEmptyString?: boolean;
message: Message<{
regex: RegExp;
}>;
name?: string;
};
export declare function create(): StringSchema<string | undefined, Record<string, any>, string | undefined>;
export declare namespace create {
var prototype: StringSchema<any, any, any>;
}
export default class StringSchema<TType extends Maybe<string> = string | undefined, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
constructor();
protected _typeCheck(value: any): value is NonNullable<TType>;
protected _isPresent(value: any): boolean;
length(length: number | Reference<number>, message?: Message<{
length: number;
}>): this;
min(min: number | Reference<number>, message?: Message<{
min: number;
}>): this;
max(max: number | Reference<number>, message?: Message<{
max: number;
}>): this;
matches(regex: RegExp, options?: MatchOptions | MatchOptions['message']): this;
email(message?: Message<{
regex: RegExp;
}>): this;
url(message?: Message<{
regex: RegExp;
}>): this;
uuid(message?: Message<{
regex: RegExp;
}>): this;
ensure(): StringSchema<NonNullable<TType>>;
trim(message?: Message<{}>): this;
lowercase(message?: Message<{}>): this;
uppercase(message?: Message<{}>): this;
}
export interface DefinedStringSchema<TType extends Maybe<string>, TContext extends AnyObject = AnyObject> extends StringSchema<TType, TContext, Defined<TType>> {
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, DefinedStringSchema<TType | undefined, TContext>, DefinedStringSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): this;
required(msg?: MixedLocale['required']): RequiredStringSchema<TType, TContext>;
optional(): StringSchema<TType, TContext>;
notRequired(): StringSchema<TType, TContext>;
nullable(isNullable?: true): RequiredStringSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredStringSchema<Exclude<TType, null>, TContext>;
}
export interface RequiredStringSchema<TType extends Maybe<string>, TContext extends AnyObject = AnyObject> extends StringSchema<TType, TContext, NonNullable<TType>> {
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, RequiredStringSchema<TType | undefined, TContext>, RequiredStringSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): DefinedStringSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredStringSchema<TType, TContext>;
optional(): StringSchema<TType, TContext>;
notRequired(): StringSchema<TType, TContext>;
nullable(isNullable?: true): RequiredStringSchema<TType | null, TContext>;
nullable(isNullable: false): RequiredStringSchema<Exclude<TType, null>, TContext>;
}
export default interface StringSchema<TType extends Maybe<string> = string | undefined, TContext extends AnyObject = AnyObject, TOut extends TType = TType> extends BaseSchema<TType, TContext, TOut> {
concat<TOther extends StringSchema<any, any, any>>(schema: TOther): TOther;
default<D extends Maybe<TType>>(def: Thunk<D>): If<D, StringSchema<TType | undefined, TContext>, StringSchema<Defined<TType>, TContext>>;
defined(msg?: MixedLocale['defined']): DefinedStringSchema<TType, TContext>;
required(msg?: MixedLocale['required']): RequiredStringSchema<TType, TContext>;
optional(): StringSchema<TType, TContext>;
notRequired(): StringSchema<TType, TContext>;
nullable(isNullable?: true): StringSchema<TType | null, TContext>;
nullable(isNullable: false): StringSchema<Exclude<TType, null>, TContext>;
withContext<TNextContext extends TContext>(): StringSchema<Exclude<TType, null>, TNextContext>;
}

192
server/node_modules/yup/lib/string.js generated vendored Normal file
View File

@@ -0,0 +1,192 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.create = create;
exports.default = void 0;
var _locale = require("./locale");
var _isAbsent = _interopRequireDefault(require("./util/isAbsent"));
var _schema = _interopRequireDefault(require("./schema"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// eslint-disable-next-line
let rEmail = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i; // eslint-disable-next-line
let rUrl = /^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i; // eslint-disable-next-line
let rUUID = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
let isTrimmed = value => (0, _isAbsent.default)(value) || value === value.trim();
let objStringTag = {}.toString();
function create() {
return new StringSchema();
}
class StringSchema extends _schema.default {
constructor() {
super({
type: 'string'
});
this.withMutation(() => {
this.transform(function (value) {
if (this.isType(value)) return value;
if (Array.isArray(value)) return value;
const strValue = value != null && value.toString ? value.toString() : value;
if (strValue === objStringTag) return value;
return strValue;
});
});
}
_typeCheck(value) {
if (value instanceof String) value = value.valueOf();
return typeof value === 'string';
}
_isPresent(value) {
return super._isPresent(value) && !!value.length;
}
length(length, message = _locale.string.length) {
return this.test({
message,
name: 'length',
exclusive: true,
params: {
length
},
test(value) {
return (0, _isAbsent.default)(value) || value.length === this.resolve(length);
}
});
}
min(min, message = _locale.string.min) {
return this.test({
message,
name: 'min',
exclusive: true,
params: {
min
},
test(value) {
return (0, _isAbsent.default)(value) || value.length >= this.resolve(min);
}
});
}
max(max, message = _locale.string.max) {
return this.test({
name: 'max',
exclusive: true,
message,
params: {
max
},
test(value) {
return (0, _isAbsent.default)(value) || value.length <= this.resolve(max);
}
});
}
matches(regex, options) {
let excludeEmptyString = false;
let message;
let name;
if (options) {
if (typeof options === 'object') {
({
excludeEmptyString = false,
message,
name
} = options);
} else {
message = options;
}
}
return this.test({
name: name || 'matches',
message: message || _locale.string.matches,
params: {
regex
},
test: value => (0, _isAbsent.default)(value) || value === '' && excludeEmptyString || value.search(regex) !== -1
});
}
email(message = _locale.string.email) {
return this.matches(rEmail, {
name: 'email',
message,
excludeEmptyString: true
});
}
url(message = _locale.string.url) {
return this.matches(rUrl, {
name: 'url',
message,
excludeEmptyString: true
});
}
uuid(message = _locale.string.uuid) {
return this.matches(rUUID, {
name: 'uuid',
message,
excludeEmptyString: false
});
} //-- transforms --
ensure() {
return this.default('').transform(val => val === null ? '' : val);
}
trim(message = _locale.string.trim) {
return this.transform(val => val != null ? val.trim() : val).test({
message,
name: 'trim',
test: isTrimmed
});
}
lowercase(message = _locale.string.lowercase) {
return this.transform(value => !(0, _isAbsent.default)(value) ? value.toLowerCase() : value).test({
message,
name: 'string_case',
exclusive: true,
test: value => (0, _isAbsent.default)(value) || value === value.toLowerCase()
});
}
uppercase(message = _locale.string.uppercase) {
return this.transform(value => !(0, _isAbsent.default)(value) ? value.toUpperCase() : value).test({
message,
name: 'string_case',
exclusive: true,
test: value => (0, _isAbsent.default)(value) || value === value.toUpperCase()
});
}
}
exports.default = StringSchema;
create.prototype = StringSchema.prototype; //
// String Interfaces
//

52
server/node_modules/yup/lib/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,52 @@
import type { AnySchema } from './schema';
import type Lazy from './Lazy';
export declare type AnyObject = Record<string, any>;
export declare type SchemaLike = AnySchema | Lazy<any>;
export declare type Callback<T = any> = (err: Error | null, value?: T) => void;
export declare type TransformFunction<T extends AnySchema> = (this: T, value: any, originalValue: any, schema: T) => any;
export interface ValidateOptions<TContext = {}> {
/**
* Only validate the input, and skip and coercion or transformation. Default - false
*/
strict?: boolean;
/**
* Return from validation methods on the first error rather than after all validations run. Default - true
*/
abortEarly?: boolean;
/**
* Remove unspecified keys from objects. Default - false
*/
stripUnknown?: boolean;
/**
* When false validations will not descend into nested schema (relevant for objects or arrays). Default - true
*/
recursive?: boolean;
/**
* Any context needed for validating schema conditions (see: when())
*/
context?: TContext;
}
export interface InternalOptions<TContext = {}> extends ValidateOptions<TContext> {
__validating?: boolean;
originalValue?: any;
parent?: any;
path?: string;
sync?: boolean;
from?: {
schema: AnySchema;
value: any;
}[];
}
export interface MessageParams {
path: string;
value: any;
originalValue: any;
label: string;
type: string;
}
export declare type Message<Extra extends Record<string, unknown> = {}> = string | ((params: Extra & MessageParams) => unknown) | Record<PropertyKey, unknown>;
export declare type ExtraParams = Record<string, unknown>;
export declare type AnyMessageParams = MessageParams & ExtraParams;
export declare type Maybe<T> = T | null | undefined;
export declare type Preserve<T, U> = T extends U ? U : never;
export declare type Optionals<T> = Extract<T, null | undefined>;

1
server/node_modules/yup/lib/types.js generated vendored Normal file
View File

@@ -0,0 +1 @@
"use strict";

14
server/node_modules/yup/lib/util/ReferenceSet.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import Reference from '../Reference';
export default class ReferenceSet {
list: Set<unknown>;
refs: Map<string, Reference>;
constructor();
get size(): number;
describe(): unknown[];
toArray(): unknown[];
add(value: unknown): void;
delete(value: unknown): void;
has(value: unknown, resolve: (v: unknown) => unknown): boolean;
clone(): ReferenceSet;
merge(newItems: ReferenceSet, removeItems: ReferenceSet): ReferenceSet;
}

72
server/node_modules/yup/lib/util/ReferenceSet.js generated vendored Normal file
View File

@@ -0,0 +1,72 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _Reference = _interopRequireDefault(require("../Reference"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class ReferenceSet {
constructor() {
this.list = new Set();
this.refs = new Map();
}
get size() {
return this.list.size + this.refs.size;
}
describe() {
const description = [];
for (const item of this.list) description.push(item);
for (const [, ref] of this.refs) description.push(ref.describe());
return description;
}
toArray() {
return Array.from(this.list).concat(Array.from(this.refs.values()));
}
add(value) {
_Reference.default.isRef(value) ? this.refs.set(value.key, value) : this.list.add(value);
}
delete(value) {
_Reference.default.isRef(value) ? this.refs.delete(value.key) : this.list.delete(value);
}
has(value, resolve) {
if (this.list.has(value)) return true;
let item,
values = this.refs.values();
while (item = values.next(), !item.done) if (resolve(item.value) === value) return true;
return false;
}
clone() {
const next = new ReferenceSet();
next.list = new Set(this.list);
next.refs = new Map(this.refs);
return next;
}
merge(newItems, removeItems) {
const next = this.clone();
newItems.list.forEach(value => next.add(value));
newItems.refs.forEach(value => next.add(value));
removeItems.list.forEach(value => next.delete(value));
removeItems.refs.forEach(value => next.delete(value));
return next;
}
}
exports.default = ReferenceSet;

52
server/node_modules/yup/lib/util/createValidation.d.ts generated vendored Normal file
View File

@@ -0,0 +1,52 @@
import ValidationError from '../ValidationError';
import { ValidateOptions, Message, InternalOptions, Callback, ExtraParams } from '../types';
import Reference from '../Reference';
import type { AnySchema } from '../schema';
export declare type CreateErrorOptions = {
path?: string;
message?: Message<any>;
params?: ExtraParams;
type?: string;
};
export declare type TestContext<TContext = {}> = {
path: string;
options: ValidateOptions<TContext>;
parent: any;
schema: any;
resolve: <T>(value: T | Reference<T>) => T;
createError: (params?: CreateErrorOptions) => ValidationError;
};
export declare type TestFunction<T = unknown, TContext = {}> = (this: TestContext<TContext>, value: T, context: TestContext<TContext>) => boolean | ValidationError | Promise<boolean | ValidationError>;
export declare type TestOptions<TSchema extends AnySchema = AnySchema> = {
value: any;
path?: string;
label?: string;
options: InternalOptions;
originalValue: any;
schema: TSchema;
sync?: boolean;
};
export declare type TestConfig<TValue = unknown, TContext = {}> = {
name?: string;
message?: Message<any>;
test: TestFunction<TValue, TContext>;
params?: ExtraParams;
exclusive?: boolean;
};
export declare type Test = ((opts: TestOptions, cb: Callback) => void) & {
OPTIONS: TestConfig;
};
export default function createValidation(config: {
name?: string;
test: TestFunction;
params?: ExtraParams;
message?: Message<any>;
}): {
<TSchema extends AnySchema<any, any, any> = AnySchema<any, any, any>>({ value, path, label, options, originalValue, sync, ...rest }: TestOptions<TSchema>, cb: Callback): void;
OPTIONS: {
name?: string | undefined;
test: TestFunction;
params?: Record<string, unknown> | undefined;
message?: string | Record<string | number | symbol, unknown> | ((params: any) => unknown) | undefined;
};
};

101
server/node_modules/yup/lib/util/createValidation.js generated vendored Normal file
View File

@@ -0,0 +1,101 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createValidation;
var _mapValues = _interopRequireDefault(require("lodash/mapValues"));
var _ValidationError = _interopRequireDefault(require("../ValidationError"));
var _Reference = _interopRequireDefault(require("../Reference"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function createValidation(config) {
function validate(_ref, cb) {
let {
value,
path = '',
label,
options,
originalValue,
sync
} = _ref,
rest = _objectWithoutPropertiesLoose(_ref, ["value", "path", "label", "options", "originalValue", "sync"]);
const {
name,
test,
params,
message
} = config;
let {
parent,
context
} = options;
function resolve(item) {
return _Reference.default.isRef(item) ? item.getValue(value, parent, context) : item;
}
function createError(overrides = {}) {
const nextParams = (0, _mapValues.default)(_extends({
value,
originalValue,
label,
path: overrides.path || path
}, params, overrides.params), resolve);
const error = new _ValidationError.default(_ValidationError.default.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name);
error.params = nextParams;
return error;
}
let ctx = _extends({
path,
parent,
type: name,
createError,
resolve,
options,
originalValue
}, rest);
if (!sync) {
try {
Promise.resolve(test.call(ctx, value, ctx)).then(validOrError => {
if (_ValidationError.default.isError(validOrError)) cb(validOrError);else if (!validOrError) cb(createError());else cb(null, validOrError);
});
} catch (err) {
cb(err);
}
return;
}
let result;
try {
var _ref2;
result = test.call(ctx, value, ctx);
if (typeof ((_ref2 = result) == null ? void 0 : _ref2.then) === 'function') {
throw new Error(`Validation test of type: "${ctx.type}" returned a Promise during a synchronous validate. ` + `This test will finish after the validate call has returned`);
}
} catch (err) {
cb(err);
return;
}
if (_ValidationError.default.isError(result)) cb(result);else if (!result) cb(createError());else cb(null, result);
}
validate.OPTIONS = config;
return validate;
}

2
server/node_modules/yup/lib/util/isAbsent.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
declare const _default: (value: any) => value is null | undefined;
export default _default;

10
server/node_modules/yup/lib/util/isAbsent.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _default = value => value == null;
exports.default = _default;

3
server/node_modules/yup/lib/util/isSchema.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import type { SchemaLike } from '../types';
declare const _default: (obj: any) => obj is SchemaLike;
export default _default;

Some files were not shown because too many files have changed in this diff Show More