@tsed/schema 7.0.0-beta.3 → 7.0.0-beta.4

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 (299) hide show
  1. package/jest.config.js +4 -4
  2. package/lib/cjs/components/schemaMapper.js +1 -1
  3. package/lib/cjs/components/schemaMapper.js.map +1 -1
  4. package/lib/cjs/constants/httpStatusMessages.js +12 -96
  5. package/lib/cjs/constants/httpStatusMessages.js.map +1 -1
  6. package/lib/cjs/decorators/common/anyOf.js +4 -0
  7. package/lib/cjs/decorators/common/anyOf.js.map +1 -1
  8. package/lib/cjs/decorators/common/description.js.map +1 -1
  9. package/lib/cjs/decorators/common/enum.js +1 -20
  10. package/lib/cjs/decorators/common/enum.js.map +1 -1
  11. package/lib/cjs/decorators/common/ignore.js.map +1 -1
  12. package/lib/cjs/decorators/common/jsonEntityFn.js.map +1 -1
  13. package/lib/cjs/decorators/common/oneOf.js +4 -0
  14. package/lib/cjs/decorators/common/oneOf.js.map +1 -1
  15. package/lib/cjs/decorators/common/recordOf.js +63 -0
  16. package/lib/cjs/decorators/common/recordOf.js.map +1 -0
  17. package/lib/cjs/decorators/operations/acceptMime.js +28 -0
  18. package/lib/cjs/decorators/operations/acceptMime.js.map +1 -0
  19. package/lib/cjs/decorators/operations/in.js +6 -4
  20. package/lib/cjs/decorators/operations/in.js.map +1 -1
  21. package/lib/cjs/decorators/operations/view.js +31 -0
  22. package/lib/cjs/decorators/operations/view.js.map +1 -0
  23. package/lib/cjs/domain/DecoratorContext.js.map +1 -1
  24. package/lib/cjs/domain/JsonClassStore.js +1 -1
  25. package/lib/cjs/domain/JsonMap.js.map +1 -1
  26. package/lib/cjs/domain/JsonMethodStore.js +66 -24
  27. package/lib/cjs/domain/JsonMethodStore.js.map +1 -1
  28. package/lib/cjs/domain/JsonOperation.js +11 -26
  29. package/lib/cjs/domain/JsonOperation.js.map +1 -1
  30. package/lib/cjs/domain/JsonOperationRoute.js +4 -0
  31. package/lib/cjs/domain/JsonOperationRoute.js.map +1 -1
  32. package/lib/cjs/domain/JsonParameter.js +38 -44
  33. package/lib/cjs/domain/JsonParameter.js.map +1 -1
  34. package/lib/cjs/domain/JsonParameterStore.js +14 -5
  35. package/lib/cjs/domain/JsonParameterStore.js.map +1 -1
  36. package/lib/cjs/domain/JsonPropertyStore.js +6 -2
  37. package/lib/cjs/domain/JsonPropertyStore.js.map +1 -1
  38. package/lib/cjs/domain/JsonResponse.js +1 -11
  39. package/lib/cjs/domain/JsonResponse.js.map +1 -1
  40. package/lib/cjs/domain/JsonSchema.js +47 -54
  41. package/lib/cjs/domain/JsonSchema.js.map +1 -1
  42. package/lib/cjs/domain/SpecTypes.js +1 -0
  43. package/lib/cjs/domain/SpecTypes.js.map +1 -1
  44. package/lib/cjs/index.js +149 -20
  45. package/lib/cjs/index.js.map +1 -1
  46. package/lib/cjs/interfaces/JsonSchemaOptions.js.map +1 -1
  47. package/lib/cjs/package.json +3 -0
  48. package/lib/cjs/utils/from.js +9 -8
  49. package/lib/cjs/utils/from.js.map +1 -1
  50. package/lib/cjs/utils/generateSpec.js +55 -0
  51. package/lib/cjs/utils/generateSpec.js.map +1 -0
  52. package/lib/cjs/utils/generics.js.map +1 -1
  53. package/lib/cjs/utils/getJsonSchema.js +11 -1
  54. package/lib/cjs/utils/getJsonSchema.js.map +1 -1
  55. package/lib/cjs/utils/getJsonType.js +1 -1
  56. package/lib/cjs/utils/getJsonType.js.map +1 -1
  57. package/lib/cjs/utils/getOperationsRoutes.js +2 -1
  58. package/lib/cjs/utils/getOperationsRoutes.js.map +1 -1
  59. package/lib/cjs/utils/getSpec.js +58 -43
  60. package/lib/cjs/utils/getSpec.js.map +1 -1
  61. package/lib/cjs/utils/getSpecType.js +21 -0
  62. package/lib/cjs/utils/getSpecType.js.map +1 -0
  63. package/lib/cjs/utils/mapNullableType.js +1 -1
  64. package/lib/cjs/utils/mapNullableType.js.map +1 -1
  65. package/lib/cjs/utils/mapOpenSpec.js +41 -0
  66. package/lib/cjs/utils/mapOpenSpec.js.map +1 -0
  67. package/lib/cjs/utils/mapOpenSpec2.js +34 -0
  68. package/lib/cjs/utils/mapOpenSpec2.js.map +1 -0
  69. package/lib/cjs/utils/mapOpenSpec3.js +26 -0
  70. package/lib/cjs/utils/mapOpenSpec3.js.map +1 -0
  71. package/lib/cjs/utils/mapOpenSpecInfo.js +21 -0
  72. package/lib/cjs/utils/mapOpenSpecInfo.js.map +1 -0
  73. package/lib/cjs/utils/matchGroups.js +1 -1
  74. package/lib/cjs/utils/matchGroups.js.map +1 -1
  75. package/lib/cjs/utils/mergeOperation.js +1 -0
  76. package/lib/cjs/utils/mergeOperation.js.map +1 -1
  77. package/lib/cjs/utils/mergeSpec.js.map +1 -1
  78. package/lib/cjs/utils/serializeEnumValues.js +26 -0
  79. package/lib/cjs/utils/serializeEnumValues.js.map +1 -0
  80. package/lib/esm/components/anyMapper.js +4 -4
  81. package/lib/esm/components/classMapper.js +4 -4
  82. package/lib/esm/components/genericsMapper.js +4 -4
  83. package/lib/esm/components/inheritedClassMapper.js +2 -2
  84. package/lib/esm/components/itemMapper.js +1 -1
  85. package/lib/esm/components/lazyRefMapper.js +3 -3
  86. package/lib/esm/components/mapMapper.js +2 -2
  87. package/lib/esm/components/objectMapper.js +3 -3
  88. package/lib/esm/components/ofMapper.js +1 -1
  89. package/lib/esm/components/propertiesMapper.js +1 -1
  90. package/lib/esm/components/schemaMapper.js +7 -7
  91. package/lib/esm/components/schemaMapper.js.map +1 -1
  92. package/lib/esm/constants/httpStatusMessages.js +11 -96
  93. package/lib/esm/constants/httpStatusMessages.js.map +1 -1
  94. package/lib/esm/decorators/class/children.js +1 -1
  95. package/lib/esm/decorators/collections/collectionContains.js +1 -1
  96. package/lib/esm/decorators/collections/collectionOf.js +1 -1
  97. package/lib/esm/decorators/collections/maxItems.js +1 -1
  98. package/lib/esm/decorators/collections/maxProperties.js +1 -1
  99. package/lib/esm/decorators/collections/minItems.js +1 -1
  100. package/lib/esm/decorators/collections/minProperties.js +1 -1
  101. package/lib/esm/decorators/collections/uniqueItems.js +1 -1
  102. package/lib/esm/decorators/common/additionalProperties.js +1 -1
  103. package/lib/esm/decorators/common/allOf.js +1 -1
  104. package/lib/esm/decorators/common/allow.js +2 -2
  105. package/lib/esm/decorators/common/any.js +1 -1
  106. package/lib/esm/decorators/common/anyOf.js +5 -1
  107. package/lib/esm/decorators/common/anyOf.js.map +1 -1
  108. package/lib/esm/decorators/common/const.js +1 -1
  109. package/lib/esm/decorators/common/customKey.js +1 -1
  110. package/lib/esm/decorators/common/default.js +1 -1
  111. package/lib/esm/decorators/common/description.js +1 -1
  112. package/lib/esm/decorators/common/description.js.map +1 -1
  113. package/lib/esm/decorators/common/enum.js +2 -21
  114. package/lib/esm/decorators/common/enum.js.map +1 -1
  115. package/lib/esm/decorators/common/example.js +1 -1
  116. package/lib/esm/decorators/common/examples.js +1 -1
  117. package/lib/esm/decorators/common/exclusiveMaximum.js +1 -1
  118. package/lib/esm/decorators/common/exclusiveMinimum.js +1 -1
  119. package/lib/esm/decorators/common/format.js +2 -2
  120. package/lib/esm/decorators/common/forwardGroups.js +1 -1
  121. package/lib/esm/decorators/common/groups.js +2 -2
  122. package/lib/esm/decorators/common/ignore.js +1 -1
  123. package/lib/esm/decorators/common/ignore.js.map +1 -1
  124. package/lib/esm/decorators/common/integer.js +1 -1
  125. package/lib/esm/decorators/common/jsonEntityFn.js +1 -1
  126. package/lib/esm/decorators/common/jsonEntityFn.js.map +1 -1
  127. package/lib/esm/decorators/common/maxLength.js +1 -1
  128. package/lib/esm/decorators/common/maximum.js +1 -1
  129. package/lib/esm/decorators/common/minLength.js +1 -1
  130. package/lib/esm/decorators/common/minimum.js +1 -1
  131. package/lib/esm/decorators/common/multipleOf.js +1 -1
  132. package/lib/esm/decorators/common/name.js +1 -1
  133. package/lib/esm/decorators/common/nullable.js +2 -2
  134. package/lib/esm/decorators/common/oneOf.js +5 -1
  135. package/lib/esm/decorators/common/oneOf.js.map +1 -1
  136. package/lib/esm/decorators/common/optional.js +1 -1
  137. package/lib/esm/decorators/common/pattern.js +1 -1
  138. package/lib/esm/decorators/common/property.js +1 -1
  139. package/lib/esm/decorators/common/readOnly.js +1 -1
  140. package/lib/esm/decorators/common/recordOf.js +59 -0
  141. package/lib/esm/decorators/common/recordOf.js.map +1 -0
  142. package/lib/esm/decorators/common/required.js +2 -2
  143. package/lib/esm/decorators/common/requiredGroups.js +2 -2
  144. package/lib/esm/decorators/common/schema.js +1 -1
  145. package/lib/esm/decorators/common/title.js +1 -1
  146. package/lib/esm/decorators/common/writeOnly.js +1 -1
  147. package/lib/esm/decorators/config/jsonEntityComponent.js +1 -1
  148. package/lib/esm/decorators/generics/genericOf.js +2 -2
  149. package/lib/esm/decorators/generics/generics.js +1 -1
  150. package/lib/esm/decorators/operations/acceptMime.js +24 -0
  151. package/lib/esm/decorators/operations/acceptMime.js.map +1 -0
  152. package/lib/esm/decorators/operations/consumes.js +1 -1
  153. package/lib/esm/decorators/operations/contentType.js +1 -1
  154. package/lib/esm/decorators/operations/deprecated.js +1 -1
  155. package/lib/esm/decorators/operations/header.js +1 -1
  156. package/lib/esm/decorators/operations/in.js +3 -1
  157. package/lib/esm/decorators/operations/in.js.map +1 -1
  158. package/lib/esm/decorators/operations/inFile.js +5 -5
  159. package/lib/esm/decorators/operations/location.js +1 -1
  160. package/lib/esm/decorators/operations/operationId.js +1 -1
  161. package/lib/esm/decorators/operations/operationPath.js +1 -1
  162. package/lib/esm/decorators/operations/partial.js +1 -1
  163. package/lib/esm/decorators/operations/path.js +1 -1
  164. package/lib/esm/decorators/operations/produces.js +1 -1
  165. package/lib/esm/decorators/operations/redirect.js +2 -2
  166. package/lib/esm/decorators/operations/returns.js +8 -8
  167. package/lib/esm/decorators/operations/route.js +3 -3
  168. package/lib/esm/decorators/operations/security.js +1 -1
  169. package/lib/esm/decorators/operations/status.js +1 -1
  170. package/lib/esm/decorators/operations/summary.js +1 -1
  171. package/lib/esm/decorators/operations/tags.js +1 -1
  172. package/lib/esm/decorators/operations/view.js +27 -0
  173. package/lib/esm/decorators/operations/view.js.map +1 -0
  174. package/lib/esm/domain/DecoratorContext.js +1 -1
  175. package/lib/esm/domain/DecoratorContext.js.map +1 -1
  176. package/lib/esm/domain/JsonClassStore.js +3 -3
  177. package/lib/esm/domain/JsonLazyRef.js +2 -2
  178. package/lib/esm/domain/JsonMap.js +1 -1
  179. package/lib/esm/domain/JsonMap.js.map +1 -1
  180. package/lib/esm/domain/JsonMethodStore.js +68 -26
  181. package/lib/esm/domain/JsonMethodStore.js.map +1 -1
  182. package/lib/esm/domain/JsonOperation.js +10 -25
  183. package/lib/esm/domain/JsonOperation.js.map +1 -1
  184. package/lib/esm/domain/JsonOperationPathsMap.js +1 -1
  185. package/lib/esm/domain/JsonOperationRoute.js +5 -1
  186. package/lib/esm/domain/JsonOperationRoute.js.map +1 -1
  187. package/lib/esm/domain/JsonParameter.js +42 -48
  188. package/lib/esm/domain/JsonParameter.js.map +1 -1
  189. package/lib/esm/domain/JsonParameterStore.js +17 -8
  190. package/lib/esm/domain/JsonParameterStore.js.map +1 -1
  191. package/lib/esm/domain/JsonPropertyStore.js +7 -3
  192. package/lib/esm/domain/JsonPropertyStore.js.map +1 -1
  193. package/lib/esm/domain/JsonRequestBody.js +2 -2
  194. package/lib/esm/domain/JsonResponse.js +4 -14
  195. package/lib/esm/domain/JsonResponse.js.map +1 -1
  196. package/lib/esm/domain/JsonSchema.js +9 -16
  197. package/lib/esm/domain/JsonSchema.js.map +1 -1
  198. package/lib/esm/domain/SpecTypes.js +1 -0
  199. package/lib/esm/domain/SpecTypes.js.map +1 -1
  200. package/lib/esm/index.js +149 -20
  201. package/lib/esm/index.js.map +1 -1
  202. package/lib/esm/interfaces/JsonSchemaOptions.js.map +1 -1
  203. package/lib/esm/package.json +3 -0
  204. package/lib/esm/utils/from.js +5 -4
  205. package/lib/esm/utils/from.js.map +1 -1
  206. package/lib/esm/utils/generateSpec.js +50 -0
  207. package/lib/esm/utils/generateSpec.js.map +1 -0
  208. package/lib/esm/utils/generics.js.map +1 -1
  209. package/lib/esm/utils/getInheritedStores.js +1 -1
  210. package/lib/esm/utils/getJsonEntityStore.js +5 -5
  211. package/lib/esm/utils/getJsonSchema.js +14 -4
  212. package/lib/esm/utils/getJsonSchema.js.map +1 -1
  213. package/lib/esm/utils/getJsonType.js +2 -2
  214. package/lib/esm/utils/getJsonType.js.map +1 -1
  215. package/lib/esm/utils/getOperationsRoutes.js +5 -4
  216. package/lib/esm/utils/getOperationsRoutes.js.map +1 -1
  217. package/lib/esm/utils/getOperationsStores.js +4 -4
  218. package/lib/esm/utils/getPropertiesStores.js +3 -3
  219. package/lib/esm/utils/getRequiredProperties.js +1 -1
  220. package/lib/esm/utils/getSpec.js +65 -50
  221. package/lib/esm/utils/getSpec.js.map +1 -1
  222. package/lib/esm/utils/getSpecType.js +16 -0
  223. package/lib/esm/utils/getSpecType.js.map +1 -0
  224. package/lib/esm/utils/mapNullableType.js +2 -2
  225. package/lib/esm/utils/mapNullableType.js.map +1 -1
  226. package/lib/esm/utils/mapOpenSpec.js +37 -0
  227. package/lib/esm/utils/mapOpenSpec.js.map +1 -0
  228. package/lib/esm/utils/mapOpenSpec2.js +30 -0
  229. package/lib/esm/utils/mapOpenSpec2.js.map +1 -0
  230. package/lib/esm/utils/mapOpenSpec3.js +22 -0
  231. package/lib/esm/utils/mapOpenSpec3.js.map +1 -0
  232. package/lib/esm/utils/mapOpenSpecInfo.js +17 -0
  233. package/lib/esm/utils/mapOpenSpecInfo.js.map +1 -0
  234. package/lib/esm/utils/mapRouteOptions.js +1 -1
  235. package/lib/esm/utils/mergeOperation.js +4 -3
  236. package/lib/esm/utils/mergeOperation.js.map +1 -1
  237. package/lib/esm/utils/mergeSpec.js.map +1 -1
  238. package/lib/esm/utils/ref.js +1 -1
  239. package/lib/esm/utils/serializeEnumValues.js +21 -0
  240. package/lib/esm/utils/serializeEnumValues.js.map +1 -0
  241. package/lib/esm/utils/toJsonMapCollection.js +1 -1
  242. package/lib/types/constants/httpStatusMessages.d.ts +2 -263
  243. package/lib/types/decorators/common/anyOf.d.ts +4 -0
  244. package/lib/types/decorators/common/ignore.d.ts +1 -1
  245. package/lib/types/decorators/common/jsonEntityFn.d.ts +1 -1
  246. package/lib/types/decorators/common/oneOf.d.ts +4 -0
  247. package/lib/types/decorators/common/recordOf.d.ts +46 -0
  248. package/lib/types/decorators/operations/acceptMime.d.ts +19 -0
  249. package/lib/types/decorators/operations/in.d.ts +1 -1
  250. package/lib/types/decorators/operations/view.d.ts +23 -0
  251. package/lib/types/domain/JsonMap.d.ts +1 -1
  252. package/lib/types/domain/JsonMethodStore.d.ts +51 -2
  253. package/lib/types/domain/JsonOperation.d.ts +2 -1
  254. package/lib/types/domain/JsonOperationRoute.d.ts +5 -3
  255. package/lib/types/domain/JsonParameter.d.ts +2 -1
  256. package/lib/types/domain/JsonParameterStore.d.ts +23 -1
  257. package/lib/types/domain/JsonPropertyStore.d.ts +7 -0
  258. package/lib/types/domain/JsonResponse.d.ts +2 -1
  259. package/lib/types/domain/JsonSchema.d.ts +2 -2
  260. package/lib/types/domain/SpecTypes.d.ts +1 -0
  261. package/lib/types/index.d.ts +142 -13
  262. package/lib/types/interfaces/JsonSchemaOptions.d.ts +2 -2
  263. package/lib/types/utils/generateSpec.d.ts +16 -0
  264. package/lib/types/utils/generics.d.ts +1 -1
  265. package/lib/types/utils/getJsonSchema.d.ts +12 -2
  266. package/lib/types/utils/getOperationsRoutes.d.ts +2 -2
  267. package/lib/types/utils/getSpec.d.ts +5 -4
  268. package/lib/types/utils/getSpecType.d.ts +12 -0
  269. package/lib/types/utils/mapNullableType.d.ts +1 -1
  270. package/lib/types/utils/mapOpenSpec.d.ts +10 -0
  271. package/lib/types/utils/mapOpenSpec2.d.ts +9 -0
  272. package/lib/types/utils/mapOpenSpec3.d.ts +8 -0
  273. package/lib/types/utils/mapOpenSpecInfo.d.ts +6 -0
  274. package/lib/types/utils/mergeSpec.d.ts +2 -2
  275. package/lib/types/utils/serializeEnumValues.d.ts +5 -0
  276. package/package.json +30 -15
  277. package/readme.md +1 -0
  278. package/tsconfig.compile.esm.json +2 -12
  279. package/benchmark/cold-start.js +0 -17
  280. package/lib/cjs/components/index.js +0 -15
  281. package/lib/cjs/components/index.js.map +0 -1
  282. package/lib/cjs/decorators/index.js +0 -77
  283. package/lib/cjs/decorators/index.js.map +0 -1
  284. package/lib/cjs/domain/index.js +0 -20
  285. package/lib/cjs/domain/index.js.map +0 -1
  286. package/lib/cjs/interfaces/index.js +0 -8
  287. package/lib/cjs/interfaces/index.js.map +0 -1
  288. package/lib/esm/components/index.js +0 -12
  289. package/lib/esm/components/index.js.map +0 -1
  290. package/lib/esm/decorators/index.js +0 -74
  291. package/lib/esm/decorators/index.js.map +0 -1
  292. package/lib/esm/domain/index.js +0 -17
  293. package/lib/esm/domain/index.js.map +0 -1
  294. package/lib/esm/interfaces/index.js +0 -5
  295. package/lib/esm/interfaces/index.js.map +0 -1
  296. package/lib/types/components/index.d.ts +0 -11
  297. package/lib/types/decorators/index.d.ts +0 -68
  298. package/lib/types/domain/index.d.ts +0 -16
  299. package/lib/types/interfaces/index.d.ts +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"schemaMapper.js","sourceRoot":"","sources":["../../../src/components/schemaMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AACxG,OAAO,EAAC,qBAAqB,EAAC,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AAEz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,CAAC,EAAE;gBACxC,KAAK,GAAG,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;aACnD;SACF;QAED,OAAO;YACL,GAAG,IAAI;YACP,CAAC,GAAG,CAAC,EAAE,KAAK;SACb,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAET,IAAI,MAAM,CAAC,OAAO,EAAE;QAClB,GAAG,GAAG,UAAU,CAAC,gBAAgB,EAAE,GAAG,EAAE,EAAC,GAAG,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,EAAC,CAAC,CAAC;KAC/G;IAED,GAAG,GAAG,UAAU,CAAC,UAAU,EAAE,GAAG,EAAE,EAAC,GAAG,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAQ,CAAC,CAAC;IAE7E,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,QAAkB,CAAC,EAAE;QAC1C,GAAG,GAAG;YACJ,GAAG,GAAG;YACN,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,QAAkB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;SAC1D,CAAC;KACH;IAED,GAAG,GAAG,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAC,GAAG,OAAO,EAAE,QAAQ,EAAC,CAAC,CAAC;IACjE,GAAG,GAAG,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,GAAG,GAAG,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,wBAAwB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import {isObject} from \"@tsed/core\";\nimport {mapAliasedProperties} from \"../domain/JsonAliasMap\";\nimport {JsonSchema} from \"../domain/JsonSchema\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper, hasMapper, registerJsonSchemaMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {getRequiredProperties} from \"../utils/getRequiredProperties\";\nimport {alterOneOf} from \"../hooks/alterOneOf\";\nimport {mapNullableType} from \"../utils/mapNullableType\";\n\n/**\n * @ignore\n */\nconst IGNORES = [\"name\", \"$required\", \"$hooks\", \"_nestedGenerics\", SpecTypes.OPENAPI, SpecTypes.JSON];\n/**\n * @ignore\n */\nconst IGNORES_OPENSPEC = [\"const\"];\n\n/**\n * @ignore\n */\nfunction isEmptyProperties(key: string, value: any) {\n return typeof value === \"object\" && [\"items\", \"properties\", \"additionalProperties\"].includes(key) && Object.keys(value).length === 0;\n}\n\n/**\n * @ignore\n */\nfunction shouldMapAlias(key: string, value: any, useAlias: boolean) {\n return typeof value === \"object\" && useAlias && [\"properties\", \"additionalProperties\"].includes(key);\n}\n\n/**\n * @ignore\n */\nfunction shouldSkipKey(key: string, {specType = SpecTypes.JSON, customKeys = false}: JsonSchemaOptions) {\n return (\n IGNORES.includes(key) ||\n (key.startsWith(\"#\") && (customKeys === false || specType !== SpecTypes.JSON)) ||\n (specType !== SpecTypes.JSON && IGNORES_OPENSPEC.includes(key))\n );\n}\n\nfunction isExample(key: string, value: any, options: JsonSchemaOptions) {\n return key === \"examples\" && isObject(value) && SpecTypes.OPENAPI === options.specType!;\n}\n\nexport function schemaMapper(schema: JsonSchema, options: JsonSchemaOptions): any {\n const {useAlias = true, schemas = {}} = options;\n options = {\n ...options,\n useAlias,\n schemas\n };\n\n let obj: any = [...schema.keys()]\n .filter((key) => !shouldSkipKey(key, options))\n .reduce((item: any, key) => {\n let value = schema.get(key);\n\n key = key.replace(/^#/, \"\");\n\n if (key === \"type\") {\n return {\n ...item,\n [key]: schema.getJsonType()\n };\n }\n\n if (isExample(key, value, options)) {\n key = \"example\";\n value = Object.values(value)[0];\n }\n\n if (value && typeof value === \"object\" && hasMapper(key)) {\n value = execMapper(key, value, options, schema);\n\n if (isEmptyProperties(key, value)) {\n return item;\n }\n\n if (shouldMapAlias(key, value, useAlias)) {\n value = mapAliasedProperties(value, schema.alias);\n }\n }\n\n return {\n ...item,\n [key]: value\n };\n }, {});\n\n if (schema.isClass) {\n obj = execMapper(\"inheritedClass\", obj, {...options, root: false, schemas, target: schema.getComputedType()});\n }\n\n obj = execMapper(\"generics\", obj, {...options, root: false, schemas} as any);\n\n if (schema.has(options.specType as string)) {\n obj = {\n ...obj,\n ...schema.get(options.specType as string).toJSON(options)\n };\n }\n\n obj = getRequiredProperties(obj, schema, {...options, useAlias});\n obj = mapNullableType(obj, schema, options);\n obj = alterOneOf(obj, schema, options);\n\n return obj;\n}\n\nregisterJsonSchemaMapper(\"schema\", schemaMapper);\n"]}
