@fern-api/venus-api-sdk 0.0.20 → 0.0.21

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 (308) hide show
  1. package/Client.d.ts +23 -0
  2. package/Client.js +28 -0
  3. package/api/index.js +17 -0
  4. package/api/resources/commons/index.js +17 -0
  5. package/api/resources/commons/types/OrganizationId.js +10 -0
  6. package/api/resources/commons/types/UserId.js +10 -0
  7. package/api/resources/commons/types/index.js +18 -0
  8. package/api/resources/index.js +40 -0
  9. package/{types/api → api}/resources/organization/client/Client.d.ts +4 -4
  10. package/api/resources/organization/client/Client.js +214 -0
  11. package/api/resources/organization/client/addUser.js +44 -0
  12. package/api/resources/organization/client/create.js +44 -0
  13. package/api/resources/organization/client/get.js +34 -0
  14. package/api/resources/organization/client/getMyOrganizationFromScopedToken.js +34 -0
  15. package/api/resources/organization/client/index.js +36 -0
  16. package/api/resources/organization/client/isMember.js +24 -0
  17. package/api/resources/organization/client/requests/AddUserToOrgRequest.js +5 -0
  18. package/api/resources/organization/client/requests/CreateOrganizationRequest.js +5 -0
  19. package/api/resources/organization/client/requests/UpdateOrganizationRequest.js +5 -0
  20. package/api/resources/organization/client/requests/index.js +2 -0
  21. package/api/resources/organization/client/update.js +34 -0
  22. package/api/resources/organization/index.js +18 -0
  23. package/api/resources/organization/types/LightweightUser.d.ts +8 -0
  24. package/api/resources/organization/types/LightweightUser.js +5 -0
  25. package/{types/api → api}/resources/organization/types/Organization.d.ts +2 -0
  26. package/api/resources/organization/types/Organization.js +5 -0
  27. package/api/resources/organization/types/index.d.ts +2 -0
  28. package/api/resources/organization/types/index.js +18 -0
  29. package/{types/api → api}/resources/registry/client/Client.d.ts +4 -4
  30. package/api/resources/registry/client/Client.js +135 -0
  31. package/api/resources/registry/client/generateRegistryTokens.js +44 -0
  32. package/api/resources/registry/client/hasRegistryPermission.js +44 -0
  33. package/api/resources/registry/client/index.js +33 -0
  34. package/api/resources/registry/client/requests/CheckRegistryPermissionRequest.js +5 -0
  35. package/api/resources/registry/client/requests/GenerateRegistryTokensRequest.js +5 -0
  36. package/api/resources/registry/client/requests/RevokeTokenRequest.js +5 -0
  37. package/api/resources/registry/client/requests/index.js +2 -0
  38. package/api/resources/registry/client/revokeToken.js +44 -0
  39. package/api/resources/registry/index.js +18 -0
  40. package/api/resources/registry/types/MavenRegistryToken.js +5 -0
  41. package/api/resources/registry/types/NpmRegistryToken.js +5 -0
  42. package/api/resources/registry/types/RegistryToken.js +45 -0
  43. package/api/resources/registry/types/RegistryTokens.js +5 -0
  44. package/api/resources/registry/types/index.js +20 -0
  45. package/{types/api → api}/resources/user/client/Client.d.ts +4 -4
  46. package/api/resources/user/client/Client.js +87 -0
  47. package/api/resources/user/client/getMyOrganizations.js +24 -0
  48. package/api/resources/user/client/getMyself.js +24 -0
  49. package/api/resources/user/client/index.js +32 -0
  50. package/api/resources/user/client/requests/GetUserOrganizationsRequest.js +5 -0
  51. package/api/resources/user/client/requests/index.js +2 -0
  52. package/api/resources/user/index.js +18 -0
  53. package/api/resources/user/types/OrganizationsPage.js +5 -0
  54. package/api/resources/user/types/User.js +5 -0
  55. package/api/resources/user/types/index.js +18 -0
  56. package/core/auth/BasicAuth.js +26 -0
  57. package/core/auth/BearerToken.js +15 -0
  58. package/core/auth/index.js +7 -0
  59. package/core/fetcher/APIResponse.js +2 -0
  60. package/{types/core → core}/fetcher/Fetcher.d.ts +0 -3
  61. package/core/fetcher/Fetcher.js +85 -0
  62. package/core/fetcher/Supplier.js +13 -0
  63. package/core/fetcher/index.js +7 -0
  64. package/core/index.js +32 -0
  65. package/core/schemas/Schema.js +19 -0
  66. package/core/schemas/builders/date/date.js +55 -0
  67. package/core/schemas/builders/date/index.js +5 -0
  68. package/core/schemas/builders/enum/enum.js +29 -0
  69. package/core/schemas/builders/enum/index.js +5 -0
  70. package/core/schemas/builders/index.js +28 -0
  71. package/core/schemas/builders/lazy/index.js +7 -0
  72. package/core/schemas/builders/lazy/lazy.js +28 -0
  73. package/core/schemas/builders/lazy/lazyObject.js +21 -0
  74. package/core/schemas/builders/list/index.js +5 -0
  75. package/core/schemas/builders/list/list.js +53 -0
  76. package/core/schemas/builders/literals/index.js +5 -0
  77. package/core/schemas/builders/literals/stringLiteral.js +28 -0
  78. package/core/schemas/builders/object/index.js +9 -0
  79. package/core/schemas/builders/object/object.js +231 -0
  80. package/core/schemas/builders/object/property.js +16 -0
  81. package/core/schemas/builders/object/types.js +2 -0
  82. package/core/schemas/builders/object-like/getObjectLikeUtils.js +62 -0
  83. package/core/schemas/builders/object-like/index.js +6 -0
  84. package/core/schemas/builders/object-like/types.js +2 -0
  85. package/core/schemas/builders/primitives/any.js +6 -0
  86. package/core/schemas/builders/primitives/boolean.js +24 -0
  87. package/core/schemas/builders/primitives/index.js +13 -0
  88. package/core/schemas/builders/primitives/number.js +24 -0
  89. package/core/schemas/builders/primitives/string.js +24 -0
  90. package/core/schemas/builders/primitives/unknown.js +6 -0
  91. package/core/schemas/builders/record/index.js +5 -0
  92. package/core/schemas/builders/record/record.js +91 -0
  93. package/core/schemas/builders/record/types.js +2 -0
  94. package/core/schemas/builders/schema-utils/JsonError.js +13 -0
  95. package/core/schemas/builders/schema-utils/ParseError.js +13 -0
  96. package/core/schemas/builders/schema-utils/getSchemaUtils.js +82 -0
  97. package/core/schemas/builders/schema-utils/index.js +11 -0
  98. package/core/schemas/builders/schema-utils/stringifyValidationErrors.js +10 -0
  99. package/core/schemas/builders/set/index.js +5 -0
  100. package/core/schemas/builders/set/set.js +44 -0
  101. package/core/schemas/builders/union/discriminant.js +10 -0
  102. package/core/schemas/builders/union/index.js +7 -0
  103. package/core/schemas/builders/union/types.js +2 -0
  104. package/core/schemas/builders/union/union.js +100 -0
  105. package/core/schemas/index.js +17 -0
  106. package/core/schemas/utils/MaybePromise.js +2 -0
  107. package/core/schemas/utils/OptionalRecord.js +2 -0
  108. package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +7 -0
  109. package/core/schemas/utils/addQuestionMarksToNullableProperties.js +2 -0
  110. package/core/schemas/utils/createIdentitySchemaCreator.js +18 -0
  111. package/core/schemas/utils/entries.js +7 -0
  112. package/core/schemas/utils/filterObject.js +14 -0
  113. package/core/schemas/utils/isPlainObject.js +19 -0
  114. package/core/schemas/utils/keys.js +7 -0
  115. package/core/schemas/utils/partition.js +16 -0
  116. package/index.js +29 -0
  117. package/package.json +19 -43
  118. package/serialization/index.js +17 -0
  119. package/serialization/resources/commons/index.js +17 -0
  120. package/serialization/resources/commons/types/OrganizationId.js +35 -0
  121. package/serialization/resources/commons/types/UserId.js +37 -0
  122. package/serialization/resources/commons/types/index.js +18 -0
  123. package/serialization/resources/index.js +39 -0
  124. package/serialization/resources/organization/client/addUser.js +47 -0
  125. package/serialization/resources/organization/client/create.js +47 -0
  126. package/serialization/resources/organization/client/get.js +44 -0
  127. package/serialization/resources/organization/client/getMyOrganizationFromScopedToken.js +44 -0
  128. package/serialization/resources/organization/client/index.js +36 -0
  129. package/serialization/resources/organization/client/isMember.js +31 -0
  130. package/serialization/resources/organization/client/requests/AddUserToOrgRequest.js +34 -0
  131. package/serialization/resources/organization/client/requests/CreateOrganizationRequest.js +34 -0
  132. package/serialization/resources/organization/client/requests/UpdateOrganizationRequest.js +33 -0
  133. package/serialization/resources/organization/client/requests/index.js +9 -0
  134. package/serialization/resources/organization/client/update.js +44 -0
  135. package/serialization/resources/organization/index.js +18 -0
  136. package/serialization/resources/organization/types/LightweightUser.d.ts +14 -0
  137. package/serialization/resources/organization/types/LightweightUser.js +35 -0
  138. package/{types/serialization → serialization}/resources/organization/types/Organization.d.ts +2 -0
  139. package/serialization/resources/organization/types/Organization.js +36 -0
  140. package/serialization/resources/organization/types/index.d.ts +2 -0
  141. package/serialization/resources/organization/types/index.js +18 -0
  142. package/serialization/resources/registry/client/generateRegistryTokens.js +47 -0
  143. package/serialization/resources/registry/client/hasRegistryPermission.js +48 -0
  144. package/serialization/resources/registry/client/index.js +33 -0
  145. package/serialization/resources/registry/client/requests/CheckRegistryPermissionRequest.js +34 -0
  146. package/serialization/resources/registry/client/requests/GenerateRegistryTokensRequest.js +33 -0
  147. package/serialization/resources/registry/client/requests/RevokeTokenRequest.js +34 -0
  148. package/serialization/resources/registry/client/requests/index.js +9 -0
  149. package/serialization/resources/registry/client/revokeToken.js +47 -0
  150. package/serialization/resources/registry/index.js +18 -0
  151. package/serialization/resources/registry/types/MavenRegistryToken.js +34 -0
  152. package/serialization/resources/registry/types/NpmRegistryToken.js +33 -0
  153. package/serialization/resources/registry/types/RegistryToken.js +49 -0
  154. package/serialization/resources/registry/types/RegistryTokens.js +34 -0
  155. package/serialization/resources/registry/types/index.js +20 -0
  156. package/serialization/resources/user/index.js +17 -0
  157. package/serialization/resources/user/types/OrganizationsPage.js +34 -0
  158. package/serialization/resources/user/types/User.js +36 -0
  159. package/serialization/resources/user/types/index.js +18 -0
  160. package/core.d.ts +0 -4
  161. package/dist/browser/cjs/core.js +0 -4821
  162. package/dist/browser/cjs/index.js +0 -6937
  163. package/dist/browser/cjs/serialization.js +0 -6453
  164. package/dist/browser/esm/core.js +0 -4815
  165. package/dist/browser/esm/index.js +0 -6933
  166. package/dist/browser/esm/serialization.js +0 -6471
  167. package/dist/node/core.js +0 -13178
  168. package/dist/node/index.js +0 -15320
  169. package/dist/node/serialization.js +0 -15332
  170. package/serialization.d.ts +0 -4
  171. package/types/Client.d.ts +0 -21
  172. package/types/api/resources/organization/types/index.d.ts +0 -1
  173. package/types/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +0 -9
  174. package/types/serialization/resources/organization/types/index.d.ts +0 -1
  175. /package/{types/api → api}/index.d.ts +0 -0
  176. /package/{types/api → api}/resources/commons/index.d.ts +0 -0
  177. /package/{types/api → api}/resources/commons/types/OrganizationId.d.ts +0 -0
  178. /package/{types/api → api}/resources/commons/types/UserId.d.ts +0 -0
  179. /package/{types/api → api}/resources/commons/types/index.d.ts +0 -0
  180. /package/{types/api → api}/resources/index.d.ts +0 -0
  181. /package/{types/api → api}/resources/organization/client/addUser.d.ts +0 -0
  182. /package/{types/api → api}/resources/organization/client/create.d.ts +0 -0
  183. /package/{types/api → api}/resources/organization/client/get.d.ts +0 -0
  184. /package/{types/api → api}/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +0 -0
  185. /package/{types/api → api}/resources/organization/client/index.d.ts +0 -0
  186. /package/{types/api → api}/resources/organization/client/isMember.d.ts +0 -0
  187. /package/{types/api → api}/resources/organization/client/requests/AddUserToOrgRequest.d.ts +0 -0
  188. /package/{types/api → api}/resources/organization/client/requests/CreateOrganizationRequest.d.ts +0 -0
  189. /package/{types/api → api}/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +0 -0
  190. /package/{types/api → api}/resources/organization/client/requests/index.d.ts +0 -0
  191. /package/{types/api → api}/resources/organization/client/update.d.ts +0 -0
  192. /package/{types/api → api}/resources/organization/index.d.ts +0 -0
  193. /package/{types/api → api}/resources/registry/client/generateRegistryTokens.d.ts +0 -0
  194. /package/{types/api → api}/resources/registry/client/hasRegistryPermission.d.ts +0 -0
  195. /package/{types/api → api}/resources/registry/client/index.d.ts +0 -0
  196. /package/{types/api → api}/resources/registry/client/requests/CheckRegistryPermissionRequest.d.ts +0 -0
  197. /package/{types/api → api}/resources/registry/client/requests/GenerateRegistryTokensRequest.d.ts +0 -0
  198. /package/{types/api → api}/resources/registry/client/requests/RevokeTokenRequest.d.ts +0 -0
  199. /package/{types/api → api}/resources/registry/client/requests/index.d.ts +0 -0
  200. /package/{types/api → api}/resources/registry/client/revokeToken.d.ts +0 -0
  201. /package/{types/api → api}/resources/registry/index.d.ts +0 -0
  202. /package/{types/api → api}/resources/registry/types/MavenRegistryToken.d.ts +0 -0
  203. /package/{types/api → api}/resources/registry/types/NpmRegistryToken.d.ts +0 -0
  204. /package/{types/api → api}/resources/registry/types/RegistryToken.d.ts +0 -0
  205. /package/{types/api → api}/resources/registry/types/RegistryTokens.d.ts +0 -0
  206. /package/{types/api → api}/resources/registry/types/index.d.ts +0 -0
  207. /package/{types/api → api}/resources/user/client/getMyOrganizations.d.ts +0 -0
  208. /package/{types/api → api}/resources/user/client/getMyself.d.ts +0 -0
  209. /package/{types/api → api}/resources/user/client/index.d.ts +0 -0
  210. /package/{types/api → api}/resources/user/client/requests/GetUserOrganizationsRequest.d.ts +0 -0
  211. /package/{types/api → api}/resources/user/client/requests/index.d.ts +0 -0
  212. /package/{types/api → api}/resources/user/index.d.ts +0 -0
  213. /package/{types/api → api}/resources/user/types/OrganizationsPage.d.ts +0 -0
  214. /package/{types/api → api}/resources/user/types/User.d.ts +0 -0
  215. /package/{types/api → api}/resources/user/types/index.d.ts +0 -0
  216. /package/{types/core → core}/auth/BasicAuth.d.ts +0 -0
  217. /package/{types/core → core}/auth/BearerToken.d.ts +0 -0
  218. /package/{types/core → core}/auth/index.d.ts +0 -0
  219. /package/{types/core → core}/fetcher/APIResponse.d.ts +0 -0
  220. /package/{types/core → core}/fetcher/Supplier.d.ts +0 -0
  221. /package/{types/core → core}/fetcher/index.d.ts +0 -0
  222. /package/{types/core → core}/index.d.ts +0 -0
  223. /package/{types/core → core}/schemas/Schema.d.ts +0 -0
  224. /package/{types/core → core}/schemas/builders/date/date.d.ts +0 -0
  225. /package/{types/core → core}/schemas/builders/date/index.d.ts +0 -0
  226. /package/{types/core → core}/schemas/builders/enum/enum.d.ts +0 -0
  227. /package/{types/core → core}/schemas/builders/enum/index.d.ts +0 -0
  228. /package/{types/core → core}/schemas/builders/index.d.ts +0 -0
  229. /package/{types/core → core}/schemas/builders/lazy/index.d.ts +0 -0
  230. /package/{types/core → core}/schemas/builders/lazy/lazy.d.ts +0 -0
  231. /package/{types/core → core}/schemas/builders/lazy/lazyObject.d.ts +0 -0
  232. /package/{types/core → core}/schemas/builders/list/index.d.ts +0 -0
  233. /package/{types/core → core}/schemas/builders/list/list.d.ts +0 -0
  234. /package/{types/core → core}/schemas/builders/literals/index.d.ts +0 -0
  235. /package/{types/core → core}/schemas/builders/literals/stringLiteral.d.ts +0 -0
  236. /package/{types/core → core}/schemas/builders/object/index.d.ts +0 -0
  237. /package/{types/core → core}/schemas/builders/object/object.d.ts +0 -0
  238. /package/{types/core → core}/schemas/builders/object/property.d.ts +0 -0
  239. /package/{types/core → core}/schemas/builders/object/types.d.ts +0 -0
  240. /package/{types/core → core}/schemas/builders/object-like/getObjectLikeUtils.d.ts +0 -0
  241. /package/{types/core → core}/schemas/builders/object-like/index.d.ts +0 -0
  242. /package/{types/core → core}/schemas/builders/object-like/types.d.ts +0 -0
  243. /package/{types/core → core}/schemas/builders/primitives/any.d.ts +0 -0
  244. /package/{types/core → core}/schemas/builders/primitives/boolean.d.ts +0 -0
  245. /package/{types/core → core}/schemas/builders/primitives/index.d.ts +0 -0
  246. /package/{types/core → core}/schemas/builders/primitives/number.d.ts +0 -0
  247. /package/{types/core → core}/schemas/builders/primitives/string.d.ts +0 -0
  248. /package/{types/core → core}/schemas/builders/primitives/unknown.d.ts +0 -0
  249. /package/{types/core → core}/schemas/builders/record/index.d.ts +0 -0
  250. /package/{types/core → core}/schemas/builders/record/record.d.ts +0 -0
  251. /package/{types/core → core}/schemas/builders/record/types.d.ts +0 -0
  252. /package/{types/core → core}/schemas/builders/schema-utils/JsonError.d.ts +0 -0
  253. /package/{types/core → core}/schemas/builders/schema-utils/ParseError.d.ts +0 -0
  254. /package/{types/core → core}/schemas/builders/schema-utils/getSchemaUtils.d.ts +0 -0
  255. /package/{types/core → core}/schemas/builders/schema-utils/index.d.ts +0 -0
  256. /package/{types/core → core}/schemas/builders/schema-utils/stringifyValidationErrors.d.ts +0 -0
  257. /package/{types/core → core}/schemas/builders/set/index.d.ts +0 -0
  258. /package/{types/core → core}/schemas/builders/set/set.d.ts +0 -0
  259. /package/{types/core → core}/schemas/builders/union/discriminant.d.ts +0 -0
  260. /package/{types/core → core}/schemas/builders/union/index.d.ts +0 -0
  261. /package/{types/core → core}/schemas/builders/union/types.d.ts +0 -0
  262. /package/{types/core → core}/schemas/builders/union/union.d.ts +0 -0
  263. /package/{types/core → core}/schemas/index.d.ts +0 -0
  264. /package/{types/core → core}/schemas/utils/MaybePromise.d.ts +0 -0
  265. /package/{types/core → core}/schemas/utils/OptionalRecord.d.ts +0 -0
  266. /package/{types/core → core}/schemas/utils/createIdentitySchemaCreator.d.ts +0 -0
  267. /package/{types/core → core}/schemas/utils/entries.d.ts +0 -0
  268. /package/{types/core → core}/schemas/utils/filterObject.d.ts +0 -0
  269. /package/{types/core → core}/schemas/utils/isPlainObject.d.ts +0 -0
  270. /package/{types/core → core}/schemas/utils/keys.d.ts +0 -0
  271. /package/{types/core → core}/schemas/utils/partition.d.ts +0 -0
  272. /package/{types/index.d.ts → index.d.ts} +0 -0
  273. /package/{types/serialization → serialization}/index.d.ts +0 -0
  274. /package/{types/serialization → serialization}/resources/commons/index.d.ts +0 -0
  275. /package/{types/serialization → serialization}/resources/commons/types/OrganizationId.d.ts +0 -0
  276. /package/{types/serialization → serialization}/resources/commons/types/UserId.d.ts +0 -0
  277. /package/{types/serialization → serialization}/resources/commons/types/index.d.ts +0 -0
  278. /package/{types/serialization → serialization}/resources/index.d.ts +0 -0
  279. /package/{types/serialization → serialization}/resources/organization/client/addUser.d.ts +0 -0
  280. /package/{types/serialization → serialization}/resources/organization/client/create.d.ts +0 -0
  281. /package/{types/serialization → serialization}/resources/organization/client/get.d.ts +0 -0
  282. /package/{types/serialization → serialization}/resources/organization/client/getMyOrganizationFromScopedToken.d.ts +0 -0
  283. /package/{types/serialization → serialization}/resources/organization/client/index.d.ts +0 -0
  284. /package/{types/serialization → serialization}/resources/organization/client/isMember.d.ts +0 -0
  285. /package/{types/serialization → serialization}/resources/organization/client/requests/AddUserToOrgRequest.d.ts +0 -0
  286. /package/{types/serialization → serialization}/resources/organization/client/requests/CreateOrganizationRequest.d.ts +0 -0
  287. /package/{types/serialization → serialization}/resources/organization/client/requests/UpdateOrganizationRequest.d.ts +0 -0
  288. /package/{types/serialization → serialization}/resources/organization/client/requests/index.d.ts +0 -0
  289. /package/{types/serialization → serialization}/resources/organization/client/update.d.ts +0 -0
  290. /package/{types/serialization → serialization}/resources/organization/index.d.ts +0 -0
  291. /package/{types/serialization → serialization}/resources/registry/client/generateRegistryTokens.d.ts +0 -0
  292. /package/{types/serialization → serialization}/resources/registry/client/hasRegistryPermission.d.ts +0 -0
  293. /package/{types/serialization → serialization}/resources/registry/client/index.d.ts +0 -0
  294. /package/{types/serialization → serialization}/resources/registry/client/requests/CheckRegistryPermissionRequest.d.ts +0 -0
  295. /package/{types/serialization → serialization}/resources/registry/client/requests/GenerateRegistryTokensRequest.d.ts +0 -0
  296. /package/{types/serialization → serialization}/resources/registry/client/requests/RevokeTokenRequest.d.ts +0 -0
  297. /package/{types/serialization → serialization}/resources/registry/client/requests/index.d.ts +0 -0
  298. /package/{types/serialization → serialization}/resources/registry/client/revokeToken.d.ts +0 -0
  299. /package/{types/serialization → serialization}/resources/registry/index.d.ts +0 -0
  300. /package/{types/serialization → serialization}/resources/registry/types/MavenRegistryToken.d.ts +0 -0
  301. /package/{types/serialization → serialization}/resources/registry/types/NpmRegistryToken.d.ts +0 -0
  302. /package/{types/serialization → serialization}/resources/registry/types/RegistryToken.d.ts +0 -0
  303. /package/{types/serialization → serialization}/resources/registry/types/RegistryTokens.d.ts +0 -0
  304. /package/{types/serialization → serialization}/resources/registry/types/index.d.ts +0 -0
  305. /package/{types/serialization → serialization}/resources/user/index.d.ts +0 -0
  306. /package/{types/serialization → serialization}/resources/user/types/OrganizationsPage.d.ts +0 -0
  307. /package/{types/serialization → serialization}/resources/user/types/User.d.ts +0 -0
  308. /package/{types/serialization → serialization}/resources/user/types/index.d.ts +0 -0
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.list = void 0;
4
+ const Schema_1 = require("../../Schema");
5
+ const schema_utils_1 = require("../schema-utils");
6
+ function list(schema) {
7
+ const baseSchema = {
8
+ parse: async (raw, opts) => validateAndTransformArray(raw, (item) => schema.parse(item, opts)),
9
+ json: (parsed, opts) => validateAndTransformArray(parsed, (item) => schema.json(item, opts)),
10
+ getType: () => Schema_1.SchemaType.LIST,
11
+ };
12
+ return {
13
+ ...baseSchema,
14
+ ...(0, schema_utils_1.getSchemaUtils)(baseSchema),
15
+ };
16
+ }
17
+ exports.list = list;
18
+ async function validateAndTransformArray(value, transformItem) {
19
+ if (!Array.isArray(value)) {
20
+ return {
21
+ ok: false,
22
+ errors: [
23
+ {
24
+ message: "Not a list",
25
+ path: [],
26
+ },
27
+ ],
28
+ };
29
+ }
30
+ const maybeValidItems = await Promise.all(value.map((item) => transformItem(item)));
31
+ return maybeValidItems.reduce((acc, item, index) => {
32
+ if (acc.ok && item.ok) {
33
+ return {
34
+ ok: true,
35
+ value: [...acc.value, item.value],
36
+ };
37
+ }
38
+ const errors = [];
39
+ if (!acc.ok) {
40
+ errors.push(...acc.errors);
41
+ }
42
+ if (!item.ok) {
43
+ errors.push(...item.errors.map((error) => ({
44
+ path: [`[${index}]`, ...error.path],
45
+ message: error.message,
46
+ })));
47
+ }
48
+ return {
49
+ ok: false,
50
+ errors,
51
+ };
52
+ }, { ok: true, value: [] });
53
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringLiteral = void 0;
4
+ var stringLiteral_1 = require("./stringLiteral");
5
+ Object.defineProperty(exports, "stringLiteral", { enumerable: true, get: function () { return stringLiteral_1.stringLiteral; } });
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringLiteral = void 0;
4
+ const Schema_1 = require("../../Schema");
5
+ const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
6
+ function stringLiteral(literal) {
7
+ const schemaCreator = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.STRING_LITERAL, (value) => {
8
+ if (value === literal) {
9
+ return {
10
+ ok: true,
11
+ value: literal,
12
+ };
13
+ }
14
+ else {
15
+ return {
16
+ ok: false,
17
+ errors: [
18
+ {
19
+ path: [],
20
+ message: `Not equal to "${literal}"`,
21
+ },
22
+ ],
23
+ };
24
+ }
25
+ });
26
+ return schemaCreator();
27
+ }
28
+ exports.stringLiteral = stringLiteral;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.property = exports.isProperty = exports.object = exports.getObjectUtils = void 0;
4
+ var object_1 = require("./object");
5
+ Object.defineProperty(exports, "getObjectUtils", { enumerable: true, get: function () { return object_1.getObjectUtils; } });
6
+ Object.defineProperty(exports, "object", { enumerable: true, get: function () { return object_1.object; } });
7
+ var property_1 = require("./property");
8
+ Object.defineProperty(exports, "isProperty", { enumerable: true, get: function () { return property_1.isProperty; } });
9
+ Object.defineProperty(exports, "property", { enumerable: true, get: function () { return property_1.property; } });
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getObjectUtils = exports.object = void 0;
4
+ const Schema_1 = require("../../Schema");
5
+ const entries_1 = require("../../utils/entries");
6
+ const filterObject_1 = require("../../utils/filterObject");
7
+ const isPlainObject_1 = require("../../utils/isPlainObject");
8
+ const keys_1 = require("../../utils/keys");
9
+ const partition_1 = require("../../utils/partition");
10
+ const object_like_1 = require("../object-like");
11
+ const schema_utils_1 = require("../schema-utils");
12
+ const property_1 = require("./property");
13
+ function object(schemas) {
14
+ const baseSchema = {
15
+ _getRawProperties: () => Promise.resolve(Object.entries(schemas).map(([parsedKey, propertySchema]) => (0, property_1.isProperty)(propertySchema) ? propertySchema.rawKey : parsedKey)),
16
+ _getParsedProperties: () => Promise.resolve((0, keys_1.keys)(schemas)),
17
+ parse: async (raw, opts) => {
18
+ const rawKeyToProperty = {};
19
+ const requiredKeys = [];
20
+ for (const [parsedKey, schemaOrObjectProperty] of (0, entries_1.entries)(schemas)) {
21
+ const rawKey = (0, property_1.isProperty)(schemaOrObjectProperty) ? schemaOrObjectProperty.rawKey : parsedKey;
22
+ const valueSchema = (0, property_1.isProperty)(schemaOrObjectProperty)
23
+ ? schemaOrObjectProperty.valueSchema
24
+ : schemaOrObjectProperty;
25
+ const property = {
26
+ rawKey,
27
+ parsedKey: parsedKey,
28
+ valueSchema,
29
+ };
30
+ rawKeyToProperty[rawKey] = property;
31
+ if (await isSchemaRequired(valueSchema)) {
32
+ requiredKeys.push(rawKey);
33
+ }
34
+ }
35
+ return validateAndTransformObject({
36
+ value: raw,
37
+ requiredKeys,
38
+ getProperty: (rawKey) => {
39
+ const property = rawKeyToProperty[rawKey];
40
+ if (property == null) {
41
+ return undefined;
42
+ }
43
+ return {
44
+ transformedKey: property.parsedKey,
45
+ transform: (propertyValue) => property.valueSchema.parse(propertyValue, opts),
46
+ };
47
+ },
48
+ allowUnknownKeys: opts?.allowUnknownKeys ?? false,
49
+ });
50
+ },
51
+ json: async (parsed, opts) => {
52
+ const requiredKeys = [];
53
+ for (const [parsedKey, schemaOrObjectProperty] of (0, entries_1.entries)(schemas)) {
54
+ const valueSchema = (0, property_1.isProperty)(schemaOrObjectProperty)
55
+ ? schemaOrObjectProperty.valueSchema
56
+ : schemaOrObjectProperty;
57
+ if (await isSchemaRequired(valueSchema)) {
58
+ requiredKeys.push(parsedKey);
59
+ }
60
+ }
61
+ return validateAndTransformObject({
62
+ value: parsed,
63
+ requiredKeys,
64
+ getProperty: (parsedKey) => {
65
+ const property = schemas[parsedKey];
66
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
67
+ if (property == null) {
68
+ return undefined;
69
+ }
70
+ if ((0, property_1.isProperty)(property)) {
71
+ return {
72
+ transformedKey: property.rawKey,
73
+ transform: (propertyValue) => property.valueSchema.json(propertyValue, opts),
74
+ };
75
+ }
76
+ else {
77
+ return {
78
+ transformedKey: parsedKey,
79
+ transform: (propertyValue) => property.json(propertyValue, opts),
80
+ };
81
+ }
82
+ },
83
+ allowUnknownKeys: opts?.allowUnknownKeys ?? false,
84
+ });
85
+ },
86
+ getType: () => Schema_1.SchemaType.OBJECT,
87
+ };
88
+ return {
89
+ ...baseSchema,
90
+ ...(0, schema_utils_1.getSchemaUtils)(baseSchema),
91
+ ...(0, object_like_1.getObjectLikeUtils)(baseSchema),
92
+ ...getObjectUtils(baseSchema),
93
+ };
94
+ }
95
+ exports.object = object;
96
+ async function validateAndTransformObject({ value, requiredKeys, getProperty, allowUnknownKeys, }) {
97
+ if (!(0, isPlainObject_1.isPlainObject)(value)) {
98
+ return {
99
+ ok: false,
100
+ errors: [
101
+ {
102
+ path: [],
103
+ message: isPlainObject_1.NOT_AN_OBJECT_ERROR_MESSAGE,
104
+ },
105
+ ],
106
+ };
107
+ }
108
+ const missingRequiredKeys = new Set(requiredKeys);
109
+ const errors = [];
110
+ const transformed = {};
111
+ for (const [preTransformedKey, preTransformedItemValue] of Object.entries(value)) {
112
+ const property = getProperty(preTransformedKey);
113
+ if (property != null) {
114
+ missingRequiredKeys.delete(preTransformedKey);
115
+ const value = await property.transform(preTransformedItemValue);
116
+ if (value.ok) {
117
+ transformed[property.transformedKey] = value.value;
118
+ }
119
+ else {
120
+ errors.push(...value.errors.map((error) => ({
121
+ path: [preTransformedKey, ...error.path],
122
+ message: error.message,
123
+ })));
124
+ }
125
+ }
126
+ else if (allowUnknownKeys) {
127
+ transformed[preTransformedKey] = preTransformedItemValue;
128
+ }
129
+ else {
130
+ errors.push({
131
+ path: [preTransformedKey],
132
+ message: `Unrecognized key "${preTransformedKey}"`,
133
+ });
134
+ }
135
+ }
136
+ errors.push(...requiredKeys
137
+ .filter((key) => missingRequiredKeys.has(key))
138
+ .map((key) => ({
139
+ path: [],
140
+ message: `Missing required key "${key}"`,
141
+ })));
142
+ if (errors.length === 0) {
143
+ return {
144
+ ok: true,
145
+ value: transformed,
146
+ };
147
+ }
148
+ else {
149
+ return {
150
+ ok: false,
151
+ errors,
152
+ };
153
+ }
154
+ }
155
+ function getObjectUtils(schema) {
156
+ return {
157
+ extend: (extension) => {
158
+ const baseSchema = {
159
+ _getParsedProperties: async () => [
160
+ ...(await schema._getParsedProperties()),
161
+ ...(await extension._getParsedProperties()),
162
+ ],
163
+ _getRawProperties: async () => [
164
+ ...(await schema._getRawProperties()),
165
+ ...(await extension._getRawProperties()),
166
+ ],
167
+ parse: async (raw, opts) => {
168
+ return validateAndTransformExtendedObject({
169
+ extensionKeys: await extension._getRawProperties(),
170
+ value: raw,
171
+ transformBase: (rawBase) => schema.parse(rawBase, opts),
172
+ transformExtension: (rawExtension) => extension.parse(rawExtension, opts),
173
+ });
174
+ },
175
+ json: async (parsed, opts) => {
176
+ return validateAndTransformExtendedObject({
177
+ extensionKeys: await extension._getParsedProperties(),
178
+ value: parsed,
179
+ transformBase: (parsedBase) => schema.json(parsedBase, opts),
180
+ transformExtension: (parsedExtension) => extension.json(parsedExtension, opts),
181
+ });
182
+ },
183
+ getType: () => Schema_1.SchemaType.OBJECT,
184
+ };
185
+ return {
186
+ ...baseSchema,
187
+ ...(0, schema_utils_1.getSchemaUtils)(baseSchema),
188
+ ...(0, object_like_1.getObjectLikeUtils)(baseSchema),
189
+ ...getObjectUtils(baseSchema),
190
+ };
191
+ },
192
+ };
193
+ }
194
+ exports.getObjectUtils = getObjectUtils;
195
+ async function validateAndTransformExtendedObject({ extensionKeys, value, transformBase, transformExtension, }) {
196
+ const extensionPropertiesSet = new Set(extensionKeys);
197
+ const [extensionProperties, baseProperties] = (0, partition_1.partition)((0, keys_1.keys)(value), (key) => extensionPropertiesSet.has(key));
198
+ const transformedBase = await transformBase((0, filterObject_1.filterObject)(value, baseProperties));
199
+ const transformedExtension = await transformExtension((0, filterObject_1.filterObject)(value, extensionProperties));
200
+ if (transformedBase.ok && transformedExtension.ok) {
201
+ return {
202
+ ok: true,
203
+ value: {
204
+ ...transformedBase.value,
205
+ ...transformedExtension.value,
206
+ },
207
+ };
208
+ }
209
+ else {
210
+ return {
211
+ ok: false,
212
+ errors: [
213
+ ...(transformedBase.ok ? [] : transformedBase.errors),
214
+ ...(transformedExtension.ok ? [] : transformedExtension.errors),
215
+ ],
216
+ };
217
+ }
218
+ }
219
+ async function isSchemaRequired(schema) {
220
+ return !(await isSchemaOptional(schema));
221
+ }
222
+ async function isSchemaOptional(schema) {
223
+ switch (await schema.getType()) {
224
+ case Schema_1.SchemaType.ANY:
225
+ case Schema_1.SchemaType.UNKNOWN:
226
+ case Schema_1.SchemaType.OPTIONAL:
227
+ return true;
228
+ default:
229
+ return false;
230
+ }
231
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isProperty = exports.property = void 0;
4
+ function property(rawKey, valueSchema) {
5
+ return {
6
+ rawKey,
7
+ valueSchema,
8
+ isProperty: true,
9
+ };
10
+ }
11
+ exports.property = property;
12
+ function isProperty(maybeProperty) {
13
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
14
+ return maybeProperty.isProperty;
15
+ }
16
+ exports.isProperty = isProperty;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withParsedProperties = exports.getObjectLikeUtils = void 0;
4
+ const filterObject_1 = require("../../utils/filterObject");
5
+ const isPlainObject_1 = require("../../utils/isPlainObject");
6
+ const schema_utils_1 = require("../schema-utils");
7
+ function getObjectLikeUtils(schema) {
8
+ return {
9
+ withParsedProperties: (properties) => withParsedProperties(schema, properties),
10
+ };
11
+ }
12
+ exports.getObjectLikeUtils = getObjectLikeUtils;
13
+ /**
14
+ * object-like utils are defined in one file to resolve issues with circular imports
15
+ */
16
+ function withParsedProperties(objectLike, properties) {
17
+ const objectSchema = {
18
+ parse: async (raw, opts) => {
19
+ const parsedObject = await objectLike.parse(raw, opts);
20
+ if (!parsedObject.ok) {
21
+ return parsedObject;
22
+ }
23
+ const additionalProperties = Object.entries(properties).reduce((processed, [key, value]) => {
24
+ return {
25
+ ...processed,
26
+ [key]: typeof value === "function" ? value(parsedObject.value) : value,
27
+ };
28
+ }, {});
29
+ return {
30
+ ok: true,
31
+ value: {
32
+ ...parsedObject.value,
33
+ ...additionalProperties,
34
+ },
35
+ };
36
+ },
37
+ json: (parsed, opts) => {
38
+ if (!(0, isPlainObject_1.isPlainObject)(parsed)) {
39
+ return {
40
+ ok: false,
41
+ errors: [
42
+ {
43
+ path: [],
44
+ message: isPlainObject_1.NOT_AN_OBJECT_ERROR_MESSAGE,
45
+ },
46
+ ],
47
+ };
48
+ }
49
+ // strip out added properties
50
+ const addedPropertyKeys = new Set(Object.keys(properties));
51
+ const parsedWithoutAddedProperties = (0, filterObject_1.filterObject)(parsed, Object.keys(parsed).filter((key) => !addedPropertyKeys.has(key)));
52
+ return objectLike.json(parsedWithoutAddedProperties, opts);
53
+ },
54
+ getType: () => objectLike.getType(),
55
+ };
56
+ return {
57
+ ...objectSchema,
58
+ ...(0, schema_utils_1.getSchemaUtils)(objectSchema),
59
+ ...getObjectLikeUtils(objectSchema),
60
+ };
61
+ }
62
+ exports.withParsedProperties = withParsedProperties;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withParsedProperties = exports.getObjectLikeUtils = void 0;
4
+ var getObjectLikeUtils_1 = require("./getObjectLikeUtils");
5
+ Object.defineProperty(exports, "getObjectLikeUtils", { enumerable: true, get: function () { return getObjectLikeUtils_1.getObjectLikeUtils; } });
6
+ Object.defineProperty(exports, "withParsedProperties", { enumerable: true, get: function () { return getObjectLikeUtils_1.withParsedProperties; } });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.any = void 0;
4
+ const Schema_1 = require("../../Schema");
5
+ const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
6
+ exports.any = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.ANY, (value) => ({ ok: true, value }));
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.boolean = void 0;
4
+ const Schema_1 = require("../../Schema");
5
+ const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
6
+ exports.boolean = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.BOOLEAN, (value) => {
7
+ if (typeof value === "boolean") {
8
+ return {
9
+ ok: true,
10
+ value,
11
+ };
12
+ }
13
+ else {
14
+ return {
15
+ ok: false,
16
+ errors: [
17
+ {
18
+ path: [],
19
+ message: "Not a boolean",
20
+ },
21
+ ],
22
+ };
23
+ }
24
+ });
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unknown = exports.string = exports.number = exports.boolean = exports.any = void 0;
4
+ var any_1 = require("./any");
5
+ Object.defineProperty(exports, "any", { enumerable: true, get: function () { return any_1.any; } });
6
+ var boolean_1 = require("./boolean");
7
+ Object.defineProperty(exports, "boolean", { enumerable: true, get: function () { return boolean_1.boolean; } });
8
+ var number_1 = require("./number");
9
+ Object.defineProperty(exports, "number", { enumerable: true, get: function () { return number_1.number; } });
10
+ var string_1 = require("./string");
11
+ Object.defineProperty(exports, "string", { enumerable: true, get: function () { return string_1.string; } });
12
+ var unknown_1 = require("./unknown");
13
+ Object.defineProperty(exports, "unknown", { enumerable: true, get: function () { return unknown_1.unknown; } });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.number = void 0;
4
+ const Schema_1 = require("../../Schema");
5
+ const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
6
+ exports.number = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.NUMBER, (value) => {
7
+ if (typeof value === "number") {
8
+ return {
9
+ ok: true,
10
+ value,
11
+ };
12
+ }
13
+ else {
14
+ return {
15
+ ok: false,
16
+ errors: [
17
+ {
18
+ path: [],
19
+ message: "Not a number",
20
+ },
21
+ ],
22
+ };
23
+ }
24
+ });
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.string = void 0;
4
+ const Schema_1 = require("../../Schema");
5
+ const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
6
+ exports.string = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.STRING, (value) => {
7
+ if (typeof value === "string") {
8
+ return {
9
+ ok: true,
10
+ value,
11
+ };
12
+ }
13
+ else {
14
+ return {
15
+ ok: false,
16
+ errors: [
17
+ {
18
+ path: [],
19
+ message: "Not a string",
20
+ },
21
+ ],
22
+ };
23
+ }
24
+ });
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unknown = void 0;
4
+ const Schema_1 = require("../../Schema");
5
+ const createIdentitySchemaCreator_1 = require("../../utils/createIdentitySchemaCreator");
6
+ exports.unknown = (0, createIdentitySchemaCreator_1.createIdentitySchemaCreator)(Schema_1.SchemaType.UNKNOWN, (value) => ({ ok: true, value }));
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.record = void 0;
4
+ var record_1 = require("./record");
5
+ Object.defineProperty(exports, "record", { enumerable: true, get: function () { return record_1.record; } });
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.record = void 0;
4
+ const Schema_1 = require("../../Schema");
5
+ const entries_1 = require("../../utils/entries");
6
+ const isPlainObject_1 = require("../../utils/isPlainObject");
7
+ const schema_utils_1 = require("../schema-utils");
8
+ function record(keySchema, valueSchema) {
9
+ const baseSchema = {
10
+ parse: async (raw, opts) => {
11
+ return validateAndTransformRecord({
12
+ value: raw,
13
+ isKeyNumeric: (await keySchema.getType()) === Schema_1.SchemaType.NUMBER,
14
+ transformKey: (key) => keySchema.parse(key, opts),
15
+ transformValue: (value) => valueSchema.parse(value, opts),
16
+ });
17
+ },
18
+ json: async (parsed, opts) => {
19
+ return validateAndTransformRecord({
20
+ value: parsed,
21
+ isKeyNumeric: (await keySchema.getType()) === Schema_1.SchemaType.NUMBER,
22
+ transformKey: (key) => keySchema.json(key, opts),
23
+ transformValue: (value) => valueSchema.json(value, opts),
24
+ });
25
+ },
26
+ getType: () => Schema_1.SchemaType.RECORD,
27
+ };
28
+ return {
29
+ ...baseSchema,
30
+ ...(0, schema_utils_1.getSchemaUtils)(baseSchema),
31
+ };
32
+ }
33
+ exports.record = record;
34
+ async function validateAndTransformRecord({ value, isKeyNumeric, transformKey, transformValue, }) {
35
+ if (!(0, isPlainObject_1.isPlainObject)(value)) {
36
+ return {
37
+ ok: false,
38
+ errors: [
39
+ {
40
+ path: [],
41
+ message: isPlainObject_1.NOT_AN_OBJECT_ERROR_MESSAGE,
42
+ },
43
+ ],
44
+ };
45
+ }
46
+ return (0, entries_1.entries)(value).reduce(async (accPromise, [stringKey, value]) => {
47
+ // skip nullish keys
48
+ if (value == null) {
49
+ return accPromise;
50
+ }
51
+ const acc = await accPromise;
52
+ let key = stringKey;
53
+ if (isKeyNumeric) {
54
+ const numberKey = stringKey.length > 0 ? Number(stringKey) : NaN;
55
+ if (!isNaN(numberKey)) {
56
+ key = numberKey;
57
+ }
58
+ }
59
+ const transformedKey = await transformKey(key);
60
+ const transformedValue = await transformValue(value);
61
+ if (acc.ok && transformedKey.ok && transformedValue.ok) {
62
+ return {
63
+ ok: true,
64
+ value: {
65
+ ...acc.value,
66
+ [transformedKey.value]: transformedValue.value,
67
+ },
68
+ };
69
+ }
70
+ const errors = [];
71
+ if (!acc.ok) {
72
+ errors.push(...acc.errors);
73
+ }
74
+ if (!transformedKey.ok) {
75
+ errors.push(...transformedKey.errors.map((error) => ({
76
+ path: [`${key} (key)`, ...error.path],
77
+ message: error.message,
78
+ })));
79
+ }
80
+ if (!transformedValue.ok) {
81
+ errors.push(...transformedValue.errors.map((error) => ({
82
+ path: [stringKey, ...error.path],
83
+ message: error.message,
84
+ })));
85
+ }
86
+ return {
87
+ ok: false,
88
+ errors,
89
+ };
90
+ }, Promise.resolve({ ok: true, value: {} }));
91
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JsonError = void 0;
4
+ const stringifyValidationErrors_1 = require("./stringifyValidationErrors");
5
+ class JsonError extends Error {
6
+ errors;
7
+ constructor(errors) {
8
+ super(errors.map(stringifyValidationErrors_1.stringifyValidationError).join("; "));
9
+ this.errors = errors;
10
+ Object.setPrototypeOf(this, JsonError.prototype);
11
+ }
12
+ }
13
+ exports.JsonError = JsonError;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ParseError = void 0;
4
+ const stringifyValidationErrors_1 = require("./stringifyValidationErrors");
5
+ class ParseError extends Error {
6
+ errors;
7
+ constructor(errors) {
8
+ super(errors.map(stringifyValidationErrors_1.stringifyValidationError).join("; "));
9
+ this.errors = errors;
10
+ Object.setPrototypeOf(this, ParseError.prototype);
11
+ }
12
+ }
13
+ exports.ParseError = ParseError;