@tstdl/base 0.71.87 → 0.78.0-beta1

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 (373) hide show
  1. package/.eslintrc.js +2 -4
  2. package/api/client/client.js +2 -12
  3. package/api/client/client.js.map +1 -1
  4. package/api/default-error-handlers.d.ts +0 -4
  5. package/api/default-error-handlers.js +1 -6
  6. package/api/default-error-handlers.js.map +1 -1
  7. package/api/server/error-handler.js +2 -2
  8. package/api/server/error-handler.js.map +1 -1
  9. package/api/server/gateway.js +12 -18
  10. package/api/server/gateway.js.map +1 -1
  11. package/api/server/module.d.ts +0 -4
  12. package/api/server/module.js +1 -12
  13. package/api/server/module.js.map +1 -1
  14. package/api/types.d.ts +8 -32
  15. package/api/types.js.map +1 -1
  16. package/container/container.js +2 -2
  17. package/container/container.js.map +1 -1
  18. package/data-structures/index.d.ts +1 -0
  19. package/data-structures/index.js +1 -0
  20. package/data-structures/index.js.map +1 -1
  21. package/data-structures/iterable-weak-map.d.ts +29 -0
  22. package/data-structures/iterable-weak-map.js +128 -0
  23. package/data-structures/iterable-weak-map.js.map +1 -0
  24. package/data-structures/multi-key-map.d.ts +12 -1
  25. package/data-structures/multi-key-map.js +22 -11
  26. package/data-structures/multi-key-map.js.map +1 -1
  27. package/error/custom.error.d.ts +3 -1
  28. package/error/custom.error.js +16 -7
  29. package/error/custom.error.js.map +1 -1
  30. package/examples/api/basic-overview.js +16 -8
  31. package/examples/api/basic-overview.js.map +1 -1
  32. package/http/http.error.d.ts +4 -2
  33. package/http/http.error.js +6 -0
  34. package/http/http.error.js.map +1 -1
  35. package/image-service/image-service.d.ts +32 -65
  36. package/image-service/image-service.js +73 -15
  37. package/image-service/image-service.js.map +1 -1
  38. package/json-path/json-path.d.ts +8 -3
  39. package/json-path/json-path.js +24 -7
  40. package/json-path/json-path.js.map +1 -1
  41. package/logger/console/logger.js +2 -2
  42. package/logger/console/logger.js.map +1 -1
  43. package/mail/mail.service.js +2 -2
  44. package/mail/mail.service.js.map +1 -1
  45. package/module/modules/index.d.ts +0 -1
  46. package/module/modules/index.js +0 -1
  47. package/module/modules/index.js.map +1 -1
  48. package/openid-connect/oidc-configuration.service.js +7 -7
  49. package/openid-connect/oidc-configuration.service.js.map +1 -1
  50. package/openid-connect/oidc.service.js +7 -7
  51. package/openid-connect/oidc.service.js.map +1 -1
  52. package/package.json +3 -4
  53. package/process-shutdown.js +3 -2
  54. package/process-shutdown.js.map +1 -1
  55. package/reflection/decorators.js +1 -0
  56. package/reflection/decorators.js.map +1 -1
  57. package/reflection/reflection-data-map.d.ts +10 -0
  58. package/reflection/reflection-data-map.js +40 -0
  59. package/reflection/reflection-data-map.js.map +1 -0
  60. package/reflection/registry.d.ts +7 -7
  61. package/reflection/registry.js +7 -6
  62. package/reflection/registry.js.map +1 -1
  63. package/reflection/types.d.ts +1 -0
  64. package/reflection/utils.d.ts +6 -3
  65. package/reflection/utils.js +9 -35
  66. package/reflection/utils.js.map +1 -1
  67. package/schema/array-constraints/index.d.ts +2 -0
  68. package/{old-api/validation/validators → schema/array-constraints}/index.js +2 -1
  69. package/schema/array-constraints/index.js.map +1 -0
  70. package/schema/array-constraints/maximum-length.d.ts +11 -0
  71. package/schema/array-constraints/maximum-length.js +26 -0
  72. package/schema/array-constraints/maximum-length.js.map +1 -0
  73. package/schema/array-constraints/minimum-length.d.ts +11 -0
  74. package/schema/array-constraints/minimum-length.js +26 -0
  75. package/schema/array-constraints/minimum-length.js.map +1 -0
  76. package/schema/coercers/boolean.coercer.d.ts +9 -0
  77. package/schema/coercers/boolean.coercer.js +35 -0
  78. package/schema/coercers/boolean.coercer.js.map +1 -0
  79. package/schema/coercers/date.coercer.d.ts +9 -0
  80. package/schema/coercers/date.coercer.js +24 -0
  81. package/schema/coercers/date.coercer.js.map +1 -0
  82. package/schema/coercers/default-value.coercer.d.ts +9 -0
  83. package/schema/coercers/default-value.coercer.js +16 -0
  84. package/schema/coercers/default-value.coercer.js.map +1 -0
  85. package/schema/coercers/index.d.ts +7 -0
  86. package/schema/coercers/index.js +24 -0
  87. package/schema/coercers/index.js.map +1 -0
  88. package/schema/coercers/number.coercer.d.ts +9 -0
  89. package/schema/coercers/number.coercer.js +22 -0
  90. package/schema/coercers/number.coercer.js.map +1 -0
  91. package/schema/coercers/regexp.coercer.d.ts +11 -0
  92. package/schema/coercers/regexp.coercer.js +24 -0
  93. package/schema/coercers/regexp.coercer.js.map +1 -0
  94. package/schema/coercers/string.coercer.d.ts +9 -0
  95. package/schema/coercers/string.coercer.js +22 -0
  96. package/schema/coercers/string.coercer.js.map +1 -0
  97. package/schema/coercers/uint8-array.coercer.d.ts +9 -0
  98. package/schema/coercers/uint8-array.coercer.js +31 -0
  99. package/schema/coercers/uint8-array.coercer.js.map +1 -0
  100. package/schema/constraints/enumeration.d.ts +13 -0
  101. package/schema/constraints/enumeration.js +29 -0
  102. package/schema/constraints/enumeration.js.map +1 -0
  103. package/schema/constraints/generic.d.ts +22 -0
  104. package/schema/constraints/generic.js +32 -0
  105. package/schema/constraints/generic.js.map +1 -0
  106. package/schema/constraints/index.d.ts +12 -0
  107. package/schema/constraints/index.js +29 -0
  108. package/schema/constraints/index.js.map +1 -0
  109. package/schema/constraints/integer.d.ts +12 -0
  110. package/schema/constraints/integer.js +27 -0
  111. package/schema/constraints/integer.js.map +1 -0
  112. package/schema/constraints/length.d.ts +6 -0
  113. package/schema/constraints/length.js +20 -0
  114. package/schema/constraints/length.js.map +1 -0
  115. package/schema/constraints/literal.d.ts +10 -0
  116. package/schema/constraints/literal.js +26 -0
  117. package/schema/constraints/literal.js.map +1 -0
  118. package/schema/constraints/maximum-date.d.ts +12 -0
  119. package/schema/constraints/maximum-date.js +29 -0
  120. package/schema/constraints/maximum-date.js.map +1 -0
  121. package/schema/constraints/maximum-length.d.ts +12 -0
  122. package/schema/constraints/maximum-length.js +29 -0
  123. package/schema/constraints/maximum-length.js.map +1 -0
  124. package/schema/constraints/maximum.d.ts +12 -0
  125. package/schema/constraints/maximum.js +27 -0
  126. package/schema/constraints/maximum.js.map +1 -0
  127. package/schema/constraints/minimum-date.d.ts +12 -0
  128. package/schema/constraints/minimum-date.js +29 -0
  129. package/schema/constraints/minimum-date.js.map +1 -0
  130. package/schema/constraints/minimum-length.d.ts +12 -0
  131. package/schema/constraints/minimum-length.js +29 -0
  132. package/schema/constraints/minimum-length.js.map +1 -0
  133. package/schema/constraints/minimum.d.ts +12 -0
  134. package/schema/constraints/minimum.js +27 -0
  135. package/schema/constraints/minimum.js.map +1 -0
  136. package/schema/constraints/pattern.d.ts +13 -0
  137. package/schema/constraints/pattern.js +28 -0
  138. package/schema/constraints/pattern.js.map +1 -0
  139. package/schema/decorators/array.d.ts +4 -0
  140. package/schema/decorators/array.js +11 -0
  141. package/schema/decorators/array.js.map +1 -0
  142. package/schema/decorators/coerce.d.ts +2 -0
  143. package/schema/decorators/coerce.js +10 -0
  144. package/schema/decorators/coerce.js.map +1 -0
  145. package/schema/decorators/defaulted.d.ts +3 -0
  146. package/schema/decorators/defaulted.js +11 -0
  147. package/schema/decorators/defaulted.js.map +1 -0
  148. package/schema/decorators/index.d.ts +8 -0
  149. package/{old-api → schema/decorators}/index.js +8 -3
  150. package/schema/decorators/index.js.map +1 -0
  151. package/schema/decorators/nullable.d.ts +2 -0
  152. package/schema/decorators/nullable.js +10 -0
  153. package/schema/decorators/nullable.js.map +1 -0
  154. package/schema/decorators/optional.d.ts +2 -0
  155. package/schema/decorators/optional.js +10 -0
  156. package/schema/decorators/optional.js.map +1 -0
  157. package/schema/decorators/property.d.ts +6 -0
  158. package/schema/decorators/property.js +19 -0
  159. package/schema/decorators/property.js.map +1 -0
  160. package/schema/decorators/type.d.ts +3 -0
  161. package/schema/decorators/type.js +10 -0
  162. package/schema/decorators/type.js.map +1 -0
  163. package/schema/decorators/types.d.ts +18 -0
  164. package/schema/decorators/types.js +3 -0
  165. package/schema/decorators/types.js.map +1 -0
  166. package/schema/decorators/utils.d.ts +10 -0
  167. package/schema/decorators/utils.js +59 -0
  168. package/schema/decorators/utils.js.map +1 -0
  169. package/schema/index.d.ts +7 -1
  170. package/schema/index.js +7 -1
  171. package/schema/index.js.map +1 -1
  172. package/schema/schema.d.ts +19 -0
  173. package/schema/schema.error.d.ts +13 -7
  174. package/schema/schema.error.js +45 -13
  175. package/schema/schema.error.js.map +1 -1
  176. package/schema/schema.js +286 -0
  177. package/schema/schema.js.map +1 -0
  178. package/schema/schemas/any.d.ts +4 -8
  179. package/schema/schemas/any.js +9 -14
  180. package/schema/schemas/any.js.map +1 -1
  181. package/schema/schemas/array.d.ts +7 -13
  182. package/schema/schemas/array.js +14 -43
  183. package/schema/schemas/array.js.map +1 -1
  184. package/schema/schemas/assign.d.ts +8 -0
  185. package/schema/schemas/assign.js +28 -0
  186. package/schema/schemas/assign.js.map +1 -0
  187. package/schema/schemas/boolean.d.ts +5 -9
  188. package/schema/schemas/boolean.js +11 -38
  189. package/schema/schemas/boolean.js.map +1 -1
  190. package/schema/schemas/constraint.d.ts +4 -0
  191. package/schema/schemas/constraint.js +14 -0
  192. package/schema/schemas/constraint.js.map +1 -0
  193. package/schema/schemas/date.d.ts +7 -11
  194. package/schema/schemas/date.js +18 -53
  195. package/schema/schemas/date.js.map +1 -1
  196. package/schema/schemas/defaulted.d.ts +2 -15
  197. package/schema/schemas/defaulted.js +7 -23
  198. package/schema/schemas/defaulted.js.map +1 -1
  199. package/schema/schemas/enumeration.d.ts +6 -18
  200. package/schema/schemas/enumeration.js +13 -50
  201. package/schema/schemas/enumeration.js.map +1 -1
  202. package/schema/schemas/exclude.d.ts +4 -0
  203. package/schema/schemas/exclude.js +17 -0
  204. package/schema/schemas/exclude.js.map +1 -0
  205. package/schema/schemas/index.d.ts +5 -6
  206. package/schema/schemas/index.js +5 -6
  207. package/schema/schemas/index.js.map +1 -1
  208. package/schema/schemas/instance.d.ts +2 -12
  209. package/schema/schemas/instance.js +4 -20
  210. package/schema/schemas/instance.js.map +1 -1
  211. package/schema/schemas/literal.d.ts +4 -11
  212. package/schema/schemas/literal.js +13 -18
  213. package/schema/schemas/literal.js.map +1 -1
  214. package/schema/schemas/nullable.d.ts +3 -13
  215. package/schema/schemas/nullable.js +3 -26
  216. package/schema/schemas/nullable.js.map +1 -1
  217. package/schema/schemas/number.d.ts +7 -14
  218. package/schema/schemas/number.js +23 -44
  219. package/schema/schemas/number.js.map +1 -1
  220. package/schema/schemas/object.d.ts +6 -34
  221. package/schema/schemas/object.js +8 -112
  222. package/schema/schemas/object.js.map +1 -1
  223. package/schema/schemas/optional.d.ts +3 -13
  224. package/schema/schemas/optional.js +3 -26
  225. package/schema/schemas/optional.js.map +1 -1
  226. package/schema/schemas/pick.d.ts +4 -0
  227. package/schema/schemas/pick.js +17 -0
  228. package/schema/schemas/pick.js.map +1 -0
  229. package/schema/schemas/readable-stream.d.ts +4 -9
  230. package/schema/schemas/readable-stream.js +9 -15
  231. package/schema/schemas/readable-stream.js.map +1 -1
  232. package/schema/schemas/record.d.ts +4 -0
  233. package/schema/schemas/record.js +14 -0
  234. package/schema/schemas/record.js.map +1 -0
  235. package/schema/schemas/regexp.d.ts +6 -9
  236. package/schema/schemas/regexp.js +10 -27
  237. package/schema/schemas/regexp.js.map +1 -1
  238. package/schema/schemas/string.d.ts +9 -13
  239. package/schema/schemas/string.js +34 -46
  240. package/schema/schemas/string.js.map +1 -1
  241. package/schema/schemas/transform.d.ts +4 -16
  242. package/schema/schemas/transform.js +7 -36
  243. package/schema/schemas/transform.js.map +1 -1
  244. package/schema/schemas/uint8-array.d.ts +8 -11
  245. package/schema/schemas/uint8-array.js +20 -32
  246. package/schema/schemas/uint8-array.js.map +1 -1
  247. package/schema/schemas/union.d.ts +5 -17
  248. package/schema/schemas/union.js +9 -35
  249. package/schema/schemas/union.js.map +1 -1
  250. package/schema/schemas/unknown.d.ts +4 -8
  251. package/schema/schemas/unknown.js +9 -14
  252. package/schema/schemas/unknown.js.map +1 -1
  253. package/schema/transformers/generic.d.ts +13 -0
  254. package/schema/transformers/generic.js +28 -0
  255. package/schema/transformers/generic.js.map +1 -0
  256. package/schema/transformers/index.d.ts +3 -0
  257. package/{old-api/endpoints → schema/transformers}/index.js +3 -1
  258. package/schema/transformers/index.js.map +1 -0
  259. package/schema/transformers/lowercase.d.ts +9 -0
  260. package/schema/transformers/lowercase.js +22 -0
  261. package/schema/transformers/lowercase.js.map +1 -0
  262. package/schema/transformers/trim.d.ts +9 -0
  263. package/schema/transformers/trim.js +22 -0
  264. package/schema/transformers/trim.js.map +1 -0
  265. package/schema/transformers/uppercase.d.ts +9 -0
  266. package/schema/transformers/uppercase.js +22 -0
  267. package/schema/transformers/uppercase.js.map +1 -0
  268. package/schema/types.d.ts +135 -15
  269. package/schema/types.js +39 -3
  270. package/schema/types.js.map +1 -1
  271. package/schema/utils/index.d.ts +2 -0
  272. package/{old-api/validation → schema/utils}/index.js +2 -1
  273. package/schema/utils/index.js.map +1 -0
  274. package/schema/utils/schema.d.ts +12 -0
  275. package/schema/utils/schema.js +78 -0
  276. package/schema/utils/schema.js.map +1 -0
  277. package/schema/utils/value-type.d.ts +4 -0
  278. package/schema/utils/value-type.js +35 -0
  279. package/schema/utils/value-type.js.map +1 -0
  280. package/templates/providers/file-template.provider.base.d.ts +1 -1
  281. package/templates/providers/file-template.provider.base.js +3 -2
  282. package/templates/providers/file-template.provider.base.js.map +1 -1
  283. package/types.d.ts +5 -1
  284. package/utils/clone.d.ts +1 -0
  285. package/utils/clone.js +45 -0
  286. package/utils/clone.js.map +1 -0
  287. package/utils/enum.d.ts +1 -1
  288. package/utils/format-error.d.ts +20 -0
  289. package/utils/format-error.js +42 -0
  290. package/utils/format-error.js.map +1 -0
  291. package/utils/function/memoize.d.ts +6 -2
  292. package/utils/function/memoize.js +28 -20
  293. package/utils/function/memoize.js.map +1 -1
  294. package/utils/helpers.d.ts +1 -32
  295. package/utils/helpers.js +3 -158
  296. package/utils/helpers.js.map +1 -1
  297. package/utils/index.d.ts +3 -0
  298. package/utils/index.js +3 -0
  299. package/utils/index.js.map +1 -1
  300. package/utils/merge.d.ts +5 -0
  301. package/utils/merge.js +32 -0
  302. package/utils/merge.js.map +1 -0
  303. package/utils/object/decycle.d.ts +16 -0
  304. package/utils/object/decycle.js +81 -0
  305. package/utils/object/decycle.js.map +1 -0
  306. package/utils/object/dereference.js.map +1 -1
  307. package/utils/object/index.d.ts +1 -0
  308. package/utils/object/index.js +1 -0
  309. package/utils/object/index.js.map +1 -1
  310. package/utils/object/object.d.ts +4 -0
  311. package/utils/object/object.js +9 -2
  312. package/utils/object/object.js.map +1 -1
  313. package/utils/patterns.d.ts +1 -1
  314. package/utils/patterns.js +3 -3
  315. package/utils/patterns.js.map +1 -1
  316. package/utils/timing.d.ts +0 -8
  317. package/utils/timing.js.map +1 -1
  318. package/utils/type-guards.d.ts +6 -0
  319. package/utils/type-guards.js +16 -4
  320. package/utils/type-guards.js.map +1 -1
  321. package/instance-provider.d.ts +0 -17
  322. package/instance-provider.js +0 -55
  323. package/instance-provider.js.map +0 -1
  324. package/module/modules/old-web-server.module.d.ts +0 -22
  325. package/module/modules/old-web-server.module.js +0 -37
  326. package/module/modules/old-web-server.module.js.map +0 -1
  327. package/old-api/endpoint.d.ts +0 -5
  328. package/old-api/endpoint.js +0 -20
  329. package/old-api/endpoint.js.map +0 -1
  330. package/old-api/endpoints/echo.endpoint.d.ts +0 -2
  331. package/old-api/endpoints/echo.endpoint.js +0 -6
  332. package/old-api/endpoints/echo.endpoint.js.map +0 -1
  333. package/old-api/endpoints/index.d.ts +0 -1
  334. package/old-api/endpoints/index.js.map +0 -1
  335. package/old-api/http-api.d.ts +0 -63
  336. package/old-api/http-api.js +0 -269
  337. package/old-api/http-api.js.map +0 -1
  338. package/old-api/index.d.ts +0 -3
  339. package/old-api/index.js.map +0 -1
  340. package/old-api/validation/index.d.ts +0 -1
  341. package/old-api/validation/index.js.map +0 -1
  342. package/old-api/validation/types.d.ts +0 -6
  343. package/old-api/validation/types.js +0 -6
  344. package/old-api/validation/types.js.map +0 -1
  345. package/old-api/validation/validators/index.d.ts +0 -1
  346. package/old-api/validation/validators/index.js.map +0 -1
  347. package/old-api/validation/validators/noop.d.ts +0 -2
  348. package/old-api/validation/validators/noop.js +0 -8
  349. package/old-api/validation/validators/noop.js.map +0 -1
  350. package/old-api/validation/validators/superstruct.d.ts +0 -14
  351. package/old-api/validation/validators/superstruct.js +0 -66
  352. package/old-api/validation/validators/superstruct.js.map +0 -1
  353. package/old-api/validation/validators/yup.d.ts +0 -7
  354. package/old-api/validation/validators/yup.js +0 -60
  355. package/old-api/validation/validators/yup.js.map +0 -1
  356. package/schema/schema.validator.d.ts +0 -40
  357. package/schema/schema.validator.js +0 -75
  358. package/schema/schema.validator.js.map +0 -1
  359. package/schema/schemas/async-iterable.d.ts +0 -13
  360. package/schema/schemas/async-iterable.js +0 -40
  361. package/schema/schemas/async-iterable.js.map +0 -1
  362. package/schema/schemas/iterable.d.ts +0 -13
  363. package/schema/schemas/iterable.js +0 -40
  364. package/schema/schemas/iterable.js.map +0 -1
  365. package/schema/schemas/never.d.ts +0 -9
  366. package/schema/schemas/never.js +0 -22
  367. package/schema/schemas/never.js.map +0 -1
  368. package/schema/schemas/preprocess.d.ts +0 -16
  369. package/schema/schemas/preprocess.js +0 -35
  370. package/schema/schemas/preprocess.js.map +0 -1
  371. package/schema/schemas/refine.d.ts +0 -24
  372. package/schema/schemas/refine.js +0 -52
  373. package/schema/schemas/refine.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.printType = exports.getTypeInfoString = exports.getConstructor = exports.createConstructorParameterDecorator = exports.createMethodParameterDecorator = exports.createParameterDecorator = exports.createMethodDecorator = exports.createPropertyOrAccessorDecorator = exports.createAccessorDecorator = exports.createPropertyDecorator = exports.createClassDecorator = exports.createDecorator = void 0;
