@tstdl/base 0.78.0-beta7 → 0.78.0-beta70

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 (550) hide show
  1. package/api/client/client.d.ts +2 -1
  2. package/api/client/client.js +38 -16
  3. package/api/client/client.js.map +1 -1
  4. package/api/response.js +3 -2
  5. package/api/response.js.map +1 -1
  6. package/api/server/api-controller.js +1 -1
  7. package/api/server/api-controller.js.map +1 -1
  8. package/api/server/gateway.d.ts +15 -3
  9. package/api/server/gateway.js +53 -37
  10. package/api/server/gateway.js.map +1 -1
  11. package/api/server/middlewares/allowed-methods.middleware.js +1 -1
  12. package/api/server/middlewares/allowed-methods.middleware.js.map +1 -1
  13. package/api/server/middlewares/cors.middleware.d.ts +6 -4
  14. package/api/server/middlewares/cors.middleware.js +30 -30
  15. package/api/server/middlewares/cors.middleware.js.map +1 -1
  16. package/api/types.d.ts +36 -14
  17. package/api/types.js +1 -2
  18. package/api/types.js.map +1 -1
  19. package/api/utils.d.ts +9 -0
  20. package/api/utils.js +15 -0
  21. package/api/utils.js.map +1 -0
  22. package/application/application.d.ts +2 -0
  23. package/application/application.js +3 -0
  24. package/application/application.js.map +1 -1
  25. package/collections/awaitable/awaitable-list.js +7 -7
  26. package/collections/awaitable/awaitable-list.js.map +1 -1
  27. package/collections/observable/observable-array.js +1 -1
  28. package/collections/observable/observable-array.js.map +1 -1
  29. package/collections/observable/observable-list-base.js +2 -2
  30. package/collections/observable/observable-list-base.js.map +1 -1
  31. package/collections/observable/observable-sorted-array-list.js +3 -3
  32. package/collections/observable/observable-sorted-array-list.js.map +1 -1
  33. package/collections/sorted-array-list.js +3 -3
  34. package/collections/sorted-array-list.js.map +1 -1
  35. package/collections/sorted-map.js +1 -1
  36. package/collections/sorted-map.js.map +1 -1
  37. package/container/container.js +19 -21
  38. package/container/container.js.map +1 -1
  39. package/container/decorators.d.ts +1 -1
  40. package/container/decorators.js.map +1 -1
  41. package/container/resolve-chain.d.ts +2 -1
  42. package/container/resolve-chain.js +6 -2
  43. package/container/resolve-chain.js.map +1 -1
  44. package/core.js +1 -1
  45. package/core.js.map +1 -1
  46. package/css/theme/theme.service.js.map +1 -1
  47. package/data-structures/index-out-of-bounds.error.d.ts +1 -1
  48. package/data-structures/index-out-of-bounds.error.js +2 -2
  49. package/data-structures/index-out-of-bounds.error.js.map +1 -1
  50. package/data-structures/iterable-weak-map.js +1 -1
  51. package/data-structures/iterable-weak-map.js.map +1 -1
  52. package/data-structures/linked-list.js.map +1 -1
  53. package/data-structures/sorted-array-list.js +2 -2
  54. package/data-structures/sorted-array-list.js.map +1 -1
  55. package/database/mongo/classes.js.map +1 -1
  56. package/database/mongo/mongo-base.repository.js +3 -3
  57. package/database/mongo/mongo-base.repository.js.map +1 -1
  58. package/database/mongo/mongo-entity-repository.js +2 -2
  59. package/database/mongo/mongo-entity-repository.js.map +1 -1
  60. package/distributed-loop/distributed-loop.js.map +1 -1
  61. package/distributed-loop/provider.js.map +1 -1
  62. package/environment.d.ts +10 -0
  63. package/environment.js +26 -0
  64. package/environment.js.map +1 -0
  65. package/error/custom.error.d.ts +7 -3
  66. package/error/custom.error.js +17 -8
  67. package/error/custom.error.js.map +1 -1
  68. package/error/index.d.ts +1 -0
  69. package/error/index.js +1 -0
  70. package/error/index.js.map +1 -1
  71. package/error/max-bytes-exceeded.error.d.ts +1 -0
  72. package/error/max-bytes-exceeded.error.js +3 -0
  73. package/error/max-bytes-exceeded.error.js.map +1 -1
  74. package/error/not-implemented.error.js +1 -1
  75. package/error/not-implemented.error.js.map +1 -1
  76. package/error/not-supported.error.d.ts +7 -0
  77. package/error/not-supported.error.js +17 -0
  78. package/error/not-supported.error.js.map +1 -0
  79. package/error/unsupported-media-type.error.js +1 -1
  80. package/error/unsupported-media-type.error.js.map +1 -1
  81. package/examples/api/basic-overview.js +17 -25
  82. package/examples/api/basic-overview.js.map +1 -1
  83. package/examples/api/streaming.d.ts +1 -0
  84. package/examples/api/streaming.js +79 -0
  85. package/examples/api/streaming.js.map +1 -0
  86. package/examples/mail/basic.js +12 -7
  87. package/examples/mail/basic.js.map +1 -1
  88. package/examples/mail/templates/hello-name.d.ts +2 -0
  89. package/examples/mail/templates/hello-name.js +11 -0
  90. package/examples/mail/templates/hello-name.js.map +1 -0
  91. package/examples/pdf/basic.js +8 -5
  92. package/examples/pdf/basic.js.map +1 -1
  93. package/examples/pdf/templates/hello-name.d.ts +1 -4
  94. package/examples/pdf/templates/hello-name.js +30 -4
  95. package/examples/pdf/templates/hello-name.js.map +1 -1
  96. package/examples/reflection/basic.js +1 -1
  97. package/examples/reflection/basic.js.map +1 -1
  98. package/examples/template/basic.d.ts +1 -0
  99. package/examples/template/basic.js +25 -0
  100. package/examples/template/basic.js.map +1 -0
  101. package/examples/template/templates/hello-name.d.ts +2 -0
  102. package/examples/template/templates/hello-name.js +23 -0
  103. package/examples/template/templates/hello-name.js.map +1 -0
  104. package/http/client/adapters/undici-http-client.adapter.d.ts +1 -2
  105. package/http/client/adapters/undici-http-client.adapter.js +10 -12
  106. package/http/client/adapters/undici-http-client.adapter.js.map +1 -1
  107. package/http/client/http-client-request.d.ts +24 -14
  108. package/http/client/http-client-request.js +4 -2
  109. package/http/client/http-client-request.js.map +1 -1
  110. package/http/client/http-client-response.d.ts +10 -12
  111. package/http/client/http-client-response.js +5 -1
  112. package/http/client/http-client-response.js.map +1 -1
  113. package/http/client/http-client.adapter.d.ts +1 -2
  114. package/http/client/http-client.adapter.js.map +1 -1
  115. package/http/client/http-client.d.ts +30 -31
  116. package/http/client/http-client.js +107 -74
  117. package/http/client/http-client.js.map +1 -1
  118. package/http/http-body.d.ts +19 -0
  119. package/http/http-body.js +52 -0
  120. package/http/http-body.js.map +1 -0
  121. package/http/http-headers.d.ts +3 -0
  122. package/http/http-headers.js +6 -0
  123. package/http/http-headers.js.map +1 -1
  124. package/http/http-value-map.js +2 -2
  125. package/http/http-value-map.js.map +1 -1
  126. package/http/http.error.d.ts +5 -2
  127. package/http/http.error.js +27 -5
  128. package/http/http.error.js.map +1 -1
  129. package/http/index.d.ts +2 -0
  130. package/http/index.js +2 -0
  131. package/http/index.js.map +1 -1
  132. package/http/server/http-server-request.d.ts +5 -10
  133. package/http/server/http-server-request.js +3 -30
  134. package/http/server/http-server-request.js.map +1 -1
  135. package/http/server/http-server-response.d.ts +4 -4
  136. package/http/server/node/node-http-server.js +2 -1
  137. package/http/server/node/node-http-server.js.map +1 -1
  138. package/http/types.d.ts +1 -11
  139. package/http/types.js +1 -2
  140. package/http/types.js.map +1 -1
  141. package/http/utils.d.ts +15 -0
  142. package/http/utils.js +113 -0
  143. package/http/utils.js.map +1 -0
  144. package/image-service/image-service.js.map +1 -1
  145. package/image-service/imgproxy/imgproxy-image-service.js.map +1 -1
  146. package/json-path/json-path.d.ts +8 -5
  147. package/json-path/json-path.js +15 -1
  148. package/json-path/json-path.js.map +1 -1
  149. package/key-value-store/mongo/mongo-key-value-store.provider.js.map +1 -1
  150. package/key-value-store/mongo/mongo-key-value.repository.js.map +1 -1
  151. package/key-value-store/mongo/mongo-key-value.store.js.map +1 -1
  152. package/lock/mongo/lock.js.map +1 -1
  153. package/lock/mongo/mongo-lock-repository.js.map +1 -1
  154. package/lock/mongo/provider.js.map +1 -1
  155. package/logger/console/logger.js +1 -1
  156. package/logger/console/logger.js.map +1 -1
  157. package/logger/logger.d.ts +2 -2
  158. package/mail/clients/nodemailer.mail-client.js.map +1 -1
  159. package/mail/index.d.ts +0 -3
  160. package/mail/index.js +0 -3
  161. package/mail/index.js.map +1 -1
  162. package/mail/mail.service.d.ts +3 -5
  163. package/mail/mail.service.js +8 -14
  164. package/mail/mail.service.js.map +1 -1
  165. package/mail/models/mail-template.model.d.ts +11 -10
  166. package/mail/models/mail-template.model.js +7 -0
  167. package/mail/models/mail-template.model.js.map +1 -1
  168. package/mail/module.d.ts +1 -5
  169. package/mail/module.js +2 -11
  170. package/mail/module.js.map +1 -1
  171. package/mail/repositories/mongo-mail-log.repository.js.map +1 -1
  172. package/mail/tokens.d.ts +0 -3
  173. package/mail/tokens.js +1 -2
  174. package/mail/tokens.js.map +1 -1
  175. package/message-bus/local/local-message-bus-provider.js.map +1 -1
  176. package/message-bus/local/local-message-bus.js.map +1 -1
  177. package/migration/migrator.js.map +1 -1
  178. package/migration/mongo/migration-state-repository.js.map +1 -1
  179. package/module/modules/web-server.module.js.map +1 -1
  180. package/object-storage/s3/s3.object-storage-provider.js.map +1 -1
  181. package/object-storage/s3/s3.object-storage.js.map +1 -1
  182. package/openid-connect/cached-oidc-configuration.service.js.map +1 -1
  183. package/openid-connect/mongo-oidc-state.repository.js.map +1 -1
  184. package/openid-connect/oidc-configuration.service.d.ts +2 -1
  185. package/openid-connect/oidc-configuration.service.js +5 -3
  186. package/openid-connect/oidc-configuration.service.js.map +1 -1
  187. package/openid-connect/oidc.service-model.d.ts +11 -3
  188. package/openid-connect/oidc.service.d.ts +6 -3
  189. package/openid-connect/oidc.service.js +72 -25
  190. package/openid-connect/oidc.service.js.map +1 -1
  191. package/package.json +12 -11
  192. package/pdf/pdf.service.d.ts +91 -12
  193. package/pdf/pdf.service.js +209 -29
  194. package/pdf/pdf.service.js.map +1 -1
  195. package/pool/pool.d.ts +6 -1
  196. package/pool/pool.js +4 -1
  197. package/pool/pool.js.map +1 -1
  198. package/promise/deferred-promise.d.ts +2 -15
  199. package/promise/deferred-promise.js +5 -10
  200. package/promise/deferred-promise.js.map +1 -1
  201. package/promise/index.d.ts +1 -0
  202. package/promise/index.js +1 -0
  203. package/promise/index.js.map +1 -1
  204. package/promise/lazy-promise.d.ts +11 -0
  205. package/promise/lazy-promise.js +31 -0
  206. package/promise/lazy-promise.js.map +1 -0
  207. package/queue/mongo/mongo-job.repository.js +1 -1
  208. package/queue/mongo/mongo-job.repository.js.map +1 -1
  209. package/queue/mongo/queue.js.map +1 -1
  210. package/queue/mongo/queue.provider.js.map +1 -1
  211. package/reflection/decorator-data.js +1 -1
  212. package/reflection/decorator-data.js.map +1 -1
  213. package/reflection/decorators.d.ts +2 -2
  214. package/reflection/decorators.js +7 -7
  215. package/reflection/decorators.js.map +1 -1
  216. package/reflection/registry.d.ts +8 -8
  217. package/reflection/registry.js +1 -1
  218. package/reflection/registry.js.map +1 -1
  219. package/reflection/types.d.ts +3 -2
  220. package/reflection/utils.d.ts +7 -2
  221. package/reflection/utils.js +38 -12
  222. package/reflection/utils.js.map +1 -1
  223. package/require.d.ts +1 -0
  224. package/require.js +9 -0
  225. package/require.js.map +1 -0
  226. package/rpc/endpoints/message-port.rpc-endpoint.d.ts +19 -0
  227. package/rpc/endpoints/message-port.rpc-endpoint.js +34 -0
  228. package/rpc/endpoints/message-port.rpc-endpoint.js.map +1 -0
  229. package/rpc/index.d.ts +4 -0
  230. package/rpc/index.js +21 -0
  231. package/rpc/index.js.map +1 -0
  232. package/rpc/model.d.ts +72 -0
  233. package/rpc/model.js +13 -0
  234. package/rpc/model.js.map +1 -0
  235. package/rpc/rpc-endpoint.d.ts +11 -0
  236. package/rpc/rpc-endpoint.js +23 -0
  237. package/rpc/rpc-endpoint.js.map +1 -0
  238. package/rpc/rpc-error.d.ts +8 -0
  239. package/rpc/rpc-error.js +26 -0
  240. package/rpc/rpc-error.js.map +1 -0
  241. package/rpc/rpc.d.ts +19 -0
  242. package/rpc/rpc.js +263 -0
  243. package/rpc/rpc.js.map +1 -0
  244. package/schema/array-constraints/maximum-length.d.ts +2 -2
  245. package/schema/array-constraints/maximum-length.js +2 -2
  246. package/schema/array-constraints/maximum-length.js.map +1 -1
  247. package/schema/array-constraints/minimum-length.d.ts +2 -2
  248. package/schema/array-constraints/minimum-length.js +2 -2
  249. package/schema/array-constraints/minimum-length.js.map +1 -1
  250. package/schema/coercers/boolean.coercer.d.ts +2 -2
  251. package/schema/coercers/boolean.coercer.js +2 -2
  252. package/schema/coercers/boolean.coercer.js.map +1 -1
  253. package/schema/coercers/date.coercer.d.ts +2 -2
  254. package/schema/coercers/date.coercer.js +2 -2
  255. package/schema/coercers/date.coercer.js.map +1 -1
  256. package/schema/coercers/number.coercer.d.ts +3 -3
  257. package/schema/coercers/number.coercer.js +2 -2
  258. package/schema/coercers/number.coercer.js.map +1 -1
  259. package/schema/coercers/regexp.coercer.d.ts +2 -2
  260. package/schema/coercers/regexp.coercer.js +2 -2
  261. package/schema/coercers/regexp.coercer.js.map +1 -1
  262. package/schema/coercers/string.coercer.d.ts +3 -3
  263. package/schema/coercers/string.coercer.js +2 -2
  264. package/schema/coercers/string.coercer.js.map +1 -1
  265. package/schema/coercers/uint8-array.coercer.js +2 -2
  266. package/schema/coercers/uint8-array.coercer.js.map +1 -1
  267. package/schema/constraints/enumeration.d.ts +5 -5
  268. package/schema/constraints/enumeration.js +6 -6
  269. package/schema/constraints/enumeration.js.map +1 -1
  270. package/schema/constraints/generic.d.ts +2 -2
  271. package/schema/constraints/generic.js +2 -2
  272. package/schema/constraints/generic.js.map +1 -1
  273. package/schema/constraints/integer.d.ts +2 -2
  274. package/schema/constraints/integer.js +2 -2
  275. package/schema/constraints/integer.js.map +1 -1
  276. package/schema/constraints/literal.d.ts +2 -2
  277. package/schema/constraints/literal.js +2 -2
  278. package/schema/constraints/literal.js.map +1 -1
  279. package/schema/constraints/maximum-date.d.ts +2 -2
  280. package/schema/constraints/maximum-date.js +2 -2
  281. package/schema/constraints/maximum-date.js.map +1 -1
  282. package/schema/constraints/maximum-length.d.ts +3 -3
  283. package/schema/constraints/maximum-length.js +2 -2
  284. package/schema/constraints/maximum-length.js.map +1 -1
  285. package/schema/constraints/maximum.d.ts +2 -2
  286. package/schema/constraints/maximum.js +2 -2
  287. package/schema/constraints/maximum.js.map +1 -1
  288. package/schema/constraints/minimum-date.d.ts +2 -2
  289. package/schema/constraints/minimum-date.js +2 -2
  290. package/schema/constraints/minimum-date.js.map +1 -1
  291. package/schema/constraints/minimum-length.d.ts +3 -3
  292. package/schema/constraints/minimum-length.js +2 -2
  293. package/schema/constraints/minimum-length.js.map +1 -1
  294. package/schema/constraints/minimum.d.ts +2 -2
  295. package/schema/constraints/minimum.js +2 -2
  296. package/schema/constraints/minimum.js.map +1 -1
  297. package/schema/constraints/pattern.d.ts +2 -2
  298. package/schema/constraints/pattern.js +2 -2
  299. package/schema/constraints/pattern.js.map +1 -1
  300. package/schema/decorators/optional.d.ts +3 -1
  301. package/schema/decorators/optional.js +2 -2
  302. package/schema/decorators/optional.js.map +1 -1
  303. package/schema/decorators/types.d.ts +3 -3
  304. package/schema/decorators/utils.d.ts +3 -2
  305. package/schema/decorators/utils.js +8 -4
  306. package/schema/decorators/utils.js.map +1 -1
  307. package/schema/schema.d.ts +4 -10
  308. package/schema/schema.error.d.ts +6 -5
  309. package/schema/schema.error.js +13 -10
  310. package/schema/schema.error.js.map +1 -1
  311. package/schema/schema.js +110 -104
  312. package/schema/schema.js.map +1 -1
  313. package/schema/schemas/array.d.ts +3 -3
  314. package/schema/schemas/array.js.map +1 -1
  315. package/schema/schemas/assign.d.ts +6 -6
  316. package/schema/schemas/assign.js +3 -1
  317. package/schema/schemas/assign.js.map +1 -1
  318. package/schema/schemas/constraint.d.ts +3 -2
  319. package/schema/schemas/constraint.js.map +1 -1
  320. package/schema/schemas/defaulted.d.ts +2 -2
  321. package/schema/schemas/defaulted.js.map +1 -1
  322. package/schema/schemas/index.d.ts +2 -1
  323. package/schema/schemas/index.js +2 -1
  324. package/schema/schemas/index.js.map +1 -1
  325. package/schema/schemas/nullable.d.ts +2 -2
  326. package/schema/schemas/nullable.js.map +1 -1
  327. package/schema/schemas/number.d.ts +1 -1
  328. package/schema/schemas/number.js.map +1 -1
  329. package/schema/schemas/omit.d.ts +4 -0
  330. package/schema/schemas/{exclude.js → omit.js} +8 -6
  331. package/schema/schemas/omit.js.map +1 -0
  332. package/schema/schemas/optional.d.ts +3 -2
  333. package/schema/schemas/optional.js.map +1 -1
  334. package/schema/schemas/partial.d.ts +4 -0
  335. package/schema/schemas/partial.js +22 -0
  336. package/schema/schemas/partial.js.map +1 -0
  337. package/schema/schemas/pick.d.ts +2 -2
  338. package/schema/schemas/pick.js +3 -1
  339. package/schema/schemas/pick.js.map +1 -1
  340. package/schema/schemas/record.d.ts +2 -2
  341. package/schema/schemas/record.js.map +1 -1
  342. package/schema/schemas/union.d.ts +4 -9
  343. package/schema/schemas/union.js.map +1 -1
  344. package/schema/types.d.ts +30 -20
  345. package/schema/types.js +21 -8
  346. package/schema/types.js.map +1 -1
  347. package/schema/utils/schema.d.ts +6 -1
  348. package/schema/utils/schema.js +60 -4
  349. package/schema/utils/schema.js.map +1 -1
  350. package/schema/utils/value-type.d.ts +5 -3
  351. package/schema/utils/value-type.js +23 -8
  352. package/schema/utils/value-type.js.map +1 -1
  353. package/search-index/elastic/config.js.map +1 -1
  354. package/search-index/elastic/model/index-mapping.d.ts +2 -1
  355. package/search-index/elastic/model/index-mapping.js.map +1 -1
  356. package/search-index/elastic/search-index.js +5 -4
  357. package/search-index/elastic/search-index.js.map +1 -1
  358. package/search-index/error.d.ts +1 -1
  359. package/search-index/error.js +2 -2
  360. package/search-index/error.js.map +1 -1
  361. package/serializer/handlers/register.d.ts +2 -2
  362. package/serializer/handlers/register.js +6 -2
  363. package/serializer/handlers/register.js.map +1 -1
  364. package/serializer/serializable.d.ts +11 -8
  365. package/serializer/serializable.js +13 -4
  366. package/serializer/serializable.js.map +1 -1
  367. package/serializer/serializer.js +21 -8
  368. package/serializer/serializer.js.map +1 -1
  369. package/serializer/types.d.ts +21 -6
  370. package/serializer/types.js +2 -1
  371. package/serializer/types.js.map +1 -1
  372. package/supports.d.ts +5 -0
  373. package/supports.js +9 -0
  374. package/supports.js.map +1 -0
  375. package/templates/index.d.ts +2 -0
  376. package/templates/index.js +2 -0
  377. package/templates/index.js.map +1 -1
  378. package/templates/module.d.ts +3 -1
  379. package/templates/module.js +31 -8
  380. package/templates/module.js.map +1 -1
  381. package/templates/providers/file.provider-template.d.ts +16 -0
  382. package/templates/providers/{file-template.provider.js → file.provider-template.js} +22 -15
  383. package/templates/providers/file.provider-template.js.map +1 -0
  384. package/templates/providers/memory.template-provider.d.ts +8 -0
  385. package/templates/providers/{memory-template.provider.base.js → memory.template-provider.js} +8 -6
  386. package/templates/providers/memory.template-provider.js.map +1 -0
  387. package/templates/renderers/handlebars.template-renderer.d.ts +38 -6
  388. package/templates/renderers/handlebars.template-renderer.js +70 -3
  389. package/templates/renderers/handlebars.template-renderer.js.map +1 -1
  390. package/templates/renderers/mjml.template-renderer.d.ts +6 -6
  391. package/templates/renderers/mjml.template-renderer.js +8 -9
  392. package/templates/renderers/mjml.template-renderer.js.map +1 -1
  393. package/templates/renderers/string.template-renderer.d.ts +8 -0
  394. package/{mail/template-providers/memory-mail-template.provider.js → templates/renderers/string.template-renderer.js} +13 -7
  395. package/templates/renderers/string.template-renderer.js.map +1 -0
  396. package/templates/resolvers/file.template-resolver.d.ts +23 -0
  397. package/templates/resolvers/file.template-resolver.js +63 -0
  398. package/templates/resolvers/file.template-resolver.js.map +1 -0
  399. package/templates/resolvers/string.template-resolver.d.ts +13 -0
  400. package/templates/resolvers/string.template-resolver.js +44 -0
  401. package/templates/resolvers/string.template-resolver.js.map +1 -0
  402. package/templates/template-renderer.provider.js +7 -19
  403. package/templates/template-renderer.provider.js.map +1 -1
  404. package/templates/template-resolver.provider.d.ts +8 -0
  405. package/templates/template-resolver.provider.js +48 -0
  406. package/templates/template-resolver.provider.js.map +1 -0
  407. package/templates/template.model.d.ts +15 -4
  408. package/templates/template.model.js +50 -0
  409. package/templates/template.model.js.map +1 -1
  410. package/templates/template.renderer.d.ts +14 -3
  411. package/templates/template.renderer.js +3 -0
  412. package/templates/template.renderer.js.map +1 -1
  413. package/templates/template.resolver.d.ts +5 -0
  414. package/templates/template.resolver.js +7 -0
  415. package/templates/template.resolver.js.map +1 -0
  416. package/templates/template.service.d.ts +10 -4
  417. package/templates/template.service.js +19 -6
  418. package/templates/template.service.js.map +1 -1
  419. package/templates/tokens.d.ts +3 -2
  420. package/templates/tokens.js +2 -1
  421. package/templates/tokens.js.map +1 -1
  422. package/threading/index.d.ts +2 -0
  423. package/threading/index.js +19 -0
  424. package/threading/index.js.map +1 -0
  425. package/threading/thread-pool.d.ts +19 -0
  426. package/threading/thread-pool.js +50 -0
  427. package/threading/thread-pool.js.map +1 -0
  428. package/threading/thread-worker.d.ts +3 -0
  429. package/threading/thread-worker.js +9 -0
  430. package/threading/thread-worker.js.map +1 -0
  431. package/types.d.ts +27 -9
  432. package/utils/alphabet.d.ts +3 -1
  433. package/utils/alphabet.js +2 -0
  434. package/utils/alphabet.js.map +1 -1
  435. package/utils/array/array.d.ts +1 -2
  436. package/utils/array/array.js.map +1 -1
  437. package/utils/base64.js +3 -2
  438. package/utils/base64.js.map +1 -1
  439. package/utils/binary.js +3 -2
  440. package/utils/binary.js.map +1 -1
  441. package/utils/clone.js +4 -0
  442. package/utils/clone.js.map +1 -1
  443. package/utils/compression.d.ts +19 -15
  444. package/utils/compression.js +43 -10
  445. package/utils/compression.js.map +1 -1
  446. package/utils/encoding.d.ts +10 -0
  447. package/utils/encoding.js +20 -4
  448. package/utils/encoding.js.map +1 -1
  449. package/utils/enum.d.ts +5 -8
  450. package/utils/enum.js +15 -13
  451. package/utils/enum.js.map +1 -1
  452. package/utils/function/memoize.js +4 -4
  453. package/utils/function/memoize.js.map +1 -1
  454. package/utils/helpers.d.ts +0 -2
  455. package/utils/helpers.js +3 -14
  456. package/utils/helpers.js.map +1 -1
  457. package/utils/image.js +2 -2
  458. package/utils/image.js.map +1 -1
  459. package/utils/index.d.ts +2 -0
  460. package/utils/index.js +2 -0
  461. package/utils/index.js.map +1 -1
  462. package/utils/object/decycle.js +10 -21
  463. package/utils/object/decycle.js.map +1 -1
  464. package/utils/object/dereference.d.ts +7 -5
  465. package/utils/object/dereference.js +4 -4
  466. package/utils/object/dereference.js.map +1 -1
  467. package/utils/object/forward-ref.js +3 -19
  468. package/utils/object/forward-ref.js.map +1 -1
  469. package/utils/object/merge.js +3 -3
  470. package/utils/object/merge.js.map +1 -1
  471. package/utils/object/object.js +3 -3
  472. package/utils/object/object.js.map +1 -1
  473. package/utils/object/property-name.d.ts +2 -2
  474. package/utils/proxy.d.ts +6 -0
  475. package/utils/proxy.js +21 -0
  476. package/utils/proxy.js.map +1 -0
  477. package/utils/stream/finalize-stream.d.ts +1 -0
  478. package/utils/stream/finalize-stream.js +38 -0
  479. package/utils/stream/finalize-stream.js.map +1 -0
  480. package/utils/stream/index.d.ts +4 -3
  481. package/utils/stream/index.js +4 -3
  482. package/utils/stream/index.js.map +1 -1
  483. package/utils/stream/readable-stream-adapter.d.ts +5 -0
  484. package/utils/stream/readable-stream-adapter.js +45 -0
  485. package/utils/stream/readable-stream-adapter.js.map +1 -0
  486. package/utils/stream/readable-stream-from-promise.d.ts +1 -0
  487. package/utils/stream/readable-stream-from-promise.js +12 -0
  488. package/utils/stream/readable-stream-from-promise.js.map +1 -0
  489. package/utils/stream/size-limited-stream.d.ts +2 -0
  490. package/utils/stream/size-limited-stream.js +18 -0
  491. package/utils/stream/size-limited-stream.js.map +1 -0
  492. package/utils/stream/stream-reader.d.ts +2 -1
  493. package/utils/stream/stream-reader.js +7 -10
  494. package/utils/stream/stream-reader.js.map +1 -1
  495. package/utils/throw.d.ts +2 -0
  496. package/utils/throw.js +15 -0
  497. package/utils/throw.js.map +1 -0
  498. package/utils/type-guards.d.ts +34 -16
  499. package/utils/type-guards.js +112 -75
  500. package/utils/type-guards.js.map +1 -1
  501. package/web-types.d.ts +28 -0
  502. package/web-types.js +3 -0
  503. package/web-types.js.map +1 -0
  504. package/http/client/adapters/got-http-client.adapter.d.ts +0 -10
  505. package/http/client/adapters/got-http-client.adapter.js +0 -141
  506. package/http/client/adapters/got-http-client.adapter.js.map +0 -1
  507. package/http/client/adapters/utils.d.ts +0 -11
  508. package/http/client/adapters/utils.js +0 -79
  509. package/http/client/adapters/utils.js.map +0 -1
  510. package/mail/mail-template-renderer.provider.d.ts +0 -8
  511. package/mail/mail-template-renderer.provider.js +0 -60
  512. package/mail/mail-template-renderer.provider.js.map +0 -1
  513. package/mail/mail-template.provider.d.ts +0 -4
  514. package/mail/mail-template.provider.js +0 -7
  515. package/mail/mail-template.provider.js.map +0 -1
  516. package/mail/mail-template.renderer.d.ts +0 -10
  517. package/mail/mail-template.renderer.js +0 -7
  518. package/mail/mail-template.renderer.js.map +0 -1
  519. package/mail/template-providers/file-mail-template.provider.d.ts +0 -24
  520. package/mail/template-providers/file-mail-template.provider.js +0 -51
  521. package/mail/template-providers/file-mail-template.provider.js.map +0 -1
  522. package/mail/template-providers/memory-mail-template.provider.d.ts +0 -6
  523. package/mail/template-providers/memory-mail-template.provider.js.map +0 -1
  524. package/mail/template-renderers/handlebars.mail-template-renderer.d.ts +0 -13
  525. package/mail/template-renderers/handlebars.mail-template-renderer.js +0 -49
  526. package/mail/template-renderers/handlebars.mail-template-renderer.js.map +0 -1
  527. package/mail/template-renderers/mjml.mail-template-renderer.d.ts +0 -14
  528. package/mail/template-renderers/mjml.mail-template-renderer.js +0 -63
  529. package/mail/template-renderers/mjml.mail-template-renderer.js.map +0 -1
  530. package/schema/schemas/exclude.d.ts +0 -4
  531. package/schema/schemas/exclude.js.map +0 -1
  532. package/templates/providers/file-template.provider.base.d.ts +0 -12
  533. package/templates/providers/file-template.provider.base.js +0 -50
  534. package/templates/providers/file-template.provider.base.js.map +0 -1
  535. package/templates/providers/file-template.provider.d.ts +0 -22
  536. package/templates/providers/file-template.provider.js.map +0 -1
  537. package/templates/providers/memory-template.provider.base.d.ts +0 -9
  538. package/templates/providers/memory-template.provider.base.js.map +0 -1
  539. package/templates/providers/memory-template.provider.d.ts +0 -4
  540. package/templates/providers/memory-template.provider.js +0 -18
  541. package/templates/providers/memory-template.provider.js.map +0 -1
  542. package/utils/stream/async-iterable-readable.d.ts +0 -13
  543. package/utils/stream/async-iterable-readable.js +0 -40
  544. package/utils/stream/async-iterable-readable.js.map +0 -1
  545. package/utils/stream/async-writable-stream.d.ts +0 -16
  546. package/utils/stream/async-writable-stream.js +0 -41
  547. package/utils/stream/async-writable-stream.js.map +0 -1
  548. package/utils/stream/typed-readable.d.ts +0 -58
  549. package/utils/stream/typed-readable.js +0 -9
  550. package/utils/stream/typed-readable.js.map +0 -1
