@tsed/core 8.0.0-alpha.1 → 8.0.0-alpha.11

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 (296) hide show
  1. package/lib/browser/core.umd.min.js +1 -1
  2. package/lib/browser/core.umd.min.js.map +1 -1
  3. package/lib/esm/decorators/deprecated.js.map +1 -1
  4. package/lib/esm/decorators/storeFn.js.map +1 -1
  5. package/lib/esm/domain/AnyToPromise.js.map +1 -1
  6. package/lib/esm/domain/Hooks.js +1 -4
  7. package/lib/esm/domain/Hooks.js.map +1 -1
  8. package/lib/esm/domain/Metadata.js.map +1 -1
  9. package/lib/esm/domain/Store.js.map +1 -1
  10. package/lib/esm/utils/catchError.js.map +1 -1
  11. package/lib/esm/utils/decorators/decorateMethodsOf.js.map +1 -1
  12. package/lib/esm/utils/decorators/decoratorTypeOf.js.map +1 -1
  13. package/lib/esm/utils/decorators/inheritedDescriptorOf.js.map +1 -1
  14. package/lib/esm/utils/http/getHostInfoFromPort.js.map +1 -1
  15. package/lib/esm/utils/imports/importPackage.js.map +1 -1
  16. package/lib/esm/utils/objects/ancestorsOf.js +1 -1
  17. package/lib/esm/utils/objects/ancestorsOf.js.map +1 -1
  18. package/lib/esm/utils/objects/cleanObject.js.map +1 -1
  19. package/lib/esm/utils/objects/deepClone.js +2 -2
  20. package/lib/esm/utils/objects/deepClone.js.map +1 -1
  21. package/lib/esm/utils/objects/deepMerge.js.map +1 -1
  22. package/lib/esm/utils/objects/getEnumerableKeys.js.map +1 -1
  23. package/lib/esm/utils/objects/getValue.js.map +1 -1
  24. package/lib/esm/utils/objects/isBuffer.js.map +1 -1
  25. package/lib/esm/utils/objects/isClass.js.map +1 -1
  26. package/lib/esm/utils/objects/isEnumerable.js.map +1 -1
  27. package/lib/esm/utils/objects/isInheritedFrom.js +1 -1
  28. package/lib/esm/utils/objects/isInheritedFrom.js.map +1 -1
  29. package/lib/esm/utils/objects/isSerializable.js +2 -2
  30. package/lib/esm/utils/objects/isSerializable.js.map +1 -1
  31. package/lib/esm/utils/objects/methodsOf.js +1 -1
  32. package/lib/esm/utils/objects/methodsOf.js.map +1 -1
  33. package/lib/esm/utils/objects/nameOf.js.map +1 -1
  34. package/lib/esm/utils/objects/primitiveOf.js.map +1 -1
  35. package/lib/esm/utils/objects/setValue.js.map +1 -1
  36. package/lib/esm/utils/objects/toMap.js.map +1 -1
  37. package/lib/esm/utils/proxyDelegation.js.map +1 -1
  38. package/lib/types/utils/objects/deepClone.d.ts +1 -1
  39. package/lib/types/utils/objects/isBuffer.d.ts +2 -1
  40. package/package.json +14 -15
  41. package/vitest.config.mts +5 -5
  42. package/lib/cjs/decorators/configurable.js +0 -14
  43. package/lib/cjs/decorators/configurable.js.map +0 -1
  44. package/lib/cjs/decorators/deprecated.js +0 -71
  45. package/lib/cjs/decorators/deprecated.js.map +0 -1
  46. package/lib/cjs/decorators/enumerable.js +0 -14
  47. package/lib/cjs/decorators/enumerable.js.map +0 -1
  48. package/lib/cjs/decorators/notConfigurable.js +0 -9
  49. package/lib/cjs/decorators/notConfigurable.js.map +0 -1
  50. package/lib/cjs/decorators/notEnumerable.js +0 -9
  51. package/lib/cjs/decorators/notEnumerable.js.map +0 -1
  52. package/lib/cjs/decorators/readOnly.js +0 -9
  53. package/lib/cjs/decorators/readOnly.js.map +0 -1
  54. package/lib/cjs/decorators/storeFn.js +0 -22
  55. package/lib/cjs/decorators/storeFn.js.map +0 -1
  56. package/lib/cjs/decorators/storeMerge.js +0 -11
  57. package/lib/cjs/decorators/storeMerge.js.map +0 -1
  58. package/lib/cjs/decorators/storeSet.js +0 -11
  59. package/lib/cjs/decorators/storeSet.js.map +0 -1
  60. package/lib/cjs/decorators/writable.js +0 -14
  61. package/lib/cjs/decorators/writable.js.map +0 -1
  62. package/lib/cjs/domain/AnyToPromise.js +0 -147
  63. package/lib/cjs/domain/AnyToPromise.js.map +0 -1
  64. package/lib/cjs/domain/DecoratorTypes.js +0 -15
  65. package/lib/cjs/domain/DecoratorTypes.js.map +0 -1
  66. package/lib/cjs/domain/Env.js +0 -19
  67. package/lib/cjs/domain/Env.js.map +0 -1
  68. package/lib/cjs/domain/Hooks.js +0 -99
  69. package/lib/cjs/domain/Hooks.js.map +0 -1
  70. package/lib/cjs/domain/Metadata.js +0 -508
  71. package/lib/cjs/domain/Metadata.js.map +0 -1
  72. package/lib/cjs/domain/Store.js +0 -157
  73. package/lib/cjs/domain/Store.js.map +0 -1
  74. package/lib/cjs/domain/Type.js +0 -7
  75. package/lib/cjs/domain/Type.js.map +0 -1
  76. package/lib/cjs/errors/UnsupportedDecoratorType.js +0 -23
  77. package/lib/cjs/errors/UnsupportedDecoratorType.js.map +0 -1
  78. package/lib/cjs/index.js +0 -90
  79. package/lib/cjs/index.js.map +0 -1
  80. package/lib/cjs/interfaces/AnyDecorator.js +0 -3
  81. package/lib/cjs/interfaces/AnyDecorator.js.map +0 -1
  82. package/lib/cjs/interfaces/DecoratorParameters.js +0 -3
  83. package/lib/cjs/interfaces/DecoratorParameters.js.map +0 -1
  84. package/lib/cjs/interfaces/MetadataTypes.js +0 -3
  85. package/lib/cjs/interfaces/MetadataTypes.js.map +0 -1
  86. package/lib/cjs/interfaces/Relation.js +0 -3
  87. package/lib/cjs/interfaces/Relation.js.map +0 -1
  88. package/lib/cjs/interfaces/ValueOf.js +0 -3
  89. package/lib/cjs/interfaces/ValueOf.js.map +0 -1
  90. package/lib/cjs/package.json +0 -3
  91. package/lib/cjs/utils/catchError.js +0 -22
  92. package/lib/cjs/utils/catchError.js.map +0 -1
  93. package/lib/cjs/utils/decorators/decorateMethodsOf.js +0 -29
  94. package/lib/cjs/utils/decorators/decorateMethodsOf.js.map +0 -1
  95. package/lib/cjs/utils/decorators/decoratorArgs.js +0 -9
  96. package/lib/cjs/utils/decorators/decoratorArgs.js.map +0 -1
  97. package/lib/cjs/utils/decorators/decoratorTypeOf.js +0 -23
  98. package/lib/cjs/utils/decorators/decoratorTypeOf.js.map +0 -1
  99. package/lib/cjs/utils/decorators/inheritedDescriptorOf.js +0 -15
  100. package/lib/cjs/utils/decorators/inheritedDescriptorOf.js.map +0 -1
  101. package/lib/cjs/utils/decorators/useDecorators.js +0 -14
  102. package/lib/cjs/utils/decorators/useDecorators.js.map +0 -1
  103. package/lib/cjs/utils/decorators/useMethodDecorators.js +0 -15
  104. package/lib/cjs/utils/decorators/useMethodDecorators.js.map +0 -1
  105. package/lib/cjs/utils/getRandomId.js +0 -8
  106. package/lib/cjs/utils/getRandomId.js.map +0 -1
  107. package/lib/cjs/utils/http/getHostInfoFromPort.js +0 -21
  108. package/lib/cjs/utils/http/getHostInfoFromPort.js.map +0 -1
  109. package/lib/cjs/utils/imports/importPackage.js +0 -39
  110. package/lib/cjs/utils/imports/importPackage.js.map +0 -1
  111. package/lib/cjs/utils/objects/ancestorOf.js +0 -12
  112. package/lib/cjs/utils/objects/ancestorOf.js.map +0 -1
  113. package/lib/cjs/utils/objects/ancestorsOf.js +0 -22
  114. package/lib/cjs/utils/objects/ancestorsOf.js.map +0 -1
  115. package/lib/cjs/utils/objects/classOf.js +0 -23
  116. package/lib/cjs/utils/objects/classOf.js.map +0 -1
  117. package/lib/cjs/utils/objects/cleanObject.js +0 -24
  118. package/lib/cjs/utils/objects/cleanObject.js.map +0 -1
  119. package/lib/cjs/utils/objects/constructorOf.js +0 -20
  120. package/lib/cjs/utils/objects/constructorOf.js.map +0 -1
  121. package/lib/cjs/utils/objects/createInstance.js +0 -9
  122. package/lib/cjs/utils/objects/createInstance.js.map +0 -1
  123. package/lib/cjs/utils/objects/deepClone.js +0 -77
  124. package/lib/cjs/utils/objects/deepClone.js.map +0 -1
  125. package/lib/cjs/utils/objects/deepMerge.js +0 -63
  126. package/lib/cjs/utils/objects/deepMerge.js.map +0 -1
  127. package/lib/cjs/utils/objects/descriptorOf.js +0 -18
  128. package/lib/cjs/utils/objects/descriptorOf.js.map +0 -1
  129. package/lib/cjs/utils/objects/getClassOrSymbol.js +0 -10
  130. package/lib/cjs/utils/objects/getClassOrSymbol.js.map +0 -1
  131. package/lib/cjs/utils/objects/getConstructorArgNames.js +0 -14
  132. package/lib/cjs/utils/objects/getConstructorArgNames.js.map +0 -1
  133. package/lib/cjs/utils/objects/getEnumerableKeys.js +0 -20
  134. package/lib/cjs/utils/objects/getEnumerableKeys.js.map +0 -1
  135. package/lib/cjs/utils/objects/getValue.js +0 -49
  136. package/lib/cjs/utils/objects/getValue.js.map +0 -1
  137. package/lib/cjs/utils/objects/hasJsonMethod.js +0 -8
  138. package/lib/cjs/utils/objects/hasJsonMethod.js.map +0 -1
  139. package/lib/cjs/utils/objects/isArray.js +0 -23
  140. package/lib/cjs/utils/objects/isArray.js.map +0 -1
  141. package/lib/cjs/utils/objects/isArrowFn.js +0 -9
  142. package/lib/cjs/utils/objects/isArrowFn.js.map +0 -1
  143. package/lib/cjs/utils/objects/isBoolean.js +0 -17
  144. package/lib/cjs/utils/objects/isBoolean.js.map +0 -1
  145. package/lib/cjs/utils/objects/isBuffer.js +0 -21
  146. package/lib/cjs/utils/objects/isBuffer.js.map +0 -1
  147. package/lib/cjs/utils/objects/isClass.js +0 -28
  148. package/lib/cjs/utils/objects/isClass.js.map +0 -1
  149. package/lib/cjs/utils/objects/isCollection.js +0 -22
  150. package/lib/cjs/utils/objects/isCollection.js.map +0 -1
  151. package/lib/cjs/utils/objects/isDate.js +0 -13
  152. package/lib/cjs/utils/objects/isDate.js.map +0 -1
  153. package/lib/cjs/utils/objects/isEmpty.js +0 -14
  154. package/lib/cjs/utils/objects/isEmpty.js.map +0 -1
  155. package/lib/cjs/utils/objects/isEnumerable.js +0 -22
  156. package/lib/cjs/utils/objects/isEnumerable.js.map +0 -1
  157. package/lib/cjs/utils/objects/isFunction.js +0 -8
  158. package/lib/cjs/utils/objects/isFunction.js.map +0 -1
  159. package/lib/cjs/utils/objects/isInheritedFrom.js +0 -26
  160. package/lib/cjs/utils/objects/isInheritedFrom.js.map +0 -1
  161. package/lib/cjs/utils/objects/isMomentObject.js +0 -8
  162. package/lib/cjs/utils/objects/isMomentObject.js.map +0 -1
  163. package/lib/cjs/utils/objects/isMongooseObject.js +0 -13
  164. package/lib/cjs/utils/objects/isMongooseObject.js.map +0 -1
  165. package/lib/cjs/utils/objects/isNil.js +0 -8
  166. package/lib/cjs/utils/objects/isNil.js.map +0 -1
  167. package/lib/cjs/utils/objects/isNumber.js +0 -17
  168. package/lib/cjs/utils/objects/isNumber.js.map +0 -1
  169. package/lib/cjs/utils/objects/isObject.js +0 -8
  170. package/lib/cjs/utils/objects/isObject.js.map +0 -1
  171. package/lib/cjs/utils/objects/isObservable.js +0 -8
  172. package/lib/cjs/utils/objects/isObservable.js.map +0 -1
  173. package/lib/cjs/utils/objects/isPlainObject.js +0 -18
  174. package/lib/cjs/utils/objects/isPlainObject.js.map +0 -1
  175. package/lib/cjs/utils/objects/isPrimitive.js +0 -30
  176. package/lib/cjs/utils/objects/isPrimitive.js.map +0 -1
  177. package/lib/cjs/utils/objects/isPromise.js +0 -16
  178. package/lib/cjs/utils/objects/isPromise.js.map +0 -1
  179. package/lib/cjs/utils/objects/isProtectedKey.js +0 -12
  180. package/lib/cjs/utils/objects/isProtectedKey.js.map +0 -1
  181. package/lib/cjs/utils/objects/isRegExp.js +0 -8
  182. package/lib/cjs/utils/objects/isRegExp.js.map +0 -1
  183. package/lib/cjs/utils/objects/isSerializable.js +0 -13
  184. package/lib/cjs/utils/objects/isSerializable.js.map +0 -1
  185. package/lib/cjs/utils/objects/isStream.js +0 -8
  186. package/lib/cjs/utils/objects/isStream.js.map +0 -1
  187. package/lib/cjs/utils/objects/isString.js +0 -16
  188. package/lib/cjs/utils/objects/isString.js.map +0 -1
  189. package/lib/cjs/utils/objects/isSymbol.js +0 -16
  190. package/lib/cjs/utils/objects/isSymbol.js.map +0 -1
  191. package/lib/cjs/utils/objects/methodsOf.js +0 -25
  192. package/lib/cjs/utils/objects/methodsOf.js.map +0 -1
  193. package/lib/cjs/utils/objects/nameOf.js +0 -32
  194. package/lib/cjs/utils/objects/nameOf.js.map +0 -1
  195. package/lib/cjs/utils/objects/objectKeys.js +0 -9
  196. package/lib/cjs/utils/objects/objectKeys.js.map +0 -1
  197. package/lib/cjs/utils/objects/primitiveOf.js +0 -20
  198. package/lib/cjs/utils/objects/primitiveOf.js.map +0 -1
  199. package/lib/cjs/utils/objects/prototypeOf.js +0 -14
  200. package/lib/cjs/utils/objects/prototypeOf.js.map +0 -1
  201. package/lib/cjs/utils/objects/setValue.js +0 -34
  202. package/lib/cjs/utils/objects/setValue.js.map +0 -1
  203. package/lib/cjs/utils/objects/toMap.js +0 -36
  204. package/lib/cjs/utils/objects/toMap.js.map +0 -1
  205. package/lib/cjs/utils/objects/toStringConstructor.js +0 -12
  206. package/lib/cjs/utils/objects/toStringConstructor.js.map +0 -1
  207. package/lib/cjs/utils/proxyDelegation.js +0 -54
  208. package/lib/cjs/utils/proxyDelegation.js.map +0 -1
  209. package/lib/cjs/utils/uniq.js +0 -19
  210. package/lib/cjs/utils/uniq.js.map +0 -1
  211. package/lib/esm/package.json +0 -3
  212. package/lib/types-esm/decorators/configurable.d.ts +0 -1
  213. package/lib/types-esm/decorators/deprecated.d.ts +0 -32
  214. package/lib/types-esm/decorators/enumerable.d.ts +0 -1
  215. package/lib/types-esm/decorators/notConfigurable.d.ts +0 -1
  216. package/lib/types-esm/decorators/notEnumerable.d.ts +0 -1
  217. package/lib/types-esm/decorators/readOnly.d.ts +0 -1
  218. package/lib/types-esm/decorators/storeFn.d.ts +0 -9
  219. package/lib/types-esm/decorators/storeMerge.d.ts +0 -1
  220. package/lib/types-esm/decorators/storeSet.d.ts +0 -1
  221. package/lib/types-esm/decorators/writable.d.ts +0 -1
  222. package/lib/types-esm/domain/AnyToPromise.d.ts +0 -42
  223. package/lib/types-esm/domain/DecoratorTypes.d.ts +0 -10
  224. package/lib/types-esm/domain/Env.d.ts +0 -13
  225. package/lib/types-esm/domain/Hooks.d.ts +0 -47
  226. package/lib/types-esm/domain/Metadata.d.ts +0 -442
  227. package/lib/types-esm/domain/Store.d.ts +0 -69
  228. package/lib/types-esm/domain/Type.d.ts +0 -14
  229. package/lib/types-esm/errors/UnsupportedDecoratorType.d.ts +0 -5
  230. package/lib/types-esm/index.d.ts +0 -86
  231. package/lib/types-esm/interfaces/AnyDecorator.d.ts +0 -1
  232. package/lib/types-esm/interfaces/DecoratorParameters.d.ts +0 -3
  233. package/lib/types-esm/interfaces/MetadataTypes.d.ts +0 -5
  234. package/lib/types-esm/interfaces/Relation.d.ts +0 -1
  235. package/lib/types-esm/interfaces/ValueOf.d.ts +0 -1
  236. package/lib/types-esm/utils/catchError.d.ts +0 -2
  237. package/lib/types-esm/utils/decorators/decorateMethodsOf.d.ts +0 -1
  238. package/lib/types-esm/utils/decorators/decoratorArgs.d.ts +0 -2
  239. package/lib/types-esm/utils/decorators/decoratorTypeOf.d.ts +0 -2
  240. package/lib/types-esm/utils/decorators/inheritedDescriptorOf.d.ts +0 -1
  241. package/lib/types-esm/utils/decorators/useDecorators.d.ts +0 -2
  242. package/lib/types-esm/utils/decorators/useMethodDecorators.d.ts +0 -3
  243. package/lib/types-esm/utils/getRandomId.d.ts +0 -1
  244. package/lib/types-esm/utils/http/getHostInfoFromPort.d.ts +0 -7
  245. package/lib/types-esm/utils/imports/importPackage.d.ts +0 -1
  246. package/lib/types-esm/utils/objects/ancestorOf.d.ts +0 -2
  247. package/lib/types-esm/utils/objects/ancestorsOf.d.ts +0 -6
  248. package/lib/types-esm/utils/objects/classOf.d.ts +0 -13
  249. package/lib/types-esm/utils/objects/cleanObject.d.ts +0 -6
  250. package/lib/types-esm/utils/objects/constructorOf.d.ts +0 -11
  251. package/lib/types-esm/utils/objects/createInstance.d.ts +0 -1
  252. package/lib/types-esm/utils/objects/deepClone.d.ts +0 -6
  253. package/lib/types-esm/utils/objects/deepMerge.d.ts +0 -9
  254. package/lib/types-esm/utils/objects/descriptorOf.d.ts +0 -8
  255. package/lib/types-esm/utils/objects/getClassOrSymbol.d.ts +0 -1
  256. package/lib/types-esm/utils/objects/getConstructorArgNames.d.ts +0 -1
  257. package/lib/types-esm/utils/objects/getEnumerableKeys.d.ts +0 -5
  258. package/lib/types-esm/utils/objects/getValue.d.ts +0 -32
  259. package/lib/types-esm/utils/objects/hasJsonMethod.d.ts +0 -1
  260. package/lib/types-esm/utils/objects/isArray.d.ts +0 -13
  261. package/lib/types-esm/utils/objects/isArrowFn.d.ts +0 -1
  262. package/lib/types-esm/utils/objects/isBoolean.d.ts +0 -7
  263. package/lib/types-esm/utils/objects/isBuffer.d.ts +0 -8
  264. package/lib/types-esm/utils/objects/isClass.d.ts +0 -1
  265. package/lib/types-esm/utils/objects/isCollection.d.ts +0 -6
  266. package/lib/types-esm/utils/objects/isDate.d.ts +0 -6
  267. package/lib/types-esm/utils/objects/isEmpty.d.ts +0 -6
  268. package/lib/types-esm/utils/objects/isEnumerable.d.ts +0 -6
  269. package/lib/types-esm/utils/objects/isFunction.d.ts +0 -1
  270. package/lib/types-esm/utils/objects/isInheritedFrom.d.ts +0 -1
  271. package/lib/types-esm/utils/objects/isMomentObject.d.ts +0 -1
  272. package/lib/types-esm/utils/objects/isMongooseObject.d.ts +0 -2
  273. package/lib/types-esm/utils/objects/isNil.d.ts +0 -1
  274. package/lib/types-esm/utils/objects/isNumber.d.ts +0 -7
  275. package/lib/types-esm/utils/objects/isObject.d.ts +0 -1
  276. package/lib/types-esm/utils/objects/isObservable.d.ts +0 -1
  277. package/lib/types-esm/utils/objects/isPlainObject.d.ts +0 -7
  278. package/lib/types-esm/utils/objects/isPrimitive.d.ts +0 -14
  279. package/lib/types-esm/utils/objects/isPromise.d.ts +0 -7
  280. package/lib/types-esm/utils/objects/isProtectedKey.d.ts +0 -5
  281. package/lib/types-esm/utils/objects/isRegExp.d.ts +0 -1
  282. package/lib/types-esm/utils/objects/isSerializable.d.ts +0 -1
  283. package/lib/types-esm/utils/objects/isStream.d.ts +0 -1
  284. package/lib/types-esm/utils/objects/isString.d.ts +0 -6
  285. package/lib/types-esm/utils/objects/isSymbol.d.ts +0 -6
  286. package/lib/types-esm/utils/objects/methodsOf.d.ts +0 -9
  287. package/lib/types-esm/utils/objects/nameOf.d.ts +0 -14
  288. package/lib/types-esm/utils/objects/objectKeys.d.ts +0 -1
  289. package/lib/types-esm/utils/objects/primitiveOf.d.ts +0 -1
  290. package/lib/types-esm/utils/objects/prototypeOf.d.ts +0 -6
  291. package/lib/types-esm/utils/objects/setValue.d.ts +0 -1
  292. package/lib/types-esm/utils/objects/toMap.d.ts +0 -3
  293. package/lib/types-esm/utils/objects/toStringConstructor.d.ts +0 -1
  294. package/lib/types-esm/utils/proxyDelegation.d.ts +0 -33
  295. package/lib/types-esm/utils/uniq.d.ts +0 -5
  296. /package/{webpack.config.js → webpack.config.cjs} +0 -0
