@tsed/schema 7.0.0-beta.2 → 7.0.0-beta.20

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 (367) hide show
  1. package/coverage.json +6 -0
  2. package/jest.config.js +1 -6
  3. package/lib/cjs/components/lazyRefMapper.js +1 -2
  4. package/lib/cjs/components/lazyRefMapper.js.map +1 -1
  5. package/lib/cjs/components/objectMapper.js +1 -1
  6. package/lib/cjs/components/objectMapper.js.map +1 -1
  7. package/lib/cjs/components/schemaMapper.js +1 -1
  8. package/lib/cjs/components/schemaMapper.js.map +1 -1
  9. package/lib/cjs/constants/httpStatusMessages.js +14 -100
  10. package/lib/cjs/constants/httpStatusMessages.js.map +1 -1
  11. package/lib/cjs/decorators/collections/collectionOf.js +3 -4
  12. package/lib/cjs/decorators/collections/collectionOf.js.map +1 -1
  13. package/lib/cjs/decorators/common/anyOf.js +4 -0
  14. package/lib/cjs/decorators/common/anyOf.js.map +1 -1
  15. package/lib/cjs/decorators/common/description.js +1 -2
  16. package/lib/cjs/decorators/common/description.js.map +1 -1
  17. package/lib/cjs/decorators/common/enum.js +1 -20
  18. package/lib/cjs/decorators/common/enum.js.map +1 -1
  19. package/lib/cjs/decorators/common/ignore.js.map +1 -1
  20. package/lib/cjs/decorators/common/jsonEntityFn.js.map +1 -1
  21. package/lib/cjs/decorators/common/oneOf.js +4 -0
  22. package/lib/cjs/decorators/common/oneOf.js.map +1 -1
  23. package/lib/cjs/decorators/common/recordOf.js +63 -0
  24. package/lib/cjs/decorators/common/recordOf.js.map +1 -0
  25. package/lib/cjs/decorators/operations/acceptMime.js +28 -0
  26. package/lib/cjs/decorators/operations/acceptMime.js.map +1 -0
  27. package/lib/cjs/decorators/operations/in.js +6 -4
  28. package/lib/cjs/decorators/operations/in.js.map +1 -1
  29. package/lib/cjs/decorators/operations/redirect.js +1 -2
  30. package/lib/cjs/decorators/operations/redirect.js.map +1 -1
  31. package/lib/cjs/decorators/operations/returns.js +43 -21
  32. package/lib/cjs/decorators/operations/returns.js.map +1 -1
  33. package/lib/cjs/decorators/operations/route.js +1 -4
  34. package/lib/cjs/decorators/operations/route.js.map +1 -1
  35. package/lib/cjs/decorators/operations/view.js +31 -0
  36. package/lib/cjs/decorators/operations/view.js.map +1 -0
  37. package/lib/cjs/domain/DecoratorContext.js +6 -3
  38. package/lib/cjs/domain/DecoratorContext.js.map +1 -1
  39. package/lib/cjs/domain/JsonClassStore.js +5 -8
  40. package/lib/cjs/domain/JsonClassStore.js.map +1 -1
  41. package/lib/cjs/domain/JsonEntityStore.js +40 -1
  42. package/lib/cjs/domain/JsonEntityStore.js.map +1 -1
  43. package/lib/cjs/domain/JsonLazyRef.js +2 -1
  44. package/lib/cjs/domain/JsonLazyRef.js.map +1 -1
  45. package/lib/cjs/domain/JsonMap.js.map +1 -1
  46. package/lib/cjs/domain/JsonMethodStore.js +85 -39
  47. package/lib/cjs/domain/JsonMethodStore.js.map +1 -1
  48. package/lib/cjs/domain/JsonOperation.js +15 -34
  49. package/lib/cjs/domain/JsonOperation.js.map +1 -1
  50. package/lib/cjs/domain/JsonOperationPathsMap.js +2 -16
  51. package/lib/cjs/domain/JsonOperationPathsMap.js.map +1 -1
  52. package/lib/cjs/domain/JsonOperationRoute.js +11 -8
  53. package/lib/cjs/domain/JsonOperationRoute.js.map +1 -1
  54. package/lib/cjs/domain/JsonParameter.js +42 -48
  55. package/lib/cjs/domain/JsonParameter.js.map +1 -1
  56. package/lib/cjs/domain/JsonParameterStore.js +26 -10
  57. package/lib/cjs/domain/JsonParameterStore.js.map +1 -1
  58. package/lib/cjs/domain/JsonPropertyStore.js +7 -6
  59. package/lib/cjs/domain/JsonPropertyStore.js.map +1 -1
  60. package/lib/cjs/domain/JsonResponse.js +7 -18
  61. package/lib/cjs/domain/JsonResponse.js.map +1 -1
  62. package/lib/cjs/domain/JsonSchema.js +62 -71
  63. package/lib/cjs/domain/JsonSchema.js.map +1 -1
  64. package/lib/cjs/domain/SpecTypes.js +1 -0
  65. package/lib/cjs/domain/SpecTypes.js.map +1 -1
  66. package/lib/cjs/hooks/alterIgnore.js +2 -3
  67. package/lib/cjs/hooks/alterIgnore.js.map +1 -1
  68. package/lib/cjs/hooks/alterRequiredGroups.js +1 -2
  69. package/lib/cjs/hooks/alterRequiredGroups.js.map +1 -1
  70. package/lib/cjs/index.js +150 -20
  71. package/lib/cjs/index.js.map +1 -1
  72. package/lib/cjs/interfaces/JsonSchemaOptions.js.map +1 -1
  73. package/lib/cjs/package.json +3 -0
  74. package/lib/cjs/utils/concatPath.js +16 -1
  75. package/lib/cjs/utils/concatPath.js.map +1 -1
  76. package/lib/cjs/utils/from.js +9 -8
  77. package/lib/cjs/utils/from.js.map +1 -1
  78. package/lib/cjs/utils/generateSpec.js +46 -0
  79. package/lib/cjs/utils/generateSpec.js.map +1 -0
  80. package/lib/cjs/utils/generics.js.map +1 -1
  81. package/lib/cjs/utils/getJsonPathParameters.js +20 -6
  82. package/lib/cjs/utils/getJsonPathParameters.js.map +1 -1
  83. package/lib/cjs/utils/getJsonSchema.js +12 -3
  84. package/lib/cjs/utils/getJsonSchema.js.map +1 -1
  85. package/lib/cjs/utils/getJsonType.js +1 -1
  86. package/lib/cjs/utils/getJsonType.js.map +1 -1
  87. package/lib/cjs/utils/getOperationsRoutes.js +2 -1
  88. package/lib/cjs/utils/getOperationsRoutes.js.map +1 -1
  89. package/lib/cjs/utils/getRequiredProperties.js +3 -3
  90. package/lib/cjs/utils/getRequiredProperties.js.map +1 -1
  91. package/lib/cjs/utils/getSpec.js +58 -43
  92. package/lib/cjs/utils/getSpec.js.map +1 -1
  93. package/lib/cjs/utils/getSpecType.js +21 -0
  94. package/lib/cjs/utils/getSpecType.js.map +1 -0
  95. package/lib/cjs/utils/mapNullableType.js +1 -1
  96. package/lib/cjs/utils/mapNullableType.js.map +1 -1
  97. package/lib/cjs/utils/mapOpenSpec.js +41 -0
  98. package/lib/cjs/utils/mapOpenSpec.js.map +1 -0
  99. package/lib/cjs/utils/mapOpenSpec2.js +34 -0
  100. package/lib/cjs/utils/mapOpenSpec2.js.map +1 -0
  101. package/lib/cjs/utils/mapOpenSpec3.js +26 -0
  102. package/lib/cjs/utils/mapOpenSpec3.js.map +1 -0
  103. package/lib/cjs/utils/mapOpenSpecInfo.js +21 -0
  104. package/lib/cjs/utils/mapOpenSpecInfo.js.map +1 -0
  105. package/lib/cjs/utils/matchGroups.js +1 -1
  106. package/lib/cjs/utils/matchGroups.js.map +1 -1
  107. package/lib/cjs/utils/mergeOperation.js +2 -2
  108. package/lib/cjs/utils/mergeOperation.js.map +1 -1
  109. package/lib/cjs/utils/mergeSpec.js.map +1 -1
  110. package/lib/cjs/utils/operationIdFormatter.js +3 -3
  111. package/lib/cjs/utils/operationIdFormatter.js.map +1 -1
  112. package/lib/cjs/utils/ref.js +2 -2
  113. package/lib/cjs/utils/ref.js.map +1 -1
  114. package/lib/cjs/utils/serializeEnumValues.js +26 -0
  115. package/lib/cjs/utils/serializeEnumValues.js.map +1 -0
  116. package/lib/cjs/utils/transformToOS2.js +510 -0
  117. package/lib/cjs/utils/transformToOS2.js.map +1 -0
  118. package/lib/esm/components/anyMapper.js +4 -4
  119. package/lib/esm/components/classMapper.js +4 -4
  120. package/lib/esm/components/genericsMapper.js +4 -4
  121. package/lib/esm/components/inheritedClassMapper.js +2 -2
  122. package/lib/esm/components/itemMapper.js +1 -1
  123. package/lib/esm/components/lazyRefMapper.js +4 -5
  124. package/lib/esm/components/lazyRefMapper.js.map +1 -1
  125. package/lib/esm/components/mapMapper.js +2 -2
  126. package/lib/esm/components/objectMapper.js +4 -4
  127. package/lib/esm/components/objectMapper.js.map +1 -1
  128. package/lib/esm/components/ofMapper.js +1 -1
  129. package/lib/esm/components/propertiesMapper.js +1 -1
  130. package/lib/esm/components/schemaMapper.js +7 -7
  131. package/lib/esm/components/schemaMapper.js.map +1 -1
  132. package/lib/esm/constants/httpStatusMessages.js +13 -100
  133. package/lib/esm/constants/httpStatusMessages.js.map +1 -1
  134. package/lib/esm/decorators/class/children.js +1 -1
  135. package/lib/esm/decorators/collections/collectionContains.js +1 -1
  136. package/lib/esm/decorators/collections/collectionOf.js +4 -5
  137. package/lib/esm/decorators/collections/collectionOf.js.map +1 -1
  138. package/lib/esm/decorators/collections/maxItems.js +1 -1
  139. package/lib/esm/decorators/collections/maxProperties.js +1 -1
  140. package/lib/esm/decorators/collections/minItems.js +1 -1
  141. package/lib/esm/decorators/collections/minProperties.js +1 -1
  142. package/lib/esm/decorators/collections/uniqueItems.js +1 -1
  143. package/lib/esm/decorators/common/additionalProperties.js +1 -1
  144. package/lib/esm/decorators/common/allOf.js +1 -1
  145. package/lib/esm/decorators/common/allow.js +2 -2
  146. package/lib/esm/decorators/common/any.js +1 -1
  147. package/lib/esm/decorators/common/anyOf.js +5 -1
  148. package/lib/esm/decorators/common/anyOf.js.map +1 -1
  149. package/lib/esm/decorators/common/const.js +1 -1
  150. package/lib/esm/decorators/common/customKey.js +1 -1
  151. package/lib/esm/decorators/common/default.js +1 -1
  152. package/lib/esm/decorators/common/description.js +2 -3
  153. package/lib/esm/decorators/common/description.js.map +1 -1
  154. package/lib/esm/decorators/common/enum.js +2 -21
  155. package/lib/esm/decorators/common/enum.js.map +1 -1
  156. package/lib/esm/decorators/common/example.js +1 -1
  157. package/lib/esm/decorators/common/examples.js +1 -1
  158. package/lib/esm/decorators/common/exclusiveMaximum.js +1 -1
  159. package/lib/esm/decorators/common/exclusiveMinimum.js +1 -1
  160. package/lib/esm/decorators/common/format.js +2 -2
  161. package/lib/esm/decorators/common/forwardGroups.js +1 -1
  162. package/lib/esm/decorators/common/groups.js +2 -2
  163. package/lib/esm/decorators/common/ignore.js +1 -1
  164. package/lib/esm/decorators/common/ignore.js.map +1 -1
  165. package/lib/esm/decorators/common/integer.js +1 -1
  166. package/lib/esm/decorators/common/jsonEntityFn.js +1 -1
  167. package/lib/esm/decorators/common/jsonEntityFn.js.map +1 -1
  168. package/lib/esm/decorators/common/maxLength.js +1 -1
  169. package/lib/esm/decorators/common/maximum.js +1 -1
  170. package/lib/esm/decorators/common/minLength.js +1 -1
  171. package/lib/esm/decorators/common/minimum.js +1 -1
  172. package/lib/esm/decorators/common/multipleOf.js +1 -1
  173. package/lib/esm/decorators/common/name.js +1 -1
  174. package/lib/esm/decorators/common/nullable.js +2 -2
  175. package/lib/esm/decorators/common/oneOf.js +5 -1
  176. package/lib/esm/decorators/common/oneOf.js.map +1 -1
  177. package/lib/esm/decorators/common/optional.js +1 -1
  178. package/lib/esm/decorators/common/pattern.js +1 -1
  179. package/lib/esm/decorators/common/property.js +1 -1
  180. package/lib/esm/decorators/common/readOnly.js +1 -1
  181. package/lib/esm/decorators/common/recordOf.js +59 -0
  182. package/lib/esm/decorators/common/recordOf.js.map +1 -0
  183. package/lib/esm/decorators/common/required.js +2 -2
  184. package/lib/esm/decorators/common/requiredGroups.js +2 -2
  185. package/lib/esm/decorators/common/schema.js +1 -1
  186. package/lib/esm/decorators/common/title.js +1 -1
  187. package/lib/esm/decorators/common/writeOnly.js +1 -1
  188. package/lib/esm/decorators/config/jsonEntityComponent.js +1 -1
  189. package/lib/esm/decorators/generics/genericOf.js +2 -2
  190. package/lib/esm/decorators/generics/generics.js +1 -1
  191. package/lib/esm/decorators/operations/acceptMime.js +24 -0
  192. package/lib/esm/decorators/operations/acceptMime.js.map +1 -0
  193. package/lib/esm/decorators/operations/consumes.js +1 -1
  194. package/lib/esm/decorators/operations/contentType.js +1 -1
  195. package/lib/esm/decorators/operations/deprecated.js +1 -1
  196. package/lib/esm/decorators/operations/header.js +1 -1
  197. package/lib/esm/decorators/operations/in.js +3 -1
  198. package/lib/esm/decorators/operations/in.js.map +1 -1
  199. package/lib/esm/decorators/operations/inFile.js +5 -5
  200. package/lib/esm/decorators/operations/location.js +1 -1
  201. package/lib/esm/decorators/operations/operationId.js +1 -1
  202. package/lib/esm/decorators/operations/operationPath.js +1 -1
  203. package/lib/esm/decorators/operations/partial.js +1 -1
  204. package/lib/esm/decorators/operations/path.js +1 -1
  205. package/lib/esm/decorators/operations/produces.js +1 -1
  206. package/lib/esm/decorators/operations/redirect.js +3 -4
  207. package/lib/esm/decorators/operations/redirect.js.map +1 -1
  208. package/lib/esm/decorators/operations/returns.js +51 -29
  209. package/lib/esm/decorators/operations/returns.js.map +1 -1
  210. package/lib/esm/decorators/operations/route.js +4 -7
  211. package/lib/esm/decorators/operations/route.js.map +1 -1
  212. package/lib/esm/decorators/operations/security.js +1 -1
  213. package/lib/esm/decorators/operations/status.js +1 -1
  214. package/lib/esm/decorators/operations/summary.js +1 -1
  215. package/lib/esm/decorators/operations/tags.js +1 -1
  216. package/lib/esm/decorators/operations/view.js +27 -0
  217. package/lib/esm/decorators/operations/view.js.map +1 -0
  218. package/lib/esm/domain/DecoratorContext.js +6 -3
  219. package/lib/esm/domain/DecoratorContext.js.map +1 -1
  220. package/lib/esm/domain/JsonClassStore.js +7 -10
  221. package/lib/esm/domain/JsonClassStore.js.map +1 -1
  222. package/lib/esm/domain/JsonEntityStore.js +40 -1
  223. package/lib/esm/domain/JsonEntityStore.js.map +1 -1
  224. package/lib/esm/domain/JsonLazyRef.js +4 -3
  225. package/lib/esm/domain/JsonLazyRef.js.map +1 -1
  226. package/lib/esm/domain/JsonMap.js +1 -1
  227. package/lib/esm/domain/JsonMap.js.map +1 -1
  228. package/lib/esm/domain/JsonMethodStore.js +86 -40
  229. package/lib/esm/domain/JsonMethodStore.js.map +1 -1
  230. package/lib/esm/domain/JsonOperation.js +22 -41
  231. package/lib/esm/domain/JsonOperation.js.map +1 -1
  232. package/lib/esm/domain/JsonOperationPathsMap.js +3 -17
  233. package/lib/esm/domain/JsonOperationPathsMap.js.map +1 -1
  234. package/lib/esm/domain/JsonOperationRoute.js +12 -9
  235. package/lib/esm/domain/JsonOperationRoute.js.map +1 -1
  236. package/lib/esm/domain/JsonParameter.js +46 -52
  237. package/lib/esm/domain/JsonParameter.js.map +1 -1
  238. package/lib/esm/domain/JsonParameterStore.js +29 -13
  239. package/lib/esm/domain/JsonParameterStore.js.map +1 -1
  240. package/lib/esm/domain/JsonPropertyStore.js +8 -7
  241. package/lib/esm/domain/JsonPropertyStore.js.map +1 -1
  242. package/lib/esm/domain/JsonRequestBody.js +2 -2
  243. package/lib/esm/domain/JsonResponse.js +10 -21
  244. package/lib/esm/domain/JsonResponse.js.map +1 -1
  245. package/lib/esm/domain/JsonSchema.js +67 -76
  246. package/lib/esm/domain/JsonSchema.js.map +1 -1
  247. package/lib/esm/domain/SpecTypes.js +1 -0
  248. package/lib/esm/domain/SpecTypes.js.map +1 -1
  249. package/lib/esm/hooks/alterIgnore.js +2 -3
  250. package/lib/esm/hooks/alterIgnore.js.map +1 -1
  251. package/lib/esm/hooks/alterRequiredGroups.js +1 -2
  252. package/lib/esm/hooks/alterRequiredGroups.js.map +1 -1
  253. package/lib/esm/index.js +150 -20
  254. package/lib/esm/index.js.map +1 -1
  255. package/lib/esm/interfaces/JsonSchemaOptions.js.map +1 -1
  256. package/lib/esm/package.json +3 -0
  257. package/lib/esm/utils/concatPath.js +16 -1
  258. package/lib/esm/utils/concatPath.js.map +1 -1
  259. package/lib/esm/utils/from.js +5 -4
  260. package/lib/esm/utils/from.js.map +1 -1
  261. package/lib/esm/utils/generateSpec.js +41 -0
  262. package/lib/esm/utils/generateSpec.js.map +1 -0
  263. package/lib/esm/utils/generics.js.map +1 -1
  264. package/lib/esm/utils/getInheritedStores.js +1 -1
  265. package/lib/esm/utils/getJsonEntityStore.js +5 -5
  266. package/lib/esm/utils/getJsonPathParameters.js +20 -6
  267. package/lib/esm/utils/getJsonPathParameters.js.map +1 -1
  268. package/lib/esm/utils/getJsonSchema.js +15 -6
  269. package/lib/esm/utils/getJsonSchema.js.map +1 -1
  270. package/lib/esm/utils/getJsonType.js +2 -2
  271. package/lib/esm/utils/getJsonType.js.map +1 -1
  272. package/lib/esm/utils/getOperationsRoutes.js +5 -4
  273. package/lib/esm/utils/getOperationsRoutes.js.map +1 -1
  274. package/lib/esm/utils/getOperationsStores.js +4 -4
  275. package/lib/esm/utils/getPropertiesStores.js +3 -3
  276. package/lib/esm/utils/getRequiredProperties.js +4 -4
  277. package/lib/esm/utils/getRequiredProperties.js.map +1 -1
  278. package/lib/esm/utils/getSpec.js +65 -50
  279. package/lib/esm/utils/getSpec.js.map +1 -1
  280. package/lib/esm/utils/getSpecType.js +16 -0
  281. package/lib/esm/utils/getSpecType.js.map +1 -0
  282. package/lib/esm/utils/mapNullableType.js +2 -2
  283. package/lib/esm/utils/mapNullableType.js.map +1 -1
  284. package/lib/esm/utils/mapOpenSpec.js +37 -0
  285. package/lib/esm/utils/mapOpenSpec.js.map +1 -0
  286. package/lib/esm/utils/mapOpenSpec2.js +30 -0
  287. package/lib/esm/utils/mapOpenSpec2.js.map +1 -0
  288. package/lib/esm/utils/mapOpenSpec3.js +22 -0
  289. package/lib/esm/utils/mapOpenSpec3.js.map +1 -0
  290. package/lib/esm/utils/mapOpenSpecInfo.js +17 -0
  291. package/lib/esm/utils/mapOpenSpecInfo.js.map +1 -0
  292. package/lib/esm/utils/mapRouteOptions.js +1 -1
  293. package/lib/esm/utils/mergeOperation.js +5 -5
  294. package/lib/esm/utils/mergeOperation.js.map +1 -1
  295. package/lib/esm/utils/mergeSpec.js.map +1 -1
  296. package/lib/esm/utils/operationIdFormatter.js +1 -1
  297. package/lib/esm/utils/operationIdFormatter.js.map +1 -1
  298. package/lib/esm/utils/ref.js +2 -2
  299. package/lib/esm/utils/ref.js.map +1 -1
  300. package/lib/esm/utils/serializeEnumValues.js +21 -0
  301. package/lib/esm/utils/serializeEnumValues.js.map +1 -0
  302. package/lib/esm/utils/toJsonMapCollection.js +1 -1
  303. package/lib/esm/utils/transformToOS2.js +504 -0
  304. package/lib/esm/utils/transformToOS2.js.map +1 -0
  305. package/lib/types/constants/httpStatusMessages.d.ts +2 -263
  306. package/lib/types/decorators/common/anyOf.d.ts +4 -0
  307. package/lib/types/decorators/common/ignore.d.ts +1 -1
  308. package/lib/types/decorators/common/jsonEntityFn.d.ts +1 -1
  309. package/lib/types/decorators/common/oneOf.d.ts +4 -0
  310. package/lib/types/decorators/common/recordOf.d.ts +46 -0
  311. package/lib/types/decorators/operations/acceptMime.d.ts +19 -0
  312. package/lib/types/decorators/operations/in.d.ts +1 -1
  313. package/lib/types/decorators/operations/returns.d.ts +7 -2
  314. package/lib/types/decorators/operations/view.d.ts +23 -0
  315. package/lib/types/domain/JsonEntityStore.d.ts +1 -0
  316. package/lib/types/domain/JsonMap.d.ts +1 -1
  317. package/lib/types/domain/JsonMethodStore.d.ts +56 -4
  318. package/lib/types/domain/JsonOperation.d.ts +2 -2
  319. package/lib/types/domain/JsonOperationPathsMap.d.ts +0 -2
  320. package/lib/types/domain/JsonOperationRoute.d.ts +7 -6
  321. package/lib/types/domain/JsonParameter.d.ts +2 -1
  322. package/lib/types/domain/JsonParameterStore.d.ts +23 -1
  323. package/lib/types/domain/JsonPropertyStore.d.ts +7 -0
  324. package/lib/types/domain/JsonResponse.d.ts +3 -1
  325. package/lib/types/domain/JsonSchema.d.ts +2 -2
  326. package/lib/types/domain/SpecTypes.d.ts +1 -0
  327. package/lib/types/index.d.ts +143 -13
  328. package/lib/types/interfaces/JsonSchemaOptions.d.ts +2 -2
  329. package/lib/types/utils/concatPath.d.ts +1 -1
  330. package/lib/types/utils/generateSpec.d.ts +16 -0
  331. package/lib/types/utils/generics.d.ts +1 -1
  332. package/lib/types/utils/getJsonSchema.d.ts +12 -2
  333. package/lib/types/utils/getOperationsRoutes.d.ts +2 -2
  334. package/lib/types/utils/getSpec.d.ts +5 -4
  335. package/lib/types/utils/getSpecType.d.ts +12 -0
  336. package/lib/types/utils/mapNullableType.d.ts +1 -1
  337. package/lib/types/utils/mapOpenSpec.d.ts +10 -0
  338. package/lib/types/utils/mapOpenSpec2.d.ts +9 -0
  339. package/lib/types/utils/mapOpenSpec3.d.ts +8 -0
  340. package/lib/types/utils/mapOpenSpecInfo.d.ts +6 -0
  341. package/lib/types/utils/mergeSpec.d.ts +2 -2
  342. package/lib/types/utils/serializeEnumValues.d.ts +5 -0
  343. package/lib/types/utils/transformToOS2.d.ts +25 -0
  344. package/package.json +35 -18
  345. package/readme.md +4 -2
  346. package/tsconfig.compile.esm.json +4 -13
  347. package/benchmark/cold-start.js +0 -17
  348. package/lib/cjs/components/index.js +0 -15
  349. package/lib/cjs/components/index.js.map +0 -1
  350. package/lib/cjs/decorators/index.js +0 -77
  351. package/lib/cjs/decorators/index.js.map +0 -1
  352. package/lib/cjs/domain/index.js +0 -20
  353. package/lib/cjs/domain/index.js.map +0 -1
  354. package/lib/cjs/interfaces/index.js +0 -8
  355. package/lib/cjs/interfaces/index.js.map +0 -1
  356. package/lib/esm/components/index.js +0 -12
  357. package/lib/esm/components/index.js.map +0 -1
  358. package/lib/esm/decorators/index.js +0 -74
  359. package/lib/esm/decorators/index.js.map +0 -1
  360. package/lib/esm/domain/index.js +0 -17
  361. package/lib/esm/domain/index.js.map +0 -1
  362. package/lib/esm/interfaces/index.js +0 -5
  363. package/lib/esm/interfaces/index.js.map +0 -1
  364. package/lib/types/components/index.d.ts +0 -11
  365. package/lib/types/decorators/index.d.ts +0 -68
  366. package/lib/types/domain/index.d.ts +0 -16
  367. package/lib/types/interfaces/index.d.ts +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../../src/decorators/common/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,eAAe,GAAG,CAAC,SAAc,EAAE,EAAE;IACzC,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,GAAQ,EAAE,EAAE;QAC1D,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE;YACf,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;YAE7B,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SAC1B;QAED,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AAmGF,MAAM,UAAU,IAAI,CAAC,SAAgC,EAAE,GAAG,UAA6B;IACrF,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,MAAM,MAAM,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YAClE,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE;gBACrC,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;aAChC;YAED,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAa,EAAE,KAAU,EAAE,EAAE;YACxD,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC;QACzD,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAEd,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {isObject} from \"@tsed/core\";\nimport type {JSONSchema6Type} from \"json-schema\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\nconst transformTsEnum = (enumValue: any) => {\n return Object.keys(enumValue).reduce((acc: any, key: any) => {\n if (isNaN(+key)) {\n const value = enumValue[key];\n\n return acc.concat(value);\n }\n\n return acc;\n }, []);\n};\n\n/**\n * The enum keyword is used to restrict a value to a fixed set of values.\n * It must be an array with at least one element, where each element is unique.\n *\n * Elements in the array might be of any value, including null.\n *\n * ::: warning\n * For v6 user, use @@Enum@@ from @tsed/schema instead of @tsed/common.\n * :::\n *\n * ## Example\n * ### With primitive type\n *\n * ```typescript\n * class Model {\n * @Enum(\"value1\", \"value2\")\n * property: \"value1\" | \"value2\";\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"string\",\n * \"enum\": [\"value1\", \"value2\"]\n * }\n * }\n * }\n * ```\n *\n * ### With array type\n *\n * ```typescript\n * class Model {\n * @Enum(\"value1\", \"value2\")\n * property: (\"value1\" | \"value2\")[];\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"array\",\n * \"items\": {\n * \"type\": \"string\",\n * \"enum\": [\"value1\", \"value2\"]\n * }\n * }\n * }\n * }\n * ```\n *\n * ### With Typescript Enum\n *\n * ```typescript\n * enum SomeEnum {\n * ENUM_1 = \"enum1\",\n * ENUM_2 = \"enum2\"\n * }\n *\n * class Model {\n * @Enum(SomeEnum)\n * property: SomeEnum;\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"string\",\n * \"enum\": [\"enum1\", \"enum2\"]\n * }\n * }\n * }\n * ```\n *\n * @param {string | number | boolean | {}} enumValue\n * @param enumValues\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n */\nexport function Enum(...enumValues: (JSONSchema6Type | any)[]): Function;\nexport function Enum(enumValue: JSONSchema6Type | any, ...enumValues: JSONSchema6Type[]) {\n return JsonEntityFn((store) => {\n const values = [enumValue].concat(enumValues).reduce((acc, value) => {\n if (isObject(value) && value !== null) {\n value = transformTsEnum(value);\n }\n\n return acc.concat(value);\n }, []);\n\n const types = values.reduce((set: Set<any>, value: any) => {\n return set.add(value === null ? \"null\" : typeof value);\n }, new Set());\n\n store.itemSchema.enum(values).any(...types);\n });\n}\n"]}