@@ -11,9 +11,9 @@ class ArrayMaximumLengthConstraint extends types_1.SchemaArrayConstraint {
11
11
  this.maximumLength = maximumLength;
12
12
  this.expects = `a maximum array length of ${this.maximumLength}`;
13
13
  }
14
- validate(value, path) {
14
+ validate(value, path, context) {
15
15
  if (value.length > this.maximumLength) {
16
- return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `an array length of ${value.length}`, path) };
16
+ return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `an array length of ${value.length}`, path, { fast: context.options.fastErrors }) };
17
17
  }
18
18
  return { valid: true };
19
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"maximum-length.js","sourceRoot":"","sources":["../../../source/schema/array-constraints/maximum-length.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAAiD;AAEjD,MAAa,4BAA6B,SAAQ,6BAAqB;IAKrE,YAAY,aAAqB;QAC/B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,6BAA6B,IAAI,CAAC,aAAa,EAAE,CAAC;IACnE,CAAC;IAED,QAAQ,CAAC,KAAY,EAAE,IAAc;QACnC,IAAI,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE;YACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,sBAAsB,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;SACtH;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAnBD,oEAmBC;AAED,SAAgB,kBAAkB,CAAC,aAAqB;IACtD,OAAO,IAAA,iDAAoC,EAAC,IAAI,4BAA4B,CAAC,aAAa,CAAC,CAAC,CAAC;AAC/F,CAAC;AAFD,gDAEC"}
1
+ {"version":3,"file":"maximum-length.js","sourceRoot":"","sources":["../../../source/schema/array-constraints/maximum-length.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAAiD;AAEjD,MAAa,4BAA6B,SAAQ,6BAAqB;IAKrE,YAAY,aAAqB;QAC/B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,6BAA6B,IAAI,CAAC,aAAa,EAAE,CAAC;IACnE,CAAC;IAED,QAAQ,CAAC,KAAY,EAAE,IAAc,EAAE,OAA0B;QAC/D,IAAI,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE;YACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,sBAAsB,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SAC5J;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAnBD,oEAmBC;AAED,SAAgB,kBAAkB,CAAC,aAAqB;IACtD,OAAO,IAAA,iDAAoC,EAAC,IAAI,4BAA4B,CAAC,aAAa,CAAC,CAAC,CAAC;AAC/F,CAAC;AAFD,gDAEC"}
@@ -1,11 +1,11 @@
1
1
  import type { JsonPath } from "../../json-path/json-path";
2
2
  import type { Decorator } from "../../reflection";
3
- import type { ConstraintResult } from '../types';
3
+ import type { ConstraintContext, ConstraintResult } from '../types';
4
4
  import { SchemaArrayConstraint } from '../types';
5
5
  export declare class MinimumArrayLengthConstraint extends SchemaArrayConstraint {
6
6
  private readonly minimumLength;
7
7
  readonly expects: string;
8
8
  constructor(minimumLength: number);
9
- validate(value: any[], path: JsonPath): ConstraintResult;
9
+ validate(value: any[], path: JsonPath, context: ConstraintContext): ConstraintResult;
10
10
  }
11
11
  export declare function MinimumArrayLength(minimumLength: number): Decorator<'property' | 'accessor'>;
@@ -11,9 +11,9 @@ class MinimumArrayLengthConstraint extends types_1.SchemaArrayConstraint {
11
11
  this.minimumLength = minimumLength;
12
12
  this.expects = `a minimum array length of ${this.minimumLength}`;
13
13
  }
14
- validate(value, path) {
14
+ validate(value, path, context) {
15
15
  if (value.length < this.minimumLength) {
16
- return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `an array length of ${value.length}`, path) };
16
+ return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `an array length of ${value.length}`, path, { fast: context.options.fastErrors }) };
17
17
  }