4
+ const array_1 = require("../utils/array/array");
4
5
  const noop_1 = require("../utils/noop");
5
- const object_1 = require("../utils/object/object");
6
6
  const type_guards_1 = require("../utils/type-guards");
7
7
  const decorator_data_1 = require("./decorator-data");
8
8
  const registry_1 = require("./registry");
@@ -18,40 +18,15 @@ function createDecorator(options, handler = noop_1.noop) {
18
18
  (0, type_guards_1.assert)(valid, () => `Decorator cannot be used for ${data.type}.`);
19
19
  const metadata = registry_1.reflectionRegistry.registerDecoratorData(data);
20
20
  if ((0, type_guards_1.isDefined)(options.data)) {
21
- for (const [key, value] of (0, object_1.objectEntries)(options.data)) {
22
- if (options.mergeData != true) {
23
- metadata.data.set(key, value);
24
- }
25
- else {
26
- let newData;
27
- if ((0, type_guards_1.isObject)(value)) {
28
- const existing = metadata.data.get(key) ?? {};
29
- (0, type_guards_1.assertObject)(existing, 'Cannot merge object into non-object.');
30
- newData = { ...existing, ...value };
31
- }
32
- else if ((0, type_guards_1.isArray)(value)) {
33
- const existing = metadata.data.get(key) ?? [];
34
- (0, type_guards_1.assertArray)(existing, 'Cannot merge array into non-array.');
35
- newData = [...existing, ...value];
36
- }
37
- else if ((0, type_guards_1.isMap)(value)) {
38
- const existing = metadata.data.get(key) ?? new Map();
39
- (0, type_guards_1.assertMap)(existing, 'Cannot merge map into non-map.');
40
- newData = new Map([...existing, ...value]);
41
- }
42
- else if ((0, type_guards_1.isSet)(value)) {
43
- const existing = metadata.data.get(key) ?? new Set();
44
- (0, type_guards_1.assertSet)(existing, 'Cannot merge set into non-set.');
45
- newData = new Set([...existing, ...value]);
46
- }
47
- else {
48
- throw new Error('Merging of data can only be done with objects, arrays, maps and sets.');
49
- }
50
- metadata.data.set(key, newData);
51
- }
21
+ metadata.data.setMany(options.data, options.mergeData);
22
+ }
23
+ const result = handler(data, metadata);
24
+ if ((0, type_guards_1.isDefined)(options.include)) {
25
+ for (const include of (0, array_1.toArray)(options.include)) {
26
+ include(target, propertyKey, descriptorOrParameterIndex); // eslint-disable-line @typescript-eslint/no-unsafe-argument
52
27
  }
53
28
  }
54
- return handler(data, metadata);
29
+ return result;
55
30
  }
56
31
  return decoratorWrapper;
57
32
  }