1
+ {"version":3,"file":"schemaMapper.js","sourceRoot":"","sources":["../../../src/components/schemaMapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AACxG,OAAO,EAAC,qBAAqB,EAAC,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AAEzD;;GAEG;AACH,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,iBAAiB,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;AACzH;;GAEG;AACH,MAAM,gBAAgB,GAAG,CAAC,OAAO,CAAC,CAAC;AAEnC;;GAEG;AACH,SAAS,iBAAi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EAAE;QAClB,GAAG,GAAG,UAAU,CAAC,gBAAgB,EAAE,GAAG,EAAE,EAAC,GAAG,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,EAAC,CAAC,CAAC;KAC/G;IAED,GAAG,GAAG,UAAU,CAAC,UAAU,EAAE,GAAG,EAAE,EAAC,GAAG,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAQ,CAAC,CAAC;IAE7E,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,QAAkB,CAAC,EAAE;QAC1C,GAAG,GAAG;YACJ,GAAG,GAAG;YACN,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,QAAkB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;SAC1D,CAAC;KACH;IAED,GAAG,GAAG,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAC,GAAG,OAAO,EAAE,QAAQ,EAAC,CAAC,CAAC;IACjE,GAAG,GAAG,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,GAAG,GAAG,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,wBAAwB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC","sourcesContent":["import {isObject} from \"@tsed/core\";\nimport {mapAliasedProperties} from \"../domain/JsonAliasMap\";\nimport {JsonSchema} from \"../domain/JsonSchema\";\nimport {SpecTypes} from \"../domain/SpecTypes\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper, hasMapper, registerJsonSchemaMapper} from \"../registries/JsonSchemaMapperContainer\";\nimport {getRequiredProperties} from \"../utils/getRequiredProperties\";\nimport {alterOneOf} from \"../hooks/alterOneOf\";\nimport {mapNullableType} from \"../utils/mapNullableType\";\n\n/**\n * @ignore\n */\nconst IGNORES = [\"name\", \"$required\", \"$hooks\", \"_nestedGenerics\", SpecTypes.OPENAPI, SpecTypes.SWAGGER, SpecTypes.JSON];\n/**\n * @ignore\n */\nconst IGNORES_OPENSPEC = [\"const\"];\n\n/**\n * @ignore\n */\nfunction isEmptyProperties(key: string, value: any) {\n return typeof value === \"object\" && [\"items\", \"properties\", \"additionalProperties\"].includes(key) && Object.keys(value).length === 0;\n}\n\n/**\n * @ignore\n */\nfunction shouldMapAlias(key: string, value: any, useAlias: boolean) {\n return typeof value === \"object\" && useAlias && [\"properties\", \"additionalProperties\"].includes(key);\n}\n\n/**\n * @ignore\n */\nfunction shouldSkipKey(key: string, {specType = SpecTypes.JSON, customKeys = false}: JsonSchemaOptions) {\n return (\n IGNORES.includes(key) ||\n (key.startsWith(\"#\") && (customKeys === false || specType !== SpecTypes.JSON)) ||\n (specType !== SpecTypes.JSON && IGNORES_OPENSPEC.includes(key))\n );\n}\n\nfunction isExample(key: string, value: any, options: JsonSchemaOptions) {\n return key === \"examples\" && isObject(value) && SpecTypes.OPENAPI === options.specType!;\n}\n\nexport function schemaMapper(schema: JsonSchema, options: JsonSchemaOptions): any {\n const {useAlias = true, schemas = {}} = options;\n options = {\n ...options,\n useAlias,\n schemas\n };\n\n let obj: any = [...schema.keys()]\n .filter((key) => !shouldSkipKey(key, options))\n .reduce((item: any, key) => {\n let value = schema.get(key);\n\n key = key.replace(/^#/, \"\");\n\n if (key === \"type\") {\n return {\n ...item,\n [key]: schema.getJsonType()\n };\n }\n\n if (isExample(key, value, options)) {\n key = \"example\";\n value = Object.values(value)[0];\n }\n\n if (value && typeof value === \"object\" && hasMapper(key)) {\n value = execMapper(key, value, options, schema);\n\n if (isEmptyProperties(key, value)) {\n return item;\n }\n\n if (shouldMapAlias(key, value, useAlias)) {\n value = mapAliasedProperties(value, schema.alias);\n }\n }\n\n return {\n ...item,\n [key]: value\n };\n }, {});\n\n if (schema.isClass) {\n obj = execMapper(\"inheritedClass\", obj, {...options, root: false, schemas, target: schema.getComputedType()});\n }\n\n obj = execMapper(\"generics\", obj, {...options, root: false, schemas} as any);\n\n if (schema.has(options.specType as string)) {\n obj = {\n ...obj,\n ...schema.get(options.specType as string).toJSON(options)\n };\n }\n\n obj = getRequiredProperties(obj, schema, {...options, useAlias});\n obj = mapNullableType(obj, schema, options);\n obj = alterOneOf(obj, schema, options);\n\n return obj;\n}\n\nregisterJsonSchemaMapper(\"schema\", schemaMapper);\n"]}
@@ -1,99 +1,14 @@
1
- export const HTTP_STATUS_MESSAGES = {
2
- "100": { label: "Continue", code: "CONTINUE" },
3
- "101": { label: "Switching Protocols", code: "SWITCHING_PROTOCOLS" },
4
- "102": { label: "Processing", code: "PROCESSING" },
5
- "103": { label: "Early Hints", code: "EARLY_HINTS" },
6
- "200": { label: "Success", code: "SUCCESS" },
7
- "201": { label: "Created", code: "CREATED" },
8
- "202": { label: "Accepted", code: "ACCEPTED" },
9
- "203": {
10
- label: "Non-Authoritative Information",
11
- code: "NON_AUTHORITATIVE_INFORMATION"
12
- },
13
- "204": { label: "No Content", code: "NO_CONTENT" },
14
- "205": { label: "Reset Content", code: "RESET_CONTENT" },
15
- "206": { label: "Partial Content", code: "PARTIAL_CONTENT" },
16
- "207": { label: "Multi-Status", code: "MULTI_STATUS" },
17
- "208": { label: "Already Reported", code: "ALREADY_REPORTED" },
18
- "226": { label: "IM Used", code: "IM_USED" },
19
- "300": { label: "Multiple Choices", code: "MULTIPLE_CHOICES" },
20
- "301": { label: "Moved Permanently", code: "MOVED_PERMANENTLY" },
21
- "302": { label: "Found", code: "FOUND" },
22
- "303": { label: "See Other", code: "SEE_OTHER" },
23
- "304": { label: "Not Modified", code: "NOT_MODIFIED" },
24
- "305": { label: "Use Proxy", code: "USE_PROXY" },
25
- "306": { label: "(Unused)", code: "UNUSED" },
26
- "307": { label: "Temporary Redirect", code: "TEMPORARY_REDIRECT" },
27
- "308": { label: "Permanent Redirect", code: "PERMANENT_REDIRECT" },
28
- "310": { label: "Too Many Redirects", code: "TOO_MANY_REDIRECTS" },
29
- "400": { label: "Bad Request", code: "BAD_REQUEST" },
30
- "401": { label: "Unauthorized", code: "UNAUTHORIZED" },
31
- "402": { label: "Payment Required", code: "PAYMENT_REQUIRED" },
32
- "403": { label: "Forbidden", code: "FORBIDDEN" },
33
- "404": { label: "Not Found", code: "NOT_FOUND" },
34
- "405": { label: "Method Not Allowed", code: "METHOD_NOT_ALLOWED" },
35
- "406": { label: "Not Acceptable", code: "NOT_ACCEPTABLE" },
36
- "407": {
37
- label: "Proxy Authentication Required",
38
- code: "PROXY_AUTHENTICATION_REQUIRED"
39
- },
40
- "408": { label: "Request Timeout", code: "REQUEST_TIMEOUT" },
41
- "409": { label: "Conflict", code: "CONFLICT" },
42
- "410": { label: "Gone", code: "GONE" },
43
- "411": { label: "Length Required", code: "LENGTH_REQUIRED" },
44
- "412": { label: "Precondition Failed", code: "PRECONDITION_FAILED" },
45
- "413": {
46
- label: "Request Entity Too Large",
47
- code: "REQUEST_ENTITY_TOO_LARGE"
48
- },
49
- "414": { label: "Request URI Too Long", code: "REQUEST_URI_TOO_LONG" },
50
- "415": { label: "Unsupported Media Type", code: "UNSUPPORTED_MEDIA_TYPE" },
51
- "416": {
52
- label: "Request Range Unsatisfiable",
53
- code: "REQUEST_RANGE_UNSATISFIABLE"
54
- },
55
- "417": { label: "Expectation Failed", code: "EXPECTATION_FAILED" },
56
- "418": { label: "I'm a Teapot", code: "I_M_A_TEAPOT" },
57
- "421": { label: "Misdirected Request", code: "MISDIRECTED_REQUEST" },
58
- "422": { label: "Unprocessable Entity", code: "UNPROCESSABLE_ENTITY" },
59
- "423": { label: "Locked", code: "LOCKED" },
60
- "424": { label: "Failed Dependency", code: "FAILED_DEPENDENCY" },
61
- "425": { label: "Too Early", code: "TOO_EARLY" },
62
- "426": { label: "Upgrade Required", code: "UPGRADE_REQUIRED" },
63
- "427": { label: "Unassigned", code: "UNASSIGNED" },
64
- "428": { label: "Precondition Required", code: "PRECONDITION_REQUIRED" },
65
- "429": { label: "Too Many Requests", code: "TOO_MANY_REQUESTS" },
66
- "430": { label: "Unassigned", code: "UNASSIGNED" },
67
- "431": {
68
- label: "Request Header Fields Too Large",
69
- code: "REQUEST_HEADER_FIELDS_TOO_LARGE"
70
- },
71
- "451": {
72
- label: "Unavailable For Legal Reasons",
73
- code: "UNAVAILABLE_FOR_LEGAL_REASONS"
74
- },
75
- "500": { label: "Internal Server Error", code: "INTERNAL_SERVER_ERROR" },
76
- "501": { label: "Not Implemented", code: "NOT_IMPLEMENTED" },
77
- "502": { label: "Bad Gateway", code: "BAD_GATEWAY" },
78
- "503": { label: "Service Unavailable", code: "SERVICE_UNAVAILABLE" },
79
- "504": { label: "Gateway Timeout", code: "GATEWAY_TIMEOUT" },
80
- "505": {
81
- label: "HTTP Version Not Supported",
82
- code: "HTTP_VERSION_NOT_SUPPORTED"
83
- },
84
- "506": { label: "Variant Also Negotiates", code: "VARIANT_ALSO_NEGOTIATES" },
85
- "507": { label: "Insufficient Storage", code: "INSUFFICIENT_STORAGE" },
86
- "508": { label: "Loop Detected", code: "LOOP_DETECTED" },
87
- "509": {
88
- label: "Bandwidth Limit Exceeded",
89
- code: "BANDWIDTH_LIMIT_EXCEEDED"
90
- },
91
- "510": { label: "Not Extended", code: "NOT_EXTENDED" },
92
- "511": {
93
- label: "Network Authentication Required",
94
- code: "NETWORK_AUTHENTICATION_REQUIRED"
95
- }
96
- };
1
+ import statuses from "statuses";
2
+ import { constantCase } from "change-case";
3
+ export const HTTP_STATUS_MESSAGES = statuses.codes.reduce((map, code) => {
4
+ const message = String(statuses(code));
5
+ return {
6
+ ...map,
7
+ [String(code)]: { label: message, code: constantCase(message) }
8
+ };
9
+ }, {});
10
+ HTTP_STATUS_MESSAGES["200"].label = "Success";
11
+ HTTP_STATUS_MESSAGES["200"].code = "SUCCESS";
97
12
  export function getStatusConstant(status) {
98
13
  var _a;
99
14
  return (_a = HTTP_STATUS_MESSAGES[status]) === null || _a === void 0 ? void 0 : _a.code;
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EAAE,eAAe,EAAC;IACtD,KAAK,EAAE;QACL,KAAK,EAAE,0BAA0B;QACjC,IAAI,EAAE,0BAA0B;KACjC;IACD,KAAK,EAAE,EAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAC;IACpD,KAAK,EAAE;QACL,KAAK,EAAE,iCAAiC;QACxC,IAAI,EAAE,iCAAiC;KACxC;CACF,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,MAAuB;;IACvD,OAAO,MAAC,oBAA4B,CAAC,MAAM,CAAC,0CAAE,IAAI,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAuB;;IACtD,OAAO,MAAC,oBAA4B,CAAC,MAAM,CAAC,0CAAE,KAAK,CAAC;AACtD,CAAC","sourcesContent":["export const HTTP_STATUS_MESSAGES = {\n \"100\": {label: \"Continue\", code: \"CONTINUE\"},\n \"101\": {label: \"Switching Protocols\", code: \"SWITCHING_PROTOCOLS\"},\n \"102\": {label: \"Processing\", code: \"PROCESSING\"},\n \"103\": {label: \"Early Hints\", code: \"EARLY_HINTS\"},\n \"200\": {label: \"Success\", code: \"SUCCESS\"},\n \"201\": {label: \"Created\", code: \"CREATED\"},\n \"202\": {label: \"Accepted\", code: \"ACCEPTED\"},\n \"203\": {\n label: \"Non-Authoritative Information\",\n code: \"NON_AUTHORITATIVE_INFORMATION\"\n },\n \"204\": {label: \"No Content\", code: \"NO_CONTENT\"},\n \"205\": {label: \"Reset Content\", code: \"RESET_CONTENT\"},\n \"206\": {label: \"Partial Content\", code: \"PARTIAL_CONTENT\"},\n \"207\": {label: \"Multi-Status\", code: \"MULTI_STATUS\"},\n \"208\": {label: \"Already Reported\", code: \"ALREADY_REPORTED\"},\n \"226\": {label: \"IM Used\", code: \"IM_USED\"},\n \"300\": {label: \"Multiple Choices\", code: \"MULTIPLE_CHOICES\"},\n \"301\": {label: \"Moved Permanently\", code: \"MOVED_PERMANENTLY\"},\n \"302\": {label: \"Found\", code: \"FOUND\"},\n \"303\": {label: \"See Other\", code: \"SEE_OTHER\"},\n \"304\": {label: \"Not Modified\", code: \"NOT_MODIFIED\"},\n \"305\": {label: \"Use Proxy\", code: \"USE_PROXY\"},\n \"306\": {label: \"(Unused)\", code: \"UNUSED\"},\n \"307\": {label: \"Temporary Redirect\", code: \"TEMPORARY_REDIRECT\"},\n \"308\": {label: \"Permanent Redirect\", code: \"PERMANENT_REDIRECT\"},\n \"310\": {label: \"Too Many Redirects\", code: \"TOO_MANY_REDIRECTS\"},\n \"400\": {label: \"Bad Request\", code: \"BAD_REQUEST\"},\n \"401\": {label: \"Unauthorized\", code: \"UNAUTHORIZED\"},\n \"402\": {label: \"Payment Required\", code: \"PAYMENT_REQUIRED\"},\n \"403\": {label: \"Forbidden\", code: \"FORBIDDEN\"},\n \"404\": {label: \"Not Found\", code: \"NOT_FOUND\"},\n \"405\": {label: \"Method Not Allowed\", code: \"METHOD_NOT_ALLOWED\"},\n \"406\": {label: \"Not Acceptable\", code: \"NOT_ACCEPTABLE\"},\n \"407\": {\n label: \"Proxy Authentication Required\",\n code: \"PROXY_AUTHENTICATION_REQUIRED\"\n },\n \"408\": {label: \"Request Timeout\", code: \"REQUEST_TIMEOUT\"},\n \"409\": {label: \"Conflict\", code: \"CONFLICT\"},\n \"410\": {label: \"Gone\", code: \"GONE\"},\n \"411\": {label: \"Length Required\", code: \"LENGTH_REQUIRED\"},\n \"412\": {label: \"Precondition Failed\", code: \"PRECONDITION_FAILED\"},\n \"413\": {\n label: \"Request Entity Too Large\",\n code: \"REQUEST_ENTITY_TOO_LARGE\"\n },\n \"414\": {label: \"Request URI Too Long\", code: \"REQUEST_URI_TOO_LONG\"},\n \"415\": {label: \"Unsupported Media Type\", code: \"UNSUPPORTED_MEDIA_TYPE\"},\n \"416\": {\n label: \"Request Range Unsatisfiable\",\n code: \"REQUEST_RANGE_UNSATISFIABLE\"\n },\n \"417\": {label: \"Expectation Failed\", code: \"EXPECTATION_FAILED\"},\n \"418\": {label: \"I'm a Teapot\", code: \"I_M_A_TEAPOT\"},\n \"421\": {label: \"Misdirected Request\", code: \"MISDIRECTED_REQUEST\"},\n \"422\": {label: \"Unprocessable Entity\", code: \"UNPROCESSABLE_ENTITY\"},\n \"423\": {label: \"Locked\", code: \"LOCKED\"},\n \"424\": {label: \"Failed Dependency\", code: \"FAILED_DEPENDENCY\"},\n \"425\": {label: \"Too Early\", code: \"TOO_EARLY\"},\n \"426\": {label: \"Upgrade Required\", code: \"UPGRADE_REQUIRED\"},\n \"427\": {label: \"Unassigned\", code: \"UNASSIGNED\"},\n \"428\": {label: \"Precondition Required\", code: \"PRECONDITION_REQUIRED\"},\n \"429\": {label: \"Too Many Requests\", code: \"TOO_MANY_REQUESTS\"},\n \"430\": {label: \"Unassigned\", code: \"UNASSIGNED\"},\n \"431\": {\n label: \"Request Header Fields Too Large\",\n code: \"REQUEST_HEADER_FIELDS_TOO_LARGE\"\n },\n \"451\": {\n label: \"Unavailable For Legal Reasons\",\n code: \"UNAVAILABLE_FOR_LEGAL_REASONS\"\n },\n \"500\": {label: \"Internal Server Error\", code: \"INTERNAL_SERVER_ERROR\"},\n \"501\": {label: \"Not Implemented\", code: \"NOT_IMPLEMENTED\"},\n \"502\": {label: \"Bad Gateway\", code: \"BAD_GATEWAY\"},\n \"503\": {label: \"Service Unavailable\", code: \"SERVICE_UNAVAILABLE\"},\n \"504\": {label: \"Gateway Timeout\", code: \"GATEWAY_TIMEOUT\"},\n \"505\": {\n label: \"HTTP Version Not Supported\",\n code: \"HTTP_VERSION_NOT_SUPPORTED\"\n },\n \"506\": {label: \"Variant Also Negotiates\", code: \"VARIANT_ALSO_NEGOTIATES\"},\n \"507\": {label: \"Insufficient Storage\", code: \"INSUFFICIENT_STORAGE\"},\n \"508\": {label: \"Loop Detected\", code: \"LOOP_DETECTED\"},\n \"509\": {\n label: \"Bandwidth Limit Exceeded\",\n code: \"BANDWIDTH_LIMIT_EXCEEDED\"\n },\n \"510\": {label: \"Not Extended\", code: \"NOT_EXTENDED\"},\n \"511\": {\n label: \"Network Authentication Required\",\n code: \"NETWORK_AUTHENTICATION_REQUIRED\"\n }\n};\n\nexport function getStatusConstant(status: number | string) {\n return (HTTP_STATUS_MESSAGES as any)[status]?.code;\n}\n\nexport function getStatusMessage(status: number | string) {\n return (HTTP_STATUS_MESSAGES as any)[status]?.label;\n}\n"]}
1
+ {"version":3,"file":"httpStatusMessages.js","sourceRoot":"","sources":["../../../src/constants/httpStatusMessages.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAkD,EAAE,IAAY,EAAE,EAAE;IAC7H,MAAM,OAAO,GAAW,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,OAAO;QACL,GAAG,GAAG;QACN,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,EAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,EAAC;KAC9D,CAAC;AACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AAEP,oBAAoB,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC;AAC9C,oBAAoB,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,SAAS,CAAC;AAE7C,MAAM,UAAU,iBAAiB,CAAC,MAAuB;;IACvD,OAAO,MAAC,oBAA4B,CAAC,MAAM,CAAC,0CAAE,IAAI,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAuB;;IACtD,OAAO,MAAC,oBAA4B,CAAC,MAAM,CAAC,0CAAE,KAAK,CAAC;AACtD,CAAC","sourcesContent":["import statuses from \"statuses\";\nimport {constantCase} from \"change-case\";\n\nexport const HTTP_STATUS_MESSAGES = statuses.codes.reduce((map: Record<string, {label: string; code: string}>, code: number) => {\n const message: string = String(statuses(code));\n return {\n ...map,\n [String(code)]: {label: message, code: constantCase(message)}\n };\n}, {});\n\nHTTP_STATUS_MESSAGES[\"200\"].label = \"Success\";\nHTTP_STATUS_MESSAGES[\"200\"].code = \"SUCCESS\";\n\nexport function getStatusConstant(status: number | string) {\n return (HTTP_STATUS_MESSAGES as any)[status]?.code;\n}\n\nexport function getStatusMessage(status: number | string) {\n return (HTTP_STATUS_MESSAGES as any)[status]?.label;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { Store } from "@tsed/core";
2
- import { JsonEntityFn } from "../common/jsonEntityFn";
2
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
3
3
  /**
4
4
  * Add Children class to compose routes
5
5
  *
@@ -1,4 +1,4 @@
1
- import { CollectionOf } from "./collectionOf";
1
+ import { CollectionOf } from "./collectionOf.js";
2
2
  /**
3
3
  * Set the type of the item collection. The possible value is String, Boolean, Number, Date, Object, Class, etc...
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityStore } from "../../domain/JsonEntityStore";
1
+ import { JsonEntityStore } from "../../domain/JsonEntityStore.js";
2
2
  /**
3
3
  * Set the type of the item collection. The possible value is String, Boolean, Number, Date, Object, Class, etc...
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "../common/jsonEntityFn";
1
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
2
2
  /**
3
3
  * The value `maxItems` MUST be a non-negative integer.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "../common/jsonEntityFn";
1
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
2
2
  /**
3
3
  * An object instance is valid against `maxProperties` if its number of properties is less than, or equal to, the value of this keyword.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "../common/jsonEntityFn";
1
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
2
2
  /**
3
3
  * An array instance is valid against `minItems` if its size is greater than, or equal to, the value of this keyword.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "../common/jsonEntityFn";
1
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
2
2
  /**
3
3
  * An object instance is valid against `minProperties` if its number of properties is less than, or equal to, the value of this keyword.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "../common/jsonEntityFn";
1
+ import { JsonEntityFn } from "../common/jsonEntityFn.js";
2
2
  /**
3
3
  * If this keyword has boolean value false, the instance validates successfully. If it has boolean value true, the instance validates successfully if all of its elements are unique.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * Accept unknown properties on the deserialized model.
4
4
  *
@@ -1,4 +1,4 @@
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.26
4
4
  *
@@ -1,6 +1,6 @@
1
1
  import { DecoratorTypes, isClass, useDecorators } from "@tsed/core";
2
- import { JsonEntityFn } from "./jsonEntityFn";
3
- import { Property } from "./property";
2
+ import { JsonEntityFn } from "./jsonEntityFn.js";
3
+ import { Property } from "./property.js";
4
4
  /**
5
5
  * Add allowed values when the property or parameters is required.
6
6
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * Set the type of the array items.
4
4
  *
@@ -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.27
4
4
  *
5
+ * ::: warning
6
+ * AnyOf isn't supported by OS2
7
+ * :::
8
+ *
5
9
  * @decorator
6
10
  * @validation
7
11
  * @swagger
@@ -1 +1 @@
1
- {"version":3,"file":"anyOf.js","sourceRoot":"","sources":["../../../../src/decorators/common/anyOf.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;IACjC,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.27\n *\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @classDecorator\n * @input\n * @param anyOf\n */\nexport function AnyOf(...anyOf: AnyJsonSchema[]) {\n return JsonEntityFn((entity) => {\n entity.itemSchema.anyOf(anyOf);\n });\n}\n"]}
1
+ {"version":3,"file":"anyOf.js","sourceRoot":"","sources":["../../../../src/decorators/common/anyOf.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;IACjC,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.27\n *\n * ::: warning\n * AnyOf isn't supported by OS2\n * :::\n *\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @classDecorator\n * @input\n * @param anyOf\n */\nexport function AnyOf(...anyOf: AnyJsonSchema[]) {\n return JsonEntityFn((entity) => {\n entity.itemSchema.anyOf(anyOf);\n });\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * The const keyword is used to restrict a value to a fixed value.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * Set a custom key on JsonSchema that is not a part of the official spec.
4
4
  *
@@ -1,4 +1,4 @@
1
- import { JsonEntityFn } from "./jsonEntityFn";
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
2
2
  /**
3
3
  * There are no restrictions placed on the value of this keyword.
4
4
  *
@@ -1,5 +1,5 @@
1
1
  import { decoratorTypeOf, DecoratorTypes } from "@tsed/core";
2
- import { JsonEntityFn } from "./jsonEntityFn";
2
+ import { JsonEntityFn } from "./jsonEntityFn.js";
3
3
  /**
4
4
  * Add a description to the class, method or property
5
5
  *
@@ -1 +1 @@
1
- {"version":3,"file":"description.js","sourceRoot":"","sources":["../../../../src/decorators/common/description.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,eAAe,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAEhF,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,UAAU,WAAW,CAAC,WAAgB;IAC1C,OAAO,YAAY,CAAC,CAAC,KAAsB,EAAE,IAAyB,EAAE,EAAE;;QACxE,QAAQ,eAAe,CAAC,IAAI,CAAC,EAAE;YAC7B,KAAK,cAAc,CAAC,IAAI,CAAC;YACzB,KAAK,cAAc,CAAC,KAAK;gBACvB,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBACtC,MAAM;YAER,KAAK,cAAc,CAAC,KAAK;gBACtB,KAA4B,CAAC,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBACjE,MAAM;YAER,KAAK,cAAc,CAAC,MAAM;gBACxB,MAAC,KAAyB,CAAC,SAAS,0CAAE,WAAW,CAAC,WAAW,CAAC,CAAC;gBAC/D,MAAM;SACT;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {DecoratorParameters, decoratorTypeOf, DecoratorTypes} from \"@tsed/core\";\nimport {JsonEntityStore} from \"../../domain/JsonEntityStore\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\nimport type {JsonMethodStore, JsonParameterStore} from \"../../domain\";\n\n/**\n * Add a description to the class, method or property\n *\n * ## Examples\n * ### On class\n *\n * ```typescript\n * @Description(\"description\")\n * class Model {\n *\n * }\n * ```\n *\n * ### On method\n *\n * ```typescript\n * @Controller(\"/\")\n * class ModelCtrl {\n * @Description(\"description\")\n * async method() {}\n * }\n * ```\n *\n * ### On parameter\n *\n * ```typescript\n * @Controller(\"/\")\n * class ModelCtrl {\n * async method(@Description(\"description\") @PathParam(\"id\") id: string) {}\n * }\n * ```\n *\n * ### On property\n *\n * ```typescript\n * class Model {\n * @Description(\"description\")\n * id: string;\n * }\n * ```\n *\n * @param {string} description\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n * @classDecorator\n * @methodDecorator\n * @propertyDecorator\n * @parameterDecorator\n */\nexport function Description(description: any) {\n return JsonEntityFn((store: JsonEntityStore, args: DecoratorParameters) => {\n switch (decoratorTypeOf(args)) {\n case DecoratorTypes.PROP:\n case DecoratorTypes.CLASS:\n store.schema.description(description);\n break;\n\n case DecoratorTypes.PARAM:\n (store as JsonParameterStore).parameter.description(description);\n break;\n\n case DecoratorTypes.METHOD:\n (store as JsonMethodStore).operation?.description(description);\n break;\n }\n });\n}\n"]}
1
+ {"version":3,"file":"description.js","sourceRoot":"","sources":["../../../../src/decorators/common/description.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,eAAe,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAEhF,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,UAAU,WAAW,CAAC,WAAgB;IAC1C,OAAO,YAAY,CAAC,CAAC,KAAsB,EAAE,IAAyB,EAAE,EAAE;;QACxE,QAAQ,eAAe,CAAC,IAAI,CAAC,EAAE;YAC7B,KAAK,cAAc,CAAC,IAAI,CAAC;YACzB,KAAK,cAAc,CAAC,KAAK;gBACvB,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBACtC,MAAM;YAER,KAAK,cAAc,CAAC,KAAK;gBACtB,KAA4B,CAAC,SAAS,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;gBACjE,MAAM;YAER,KAAK,cAAc,CAAC,MAAM;gBACxB,MAAC,KAAyB,CAAC,SAAS,0CAAE,WAAW,CAAC,WAAW,CAAC,CAAC;gBAC/D,MAAM;SACT;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {DecoratorParameters, decoratorTypeOf, DecoratorTypes} from \"@tsed/core\";\nimport {JsonEntityStore} from \"../../domain/JsonEntityStore\";\nimport {JsonEntityFn} from \"./jsonEntityFn\";\nimport type {JsonMethodStore} from \"../../domain/JsonMethodStore\";\nimport type {JsonParameterStore} from \"../../domain/JsonParameterStore\";\n\n/**\n * Add a description to the class, method or property\n *\n * ## Examples\n * ### On class\n *\n * ```typescript\n * @Description(\"description\")\n * class Model {\n *\n * }\n * ```\n *\n * ### On method\n *\n * ```typescript\n * @Controller(\"/\")\n * class ModelCtrl {\n * @Description(\"description\")\n * async method() {}\n * }\n * ```\n *\n * ### On parameter\n *\n * ```typescript\n * @Controller(\"/\")\n * class ModelCtrl {\n * async method(@Description(\"description\") @PathParam(\"id\") id: string) {}\n * }\n * ```\n *\n * ### On property\n *\n * ```typescript\n * class Model {\n * @Description(\"description\")\n * id: string;\n * }\n * ```\n *\n * @param {string} description\n * @decorator\n * @validation\n * @swagger\n * @schema\n * @input\n * @classDecorator\n * @methodDecorator\n * @propertyDecorator\n * @parameterDecorator\n */\nexport function Description(description: any) {\n return JsonEntityFn((store: JsonEntityStore, args: DecoratorParameters) => {\n switch (decoratorTypeOf(args)) {\n case DecoratorTypes.PROP:\n case DecoratorTypes.CLASS:\n store.schema.description(description);\n break;\n\n case DecoratorTypes.PARAM:\n (store as JsonParameterStore).parameter.description(description);\n break;\n\n case DecoratorTypes.METHOD:\n (store as JsonMethodStore).operation?.description(description);\n break;\n }\n });\n}\n"]}
@@ -1,26 +1,7 @@
1
- import { isObject } from "@tsed/core";
2
- import { JsonEntityFn } from "./jsonEntityFn";
3
- const transformTsEnum = (enumValue) => {
4
- return Object.keys(enumValue).reduce((acc, key) => {
5
- if (isNaN(+key)) {
6
- const value = enumValue[key];
7
- return acc.concat(value);
8
- }
9
- return acc;
10
- }, []);
11
- };
1
+ import { JsonEntityFn } from "./jsonEntityFn.js";
12
2
  export function Enum(enumValue, ...enumValues) {
13
3
  return JsonEntityFn((store) => {
14
- const values = [enumValue].concat(enumValues).reduce((acc, value) => {
15
- if (isObject(value) && value !== null) {
16
- value = transformTsEnum(value);
17
- }
18
- return acc.concat(value);
19
- }, []);
20
- const types = values.reduce((set, value) => {
21
- return set.add(value === null ? "null" : typeof value);
22
- }, new Set());
23
- store.itemSchema.enum(values).any(...types);
4
+ store.itemSchema.enum(enumValue, ...enumValues);
24
5
  });
25
6
  }
26
7
  //# sourceMappingURL=enum.js.map
@@ -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,gBAAg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","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
  *