18
18
  return { valid: true };
19
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"minimum-length.js","sourceRoot":"","sources":["../../../source/schema/array-constraints/minimum-length.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAAiD;AAEjD,MAAa,4BAA6B,SAAQ,6BAAqB;IAKrE,YAAY,aAAqB;QAC/B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,6BAA6B,IAAI,CAAC,aAAa,EAAE,CAAC;IACnE,CAAC;IAED,QAAQ,CAAC,KAAY,EAAE,IAAc;QACnC,IAAI,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE;YACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,sBAAsB,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;SACtH;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAnBD,oEAmBC;AAED,SAAgB,kBAAkB,CAAC,aAAqB;IACtD,OAAO,IAAA,iDAAoC,EAAC,IAAI,4BAA4B,CAAC,aAAa,CAAC,CAAC,CAAC;AAC/F,CAAC;AAFD,gDAEC"}
1
+ {"version":3,"file":"minimum-length.js","sourceRoot":"","sources":["../../../source/schema/array-constraints/minimum-length.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAAiD;AAEjD,MAAa,4BAA6B,SAAQ,6BAAqB;IAKrE,YAAY,aAAqB;QAC/B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,6BAA6B,IAAI,CAAC,aAAa,EAAE,CAAC;IACnE,CAAC;IAED,QAAQ,CAAC,KAAY,EAAE,IAAc,EAAE,OAA0B;QAC/D,IAAI,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE;YACrC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,sBAAsB,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SAC5J;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAnBD,oEAmBC;AAED,SAAgB,kBAAkB,CAAC,aAAqB;IACtD,OAAO,IAAA,iDAAoC,EAAC,IAAI,4BAA4B,CAAC,aAAa,CAAC,CAAC,CAAC;AAC/F,CAAC;AAFD,gDAEC"}
@@ -1,9 +1,9 @@
1
1
  import type { JsonPath } from "../../json-path";
2
- import type { CoerceResult } from '../types';
2
+ import type { CoercerContext, CoerceResult } from '../types';
3
3
  import { SchemaValueCoercer } from '../types';
4
4
  export declare class BooleanCoercer extends SchemaValueCoercer {
5
5
  readonly sourceType: (NumberConstructor | StringConstructor | BigIntConstructor)[];
6
6
  readonly targetType: BooleanConstructor;
7
- coerce(value: number | string | bigint, path: JsonPath): CoerceResult;
7
+ coerce(value: number | string | bigint, path: JsonPath, context: CoercerContext): CoerceResult;
8
8
  }
9
9
  export declare const booleanCoercer: BooleanCoercer;
@@ -10,7 +10,7 @@ class BooleanCoercer extends types_1.SchemaValueCoercer {
10
10
  this.sourceType = [Number, String, BigInt];
11
11
  this.targetType = Boolean;
12
12
  }
13
- coerce(value, path) {
13
+ coerce(value, path, context) {
14
14
  const normalizedValue = (0, type_guards_1.isString)(value) ? value.toLowerCase() : value;
15
15
  switch (normalizedValue) {
16
16
  case 1:
@@ -26,7 +26,7 @@ class BooleanCoercer extends types_1.SchemaValueCoercer {
26
26
  case 'no':
27
27
  return { success: true, value: false };
28
28
  default:
29
- return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(Boolean, value.toString(), path) };
29
+ return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(Boolean, value.toString(), path, undefined, { fast: context.options.fastErrors }) };
30
30
  }
31
31
  }
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"boolean.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/boolean.coercer.ts"],"names":[],"mappings":";;;AACA,yDAA+C;AAC/C,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,cAAe,SAAQ,0BAAkB;IAAtD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,eAAU,GAAG,OAAO,CAAC;IAwBhC,CAAC;IAtBC,MAAM,CAAC,KAA+B,EAAE,IAAc;QACpD,MAAM,eAAe,GAAG,IAAA,sBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAEtE,QAAQ,eAAe,EAAE;YACvB,K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E,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YAExC,KAAK,CAAC,CAAC;YACP,KAAK,EAAE,CAAC;YACR,KAAK,OAAO,CAAC;YACb,KAAK,GAAG,CAAC;YACT,KAAK,IAAI;gBACP,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;YAEzC;gBACE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SAClJ;IACH,CAAC;CACF;AA1BD,wCA0BC;AAEY,QAAA,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import type { JsonPath } from "../../json-path";
2
- import type { CoerceResult } from '../types';
2
+ import type { CoercerContext, CoerceResult } from '../types';
3
3
  import { SchemaValueCoercer } from '../types';
