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

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 (304) 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 +150 -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 +46 -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/cjs/utils/transformToOS2.js +510 -0
  81. package/lib/cjs/utils/transformToOS2.js.map +1 -0
  82. package/lib/esm/components/anyMapper.js +4 -4
  83. package/lib/esm/components/classMapper.js +4 -4
  84. package/lib/esm/components/genericsMapper.js +4 -4
  85. package/lib/esm/components/inheritedClassMapper.js +2 -2
  86. package/lib/esm/components/itemMapper.js +1 -1
  87. package/lib/esm/components/lazyRefMapper.js +3 -3
  88. package/lib/esm/components/mapMapper.js +2 -2
  89. package/lib/esm/components/objectMapper.js +3 -3
  90. package/lib/esm/components/ofMapper.js +1 -1
  91. package/lib/esm/components/propertiesMapper.js +1 -1
  92. package/lib/esm/components/schemaMapper.js +7 -7
  93. package/lib/esm/components/schemaMapper.js.map +1 -1
  94. package/lib/esm/constants/httpStatusMessages.js +11 -96
  95. package/lib/esm/constants/httpStatusMessages.js.map +1 -1
  96. package/lib/esm/decorators/class/children.js +1 -1
  97. package/lib/esm/decorators/collections/collectionContains.js +1 -1
  98. package/lib/esm/decorators/collections/collectionOf.js +1 -1
  99. package/lib/esm/decorators/collections/maxItems.js +1 -1
  100. package/lib/esm/decorators/collections/maxProperties.js +1 -1
  101. package/lib/esm/decorators/collections/minItems.js +1 -1
  102. package/lib/esm/decorators/collections/minProperties.js +1 -1
  103. package/lib/esm/decorators/collections/uniqueItems.js +1 -1
  104. package/lib/esm/decorators/common/additionalProperties.js +1 -1
  105. package/lib/esm/decorators/common/allOf.js +1 -1
  106. package/lib/esm/decorators/common/allow.js +2 -2
  107. package/lib/esm/decorators/common/any.js +1 -1
  108. package/lib/esm/decorators/common/anyOf.js +5 -1
  109. package/lib/esm/decorators/common/anyOf.js.map +1 -1
  110. package/lib/esm/decorators/common/const.js +1 -1
  111. package/lib/esm/decorators/common/customKey.js +1 -1
  112. package/lib/esm/decorators/common/default.js +1 -1
  113. package/lib/esm/decorators/common/description.js +1 -1
  114. package/lib/esm/decorators/common/description.js.map +1 -1
  115. package/lib/esm/decorators/common/enum.js +2 -21
  116. package/lib/esm/decorators/common/enum.js.map +1 -1
  117. package/lib/esm/decorators/common/example.js +1 -1
  118. package/lib/esm/decorators/common/examples.js +1 -1
  119. package/lib/esm/decorators/common/exclusiveMaximum.js +1 -1
  120. package/lib/esm/decorators/common/exclusiveMinimum.js +1 -1
  121. package/lib/esm/decorators/common/format.js +2 -2
  122. package/lib/esm/decorators/common/forwardGroups.js +1 -1
  123. package/lib/esm/decorators/common/groups.js +2 -2
  124. package/lib/esm/decorators/common/ignore.js +1 -1
  125. package/lib/esm/decorators/common/ignore.js.map +1 -1
  126. package/lib/esm/decorators/common/integer.js +1 -1
  127. package/lib/esm/decorators/common/jsonEntityFn.js +1 -1
  128. package/lib/esm/decorators/common/jsonEntityFn.js.map +1 -1
  129. package/lib/esm/decorators/common/maxLength.js +1 -1
  130. package/lib/esm/decorators/common/maximum.js +1 -1
  131. package/lib/esm/decorators/common/minLength.js +1 -1
  132. package/lib/esm/decorators/common/minimum.js +1 -1
  133. package/lib/esm/decorators/common/multipleOf.js +1 -1
  134. package/lib/esm/decorators/common/name.js +1 -1
  135. package/lib/esm/decorators/common/nullable.js +2 -2
  136. package/lib/esm/decorators/common/oneOf.js +5 -1
  137. package/lib/esm/decorators/common/oneOf.js.map +1 -1
  138. package/lib/esm/decorators/common/optional.js +1 -1
  139. package/lib/esm/decorators/common/pattern.js +1 -1
  140. package/lib/esm/decorators/common/property.js +1 -1
  141. package/lib/esm/decorators/common/readOnly.js +1 -1
  142. package/lib/esm/decorators/common/recordOf.js +59 -0
  143. package/lib/esm/decorators/common/recordOf.js.map +1 -0
  144. package/lib/esm/decorators/common/required.js +2 -2
  145. package/lib/esm/decorators/common/requiredGroups.js +2 -2
  146. package/lib/esm/decorators/common/schema.js +1 -1
  147. package/lib/esm/decorators/common/title.js +1 -1
  148. package/lib/esm/decorators/common/writeOnly.js +1 -1
  149. package/lib/esm/decorators/config/jsonEntityComponent.js +1 -1
  150. package/lib/esm/decorators/generics/genericOf.js +2 -2
  151. package/lib/esm/decorators/generics/generics.js +1 -1
  152. package/lib/esm/decorators/operations/acceptMime.js +24 -0
  153. package/lib/esm/decorators/operations/acceptMime.js.map +1 -0
  154. package/lib/esm/decorators/operations/consumes.js +1 -1
  155. package/lib/esm/decorators/operations/contentType.js +1 -1
  156. package/lib/esm/decorators/operations/deprecated.js +1 -1
  157. package/lib/esm/decorators/operations/header.js +1 -1
  158. package/lib/esm/decorators/operations/in.js +3 -1
  159. package/lib/esm/decorators/operations/in.js.map +1 -1
  160. package/lib/esm/decorators/operations/inFile.js +5 -5
  161. package/lib/esm/decorators/operations/location.js +1 -1
  162. package/lib/esm/decorators/operations/operationId.js +1 -1
  163. package/lib/esm/decorators/operations/operationPath.js +1 -1
  164. package/lib/esm/decorators/operations/partial.js +1 -1
  165. package/lib/esm/decorators/operations/path.js +1 -1
  166. package/lib/esm/decorators/operations/produces.js +1 -1
  167. package/lib/esm/decorators/operations/redirect.js +2 -2
  168. package/lib/esm/decorators/operations/returns.js +8 -8
  169. package/lib/esm/decorators/operations/route.js +3 -3
  170. package/lib/esm/decorators/operations/security.js +1 -1
  171. package/lib/esm/decorators/operations/status.js +1 -1
  172. package/lib/esm/decorators/operations/summary.js +1 -1
  173. package/lib/esm/decorators/operations/tags.js +1 -1
  174. package/lib/esm/decorators/operations/view.js +27 -0
  175. package/lib/esm/decorators/operations/view.js.map +1 -0
  176. package/lib/esm/domain/DecoratorContext.js +1 -1
  177. package/lib/esm/domain/DecoratorContext.js.map +1 -1
  178. package/lib/esm/domain/JsonClassStore.js +3 -3
  179. package/lib/esm/domain/JsonLazyRef.js +2 -2
  180. package/lib/esm/domain/JsonMap.js +1 -1
  181. package/lib/esm/domain/JsonMap.js.map +1 -1
  182. package/lib/esm/domain/JsonMethodStore.js +68 -26
  183. package/lib/esm/domain/JsonMethodStore.js.map +1 -1
  184. package/lib/esm/domain/JsonOperation.js +10 -25
  185. package/lib/esm/domain/JsonOperation.js.map +1 -1
  186. package/lib/esm/domain/JsonOperationPathsMap.js +1 -1
  187. package/lib/esm/domain/JsonOperationRoute.js +5 -1
  188. package/lib/esm/domain/JsonOperationRoute.js.map +1 -1
  189. package/lib/esm/domain/JsonParameter.js +42 -48
  190. package/lib/esm/domain/JsonParameter.js.map +1 -1
  191. package/lib/esm/domain/JsonParameterStore.js +17 -8
  192. package/lib/esm/domain/JsonParameterStore.js.map +1 -1
  193. package/lib/esm/domain/JsonPropertyStore.js +7 -3
  194. package/lib/esm/domain/JsonPropertyStore.js.map +1 -1
  195. package/lib/esm/domain/JsonRequestBody.js +2 -2
  196. package/lib/esm/domain/JsonResponse.js +4 -14
  197. package/lib/esm/domain/JsonResponse.js.map +1 -1
  198. package/lib/esm/domain/JsonSchema.js +9 -16
  199. package/lib/esm/domain/JsonSchema.js.map +1 -1
  200. package/lib/esm/domain/SpecTypes.js +1 -0
  201. package/lib/esm/domain/SpecTypes.js.map +1 -1
  202. package/lib/esm/index.js +150 -20
  203. package/lib/esm/index.js.map +1 -1
  204. package/lib/esm/interfaces/JsonSchemaOptions.js.map +1 -1
  205. package/lib/esm/package.json +3 -0
  206. package/lib/esm/utils/from.js +5 -4
  207. package/lib/esm/utils/from.js.map +1 -1
  208. package/lib/esm/utils/generateSpec.js +41 -0
  209. package/lib/esm/utils/generateSpec.js.map +1 -0
  210. package/lib/esm/utils/generics.js.map +1 -1
  211. package/lib/esm/utils/getInheritedStores.js +1 -1
  212. package/lib/esm/utils/getJsonEntityStore.js +5 -5
  213. package/lib/esm/utils/getJsonSchema.js +14 -4
  214. package/lib/esm/utils/getJsonSchema.js.map +1 -1
  215. package/lib/esm/utils/getJsonType.js +2 -2
  216. package/lib/esm/utils/getJsonType.js.map +1 -1
  217. package/lib/esm/utils/getOperationsRoutes.js +5 -4
  218. package/lib/esm/utils/getOperationsRoutes.js.map +1 -1
  219. package/lib/esm/utils/getOperationsStores.js +4 -4
  220. package/lib/esm/utils/getPropertiesStores.js +3 -3
  221. package/lib/esm/utils/getRequiredProperties.js +1 -1
  222. package/lib/esm/utils/getSpec.js +65 -50
  223. package/lib/esm/utils/getSpec.js.map +1 -1
  224. package/lib/esm/utils/getSpecType.js +16 -0
  225. package/lib/esm/utils/getSpecType.js.map +1 -0
  226. package/lib/esm/utils/mapNullableType.js +2 -2
  227. package/lib/esm/utils/mapNullableType.js.map +1 -1
  228. package/lib/esm/utils/mapOpenSpec.js +37 -0
  229. package/lib/esm/utils/mapOpenSpec.js.map +1 -0
  230. package/lib/esm/utils/mapOpenSpec2.js +30 -0
  231. package/lib/esm/utils/mapOpenSpec2.js.map +1 -0
  232. package/lib/esm/utils/mapOpenSpec3.js +22 -0
  233. package/lib/esm/utils/mapOpenSpec3.js.map +1 -0
  234. package/lib/esm/utils/mapOpenSpecInfo.js +17 -0
  235. package/lib/esm/utils/mapOpenSpecInfo.js.map +1 -0
  236. package/lib/esm/utils/mapRouteOptions.js +1 -1
  237. package/lib/esm/utils/mergeOperation.js +4 -3
  238. package/lib/esm/utils/mergeOperation.js.map +1 -1
  239. package/lib/esm/utils/mergeSpec.js.map +1 -1
  240. package/lib/esm/utils/ref.js +1 -1
  241. package/lib/esm/utils/serializeEnumValues.js +21 -0
  242. package/lib/esm/utils/serializeEnumValues.js.map +1 -0
  243. package/lib/esm/utils/toJsonMapCollection.js +1 -1
  244. package/lib/esm/utils/transformToOS2.js +504 -0
  245. package/lib/esm/utils/transformToOS2.js.map +1 -0
  246. package/lib/types/constants/httpStatusMessages.d.ts +2 -263
  247. package/lib/types/decorators/common/anyOf.d.ts +4 -0
  248. package/lib/types/decorators/common/ignore.d.ts +1 -1
  249. package/lib/types/decorators/common/jsonEntityFn.d.ts +1 -1
  250. package/lib/types/decorators/common/oneOf.d.ts +4 -0
  251. package/lib/types/decorators/common/recordOf.d.ts +46 -0
  252. package/lib/types/decorators/operations/acceptMime.d.ts +19 -0
  253. package/lib/types/decorators/operations/in.d.ts +1 -1
  254. package/lib/types/decorators/operations/view.d.ts +23 -0
  255. package/lib/types/domain/JsonMap.d.ts +1 -1
  256. package/lib/types/domain/JsonMethodStore.d.ts +51 -2
  257. package/lib/types/domain/JsonOperation.d.ts +2 -1
  258. package/lib/types/domain/JsonOperationRoute.d.ts +5 -3
  259. package/lib/types/domain/JsonParameter.d.ts +2 -1
  260. package/lib/types/domain/JsonParameterStore.d.ts +23 -1
  261. package/lib/types/domain/JsonPropertyStore.d.ts +7 -0
  262. package/lib/types/domain/JsonResponse.d.ts +2 -1
  263. package/lib/types/domain/JsonSchema.d.ts +2 -2
  264. package/lib/types/domain/SpecTypes.d.ts +1 -0
  265. package/lib/types/index.d.ts +143 -13
  266. package/lib/types/interfaces/JsonSchemaOptions.d.ts +2 -2
  267. package/lib/types/utils/generateSpec.d.ts +16 -0
  268. package/lib/types/utils/generics.d.ts +1 -1
  269. package/lib/types/utils/getJsonSchema.d.ts +12 -2
  270. package/lib/types/utils/getOperationsRoutes.d.ts +2 -2
  271. package/lib/types/utils/getSpec.d.ts +5 -4
  272. package/lib/types/utils/getSpecType.d.ts +12 -0
  273. package/lib/types/utils/mapNullableType.d.ts +1 -1
  274. package/lib/types/utils/mapOpenSpec.d.ts +10 -0
  275. package/lib/types/utils/mapOpenSpec2.d.ts +9 -0
  276. package/lib/types/utils/mapOpenSpec3.d.ts +8 -0
  277. package/lib/types/utils/mapOpenSpecInfo.d.ts +6 -0
  278. package/lib/types/utils/mergeSpec.d.ts +2 -2
  279. package/lib/types/utils/serializeEnumValues.d.ts +5 -0
  280. package/lib/types/utils/transformToOS2.d.ts +25 -0
  281. package/package.json +30 -15
  282. package/readme.md +1 -0
  283. package/tsconfig.compile.esm.json +2 -12
  284. package/benchmark/cold-start.js +0 -17
  285. package/lib/cjs/components/index.js +0 -15
  286. package/lib/cjs/components/index.js.map +0 -1
  287. package/lib/cjs/decorators/index.js +0 -77
  288. package/lib/cjs/decorators/index.js.map +0 -1
  289. package/lib/cjs/domain/index.js +0 -20
  290. package/lib/cjs/domain/index.js.map +0 -1
  291. package/lib/cjs/interfaces/index.js +0 -8
  292. package/lib/cjs/interfaces/index.js.map +0 -1
  293. package/lib/esm/components/index.js +0 -12
  294. package/lib/esm/components/index.js.map +0 -1
  295. package/lib/esm/decorators/index.js +0 -74
  296. package/lib/esm/decorators/index.js.map +0 -1
  297. package/lib/esm/domain/index.js +0 -17
  298. package/lib/esm/domain/index.js.map +0 -1
  299. package/lib/esm/interfaces/index.js +0 -5
  300. package/lib/esm/interfaces/index.js.map +0 -1
  301. package/lib/types/components/index.d.ts +0 -11
  302. package/lib/types/decorators/index.d.ts +0 -68
  303. package/lib/types/domain/index.d.ts +0 -16
  304. package/lib/types/interfaces/index.d.ts +0 -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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ethodsOf, 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,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AE,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)) {
@@ -1,12 +1,12 @@
1
1
  import { decorateMethodsOf, decoratorTypeOf, DecoratorTypes, isArray, isCollection, isObject, isPlainObject, isPrimitiveOrPrimitiveClass, isString } from "@tsed/core";
2
- import { getStatusMessage } from "../../constants/httpStatusMessages";
3
- import { DecoratorContext } from "../../domain/DecoratorContext";
4
- import { JsonEntityStore } from "../../domain/JsonEntityStore";
5
- import { JsonSchema } from "../../domain/JsonSchema";
6
- import { getStatusModel } from "../../utils/defineStatusModel";
7
- import { string } from "../../utils/from";
8
- import { isSuccessStatus } from "../../utils/isSuccessStatus";
9
- import { mapHeaders } from "../../utils/mapHeaders";
2
+ import { getStatusMessage } from "../../constants/httpStatusMessages.js";
3
+ import { DecoratorContext } from "../../domain/DecoratorContext.js";
4
+ import { JsonEntityStore } from "../../domain/JsonEntityStore.js";
5
+ import { JsonSchema } from "../../domain/JsonSchema.js";
6
+ import { getStatusModel } from "../../utils/defineStatusModel.js";
7
+ import { string } from "../../utils/from.js";
8
+ import { isSuccessStatus } from "../../utils/isSuccessStatus.js";
9
+ import { mapHeaders } from "../../utils/mapHeaders.js";
10
10
  /**
11
11
  * @ignore
12
12
  */
@@ -1,6 +1,6 @@
1
- import { DecoratorContext } from "../../domain/DecoratorContext";
2
- import { mapRouteOptions } from "../../utils/mapRouteOptions";
3
- import { OperationMethods } from "../../constants/httpMethods";
1
+ import { DecoratorContext } from "../../domain/DecoratorContext.js";
2
+ import { mapRouteOptions } from "../../utils/mapRouteOptions.js";
3
+ import { OperationMethods } from "../../constants/httpMethods.js";
4
4
  class RouteDecoratorContext extends DecoratorContext {
5
5
  constructor() {
6
6
  super(...arguments);
@@ -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 security metadata on the decorated method.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { Returns } from "./returns";
1
+ import { Returns } from "./returns.js";
2
2
  /**
3
3
  * Add responses documentation for a specific status code.
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
  * Add summary metadata on the decorated element.
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
  function mapTags(tags) {
4
4
  return tags.map((tag) => {
5
5
  if (typeof tag === "string") {
@@ -0,0 +1,27 @@
1
+ import { StoreSet } from "@tsed/core";
2
+ /**
3
+ * Use a view and sends the rendered HTML string to the client. Optional parameter:
4
+ *
5
+ * * viewOptions, an object whose properties define local variables for the view.
6
+ *
7
+ * The view argument is a string that is the file path of the view file to render.
8
+ * This can be an absolute path, or a path relative to the views setting.
9
+ * If the path does not contain a file extension, then the view engine setting determines the file extension.
10
+ * If the path does contain a file extension, then Express will load the module for the specified template engine (via require())
11
+ * and render it using the loaded module’s __express function.
12
+ *
13
+ * For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).
14
+ *
15
+ * > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,
16
+ * and as so for security reasons should not contain input from the end-user.
17
+ *
18
+ * @param path Relative path to the view file.
19
+ * @param options Additional options
20
+ * @decorator
21
+ * @operation
22
+ * @response
23
+ */
24
+ export function View(path, options) {
25
+ return StoreSet("view", { path, options });
26
+ }
27
+ //# sourceMappingURL=view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view.js","sourceRoot":"","sources":["../../../../src/decorators/operations/view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,IAAI,CAAC,IAAY,EAAE,OAAgB;IACjD,OAAO,QAAQ,CAAC,MAAM,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC,CAAQ,CAAC;AAClD,CAAC","sourcesContent":["import {StoreSet} from \"@tsed/core\";\n\n/**\n * Use a view and sends the rendered HTML string to the client. Optional parameter:\n *\n * * viewOptions, an object whose properties define local variables for the view.\n *\n * The view argument is a string that is the file path of the view file to render.\n * This can be an absolute path, or a path relative to the views setting.\n * If the path does not contain a file extension, then the view engine setting determines the file extension.\n * If the path does contain a file extension, then Express will load the module for the specified template engine (via require())\n * and render it using the loaded module’s __express function.\n *\n * For more information, see [Using template engines with Express](http://expressjs.com/guide/using-template-engines.html).\n *\n * > NOTE: The view argument performs file system operations like reading a file from disk and evaluating Node.js modules,\n * and as so for security reasons should not contain input from the end-user.\n *\n * @param path Relative path to the view file.\n * @param options Additional options\n * @decorator\n * @operation\n * @response\n */\nexport function View(path: string, options?: Object): MethodDecorator {\n return StoreSet(\"view\", {path, options}) as any;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { DecoratorTypes } from "@tsed/core";
2
2
  import { pascalCase } from "pascal-case";
3
- import { JsonEntityStore } from "./JsonEntityStore";
3
+ import { JsonEntityStore } from "./JsonEntityStore.js";
4
4
  /**
5
5
  * @ignore
6
6
  */
@@ -1 +1 @@
1
- {"version":3,"file":"DecoratorContext.js","sourceRoot":"","sources":["../../../src/domain/DecoratorContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,cAAc,EAAC,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AASlD;;GAEG;AACH,MAAM,OAAgB,gBAA0B,SAAQ,GAAgB;IAMtE,YAAY,OAAY,EAAE;QACxB,KAAK,EAAE,CAAC;QAHA,YAAO,GAA6B,EAAE,CAAC;QAK/C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,C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MAAW,EAAE,EAAE;YACnC,MAAM,CAAC,IAAI,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAES,UAAU,KAAI,CAAC;IAEf,SAAS,KAAI,CAAC;CACzB","sourcesContent":["import {DecoratorParameters, DecoratorTypes} from \"@tsed/core\";\nimport {pascalCase} from \"pascal-case\";\nimport {JsonEntityStore} from \"./JsonEntityStore\";\n\n/**\n * @ignore\n */\nexport interface DecoratorActionHandler {\n (ctx: Map<string, any>): void;\n}\n\n/**\n * @ignore\n */\nexport abstract class DecoratorContext<T = any> extends Map<string, any> {\n readonly methods: string[];\n protected decoratorType: DecoratorTypes;\n protected entity: JsonEntityStore;\n protected actions: DecoratorActionHandler[] = [];\n\n constructor(opts: any = {}) {\n super();\n\n Object.entries(opts).forEach(([key, value]) => {\n this.set(key, value);\n });\n }\n\n addAction(cb: DecoratorActionHandler) {\n this.actions.push(cb);\n return this;\n }\n\n build(): T {\n const decorator: any = (...args: DecoratorParameters) => this.bind(args, decorator);\n\n const wrap = (cb: any) => {\n return (...args: any[]) => {\n cb(...args);\n return decorator;\n };\n };\n\n const wrapKey = (key: string) => {\n return wrap((...values: any[]) => {\n key in this ? (this as any)[key](...values) : this.set(key, values[0]);\n });\n };\n\n this.methods.forEach((name) => {\n decorator[pascalCase(name)] = wrapKey(name);\n });\n\n return (decorator as unknown) as T;\n }\n\n toObject(): any {\n return [...this.entries()].reduce((obj, [key, value]) => {\n return {\n ...obj,\n [key]: value\n };\n }, {});\n }\n\n getMergedKey(key: string, defaultValue: any) {\n let value = this.get(key) || defaultValue;\n\n if (!value) {\n return;\n }\n\n if (this.decoratorType === DecoratorTypes.CLASS) {\n value = {\n ...value,\n ...(defaultValue || {})\n };\n }\n\n return {\n ...(defaultValue || {}),\n ...value\n };\n }\n\n protected bind(args: DecoratorParameters, decorator: any) {\n this.entity = JsonEntityStore.from(...args);\n\n this.beforeInit();\n this.onInit(args, decorator);\n this.afterInit();\n }\n\n protected onInit(args: DecoratorParameters, decorator: any): void {\n this.forEach((value, key) => {\n this.onMapKey(key, value);\n });\n }\n\n protected onMapKey(key: string, value: any): void {\n this.entity.set(key, value);\n }\n\n protected runActions() {\n this.actions.forEach((action: any) => {\n action(this);\n });\n\n return this;\n }\n\n protected beforeInit() {}\n\n protected afterInit() {}\n}\n"]}
1
+ {"version":3,"file":"DecoratorContext.js","sourceRoot":"","sources":["../../../src/domain/DecoratorContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,cAAc,EAAC,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AASlD;;GAEG;AACH,MAAM,OAAgB,gBAA0B,SAAQ,GAAgB;IAMtE,YAAY,OAAY,EAAE;QACxB,KAAK,EAAE,CAAC;QAHA,YAAO,GAA6B,EAAE,CAAC;QAK/C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC5C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,SAAS,CAAC,EAA0B;QAClC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,MAAM,SAAS,GAAQ,CAAC,GAAG,IAAyB,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAEpF,MAAM,IAAI,GAAG,CAAC,EAAO,EAAE,EAAE;YACvB,OAAO,CAAC,GAAG,IAAW,EAAE,EAAE;gBACxB,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;gBACZ,OAAO,SAAS,CAAC;YACnB,CAAC,CAAC;QACJ,CAAC,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I,CAAC,IAAyB,EAAE,SAAc;QACtD,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAE5C,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAC7B,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAES,MAAM,CAAC,IAAyB,EAAE,SAAc;QACxD,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC1B,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;IAES,QAAQ,CAAC,GAAW,EAAE,KAAU;QACxC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IAES,UAAU;QAClB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAW,EAAE,EAAE;YACnC,MAAM,CAAC,IAAI,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAES,UAAU,KAAI,CAAC;IAEf,SAAS,KAAI,CAAC;CACzB","sourcesContent":["import {DecoratorParameters, DecoratorTypes} from \"@tsed/core\";\nimport {pascalCase} from \"pascal-case\";\nimport {JsonEntityStore} from \"./JsonEntityStore\";\n\n/**\n * @ignore\n */\nexport interface DecoratorActionHandler {\n (ctx: Map<string, any>): void;\n}\n\n/**\n * @ignore\n */\nexport abstract class DecoratorContext<T = any> extends Map<string, any> {\n readonly methods: string[];\n protected decoratorType: DecoratorTypes;\n protected entity: JsonEntityStore;\n protected actions: DecoratorActionHandler[] = [];\n\n constructor(opts: any = {}) {\n super();\n\n Object.entries(opts).forEach(([key, value]) => {\n this.set(key, value);\n });\n }\n\n addAction(cb: DecoratorActionHandler) {\n this.actions.push(cb);\n return this;\n }\n\n build(): T {\n const decorator: any = (...args: DecoratorParameters) => this.bind(args, decorator);\n\n const wrap = (cb: any) => {\n return (...args: any[]) => {\n cb(...args);\n return decorator;\n };\n };\n\n const wrapKey = (key: string) => {\n return wrap((...values: any[]) => {\n key in this ? (this as any)[key](...values) : this.set(key, values[0]);\n });\n };\n\n this.methods.forEach((name) => {\n decorator[pascalCase(name)] = wrapKey(name);\n });\n\n return decorator as unknown as T;\n }\n\n toObject(): any {\n return [...this.entries()].reduce((obj, [key, value]) => {\n return {\n ...obj,\n [key]: value\n };\n }, {});\n }\n\n getMergedKey(key: string, defaultValue: any) {\n let value = this.get(key) || defaultValue;\n\n if (!value) {\n return;\n }\n\n if (this.decoratorType === DecoratorTypes.CLASS) {\n value = {\n ...value,\n ...(defaultValue || {})\n };\n }\n\n return {\n ...(defaultValue || {}),\n ...value\n };\n }\n\n protected bind(args: DecoratorParameters, decorator: any) {\n this.entity = JsonEntityStore.from(...args);\n\n this.beforeInit();\n this.onInit(args, decorator);\n this.afterInit();\n }\n\n protected onInit(args: DecoratorParameters, decorator: any): void {\n this.forEach((value, key) => {\n this.onMapKey(key, value);\n });\n }\n\n protected onMapKey(key: string, value: any): void {\n this.entity.set(key, value);\n }\n\n protected runActions() {\n this.actions.forEach((action: any) => {\n action(this);\n });\n\n return this;\n }\n\n protected beforeInit() {}\n\n protected afterInit() {}\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { DecoratorTypes } from "@tsed/core";
3
- import { JsonEntityStore } from "./JsonEntityStore";
4
- import { JsonSchema } from "./JsonSchema";
5
- import { JsonEntityComponent } from "../decorators/config/jsonEntityComponent";
3
+ import { JsonEntityStore } from "./JsonEntityStore.js";
4
+ import { JsonSchema } from "./JsonSchema.js";
5
+ import { JsonEntityComponent } from "../decorators/config/jsonEntityComponent.js";
6
6
  let JsonClassStore = class JsonClassStore extends JsonEntityStore {
7
7
  constructor() {
8
8
  super(...arguments);
@@ -1,6 +1,6 @@
1
1
  import { nameOf } from "@tsed/core";
2
- import { execMapper } from "../registries/JsonSchemaMapperContainer";
3
- import { getJsonEntityStore } from "../utils/getJsonEntityStore";
2
+ import { execMapper } from "../registries/JsonSchemaMapperContainer.js";
3
+ import { getJsonEntityStore } from "../utils/getJsonEntityStore.js";
4
4
  export class JsonLazyRef {
5
5
  constructor(getType) {
6
6
  this.getType = getType;
@@ -1,5 +1,5 @@
1
1
  import { isFunction } from "@tsed/core";
2
- import { execMapper } from "../registries/JsonSchemaMapperContainer";
2
+ import { execMapper } from "../registries/JsonSchemaMapperContainer.js";
3
3
  export class JsonMap extends Map {
4
4
  constructor(obj = {}) {
5
5
  super();
@@ -1 +1 @@
1
- {"version":3,"file":"JsonMap.js","sourceRoot":"","sources":["../../../src/domain/JsonMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAC,UAAU,EAAC,MAAM,yCAAyC,CAAC;AAEnE,MAAM,OAAO,OAAW,SAAQ,GAAgB;IAG9C,YAAY,MAAkB,EAAE;QAC9B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,MAAwB,EAAE;QAC/B,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC3C,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;gBACzB,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;aAClB;iBAAM;gBACL,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACtB;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,UAA6B,EAAE;QACpC,OAAO,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import {isFunction} from \"@tsed/core\";\nimport {JsonSchemaOptions} from \"../interfaces\";\nimport {execMapper} from \"../registries/JsonSchemaMapperContainer\";\n\nexport class JsonMap<T> extends Map<string, any> {\n [key: string]: any;\n\n constructor(obj: Partial<T> = {}) {\n super();\n\n this.assign(obj);\n }\n\n assign(obj: Partial<T> & any = {}) {\n Object.entries(obj).forEach(([key, value]) => {\n if (isFunction(this[key])) {\n this[key](value);\n } else {\n this.set(key, value);\n }\n });\n\n return this;\n }\n\n toJSON(options: JsonSchemaOptions = {}) {\n return execMapper(\"map\", this, options);\n }\n}\n"]}
1
+ {"version":3,"file":"JsonMap.js","sourceRoot":"","sources":["../../../src/domain/JsonMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAC,UAAU,EAAC,MAAM,yCAAyC,CAAC;AAEnE,MAAM,OAAO,OAAW,SAAQ,GAAgB;IAG9C,YAAY,MAAkB,EAAE;QAC9B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,MAAwB,EAAE;QAC/B,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC3C,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;gBACzB,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;aAClB;iBAAM;gBACL,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACtB;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,UAA6B,EAAE;QACpC,OAAO,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import {isFunction} from \"@tsed/core\";\nimport {JsonSchemaOptions} from \"../interfaces/JsonSchemaOptions\";\nimport {execMapper} from \"../registries/JsonSchemaMapperContainer\";\n\nexport class JsonMap<T> extends Map<string, any> {\n [key: string]: any;\n\n constructor(obj: Partial<T> = {}) {\n super();\n\n this.assign(obj);\n }\n\n assign(obj: Partial<T> & any = {}) {\n Object.entries(obj).forEach(([key, value]) => {\n if (isFunction(this[key])) {\n this[key](value);\n } else {\n this.set(key, value);\n }\n });\n\n return this;\n }\n\n toJSON(options: JsonSchemaOptions = {}) {\n return execMapper(\"map\", this, options);\n }\n}\n"]}