@@ -1,508 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Metadata = void 0;
4
- require("reflect-metadata");
5
- const classOf_js_1 = require("../utils/objects/classOf.js");
6
- /**
7
- * Metadata key
8
- * @private
9
- * @type {string}
10
- */
11
- const DESIGN_PARAM_TYPES = "design:paramtypes";
12
- /**
13
- * Metadata key
14
- * @private
15
- * @type {string}
16
- */
17
- const DESIGN_TYPE = "design:type";
18
- /**
19
- * Metadata key
20
- * @private
21
- * @type {string}
22
- */
23
- const DESIGN_RETURN_TYPE = "design:returntype";
24
- /**
25
- * Properties collections
26
- * @private
27
- * @type {string}
28
- */
29
- const PROPERTIES = new Map();
30
- /**
31
- * @stable
32
- */
33
- class Metadata {
34
- /**
35
- * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
36
- * @param key A key used to store and retrieve metadata.
37
- * @param target The target object on which the metadata is defined.
38
- * @param propertyKey The property key for the target.
39
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
40
- * @example
41
- *
42
- * ```typescript
43
- * class Example {
44
- * // property declarations are not part of ES6, though they are valid in TypeScript:
45
- * // static staticProperty;
46
- * // property;
47
- *
48
- * static staticMethod(p) { }
49
- * method(p) { }
50
- * }
51
- *
52
- * // constructor
53
- * result = Metadata.get("custom:annotation", Example);
54
- *
55
- * // property (on constructor)
56
- * result = Metadata.get("custom:annotation", Example, "staticProperty");
57
- *
58
- * // property (on prototype)
59
- * result = Metadata.get("custom:annotation", Example.prototype, "property");
60
- *
61
- * // method (on constructor)
62
- * result = Metadata.get("custom:annotation", Example, "staticMethod");
63
- *
64
- * // method (on prototype)
65
- * result = Metadata.get("custom:annotation", Example.prototype, "method");
66
- * ```
67
- *
68
- */
69
- static get(key, target, propertyKey) {
70
- return Reflect.getMetadata(key, (0, classOf_js_1.classOf)(target), propertyKey);
71
- }
72
- /**
73
- * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
74
- * @param key A key used to store and retrieve metadata.
75
- * @param target The target object on which the metadata is defined.
76
- * @param propertyKey The property key for the target.
77
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
78
- * @example
79
- *
80
- * ```typescript
81
- * class Example {
82
- * // property declarations are not part of ES6, though they are valid in TypeScript:
83
- * // static staticProperty;
84
- * // property;
85
- *
86
- * static staticMethod(p) { }
87
- * method(p) { }
88
- * }
89
- *
90
- * // constructor
91
- * result = Metadata.getOwn("custom:annotation", Example);
92
- *
93
- * // property (on constructor)
94
- * result = Metadata.getOwn("custom:annotation", Example, "staticProperty");
95
- *
96
- * // property (on prototype)
97
- * result = Metadata.getOwn("custom:annotation", Example.prototype, "property");
98
- *
99
- * // method (on constructor)
100
- * result = Metadata.getOwn("custom:annotation", Example, "staticMethod");
101
- *
102
- * // method (on prototype)
103
- * result = Metadata.getOwn("custom:annotation", Example.prototype, "method");
104
- * ```
105
- *
106
- */
107
- static getOwn(key, target, propertyKey) {
108
- return Reflect.getOwnMetadata(key, (0, classOf_js_1.classOf)(target), propertyKey);
109
- }
110
- /**
111
- * Gets the metadata value for the provided metadata DESIGN_TYPE on the target object or its prototype chain.
112
- * @param target The target object on which the metadata is defined.
113
- * @param propertyKey The property key for the target.
114
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
115
- * @example
116
- *
117
- * ```typescript
118
- * class Example {
119
- * // property declarations are not part of ES6, though they are valid in TypeScript:
120
- * // static staticProperty;
121
- * // property;
122
- *
123
- * static staticMethod(p) { }
124
- * method(p) { }
125
- * }
126
- *
127
- * // on contructor
128
- * result = Metadata.getType(Example);
129
- *
130
- * // property (on constructor)
131
- * result = Metadata.getType(Example, "staticProperty");
132
- *
133
- * // method (on constructor)
134
- * result = Metadata.getType(Example, "staticMethod");
135
- * ```
136
- *
137
- */
138
- static getType(target, propertyKey) {
139
- return Reflect.getMetadata(DESIGN_TYPE, target, propertyKey);
140
- }
141
- /**
142
- * Gets the metadata value for the provided metadata DESIGN_TYPE on the target object or its prototype chain.
143
- * @param target The target object on which the metadata is defined.
144
- * @param propertyKey The property key for the target.
145
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
146
- * @example
147
- *
148
- * ```typescript
149
- * class Example {
150
- * // property declarations are not part of ES6, though they are valid in TypeScript:
151
- * // static staticProperty;
152
- * // property;
153
- *
154
- * static staticMethod(p) { }
155
- * method(p) { }
156
- * }
157
- *
158
- * // on contructor
159
- * result = Metadata.getOwnType(Example);
160
- *
161
- * // property (on constructor)
162
- * result = Metadata.getOwnType(Example, "staticProperty");
163
- *
164
- * // method (on constructor)
165
- * result = Metadata.getOwnType(Example, "staticMethod");
166
- * ```
167
- *
168
- */
169
- static getOwnType(target, propertyKey) {
170
- return Reflect.getMetadata(DESIGN_TYPE, target, propertyKey);
171
- }
172
- /**
173
- * Gets the metadata value for the provided metadata DESIGN_RETURN_TYPE on the target object or its prototype chain.
174
- * @param target The target object on which the metadata is defined.
175
- * @param propertyKey The property key for the target.
176
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
177
- * @example
178
- *
179
- * ```typescript
180
- * class Example {
181
- * // property declarations are not part of ES6, though they are valid in TypeScript:
182
- * // static staticProperty;
183
- * // property;
184
- *
185
- * static staticMethod(p) { }
186
- * method(p) { }
187
- * }
188
- *
189
- * // on contructor
190
- * result = Metadata.getReturnType(Example);
191
- *
192
- * // property (on constructor)
193
- * result = Metadata.getReturnType(Example, "staticProperty");
194
- *
195
- * // method (on constructor)
196
- * result = Metadata.getReturnType(Example, "staticMethod");
197
- * ```
198
- *
199
- */
200
- static getReturnType(target, propertyKey) {
201
- return Reflect.getMetadata(DESIGN_RETURN_TYPE, target, propertyKey);
202
- }
203
- /**
204
- * Gets the metadata value for the provided metadata DESIGN_RETURN_TYPE on the target object or its prototype chain.
205
- * @param target The target object on which the metadata is defined.
206
- * @param propertyKey The property key for the target.
207
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
208
- * @example
209
- *
210
- * ```typescript
211
- * class Example {
212
- * // property declarations are not part of ES6, though they are valid in TypeScript:
213
- * // static staticProperty;
214
- * // property;
215
- *
216
- * static staticMethod(p) { }
217
- * method(p) { }
218
- * }
219
- *
220
- * // on contructor
221
- * result = Metadata.getOwnReturnType(Example);
222
- *
223
- * // property (on constructor)
224
- * result = Metadata.getOwnReturnType(Example, "staticProperty");
225
- *
226
- * // method (on constructor)
227
- * result = Metadata.getOwnReturnType(Example, "staticMethod");
228
- * ```
229
- *
230
- */
231
- static getOwnReturnType(target, propertyKey) {
232
- return Reflect.getOwnMetadata(DESIGN_RETURN_TYPE, target, propertyKey);
233
- }
234
- /**
235
- * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
236
- * @param key A key used to store and retrieve metadata.
237
- * @param target The target object on which the metadata is defined.
238
- * @param propertyKey The property key for the target.
239
- * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
240
- * @example
241
- *
242
- * ```typescript
243
- * class Example {
244
- * // property declarations are not part of ES6, though they are valid in TypeScript:
245
- * // static staticProperty;
246
- * // property;
247
- *
248
- * static staticMethod(p) { }
249
- * method(p) { }
250
- * }
251
- *
252
- * // constructor
253
- * result = Metadata.has("custom:annotation", Example);
254
- *
255
- * // property (on constructor)
256
- * result = Metadata.has("custom:annotation", Example, "staticProperty");
257
- *
258
- * // property (on prototype)
259
- * result = Metadata.has("custom:annotation", Example.prototype, "property");
260
- *
261
- * // method (on constructor)
262
- * result = Metadata.has("custom:annotation", Example, "staticMethod");
263
- *
264
- * // method (on prototype)
265
- * result = Metadata.has("custom:annotation", Example.prototype, "method");
266
- * ```
267
- *
268
- */
269
- static has(key, target, propertyKey) {
270
- try {
271
- return Reflect.hasMetadata(key, (0, classOf_js_1.classOf)(target), propertyKey);
272
- }
273
- catch (er) { }
274
- return false;
275
- }
276
- /**
277
- * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
278
- * @param key A key used to store and retrieve metadata.
279
- * @param target The target object on which the metadata is defined.
280
- * @param propertyKey The property key for the target.
281
- * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
282
- * @example
283
- *
284
- * ```typescript
285
- * class Example {
286
- * // property declarations are not part of ES6, though they are valid in TypeScript:
287
- * // static staticProperty;
288
- * // property;
289
- *
290
- * static staticMethod(p) { }
291
- * method(p) { }
292
- * }
293
- *
294
- * // constructor
295
- * result = Metadata.has("custom:annotation", Example);
296
- *
297
- * // property (on constructor)
298
- * result = Metadata.hasOwn("custom:annotation", Example, "staticProperty");
299
- *
300
- * // property (on prototype)
301
- * result = Metadata.hasOwn("custom:annotation", Example.prototype, "property");
302
- *
303
- * // method (on constructor)
304
- * result = Metadata.hasOwn("custom:annotation", Example, "staticMethod");
305
- *
306
- * // method (on prototype)
307
- * result = Metadata.hasOwn("custom:annotation", Example.prototype, "method");
308
- * ```
309
- *
310
- */
311
- static hasOwn(key, target, propertyKey) {
312
- return Reflect.hasOwnMetadata(key, (0, classOf_js_1.classOf)(target), propertyKey);
313
- }
314
- /**
315
- * Deletes the metadata entry from the target object with the provided key.
316
- * @param key A key used to store and retrieve metadata.
317
- * @param target The target object on which the metadata is defined.
318
- * @param propertyKey The property key for the target.
319
- * @returns `true` if the metadata entry was found and deleted; otherwise, false.
320
- * @example
321
- *
322
- * ```typescript
323
- * class Example {
324
- * // property declarations are not part of ES6, though they are valid in TypeScript:
325
- * // static staticProperty;
326
- * // property;
327
- *
328
- * static staticMethod(p) { }
329
- * method(p) { }
330
- * }
331
- *
332
- * // constructor
333
- * result = Metadata.delete("custom:annotation", Example);
334
- *
335
- * // property (on constructor)
336
- * result = Metadata.delete("custom:annotation", Example, "staticProperty");
337
- *
338
- * // property (on prototype)
339
- * result = Metadata.delete("custom:annotation", Example.prototype, "property");
340
- *
341
- * // method (on constructor)
342
- * result = Metadata.delete("custom:annotation", Example, "staticMethod");
343
- *
344
- * // method (on prototype)
345
- * result = Metadata.delete("custom:annotation", Example.prototype, "method");
346
- * ```
347
- *
348
- */
349
- static delete(key, target, propertyKey) {
350
- return Reflect.deleteMetadata(key, (0, classOf_js_1.classOf)(target), propertyKey);
351
- }
352
- /**
353
- * Set the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.
354
- * @param target The target object on which the metadata is defined.
355
- * @param propertyKey The property key for the target.
356
- * @param value A value that contains attached metadata.
357
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
358
- * @example
359
- *
360
- * ```typescript
361
- * class Example {
362
- * // property declarations are not part of ES6, though they are valid in TypeScript:
363
- * // static staticProperty;
364
- * // property;
365
- *
366
- * static staticMethod(p) { }
367
- * method(p) { }
368
- * }
369
- *
370
- * // on contructor
371
- * result = Metadata.setParamTypes(Example, undefined, [Object]);
372
- *
373
- * // property (on constructor)
374
- * result = Metadata.setParamTypes(Example, "staticProperty", [Object]);
375
- *
376
- * // property (on prototype)
377
- * result = Metadata.setParamTypes(Example.prototype, "property", [Object]);
378
- *
379
- * // method (on constructor)
380
- * result = Metadata.setParamTypes(Example, "staticMethod", [Object]);
381
- *
382
- * // method (on prototype)
383
- * result = Metadata.setParamTypes(Example.prototype, "method", [Object]);
384
- * ```
385
- *
386
- */
387
- static setParamTypes(target, propertyKey, value) {
388
- return this.set(DESIGN_PARAM_TYPES, value, target.prototype, propertyKey);
389
- }
390
- /**
391
- * Get all metadata for a metadataKey.
392
- * @param metadataKey
393
- */
394
- static { this.getTargetsFromPropertyKey = (metadataKey) => PROPERTIES.has(metadataKey) ? PROPERTIES.get(metadataKey) || [] : []; }
395
- /**
396
- * Define a unique metadata entry on the target.
397
- * @param key A key used to store and retrieve metadata.
398
- * @param value A value that contains attached metadata.
399
- * @param target The target object on which to define metadata.
400
- * @param propertyKey The property key for the target.
401
- * @example
402
- *
403
- * ```typescript
404
- * class Example {
405
- * // property declarations are not part of ES6, though they are valid in TypeScript:
406
- * // static staticProperty;
407
- * // property;
408
- *
409
- * static staticMethod(p) { }
410
- * method(p) { }
411
- * }
412
- *
413
- * // constructor
414
- * Reflect.defineMetadata("custom:annotation", options, Example);
415
- *
416
- * // property (on constructor)
417
- * Reflect.defineMetadata("custom:annotation", Number, Example, "staticProperty");
418
- *
419
- * // property (on prototype)
420
- * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "property");
421
- *
422
- * // method (on constructor)
423
- * Reflect.defineMetadata("custom:annotation", Number, Example, "staticMethod");
424
- *
425
- * // method (on prototype)
426
- * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "method");
427
- *
428
- * // decorator factory as metadata-producing annotation.
429
- * function MyAnnotation(options): PropertyDecorator {
430
- * return (target, key) => Reflect.defineMetadata("custom:annotation", options, target, key);
431
- * }
432
- * ```
433
- *
434
- */
435
- static set(key, value, target, propertyKey) {
436
- const targets = PROPERTIES.has(key) ? PROPERTIES.get(key) || [] : [];
437
- const classConstructor = (0, classOf_js_1.classOf)(target);
438
- if (targets.indexOf(classConstructor) === -1) {
439
- targets.push(classConstructor);
440
- PROPERTIES.set(key, targets);
441
- }
442
- Reflect.defineMetadata(key, value, (0, classOf_js_1.classOf)(target), propertyKey);
443
- }
444
- /**
445
- * Gets the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.
446
- * @param targetPrototype
447
- * @param propertyKey The property key for the target.
448
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
449
- * @example
450
- *
451
- * ```typescript
452
- * class Example {
453
- * // property declarations are not part of ES6, though they are valid in TypeScript:
454
- * // static staticProperty;
455
- * // property;
456
- *
457
- * static staticMethod(p) { }
458
- * method(p) { }
459
- * }
460
- *
461
- * // on contructor
462
- * result = Metadata.getParamTypes(Example.prototype);
463
- *
464
- * // property (on constructor)
465
- * result = Metadata.getParamTypes(Example.prototype, "staticProperty");
466
- *
467
- * // method (on constructor)
468
- * result = Metadata.getParamTypes(Example.prototype, "staticMethod");
469
- * ```
470
- *
471
- */
472
- static getParamTypes(targetPrototype, propertyKey) {
473
- return Reflect.getMetadata(DESIGN_PARAM_TYPES, targetPrototype, propertyKey) || [];
474
- }
475
- /**
476
- * Gets the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.
477
- * @param target The target object on which the metadata is defined.
478
- * @param propertyKey The property key for the target.
479
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
480
- * @example
481
- *
482
- * ```typescript
483
- * class Example {
484
- * // property declarations are not part of ES6, though they are valid in TypeScript:
485
- * // static staticProperty;
486
- * // property;
487
- *
488
- * static staticMethod(p) { }
489
- * method(p) { }
490
- * }
491
- *
492
- * // on contructor
493
- * result = Metadata.getParamTypes(Example);
494
- *
495
- * // property (on constructor)
496
- * result = Metadata.getParamTypes(Example, "staticProperty");
497
- *
498
- * // method (on constructor)
499
- * result = Metadata.getParamTypes(Example, "staticMethod");
500
- * ```
501
- *
502
- */
503
- static getOwnParamTypes(target, propertyKey) {
504
- return Reflect.getOwnMetadata(DESIGN_PARAM_TYPES, target, propertyKey) || [];
505
- }
506
- }
507
- exports.Metadata = Metadata;
508
- //# sourceMappingURL=Metadata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Metadata.js","sourceRoot":"","sources":["../../../src/domain/Metadata.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,4DAAoD;AAEpD;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,m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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Store = exports.PARAM_STORE = exports.PROPERTY_STORE = exports.METHOD_STORE = exports.CLASS_STORE = void 0;
4
- const DecoratorTypes_js_1 = require("../domain/DecoratorTypes.js");
5
- const decoratorTypeOf_js_1 = require("../utils/decorators/decoratorTypeOf.js");
6
- const deepClone_js_1 = require("../utils/objects/deepClone.js");
7
- const deepMerge_js_1 = require("../utils/objects/deepMerge.js");
8
- const descriptorOf_js_1 = require("../utils/objects/descriptorOf.js");
9
- const isSymbol_js_1 = require("../utils/objects/isSymbol.js");
10
- const nameOf_js_1 = require("../utils/objects/nameOf.js");
11
- const Metadata_js_1 = require("./Metadata.js");
12
- /**
13
- * @ignore
14
- */
15
- exports.CLASS_STORE = "tsed:class:store";
16
- /**
17
- * @ignore
18
- */
19
- exports.METHOD_STORE = "tsed:method:store";
20
- /**
21
- * @ignore
22
- */
23
- exports.PROPERTY_STORE = "tsed:property:store";
24
- /**
25
- * @ignore
26
- */
27
- exports.PARAM_STORE = "tsed:param:store";
28
- const stores = new Map();
29
- function storeGet(key, ...args) {
30
- if ((0, isSymbol_js_1.isSymbol)(args[0])) {
31
- if (!stores.has(args[0])) {
32
- stores.set(args[0], new Store());
33
- }
34
- return stores.get(args[0]);
35
- }
36
- else {
37
- const registry = Metadata_js_1.Metadata;
38
- if (!registry.hasOwn(key, ...args)) {
39
- registry.set(key, new Store(), ...args);
40
- }
41
- return registry.getOwn(key, ...args);
42
- }
43
- }
44
- function defineStore(args) {
45
- const [target, propertyKey, descriptor] = args;
46
- switch ((0, decoratorTypeOf_js_1.decoratorTypeOf)(args)) {
47
- case DecoratorTypes_js_1.DecoratorTypes.PARAM_CTOR:
48
- case DecoratorTypes_js_1.DecoratorTypes.PARAM_STC:
49
- case DecoratorTypes_js_1.DecoratorTypes.PARAM:
50
- const store = storeGet(exports.PARAM_STORE, target, propertyKey);
51
- if (!store.has("" + descriptor)) {
52
- store.set("" + descriptor, new Store());
53
- }
54
- return store.get("" + descriptor);
55
- case DecoratorTypes_js_1.DecoratorTypes.PROP:
56
- case DecoratorTypes_js_1.DecoratorTypes.PROP_STC:
57
- return storeGet(exports.PROPERTY_STORE, target, propertyKey);
58
- case DecoratorTypes_js_1.DecoratorTypes.METHOD:
59
- case DecoratorTypes_js_1.DecoratorTypes.METHOD_STC:
60
- return storeGet(exports.METHOD_STORE, target, propertyKey);
61
- case DecoratorTypes_js_1.DecoratorTypes.CLASS:
62
- return storeGet(exports.CLASS_STORE, target);
63
- }
64
- }
65
- class Store {
66
- constructor() {
67
- this._entries = new Map();
68
- }
69
- /**
70
- * Create or get a Store from args {target + methodName + descriptor}
71
- * @param args
72
- * @returns {Store}
73
- */
74
- static from(...args) {
75
- return defineStore(args);
76
- }
77
- /**
78
- * Create store on the method.
79
- * @param target
80
- * @param {string} propertyKey
81
- * @returns {Store}
82
- */
83
- static fromMethod(target, propertyKey) {
84
- return Store.from(target, propertyKey, (0, descriptorOf_js_1.descriptorOf)(target, propertyKey));
85
- }
86
- static mergeStoreFrom(target, source, ...args) {
87
- const store = Store.from(target, ...args);
88
- Store.from(source, ...args)._entries.forEach((value, key) => {
89
- store.merge(key, value);
90
- });
91
- return store;
92
- }
93
- static mergeStoreMethodFrom(target, source, propertyKey) {
94
- return this.mergeStoreFrom(target, source, propertyKey, (0, descriptorOf_js_1.descriptorOf)(target, propertyKey));
95
- }
96
- /**
97
- * The get() method returns a specified element from a Map object.
98
- * @param key Required. The key of the element to return from the Map object.
99
- * @param defaultValue
100
- * @returns {T} Returns the element associated with the specified key or undefined if the key can't be found in the Map object.
101
- */
102
- get(key, defaultValue) {
103
- return this._entries.get((0, nameOf_js_1.nameOf)(key)) || defaultValue;
104
- }
105
- /**
106
- * The has() method returns a boolean indicating whether an element with the specified key exists or not.
107
- * @param key
108
- * @returns {boolean}
109
- */
110
- has(key) {
111
- return this._entries.has((0, nameOf_js_1.nameOf)(key));
112
- }
113
- /**
114
- * The set() method adds or updates an element with a specified key and value to a Map object.
115
- * @param key Required. The key of the element to add to the Map object.
116
- * @param metadata Required. The value of the element to add to the Map object.
117
- */
118
- set(key, metadata) {
119
- this._entries.set((0, nameOf_js_1.nameOf)(key), metadata);
120
- return this;
121
- }
122
- /**
123
- * The delete() method removes the specified element from a Map object.
124
- * @param key Required. The key of the element to remove from the Map object.
125
- * @returns {boolean} Returns true if an element in the Map object existed and has been removed, or false if the element does not exist.
126
- */
127
- delete(key) {
128
- return this._entries.delete((0, nameOf_js_1.nameOf)(key));
129
- }
130
- /**
131
- * Merge given value with existing value.
132
- * @param key
133
- * @param value
134
- * @param inverse Change the merge order. Get the existing value and apply over given value
135
- * @returns {Store}
136
- */
137
- merge(key, value, inverse = false) {
138
- let _value_ = this.get(key);
139
- if (_value_) {
140
- value = (0, deepClone_js_1.deepClone)(value);
141
- _value_ = (0, deepClone_js_1.deepClone)(_value_);
142
- value = inverse ? (0, deepMerge_js_1.deepMerge)(value, _value_) : (0, deepMerge_js_1.deepMerge)(_value_, value);
143
- }
144
- this.set(key, value);
145
- return this;
146
- }
147
- toJson() {
148
- return [...this._entries.entries()].reduce((obj, [key, value]) => {
149
- return {
150
- ...obj,
151
- [key]: value
152
- };
153
- }, {});
154
- }
155
- }
156
- exports.Store = Store;
157
- //# sourceMappingURL=Store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Store.js","sourceRoot":"","sources":["../../../src/domain/Store.ts"],"names":[],"mappings":";;;AAAA,mEAA2D;AAC3D,+EAAuE;AACvE,gEAAwD;AACxD,gEAAwD;AACxD,sEAA8D;AAC9D,8DAAsD;AACtD,0DAAkD;AAClD,+CAAuC;AAGvC;;GAEG;AACU,QAAA,WAAW,GAAG,kBAAkB,CAAC;AAC9C;;GAEG;AACU,QAAA,YAAY,GAAG,mBAAmB,CAAC;AAChD;;GAEG;AACU,QAAA,cAAc,GAAG,qBAAqB,CAAC;AACpD;;GAEG;AACU,QAAA,WAAW,GAAG,kBAAkB,CAAC;AAE9C,MAAM,M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BAAS,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SACzE;QAED,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAErB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM;QACJ,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC/D,OAAO;gBACL,GAAG,GAAG;gBACN,CAAC,GAAG,CAAC,EAAE,KAAK;aACb,CAAC;QACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;CACF;AAvGD,sBAuGC"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Type = void 0;
4
- exports.Type = Function;
5
- // @ts-ignore
6
- global.Type = exports.Type;
7
- //# sourceMappingURL=Type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Type.js","sourceRoot":"","sources":["../../../src/domain/Type.ts"],"names":[],"mappings":";;;AAYa,QAAA,IAAI,GAAG,QAAQ,CAAC;AAE7B,aAAa;AACb,MAAM,CAAC,IAAI,GAAG,YAAI,CAAC"}