4
4
  export declare class DateCoercer extends SchemaValueCoercer {
5
5
  readonly sourceType: (NumberConstructor | StringConstructor | BigIntConstructor)[];
6
6
  readonly targetType: DateConstructor;
7
- coerce(value: number | string | bigint, path: JsonPath): CoerceResult;
7
+ coerce(value: number | string | bigint, path: JsonPath, context: CoercerContext): CoerceResult;
8
8
  }
9
9
  export declare const dateCoercer: DateCoercer;
@@ -10,11 +10,11 @@ class DateCoercer extends types_1.SchemaValueCoercer {
10
10
  this.sourceType = [Number, String, BigInt];
11
11
  this.targetType = Date;
12
12
  }
13
- coerce(value, path) {
13
+ coerce(value, path, context) {
14
14
  const parseValue = (0, type_guards_1.isBigInt)(value) ? Number(value) : value;
15
15
  const date = new Date(parseValue);
16
16
  if (Number.isNaN(date.getTime())) {
17
- return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, value.toString(), path) };
17
+ return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, value.toString(), path, undefined, { fast: context.options.fastErrors }) };
18
18
  }
19
19
  return { success: true, value: date };
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"date.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/date.coercer.ts"],"names":[],"mappings":";;;AACA,yDAA+C;AAC/C,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,WAAY,SAAQ,0BAAkB;IAAnD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,eAAU,GAAG,IAAI,CAAC;IAY7B,CAAC;IAVC,MAAM,CAAC,KAA+B,EAAE,IAAc;QACpD,MAAM,UAAU,GAAG,IAAA,sBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC3D,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;QAElC,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE;YAChC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;SACvG;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACxC,CAAC;CACF;AAdD,kCAcC;AACY,QAAA,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"date.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/date.coercer.ts"],"names":[],"mappings":";;;AACA,yDAA+C;AAC/C,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,WAAY,SAAQ,0BAAkB;IAAnD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,eAAU,GAAG,IAAI,CAAC;IAY7B,CAAC;IAVC,MAAM,CAAC,KAA+B,EAAE,IAAc,EAAE,OAAuB;QAC7E,MAAM,UAAU,GAAG,IAAA,sBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC3D,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC;QAElC,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE;YAChC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACxJ;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACxC,CAAC;CACF;AAdD,kCAcC;AACY,QAAA,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import type { JsonPath } from "../../json-path";
2
- import type { CoerceResult } from '../types';
2
+ import type { CoercerContext, CoerceResult } from '../types';
3
3
  import { SchemaValueCoercer } from '../types';
