@hookform/resolvers 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +420 -0
  3. package/class-validator/dist/class-validator.d.ts +2 -0
  4. package/class-validator/dist/class-validator.js +2 -0
  5. package/class-validator/dist/class-validator.js.map +1 -0
  6. package/class-validator/dist/class-validator.mjs +2 -0
  7. package/class-validator/dist/class-validator.modern.js +2 -0
  8. package/class-validator/dist/class-validator.modern.js.map +1 -0
  9. package/class-validator/dist/class-validator.module.js +2 -0
  10. package/class-validator/dist/class-validator.module.js.map +1 -0
  11. package/class-validator/dist/class-validator.umd.js +2 -0
  12. package/class-validator/dist/class-validator.umd.js.map +1 -0
  13. package/class-validator/dist/index.d.ts +2 -0
  14. package/class-validator/dist/types.d.ts +8 -0
  15. package/class-validator/package.json +19 -0
  16. package/class-validator/src/__tests__/Form-native-validation.tsx +83 -0
  17. package/class-validator/src/__tests__/Form.tsx +55 -0
  18. package/class-validator/src/__tests__/__fixtures__/data.ts +88 -0
  19. package/class-validator/src/__tests__/__snapshots__/class-validator.ts.snap +207 -0
  20. package/class-validator/src/__tests__/class-validator.ts +87 -0
  21. package/class-validator/src/class-validator.ts +62 -0
  22. package/class-validator/src/index.ts +2 -0
  23. package/class-validator/src/types.ts +22 -0
  24. package/computed-types/dist/computed-types.d.ts +2 -0
  25. package/computed-types/dist/computed-types.js +2 -0
  26. package/computed-types/dist/computed-types.js.map +1 -0
  27. package/computed-types/dist/computed-types.mjs +2 -0
  28. package/computed-types/dist/computed-types.modern.js +2 -0
  29. package/computed-types/dist/computed-types.modern.js.map +1 -0
  30. package/computed-types/dist/computed-types.module.js +2 -0
  31. package/computed-types/dist/computed-types.module.js.map +1 -0
  32. package/computed-types/dist/computed-types.umd.js +2 -0
  33. package/computed-types/dist/computed-types.umd.js.map +1 -0
  34. package/computed-types/dist/index.d.ts +2 -0
  35. package/computed-types/dist/types.d.ts +2 -0
  36. package/computed-types/package.json +17 -0
  37. package/computed-types/src/__tests__/Form-native-validation.tsx +85 -0
  38. package/computed-types/src/__tests__/Form.tsx +54 -0
  39. package/computed-types/src/__tests__/__fixtures__/data.ts +72 -0
  40. package/computed-types/src/__tests__/__snapshots__/computed-types.ts.snap +55 -0
  41. package/computed-types/src/__tests__/computed-types.ts +24 -0
  42. package/computed-types/src/computed-types.ts +43 -0
  43. package/computed-types/src/index.ts +2 -0
  44. package/computed-types/src/types.ts +14 -0
  45. package/dist/index.d.ts +2 -0
  46. package/dist/resolvers.js +2 -0
  47. package/dist/resolvers.js.map +1 -0
  48. package/dist/resolvers.mjs +2 -0
  49. package/dist/resolvers.mjs.map +1 -0
  50. package/dist/resolvers.module.js +2 -0
  51. package/dist/resolvers.module.js.map +1 -0
  52. package/dist/resolvers.umd.js +2 -0
  53. package/dist/resolvers.umd.js.map +1 -0
  54. package/dist/toNestError.d.ts +2 -0
  55. package/dist/validateFieldsNatively.d.ts +2 -0
  56. package/io-ts/dist/arrayToPath.d.ts +3 -0
  57. package/io-ts/dist/errorsToRecord.d.ts +5 -0
  58. package/io-ts/dist/index.d.ts +2 -0
  59. package/io-ts/dist/io-ts.d.ts +2 -0
  60. package/io-ts/dist/io-ts.js +2 -0
  61. package/io-ts/dist/io-ts.js.map +1 -0
  62. package/io-ts/dist/io-ts.mjs +2 -0
  63. package/io-ts/dist/io-ts.modern.js +2 -0
  64. package/io-ts/dist/io-ts.modern.js.map +1 -0
  65. package/io-ts/dist/io-ts.module.js +2 -0
  66. package/io-ts/dist/io-ts.module.js.map +1 -0
  67. package/io-ts/dist/io-ts.umd.js +2 -0
  68. package/io-ts/dist/io-ts.umd.js.map +1 -0
  69. package/io-ts/dist/types.d.ts +7 -0
  70. package/io-ts/package.json +19 -0
  71. package/io-ts/src/__tests__/Form-native-validation.tsx +89 -0
  72. package/io-ts/src/__tests__/Form.tsx +65 -0
  73. package/io-ts/src/__tests__/__fixtures__/data.ts +129 -0
  74. package/io-ts/src/__tests__/__snapshots__/io-ts.ts.snap +89 -0
  75. package/io-ts/src/__tests__/io-ts.ts +37 -0
  76. package/io-ts/src/arrayToPath.ts +18 -0
  77. package/io-ts/src/errorsToRecord.ts +131 -0
  78. package/io-ts/src/index.ts +2 -0
  79. package/io-ts/src/io-ts.ts +33 -0
  80. package/io-ts/src/types.ts +23 -0
  81. package/joi/dist/index.d.ts +2 -0
  82. package/joi/dist/joi.d.ts +2 -0
  83. package/joi/dist/joi.js +2 -0
  84. package/joi/dist/joi.js.map +1 -0
  85. package/joi/dist/joi.mjs +2 -0
  86. package/joi/dist/joi.modern.js +2 -0
  87. package/joi/dist/joi.modern.js.map +1 -0
  88. package/joi/dist/joi.module.js +2 -0
  89. package/joi/dist/joi.module.js.map +1 -0
  90. package/joi/dist/joi.umd.js +2 -0
  91. package/joi/dist/joi.umd.js.map +1 -0
  92. package/joi/dist/types.d.ts +5 -0
  93. package/joi/package.json +17 -0
  94. package/joi/src/__tests__/Form-native-validation.tsx +89 -0
  95. package/joi/src/__tests__/Form.tsx +61 -0
  96. package/joi/src/__tests__/__fixtures__/data.ts +85 -0
  97. package/joi/src/__tests__/__snapshots__/joi.ts.snap +293 -0
  98. package/joi/src/__tests__/joi.ts +98 -0
  99. package/joi/src/index.ts +2 -0
  100. package/joi/src/joi.ts +81 -0
  101. package/joi/src/types.ts +16 -0
  102. package/nope/dist/index.d.ts +2 -0
  103. package/nope/dist/nope.d.ts +2 -0
  104. package/nope/dist/nope.js +2 -0
  105. package/nope/dist/nope.js.map +1 -0
  106. package/nope/dist/nope.mjs +2 -0
  107. package/nope/dist/nope.modern.js +2 -0
  108. package/nope/dist/nope.modern.js.map +1 -0
  109. package/nope/dist/nope.module.js +2 -0
  110. package/nope/dist/nope.module.js.map +1 -0
  111. package/nope/dist/nope.umd.js +2 -0
  112. package/nope/dist/nope.umd.js.map +1 -0
  113. package/nope/dist/types.d.ts +6 -0
  114. package/nope/package.json +18 -0
  115. package/nope/src/__tests__/Form-native-validation.tsx +89 -0
  116. package/nope/src/__tests__/Form.tsx +57 -0
  117. package/nope/src/__tests__/__fixtures__/data.ts +70 -0
  118. package/nope/src/__tests__/__snapshots__/nope.ts.snap +43 -0
  119. package/nope/src/__tests__/nope.ts +28 -0
  120. package/nope/src/index.ts +2 -0
  121. package/nope/src/nope.ts +46 -0
  122. package/nope/src/types.ts +22 -0
  123. package/package.json +216 -0
  124. package/superstruct/dist/index.d.ts +2 -0
  125. package/superstruct/dist/superstruct.d.ts +2 -0
  126. package/superstruct/dist/superstruct.js +2 -0
  127. package/superstruct/dist/superstruct.js.map +1 -0
  128. package/superstruct/dist/superstruct.mjs +2 -0
  129. package/superstruct/dist/superstruct.modern.js +2 -0
  130. package/superstruct/dist/superstruct.modern.js.map +1 -0
  131. package/superstruct/dist/superstruct.module.js +2 -0
  132. package/superstruct/dist/superstruct.module.js.map +1 -0
  133. package/superstruct/dist/superstruct.umd.js +2 -0
  134. package/superstruct/dist/superstruct.umd.js.map +1 -0
  135. package/superstruct/dist/types.d.ts +5 -0
  136. package/superstruct/package.json +18 -0
  137. package/superstruct/src/__tests__/Form-native-validation.tsx +86 -0
  138. package/superstruct/src/__tests__/Form.tsx +62 -0
  139. package/superstruct/src/__tests__/__fixtures__/data.ts +75 -0
  140. package/superstruct/src/__tests__/__snapshots__/superstruct.ts.snap +64 -0
  141. package/superstruct/src/__tests__/superstruct.ts +24 -0
  142. package/superstruct/src/index.ts +2 -0
  143. package/superstruct/src/superstruct.ts +37 -0
  144. package/superstruct/src/types.ts +17 -0
  145. package/typanion/dist/index.d.ts +2 -0
  146. package/typanion/dist/typanion.d.ts +2 -0
  147. package/typanion/dist/typanion.js +2 -0
  148. package/typanion/dist/typanion.js.map +1 -0
  149. package/typanion/dist/typanion.mjs +2 -0
  150. package/typanion/dist/typanion.modern.js +2 -0
  151. package/typanion/dist/typanion.modern.js.map +1 -0
  152. package/typanion/dist/typanion.module.js +2 -0
  153. package/typanion/dist/typanion.module.js.map +1 -0
  154. package/typanion/dist/typanion.umd.js +2 -0
  155. package/typanion/dist/typanion.umd.js.map +1 -0
  156. package/typanion/dist/types.d.ts +6 -0
  157. package/typanion/package.json +18 -0
  158. package/typanion/src/__tests__/Form-native-validation.tsx +89 -0
  159. package/typanion/src/__tests__/Form.tsx +61 -0
  160. package/typanion/src/__tests__/__fixtures__/data.ts +77 -0
  161. package/typanion/src/__tests__/__snapshots__/typanion.ts.snap +67 -0
  162. package/typanion/src/__tests__/typanion.ts +31 -0
  163. package/typanion/src/index.ts +2 -0
  164. package/typanion/src/typanion.ts +44 -0
  165. package/typanion/src/types.ts +28 -0
  166. package/vest/dist/index.d.ts +1 -0
  167. package/vest/dist/vest.d.ts +2 -0
  168. package/vest/dist/vest.js +2 -0
  169. package/vest/dist/vest.js.map +1 -0
  170. package/vest/dist/vest.mjs +2 -0
  171. package/vest/dist/vest.modern.js +2 -0
  172. package/vest/dist/vest.modern.js.map +1 -0
  173. package/vest/dist/vest.module.js +2 -0
  174. package/vest/dist/vest.module.js.map +1 -0
  175. package/vest/dist/vest.umd.js +2 -0
  176. package/vest/dist/vest.umd.js.map +1 -0
  177. package/vest/package.json +18 -0
  178. package/vest/src/__tests__/Form-native-validation.tsx +93 -0
  179. package/vest/src/__tests__/Form.tsx +64 -0
  180. package/vest/src/__tests__/__fixtures__/data.ts +67 -0
  181. package/vest/src/__tests__/__snapshots__/vest.ts.snap +141 -0
  182. package/vest/src/__tests__/vest.ts +71 -0
  183. package/vest/src/index.ts +1 -0
  184. package/vest/src/types.ts +20 -0
  185. package/vest/src/vest.ts +51 -0
  186. package/yup/dist/index.d.ts +2 -0
  187. package/yup/dist/types.d.ts +8 -0
  188. package/yup/dist/yup.d.ts +2 -0
  189. package/yup/dist/yup.js +2 -0
  190. package/yup/dist/yup.js.map +1 -0
  191. package/yup/dist/yup.mjs +2 -0
  192. package/yup/dist/yup.modern.js +2 -0
  193. package/yup/dist/yup.modern.js.map +1 -0
  194. package/yup/dist/yup.module.js +2 -0
  195. package/yup/dist/yup.module.js.map +1 -0
  196. package/yup/dist/yup.umd.js +2 -0
  197. package/yup/dist/yup.umd.js.map +1 -0
  198. package/yup/package.json +17 -0
  199. package/yup/src/__tests__/Form-native-validation.tsx +85 -0
  200. package/yup/src/__tests__/Form.tsx +54 -0
  201. package/yup/src/__tests__/__fixtures__/data.ts +72 -0
  202. package/yup/src/__tests__/__snapshots__/yup.ts.snap +231 -0
  203. package/yup/src/__tests__/yup.ts +174 -0
  204. package/yup/src/index.ts +2 -0
  205. package/yup/src/types.ts +21 -0
  206. package/yup/src/yup.ts +75 -0
  207. package/zod/dist/index.d.ts +2 -0
  208. package/zod/dist/types.d.ts +5 -0
  209. package/zod/dist/zod.d.ts +2 -0
  210. package/zod/dist/zod.js +2 -0
  211. package/zod/dist/zod.js.map +1 -0
  212. package/zod/dist/zod.mjs +2 -0
  213. package/zod/dist/zod.modern.js +2 -0
  214. package/zod/dist/zod.modern.js.map +1 -0
  215. package/zod/dist/zod.module.js +2 -0
  216. package/zod/dist/zod.module.js.map +1 -0
  217. package/zod/dist/zod.umd.js +2 -0
  218. package/zod/dist/zod.umd.js.map +1 -0
  219. package/zod/package.json +17 -0
  220. package/zod/src/__tests__/Form-native-validation.tsx +85 -0
  221. package/zod/src/__tests__/Form.tsx +54 -0
  222. package/zod/src/__tests__/__fixtures__/data.ts +81 -0
  223. package/zod/src/__tests__/__snapshots__/zod.ts.snap +377 -0
  224. package/zod/src/__tests__/zod.ts +77 -0
  225. package/zod/src/index.ts +2 -0
  226. package/zod/src/types.ts +16 -0
  227. package/zod/src/zod.ts +85 -0