1
+ {"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../../src/decorators/common/enum.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAmG5C,MAAM,UAAU,IAAI,CAAC,SAAgC,EAAE,GAAG,UAA6B;IACrF,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,UAAU,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type {JSONSchema6Type} from \"json-schema\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * The enum keyword is used to restrict a value to a fixed set of values.\n * It must be an array with at least one element, where each element is unique.\n *\n * Elements in the array might be of any value, including null.\n *\n * ::: warning\n * For v6 user, use @@Enum@@ from @tsed/schema instead of @tsed/common.\n * :::\n *\n * ## Example\n * ### With primitive type\n *\n * ```typescript\n * class Model {\n * @Enum(\"value1\", \"value2\")\n * property: \"value1\" | \"value2\";\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"string\",\n * \"enum\": [\"value1\", \"value2\"]\n * }\n * }\n * }\n * ```\n *\n * ### With array type\n *\n * ```typescript\n * class Model {\n * @Enum(\"value1\", \"value2\")\n * property: (\"value1\" | \"value2\")[];\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"array\",\n * \"items\": {\n * \"type\": \"string\",\n * \"enum\": [\"value1\", \"value2\"]\n * }\n * }\n * }\n * }\n * ```\n *\n * ### With Typescript Enum\n *\n * ```typescript\n * enum SomeEnum {\n * ENUM_1 = \"enum1\",\n * ENUM_2 = \"enum2\"\n * }\n *\n * class Model {\n * @Enum(SomeEnum)\n * property: SomeEnum;\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"property\": {\n * \"type\": \"string\",\n * \"enum\": [\"enum1\", \"enum2\"]\n * }\n * }\n * }\n * ```\n *\n * @param {string | number | boolean | {}} enumValue\n * @param enumValues\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n */\nexport function Enum(...enumValues: (JSONSchema6Type | any)[]): Function;\nexport function Enum(enumValue: JSONSchema6Type | any, ...enumValues: JSONSchema6Type[]) {\n return JsonEntityFn((store) => {\n store.itemSchema.enum(enumValue, ...enumValues);\n });\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * Add a example metadata on the decorated element.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * Add a examples metadata on the decorated element.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { Maximum } from "./maximum";
1
+ import { Maximum } from "./maximum.js";
2
2
  /**
3
3
  * The value of `exclusiveMaximum` MUST be number, representing an exclusive upper limit for a numeric instance.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { Minimum } from "./minimum";
1
+ import { Minimum } from "./minimum.js";
2
2
  /**
3
3
  * The value of `exclusiveMinimum` MUST be number, representing an exclusive upper limit for a numeric instance.
4
4
  *
@@ -1,5 +1,5 @@
1
- import { JsonFormatTypes } from "../../domain/JsonFormatTypes";
2
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonFormatTypes } from "../../domain/JsonFormatTypes.js";
2
+ import { JsonEntityFn } from "./jsonEntityFn.js";
3
3
  /**
4
4
  * The following formats are supported for string validation with `format` keyword:
5
5
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * Allow to forward group on specific property.
4
4
  *
@@ -1,6 +1,6 @@
1
1
  import { DecoratorTypes } from "@tsed/core";
2
- import { matchGroups } from "../../utils/matchGroups";
3
- import { JsonEntityFn } from "./jsonEntityFn";
2
+ import { matchGroups } from "../../utils/matchGroups.js";
3
+ import { JsonEntityFn } from "./jsonEntityFn.js";
4
4
  /**
5
5
  * @ignore
6
6
  */
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * @ignore
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ignore.js","sourceRoot":"","sources":["../../../../src/decorators/common/ignore.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,MAAM,SAAS,GAAG,CAAC,KAAU,EAAE,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,IAAI,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,UAAU,MAAM,CAAC,KAA+B,SAAS;IAC7D,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {IgnoreCallback} from \"../../interfaces\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * @ignore\n */\nconst defaultCB = (value: any, ctx: any) => ctx.mongoose !== true;\n\n/**\n * Ignore the property when JsonMapper serialize the class to a Plain Object JavaScript.\n *\n * ::: warning\n * Swagger will not generate documentation for the ignored property.\n * :::\n *\n * ```typescript\n * class User {\n * @Ignore()\n * _id: string;\n *\n * @Property()\n * firstName: string;\n *\n * @Property()\n * lastName: string;\n *\n * @Ignore((value, ctx) => !ctx.mongoose) // don't ignore prop only if mongoose\n * password: string;\n * }\n * ```\n *\n * The controller:\n * ```typescript\n * import {Post, Controller, BodyParams} from \"@tsed/common\";\n * import {Person} from \"../models/Person\";\n *\n * @Controller(\"/\")\n * export class UsersCtrl {\n * @Get(\"/\")\n * get(): User {\n * const user = new User();\n * user._id = \"12345\";\n * user.firstName = \"John\";\n * user.lastName = \"Doe\";\n * user.password = \"secretpassword\";\n * return\n * }\n * }\n * ```\n *\n * The expected json object:\n *\n * ```json\n * {\n * \"firstName\": \"John\",\n * \"lastName\": \"Doe\"\n * }\n * ```\n * @param cb Callback to know if the property must be ignored\n * @decorator\n * @validation\n * @swagger\n * @schema\n */\nexport function Ignore(cb: boolean | IgnoreCallback = defaultCB) {\n return JsonEntityFn((store) => {\n store.schema.ignore(cb);\n });\n}\n"]}
1
+ {"version":3,"file":"ignore.js","sourceRoot":"","sources":["../../../../src/decorators/common/ignore.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,MAAM,SAAS,GAAG,CAAC,KAAU,EAAE,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,IAAI,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,UAAU,MAAM,CAAC,KAA+B,SAAS;IAC7D,OAAO,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE;QAC5B,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {IgnoreCallback} from \"../../interfaces/IgnoreCallback\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * @ignore\n */\nconst defaultCB = (value: any, ctx: any) => ctx.mongoose !== true;\n\n/**\n * Ignore the property when JsonMapper serialize the class to a Plain Object JavaScript.\n *\n * ::: warning\n * Swagger will not generate documentation for the ignored property.\n * :::\n *\n * ```typescript\n * class User {\n * @Ignore()\n * _id: string;\n *\n * @Property()\n * firstName: string;\n *\n * @Property()\n * lastName: string;\n *\n * @Ignore((value, ctx) => !ctx.mongoose) // don't ignore prop only if mongoose\n * password: string;\n * }\n * ```\n *\n * The controller:\n * ```typescript\n * import {Post, Controller, BodyParams} from \"@tsed/common\";\n * import {Person} from \"../models/Person\";\n *\n * @Controller(\"/\")\n * export class UsersCtrl {\n * @Get(\"/\")\n * get(): User {\n * const user = new User();\n * user._id = \"12345\";\n * user.firstName = \"John\";\n * user.lastName = \"Doe\";\n * user.password = \"secretpassword\";\n * return\n * }\n * }\n * ```\n *\n * The expected json object:\n *\n * ```json\n * {\n * \"firstName\": \"John\",\n * \"lastName\": \"Doe\"\n * }\n * ```\n * @param cb Callback to know if the property must be ignored\n * @decorator\n * @validation\n * @swagger\n * @schema\n */\nexport function Ignore(cb: boolean | IgnoreCallback = defaultCB) {\n return JsonEntityFn((store) => {\n store.schema.ignore(cb);\n });\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * Set integer type.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { getJsonEntityStore } from "../../utils/getJsonEntityStore";
1
+ import { getJsonEntityStore } from "../../utils/getJsonEntityStore.js";
2
2
  /**
3
3
  * Decorator util to compose another decorator. See @@Description@@ decorator implementation for more details.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"jsonEntityFn.js","sourceRoot":"","sources":["../../../../src/decorators/common/jsonEntityFn.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,YAAY,CAC1B,EAAuD;IAEvD,OAAO,CAAC,GAAG,UAA+B,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAQ,EAAE,CAAC,kBAAkB,CAAI,GAAG,UAAU,CAAM,EAAE,UAAU,CAAC,CAAC;QAC9E,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;YAChC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC;SACvB;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {DecoratorParameters} from \"@tsed/core\";\nimport type {JsonEntityStore} from \"../../domain\";\nimport {getJsonEntityStore} from \"../../utils/getJsonEntityStore\";\n\n/**\n * Decorator util to compose another decorator. See @@Description@@ decorator implementation for more details.\n *\n * ## Usage\n *\n * ```typescript\n * export function Description(description: any) {\n * return JsonEntityFn((entity: JsonEntityStore, args: DecoratorParameters) => {\n * entity.itemSchema.description(description)\n * });\n * }\n * ```\n *\n * @param fn\n * @decorator\n * @utils\n * @model\n */\nexport function JsonEntityFn<T extends JsonEntityStore = JsonEntityStore>(\n fn: (entity: T, parameters: DecoratorParameters) => any\n): (...args: any[]) => any {\n return (...parameters: DecoratorParameters) => {\n const result: any = fn(getJsonEntityStore<T>(...parameters) as T, parameters);\n if (typeof result === \"function\") {\n result(...parameters);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"jsonEntityFn.js","sourceRoot":"","sources":["../../../../src/decorators/common/jsonEntityFn.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AAElE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,YAAY,CAC1B,EAAuD;IAEvD,OAAO,CAAC,GAAG,UAA+B,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAQ,EAAE,CAAC,kBAAkB,CAAI,GAAG,UAAU,CAAM,EAAE,UAAU,CAAC,CAAC;QAC9E,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;YAChC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC;SACvB;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {DecoratorParameters} from \"@tsed/core\";\nimport type {JsonEntityStore} from \"../../domain/JsonEntityStore\";\nimport {getJsonEntityStore} from \"../../utils/getJsonEntityStore\";\n\n/**\n * Decorator util to compose another decorator. See @@Description@@ decorator implementation for more details.\n *\n * ## Usage\n *\n * ```typescript\n * export function Description(description: any) {\n * return JsonEntityFn((entity: JsonEntityStore, args: DecoratorParameters) => {\n * entity.itemSchema.description(description)\n * });\n * }\n * ```\n *\n * @param fn\n * @decorator\n * @utils\n * @model\n */\nexport function JsonEntityFn<T extends JsonEntityStore = JsonEntityStore>(\n fn: (entity: T, parameters: DecoratorParameters) => any\n): (...args: any[]) => any {\n return (...parameters: DecoratorParameters) => {\n const result: any = fn(getJsonEntityStore<T>(...parameters) as T, parameters);\n if (typeof result === \"function\") {\n result(...parameters);\n }\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * The value of `maximum` MUST be a number, representing an inclusive upper limit for a numeric instance.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  *
4
4
  * A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * The value of `minimum` MUST be a number, representing an inclusive upper limit for a numeric instance.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * A numeric instance is valid only if division by this keyword's value results in an integer.
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import { decoratorTypeOf, DecoratorTypes } from "@tsed/core";
2
- import { JsonEntityFn } from "../common/jsonEntityFn";
2
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
3
3
  /**
4
4
  * Add a name metadata on the decorated element.
5
5
  *
@@ -1,6 +1,6 @@
1
1
  import { useDecorators } from "@tsed/core";
2
- import { Any } from "./any";
3
- import { Property } from "./property";
2
+ import { Any } from "./any.js";
3
+ import { Property } from "./property.js";
4
4
  /**
5
5
  * Set field as nullable.
6
6
  *
@@ -1,7 +1,11 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
4
4
  *
5
+ * ::: warning
6
+ * OneOf isn't supported by OS2
7
+ * :::
8
+ *
5
9
  * @decorator
6
10
  * @validation
7
11
  * @swagger
@@ -1 +1 @@
1
- {"version":3,"file":"oneOf.js","sourceRoot":"","sources":["../../../../src/decorators/common/oneOf.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,KAAK,CAAC,GAAG,KAAsB;IAC7C,OAAO,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE;QAC7B,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {AnyJsonSchema} from \"../../domain/JsonSchema\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28\n *\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @classDecorator\n * @input\n * @param oneOf\n */\nexport function OneOf(...oneOf: AnyJsonSchema[]) {\n return JsonEntityFn((entity) => {\n entity.itemSchema.oneOf(oneOf);\n entity.type = Object;\n });\n}\n"]}
1
+ {"version":3,"file":"oneOf.js","sourceRoot":"","sources":["../../../../src/decorators/common/oneOf.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,KAAK,CAAC,GAAG,KAAsB;IAC7C,OAAO,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE;QAC7B,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {AnyJsonSchema} from \"../../domain/JsonSchema\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\n\n/**\n * See https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28\n *\n * ::: warning\n * OneOf isn't supported by OS2\n * :::\n *\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @classDecorator\n * @input\n * @param oneOf\n */\nexport function OneOf(...oneOf: AnyJsonSchema[]) {\n return JsonEntityFn((entity) => {\n entity.itemSchema.oneOf(oneOf);\n entity.type = Object;\n });\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { DecoratorTypes } from "@tsed/core";
2
- import { JsonEntityFn } from "./jsonEntityFn";
2
+ import { JsonEntityFn } from "./jsonEntityFn.js";
3
3
  /**
4
4
  * Add optional annotation on Property or Parameter.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * The pattern and Pattern Properties keywords use regular expressions to express constraints.
4
4
  * The regular expression syntax used is from JavaScript (ECMA 262, specifically). However, that complete syntax is not widely supported, therefore it is recommended that you stick to the subset of that syntax described below.
@@ -1,5 +1,5 @@
1
1
  import { isClass } from "@tsed/core";
2
- import { JsonEntityFn } from "./jsonEntityFn";
2
+ import { JsonEntityFn } from "./jsonEntityFn.js";
3
3
  /**
4
4
  * Declare a new property on a model.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * Set the property as readOnly.
4
4
  *
@@ -0,0 +1,59 @@
1
+ import { Schema } from "./schema.js";
2
+ /**
3
+ * Constructs a json schema object type whose property keys are keys and whose property values are type.
4
+ *
5
+ * ## Example
6
+ *
7
+ * ```typescript
8
+ * type keys = 'one' | 'two';
9
+ *
10
+ * class Part {
11
+ * prop: string;
12
+ * }
13
+ *
14
+ * type Parts = Record<keys, Part>;
15
+ *
16
+ * class Test {
17
+ * @RecordOf(Part, 'one', 'two')
18
+ * parts: Parts;
19
+ * }
20
+ * ```
21
+ *
22
+ * Will produce:
23
+ *
24
+ * ```json
25
+ * {
26
+ * "type": "object",
27
+ * "properties": {
28
+ * "one": {
29
+ * "$ref": "#/components/schemas/Part"
30
+ * },
31
+ * "two": {
32
+ * "$ref": "#/components/schemas/Part"
33
+ * },
34
+ * },
35
+ * }
36
+ * ```
37
+ *
38
+ * @param model
39
+ * @param keys
40
+ * @decorator
41
+ * @validation
42
+ * @swagger
43
+ * @schema
44
+ * @classDecorator
45
+ * @input
46
+ */
47
+ export function RecordOf(model, ...keys) {
48
+ return Schema({
49
+ properties: {
50
+ ...keys.reduce((initial, key) => {
51
+ return {
52
+ ...initial,
53
+ [key]: model
54
+ };
55
+ }, {})
56
+ }
57
+ });
58
+ }
59
+ //# sourceMappingURL=recordOf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordOf.js","sourceRoot":"","sources":["../../../../src/decorators/common/recordOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAU,EAAE,GAAG,IAAc;IACpD,OAAO,MAAM,CAAC;QACZ,UAAU,EAAE;YACV,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE;gBAC9B,OAAO;oBACL,GAAG,OAAO;oBACV,CAAC,GAAG,CAAC,EAAE,KAAK;iBACb,CAAC;YACJ,CAAC,EAAE,EAAE,CAAC;SACP;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {Schema} from \"./schema\";\n\n/**\n * Constructs a json schema object type whose property keys are keys and whose property values are type.\n *\n * ## Example\n *\n * ```typescript\n * type keys = 'one' | 'two';\n *\n * class Part {\n * prop: string;\n * }\n *\n * type Parts = Record<keys, Part>;\n *\n * class Test {\n * @RecordOf(Part, 'one', 'two')\n * parts: Parts;\n * }\n * ```\n *\n * Will produce:\n *\n * ```json\n * {\n * \"type\": \"object\",\n * \"properties\": {\n * \"one\": {\n * \"$ref\": \"#/components/schemas/Part\"\n * },\n * \"two\": {\n * \"$ref\": \"#/components/schemas/Part\"\n * },\n * },\n * }\n * ```\n *\n * @param model\n * @param keys\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @classDecorator\n * @input\n */\nexport function RecordOf(model: any, ...keys: string[]) {\n return Schema({\n properties: {\n ...keys.reduce((initial, key) => {\n return {\n ...initial,\n [key]: model\n };\n }, {})\n }\n });\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { Allow } from "./allow";
2
- import { Optional } from "./optional";
1
+ import { Allow } from "./allow.js";
2
+ import { Optional } from "./optional.js";
3
3
  /**
4
4
  * Add required annotation on Property or Parameter.
5
5
  *
@@ -1,5 +1,5 @@
1
- import { matchGroups } from "../../utils/matchGroups";
2
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { matchGroups } from "../../utils/matchGroups.js";
2
+ import { JsonEntityFn } from "./jsonEntityFn.js";
3
3
  /**
4
4
  * Apply groups validation strategy for required property.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * Write data formatted to JsonSchema.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * Add title metadata on the decorated element.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * Set the property as WriteOnly.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntitiesContainer } from "../../domain/JsonEntityStore";
1
+ import { JsonEntitiesContainer } from "../../domain/JsonEntityStore.js";
2
2
  /**
3
3
  * Declare a new JsonEntityStore class for a specific decorator type.
4
4
  *
@@ -1,6 +1,6 @@
1
1
  import { isObject } from "@tsed/core";
2
- import { JsonEntityStore } from "../../domain/JsonEntityStore";
3
- import { string } from "../../utils/from";
2
+ import { JsonEntityStore } from "../../domain/JsonEntityStore.js";
3
+ import { string } from "../../utils/from.js";
4
4
  /**
5
5
  * @ignore
6
6
  */
@@ -1,4 +1,4 @@
1
- import { JsonEntityStore } from "../../domain/JsonEntityStore";
1
+ import { JsonEntityStore } from "../../domain/JsonEntityStore.js";
2
2
  /**
3
3
  * Define generics list. This list is used by @@GenericOf@@ and the @@getJsonSchema@@ function to build the correct JsonSchema.
4
4
  *
@@ -0,0 +1,24 @@
1
+ import { StoreSet, useDecorators } from "@tsed/core";
2
+ import { Produces } from "./produces.js";
3
+ /**
4
+ * Set a mime list which are acceptable and checks if the specified content types are acceptable, based on the request’s Accept HTTP header field.
5
+ *
6
+ * ```typescript
7
+ * @Controller('/mypath')
8
+ * export class MyCtrl {
9
+ *
10
+ * @Get('/')
11
+ * @AcceptMime('application/json')
12
+ * public getResource(){}
13
+ * }
14
+ * ```
15
+ *
16
+ * @param mimes
17
+ * @decorator
18
+ * @operation
19
+ * @response
20
+ */
21
+ export function AcceptMime(...mimes) {
22
+ return useDecorators(Produces(...mimes), StoreSet("acceptMimes", mimes));
23
+ }
24
+ //# sourceMappingURL=acceptMime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acceptMime.js","sourceRoot":"","sources":["../../../../src/decorators/operations/acceptMime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,UAAU,CAAC,GAAG,KAAe;IAC3C,OAAO,aAAa,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,EAAE,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["import {StoreSet, useDecorators} from \"@tsed/core\";\nimport {Produces} from \"./produces\";\n\n/**\n * Set a mime list which are acceptable and checks if the specified content types are acceptable, based on the request’s Accept HTTP header field.\n *\n * ```typescript\n * @Controller('/mypath')\n * export class MyCtrl {\n *\n * @Get('/')\n * @AcceptMime('application/json')\n * public getResource(){}\n * }\n * ```\n *\n * @param mimes\n * @decorator\n * @operation\n * @response\n */\nexport function AcceptMime(...mimes: string[]): Function {\n return useDecorators(Produces(...mimes), StoreSet(\"acceptMimes\", mimes));\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { decorateMethodsOf, DecoratorTypes, UnsupportedDecoratorType } from "@tsed/core";
2
- import { JsonEntityFn } from "../common/jsonEntityFn";
2
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
3
3
  /**
4
4
  * Add consumes metadata on the decorated element.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { Returns } from "./returns";
1
+ import { Returns } from "./returns.js";
2
2
  /**
3
3
  * Sets the Content-Type HTTP header to the MIME type as determined by mime.lookup() for the specified type.
4
4
  * If type contains the “/” character, then it sets the `Content-Type` to type.
@@ -1,5 +1,5 @@
1
1
  import { decorateMethodsOf, DecoratorTypes, UnsupportedDecoratorType } from "@tsed/core";
2
- import { JsonEntityFn } from "../common/jsonEntityFn";
2
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
3
3
  /**
4
4
  * Add deprecated metadata on the decorated element.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { Returns } from "./returns";
1
+ import { Returns } from "./returns.js";
2
2
  /**
3
3
  * Sets the response’s HTTP header field to value. To set multiple fields at once, pass an object as the parameter.
4
4
  *
@@ -1,5 +1,7 @@
1
1
  import { decorateMethodsOf, DecoratorTypes, UnsupportedDecoratorType } from "@tsed/core";
2
- import { JsonEntityStore, JsonParameter, JsonSchema } from "../../domain";
2
+ import { JsonEntityStore } from "../../domain/JsonEntityStore.js";
3
+ import { JsonParameter } from "../../domain/JsonParameter.js";
4
+ import { JsonSchema } from "../../domain/JsonSchema.js";
3
5
  /**
4
6
  * Add a input parameter.
5
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"in.js","sourceRoot":"","sources":["../../../../src/decorators/operations/in.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAQ,wBAAwB,EAAC,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAC,eAAe,EAAmB,aAAa,EAAsB,UAAU,EAAmB,MAAM,cAAc,CAAC;AA+C/H;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,EAAE,CAAC,MAAmC;IACpD,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAQ,EAAE,CAAC;IAEvB,MAAM,SAAS,GAAG,CAAC,MAAW,EAAE,WAA6B,EAAE,KAAmC,EAAE,EAAE;QACpG,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QAE/D,QAAQ,KAAK,CAAC,aAAa,EAAE;YAC3B,KAAK,cAAc,CAAC,KAAK;gBACtB,KAA4B,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;gBACnD,MAAM;YACR,KAAK,cAAc,CAAC,MAAM;gBACxB,aAAa,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;gBACxB,KAAyB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;gBAErE,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC9C,MAAM;YAER,KAAK,cAAc,CAAC,KAAK;gBACvB,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;gBACrC,MAAM;YAER;gBACE,MAAM,IAAI,wBAAwB,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;SACxE;IACH,CAAC,CAAC;IAEF,SAAS,CAAC,IAAI,GAAG,CAAC,IAAe,EAAE,EAAE;QACnC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QAEnB,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,SAAS,CAAC,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE;QAChC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzB,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,CAAC,WAAmB,EAAE,EAAE;QAC9C,aAAa,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAEvC,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,SAAS,CAAC,QAAQ,GAAG,CAAC,WAAoB,IAAI,EAAE,EAAE;QAChD,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEjC,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,SAAS,CAAC,OAAO,GAAG,CAAC,OAAwB,EAAE,EAAE;QAC/C,OAAO,SAAS,CAAC,MAAM,CAAC,EAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAC,CAAC,CAAC;IACzD,CAAC,CAAC;IAEF,SAAS,CAAC,MAAM,GAAG,CAAC,OAAY,EAAE,EAAE;QAClC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE/B,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import {decorateMethodsOf, DecoratorTypes, Type, UnsupportedDecoratorType} from \"@tsed/core\";\nimport {JsonEntityStore, JsonMethodStore, JsonParameter, JsonParameterStore, JsonSchema, JsonSchemaObject} from \"../../domain\";\nimport {JsonParameterTypes} from \"../../domain/JsonParameterTypes\";\n\nexport interface InChainedDecorators {\n <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;\n\n (target: Object, propertyKey: string | symbol, parameterIndex: number): void;\n\n (target: Function): void;\n\n /**\n * Type of this in parameter\n * @param type\n */\n Type(type: Type<any>): this;\n\n /**\n *\n * @param name\n */\n Name(name: string): this;\n\n /**\n *\n * @param description\n */\n Description(description: string): this;\n\n /**\n *\n * @param required\n */\n Required(required?: boolean): this;\n\n /**\n * Add pattern constraint. Only available for OPENAPI.\n * @param pattern\n */\n Pattern(pattern: string | RegExp): this;\n\n /**\n * Add custom schema.\n * @param schema\n */\n Schema(schema: Partial<JsonSchemaObject>): this;\n}\n\n/**\n * Add a input parameter.\n *\n * ::: warning\n * Don't use decorator with Ts.ED application to decorate parameters. Use @@BodyParams@@, @@PathParams@@, etc... instead.\n * But you can use this decorator on Method, to add extra in parameters like Authorization header.\n *\n * ```typescript\n * @Controller(\"/\")\n * class MyController {\n * @Get(\"/\")\n * @In(\"header\").Type(String).Name(\"Authorization\").Required()\n * method() {\n * }\n * }\n * ```\n * :::\n *\n * @param inType\n * @decorator\n * @swagger\n * @schema\n * @input\n * @operation\n */\nexport function In(inType: JsonParameterTypes | string): InChainedDecorators {\n const jsonParameter = new JsonParameter();\n const schema: any = {};\n\n const decorator = (target: any, propertyKey?: string | symbol, index?: PropertyDescriptor | number) => {\n const store = JsonEntityStore.from(target, propertyKey, index);\n\n switch (store.decoratorType) {\n case DecoratorTypes.PARAM:\n (store as JsonParameterStore).parameter.in(inType);\n break;\n case DecoratorTypes.METHOD:\n jsonParameter.in(inType);\n (store as JsonMethodStore).operation.addParameter(-1, jsonParameter);\n\n jsonParameter.schema(JsonSchema.from(schema));\n break;\n\n case DecoratorTypes.CLASS:\n decorateMethodsOf(target, decorator);\n break;\n\n default:\n throw new UnsupportedDecoratorType(In, [target, propertyKey, index]);\n }\n };\n\n decorator.Type = (type: Type<any>) => {\n schema.type = type;\n\n return decorator;\n };\n\n decorator.Name = (name: string) => {\n jsonParameter.name(name);\n\n return decorator;\n };\n\n decorator.Description = (description: string) => {\n jsonParameter.description(description);\n\n return decorator;\n };\n\n decorator.Required = (required: boolean = true) => {\n jsonParameter.required(required);\n\n return decorator;\n };\n\n decorator.Pattern = (pattern: string | RegExp) => {\n return decorator.Schema({pattern: pattern.toString()});\n };\n\n decorator.Schema = (_schema: any) => {\n Object.assign(schema, _schema);\n\n return decorator;\n };\n\n return decorator;\n}\n"]}
1
+ {"version":3,"file":"in.js","sourceRoot":"","sources":["../../../../src/decorators/operations/in.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,cAAc,EAAQ,wBAAwB,EAAC,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AAGzD,OAAO,EAAC,UAAU,EAAmB,MAAM,yBAAyB,CAAC;AA8CrE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,EAAE,CAAC,MAAmC;IACpD,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;IAC1C,MAAM,MAAM,GAAQ,EAAE,CAAC;IAEvB,MAAM,SAAS,GAAG,CAAC,MAAW,EAAE,WAA6B,EAAE,KAAmC,EAAE,EAAE;QACpG,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QAE/D,QAAQ,KAAK,CAAC,aAAa,EAAE;YAC3B,KAAK,cAAc,CAAC,KAAK;gBACtB,KAA4B,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;gBACnD,MAAM;YACR,KAAK,cAAc,CAAC,MAAM;gBACxB,aAAa,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;gBACxB,KAAyB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;gBAErE,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC9C,MAAM;YAER,KAAK,cAAc,CAAC,KAAK;gBACvB,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;gBACrC,MAAM;YAER;gBACE,MAAM,IAAI,wBAAwB,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;SACxE;IACH,CAAC,CAAC;IAEF,SAAS,CAAC,IAAI,GAAG,CAAC,IAAe,EAAE,EAAE;QACnC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QAEnB,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,SAAS,CAAC,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE;QAChC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEzB,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,SAAS,CAAC,WAAW,GAAG,CAAC,WAAmB,EAAE,EAAE;QAC9C,aAAa,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAEvC,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,SAAS,CAAC,QAAQ,GAAG,CAAC,WAAoB,IAAI,EAAE,EAAE;QAChD,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEjC,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,SAAS,CAAC,OAAO,GAAG,CAAC,OAAwB,EAAE,EAAE;QAC/C,OAAO,SAAS,CAAC,MAAM,CAAC,EAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAC,CAAC,CAAC;IACzD,CAAC,CAAC;IAEF,SAAS,CAAC,MAAM,GAAG,CAAC,OAAY,EAAE,EAAE;QAClC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE/B,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import {decorateMethodsOf, DecoratorTypes, Type, UnsupportedDecoratorType} from \"@tsed/core\";\nimport {JsonEntityStore} from \"../../domain/JsonEntityStore\";\nimport {JsonMethodStore} from \"../../domain/JsonMethodStore\";\nimport {JsonParameter} from \"../../domain/JsonParameter\";\nimport {JsonParameterStore} from \"../../domain/JsonParameterStore\";\nimport {JsonParameterTypes} from \"../../domain/JsonParameterTypes\";\nimport {JsonSchema, JsonSchemaObject} from \"../../domain/JsonSchema\";\n\nexport interface InChainedDecorators {\n <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;\n\n (target: Object, propertyKey: string | symbol, parameterIndex: number): void;\n\n (target: Function): void;\n\n /**\n * Type of this in parameter\n * @param type\n */\n Type(type: Type<any>): this;\n\n /**\n *\n * @param name\n */\n Name(name: string): this;\n\n /**\n *\n * @param description\n */\n Description(description: string): this;\n\n /**\n *\n * @param required\n */\n Required(required?: boolean): this;\n\n /**\n * Add pattern constraint. Only available for OPENAPI.\n * @param pattern\n */\n Pattern(pattern: string | RegExp): this;\n\n /**\n * Add custom schema.\n * @param schema\n */\n Schema(schema: Partial<JsonSchemaObject>): this;\n}\n\n/**\n * Add a input parameter.\n *\n * ::: warning\n * Don't use decorator with Ts.ED application to decorate parameters. Use @@BodyParams@@, @@PathParams@@, etc... instead.\n * But you can use this decorator on Method, to add extra in parameters like Authorization header.\n *\n * ```typescript\n * @Controller(\"/\")\n * class MyController {\n * @Get(\"/\")\n * @In(\"header\").Type(String).Name(\"Authorization\").Required()\n * method() {\n * }\n * }\n * ```\n * :::\n *\n * @param inType\n * @decorator\n * @swagger\n * @schema\n * @input\n * @operation\n */\nexport function In(inType: JsonParameterTypes | string): InChainedDecorators {\n const jsonParameter = new JsonParameter();\n const schema: any = {};\n\n const decorator = (target: any, propertyKey?: string | symbol, index?: PropertyDescriptor | number) => {\n const store = JsonEntityStore.from(target, propertyKey, index);\n\n switch (store.decoratorType) {\n case DecoratorTypes.PARAM:\n (store as JsonParameterStore).parameter.in(inType);\n break;\n case DecoratorTypes.METHOD:\n jsonParameter.in(inType);\n (store as JsonMethodStore).operation.addParameter(-1, jsonParameter);\n\n jsonParameter.schema(JsonSchema.from(schema));\n break;\n\n case DecoratorTypes.CLASS:\n decorateMethodsOf(target, decorator);\n break;\n\n default:\n throw new UnsupportedDecoratorType(In, [target, propertyKey, index]);\n }\n };\n\n decorator.Type = (type: Type<any>) => {\n schema.type = type;\n\n return decorator;\n };\n\n decorator.Name = (name: string) => {\n jsonParameter.name(name);\n\n return decorator;\n };\n\n decorator.Description = (description: string) => {\n jsonParameter.description(description);\n\n return decorator;\n };\n\n decorator.Required = (required: boolean = true) => {\n jsonParameter.required(required);\n\n return decorator;\n };\n\n decorator.Pattern = (pattern: string | RegExp) => {\n return decorator.Schema({pattern: pattern.toString()});\n };\n\n decorator.Schema = (_schema: any) => {\n Object.assign(schema, _schema);\n\n return decorator;\n };\n\n return decorator;\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  import { Metadata, useDecorators, useMethodDecorators } from "@tsed/core";
2
- import { In } from "./in";
3
- import { JsonParameterTypes } from "../../domain/JsonParameterTypes";
4
- import { Returns } from "./returns";
5
- import { Name } from "../common/name";
6
- import { Consumes } from "./consumes";
2
+ import { In } from "./in.js";
3
+ import { JsonParameterTypes } from "../../domain/JsonParameterTypes.js";
4
+ import { Returns } from "./returns.js";
5
+ import { Name } from "../common/name.js";
6
+ import { Consumes } from "./consumes.js";
7
7
  /**
8
8
  * Add a input file parameter.
9
9
  *
@@ -1,4 +1,4 @@
1
- import { Returns } from "./returns";
1
+ import { Returns } from "./returns.js";
2
2
  /**
3
3
  * Sets the response Location HTTP header to the specified path parameter.
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import { DecoratorTypes, UnsupportedDecoratorType } from "@tsed/core";
2
- import { JsonEntityFn } from "../common/jsonEntityFn";
2
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
3
3
  /**
4
4
  * Set a swagger operationId explicitly.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import { DecoratorTypes, UnsupportedDecoratorType } from "@tsed/core";
2
- import { JsonEntityFn } from "../common/jsonEntityFn";
2
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
3
3
  /**
4
4
  * Declare new Operation with his path and http method.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { Groups } from "../common/groups";
1
+ import { Groups } from "../common/groups.js";
2
2
  /**
3
3
  * Apply Partial group strategy on the input model
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import { DecoratorTypes, UnsupportedDecoratorType } from "@tsed/core";
2
- import { JsonEntityFn } from "../common/jsonEntityFn";
2
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
3
3
  /**
4
4
  * Set class path to expose all endpoints
5
5
  *
@@ -1,5 +1,5 @@
1
1
  import { decorateMethodsOf, DecoratorTypes, UnsupportedDecoratorType } from "@tsed/core";
2
- import { JsonEntityFn } from "../common/jsonEntityFn";
2
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
3
3
  /**
4
4
  * Add produces metadata on the decorated element.
5
5
  *
@@ -1,6 +1,6 @@
1
1
  import { isNumber, isString, useDecorators } from "@tsed/core";
2
- import { JsonEntityFn } from "../common/jsonEntityFn";
3
- import { Returns } from "./returns";
2
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
3
+ import { Returns } from "./returns.js";
4
4
  export function Redirect(...args) {
5
5
  const { status, url, meta } = args.reduce((options, value) => {
6
6
  if (isNumber(value)) {
@@ -15,8 +15,7 @@ export function Redirect(...args) {
15
15
  return options;
16
16
  }, { status: 302, url: "", meta: {} });
17
17
  return useDecorators(Returns(status).Location(url, meta), JsonEntityFn((entity) => {
18
- var _a;
19
- (_a = entity.operation) === null || _a === void 0 ? void 0 : _a.setRedirection(status);
18
+ entity.operation?.setRedirection(status);
20
19
  }));
21
20
  }
22
21
  //# sourceMappingURL=redirect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"redirect.js","sourceRoot":"","sources":["../../../../src/decorators/operations/redirect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAqDlC,MAAM,UAAU,QAAQ,CAAC,GAAG,IAAW;IACrC,MAAM,EAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,MAAM,CACrC,CAAC,OAAY,EAAE,KAAU,EAAE,EAAE;QAC3B,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;YACnB,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;YACvB,OAAO,OAAO,CAAC;SAChB;QAED,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;YACnB,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC;YACpB,OAAO,OAAO,CAAC;SAChB;QAED,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;QACrB,OAAO,OAAO,CAAC;IACjB,CAAC,EACD,EAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAC,CACjC,CAAC;IACF,OAAO,aAAa,CAClB,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,EACnC,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE;;QACtB,MAAA,MAAM,CAAC,SAAS,0CAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC,CAAC,CACH,CAAC;AACJ,CAAC","sourcesContent":["import {isNumber, isString, useDecorators} from \"@tsed/core\";\nimport {JsonHeader} from \"../../interfaces/JsonOpenSpec\";\nimport {JsonEntityFn} from \"../common/jsonEntityFn\";\nimport {Returns} from \"./returns\";\n\n/**\n * Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code . If not specified, status defaults to “302 “Found”.\n *\n * ```typescript\n * @Redirect('/foo/bar')\n * @Redirect(301, 'http://example.com').Type(Model)\n * private myMethod() {}\n * ```\n * Redirects can be a fully-qualified URL for redirecting to a different site:\n *\n * ```typescript\n * @Redirect('http://google.com');\n * private myMethod() {}\n * ```\n *\n * Redirects can be relative to the root of the host name. For example, if the application is on http://example.com/admin/post/new, the following would redirect to the URL http://example.com/admin:\n *\n * ```typescript\n * @Redirect('/admin');\n * ```\n * Redirects can be relative to the current URL. For example, from http://example.com/blog/admin/ (notice the trailing slash), the following would redirect to the URL http://example.com/blog/admin/post/new.\n *\n * ```typescript\n * @Redirect('post/new');\n * ```\n *\n * Redirecting to post/new from http://example.com/blog/admin (no trailing slash), will redirect to http://example.com/blog/post/new.\n *\n * If you found the above behavior confusing, think of path segments as directories (with trailing slashes) and files, it will start to make sense.\n *\n * Path-relative redirects are also possible. If you were on http://example.com/admin/post/new, the following would redirect to http//example.com/admin/post:\n *\n * ```typescript\n * @Redirect('..');\n * ``\n *\n * A back redirection redirects the request back to the referer, defaulting to / when the referer is missing.\n *\n * ```typescript\n * @Redirect('back');\n * ```\n *\n * @param url\n * @param meta\n * @decorator\n * @operation\n * @response\n * @headers\n */\nexport function Redirect(url: string, meta?: JsonHeader): Function;\nexport function Redirect(status: number, url: string, meta?: JsonHeader): Function;\nexport function Redirect(...args: any[]): Function {\n const {status, url, meta} = args.reduce(\n (options: any, value: any) => {\n if (isNumber(value)) {\n options.status = value;\n return options;\n }\n\n if (isString(value)) {\n options.url = value;\n return options;\n }\n\n options.meta = value;\n return options;\n },\n {status: 302, url: \"\", meta: {}}\n );\n return useDecorators(\n Returns(status).Location(url, meta),\n JsonEntityFn((entity) => {\n entity.operation?.setRedirection(status);\n })\n );\n}\n"]}
1
+ {"version":3,"file":"redirect.js","sourceRoot":"","sources":["../../../../src/decorators/operations/redirect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAqDlC,MAAM,UAAU,QAAQ,CAAC,GAAG,IAAW;IACrC,MAAM,EAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,MAAM,CACrC,CAAC,OAAY,EAAE,KAAU,EAAE,EAAE;QAC3B,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;YACnB,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;YACvB,OAAO,OAAO,CAAC;SAChB;QAED,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;YACnB,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC;YACpB,OAAO,OAAO,CAAC;SAChB;QAED,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;QACrB,OAAO,OAAO,CAAC;IACjB,CAAC,EACD,EAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAC,CACjC,CAAC;IACF,OAAO,aAAa,CAClB,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,EACnC,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE;QACtB,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC,CAAC,CACH,CAAC;AACJ,CAAC","sourcesContent":["import {isNumber, isString, useDecorators} from \"@tsed/core\";\nimport {JsonHeader} from \"../../interfaces/JsonOpenSpec\";\nimport {JsonEntityFn} from \"../common/jsonEntityFn\";\nimport {Returns} from \"./returns\";\n\n/**\n * Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code . If not specified, status defaults to “302 “Found”.\n *\n * ```typescript\n * @Redirect('/foo/bar')\n * @Redirect(301, 'http://example.com').Type(Model)\n * private myMethod() {}\n * ```\n * Redirects can be a fully-qualified URL for redirecting to a different site:\n *\n * ```typescript\n * @Redirect('http://google.com');\n * private myMethod() {}\n * ```\n *\n * Redirects can be relative to the root of the host name. For example, if the application is on http://example.com/admin/post/new, the following would redirect to the URL http://example.com/admin:\n *\n * ```typescript\n * @Redirect('/admin');\n * ```\n * Redirects can be relative to the current URL. For example, from http://example.com/blog/admin/ (notice the trailing slash), the following would redirect to the URL http://example.com/blog/admin/post/new.\n *\n * ```typescript\n * @Redirect('post/new');\n * ```\n *\n * Redirecting to post/new from http://example.com/blog/admin (no trailing slash), will redirect to http://example.com/blog/post/new.\n *\n * If you found the above behavior confusing, think of path segments as directories (with trailing slashes) and files, it will start to make sense.\n *\n * Path-relative redirects are also possible. If you were on http://example.com/admin/post/new, the following would redirect to http//example.com/admin/post:\n *\n * ```typescript\n * @Redirect('..');\n * ``\n *\n * A back redirection redirects the request back to the referer, defaulting to / when the referer is missing.\n *\n * ```typescript\n * @Redirect('back');\n * ```\n *\n * @param url\n * @param meta\n * @decorator\n * @operation\n * @response\n * @headers\n */\nexport function Redirect(url: string, meta?: JsonHeader): Function;\nexport function Redirect(status: number, url: string, meta?: JsonHeader): Function;\nexport function Redirect(...args: any[]): Function {\n const {status, url, meta} = args.reduce(\n (options: any, value: any) => {\n if (isNumber(value)) {\n options.status = value;\n return options;\n }\n\n if (isString(value)) {\n options.url = value;\n return options;\n }\n\n options.meta = value;\n return options;\n },\n {status: 302, url: \"\", meta: {}}\n );\n return useDecorators(\n Returns(status).Location(url, meta),\n JsonEntityFn((entity) => {\n entity.operation?.setRedirection(status);\n })\n );\n}\n"]}