4
4
  export declare class NumberCoercer extends SchemaValueCoercer {
5
- readonly sourceType: (StringConstructor | BooleanConstructor | BigIntConstructor)[];
5
+ readonly sourceType: (BooleanConstructor | StringConstructor | BigIntConstructor)[];
6
6
  readonly targetType: NumberConstructor;
7
- coerce(value: string | bigint | boolean, path: JsonPath): CoerceResult;
7
+ coerce(value: string | bigint | boolean, path: JsonPath, context: CoercerContext): CoerceResult;
8
8
  }
9
9
  export declare const numberCoercer: NumberCoercer;
@@ -9,10 +9,10 @@ class NumberCoercer extends types_1.SchemaValueCoercer {
9
9
  this.sourceType = [String, BigInt, Boolean];
10
10
  this.targetType = Number;
11
11
  }
12
- coerce(value, path) {
12
+ coerce(value, path, context) {
13
13
  const result = Number(value);
14
14
  if (Number.isNaN(result)) {
15
- return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, value.toString(), path, 'Value is not a number.') };
15
+ return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, value.toString(), path, 'Value is not a number.', { fast: context.options.fastErrors }) };
16
16
  }
17
17
  return { success: true, value: result };
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"number.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/number.coercer.ts"],"names":[],"mappings":";;;AACA,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,0BAAkB;IAArD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACvC,eAAU,GAAG,MAAM,CAAC;IAW/B,CAAC;IATC,MAAM,CAAC,KAAgC,EAAE,IAAc;QACrD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;YACxB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,wBAAwB,CAAC,EAAE,CAAC;SACjI;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC1C,CAAC;CACF;AAbD,sCAaC;AAEY,QAAA,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"number.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/number.coercer.ts"],"names":[],"mappings":";;;AACA,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,0BAAkB;IAArD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACvC,eAAU,GAAG,MAAM,CAAC;IAW/B,CAAC;IATC,MAAM,CAAC,KAAgC,EAAE,IAAc,EAAE,OAAuB;QAC9E,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;YACxB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACvK;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC1C,CAAC;CACF;AAbD,sCAaC;AAEY,QAAA,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import type { JsonPath } from "../../json-path/json-path";
2
- import type { CoerceResult } from '../types';
2
+ import type { CoercerContext, CoerceResult } from '../types';
3
3
  import { SchemaValueCoercer } from '../types';