package/package.json ADDED
@@ -0,0 +1,216 @@
1
+ {
2
+ "name": "@hookform/resolvers",
3
+ "amdName": "hookformResolvers",
4
+ "version": "2.8.1",
5
+ "description": "React Hook Form validation resolvers: Yup, Joi, Superstruct, Zod, Vest, Class Validator, io-ts, Nope, computed-types and Typanion",
6
+ "main": "dist/resolvers.js",
7
+ "module": "dist/resolvers.module.js",
8
+ "umd:main": "dist/resolvers.umd.js",
9
+ "source": "src/index.ts",
10
+ "types": "dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "browser": "./dist/resolvers.module.js",
14
+ "umd": "./dist/resolvers.umd.js",
15
+ "import": "./dist/resolvers.mjs",
16
+ "require": "./dist/resolvers.js"
17
+ },
18
+ "./zod": {
19
+ "browser": "./zod/dist/zod.module.js",
20
+ "umd": "./zod/dist/zod.umd.js",
21
+ "import": "./zod/dist/zod.mjs",
22
+ "require": "./zod/dist/zod.js"
23
+ },
24
+ "./yup": {
25
+ "browser": "./yup/dist/yup.module.js",
26
+ "umd": "./yup/dist/yup.umd.js",
27
+ "import": "./yup/dist/yup.mjs",
28
+ "require": "./yup/dist/yup.js"
29
+ },
30
+ "./joi": {
31
+ "browser": "./joi/dist/joi.module.js",
32
+ "umd": "./joi/dist/joi.umd.js",
33
+ "import": "./joi/dist/joi.mjs",
34
+ "require": "./joi/dist/joi.js"
35
+ },
36
+ "./vest": {
37
+ "browser": "./vest/dist/vest.module.js",
38
+ "umd": "./vest/dist/vest.umd.js",
39
+ "import": "./vest/dist/vest.mjs",
40
+ "require": "./vest/dist/vest.js"
41
+ },
42
+ "./superstruct": {
43
+ "browser": "./superstruct/dist/superstruct.module.js",
44
+ "umd": "./superstruct/dist/superstruct.umd.js",
45
+ "import": "./superstruct/dist/superstruct.mjs",
46
+ "require": "./superstruct/dist/superstruct.js"
47
+ },
48
+ "./class-validator": {
49
+ "browser": "./class-validator/dist/class-validator.module.js",
50
+ "umd": "./class-validator/dist/class-validator.umd.js",
51
+ "import": "./class-validator/dist/class-validator.mjs",
52
+ "require": "./class-validator/dist/class-validator.js"
53
+ },
54
+ "./io-ts": {
55
+ "browser": "./io-ts/dist/io-ts.module.js",
56
+ "umd": "./io-ts/dist/io-ts.umd.js",
57
+ "import": "./io-ts/dist/io-ts.mjs",
58
+ "require": "./io-ts/dist/io-ts.js"
59
+ },
60
+ "./nope": {
61
+ "browser": "./nope/dist/nope.module.js",
62
+ "umd": "./nope/dist/nope.umd.js",
63
+ "import": "./nope/dist/nope.mjs",
64
+ "require": "./nope/dist/nope.js"
65
+ },
66
+ "./computed-types": {
67
+ "browser": "./computed-types/dist/computed-types.module.js",
68
+ "umd": "./computed-types/dist/computed-types.umd.js",
69
+ "import": "./computed-types/dist/computed-types.mjs",
70
+ "require": "./computed-types/dist/computed-types.js"
71
+ },
72
+ "./typanion": {
73
+ "browser": "./typanion/dist/typanion.module.js",
74
+ "umd": "./typanion/dist/typanion.umd.js",
75
+ "import": "./typanion/dist/typanion.mjs",
76
+ "require": "./typanion/dist/typanion.js"
77
+ },
78
+ "./package.json": "./package.json",
79
+ "./": "./"
80
+ },
81
+ "files": [
82
+ "dist",
83
+ "yup/package.json",
84
+ "yup/src",
85
+ "yup/dist",
86
+ "zod/package.json",
87
+ "zod/src",
88
+ "zod/dist",
89
+ "vest/package.json",
90
+ "vest/src",
91
+ "vest/dist",
92
+ "joi/package.json",
93
+ "joi/src",
94
+ "joi/dist",
95
+ "superstruct/package.json",
96
+ "superstruct/src",
97
+ "superstruct/dist",
98
+ "class-validator/package.json",
99
+ "class-validator/src",
100
+ "class-validator/dist",
101
+ "io-ts/package.json",
102
+ "io-ts/src",
103
+ "io-ts/dist",
104
+ "nope/package.json",
105
+ "nope/src",
106
+ "nope/dist",
107
+ "computed-types/package.json",
108
+ "computed-types/src",
109
+ "computed-types/dist",
110
+ "typanion/package.json",
111
+ "typanion/src",
112
+ "typanion/dist"
113
+ ],
114
+ "publishConfig": {
115
+ "access": "public"
116
+ },
117
+ "scripts": {
118
+ "prepare": "run-s build:src build && check-export-map && husky install",
119
+ "build": "npm-run-all --parallel build:*",
120
+ "build:src": "microbundle build",
121
+ "build:zod": "microbundle --cwd zod --globals '@hookform/resolvers=hookformResolvers'",
122
+ "build:yup": "microbundle --cwd yup --globals '@hookform/resolvers=hookformResolvers'",
123
+ "build:joi": "microbundle --cwd joi --globals '@hookform/resolvers=hookformResolvers'",
124
+ "build:superstruct": "microbundle --cwd superstruct --globals '@hookform/resolvers=hookformResolvers'",
125
+ "build:io-ts": "microbundle --cwd io-ts --globals '@hookform/resolvers=hookformResolvers'",
126
+ "build:vest": "microbundle --cwd vest --globals '@hookform/resolvers=hookformResolvers'",
127
+ "build:class-validator": "microbundle --cwd class-validator --globals '@hookform/resolvers=hookformResolvers'",
128
+ "build:nope": "microbundle --cwd nope --globals '@hookform/resolvers=hookformResolvers'",
129
+ "build:computed-types": "microbundle --cwd computed-types --globals '@hookform/resolvers=hookformResolvers'",
130
+ "build:typanion": "microbundle --cwd typanion --globals '@hookform/resolvers=hookformResolvers'",
131
+ "postbuild": "node ./config/node-13-exports.js",
132
+ "lint": "eslint . --ext .ts,.js --ignore-path .gitignore",
133
+ "lint:types": "tsc",
134
+ "test": "jest",
135
+ "test:watch": "yarn test --watchAll --coverage --runInBand",
136
+ "check:all": "npm-run-all --parallel lint:* test"
137
+ },
138
+ "keywords": [
139
+ "scheme",
140
+ "validation",
141
+ "scheme-validation",
142
+ "hookform",
143
+ "react-hook-form",
144
+ "yup",
145
+ "joi",
146
+ "superstruct",
147
+ "typescript",
148
+ "zod",
149
+ "vest",
150
+ "class-validator",
151
+ "io-ts",
152
+ "nope",
153
+ "computed-types",
154
+ "typanion"
155
+ ],
156
+ "repository": {
157
+ "type": "git",
158
+ "url": "git+https://github.com/react-hook-form/resolvers.git"
159
+ },
160
+ "author": "bluebill1049 <bluebill1049@hotmail.com>",
161
+ "license": "MIT",
162
+ "bugs": {
163
+ "url": "https://github.com/react-hook-form/resolvers/issues"
164
+ },
165
+ "homepage": "https://react-hook-form.com",
166
+ "devDependencies": {
167
+ "@testing-library/jest-dom": "^5.12.0",
168
+ "@testing-library/react": "^12.0.0",
169
+ "@testing-library/user-event": "^13.2.1",
170
+ "@types/jest": "^27.0.0",
171
+ "@types/react": "^17.0.17",
172
+ "@typescript-eslint/eslint-plugin": "^4.25.0",
173
+ "@typescript-eslint/parser": "^4.25.0",
174
+ "check-export-map": "^1.1.1",
175
+ "class-transformer": "^0.4.0",
176
+ "class-validator": "^0.13.1",
177
+ "computed-types": "^1.7.0",
178
+ "eslint": "^7.27.0",
179
+ "eslint-config-prettier": "^8.3.0",
180
+ "fp-ts": "^2.11.1",
181
+ "husky": "^7.0.1",
182
+ "io-ts": "^2.0.0",
183
+ "io-ts-types": "^0.5.16",
184
+ "jest": "^27.0.6",
185
+ "joi": "^17.4.2",
186
+ "lint-staged": "^11.1.2",
187
+ "microbundle": "^0.13.3",
188
+ "monocle-ts": "^2.3.10",
189
+ "newtype-ts": "^0.3.4",
190
+ "nope-validator": "^1.0.0",
191
+ "npm-run-all": "^4.1.5",
192
+ "prettier": "^2.3.2",
193
+ "react": "^17.0.2",
194
+ "react-dom": "^17.0.2",
195
+ "react-hook-form": "7.15.0",
196
+ "reflect-metadata": "^0.1.13",
197
+ "superstruct": "^0.15.2",
198
+ "ts-jest": "^27.0.4",
199
+ "typanion": "^3.3.2",
200
+ "typescript": "^4.3.2",
201
+ "vest": "^3.2.5",
202
+ "yup": "^0.32.9",
203
+ "zod": "^3.7.1"
204
+ },
205
+ "peerDependencies": {
206
+ "react-hook-form": "^7.0.0"
207
+ },
208
+ "lint-staged": {
209
+ "*.{js,ts}": [
210
+ "yarn lint --fix"
211
+ ],
212
+ "*.{md,json,yml}": [
213
+ "prettier --write"
214
+ ]
215
+ }
216
+ }
@@ -0,0 +1,2 @@
1
+ export * from './superstruct';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ import { Resolver } from './types';
2
+ export declare const superstructResolver: Resolver;
@@ -0,0 +1,2 @@
1
+ var e=require("@hookform/resolvers"),r=require("superstruct");exports.superstructResolver=function(s,t){return function(u,a,o){var i,l=r.validate(u,s,t);return l[0]?{values:{},errors:e.toNestError((i=l[0],i.failures().reduce(function(e,r){return(e[r.path.join(".")]={message:r.message,type:r.type})&&e},{})),o)}:(o.shouldUseNativeValidation&&e.validateFieldsNatively({},o),{values:l[1],errors:{}})}};
2
+ //# sourceMappingURL=superstruct.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"superstruct.js","sources":["../src/superstruct.ts"],"sourcesContent":["import { FieldError, FieldErrors } from 'react-hook-form';\nimport { toNestError, validateFieldsNatively } from '@hookform/resolvers';\n\nimport { StructError, validate } from 'superstruct';\nimport { Resolver } from './types';\n\nconst parseErrorSchema = (error: StructError) =>\n error.failures().reduce<Record<string, FieldError>>(\n (previous, error) =>\n (previous[error.path.join('.')] = {\n message: error.message,\n type: error.type,\n }) && previous,\n {},\n );\n\nexport const superstructResolver: Resolver =\n (schema, resolverOptions) => (values, _, options) => {\n const result = validate(values, schema, resolverOptions);\n\n if (result[0]) {\n return {\n values: {},\n errors: toNestError(\n parseErrorSchema(result[0]),\n options,\n ) as FieldErrors<any>,\n };\n }\n\n options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n return {\n values: result[1],\n errors: {} as FieldErrors<any>,\n };\n };\n"],"names":["schema","resolverOptions","values","_","options","error","result","validate","errors","toNestError","failures","reduce","previous","path","join","message","type","shouldUseNativeValidation","validateFieldsNatively"],"mappings":"0FAiBE,SAACA,EAAQC,mBAAqBC,EAAQC,EAAGC,GACvC,IAZsBC,EAYhBC,EAASC,WAASL,EAAQF,EAAQC,GAExC,OAAIK,EAAO,GACF,CACLJ,OAAQ,GACRM,OAAQC,eAjBUJ,EAkBCC,EAAO,GAjBhCD,EAAMK,WAAWC,OACf,SAACC,EAAUP,UACRO,EAASP,EAAMQ,KAAKC,KAAK,MAAQ,CAChCC,QAASV,EAAMU,QACfC,KAAMX,EAAMW,QACRJ,GACR,KAYMR,KAKNA,EAAQa,2BAA6BC,yBAAuB,GAAId,GAEzD,CACLF,OAAQI,EAAO,GACfE,OAAQ"}
@@ -0,0 +1,2 @@
1
+ import{toNestError as r,validateFieldsNatively as e}from"@hookform/resolvers";import{validate as o}from"superstruct";var t=function(t,s){return function(u,a,n){var i,f=o(u,t,s);return f[0]?{values:{},errors:r((i=f[0],i.failures().reduce(function(r,e){return(r[e.path.join(".")]={message:e.message,type:e.type})&&r},{})),n)}:(n.shouldUseNativeValidation&&e({},n),{values:f[1],errors:{}})}};export{t as superstructResolver};
2
+ //# sourceMappingURL=superstruct.module.js.map
@@ -0,0 +1,2 @@
1
+ import{toNestError as r,validateFieldsNatively as e}from"@hookform/resolvers";import{validate as s}from"superstruct";const o=(o,t)=>(a,u,i)=>{const m=s(a,o,t);return m[0]?{values:{},errors:r((p=m[0],p.failures().reduce((r,e)=>(r[e.path.join(".")]={message:e.message,type:e.type})&&r,{})),i)}:(i.shouldUseNativeValidation&&e({},i),{values:m[1],errors:{}});var p};export{o as superstructResolver};
2
+ //# sourceMappingURL=superstruct.modern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"superstruct.modern.js","sources":["../src/superstruct.ts"],"sourcesContent":["import { FieldError, FieldErrors } from 'react-hook-form';\nimport { toNestError, validateFieldsNatively } from '@hookform/resolvers';\n\nimport { StructError, validate } from 'superstruct';\nimport { Resolver } from './types';\n\nconst parseErrorSchema = (error: StructError) =>\n error.failures().reduce<Record<string, FieldError>>(\n (previous, error) =>\n (previous[error.path.join('.')] = {\n message: error.message,\n type: error.type,\n }) && previous,\n {},\n );\n\nexport const superstructResolver: Resolver =\n (schema, resolverOptions) => (values, _, options) => {\n const result = validate(values, schema, resolverOptions);\n\n if (result[0]) {\n return {\n values: {},\n errors: toNestError(\n parseErrorSchema(result[0]),\n options,\n ) as FieldErrors<any>,\n };\n }\n\n options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n return {\n values: result[1],\n errors: {} as FieldErrors<any>,\n };\n };\n"],"names":["superstructResolver","schema","resolverOptions","values","_","options","result","validate","errors","toNestError","error","failures","reduce","previous","path","join","message","type","shouldUseNativeValidation","validateFieldsNatively"],"mappings":"qHAMA,MAUaA,EACX,CAACC,EAAQC,IAAoB,CAACC,EAAQC,EAAGC,KACvC,MAAMC,EAASC,EAASJ,EAAQF,EAAQC,GAExC,OAAII,EAAO,GACF,CACLH,OAAQ,GACRK,OAAQC,GAjBUC,EAkBCJ,EAAO,GAjBhCI,EAAMC,WAAWC,OACf,CAACC,EAAUH,KACRG,EAASH,EAAMI,KAAKC,KAAK,MAAQ,CAChCC,QAASN,EAAMM,QACfC,KAAMP,EAAMO,QACRJ,EACR,KAYMR,KAKNA,EAAQa,2BAA6BC,EAAuB,GAAId,GAEzD,CACLF,OAAQG,EAAO,GACfE,OAAQ,KA5BYE,IAAAA"}
@@ -0,0 +1,2 @@
1
+ import{toNestError as r,validateFieldsNatively as e}from"@hookform/resolvers";import{validate as o}from"superstruct";var t=function(t,s){return function(u,a,n){var i,f=o(u,t,s);return f[0]?{values:{},errors:r((i=f[0],i.failures().reduce(function(r,e){return(r[e.path.join(".")]={message:e.message,type:e.type})&&r},{})),n)}:(n.shouldUseNativeValidation&&e({},n),{values:f[1],errors:{}})}};export{t as superstructResolver};
2
+ //# sourceMappingURL=superstruct.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"superstruct.module.js","sources":["../src/superstruct.ts"],"sourcesContent":["import { FieldError, FieldErrors } from 'react-hook-form';\nimport { toNestError, validateFieldsNatively } from '@hookform/resolvers';\n\nimport { StructError, validate } from 'superstruct';\nimport { Resolver } from './types';\n\nconst parseErrorSchema = (error: StructError) =>\n error.failures().reduce<Record<string, FieldError>>(\n (previous, error) =>\n (previous[error.path.join('.')] = {\n message: error.message,\n type: error.type,\n }) && previous,\n {},\n );\n\nexport const superstructResolver: Resolver =\n (schema, resolverOptions) => (values, _, options) => {\n const result = validate(values, schema, resolverOptions);\n\n if (result[0]) {\n return {\n values: {},\n errors: toNestError(\n parseErrorSchema(result[0]),\n options,\n ) as FieldErrors<any>,\n };\n }\n\n options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n return {\n values: result[1],\n errors: {} as FieldErrors<any>,\n };\n };\n"],"names":["superstructResolver","schema","resolverOptions","values","_","options","error","result","validate","errors","toNestError","failures","reduce","previous","path","join","message","type","shouldUseNativeValidation","validateFieldsNatively"],"mappings":"qHAMA,IAUaA,EACX,SAACC,EAAQC,mBAAqBC,EAAQC,EAAGC,GACvC,IAZsBC,EAYhBC,EAASC,EAASL,EAAQF,EAAQC,GAExC,OAAIK,EAAO,GACF,CACLJ,OAAQ,GACRM,OAAQC,GAjBUJ,EAkBCC,EAAO,GAjBhCD,EAAMK,WAAWC,OACf,SAACC,EAAUP,UACRO,EAASP,EAAMQ,KAAKC,KAAK,MAAQ,CAChCC,QAASV,EAAMU,QACfC,KAAMX,EAAMW,QACRJ,GACR,KAYMR,KAKNA,EAAQa,2BAA6BC,EAAuB,GAAId,GAEzD,CACLF,OAAQI,EAAO,GACfE,OAAQ"}
@@ -0,0 +1,2 @@
1
+ !function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@hookform/resolvers"),require("superstruct")):"function"==typeof define&&define.amd?define(["exports","@hookform/resolvers","superstruct"],r):r((e||self).hookformResolversSuperstruct={},e.hookformResolvers,e.superstruct)}(this,function(e,r,o){e.superstructResolver=function(e,s){return function(t,u,i){var n,f=o.validate(t,e,s);return f[0]?{values:{},errors:r.toNestError((n=f[0],n.failures().reduce(function(e,r){return(e[r.path.join(".")]={message:r.message,type:r.type})&&e},{})),i)}:(i.shouldUseNativeValidation&&r.validateFieldsNatively({},i),{values:f[1],errors:{}})}}});
2
+ //# sourceMappingURL=superstruct.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"superstruct.umd.js","sources":["../src/superstruct.ts"],"sourcesContent":["import { FieldError, FieldErrors } from 'react-hook-form';\nimport { toNestError, validateFieldsNatively } from '@hookform/resolvers';\n\nimport { StructError, validate } from 'superstruct';\nimport { Resolver } from './types';\n\nconst parseErrorSchema = (error: StructError) =>\n error.failures().reduce<Record<string, FieldError>>(\n (previous, error) =>\n (previous[error.path.join('.')] = {\n message: error.message,\n type: error.type,\n }) && previous,\n {},\n );\n\nexport const superstructResolver: Resolver =\n (schema, resolverOptions) => (values, _, options) => {\n const result = validate(values, schema, resolverOptions);\n\n if (result[0]) {\n return {\n values: {},\n errors: toNestError(\n parseErrorSchema(result[0]),\n options,\n ) as FieldErrors<any>,\n };\n }\n\n options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n return {\n values: result[1],\n errors: {} as FieldErrors<any>,\n };\n };\n"],"names":["schema","resolverOptions","values","_","options","error","result","validate","errors","toNestError","failures","reduce","previous","path","join","message","type","shouldUseNativeValidation","validateFieldsNatively"],"mappings":"4YAiBE,SAACA,EAAQC,mBAAqBC,EAAQC,EAAGC,GACvC,IAZsBC,EAYhBC,EAASC,WAASL,EAAQF,EAAQC,GAExC,OAAIK,EAAO,GACF,CACLJ,OAAQ,GACRM,OAAQC,eAjBUJ,EAkBCC,EAAO,GAjBhCD,EAAMK,WAAWC,OACf,SAACC,EAAUP,UACRO,EAASP,EAAMQ,KAAKC,KAAK,MAAQ,CAChCC,QAASV,EAAMU,QACfC,KAAMX,EAAMW,QACRJ,GACR,KAYMR,KAKNA,EAAQa,2BAA6BC,yBAAuB,GAAId,GAEzD,CACLF,OAAQI,EAAO,GACfE,OAAQ"}
@@ -0,0 +1,5 @@
1
+ import { FieldValues, ResolverOptions, ResolverResult } from 'react-hook-form';
2
+ import { validate, Struct } from 'superstruct';
3
+ declare type Options = Parameters<typeof validate>[2];
4
+ export declare type Resolver = <TFieldValues extends FieldValues, TContext extends object = object>(schema: Struct<TFieldValues, any>, factoryOptions?: Options) => (values: unknown, context: TContext | undefined, options: ResolverOptions<TFieldValues>) => ResolverResult<TFieldValues>;
5
+ export {};
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "superstruct",
3
+ "amdName": "hookformResolversSuperstruct",
4
+ "version": "1.0.0",
5
+ "private": true,
6
+ "description": "React Hook Form validation resolver: superstruct",
7
+ "main": "dist/superstruct.js",
8
+ "module": "dist/superstruct.module.js",
9
+ "umd:main": "dist/superstruct.umd.js",
10
+ "source": "src/index.ts",
11
+ "types": "dist/index.d.ts",
12
+ "license": "MIT",
13
+ "peerDependencies": {
14
+ "react-hook-form": "^7.0.0",
15
+ "@hookform/resolvers": "^2.0.0",
16
+ "superstruct": ">=0.12.0"
17
+ }
18
+ }
@@ -0,0 +1,86 @@
1
+ import React from 'react';
2
+ import { render, screen, act } from '@testing-library/react';
3
+ import user from '@testing-library/user-event';
4
+ import { useForm } from 'react-hook-form';
5
+ import { object, string, Infer, size } from 'superstruct';
6
+ import { superstructResolver } from '..';
7
+
8
+ const schema = object({
9
+ username: size(string(), 2),
10
+ password: size(string(), 6),
11
+ });
12
+
13
+ type FormData = Infer<typeof schema>;
14
+
15
+ interface Props {
16
+ onSubmit: (data: FormData) => void;
17
+ }
18
+
19
+ function TestComponent({ onSubmit }: Props) {
20
+ const { register, handleSubmit } = useForm<FormData>({
21
+ resolver: superstructResolver(schema),
22
+ shouldUseNativeValidation: true,
23
+ });
24
+
25
+ return (
26
+ <form onSubmit={handleSubmit(onSubmit)}>
27
+ <input {...register('username')} placeholder="username" />
28
+
29
+ <input {...register('password')} placeholder="password" />
30
+
31
+ <button type="submit">submit</button>
32
+ </form>
33
+ );
34
+ }
35
+
36
+ test("form's native validation with Superstruct", async () => {
37
+ const handleSubmit = jest.fn();
38
+ render(<TestComponent onSubmit={handleSubmit} />);
39
+
40
+ // username
41
+ let usernameField = screen.getByPlaceholderText(
42
+ /username/i,
43
+ ) as HTMLInputElement;
44
+ expect(usernameField.validity.valid).toBe(true);
45
+ expect(usernameField.validationMessage).toBe('');
46
+
47
+ // password
48
+ let passwordField = screen.getByPlaceholderText(
49
+ /password/i,
50
+ ) as HTMLInputElement;
51
+ expect(passwordField.validity.valid).toBe(true);
52
+ expect(passwordField.validationMessage).toBe('');
53
+
54
+ await act(async () => {
55
+ user.click(screen.getByText(/submit/i));
56
+ });
57
+
58
+ // username
59
+ usernameField = screen.getByPlaceholderText(/username/i) as HTMLInputElement;
60
+ expect(usernameField.validity.valid).toBe(false);
61
+ expect(usernameField.validationMessage).toBe(
62
+ 'Expected a string with a length of `2` but received one with a length of `0`',
63
+ );
64
+
65
+ // password
66
+ passwordField = screen.getByPlaceholderText(/password/i) as HTMLInputElement;
67
+ expect(passwordField.validity.valid).toBe(false);
68
+ expect(passwordField.validationMessage).toBe(
69
+ 'Expected a string with a length of `6` but received one with a length of `0`',
70
+ );
71
+
72
+ await act(async () => {
73
+ user.type(screen.getByPlaceholderText(/username/i), 'jo');
74
+ user.type(screen.getByPlaceholderText(/password/i), 'passwo');
75
+ });
76
+
77
+ // username
78
+ usernameField = screen.getByPlaceholderText(/username/i) as HTMLInputElement;
79
+ expect(usernameField.validity.valid).toBe(true);
80
+ expect(usernameField.validationMessage).toBe('');
81
+
82
+ // password
83
+ passwordField = screen.getByPlaceholderText(/password/i) as HTMLInputElement;
84
+ expect(passwordField.validity.valid).toBe(true);
85
+ expect(passwordField.validationMessage).toBe('');
86
+ });
@@ -0,0 +1,62 @@
1
+ import React from 'react';
2
+ import { render, screen, act } from '@testing-library/react';
3
+ import user from '@testing-library/user-event';
4
+ import { useForm } from 'react-hook-form';
5
+ import { object, string, Infer, size } from 'superstruct';
6
+ import { superstructResolver } from '..';
7
+
8
+ const schema = object({
9
+ username: size(string(), 2),
10
+ password: size(string(), 6),
11
+ });
12
+
13
+ type FormData = Infer<typeof schema>;
14
+
15
+ interface Props {
16
+ onSubmit: (data: FormData) => void;
17
+ }
18
+
19
+ function TestComponent({ onSubmit }: Props) {
20
+ const {
21
+ register,
22
+ formState: { errors },
23
+ handleSubmit,
24
+ } = useForm({
25
+ resolver: superstructResolver(schema), // Useful to check TypeScript regressions
26
+ });
27
+
28
+ return (
29
+ <form onSubmit={handleSubmit(onSubmit)}>
30
+ <input {...register('username')} />
31
+ {errors.username && <span role="alert">{errors.username.message}</span>}
32
+
33
+ <input {...register('password')} />
34
+ {errors.password && <span role="alert">{errors.password.message}</span>}
35
+
36
+ <button type="submit">submit</button>
37
+ </form>
38
+ );
39
+ }
40
+
41
+ test("form's validation with Superstruct and TypeScript's integration", async () => {
42
+ const handleSubmit = jest.fn();
43
+ render(<TestComponent onSubmit={handleSubmit} />);
44
+
45
+ expect(screen.queryAllByRole(/alert/i)).toHaveLength(0);
46
+
47
+ await act(async () => {
48
+ user.click(screen.getByText(/submit/i));
49
+ });
50
+
51
+ expect(
52
+ screen.getByText(
53
+ /Expected a string with a length of `2` but received one with a length of `0`/i,
54
+ ),
55
+ ).toBeInTheDocument();
56
+ expect(
57
+ screen.getByText(
58
+ /Expected a string with a length of `6` but received one with a length of `0`/i,
59
+ ),
60
+ ).toBeInTheDocument();
61
+ expect(handleSubmit).not.toHaveBeenCalled();
62
+ });
@@ -0,0 +1,75 @@
1
+ import { Field, InternalFieldName } from 'react-hook-form';
2
+ import {
3
+ object,
4
+ number,
5
+ string,
6
+ optional,
7
+ pattern,
8
+ size,
9
+ union,
10
+ min,
11
+ max,
12
+ Infer,
13
+ define,
14
+ array,
15
+ boolean,
16
+ } from 'superstruct';
17
+
18
+ const Password = define(
19
+ 'Password',
20
+ (value, ctx) => value === ctx.branch[0].password,
21
+ );
22
+
23
+ export const schema = object({
24
+ username: size(pattern(string(), /^\w+$/), 3, 30),
25
+ password: pattern(string(), /^[a-zA-Z0-9]{3,30}/),
26
+ repeatPassword: Password,
27
+ accessToken: optional(union([string(), number()])),
28
+ birthYear: optional(max(min(number(), 1900), 2013)),
29
+ email: optional(pattern(string(), /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/)),
30
+ tags: array(string()),
31
+ enabled: boolean(),
32
+ like: optional(array(object({ id: number(), name: size(string(), 4) }))),
33
+ });
34
+
35
+ export const validData: Infer<typeof schema> = {
36
+ username: 'Doe',
37
+ password: 'Password123',
38
+ repeatPassword: 'Password123',
39
+ birthYear: 2000,
40
+ email: 'john@doe.com',
41
+ tags: ['tag1', 'tag2'],
42
+ enabled: true,
43
+ like: [
44
+ {
45
+ id: 1,
46
+ name: 'name',
47
+ },
48
+ ],
49
+ };
50
+
51
+ export const invalidData = {
52
+ password: '___',
53
+ email: '',
54
+ birthYear: 'birthYear',
55
+ like: [{ id: 'z' }],
56
+ };
57
+
58
+ export const fields: Record<InternalFieldName, Field['_f']> = {
59
+ username: {
60
+ ref: { name: 'username' },
61
+ name: 'username',
62
+ },
63
+ password: {
64
+ ref: { name: 'password' },
65
+ name: 'password',
66
+ },
67
+ email: {
68
+ ref: { name: 'email' },
69
+ name: 'email',
70
+ },
71
+ birthday: {
72
+ ref: { name: 'birthday' },
73
+ name: 'birthday',
74
+ },
75
+ };
@@ -0,0 +1,64 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`superstructResolver should return a single error from superstructResolver when validation fails 1`] = `
4
+ Object {
5
+ "errors": Object {
6
+ "birthYear": Object {
7
+ "message": "Expected a number, but received: \\"birthYear\\"",
8
+ "ref": undefined,
9
+ "type": "number",
10
+ },
11
+ "email": Object {
12
+ "message": "Expected a string matching \`/^[\\\\w-\\\\.]+@([\\\\w-]+\\\\.)+[\\\\w-]{2,4}$/\` but received \\"\\"",
13
+ "ref": Object {
14
+ "name": "email",
15
+ },
16
+ "type": "string",
17
+ },
18
+ "enabled": Object {
19
+ "message": "Expected a value of type \`boolean\`, but received: \`undefined\`",
20
+ "ref": undefined,
21
+ "type": "boolean",
22
+ },
23
+ "like": Array [
24
+ Object {
25
+ "id": Object {
26
+ "message": "Expected a number, but received: \\"z\\"",
27
+ "ref": undefined,
28
+ "type": "number",
29
+ },
30
+ "name": Object {
31
+ "message": "Expected a string, but received: undefined",
32
+ "ref": undefined,
33
+ "type": "string",
34
+ },
35
+ },
36
+ ],
37
+ "password": Object {
38
+ "message": "Expected a string matching \`/^[a-zA-Z0-9]{3,30}/\` but received \\"___\\"",
39
+ "ref": Object {
40
+ "name": "password",
41
+ },
42
+ "type": "string",
43
+ },
44
+ "repeatPassword": Object {
45
+ "message": "Expected a value of type \`Password\`, but received: \`undefined\`",
46
+ "ref": undefined,
47
+ "type": "Password",
48
+ },
49
+ "tags": Object {
50
+ "message": "Expected an array value, but received: undefined",
51
+ "ref": undefined,
52
+ "type": "array",
53
+ },
54
+ "username": Object {
55
+ "message": "Expected a string, but received: undefined",
56
+ "ref": Object {
57
+ "name": "username",
58
+ },
59
+ "type": "string",
60
+ },
61
+ },
62
+ "values": Object {},
63
+ }
64
+ `;
@@ -0,0 +1,24 @@
1
+ import { superstructResolver } from '..';
2
+ import { invalidData, schema, validData, fields } from './__fixtures__/data';
3
+
4
+ const shouldUseNativeValidation = false;
5
+
6
+ describe('superstructResolver', () => {
7
+ it('should return values from superstructResolver when validation pass', async () => {
8
+ const result = await superstructResolver(schema)(validData, undefined, {
9
+ fields,
10
+ shouldUseNativeValidation,
11
+ });
12
+
13
+ expect(result).toEqual({ errors: {}, values: validData });
14
+ });
15
+
16
+ it('should return a single error from superstructResolver when validation fails', async () => {
17
+ const result = await superstructResolver(schema)(invalidData, undefined, {
18
+ fields,
19
+ shouldUseNativeValidation,
20
+ });
21
+
22
+ expect(result).toMatchSnapshot();
23
+ });
24
+ });
@@ -0,0 +1,2 @@
1
+ export * from './superstruct';
2
+ export * from './types';
@@ -0,0 +1,37 @@
1
+ import { FieldError, FieldErrors } from 'react-hook-form';
2
+ import { toNestError, validateFieldsNatively } from '@hookform/resolvers';
3
+
4
+ import { StructError, validate } from 'superstruct';
5
+ import { Resolver } from './types';
6
+
7
+ const parseErrorSchema = (error: StructError) =>
8
+ error.failures().reduce<Record<string, FieldError>>(
9
+ (previous, error) =>
10
+ (previous[error.path.join('.')] = {
11
+ message: error.message,
12
+ type: error.type,
13
+ }) && previous,
14
+ {},
15
+ );
16
+
17
+ export const superstructResolver: Resolver =
18
+ (schema, resolverOptions) => (values, _, options) => {
19
+ const result = validate(values, schema, resolverOptions);
20
+
21
+ if (result[0]) {
22
+ return {
23
+ values: {},
24
+ errors: toNestError(
25
+ parseErrorSchema(result[0]),
26
+ options,
27
+ ) as FieldErrors<any>,
28
+ };
29
+ }
30
+
31
+ options.shouldUseNativeValidation && validateFieldsNatively({}, options);
32
+
33
+ return {
34
+ values: result[1],
35
+ errors: {} as FieldErrors<any>,
36
+ };
37
+ };