@@ -120,10 +95,9 @@ function getTypeInfoString(type) {
120
95
  return lines.join('\n');
121
96
  }
122
97
  exports.getTypeInfoString = getTypeInfoString;
123
- // eslint-disable-next-line max-statements, max-lines-per-function
124
98
  function printType(type) {
125
99
  const text = getTypeInfoString(type);
126
- console.log(text);
100
+ console.log(text); // eslint-disable-line no-console
127
101
  }
128
102
  exports.printType = printType;
129
103
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../source/reflection/utils.ts"],"names":[],"mappings":";;;AACA,wCAAoC;AACpC,mDAAsD;AACtD,sDAAgK;AAChK,qDAAoD;AACpD,yCAAgD;AAkBhD,kDAAkD;AAClD,SAAgB,eAAe,CAAgE,OAAU,EAAE,UAAoD,WAAI;IACjK,kEAAkE;IAClE,SAAS,gBAAgB,CAAC,MAAc,EAAE,WAA6B,EAAE,0BAAwD;QAC/H,MAAM,IAAI,GAAG,IAAA,iCAAgB,EAAC,MAAM,EAAE,WAAW,EAAE,0BAA0B,CAAC,CAAC;QAC/E,MAAM,WAAW,GAAqC,CAAC,IAAI,CAAC,IAAI,IAAI,uBAAuB,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAElI,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC;eACvC,CAAC,WAAW,IAAI,WAAW,IAAI,CAAC,CAAC,OAAO,CAAC,oBAAoB,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC,CAAC;eAC7G,CAAC,CAAC,CAAC,WAAW,IAAI,sBAAsB,CAAC,IAAI,CAAC,WAA4B,IAAI,iBAAiB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC;QAEvI,IAAA,oBAAM,EAAC,KAAK,EAAE,GAA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IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChG,KAAK,CAAC,IAAI,CAAC,KAAK,WAAW,IAAI,UAAU,MAAM,cAAc,CAAC,UAAU,EAAE,IAAI,IAAI,MAAM,EAAE,CAAC,CAAC;KAC7F;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AA/BD,8CA+BC;AAED,SAAgB,SAAS,CAAC,IAAiB;IACzC,MAAM,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,iCAAiC;AACtD,CAAC;AAHD,8BAGC"}
@@ -0,0 +1,2 @@
1
+ export * from './maximum-length';
2
+ export * from './minimum-length';
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./noop"), exports);
17
+ __exportStar(require("./maximum-length"), exports);
18
+ __exportStar(require("./minimum-length"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/schema/array-constraints/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAiC"}
@@ -0,0 +1,11 @@
1
+ import type { JsonPath } from "../../json-path/json-path";
2
+ import type { Decorator } from "../../reflection";
3
+ import type { ConstraintResult } from '../types';
4
+ import { SchemaArrayConstraint } from '../types';
5
+ export declare class ArrayMaximumLengthConstraint extends SchemaArrayConstraint {
6
+ private readonly maximumLength;
7
+ readonly expects: string;
8
+ constructor(maximumLength: number);
9
+ validate(value: any[], path: JsonPath): ConstraintResult;
10
+ }
11
+ export declare function ArrayMaximumLength(maximumLength: number): Decorator<'property' | 'accessor'>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/naming-convention */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ArrayMaximumLength = exports.ArrayMaximumLengthConstraint = void 0;
5
+ const decorators_1 = require("../decorators");
6
+ const schema_error_1 = require("../schema.error");
7
+ const types_1 = require("../types");
8
+ class ArrayMaximumLengthConstraint extends types_1.SchemaArrayConstraint {
9
+ constructor(maximumLength) {
10
+ super();
11
+ this.maximumLength = maximumLength;
12
+ this.expects = `a maximum array length of ${this.maximumLength}`;
13
+ }
14
+ validate(value, path) {
15
+ if (value.length > this.maximumLength) {
16
+ return { success: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `an array length of ${value.length}`, path) };
17
+ }
18
+ return { success: true };
19
+ }
20
+ }
21
+ exports.ArrayMaximumLengthConstraint = ArrayMaximumLengthConstraint;
22
+ function ArrayMaximumLength(maximumLength) {
23
+ return (0, decorators_1.createSchemaArrayConstraintDecorator)(new ArrayMaximumLengthConstraint(maximumLength));
24
+ }
25
+ exports.ArrayMaximumLength = ArrayMaximumLength;
26
+ //# sourceMappingURL=maximum-length.js.map
@@ -0,0 +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,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,sBAAsB,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;SACxH;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,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"}
@@ -0,0 +1,11 @@
1
+ import type { JsonPath } from "../../json-path/json-path";
2
+ import type { Decorator } from "../../reflection";
3
+ import type { ConstraintResult } from '../types';
4
+ import { SchemaArrayConstraint } from '../types';
5
+ export declare class MinimumArrayLengthConstraint extends SchemaArrayConstraint {
6
+ private readonly minimumLength;
7
+ readonly expects: string;
8
+ constructor(minimumLength: number);
9
+ validate(value: any[], path: JsonPath): ConstraintResult;
10
+ }
11
+ export declare function MinimumArrayLength(minimumLength: number): Decorator<'property' | 'accessor'>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/naming-convention */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.MinimumArrayLength = exports.MinimumArrayLengthConstraint = void 0;
5
+ const decorators_1 = require("../decorators");
6
+ const schema_error_1 = require("../schema.error");
7
+ const types_1 = require("../types");
8
+ class MinimumArrayLengthConstraint extends types_1.SchemaArrayConstraint {
9
+ constructor(minimumLength) {
10
+ super();
11
+ this.minimumLength = minimumLength;
12
+ this.expects = `a minimum array length of ${this.minimumLength}`;
13
+ }
14
+ validate(value, path) {
15
+ if (value.length < this.minimumLength) {
16
+ return { success: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, `an array length of ${value.length}`, path) };
17
+ }
18
+ return { success: true };
19
+ }
20
+ }
21
+ exports.MinimumArrayLengthConstraint = MinimumArrayLengthConstraint;
22
+ function MinimumArrayLength(minimumLength) {
23
+ return (0, decorators_1.createSchemaArrayConstraintDecorator)(new MinimumArrayLengthConstraint(minimumLength));
24
+ }
25
+ exports.MinimumArrayLength = MinimumArrayLength;
26
+ //# sourceMappingURL=minimum-length.js.map
@@ -0,0 +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,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,sBAAsB,KAAK,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;SACxH;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,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"}
@@ -0,0 +1,9 @@
1
+ import type { JsonPath } from "../../json-path";
2
+ import type { CoerceResult } from '../types';
3
+ import { SchemaValueCoercer } from '../types';
4
+ export declare class BooleanCoercer extends SchemaValueCoercer {
5
+ readonly sourceType: (NumberConstructor | StringConstructor | BigIntConstructor)[];
6
+ readonly targetType: BooleanConstructor;
7
+ coerce(value: number | string | bigint, path: JsonPath): CoerceResult;
8
+ }
9
+ export declare const booleanCoercer: BooleanCoercer;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.booleanCoercer = exports.BooleanCoercer = void 0;
4
+ const type_guards_1 = require("../../utils/type-guards");
5
+ const schema_error_1 = require("../schema.error");
6
+ const types_1 = require("../types");
7
+ class BooleanCoercer extends types_1.SchemaValueCoercer {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.sourceType = [Number, String, BigInt];
11
+ this.targetType = Boolean;
12
+ }
13
+ coerce(value, path) {
14
+ const normalizedValue = (0, type_guards_1.isString)(value) ? value.toLowerCase() : value;
15
+ switch (normalizedValue) {
16
+ case 1:
17
+ case 1n:
18
+ case 'true':
19
+ case '1':
20
+ case 'yes':
21
+ return { success: true, value: true };
22
+ case 0:
23
+ case 0n:
24
+ case 'false':
25
+ case '0':
26
+ case 'no':
27
+ return { success: true, value: false };
28
+ default:
29
+ return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(Boolean, value.toString(), path) };
30
+ }
31
+ }
32
+ }
33
+ exports.BooleanCoercer = BooleanCoercer;
34
+ exports.booleanCoercer = new BooleanCoercer();
35
+ //# sourceMappingURL=boolean.coercer.js.map
@@ -0,0 +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,KAAK,CAAC,CAAC;YACP,KAAK,EAAE,CAAC;YACR,KAAK,MAAM,CAAC;YACZ,KAAK,GAAG,CAAC;YACT,KAAK,KAAK;gBACR,OAAO,EAAE,OAAO,EAAE,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,CAAC,EAAE,CAAC;SACjG;IACH,CAAC;CACF;AA1BD,wCA0BC;AAEY,QAAA,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { JsonPath } from "../../json-path";
2
+ import type { CoerceResult } from '../types';
3
+ import { SchemaValueCoercer } from '../types';
4
+ export declare class DateCoercer extends SchemaValueCoercer {
5
+ readonly sourceType: (NumberConstructor | StringConstructor | BigIntConstructor)[];
6
+ readonly targetType: DateConstructor;
7
+ coerce(value: number | string | bigint, path: JsonPath): CoerceResult;
8
+ }
9
+ export declare const dateCoercer: DateCoercer;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dateCoercer = exports.DateCoercer = void 0;
4
+ const type_guards_1 = require("../../utils/type-guards");
5
+ const schema_error_1 = require("../schema.error");
6
+ const types_1 = require("../types");
7
+ class DateCoercer extends types_1.SchemaValueCoercer {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.sourceType = [Number, String, BigInt];
11
+ this.targetType = Date;
12
+ }
13
+ coerce(value, path) {
14
+ const parseValue = (0, type_guards_1.isBigInt)(value) ? Number(value) : value;
15
+ const date = new Date(parseValue);
16
+ if (Number.isNaN(date.getTime())) {
17
+ return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, value.toString(), path) };
18
+ }
19
+ return { success: true, value: date };
20
+ }
21
+ }
22
+ exports.DateCoercer = DateCoercer;
23
+ exports.dateCoercer = new DateCoercer();
24
+ //# sourceMappingURL=date.coercer.js.map
@@ -0,0 +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"}
@@ -0,0 +1,9 @@
1
+ import type { CoerceResult, ValueType } from '../types';
2
+ import { SchemaValueCoercer } from '../types';
3
+ export declare class DefaultValueCoercer extends SchemaValueCoercer {
4
+ readonly defaultValue: any;
5
+ readonly sourceType = "undefined";
6
+ readonly targetType: ValueType;
7
+ constructor(defaultValue: any);
8
+ coerce(): CoerceResult;
9
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DefaultValueCoercer = void 0;
4
+ const types_1 = require("../types");
5
+ class DefaultValueCoercer extends types_1.SchemaValueCoercer {
6
+ constructor(defaultValue) {
7
+ super();
8
+ this.sourceType = 'undefined';
9
+ this.defaultValue = defaultValue;
10
+ }
11
+ coerce() {
12
+ return { success: true, value: this.defaultValue };
13
+ }
14
+ }
15
+ exports.DefaultValueCoercer = DefaultValueCoercer;
16
+ //# sourceMappingURL=default-value.coercer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-value.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/default-value.coercer.ts"],"names":[],"mappings":";;;AACA,oCAA8C;AAE9C,MAAa,mBAAoB,SAAQ,0BAAkB;IAKzD,YAAY,YAAiB;QAC3B,KAAK,EAAE,CAAC;QAJD,eAAU,GAAG,WAAW,CAAC;QAMhC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,MAAM;QACJ,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC;IACrD,CAAC;CACF;AAdD,kDAcC"}
@@ -0,0 +1,7 @@
1
+ export * from './boolean.coercer';
2
+ export * from './date.coercer';
3
+ export * from './default-value.coercer';
4
+ export * from './number.coercer';
5
+ export * from './regexp.coercer';
6
+ export * from './string.coercer';
7
+ export * from './uint8-array.coercer';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./boolean.coercer"), exports);
18
+ __exportStar(require("./date.coercer"), exports);
19
+ __exportStar(require("./default-value.coercer"), exports);
20
+ __exportStar(require("./number.coercer"), exports);
21
+ __exportStar(require("./regexp.coercer"), exports);
22
+ __exportStar(require("./string.coercer"), exports);
23
+ __exportStar(require("./uint8-array.coercer"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/schema/coercers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,iDAA+B;AAC/B,0DAAwC;AACxC,mDAAiC;AACjC,mDAAiC;AACjC,mDAAiC;AACjC,wDAAsC"}
@@ -0,0 +1,9 @@
1
+ import type { JsonPath } from "../../json-path";
2
+ import type { CoerceResult } from '../types';
3
+ import { SchemaValueCoercer } from '../types';
4
+ export declare class NumberCoercer extends SchemaValueCoercer {
5
+ readonly sourceType: (StringConstructor | BooleanConstructor | BigIntConstructor)[];
6
+ readonly targetType: NumberConstructor;
7
+ coerce(value: string | bigint | boolean, path: JsonPath): CoerceResult;
8
+ }
9
+ export declare const numberCoercer: NumberCoercer;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.numberCoercer = exports.NumberCoercer = void 0;
4
+ const schema_error_1 = require("../schema.error");
5
+ const types_1 = require("../types");
6
+ class NumberCoercer extends types_1.SchemaValueCoercer {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.sourceType = [String, BigInt, Boolean];
10
+ this.targetType = Number;
11
+ }
12
+ coerce(value, path) {
13
+ const result = Number(value);
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.') };
16
+ }
17
+ return { success: true, value: result };
18
+ }
19
+ }
20
+ exports.NumberCoercer = NumberCoercer;
21
+ exports.numberCoercer = new NumberCoercer();
22
+ //# sourceMappingURL=number.coercer.js.map
@@ -0,0 +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"}
@@ -0,0 +1,11 @@
1
+ import type { JsonPath } from "../../json-path/json-path";
2
+ import type { CoerceResult } from '../types';
3
+ import { SchemaValueCoercer } from '../types';
4
+ export declare class RegExpCoercer extends SchemaValueCoercer {
5
+ readonly sourceType: StringConstructor;
6
+ readonly targetType: RegExpConstructor;
7
+ readonly flags: string | undefined;
8
+ constructor(flags?: string);
9
+ coerce(value: string, path: JsonPath): CoerceResult;
10
+ }
11
+ export declare const regExpCoercer: RegExpCoercer;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.regExpCoercer = exports.RegExpCoercer = void 0;
4
+ const schema_error_1 = require("../schema.error");
5
+ const types_1 = require("../types");
6
+ class RegExpCoercer extends types_1.SchemaValueCoercer {
7
+ constructor(flags = 'u') {
8
+ super();
9
+ this.sourceType = String;
10
+ this.targetType = RegExp;
11
+ this.flags = flags;
12
+ }
13
+ coerce(value, path) {
14
+ try {
15
+ return { success: true, value: RegExp(value, this.flags) };
16
+ }
17
+ catch (error) {
18
+ return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(this.targetType, 'invalid regexp pattern', path, error.message) };
19
+ }
20
+ }
21
+ }
22
+ exports.RegExpCoercer = RegExpCoercer;
23
+ exports.regExpCoercer = new RegExpCoercer();
24
+ //# sourceMappingURL=regexp.coercer.js.map
@@ -0,0 +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"}
@@ -0,0 +1,9 @@
1
+ import type { JsonPath } from "../../json-path";
2
+ import type { CoerceResult } from '../types';
3
+ import { SchemaValueCoercer } from '../types';
4
+ export declare class StringCoercer extends SchemaValueCoercer {
5
+ readonly sourceType: (NumberConstructor | DateConstructor | BooleanConstructor | BigIntConstructor)[];
6
+ readonly targetType: StringConstructor;
7
+ coerce(value: number | boolean | bigint | Date, path: JsonPath): CoerceResult;
8
+ }
9
+ export declare const stringCoercer: StringCoercer;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stringCoercer = exports.StringCoercer = void 0;
4
+ const type_guards_1 = require("../../utils/type-guards");
5
+ const schema_error_1 = require("../schema.error");
6
+ const types_1 = require("../types");
7
+ class StringCoercer extends types_1.SchemaValueCoercer {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.sourceType = [Number, Boolean, BigInt, Date];
11
+ this.targetType = String;
12
+ }
13
+ coerce(value, path) {
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) };
16
+ }
17
+ return { success: true, value: value.toString() };
18
+ }
19
+ }
20
+ exports.StringCoercer = StringCoercer;
21
+ exports.stringCoercer = new StringCoercer();
22
+ //# sourceMappingURL=string.coercer.js.map
@@ -0,0 +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"}
@@ -0,0 +1,9 @@
1
+ import type { JsonPath } from "../../json-path/json-path";
2
+ import type { CoercerContext, CoerceResult } from '../types';
3
+ import { SchemaValueCoercer } from '../types';
4
+ export declare class Uint8ArrayCoercer extends SchemaValueCoercer {
5
+ readonly sourceType: ArrayConstructor;
6
+ readonly targetType: Uint8ArrayConstructor;
7
+ coerce(value: any[], path: JsonPath, { options }: CoercerContext): CoerceResult;
8
+ }
9
+ export declare const uint8ArrayCoercer: Uint8ArrayCoercer;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uint8ArrayCoercer = exports.Uint8ArrayCoercer = void 0;
4
+ const integer_1 = require("../constraints/integer");
5
+ const maximum_1 = require("../constraints/maximum");
6
+ const minimum_1 = require("../constraints/minimum");
7
+ const schema_1 = require("../schema");
8
+ const schema_error_1 = require("../schema.error");
9
+ const types_1 = require("../types");
10
+ const byteNumberArraySchema = {
11
+ type: Number,
12
+ array: true,
13
+ valueConstraints: [new minimum_1.MinimumConstraint(0), new maximum_1.MaximumConstraint(255), new integer_1.IntegerConstraint()]
14
+ };
15
+ class Uint8ArrayCoercer extends types_1.SchemaValueCoercer {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.sourceType = Array;
19
+ this.targetType = Uint8Array;
20
+ }
21
+ coerce(value, path, { options }) {
22
+ const testResult = schema_1.Schema.testWithFastError(byteNumberArraySchema, value, options, path);
23
+ if (!testResult.success) {
24
+ return { success: false, error: schema_error_1.SchemaError.couldNotCoerce(Uint8Array, Array, path, undefined, { inner: testResult.error }) };
25
+ }
26
+ return { success: true, value: Uint8Array.from(testResult.value) };
27
+ }
28
+ }
29
+ exports.Uint8ArrayCoercer = Uint8ArrayCoercer;
30
+ exports.uint8ArrayCoercer = new Uint8ArrayCoercer();
31
+ //# sourceMappingURL=uint8-array.coercer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uint8-array.coercer.js","sourceRoot":"","sources":["../../../source/schema/coercers/uint8-array.coercer.ts"],"names":[],"mappings":";;;AACA,oDAA2D;AAC3D,oDAA2D;AAC3D,oDAA2D;AAC3D,sCAAmC;AACnC,kDAA8C;AAE9C,oCAA8C;AAE9C,MAAM,qBAAqB,GAA0B;IACnD,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,IAAI;IACX,gBAAgB,EAAE,CAAC,IAAI,2BAAiB,CAAC,CAAC,CAAC,EAAE,IAAI,2BAAiB,CAAC,GAAG,CAAC,EAAE,IAAI,2BAAiB,EAAE,CAAC;CAClG,CAAC;AAEF,MAAa,iBAAkB,SAAQ,0BAAkB;IAAzD;;QACW,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,UAAU,CAAC;IAWnC,CAAC;IATC,MAAM,CAAC,KAAY,EAAE,IAAc,EAAE,EAAE,OAAO,EAAkB;QAC9D,MAAM,UAAU,GAAG,eAAM,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAEzF,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE;YACvB,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,CAAC,EAAE,CAAC;SAC/H;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"}
@@ -0,0 +1,13 @@
1
+ import type { JsonPath } from "../../json-path/json-path";
2
+ import type { Enumeration as EnumerationType, OneOrMany } from "../../types";
3
+ import type { ConstraintResult } from '../types';
4
+ import { SchemaValueConstraint } from '../types';
5
+ export declare class EnumerationConstraint extends SchemaValueConstraint {
6
+ private readonly allowedValuesSet;
7
+ private readonly allowedValuesString;
8
+ readonly enumeration: EnumerationType;
9
+ readonly suitableTypes: SchemaValueConstraint['suitableTypes'];
10
+ readonly expects: OneOrMany<string>;
11
+ constructor(enumeration: EnumerationType);
12
+ validate(value: number, path: JsonPath): ConstraintResult;
13
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/naming-convention */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.EnumerationConstraint = void 0;
5
+ const utils_1 = require("../../utils");
6
+ const iterable_helpers_1 = require("../../utils/iterable-helpers");
7
+ const type_guards_1 = require("../../utils/type-guards");
8
+ const schema_error_1 = require("../schema.error");
9
+ const types_1 = require("../types");
10
+ const utils_2 = require("../utils");
11
+ class EnumerationConstraint extends types_1.SchemaValueConstraint {
12
+ constructor(enumeration) {
13
+ super();
14
+ this.enumeration = enumeration;
15
+ const allowedValues = (0, type_guards_1.isArray)(enumeration) ? enumeration : (0, utils_1.enumValues)(enumeration);
16
+ this.allowedValuesSet = new Set(allowedValues);
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)))];
19
+ this.expects = `one of [${this.allowedValuesString}]`;
20
+ }
21
+ validate(value, path) {
22
+ if (!this.allowedValuesSet.has(value)) {
23
+ return { success: false, error: schema_error_1.SchemaError.expectedButGot(this.expects, value.toString(), path) };
24
+ }
25
+ return { success: true };
26
+ }
27
+ }
28
+ exports.EnumerationConstraint = EnumerationConstraint;
29
+ //# sourceMappingURL=enumeration.js.map
@@ -0,0 +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;AAE9C,oCAAiD;AACjD,oCAAwC;AAExC,MAAa,qBAAsB,SAAQ,6BAAqB;IAQ9D,YAAY,WAA4B;QACtC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAE/B,MAAM,aAAa,GAAG,IAAA,qBAAO,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAA,kBAAU,EAAC,WAAW,CAAC,CAAC;QACnF,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;QAC/C,IAAI,CAAC,mBAAmB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAA,sBAAQ,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7G,IAAI,CAAC,aAAa,GAAG,CAAC,GAAG,IAAA,2BAAQ,EAAC,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,oBAAY,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACtF,IAAI,CAAC,OAAO,GAAG,WAAW,IAAI,CAAC,mBAAmB,GAAG,CAAC;IACxD,CAAC;IAED,QAAQ,CAAC,KAAa,EAAE,IAAc;QACpC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YACrC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,0BAAW,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;SACpG;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF;AA5BD,sDA4BC"}
@@ -0,0 +1,22 @@
1
+ import type { JsonPath } from "../../json-path/json-path";
2
+ import type { Decorator } from "../../reflection";
3
+ import type { OneOrMany } from "../../types";
4
+ import { SchemaError } from '../schema.error';
5
+ import type { ConstraintResult } from '../types';
6
+ import { SchemaValueConstraint } from '../types';
7
+ export declare type GenericConstraintResult = {
8
+ success: true;
9
+ error?: undefined;
10
+ } | {
11
+ success: false;
12
+ error: string | SchemaError;
13
+ };
14
+ export declare type GenericConstraintFunction<T> = (value: T, path: JsonPath) => boolean | ConstraintResult;
15
+ export declare class GenericConstraint<T> extends SchemaValueConstraint {
16
+ readonly suitableTypes: NumberConstructor;
17
+ readonly expects: OneOrMany<string>;
18
+ readonly constraintFunction: GenericConstraintFunction<T>;
19
+ constructor(constraintFunction: GenericConstraintFunction<T>, expects?: OneOrMany<string>);
20
+ validate(value: T, path: JsonPath): ConstraintResult;
21
+ }
22
+ export declare function Constraint<T>(constraintFunction: GenericConstraintFunction<T>, expects?: OneOrMany<string>): Decorator<'property' | 'accessor'>;