4
4
  export declare class RegExpCoercer extends SchemaValueCoercer {
5
5
  readonly sourceType: StringConstructor;
6
6
  readonly targetType: RegExpConstructor;
7
7
  readonly flags: string | undefined;
8
8
  constructor(flags?: string);
9
- coerce(value: string, path: JsonPath): CoerceResult;
9
+ coerce(value: string, path: JsonPath, context: CoercerContext): CoerceResult;
10
10
  }
11
11
  export declare const regExpCoercer: RegExpCoercer;
@@ -10,12 +10,12 @@ class RegExpCoercer extends types_1.SchemaValueCoercer {
10
10
  this.targetType = RegExp;
11
11
  this.flags = flags;
12
12
  }
13
- coerce(value, path) {
13
+ coerce(value, path, context) {
14
14
  try {
15
15
  return { success: true, value: RegExp(value, this.flags) };
16
16
  }
17
17
  catch (error) {
18
- return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, 'invalid regexp pattern', path, error.message) };
18
+ return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, 'invalid regexp pattern', path, error.message, { fast: context.options.fastErrors }) };
19
19
  }
20
20
  }
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"regexp.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/regexp.coercer.ts"],"names":[],"mappings":";;;AACA,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,0BAAkB;IAKnD,YAAY,QAAgB,GAAG;QAC7B,KAAK,EAAE,CAAC;QALD,eAAU,GAAG,MAAM,CAAC;QACpB,eAAU,GAAG,MAAM,CAAC;QAM3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,IAAc;QAClC,IAAI;YACF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;SAC5D;QACD,OAAO,KAAK,EAAE;YACZ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,wBAAwB,EAAE,IAAI,EAAG,KAAe,CAAC,OAAO,CAAC,EAAE,CAAC;SACzI;IACH,CAAC;CACF;AAnBD,sCAmBC;AAEY,QAAA,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"regexp.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/regexp.coercer.ts"],"names":[],"mappings":";;;AACA,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,0BAAkB;IAKnD,YAAY,QAAgB,GAAG;QAC7B,KAAK,EAAE,CAAC;QALD,eAAU,GAAG,MAAM,CAAC;QACpB,eAAU,GAAG,MAAM,CAAC;QAM3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,IAAc,EAAE,OAAuB;QAC3D,IAAI;YACF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;SAC5D;QACD,OAAO,KAAK,EAAE;YACZ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,wBAAwB,EAAE,IAAI,EAAG,KAAe,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SAC/K;IACH,CAAC;CACF;AAnBD,sCAmBC;AAEY,QAAA,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import type { JsonPath } from "../../json-path";
2
- import type { CoerceResult } from '../types';
2
+ import type { CoercerContext, CoerceResult } from '../types';
3
3
  import { SchemaValueCoercer } from '../types';
4
4
  export declare class StringCoercer extends SchemaValueCoercer {
5
- readonly sourceType: (NumberConstructor | DateConstructor | BooleanConstructor | BigIntConstructor)[];
5
+ readonly sourceType: (DateConstructor | NumberConstructor | BooleanConstructor | BigIntConstructor)[];
6
6
  readonly targetType: StringConstructor;
7
- coerce(value: number | boolean | bigint | Date, path: JsonPath): CoerceResult;
7
+ coerce(value: number | boolean | bigint | Date, path: JsonPath, context: CoercerContext): CoerceResult;
8
8
  }
9
9
  export declare const stringCoercer: StringCoercer;
@@ -10,9 +10,9 @@ class StringCoercer extends types_1.SchemaValueCoercer {
10
10
  this.sourceType = [Number, Boolean, BigInt, Date];
11
11
  this.targetType = String;
12
12
  }
13
- coerce(value, path) {
13
+ coerce(value, path, context) {
14
14
  if ((0, type_guards_1.isDate)(value) && !(0, type_guards_1.isValidDate)(value)) {
15
- return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, 'invalid date', path) };
15
+ return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, 'invalid date', path, undefined, { fast: context.options.fastErrors }) };
16
16
  }
17
17
  return { success: true, value: value.toString() };
18
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"string.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/string.coercer.ts"],"names":[],"mappings":";;;AACA,yDAA0D;AAC1D,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,0BAAkB;IAArD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC7C,eAAU,GAAG,MAAM,CAAC;IAS/B,CAAC;IAPC,MAAM,CAAC,KAAuC,EAAE,IAAc;QAC5D,IAAI,IAAA,oBAAM,EAAC,KAAK,CAAC,IAAI,CAAC,IAAA,yBAAW,EAAC,KAAK,CAAC,EAAE;YACxC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC;SACrG;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACpD,CAAC;CACF;AAXD,sCAWC;AAEY,QAAA,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"string.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/string.coercer.ts"],"names":[],"mappings":";;;AACA,yDAA0D;AAC1D,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,0BAAkB;IAArD;;QACW,eAAU,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC7C,eAAU,GAAG,MAAM,CAAC;IAS/B,CAAC;IAPC,MAAM,CAAC,KAAuC,EAAE,IAAc,EAAE,OAAuB;QACrF,IAAI,IAAA,oBAAM,EAAC,KAAK,CAAC,IAAI,CAAC,IAAA,yBAAW,EAAC,KAAK,CAAC,EAAE;YACxC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACtJ;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;IACpD,CAAC;CACF;AAXD,sCAWC;AAEY,QAAA,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
@@ -14,9 +14,9 @@ class Uint8ArrayCoercer extends types_1.SchemaValueCoercer {
14
14
  this.targetType = Uint8Array;
15
15
  }
16
16
  coerce(value, path, { options }) {
17
- const testResult = schema_1.Schema.testWithFastError(byteNumberArraySchema, value, options, path);
17
+ const testResult = (0, schema_1.testWithFastError)(byteNumberArraySchema, value, options, path);
18
18
  if (!testResult.valid) {
19
- return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(Uint8Array, Array, path, undefined, { inner: testResult.error }) };
19
+ return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(Uint8Array, Array, path, undefined, { inner: testResult.error, fast: options.fastErrors }) };
20
20
  }
21
21
  return { success: true, value: Uint8Array.from(testResult.value) };
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"uint8-array.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/uint8-array.coercer.ts"],"names":[],"mappings":";;;AACA,sCAAmC;AACnC,kDAA8C;AAC9C,4CAAyC;AACzC,8CAA2C;AAE3C,oCAA8C;AAE9C,MAAM,qBAAqB,GAAG,IAAA,aAAK,EAAC,IAAA,eAAM,EAAC,EA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GAAG,UAAU,CAAC;IAWnC,CAAC;IATC,MAAM,CAAC,KAAY,EAAE,IAAc,EAAE,EAAE,OAAO,EAAkB;QAC9D,MAAM,UAAU,GAAG,IAAA,0BAAiB,EAAC,qBAAqB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAElF,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;YACrB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACzJ;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;IACrE,CAAC;CACF;AAbD,8CAaC;AAEY,QAAA,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
@@ -1,13 +1,13 @@
1
1
  import type { JsonPath } from "../../json-path/json-path";
2
- import type { Enumeration as EnumerationType, OneOrMany } from "../../types";
3
- import type { ConstraintResult } from '../types';
2
+ import type { Enumeration, OneOrMany } from "../../types";
3
+ import type { ConstraintContext, ConstraintResult } from '../types';
4
4
  import { SchemaValueConstraint } from '../types';
5
5
  export declare class EnumerationConstraint extends SchemaValueConstraint {
6
6
  private readonly allowedValuesSet;
7
7
  private readonly allowedValuesString;
8
- readonly enumeration: EnumerationType;
8
+ readonly enumeration: Enumeration;
9
9
  readonly suitableTypes: SchemaValueConstraint['suitableTypes'];
10
10
  readonly expects: OneOrMany<string>;
11
- constructor(enumeration: EnumerationType);
12
- validate(value: number, path: JsonPath): ConstraintResult;
11
+ constructor(enumeration: Enumeration);
12
+ validate(value: number, path: JsonPath, context: ConstraintContext): ConstraintResult;
13
13
  }
@@ -2,25 +2,25 @@
2
2
  /* eslint-disable @typescript-eslint/naming-convention */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.EnumerationConstraint = void 0;
5
- const utils_1 = require("../../utils");
5
+ const enum_1 = require("../../utils/enum");
6
6
  const iterable_helpers_1 = require("../../utils/iterable-helpers");
7
7
  const type_guards_1 = require("../../utils/type-guards");
8
8
  const schema_error_1 = require("../schema.error");
9
9
  const types_1 = require("../types");
10
- const utils_2 = require("../utils");
10
+ const utils_1 = require("../utils");
11
11
  class EnumerationConstraint extends types_1.SchemaValueConstraint {
12
12
  constructor(enumeration) {
13
13
  super();
14
14
  this.enumeration = enumeration;
15
- const allowedValues = (0, type_guards_1.isArray)(enumeration) ? enumeration : (0, utils_1.enumValues)(enumeration);
15
+ const allowedValues = (0, type_guards_1.isArray)(enumeration) ? enumeration : (0, enum_1.enumValues)(enumeration);
16
16
  this.allowedValuesSet = new Set(allowedValues);
17
17
  this.allowedValuesString = allowedValues.map((value) => ((0, type_guards_1.isString)(value) ? `"${value}"` : value)).join(', ');
18
- this.suitableTypes = [...(0, iterable_helpers_1.distinct)(allowedValues.map((value) => (0, utils_2.getValueType)(value)))];
18
+ this.suitableTypes = [...(0, iterable_helpers_1.distinct)(allowedValues.map((value) => (0, utils_1.getValueType)(value)))];
19
19
  this.expects = `one of [${this.allowedValuesString}]`;
20
20
  }
21
- validate(value, path) {
21
+ validate(value, path, context) {
22
22
  if (!this.allowedValuesSet.has(value)) {
23
- return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path) };
23
+ return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path, { fast: context.options.fastErrors }) };
24
24
  }
25
25
  return { valid: true };
26
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"enumeration.js","sourceRoot":"","sources":["../../../source/schema/constraints/enumeration.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,uCAAqC;AACrC,mEAAoD;AACpD,yDAAwD;AACxD,kDAA8C;A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AAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACxI;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AA5BD,sDA4BC"}
@@ -2,7 +2,7 @@ import type { JsonPath } from "../../json-path/json-path";
2
2
  import type { Decorator } from "../../reflection";
3
3
  import type { OneOrMany } from "../../types";
4
4
  import { SchemaError } from '../schema.error';
5
- import type { ConstraintResult } from '../types';
5
+ import type { ConstraintContext, ConstraintResult } from '../types';
6
6
  import { SchemaValueConstraint } from '../types';
7
7
  export declare type GenericConstraintResult = {
8
8
  success: true;
@@ -17,6 +17,6 @@ export declare class GenericConstraint<T> extends SchemaValueConstraint {
17
17
  readonly expects: OneOrMany<string>;
18
18
  readonly constraintFunction: GenericConstraintFunction<T>;
19
19
  constructor(constraintFunction: GenericConstraintFunction<T>, expects?: OneOrMany<string>);
20
- validate(value: T, path: JsonPath): ConstraintResult;
20
+ validate(value: T, path: JsonPath, context: ConstraintContext): ConstraintResult;
21
21
  }
22
22
  export declare function Constraint<T>(constraintFunction: GenericConstraintFunction<T>, expects?: OneOrMany<string>): Decorator<'property' | 'accessor'>;
@@ -13,12 +13,12 @@ class GenericConstraint extends types_1.SchemaValueConstraint {
13
13
  this.constraintFunction = constraintFunction;
14
14
  this.expects = expects;
15
15
  }
16
- validate(value, path) {
16
+ validate(value, path, context) {
17
17
  const result = this.constraintFunction(value, path);
18
18
  if ((0, type_guards_1.isBoolean)(result)) {
19
19
  return result
20
20
  ? { valid: true }
21
- : { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, 'invalid value', path) };
21
+ : { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, 'invalid value', path, { fast: context.options.fastErrors }) };
22
22
  }
23
23
  return result;
24
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generic.js","sourceRoot":"","sources":["../../../source/schema/constraints/generic.ts"],"names":[],"mappings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G,MAAM,CAAC;QAO9B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,QAAQ,CAAC,KAAQ,EAAE,IAAc,EAAE,OAA0B;QAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAEpD,IAAI,IAAA,uBAAS,EAAC,MAAM,CAAC,EAAE;YACrB,OAAO,MAAM;gBACX,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;gBACjB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACpI;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAvBD,8CAuBC;AAED,SAAgB,UAAU,CAAI,kBAAgD,EAAE,OAA2B;IACzG,MAAM,UAAU,GAAG,IAAI,iBAAiB,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACtE,OAAO,IAAA,iDAAoC,EAAC,UAAU,CAAC,CAAC;AAC1D,CAAC;AAHD,gCAGC"}
@@ -1,12 +1,12 @@
1
1
  import type { JsonPath } from "../../json-path/json-path";
2
2
  import type { Decorator } from "../../reflection";
3
- import type { ConstraintResult } from '../types';
3
+ import type { ConstraintContext, ConstraintResult } from '../types';
4
4
  import { SchemaValueConstraint } from '../types';
5
5
  export declare class IntegerConstraint extends SchemaValueConstraint {
6
6
  readonly suitableTypes: NumberConstructor;
7
7
  readonly expects: string;
8
8
  constructor();
9
- validate(value: number, path: JsonPath): ConstraintResult;
9
+ validate(value: number, path: JsonPath, context: ConstraintContext): ConstraintResult;
10
10
  }
11
11
  export declare const integerConstraint: IntegerConstraint;
12
12
  export declare function Integer(): Decorator<'property' | 'accessor'>;
@@ -11,9 +11,9 @@ class IntegerConstraint extends types_1.SchemaValueConstraint {
11
11
  this.suitableTypes = Number;
12
12
  this.expects = 'an integer';
13
13
  }
14
- validate(value, path) {
14
+ validate(value, path, context) {
15
15
  if (!Number.isInteger(value)) {
16
- return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path) };
16
+ return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path, { fast: context.options.fastErrors }) };
17
17
  }
18
18
  return { valid: true };
19
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"integer.js","sourceRoot":"","sources":["../../../source/schema/constraints/integer.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,+CAA2E;AAC3E,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,iBAAkB,SAAQ,6BAAqB;IAI1D;QACE,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC;IAC9B,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc;QACpC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;YAC5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;SAClG;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAjBD,8CAiBC;AAEY,QAAA,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAEzD,SAAgB,OAAO;IACrB,OAAO,IAAA,4CAAoC,EAAC,yBAAiB,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACjG,CAAC;AAFD,0BAEC"}
1
+ {"version":3,"file":"integer.js","sourceRoot":"","sources":["../../../source/schema/constraints/integer.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,+CAA2E;AAC3E,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,iBAAkB,SAAQ,6BAAqB;IAI1D;QACE,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC;IAC9B,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc,EAAE,OAA0B;QAChE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE;YAC5B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACxI;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAjBD,8CAiBC;AAEY,QAAA,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAEzD,SAAgB,OAAO;IACrB,OAAO,IAAA,4CAAoC,EAAC,yBAAiB,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACjG,CAAC;AAFD,0BAEC"}
@@ -1,10 +1,10 @@
1
1
  import type { JsonPath } from "../../json-path/json-path";
2
- import type { ConstraintResult } from '../types';
2
+ import type { ConstraintContext, ConstraintResult } from '../types';
3
3
  import { SchemaValueConstraint } from '../types';
4
4
  export declare class LiteralConstraint extends SchemaValueConstraint {
5
5
  readonly literal: any;
6
6
  readonly suitableTypes: SchemaValueConstraint['suitableTypes'];
7
7
  readonly expects: string;
8
8
  constructor(literal: any);
9
- validate(value: any, path: JsonPath): ConstraintResult;
9
+ validate(value: any, path: JsonPath, context: ConstraintContext): ConstraintResult;
10
10
  }
@@ -14,10 +14,10 @@ class LiteralConstraint extends types_1.SchemaValueConstraint {
14
14
  const literalName = (0, type_guards_1.isPrimitive)(literal) ? String(literal) : (0, utils_1.getValueTypeName)(this.suitableTypes);
15
15
  this.expects = `literal ${literalName}`;
16
16
  }
17
- validate(value, path) {
17
+ validate(value, path, context) {
18
18
  if (value !== this.literal) {
19
19
  const valueType = (0, utils_1.getValueType)(value);
20
- return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, (0, utils_1.getValueTypeName)(valueType), path) };
20
+ return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, (0, utils_1.getValueTypeName)(valueType), path, { fast: context.options.fastErrors }) };
21
21
  }
22
22
  return { valid: true };
23
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"literal.js","sourceRoot":"","sources":["../../../source/schema/constraints/literal.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAGzD,yDAAkD;AAClD,kDAA8C;AAE9C,oCAAiD;AACjD,oCAA0D;AAE1D,MAAa,iBAAkB,SAAQ,6BAAqB;IAK1D,YAAY,OAAY;QACtB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,aAAa,GAAG,IAAA,oBAAY,EAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,WAAW,GAAG,IAAA,yBAAW,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAA,wBAAgB,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAClG,IAAI,CAAC,OAAO,GAAG,WAAW,WAAW,EAAE,CAAC;IAC1C,CAAC;IAED,QAAQ,CAAC,KAAU,EAAE,IAAc;QACjC,IAAI,KAAK,KAAK,IAAI,CAAC,OAAO,EAAE;YAC1B,MAAM,SAAS,GAAG,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC;YACtC,OAAO,EA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K,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAvBD,8CAuBC"}
@@ -1,12 +1,12 @@
1
1
  import type { JsonPath } from "../../json-path/json-path";
2
2
  import type { Decorator } from "../../reflection";
3
- import type { ConstraintResult } from '../types';
3
+ import type { ConstraintContext, ConstraintResult } from '../types';
4
4
  import { SchemaValueConstraint } from '../types';
5
5
  export declare class MaximumDateConstraint extends SchemaValueConstraint {
6
6
  private readonly maximum;
7
7
  readonly suitableTypes: NumberConstructor;
8
8
  readonly expects: string;
9
9
  constructor(maximum: Date | number);
10
- validate(value: Date, path: JsonPath): ConstraintResult;
10
+ validate(value: Date, path: JsonPath, context: ConstraintContext): ConstraintResult;
11
11
  }
12
12
  export declare function MaximumDate(maximum: number): Decorator<'property' | 'accessor'>;
@@ -14,9 +14,9 @@ class MaximumDateConstraint extends types_1.SchemaValueConstraint {
14
14
  this.expects = `<= ${this.maximum.toISOString()}`;
15
15
  (0, type_guards_1.assertValidDate)(this.maximum);
16
16
  }
17
- validate(value, path) {
17
+ validate(value, path, context) {
18
18
  if (value > this.maximum) {
19
- return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toISOString(), path) };
19
+ return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toISOString(), path, { fast: context.options.fastErrors }) };
20
20
  }
21
21
  return { valid: true };
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"maximum-date.js","sourceRoot":"","sources":["../../../source/schema/constraints/maximum-date.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,yDAAgE;AAChE,8CAAqE;AACrE,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,qBAAsB,SAAQ,6BAAqB;IAM9D,YAAY,OAAsB;QAChC,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,IAAA,sBAAQ,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,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AAe,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,QAAQ,CAAC,KAAW,EAAE,IAAc,EAAE,OAA0B;QAC9D,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE;YACxB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SAC3I;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAtBD,sDAsBC;AAED,SAAgB,WAAW,CAAC,OAAe;IACzC,OAAO,IAAA,iDAAoC,EAAC,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAClH,CAAC;AAFD,kCAEC"}
@@ -1,12 +1,12 @@
1
1
  import type { JsonPath } from "../../json-path/json-path";
2
2
  import type { Decorator } from "../../reflection";
3
- import type { ConstraintResult } from '../types';
3
+ import type { ConstraintContext, ConstraintResult } from '../types';
4
4
  import { SchemaValueConstraint } from '../types';
5
5
  export declare class MaximumLengthConstraint extends SchemaValueConstraint {
6
6
  private readonly maximumLength;
7
- readonly suitableTypes: (ArrayConstructor | StringConstructor | Uint8ArrayConstructor | Int8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor | BigInt64ArrayConstructor | BigUint64ArrayConstructor | ArrayBufferConstructor)[];
7
+ readonly suitableTypes: (ArrayConstructor | Uint8ArrayConstructor | StringConstructor | Int8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor | BigInt64ArrayConstructor | BigUint64ArrayConstructor | ArrayBufferConstructor)[];
8
8
  readonly expects: string;
9
9
  constructor(maximumLength: number);
10
- validate(value: string, path: JsonPath): ConstraintResult;
10
+ validate(value: string, path: JsonPath, context: ConstraintContext): ConstraintResult;
11
11
  }
12
12
  export declare function MaximumLength(maximumLength: number): Decorator<'property' | 'accessor'>;
@@ -13,10 +13,10 @@ class MaximumLengthConstraint extends types_1.SchemaValueConstraint {
13
13
  this.maximumLength = maximumLength;
14
14
  this.expects = `a maximum length of ${this.maximumLength}`;
15
15
  }
16
- validate(value, path) {
16
+ validate(value, path, context) {
17
17
  const length = (0, type_guards_1.isArrayBuffer)(value) ? value.byteLength : value.length;
18
18
  if (length > this.maximumLength) {
19
- return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `a length of ${length}`, path) };
19
+ return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `a length of ${length}`, path, { fast: context.options.fastErrors }) };
20
20
  }
21
21
  return { valid: true };
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"maximum-length.js","sourceRoot":"","sources":["../../../source/schema/constraints/maximum-length.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,yDAAoD;AACpD,+CAA2E;AAC3E,kDAA8C;AAE9C,oCAAiD;AAEjD,MAAa,uBAAwB,SAAQ,6BAAqB;IAMhE,YAAY,aAAqB;QAC/B,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;QAM3M,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,uBAAuB,IAAI,CAA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c,EAAE,OAA0B;QAChE,MAAM,MAAM,GAAG,IAAA,2BAAa,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;QAEtE,IAAI,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE;YAC/B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SAC/I;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AAtBD,0DAsBC;AAED,SAAgB,aAAa,CAAC,aAAqB;IACjD,OAAO,IAAA,4CAAoC,EAAC,IAAI,uBAAuB,CAAC,aAAa,CAAC,CAAC,CAAC;AAC1F,CAAC;AAFD,sCAEC"}
@@ -1,12 +1,12 @@
1
1
  import type { JsonPath } from "../../json-path/json-path";
2
2
  import type { Decorator } from "../../reflection";
3
- import type { ConstraintResult } from '../types';
3
+ import type { ConstraintContext, ConstraintResult } from '../types';
4
4
  import { SchemaValueConstraint } from '../types';
5
5
  export declare class MaximumConstraint extends SchemaValueConstraint {
6
6
  private readonly maximum;
7
7
  readonly suitableTypes: NumberConstructor;
8
8
  readonly expects: string;
9
9
  constructor(maximum: number);
10
- validate(value: number, path: JsonPath): ConstraintResult;
10
+ validate(value: number, path: JsonPath, context: ConstraintContext): ConstraintResult;
11
11
  }
12
12
  export declare function Maximum(maximum: number): Decorator<'property' | 'accessor'>;
@@ -12,9 +12,9 @@ class MaximumConstraint extends types_1.SchemaValueConstraint {
12
12
  this.maximum = maximum;
13
13
  this.expects = `<= ${this.maximum}`;
14
14
  }
15
- validate(value, path) {
15
+ validate(value, path, context) {
16
16
  if (value > this.maximum) {
17
- return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path) };
17
+ return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path, { fast: context.options.fastErrors }) };
18
18
  }
19
19
  return { valid: true };
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"maximum.js","sourceRoot":"","sources":["../../../source/schema/constraints/maximum.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,iBAAkB,SAAQ,6BAAqB;IAM1D,YAAY,OAAe;QACzB,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc;QACpC,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE;YACxB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;SAClG;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AApBD,8CAoBC;AAED,SAAgB,OAAO,CAAC,OAAe;IACrC,OAAO,IAAA,iDAAoC,EAAC,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC9G,CAAC;AAFD,0BAEC"}
1
+ {"version":3,"file":"maximum.js","sourceRoot":"","sources":["../../../source/schema/constraints/maximum.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;AAIzD,8CAAqE;AACrE,kDAA8C;AAE9C,oCAA6D;AAE7D,MAAa,iBAAkB,SAAQ,6BAAqB;IAM1D,YAAY,OAAe;QACzB,KAAK,EAAE,CAAC;QAJD,kBAAa,GAAG,MAAM,CAAC;QAM9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc,EAAE,OAA0B;QAChE,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,EAAE;YACxB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;SACxI;QAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF;AApBD,8CAoBC;AAED,SAAgB,OAAO,CAAC,OAAe;IACrC,OAAO,IAAA,iDAAoC,EAAC,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC9G,CAAC;AAFD,0BAEC"}
@@ -1,12 +1,12 @@
1
1
  import type { JsonPath } from "../../json-path/json-path";
2
2
  import type { Decorator } from "../../reflection";
3
- import type { ConstraintResult } from '../types';
3
+ import type { ConstraintContext, ConstraintResult } from '../types';
4
4
  import { SchemaValueConstraint } from '../types';
5
5
  export declare class MinimumDateConstraint extends SchemaValueConstraint {
6
6
  private readonly minimum;
7
7
  readonly suitableTypes: NumberConstructor;
8
8
  readonly expects: string;
9
9
  constructor(minimum: Date | number);
10
- validate(value: Date, path: JsonPath): ConstraintResult;
10
+ validate(value: Date, path: JsonPath, context: ConstraintContext): ConstraintResult;
11
11
  }
12
12
  export declare function MinimumDate(minimum: number): Decorator<'property' | 'accessor'>;
@@ -14,9 +14,9 @@ class MinimumDateConstraint extends types_1.SchemaValueConstraint {
14
14
  this.expects = `>= ${this.minimum.toISOString()}`;
15
15
  (0, type_guards_1.assertValidDate)(this.minimum);
16
16
  }
17
- validate(value, path) {
17
+ validate(value, path, context) {
18
18
  if (value > this.minimum) {
19
- return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toISOString(), path) };
19
+ return { valid: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toISOString(), path, { fast: context.options.fastErrors }) };
20
20
  }
21
21
  return { valid: true };
22
22
  }