@tsed/core 6.88.1 → 6.89.0

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 (504) hide show
  1. package/lib/{decorators → cjs/decorators}/configurable.d.ts +0 -0
  2. package/lib/cjs/decorators/configurable.js +18 -0
  3. package/lib/cjs/decorators/configurable.js.map +1 -0
  4. package/lib/{decorators → cjs/decorators}/deprecated.d.ts +0 -0
  5. package/lib/cjs/decorators/deprecated.js +43 -0
  6. package/lib/cjs/decorators/deprecated.js.map +1 -0
  7. package/lib/{decorators → cjs/decorators}/enumerable.d.ts +0 -0
  8. package/lib/cjs/decorators/enumerable.js +18 -0
  9. package/lib/cjs/decorators/enumerable.js.map +1 -0
  10. package/lib/{decorators → cjs/decorators}/index.d.ts +0 -0
  11. package/lib/cjs/decorators/index.js +18 -0
  12. package/lib/cjs/decorators/index.js.map +1 -0
  13. package/lib/{decorators → cjs/decorators}/notConfigurable.d.ts +0 -0
  14. package/lib/cjs/decorators/notConfigurable.js +13 -0
  15. package/lib/cjs/decorators/notConfigurable.js.map +1 -0
  16. package/lib/{decorators → cjs/decorators}/notEnumerable.d.ts +0 -0
  17. package/lib/cjs/decorators/notEnumerable.js +13 -0
  18. package/lib/cjs/decorators/notEnumerable.js.map +1 -0
  19. package/lib/{decorators → cjs/decorators}/readOnly.d.ts +0 -0
  20. package/lib/cjs/decorators/readOnly.js +13 -0
  21. package/lib/cjs/decorators/readOnly.js.map +1 -0
  22. package/lib/{decorators → cjs/decorators}/storeFn.d.ts +0 -0
  23. package/lib/cjs/decorators/storeFn.js +22 -0
  24. package/lib/cjs/decorators/storeFn.js.map +1 -0
  25. package/lib/{decorators → cjs/decorators}/storeMerge.d.ts +0 -0
  26. package/lib/cjs/decorators/storeMerge.js +11 -0
  27. package/lib/cjs/decorators/storeMerge.js.map +1 -0
  28. package/lib/{decorators → cjs/decorators}/storeSet.d.ts +0 -0
  29. package/lib/cjs/decorators/storeSet.js +11 -0
  30. package/lib/cjs/decorators/storeSet.js.map +1 -0
  31. package/lib/{decorators → cjs/decorators}/writable.d.ts +0 -0
  32. package/lib/cjs/decorators/writable.js +18 -0
  33. package/lib/cjs/decorators/writable.js.map +1 -0
  34. package/lib/{domain → cjs/domain}/AnyToPromise.d.ts +0 -0
  35. package/lib/cjs/domain/AnyToPromise.js +148 -0
  36. package/lib/cjs/domain/AnyToPromise.js.map +1 -0
  37. package/lib/{domain → cjs/domain}/DecoratorTypes.d.ts +0 -0
  38. package/lib/cjs/domain/DecoratorTypes.js +15 -0
  39. package/lib/cjs/domain/DecoratorTypes.js.map +1 -0
  40. package/lib/{domain → cjs/domain}/Env.d.ts +0 -0
  41. package/lib/cjs/domain/Env.js +19 -0
  42. package/lib/cjs/domain/Env.js.map +1 -0
  43. package/lib/{domain → cjs/domain}/Hooks.d.ts +0 -0
  44. package/lib/cjs/domain/Hooks.js +89 -0
  45. package/lib/cjs/domain/Hooks.js.map +1 -0
  46. package/lib/{domain → cjs/domain}/Metadata.d.ts +0 -0
  47. package/lib/cjs/domain/Metadata.js +508 -0
  48. package/lib/cjs/domain/Metadata.js.map +1 -0
  49. package/lib/{domain → cjs/domain}/Store.d.ts +0 -0
  50. package/lib/cjs/domain/Store.js +157 -0
  51. package/lib/cjs/domain/Store.js.map +1 -0
  52. package/lib/{domain → cjs/domain}/Type.d.ts +0 -0
  53. package/lib/cjs/domain/Type.js +7 -0
  54. package/lib/cjs/domain/Type.js.map +1 -0
  55. package/lib/{domain → cjs/domain}/index.d.ts +0 -0
  56. package/lib/cjs/domain/index.js +11 -0
  57. package/lib/cjs/domain/index.js.map +1 -0
  58. package/lib/{errors → cjs/errors}/UnsupportedDecoratorType.d.ts +0 -0
  59. package/lib/cjs/errors/UnsupportedDecoratorType.js +21 -0
  60. package/lib/cjs/errors/UnsupportedDecoratorType.js.map +1 -0
  61. package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
  62. package/lib/cjs/index.js +9 -0
  63. package/lib/cjs/index.js.map +1 -0
  64. package/lib/{interfaces → cjs/interfaces}/AnyDecorator.d.ts +0 -0
  65. package/lib/cjs/interfaces/AnyDecorator.js +3 -0
  66. package/lib/cjs/interfaces/AnyDecorator.js.map +1 -0
  67. package/lib/{interfaces → cjs/interfaces}/DecoratorParameters.d.ts +0 -0
  68. package/lib/cjs/interfaces/DecoratorParameters.js +3 -0
  69. package/lib/cjs/interfaces/DecoratorParameters.js.map +1 -0
  70. package/lib/{interfaces → cjs/interfaces}/HashOf.d.ts +0 -0
  71. package/lib/cjs/interfaces/HashOf.js +3 -0
  72. package/lib/cjs/interfaces/HashOf.js.map +1 -0
  73. package/lib/{interfaces → cjs/interfaces}/MetadataTypes.d.ts +0 -0
  74. package/lib/cjs/interfaces/MetadataTypes.js +3 -0
  75. package/lib/cjs/interfaces/MetadataTypes.js.map +1 -0
  76. package/lib/{interfaces → cjs/interfaces}/ValueOf.d.ts +0 -0
  77. package/lib/cjs/interfaces/ValueOf.js +3 -0
  78. package/lib/cjs/interfaces/ValueOf.js.map +1 -0
  79. package/lib/{interfaces → cjs/interfaces}/index.d.ts +0 -0
  80. package/lib/cjs/interfaces/index.js +3 -0
  81. package/lib/cjs/interfaces/index.js.map +1 -0
  82. package/lib/{utils → cjs/utils}/catchError.d.ts +0 -0
  83. package/lib/cjs/utils/catchError.js +22 -0
  84. package/lib/cjs/utils/catchError.js.map +1 -0
  85. package/lib/{utils → cjs/utils}/decorators/decorateMethodsOf.d.ts +0 -0
  86. package/lib/cjs/utils/decorators/decorateMethodsOf.js +23 -0
  87. package/lib/cjs/utils/decorators/decorateMethodsOf.js.map +1 -0
  88. package/lib/{utils → cjs/utils}/decorators/decoratorArgs.d.ts +0 -0
  89. package/lib/cjs/utils/decorators/decoratorArgs.js +9 -0
  90. package/lib/cjs/utils/decorators/decoratorArgs.js.map +1 -0
  91. package/lib/{utils → cjs/utils}/decorators/decoratorTypeOf.d.ts +0 -0
  92. package/lib/cjs/utils/decorators/decoratorTypeOf.js +23 -0
  93. package/lib/cjs/utils/decorators/decoratorTypeOf.js.map +1 -0
  94. package/lib/{utils → cjs/utils}/decorators/inheritedDescriptorOf.d.ts +0 -0
  95. package/lib/cjs/utils/decorators/inheritedDescriptorOf.js +15 -0
  96. package/lib/cjs/utils/decorators/inheritedDescriptorOf.js.map +1 -0
  97. package/lib/{utils → cjs/utils}/decorators/useDecorators.d.ts +0 -0
  98. package/lib/cjs/utils/decorators/useDecorators.js +14 -0
  99. package/lib/cjs/utils/decorators/useDecorators.js.map +1 -0
  100. package/lib/{utils → cjs/utils}/decorators/useMethodDecorators.d.ts +0 -0
  101. package/lib/cjs/utils/decorators/useMethodDecorators.js +15 -0
  102. package/lib/cjs/utils/decorators/useMethodDecorators.js.map +1 -0
  103. package/lib/{utils → cjs/utils}/imports/importPackage.d.ts +0 -0
  104. package/lib/cjs/utils/imports/importPackage.js +35 -0
  105. package/lib/cjs/utils/imports/importPackage.js.map +1 -0
  106. package/lib/{utils → cjs/utils}/index.d.ts +0 -0
  107. package/lib/cjs/utils/index.js +18 -0
  108. package/lib/cjs/utils/index.js.map +1 -0
  109. package/lib/{utils → cjs/utils}/objects/ancestorOf.d.ts +0 -0
  110. package/lib/cjs/utils/objects/ancestorOf.js +12 -0
  111. package/lib/cjs/utils/objects/ancestorOf.js.map +1 -0
  112. package/lib/{utils → cjs/utils}/objects/ancestorsOf.d.ts +0 -0
  113. package/lib/cjs/utils/objects/ancestorsOf.js +22 -0
  114. package/lib/cjs/utils/objects/ancestorsOf.js.map +1 -0
  115. package/lib/{utils → cjs/utils}/objects/classOf.d.ts +0 -0
  116. package/lib/cjs/utils/objects/classOf.js +23 -0
  117. package/lib/cjs/utils/objects/classOf.js.map +1 -0
  118. package/lib/{utils → cjs/utils}/objects/cleanObject.d.ts +0 -0
  119. package/lib/cjs/utils/objects/cleanObject.js +24 -0
  120. package/lib/cjs/utils/objects/cleanObject.js.map +1 -0
  121. package/lib/{utils → cjs/utils}/objects/constructorOf.d.ts +0 -0
  122. package/lib/cjs/utils/objects/constructorOf.js +20 -0
  123. package/lib/cjs/utils/objects/constructorOf.js.map +1 -0
  124. package/lib/{utils → cjs/utils}/objects/createInstance.d.ts +0 -0
  125. package/lib/cjs/utils/objects/createInstance.js +9 -0
  126. package/lib/cjs/utils/objects/createInstance.js.map +1 -0
  127. package/lib/{utils → cjs/utils}/objects/deepClone.d.ts +0 -0
  128. package/lib/cjs/utils/objects/deepClone.js +57 -0
  129. package/lib/cjs/utils/objects/deepClone.js.map +1 -0
  130. package/lib/{utils → cjs/utils}/objects/deepExtends.d.ts +0 -0
  131. package/lib/cjs/utils/objects/deepExtends.js +79 -0
  132. package/lib/cjs/utils/objects/deepExtends.js.map +1 -0
  133. package/lib/{utils → cjs/utils}/objects/deepMerge.d.ts +0 -0
  134. package/lib/cjs/utils/objects/deepMerge.js +63 -0
  135. package/lib/cjs/utils/objects/deepMerge.js.map +1 -0
  136. package/lib/{utils → cjs/utils}/objects/descriptorOf.d.ts +0 -0
  137. package/lib/cjs/utils/objects/descriptorOf.js +19 -0
  138. package/lib/cjs/utils/objects/descriptorOf.js.map +1 -0
  139. package/lib/{utils → cjs/utils}/objects/getClassOrSymbol.d.ts +0 -0
  140. package/lib/cjs/utils/objects/getClassOrSymbol.js +10 -0
  141. package/lib/cjs/utils/objects/getClassOrSymbol.js.map +1 -0
  142. package/lib/{utils → cjs/utils}/objects/getConstructorArgNames.d.ts +0 -0
  143. package/lib/cjs/utils/objects/getConstructorArgNames.js +9 -0
  144. package/lib/cjs/utils/objects/getConstructorArgNames.js.map +1 -0
  145. package/lib/{utils → cjs/utils}/objects/getEnumerableKeys.d.ts +0 -0
  146. package/lib/cjs/utils/objects/getEnumerableKeys.js +20 -0
  147. package/lib/cjs/utils/objects/getEnumerableKeys.js.map +1 -0
  148. package/lib/{utils → cjs/utils}/objects/getValue.d.ts +0 -0
  149. package/lib/cjs/utils/objects/getValue.js +49 -0
  150. package/lib/cjs/utils/objects/getValue.js.map +1 -0
  151. package/lib/{utils → cjs/utils}/objects/index.d.ts +0 -0
  152. package/lib/cjs/utils/objects/index.js +47 -0
  153. package/lib/cjs/utils/objects/index.js.map +1 -0
  154. package/lib/{utils → cjs/utils}/objects/isArray.d.ts +0 -0
  155. package/lib/cjs/utils/objects/isArray.js +23 -0
  156. package/lib/cjs/utils/objects/isArray.js.map +1 -0
  157. package/lib/{utils → cjs/utils}/objects/isArrowFn.d.ts +0 -0
  158. package/lib/cjs/utils/objects/isArrowFn.js +9 -0
  159. package/lib/cjs/utils/objects/isArrowFn.js.map +1 -0
  160. package/lib/{utils → cjs/utils}/objects/isBoolean.d.ts +0 -0
  161. package/lib/cjs/utils/objects/isBoolean.js +17 -0
  162. package/lib/cjs/utils/objects/isBoolean.js.map +1 -0
  163. package/lib/{utils → cjs/utils}/objects/isClass.d.ts +0 -0
  164. package/lib/cjs/utils/objects/isClass.js +26 -0
  165. package/lib/cjs/utils/objects/isClass.js.map +1 -0
  166. package/lib/{utils → cjs/utils}/objects/isCollection.d.ts +0 -0
  167. package/lib/cjs/utils/objects/isCollection.js +22 -0
  168. package/lib/cjs/utils/objects/isCollection.js.map +1 -0
  169. package/lib/{utils → cjs/utils}/objects/isDate.d.ts +0 -0
  170. package/lib/cjs/utils/objects/isDate.js +13 -0
  171. package/lib/cjs/utils/objects/isDate.js.map +1 -0
  172. package/lib/{utils → cjs/utils}/objects/isEmpty.d.ts +0 -0
  173. package/lib/cjs/utils/objects/isEmpty.js +14 -0
  174. package/lib/cjs/utils/objects/isEmpty.js.map +1 -0
  175. package/lib/{utils → cjs/utils}/objects/isEnumerable.d.ts +0 -0
  176. package/lib/cjs/utils/objects/isEnumerable.js +22 -0
  177. package/lib/cjs/utils/objects/isEnumerable.js.map +1 -0
  178. package/lib/{utils → cjs/utils}/objects/isFunction.d.ts +0 -0
  179. package/lib/cjs/utils/objects/isFunction.js +8 -0
  180. package/lib/cjs/utils/objects/isFunction.js.map +1 -0
  181. package/lib/{utils → cjs/utils}/objects/isInheritedFrom.d.ts +0 -0
  182. package/lib/cjs/utils/objects/isInheritedFrom.js +26 -0
  183. package/lib/cjs/utils/objects/isInheritedFrom.js.map +1 -0
  184. package/lib/{utils → cjs/utils}/objects/isNil.d.ts +0 -0
  185. package/lib/cjs/utils/objects/isNil.js +8 -0
  186. package/lib/cjs/utils/objects/isNil.js.map +1 -0
  187. package/lib/{utils → cjs/utils}/objects/isNumber.d.ts +0 -0
  188. package/lib/cjs/utils/objects/isNumber.js +17 -0
  189. package/lib/cjs/utils/objects/isNumber.js.map +1 -0
  190. package/lib/{utils → cjs/utils}/objects/isObject.d.ts +0 -0
  191. package/lib/cjs/utils/objects/isObject.js +8 -0
  192. package/lib/cjs/utils/objects/isObject.js.map +1 -0
  193. package/lib/{utils → cjs/utils}/objects/isObservable.d.ts +0 -0
  194. package/lib/cjs/utils/objects/isObservable.js +8 -0
  195. package/lib/cjs/utils/objects/isObservable.js.map +1 -0
  196. package/lib/{utils → cjs/utils}/objects/isPlainObject.d.ts +0 -0
  197. package/lib/cjs/utils/objects/isPlainObject.js +18 -0
  198. package/lib/cjs/utils/objects/isPlainObject.js.map +1 -0
  199. package/lib/{utils → cjs/utils}/objects/isPrimitive.d.ts +0 -0
  200. package/lib/cjs/utils/objects/isPrimitive.js +30 -0
  201. package/lib/cjs/utils/objects/isPrimitive.js.map +1 -0
  202. package/lib/{utils → cjs/utils}/objects/isPromise.d.ts +0 -0
  203. package/lib/cjs/utils/objects/isPromise.js +16 -0
  204. package/lib/cjs/utils/objects/isPromise.js.map +1 -0
  205. package/lib/{utils → cjs/utils}/objects/isProtectedKey.d.ts +0 -0
  206. package/lib/cjs/utils/objects/isProtectedKey.js +12 -0
  207. package/lib/cjs/utils/objects/isProtectedKey.js.map +1 -0
  208. package/lib/{utils → cjs/utils}/objects/isSerializable.d.ts +0 -0
  209. package/lib/cjs/utils/objects/isSerializable.js +13 -0
  210. package/lib/cjs/utils/objects/isSerializable.js.map +1 -0
  211. package/lib/{utils → cjs/utils}/objects/isStream.d.ts +0 -0
  212. package/lib/cjs/utils/objects/isStream.js +8 -0
  213. package/lib/cjs/utils/objects/isStream.js.map +1 -0
  214. package/lib/{utils → cjs/utils}/objects/isString.d.ts +0 -0
  215. package/lib/cjs/utils/objects/isString.js +16 -0
  216. package/lib/cjs/utils/objects/isString.js.map +1 -0
  217. package/lib/{utils → cjs/utils}/objects/isSymbol.d.ts +0 -0
  218. package/lib/cjs/utils/objects/isSymbol.js +16 -0
  219. package/lib/cjs/utils/objects/isSymbol.js.map +1 -0
  220. package/lib/{utils → cjs/utils}/objects/methodsOf.d.ts +0 -0
  221. package/lib/cjs/utils/objects/methodsOf.js +25 -0
  222. package/lib/cjs/utils/objects/methodsOf.js.map +1 -0
  223. package/lib/{utils → cjs/utils}/objects/nameOf.d.ts +0 -0
  224. package/lib/cjs/utils/objects/nameOf.js +32 -0
  225. package/lib/cjs/utils/objects/nameOf.js.map +1 -0
  226. package/lib/{utils → cjs/utils}/objects/objectKeys.d.ts +0 -0
  227. package/lib/cjs/utils/objects/objectKeys.js +9 -0
  228. package/lib/cjs/utils/objects/objectKeys.js.map +1 -0
  229. package/lib/{utils → cjs/utils}/objects/primitiveOf.d.ts +0 -0
  230. package/lib/cjs/utils/objects/primitiveOf.js +20 -0
  231. package/lib/cjs/utils/objects/primitiveOf.js.map +1 -0
  232. package/lib/{utils → cjs/utils}/objects/prototypeOf.d.ts +0 -0
  233. package/lib/cjs/utils/objects/prototypeOf.js +14 -0
  234. package/lib/cjs/utils/objects/prototypeOf.js.map +1 -0
  235. package/lib/{utils → cjs/utils}/objects/setValue.d.ts +0 -0
  236. package/lib/cjs/utils/objects/setValue.js +34 -0
  237. package/lib/cjs/utils/objects/setValue.js.map +1 -0
  238. package/lib/{utils → cjs/utils}/objects/toMap.d.ts +0 -0
  239. package/lib/cjs/utils/objects/toMap.js +32 -0
  240. package/lib/cjs/utils/objects/toMap.js.map +1 -0
  241. package/lib/{utils → cjs/utils}/objects/toStringConstructor.d.ts +0 -0
  242. package/lib/cjs/utils/objects/toStringConstructor.js +12 -0
  243. package/lib/cjs/utils/objects/toStringConstructor.js.map +1 -0
  244. package/lib/{utils → cjs/utils}/proxyDelegation.d.ts +0 -0
  245. package/lib/cjs/utils/proxyDelegation.js +54 -0
  246. package/lib/cjs/utils/proxyDelegation.js.map +1 -0
  247. package/lib/{utils → cjs/utils}/uniq.d.ts +0 -0
  248. package/lib/cjs/utils/uniq.js +16 -0
  249. package/lib/cjs/utils/uniq.js.map +1 -0
  250. package/lib/esm/decorators/configurable.js +14 -0
  251. package/lib/esm/decorators/configurable.js.map +1 -0
  252. package/lib/esm/decorators/deprecated.js +39 -0
  253. package/lib/esm/decorators/deprecated.js.map +1 -0
  254. package/lib/esm/decorators/enumerable.js +14 -0
  255. package/lib/esm/decorators/enumerable.js.map +1 -0
  256. package/lib/esm/decorators/index.js +15 -0
  257. package/lib/esm/decorators/index.js.map +1 -0
  258. package/lib/esm/decorators/notConfigurable.js +9 -0
  259. package/lib/esm/decorators/notConfigurable.js.map +1 -0
  260. package/lib/esm/decorators/notEnumerable.js +9 -0
  261. package/lib/esm/decorators/notEnumerable.js.map +1 -0
  262. package/lib/esm/decorators/readOnly.js +9 -0
  263. package/lib/esm/decorators/readOnly.js.map +1 -0
  264. package/lib/esm/decorators/storeFn.js +18 -0
  265. package/lib/esm/decorators/storeFn.js.map +1 -0
  266. package/lib/esm/decorators/storeMerge.js +7 -0
  267. package/lib/esm/decorators/storeMerge.js.map +1 -0
  268. package/lib/esm/decorators/storeSet.js +7 -0
  269. package/lib/esm/decorators/storeSet.js.map +1 -0
  270. package/lib/esm/decorators/writable.js +14 -0
  271. package/lib/esm/decorators/writable.js.map +1 -0
  272. package/lib/esm/domain/AnyToPromise.js +144 -0
  273. package/lib/esm/domain/AnyToPromise.js.map +1 -0
  274. package/lib/esm/domain/DecoratorTypes.js +12 -0
  275. package/lib/esm/domain/DecoratorTypes.js.map +1 -0
  276. package/lib/esm/domain/Env.js +16 -0
  277. package/lib/esm/domain/Env.js.map +1 -0
  278. package/lib/esm/domain/Hooks.js +85 -0
  279. package/lib/esm/domain/Hooks.js.map +1 -0
  280. package/lib/esm/domain/Metadata.js +504 -0
  281. package/lib/esm/domain/Metadata.js.map +1 -0
  282. package/lib/esm/domain/Store.js +153 -0
  283. package/lib/esm/domain/Store.js.map +1 -0
  284. package/lib/esm/domain/Type.js +4 -0
  285. package/lib/esm/domain/Type.js.map +1 -0
  286. package/lib/esm/domain/index.js +8 -0
  287. package/lib/esm/domain/index.js.map +1 -0
  288. package/lib/esm/errors/UnsupportedDecoratorType.js +17 -0
  289. package/lib/esm/errors/UnsupportedDecoratorType.js.map +1 -0
  290. package/lib/esm/index.js +6 -0
  291. package/lib/esm/index.js.map +1 -0
  292. package/lib/esm/interfaces/AnyDecorator.js +2 -0
  293. package/lib/esm/interfaces/AnyDecorator.js.map +1 -0
  294. package/lib/esm/interfaces/DecoratorParameters.js +2 -0
  295. package/lib/esm/interfaces/DecoratorParameters.js.map +1 -0
  296. package/lib/esm/interfaces/HashOf.js +2 -0
  297. package/lib/esm/interfaces/HashOf.js.map +1 -0
  298. package/lib/esm/interfaces/MetadataTypes.js +2 -0
  299. package/lib/esm/interfaces/MetadataTypes.js.map +1 -0
  300. package/lib/esm/interfaces/ValueOf.js +2 -0
  301. package/lib/esm/interfaces/ValueOf.js.map +1 -0
  302. package/lib/esm/interfaces/index.js +2 -0
  303. package/lib/esm/interfaces/index.js.map +1 -0
  304. package/lib/esm/utils/catchError.js +17 -0
  305. package/lib/esm/utils/catchError.js.map +1 -0
  306. package/lib/esm/utils/decorators/decorateMethodsOf.js +19 -0
  307. package/lib/esm/utils/decorators/decorateMethodsOf.js.map +1 -0
  308. package/lib/esm/utils/decorators/decoratorArgs.js +5 -0
  309. package/lib/esm/utils/decorators/decoratorArgs.js.map +1 -0
  310. package/lib/esm/utils/decorators/decoratorTypeOf.js +19 -0
  311. package/lib/esm/utils/decorators/decoratorTypeOf.js.map +1 -0
  312. package/lib/esm/utils/decorators/inheritedDescriptorOf.js +11 -0
  313. package/lib/esm/utils/decorators/inheritedDescriptorOf.js.map +1 -0
  314. package/lib/esm/utils/decorators/useDecorators.js +10 -0
  315. package/lib/esm/utils/decorators/useDecorators.js.map +1 -0
  316. package/lib/esm/utils/decorators/useMethodDecorators.js +10 -0
  317. package/lib/esm/utils/decorators/useMethodDecorators.js.map +1 -0
  318. package/lib/esm/utils/imports/importPackage.js +12 -0
  319. package/lib/esm/utils/imports/importPackage.js.map +1 -0
  320. package/lib/esm/utils/index.js +15 -0
  321. package/lib/esm/utils/index.js.map +1 -0
  322. package/lib/esm/utils/objects/ancestorOf.js +7 -0
  323. package/lib/esm/utils/objects/ancestorOf.js.map +1 -0
  324. package/lib/esm/utils/objects/ancestorsOf.js +18 -0
  325. package/lib/esm/utils/objects/ancestorsOf.js.map +1 -0
  326. package/lib/esm/utils/objects/classOf.js +18 -0
  327. package/lib/esm/utils/objects/classOf.js.map +1 -0
  328. package/lib/esm/utils/objects/cleanObject.js +20 -0
  329. package/lib/esm/utils/objects/cleanObject.js.map +1 -0
  330. package/lib/esm/utils/objects/constructorOf.js +15 -0
  331. package/lib/esm/utils/objects/constructorOf.js.map +1 -0
  332. package/lib/esm/utils/objects/createInstance.js +5 -0
  333. package/lib/esm/utils/objects/createInstance.js.map +1 -0
  334. package/lib/esm/utils/objects/deepClone.js +53 -0
  335. package/lib/esm/utils/objects/deepClone.js.map +1 -0
  336. package/lib/esm/utils/objects/deepExtends.js +75 -0
  337. package/lib/esm/utils/objects/deepExtends.js.map +1 -0
  338. package/lib/esm/utils/objects/deepMerge.js +58 -0
  339. package/lib/esm/utils/objects/deepMerge.js.map +1 -0
  340. package/lib/esm/utils/objects/descriptorOf.js +14 -0
  341. package/lib/esm/utils/objects/descriptorOf.js.map +1 -0
  342. package/lib/esm/utils/objects/getClassOrSymbol.js +6 -0
  343. package/lib/esm/utils/objects/getClassOrSymbol.js.map +1 -0
  344. package/lib/esm/utils/objects/getConstructorArgNames.js +5 -0
  345. package/lib/esm/utils/objects/getConstructorArgNames.js.map +1 -0
  346. package/lib/esm/utils/objects/getEnumerableKeys.js +16 -0
  347. package/lib/esm/utils/objects/getEnumerableKeys.js.map +1 -0
  348. package/lib/esm/utils/objects/getValue.js +45 -0
  349. package/lib/esm/utils/objects/getValue.js.map +1 -0
  350. package/lib/esm/utils/objects/index.js +44 -0
  351. package/lib/esm/utils/objects/index.js.map +1 -0
  352. package/lib/esm/utils/objects/isArray.js +18 -0
  353. package/lib/esm/utils/objects/isArray.js.map +1 -0
  354. package/lib/esm/utils/objects/isArrowFn.js +5 -0
  355. package/lib/esm/utils/objects/isArrowFn.js.map +1 -0
  356. package/lib/esm/utils/objects/isBoolean.js +12 -0
  357. package/lib/esm/utils/objects/isBoolean.js.map +1 -0
  358. package/lib/esm/utils/objects/isClass.js +22 -0
  359. package/lib/esm/utils/objects/isClass.js.map +1 -0
  360. package/lib/esm/utils/objects/isCollection.js +18 -0
  361. package/lib/esm/utils/objects/isCollection.js.map +1 -0
  362. package/lib/esm/utils/objects/isDate.js +9 -0
  363. package/lib/esm/utils/objects/isDate.js.map +1 -0
  364. package/lib/esm/utils/objects/isEmpty.js +10 -0
  365. package/lib/esm/utils/objects/isEmpty.js.map +1 -0
  366. package/lib/esm/utils/objects/isEnumerable.js +18 -0
  367. package/lib/esm/utils/objects/isEnumerable.js.map +1 -0
  368. package/lib/esm/utils/objects/isFunction.js +4 -0
  369. package/lib/esm/utils/objects/isFunction.js.map +1 -0
  370. package/lib/esm/utils/objects/isInheritedFrom.js +22 -0
  371. package/lib/esm/utils/objects/isInheritedFrom.js.map +1 -0
  372. package/lib/esm/utils/objects/isNil.js +4 -0
  373. package/lib/esm/utils/objects/isNil.js.map +1 -0
  374. package/lib/esm/utils/objects/isNumber.js +12 -0
  375. package/lib/esm/utils/objects/isNumber.js.map +1 -0
  376. package/lib/esm/utils/objects/isObject.js +4 -0
  377. package/lib/esm/utils/objects/isObject.js.map +1 -0
  378. package/lib/esm/utils/objects/isObservable.js +4 -0
  379. package/lib/esm/utils/objects/isObservable.js.map +1 -0
  380. package/lib/esm/utils/objects/isPlainObject.js +13 -0
  381. package/lib/esm/utils/objects/isPlainObject.js.map +1 -0
  382. package/lib/esm/utils/objects/isPrimitive.js +24 -0
  383. package/lib/esm/utils/objects/isPrimitive.js.map +1 -0
  384. package/lib/esm/utils/objects/isPromise.js +12 -0
  385. package/lib/esm/utils/objects/isPromise.js.map +1 -0
  386. package/lib/esm/utils/objects/isProtectedKey.js +8 -0
  387. package/lib/esm/utils/objects/isProtectedKey.js.map +1 -0
  388. package/lib/esm/utils/objects/isSerializable.js +9 -0
  389. package/lib/esm/utils/objects/isSerializable.js.map +1 -0
  390. package/lib/esm/utils/objects/isStream.js +4 -0
  391. package/lib/esm/utils/objects/isStream.js.map +1 -0
  392. package/lib/esm/utils/objects/isString.js +11 -0
  393. package/lib/esm/utils/objects/isString.js.map +1 -0
  394. package/lib/esm/utils/objects/isSymbol.js +11 -0
  395. package/lib/esm/utils/objects/isSymbol.js.map +1 -0
  396. package/lib/esm/utils/objects/methodsOf.js +21 -0
  397. package/lib/esm/utils/objects/methodsOf.js.map +1 -0
  398. package/lib/esm/utils/objects/nameOf.js +26 -0
  399. package/lib/esm/utils/objects/nameOf.js.map +1 -0
  400. package/lib/esm/utils/objects/objectKeys.js +5 -0
  401. package/lib/esm/utils/objects/objectKeys.js.map +1 -0
  402. package/lib/esm/utils/objects/primitiveOf.js +16 -0
  403. package/lib/esm/utils/objects/primitiveOf.js.map +1 -0
  404. package/lib/esm/utils/objects/prototypeOf.js +10 -0
  405. package/lib/esm/utils/objects/prototypeOf.js.map +1 -0
  406. package/lib/esm/utils/objects/setValue.js +30 -0
  407. package/lib/esm/utils/objects/setValue.js.map +1 -0
  408. package/lib/esm/utils/objects/toMap.js +28 -0
  409. package/lib/esm/utils/objects/toMap.js.map +1 -0
  410. package/lib/esm/utils/objects/toStringConstructor.js +8 -0
  411. package/lib/esm/utils/objects/toStringConstructor.js.map +1 -0
  412. package/lib/esm/utils/proxyDelegation.js +50 -0
  413. package/lib/esm/utils/proxyDelegation.js.map +1 -0
  414. package/lib/esm/utils/uniq.js +11 -0
  415. package/lib/esm/utils/uniq.js.map +1 -0
  416. package/lib/types/decorators/configurable.d.ts +2 -0
  417. package/lib/types/decorators/deprecated.d.ts +32 -0
  418. package/lib/types/decorators/enumerable.d.ts +2 -0
  419. package/lib/types/decorators/index.d.ts +14 -0
  420. package/lib/types/decorators/notConfigurable.d.ts +2 -0
  421. package/lib/types/decorators/notEnumerable.d.ts +2 -0
  422. package/lib/types/decorators/readOnly.d.ts +2 -0
  423. package/lib/types/decorators/storeFn.d.ts +9 -0
  424. package/lib/types/decorators/storeMerge.d.ts +1 -0
  425. package/lib/types/decorators/storeSet.d.ts +1 -0
  426. package/lib/types/decorators/writable.d.ts +2 -0
  427. package/lib/types/domain/AnyToPromise.d.ts +42 -0
  428. package/lib/types/domain/DecoratorTypes.d.ts +10 -0
  429. package/lib/types/domain/Env.d.ts +13 -0
  430. package/lib/types/domain/Hooks.d.ts +45 -0
  431. package/lib/types/domain/Metadata.d.ts +442 -0
  432. package/lib/types/domain/Store.d.ts +69 -0
  433. package/lib/types/domain/Type.d.ts +11 -0
  434. package/lib/types/domain/index.d.ts +7 -0
  435. package/lib/types/errors/UnsupportedDecoratorType.d.ts +5 -0
  436. package/lib/types/index.d.ts +6 -0
  437. package/lib/types/interfaces/AnyDecorator.d.ts +1 -0
  438. package/lib/types/interfaces/DecoratorParameters.d.ts +3 -0
  439. package/lib/types/interfaces/HashOf.d.ts +1 -0
  440. package/lib/types/interfaces/MetadataTypes.d.ts +5 -0
  441. package/lib/types/interfaces/ValueOf.d.ts +1 -0
  442. package/lib/types/interfaces/index.d.ts +4 -0
  443. package/lib/types/utils/catchError.d.ts +2 -0
  444. package/lib/types/utils/decorators/decorateMethodsOf.d.ts +1 -0
  445. package/lib/types/utils/decorators/decoratorArgs.d.ts +2 -0
  446. package/lib/types/utils/decorators/decoratorTypeOf.d.ts +2 -0
  447. package/lib/types/utils/decorators/inheritedDescriptorOf.d.ts +1 -0
  448. package/lib/types/utils/decorators/useDecorators.d.ts +2 -0
  449. package/lib/types/utils/decorators/useMethodDecorators.d.ts +3 -0
  450. package/lib/types/utils/imports/importPackage.d.ts +1 -0
  451. package/lib/types/utils/index.d.ts +12 -0
  452. package/lib/types/utils/objects/ancestorOf.d.ts +2 -0
  453. package/lib/types/utils/objects/ancestorsOf.d.ts +6 -0
  454. package/lib/types/utils/objects/classOf.d.ts +13 -0
  455. package/lib/types/utils/objects/cleanObject.d.ts +6 -0
  456. package/lib/types/utils/objects/constructorOf.d.ts +11 -0
  457. package/lib/types/utils/objects/createInstance.d.ts +1 -0
  458. package/lib/types/utils/objects/deepClone.d.ts +6 -0
  459. package/lib/types/utils/objects/deepExtends.d.ts +10 -0
  460. package/lib/types/utils/objects/deepMerge.d.ts +9 -0
  461. package/lib/types/utils/objects/descriptorOf.d.ts +8 -0
  462. package/lib/types/utils/objects/getClassOrSymbol.d.ts +1 -0
  463. package/lib/types/utils/objects/getConstructorArgNames.d.ts +1 -0
  464. package/lib/types/utils/objects/getEnumerableKeys.d.ts +5 -0
  465. package/lib/types/utils/objects/getValue.d.ts +32 -0
  466. package/lib/types/utils/objects/index.d.ts +43 -0
  467. package/lib/types/utils/objects/isArray.d.ts +13 -0
  468. package/lib/types/utils/objects/isArrowFn.d.ts +1 -0
  469. package/lib/types/utils/objects/isBoolean.d.ts +7 -0
  470. package/lib/types/utils/objects/isClass.d.ts +1 -0
  471. package/lib/types/utils/objects/isCollection.d.ts +6 -0
  472. package/lib/types/utils/objects/isDate.d.ts +6 -0
  473. package/lib/types/utils/objects/isEmpty.d.ts +6 -0
  474. package/lib/types/utils/objects/isEnumerable.d.ts +6 -0
  475. package/lib/types/utils/objects/isFunction.d.ts +1 -0
  476. package/lib/types/utils/objects/isInheritedFrom.d.ts +1 -0
  477. package/lib/types/utils/objects/isNil.d.ts +1 -0
  478. package/lib/types/utils/objects/isNumber.d.ts +7 -0
  479. package/lib/types/utils/objects/isObject.d.ts +1 -0
  480. package/lib/types/utils/objects/isObservable.d.ts +1 -0
  481. package/lib/types/utils/objects/isPlainObject.d.ts +7 -0
  482. package/lib/types/utils/objects/isPrimitive.d.ts +14 -0
  483. package/lib/types/utils/objects/isPromise.d.ts +7 -0
  484. package/lib/types/utils/objects/isProtectedKey.d.ts +5 -0
  485. package/lib/types/utils/objects/isSerializable.d.ts +1 -0
  486. package/lib/types/utils/objects/isStream.d.ts +1 -0
  487. package/lib/types/utils/objects/isString.d.ts +6 -0
  488. package/lib/types/utils/objects/isSymbol.d.ts +6 -0
  489. package/lib/types/utils/objects/methodsOf.d.ts +5 -0
  490. package/lib/types/utils/objects/nameOf.d.ts +14 -0
  491. package/lib/types/utils/objects/objectKeys.d.ts +1 -0
  492. package/lib/types/utils/objects/primitiveOf.d.ts +1 -0
  493. package/lib/types/utils/objects/prototypeOf.d.ts +6 -0
  494. package/lib/types/utils/objects/setValue.d.ts +1 -0
  495. package/lib/types/utils/objects/toMap.d.ts +3 -0
  496. package/lib/types/utils/objects/toStringConstructor.d.ts +1 -0
  497. package/lib/types/utils/proxyDelegation.d.ts +33 -0
  498. package/lib/types/utils/uniq.d.ts +2 -0
  499. package/package.json +10 -6
  500. package/tsconfig.compile.esm.json +23 -0
  501. package/lib/index.js +0 -2317
  502. package/lib/index.js.map +0 -1
  503. package/lib/index.modern.js +0 -2207
  504. package/lib/index.modern.js.map +0 -1
@@ -1,2207 +0,0 @@
1
- import 'reflect-metadata';
2
-
3
- function catchError(cb) {
4
- try {
5
- cb();
6
- } catch (er) {
7
- return er;
8
- }
9
- }
10
- async function catchAsyncError(cb) {
11
- try {
12
- await cb();
13
- } catch (er) {
14
- return er;
15
- }
16
- }
17
-
18
- function _extends() {
19
- _extends = Object.assign || function (target) {
20
- for (var i = 1; i < arguments.length; i++) {
21
- var source = arguments[i];
22
-
23
- for (var key in source) {
24
- if (Object.prototype.hasOwnProperty.call(source, key)) {
25
- target[key] = source[key];
26
- }
27
- }
28
- }
29
-
30
- return target;
31
- };
32
-
33
- return _extends.apply(this, arguments);
34
- }
35
-
36
- var id = 0;
37
-
38
- function _classPrivateFieldLooseKey(name) {
39
- return "__private_" + id++ + "_" + name;
40
- }
41
-
42
- function _classPrivateFieldLooseBase(receiver, privateKey) {
43
- if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
44
- throw new TypeError("attempted to use private field on non-instance");
45
- }
46
-
47
- return receiver;
48
- }
49
-
50
- function uniq(list) {
51
- return Array.from(new Set(list).values());
52
- }
53
- function uniqBy(list, key = "id") {
54
- const map = new Map();
55
- list.forEach(item => {
56
- map.set(item[key], item);
57
- });
58
- return Array.from(map.values());
59
- }
60
-
61
- /**
62
- * Create a complete and iterable trap.
63
- * @param self
64
- * @param options
65
- * @ignore
66
- */
67
-
68
- function proxyDelegation(self, options = {}) {
69
- const {
70
- handlers = {},
71
- remove,
72
- ownKeys
73
- } = options;
74
-
75
- const get = options.getter || ((target, propertyKey) => target.get(propertyKey));
76
-
77
- const set = options.setter || ((target, propertyKey, value) => !!target.set(propertyKey, value));
78
-
79
- const itsOwnProp = (target, p) => Reflect.has(target, p) || typeof p === "symbol";
80
-
81
- return new Proxy(self, _extends({
82
- getOwnPropertyDescriptor(target, p) {
83
- return Reflect.getOwnPropertyDescriptor(target, p);
84
- },
85
-
86
- has(target, p) {
87
- if (itsOwnProp(target, p)) {
88
- return Reflect.has(target, p);
89
- }
90
-
91
- return get(target, p) !== undefined;
92
- },
93
-
94
- get(target, p, receiver) {
95
- if (itsOwnProp(target, p)) {
96
- return Reflect.get(target, p, receiver);
97
- }
98
-
99
- return get(target, p);
100
- },
101
-
102
- set(target, p, value, receiver) {
103
- if (itsOwnProp(target, p)) {
104
- return Reflect.set(target, p, value, receiver);
105
- }
106
-
107
- return !!set(target, p, value, receiver);
108
- },
109
-
110
- deleteProperty(target, p) {
111
- if (itsOwnProp(target, p) || !remove) {
112
- return Reflect.deleteProperty(target, p);
113
- }
114
-
115
- return remove(target, p);
116
- },
117
-
118
- defineProperty(target, p, attributes) {
119
- return Reflect.defineProperty(target, p, attributes);
120
- },
121
-
122
- ownKeys(target) {
123
- return uniq(Reflect.ownKeys(target).concat(ownKeys && ownKeys(target) || []));
124
- }
125
-
126
- }, handlers));
127
- }
128
-
129
- async function importPackage(packageName, loaderFn = () => import(packageName), optional = false) {
130
- try {
131
- return await loaderFn();
132
- } catch (e) {
133
- if (!optional) {
134
- throw new Error(`The "${packageName}\" package is missing.`);
135
- }
136
-
137
- return {};
138
- }
139
- }
140
-
141
- /**
142
- * Get the provide constructor if target is an instance.
143
- * @param target
144
- * @returns {*}
145
- */
146
- function getClass(target) {
147
- return target.prototype ? target : target.constructor;
148
- }
149
- /**
150
- * Get the provide constructor if target is an instance.
151
- * @param target
152
- * @returns {*}
153
- * @alias getClass
154
- */
155
-
156
- function classOf(target) {
157
- return getClass(target);
158
- }
159
-
160
- function ancestorOf(target) {
161
- return target && Object.getPrototypeOf(target);
162
- }
163
- function getInheritedClass(target) {
164
- return ancestorOf(target);
165
- }
166
-
167
- /**
168
- * Get the provide name.
169
- * @param targetClass
170
- */
171
- function nameOfClass(targetClass) {
172
- return typeof targetClass === "function" ? targetClass.name : targetClass.constructor.name;
173
- }
174
- /**
175
- * Get symbol name.
176
- * @param sym
177
- */
178
-
179
- const nameOfSymbol = sym => sym.toString().replace("Symbol(", "").replace(")", "");
180
- /**
181
- * Get object name
182
- */
183
-
184
- function nameOf(obj) {
185
- switch (typeof obj) {
186
- default:
187
- return "" + obj;
188
-
189
- case "symbol":
190
- return nameOfSymbol(obj);
191
-
192
- case "function":
193
- return nameOfClass(obj);
194
- }
195
- }
196
-
197
- /**
198
- *
199
- * @param target
200
- * @returns {Array}
201
- */
202
-
203
- function ancestorsOf(target) {
204
- const classes = [];
205
- let currentTarget = classOf(target);
206
-
207
- while (currentTarget && nameOf(currentTarget) !== "") {
208
- classes.unshift(currentTarget);
209
- currentTarget = getInheritedClass(currentTarget);
210
- }
211
-
212
- return classes;
213
- }
214
-
215
- /**
216
- * Return the prototype of the given class.
217
- * @param target
218
- * @returns {any}
219
- */
220
-
221
- function prototypeOf(target) {
222
- return classOf(target) === target ? target.prototype : target;
223
- }
224
-
225
- /**
226
- * Return all methods for a given class.
227
- * @param target
228
- */
229
-
230
- function methodsOf(target) {
231
- const methods = new Map();
232
- target = classOf(target);
233
- ancestorsOf(target).forEach(target => {
234
- const keys = Reflect.ownKeys(prototypeOf(target));
235
- keys.forEach(propertyKey => {
236
- if (propertyKey !== "constructor") {
237
- methods.set(propertyKey, {
238
- target,
239
- propertyKey
240
- });
241
- }
242
- });
243
- });
244
- return Array.from(methods.values());
245
- }
246
-
247
- /**
248
- * Return the descriptor for a given class and propertyKey
249
- * @param target
250
- * @param {string} propertyKey
251
- * @returns {PropertyDescriptor}
252
- */
253
- function descriptorOf(target, propertyKey) {
254
- return Object.getOwnPropertyDescriptor(target && target.prototype || target, propertyKey);
255
- }
256
- function isMethodDescriptor(target, propertyKey) {
257
- var _descriptorOf;
258
-
259
- return (_descriptorOf = descriptorOf(target, propertyKey)) == null ? void 0 : _descriptorOf.value;
260
- }
261
-
262
- var DecoratorTypes;
263
-
264
- (function (DecoratorTypes) {
265
- DecoratorTypes["PARAM"] = "parameter";
266
- DecoratorTypes["PARAM_CTOR"] = "parameter.constructor";
267
- DecoratorTypes["PARAM_STC"] = "parameter.static";
268
- DecoratorTypes["PROP"] = "property";
269
- DecoratorTypes["PROP_STC"] = "property.static";
270
- DecoratorTypes["METHOD"] = "method";
271
- DecoratorTypes["METHOD_STC"] = "method.static";
272
- DecoratorTypes["CLASS"] = "class";
273
- })(DecoratorTypes || (DecoratorTypes = {}));
274
-
275
- function decoratorTypeOf(args) {
276
- const [target, propertyKey, descriptor] = args;
277
-
278
- const staticType = type => {
279
- return target !== classOf(target) ? type : `${type}.static`;
280
- };
281
-
282
- if (typeof descriptor === "number") {
283
- return propertyKey ? staticType("parameter") : "parameter.constructor";
284
- }
285
-
286
- if (descriptor && descriptor.value) {
287
- return staticType("method");
288
- }
289
-
290
- if (propertyKey && descriptor === undefined || descriptor) {
291
- return staticType("property");
292
- }
293
-
294
- return DecoratorTypes.CLASS;
295
- }
296
-
297
- /**
298
- * Return true if value is an array
299
- * @param target
300
- * @returns {boolean}
301
- */
302
- function isArray(target) {
303
- return Array.isArray(target);
304
- }
305
- /**
306
- * Return true if the clazz is an array.
307
- * @param target
308
- * @returns {boolean}
309
- * @ignore
310
- */
311
-
312
- function isArrayOrArrayClass(target) {
313
- return target === Array || isArray(target);
314
- }
315
-
316
- /**
317
- *
318
- * @param target
319
- * @returns {boolean}
320
- */
321
- function isDate(target) {
322
- return target === Date || target instanceof Date && !isNaN(+target);
323
- }
324
-
325
- function isFunction(target) {
326
- return typeof target === "function";
327
- }
328
-
329
- function isNil(value) {
330
- return value === undefined || value === null;
331
- }
332
-
333
- /**
334
- *
335
- * @param target
336
- * @returns {boolean}
337
- */
338
- function isBoolean(target) {
339
- return typeof target === "boolean" || target instanceof Boolean || target === Boolean;
340
- }
341
- function isBooleanOrBooleanClass(target) {
342
- return typeof target === "boolean" || target instanceof Boolean || target === Boolean;
343
- }
344
-
345
- /**
346
- *
347
- * @param target
348
- * @returns {boolean}
349
- */
350
- function isNumber(target) {
351
- return typeof target === "number";
352
- }
353
- function isNumberOrNumberClass(target) {
354
- return typeof target === "number" || target instanceof Number || target === Number;
355
- }
356
-
357
- /**
358
- * @param target
359
- * @returns {boolean}
360
- */
361
- function isString(target) {
362
- return typeof target === "string";
363
- }
364
- function isStringOrStringClass(target) {
365
- return typeof target === "string" || target instanceof String || target === String;
366
- }
367
-
368
- /**
369
- * Return true if the given obj is a primitive.
370
- * @param target
371
- * @returns {boolean}
372
- * @ignore
373
- */
374
-
375
- function isPrimitiveOrPrimitiveClass(target) {
376
- return isStringOrStringClass(target) || isNumberOrNumberClass(target) || isBooleanOrBooleanClass(target);
377
- }
378
- /**
379
- * Return true if the given obj is a primitive.
380
- * @param target
381
- * @returns {boolean}
382
- */
383
-
384
- function isPrimitive(target) {
385
- return isString(target) || isNumber(target) || isBoolean(target);
386
- }
387
- function isPrimitiveClass(target) {
388
- return [String, Number, Boolean].includes(target);
389
- }
390
-
391
- /**
392
- *
393
- * @param target
394
- */
395
- function isSymbol(target) {
396
- return typeof target === "symbol";
397
- }
398
- function isSymbolOrSymbolClass(target) {
399
- return typeof target === "symbol" || target instanceof Symbol || target === Symbol;
400
- }
401
-
402
- const isBasicType = source => isNil(source) || isPrimitive(source) || isSymbol(source) || isFunction(source);
403
- /**
404
- * Return a cloned value
405
- * @param source
406
- * @param stack
407
- */
408
-
409
-
410
- function deepClone(source, stack = new WeakMap()) {
411
- let dest;
412
-
413
- if (isBasicType(source)) {
414
- return source;
415
- }
416
-
417
- if (isDate(source)) {
418
- return new Date(source);
419
- }
420
-
421
- const stacked = stack.get(source);
422
-
423
- if (stacked) {
424
- // See issue #1619
425
- // istanbul ignore next
426
- process.env.TSED_TRACK_CIRCULAR_REF && console.trace("Circular ref detected on deepClone", stacked);
427
- return stacked;
428
- }
429
-
430
- if (isArray(source)) {
431
- dest = [];
432
- } else {
433
- dest = {};
434
- stack.set(source, dest);
435
- }
436
-
437
- for (const key in source) {
438
- // Use getOwnPropertyDescriptor instead of source[key] to prevent from triggering setter/getter.
439
- const descriptor = Object.getOwnPropertyDescriptor(source, key);
440
-
441
- if (descriptor) {
442
- if (!isFunction(descriptor.value)) {
443
- dest[key] = deepClone(descriptor.value, stack);
444
- } else {
445
- Object.defineProperty(dest, key, descriptor);
446
- }
447
- }
448
- }
449
-
450
- if (!isArray(source)) {
451
- const prototype = Reflect.getPrototypeOf(source);
452
- Reflect.setPrototypeOf(dest, prototype);
453
- }
454
-
455
- return dest;
456
- }
457
-
458
- function createInstance(obj) {
459
- return obj ? classOf(obj) !== Object ? Object.create(obj) : {} : {};
460
- }
461
-
462
- /**
463
- * Prevent prototype pollution vulnerability
464
- * @param key
465
- */
466
- function isProtectedKey(key) {
467
- return ["__proto__", "constructor", "prototype"].includes(key);
468
- }
469
-
470
- function objectKeys(obj) {
471
- return Object.keys(obj).filter(key => !isProtectedKey(key));
472
- }
473
-
474
- function mergeReducerBuilder(cb) {
475
- return (collection, value, options) => {
476
- const index = collection.findIndex(item => cb(item, value));
477
-
478
- if (index === -1) {
479
- return [...collection, value];
480
- }
481
-
482
- collection[index] = deepMerge(collection[index], value, options);
483
- return collection;
484
- };
485
- }
486
- const defaultReducer = mergeReducerBuilder((a, b) => a === b);
487
-
488
- function getReducer({
489
- reducers,
490
- parentKey
491
- }) {
492
- if (!reducers) {
493
- return defaultReducer;
494
- }
495
-
496
- if (parentKey && reducers[parentKey]) {
497
- return reducers[parentKey];
498
- }
499
-
500
- return reducers["default"] || defaultReducer;
501
- }
502
-
503
- function shouldReturnObj(obj, source) {
504
- return isPrimitive(obj) || isSymbol(obj) || isFunction(obj) || source === undefined;
505
- }
506
-
507
- function shouldReturnSource(obj, source) {
508
- return obj === undefined || obj === null || obj === "" && source !== "";
509
- }
510
-
511
- function deepMerge(source, obj, options = {}) {
512
- if (shouldReturnSource(obj, source)) {
513
- return source;
514
- }
515
-
516
- if (shouldReturnObj(obj, source)) {
517
- return obj;
518
- }
519
-
520
- if (Array.isArray(source)) {
521
- const reducer = getReducer(options);
522
- return [].concat(obj).reduce((out, value) => reducer(out, value, options), [...source]);
523
- }
524
-
525
- return [...objectKeys(source), ...objectKeys(obj)].reduce((out, key) => {
526
- const src = source && source[key];
527
- const value = deepMerge(src, obj && obj[key], _extends({}, options, {
528
- parentKey: key
529
- }));
530
-
531
- if (options.cleanUndefinedProps && value === undefined) {
532
- return out;
533
- }
534
-
535
- return _extends({}, out, {
536
- [key]: value
537
- });
538
- }, createInstance(source));
539
- }
540
-
541
- /**
542
- * Metadata key
543
- * @private
544
- * @type {string}
545
- */
546
-
547
- const DESIGN_PARAM_TYPES = "design:paramtypes";
548
- /**
549
- * Metadata key
550
- * @private
551
- * @type {string}
552
- */
553
-
554
- const DESIGN_TYPE = "design:type";
555
- /**
556
- * Metadata key
557
- * @private
558
- * @type {string}
559
- */
560
-
561
- const DESIGN_RETURN_TYPE = "design:returntype";
562
- /**
563
- * Properties collections
564
- * @private
565
- * @type {string}
566
- */
567
-
568
- const PROPERTIES = new Map();
569
- /**
570
- * @stable
571
- */
572
-
573
- class Metadata {
574
- /**
575
- * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
576
- * @param key A key used to store and retrieve metadata.
577
- * @param target The target object on which the metadata is defined.
578
- * @param propertyKey The property key for the target.
579
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
580
- * @example
581
- *
582
- * ```typescript
583
- * class Example {
584
- * // property declarations are not part of ES6, though they are valid in TypeScript:
585
- * // static staticProperty;
586
- * // property;
587
- *
588
- * static staticMethod(p) { }
589
- * method(p) { }
590
- * }
591
- *
592
- * // constructor
593
- * result = Metadata.get("custom:annotation", Example);
594
- *
595
- * // property (on constructor)
596
- * result = Metadata.get("custom:annotation", Example, "staticProperty");
597
- *
598
- * // property (on prototype)
599
- * result = Metadata.get("custom:annotation", Example.prototype, "property");
600
- *
601
- * // method (on constructor)
602
- * result = Metadata.get("custom:annotation", Example, "staticMethod");
603
- *
604
- * // method (on prototype)
605
- * result = Metadata.get("custom:annotation", Example.prototype, "method");
606
- * ```
607
- *
608
- */
609
- static get(key, target, propertyKey) {
610
- return Reflect.getMetadata(key, classOf(target), propertyKey);
611
- }
612
- /**
613
- * Gets the metadata value for the provided metadata key on the target object or its prototype chain.
614
- * @param key A key used to store and retrieve metadata.
615
- * @param target The target object on which the metadata is defined.
616
- * @param propertyKey The property key for the target.
617
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
618
- * @example
619
- *
620
- * ```typescript
621
- * class Example {
622
- * // property declarations are not part of ES6, though they are valid in TypeScript:
623
- * // static staticProperty;
624
- * // property;
625
- *
626
- * static staticMethod(p) { }
627
- * method(p) { }
628
- * }
629
- *
630
- * // constructor
631
- * result = Metadata.getOwn("custom:annotation", Example);
632
- *
633
- * // property (on constructor)
634
- * result = Metadata.getOwn("custom:annotation", Example, "staticProperty");
635
- *
636
- * // property (on prototype)
637
- * result = Metadata.getOwn("custom:annotation", Example.prototype, "property");
638
- *
639
- * // method (on constructor)
640
- * result = Metadata.getOwn("custom:annotation", Example, "staticMethod");
641
- *
642
- * // method (on prototype)
643
- * result = Metadata.getOwn("custom:annotation", Example.prototype, "method");
644
- * ```
645
- *
646
- */
647
-
648
-
649
- static getOwn(key, target, propertyKey) {
650
- return Reflect.getOwnMetadata(key, classOf(target), propertyKey);
651
- }
652
- /**
653
- * Gets the metadata value for the provided metadata DESIGN_TYPE on the target object or its prototype chain.
654
- * @param target The target object on which the metadata is defined.
655
- * @param propertyKey The property key for the target.
656
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
657
- * @example
658
- *
659
- * ```typescript
660
- * class Example {
661
- * // property declarations are not part of ES6, though they are valid in TypeScript:
662
- * // static staticProperty;
663
- * // property;
664
- *
665
- * static staticMethod(p) { }
666
- * method(p) { }
667
- * }
668
- *
669
- * // on contructor
670
- * result = Metadata.getType(Example);
671
- *
672
- * // property (on constructor)
673
- * result = Metadata.getType(Example, "staticProperty");
674
- *
675
- * // method (on constructor)
676
- * result = Metadata.getType(Example, "staticMethod");
677
- * ```
678
- *
679
- */
680
-
681
-
682
- static getType(target, propertyKey) {
683
- return Reflect.getMetadata(DESIGN_TYPE, target, propertyKey);
684
- }
685
- /**
686
- * Gets the metadata value for the provided metadata DESIGN_TYPE on the target object or its prototype chain.
687
- * @param target The target object on which the metadata is defined.
688
- * @param propertyKey The property key for the target.
689
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
690
- * @example
691
- *
692
- * ```typescript
693
- * class Example {
694
- * // property declarations are not part of ES6, though they are valid in TypeScript:
695
- * // static staticProperty;
696
- * // property;
697
- *
698
- * static staticMethod(p) { }
699
- * method(p) { }
700
- * }
701
- *
702
- * // on contructor
703
- * result = Metadata.getOwnType(Example);
704
- *
705
- * // property (on constructor)
706
- * result = Metadata.getOwnType(Example, "staticProperty");
707
- *
708
- * // method (on constructor)
709
- * result = Metadata.getOwnType(Example, "staticMethod");
710
- * ```
711
- *
712
- */
713
-
714
-
715
- static getOwnType(target, propertyKey) {
716
- return Reflect.getMetadata(DESIGN_TYPE, target, propertyKey);
717
- }
718
- /**
719
- * Gets the metadata value for the provided metadata DESIGN_RETURN_TYPE on the target object or its prototype chain.
720
- * @param target The target object on which the metadata is defined.
721
- * @param propertyKey The property key for the target.
722
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
723
- * @example
724
- *
725
- * ```typescript
726
- * class Example {
727
- * // property declarations are not part of ES6, though they are valid in TypeScript:
728
- * // static staticProperty;
729
- * // property;
730
- *
731
- * static staticMethod(p) { }
732
- * method(p) { }
733
- * }
734
- *
735
- * // on contructor
736
- * result = Metadata.getReturnType(Example);
737
- *
738
- * // property (on constructor)
739
- * result = Metadata.getReturnType(Example, "staticProperty");
740
- *
741
- * // method (on constructor)
742
- * result = Metadata.getReturnType(Example, "staticMethod");
743
- * ```
744
- *
745
- */
746
-
747
-
748
- static getReturnType(target, propertyKey) {
749
- return Reflect.getMetadata(DESIGN_RETURN_TYPE, target, propertyKey);
750
- }
751
- /**
752
- * Gets the metadata value for the provided metadata DESIGN_RETURN_TYPE on the target object or its prototype chain.
753
- * @param target The target object on which the metadata is defined.
754
- * @param propertyKey The property key for the target.
755
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
756
- * @example
757
- *
758
- * ```typescript
759
- * class Example {
760
- * // property declarations are not part of ES6, though they are valid in TypeScript:
761
- * // static staticProperty;
762
- * // property;
763
- *
764
- * static staticMethod(p) { }
765
- * method(p) { }
766
- * }
767
- *
768
- * // on contructor
769
- * result = Metadata.getOwnReturnType(Example);
770
- *
771
- * // property (on constructor)
772
- * result = Metadata.getOwnReturnType(Example, "staticProperty");
773
- *
774
- * // method (on constructor)
775
- * result = Metadata.getOwnReturnType(Example, "staticMethod");
776
- * ```
777
- *
778
- */
779
-
780
-
781
- static getOwnReturnType(target, propertyKey) {
782
- return Reflect.getOwnMetadata(DESIGN_RETURN_TYPE, target, propertyKey);
783
- }
784
- /**
785
- * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
786
- * @param key A key used to store and retrieve metadata.
787
- * @param target The target object on which the metadata is defined.
788
- * @param propertyKey The property key for the target.
789
- * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
790
- * @example
791
- *
792
- * ```typescript
793
- * class Example {
794
- * // property declarations are not part of ES6, though they are valid in TypeScript:
795
- * // static staticProperty;
796
- * // property;
797
- *
798
- * static staticMethod(p) { }
799
- * method(p) { }
800
- * }
801
- *
802
- * // constructor
803
- * result = Metadata.has("custom:annotation", Example);
804
- *
805
- * // property (on constructor)
806
- * result = Metadata.has("custom:annotation", Example, "staticProperty");
807
- *
808
- * // property (on prototype)
809
- * result = Metadata.has("custom:annotation", Example.prototype, "property");
810
- *
811
- * // method (on constructor)
812
- * result = Metadata.has("custom:annotation", Example, "staticMethod");
813
- *
814
- * // method (on prototype)
815
- * result = Metadata.has("custom:annotation", Example.prototype, "method");
816
- * ```
817
- *
818
- */
819
-
820
-
821
- static has(key, target, propertyKey) {
822
- try {
823
- return Reflect.hasMetadata(key, classOf(target), propertyKey);
824
- } catch (er) {}
825
-
826
- return false;
827
- }
828
- /**
829
- * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
830
- * @param key A key used to store and retrieve metadata.
831
- * @param target The target object on which the metadata is defined.
832
- * @param propertyKey The property key for the target.
833
- * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
834
- * @example
835
- *
836
- * ```typescript
837
- * class Example {
838
- * // property declarations are not part of ES6, though they are valid in TypeScript:
839
- * // static staticProperty;
840
- * // property;
841
- *
842
- * static staticMethod(p) { }
843
- * method(p) { }
844
- * }
845
- *
846
- * // constructor
847
- * result = Metadata.has("custom:annotation", Example);
848
- *
849
- * // property (on constructor)
850
- * result = Metadata.hasOwn("custom:annotation", Example, "staticProperty");
851
- *
852
- * // property (on prototype)
853
- * result = Metadata.hasOwn("custom:annotation", Example.prototype, "property");
854
- *
855
- * // method (on constructor)
856
- * result = Metadata.hasOwn("custom:annotation", Example, "staticMethod");
857
- *
858
- * // method (on prototype)
859
- * result = Metadata.hasOwn("custom:annotation", Example.prototype, "method");
860
- * ```
861
- *
862
- */
863
-
864
-
865
- static hasOwn(key, target, propertyKey) {
866
- return Reflect.hasOwnMetadata(key, classOf(target), propertyKey);
867
- }
868
- /**
869
- * Deletes the metadata entry from the target object with the provided key.
870
- * @param key A key used to store and retrieve metadata.
871
- * @param target The target object on which the metadata is defined.
872
- * @param propertyKey The property key for the target.
873
- * @returns `true` if the metadata entry was found and deleted; otherwise, false.
874
- * @example
875
- *
876
- * ```typescript
877
- * class Example {
878
- * // property declarations are not part of ES6, though they are valid in TypeScript:
879
- * // static staticProperty;
880
- * // property;
881
- *
882
- * static staticMethod(p) { }
883
- * method(p) { }
884
- * }
885
- *
886
- * // constructor
887
- * result = Metadata.delete("custom:annotation", Example);
888
- *
889
- * // property (on constructor)
890
- * result = Metadata.delete("custom:annotation", Example, "staticProperty");
891
- *
892
- * // property (on prototype)
893
- * result = Metadata.delete("custom:annotation", Example.prototype, "property");
894
- *
895
- * // method (on constructor)
896
- * result = Metadata.delete("custom:annotation", Example, "staticMethod");
897
- *
898
- * // method (on prototype)
899
- * result = Metadata.delete("custom:annotation", Example.prototype, "method");
900
- * ```
901
- *
902
- */
903
-
904
-
905
- static delete(key, target, propertyKey) {
906
- return Reflect.deleteMetadata(key, classOf(target), propertyKey);
907
- }
908
- /**
909
- * Set the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.
910
- * @param target The target object on which the metadata is defined.
911
- * @param propertyKey The property key for the target.
912
- * @param value A value that contains attached metadata.
913
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
914
- * @example
915
- *
916
- * ```typescript
917
- * class Example {
918
- * // property declarations are not part of ES6, though they are valid in TypeScript:
919
- * // static staticProperty;
920
- * // property;
921
- *
922
- * static staticMethod(p) { }
923
- * method(p) { }
924
- * }
925
- *
926
- * // on contructor
927
- * result = Metadata.setParamTypes(Example, undefined, [Object]);
928
- *
929
- * // property (on constructor)
930
- * result = Metadata.setParamTypes(Example, "staticProperty", [Object]);
931
- *
932
- * // property (on prototype)
933
- * result = Metadata.setParamTypes(Example.prototype, "property", [Object]);
934
- *
935
- * // method (on constructor)
936
- * result = Metadata.setParamTypes(Example, "staticMethod", [Object]);
937
- *
938
- * // method (on prototype)
939
- * result = Metadata.setParamTypes(Example.prototype, "method", [Object]);
940
- * ```
941
- *
942
- */
943
-
944
-
945
- static setParamTypes(target, propertyKey, value) {
946
- return this.set(DESIGN_PARAM_TYPES, value, target.prototype, propertyKey);
947
- }
948
- /**
949
- * Define a unique metadata entry on the target.
950
- * @param key A key used to store and retrieve metadata.
951
- * @param value A value that contains attached metadata.
952
- * @param target The target object on which to define metadata.
953
- * @param propertyKey The property key for the target.
954
- * @example
955
- *
956
- * ```typescript
957
- * class Example {
958
- * // property declarations are not part of ES6, though they are valid in TypeScript:
959
- * // static staticProperty;
960
- * // property;
961
- *
962
- * static staticMethod(p) { }
963
- * method(p) { }
964
- * }
965
- *
966
- * // constructor
967
- * Reflect.defineMetadata("custom:annotation", options, Example);
968
- *
969
- * // property (on constructor)
970
- * Reflect.defineMetadata("custom:annotation", Number, Example, "staticProperty");
971
- *
972
- * // property (on prototype)
973
- * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "property");
974
- *
975
- * // method (on constructor)
976
- * Reflect.defineMetadata("custom:annotation", Number, Example, "staticMethod");
977
- *
978
- * // method (on prototype)
979
- * Reflect.defineMetadata("custom:annotation", Number, Example.prototype, "method");
980
- *
981
- * // decorator factory as metadata-producing annotation.
982
- * function MyAnnotation(options): PropertyDecorator {
983
- * return (target, key) => Reflect.defineMetadata("custom:annotation", options, target, key);
984
- * }
985
- * ```
986
- *
987
- */
988
-
989
-
990
- static set(key, value, target, propertyKey) {
991
- const targets = PROPERTIES.has(key) ? PROPERTIES.get(key) || [] : [];
992
- const classConstructor = classOf(target);
993
-
994
- if (targets.indexOf(classConstructor) === -1) {
995
- targets.push(classConstructor);
996
- PROPERTIES.set(key, targets);
997
- }
998
-
999
- Reflect.defineMetadata(key, value, classOf(target), propertyKey);
1000
- }
1001
- /**
1002
- * Gets the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.
1003
- * @param targetPrototype
1004
- * @param propertyKey The property key for the target.
1005
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
1006
- * @example
1007
- *
1008
- * ```typescript
1009
- * class Example {
1010
- * // property declarations are not part of ES6, though they are valid in TypeScript:
1011
- * // static staticProperty;
1012
- * // property;
1013
- *
1014
- * static staticMethod(p) { }
1015
- * method(p) { }
1016
- * }
1017
- *
1018
- * // on contructor
1019
- * result = Metadata.getParamTypes(Example.prototype);
1020
- *
1021
- * // property (on constructor)
1022
- * result = Metadata.getParamTypes(Example.prototype, "staticProperty");
1023
- *
1024
- * // method (on constructor)
1025
- * result = Metadata.getParamTypes(Example.prototype, "staticMethod");
1026
- * ```
1027
- *
1028
- */
1029
-
1030
-
1031
- static getParamTypes(targetPrototype, propertyKey) {
1032
- return Reflect.getMetadata(DESIGN_PARAM_TYPES, targetPrototype, propertyKey) || [];
1033
- }
1034
- /**
1035
- * Gets the metadata value for the provided metadata DESIGN_PARAM_TYPES on the target object or its prototype chain.
1036
- * @param target The target object on which the metadata is defined.
1037
- * @param propertyKey The property key for the target.
1038
- * @returns The metadata value for the metadata key if found; otherwise, `undefined`.
1039
- * @example
1040
- *
1041
- * ```typescript
1042
- * class Example {
1043
- * // property declarations are not part of ES6, though they are valid in TypeScript:
1044
- * // static staticProperty;
1045
- * // property;
1046
- *
1047
- * static staticMethod(p) { }
1048
- * method(p) { }
1049
- * }
1050
- *
1051
- * // on contructor
1052
- * result = Metadata.getParamTypes(Example);
1053
- *
1054
- * // property (on constructor)
1055
- * result = Metadata.getParamTypes(Example, "staticProperty");
1056
- *
1057
- * // method (on constructor)
1058
- * result = Metadata.getParamTypes(Example, "staticMethod");
1059
- * ```
1060
- *
1061
- */
1062
-
1063
-
1064
- static getOwnParamTypes(target, propertyKey) {
1065
- return Reflect.getOwnMetadata(DESIGN_PARAM_TYPES, target, propertyKey) || [];
1066
- }
1067
-
1068
- }
1069
- /**
1070
- * Get all metadata for a metadataKey.
1071
- * @param metadataKey
1072
- */
1073
-
1074
- Metadata.getTargetsFromPropertyKey = metadataKey => PROPERTIES.has(metadataKey) ? PROPERTIES.get(metadataKey) || [] : [];
1075
-
1076
- /**
1077
- * @ignore
1078
- */
1079
-
1080
- const CLASS_STORE = "tsed:class:store";
1081
- /**
1082
- * @ignore
1083
- */
1084
-
1085
- const METHOD_STORE = "tsed:method:store";
1086
- /**
1087
- * @ignore
1088
- */
1089
-
1090
- const PROPERTY_STORE = "tsed:property:store";
1091
- /**
1092
- * @ignore
1093
- */
1094
-
1095
- const PARAM_STORE = "tsed:param:store";
1096
- const stores = new Map();
1097
-
1098
- function storeGet(key, ...args) {
1099
- if (isSymbol(args[0])) {
1100
- if (!stores.has(args[0])) {
1101
- stores.set(args[0], new Store());
1102
- }
1103
-
1104
- return stores.get(args[0]);
1105
- } else {
1106
- const registry = Metadata;
1107
-
1108
- if (!registry.hasOwn(key, ...args)) {
1109
- registry.set(key, new Store(), ...args);
1110
- }
1111
-
1112
- return registry.getOwn(key, ...args);
1113
- }
1114
- }
1115
-
1116
- function defineStore(args) {
1117
- const [target, propertyKey, descriptor] = args;
1118
-
1119
- switch (decoratorTypeOf(args)) {
1120
- case DecoratorTypes.PARAM_CTOR:
1121
- case DecoratorTypes.PARAM_STC:
1122
- case DecoratorTypes.PARAM:
1123
- const store = storeGet(PARAM_STORE, target, propertyKey);
1124
-
1125
- if (!store.has("" + descriptor)) {
1126
- store.set("" + descriptor, new Store());
1127
- }
1128
-
1129
- return store.get("" + descriptor);
1130
-
1131
- case DecoratorTypes.PROP:
1132
- case DecoratorTypes.PROP_STC:
1133
- return storeGet(PROPERTY_STORE, target, propertyKey);
1134
-
1135
- case DecoratorTypes.METHOD:
1136
- case DecoratorTypes.METHOD_STC:
1137
- return storeGet(METHOD_STORE, target, propertyKey);
1138
-
1139
- case DecoratorTypes.CLASS:
1140
- return storeGet(CLASS_STORE, target);
1141
- }
1142
- }
1143
-
1144
- class Store {
1145
- constructor() {
1146
- this._entries = new Map();
1147
- }
1148
- /**
1149
- * Create or get a Store from args {target + methodName + descriptor}
1150
- * @param args
1151
- * @returns {Store}
1152
- */
1153
-
1154
-
1155
- static from(...args) {
1156
- return defineStore(args);
1157
- }
1158
- /**
1159
- * Create store on the method.
1160
- * @param target
1161
- * @param {string} propertyKey
1162
- * @returns {Store}
1163
- */
1164
-
1165
-
1166
- static fromMethod(target, propertyKey) {
1167
- return Store.from(target, propertyKey, descriptorOf(target, propertyKey));
1168
- }
1169
-
1170
- static mergeStoreFrom(target, source, ...args) {
1171
- const store = Store.from(target, ...args);
1172
-
1173
- Store.from(source, ...args)._entries.forEach((value, key) => {
1174
- store.merge(key, value);
1175
- });
1176
-
1177
- return store;
1178
- }
1179
-
1180
- static mergeStoreMethodFrom(target, source, propertyKey) {
1181
- return this.mergeStoreFrom(target, source, propertyKey, descriptorOf(target, propertyKey));
1182
- }
1183
- /**
1184
- * The get() method returns a specified element from a Map object.
1185
- * @param key Required. The key of the element to return from the Map object.
1186
- * @param defaultValue
1187
- * @returns {T} Returns the element associated with the specified key or undefined if the key can't be found in the Map object.
1188
- */
1189
-
1190
-
1191
- get(key, defaultValue) {
1192
- return this._entries.get(nameOf(key)) || defaultValue;
1193
- }
1194
- /**
1195
- * The has() method returns a boolean indicating whether an element with the specified key exists or not.
1196
- * @param key
1197
- * @returns {boolean}
1198
- */
1199
-
1200
-
1201
- has(key) {
1202
- return this._entries.has(nameOf(key));
1203
- }
1204
- /**
1205
- * The set() method adds or updates an element with a specified key and value to a Map object.
1206
- * @param key Required. The key of the element to add to the Map object.
1207
- * @param metadata Required. The value of the element to add to the Map object.
1208
- */
1209
-
1210
-
1211
- set(key, metadata) {
1212
- this._entries.set(nameOf(key), metadata);
1213
-
1214
- return this;
1215
- }
1216
- /**
1217
- * The delete() method removes the specified element from a Map object.
1218
- * @param key Required. The key of the element to remove from the Map object.
1219
- * @returns {boolean} Returns true if an element in the Map object existed and has been removed, or false if the element does not exist.
1220
- */
1221
-
1222
-
1223
- delete(key) {
1224
- return this._entries.delete(nameOf(key));
1225
- }
1226
- /**
1227
- * Merge given value with existing value.
1228
- * @param key
1229
- * @param value
1230
- * @param inverse Change the merge order. Get the existing value and apply over given value
1231
- * @returns {Store}
1232
- */
1233
-
1234
-
1235
- merge(key, value, inverse = false) {
1236
- let _value_ = this.get(key);
1237
-
1238
- if (_value_) {
1239
- value = deepClone(value);
1240
- _value_ = deepClone(_value_);
1241
- value = inverse ? deepMerge(value, _value_) : deepMerge(_value_, value);
1242
- }
1243
-
1244
- this.set(key, value);
1245
- return this;
1246
- }
1247
-
1248
- toJson() {
1249
- return [...this._entries.entries()].reduce((obj, [key, value]) => {
1250
- return _extends({}, obj, {
1251
- [key]: value
1252
- });
1253
- }, {});
1254
- }
1255
-
1256
- }
1257
-
1258
- function decorateMethodsOf(klass, decorator) {
1259
- methodsOf(klass).forEach(({
1260
- target,
1261
- propertyKey
1262
- }) => {
1263
- if (target !== classOf(klass)) {
1264
- Object.defineProperty(prototypeOf(klass), propertyKey, {
1265
- value(...args) {
1266
- return prototypeOf(target)[propertyKey].apply(this, args);
1267
- }
1268
-
1269
- });
1270
- Store.mergeStoreMethodFrom(klass, target, propertyKey);
1271
- }
1272
-
1273
- decorator(prototypeOf(klass), propertyKey, descriptorOf(klass, propertyKey));
1274
- });
1275
- }
1276
-
1277
- function decoratorArgs(target, propertyKey) {
1278
- return [target, propertyKey, descriptorOf(target, propertyKey)];
1279
- }
1280
-
1281
- function inheritedDescriptorOf(target, propertyKey) {
1282
- for (const klass of ancestorsOf(target)) {
1283
- const descriptor = Object.getOwnPropertyDescriptor(klass && klass.prototype || klass, propertyKey);
1284
-
1285
- if (descriptor) {
1286
- return descriptor;
1287
- }
1288
- }
1289
-
1290
- return undefined;
1291
- }
1292
-
1293
- function useDecorators(...decorators) {
1294
- return (...args) => {
1295
- decorators.filter(o => !!o).forEach(decorator => {
1296
- decorator(...args);
1297
- });
1298
- };
1299
- }
1300
-
1301
- function useMethodDecorator(decorator) {
1302
- return (target, propertyKey) => decorator(target, propertyKey, descriptorOf(target, propertyKey));
1303
- }
1304
- function useMethodDecorators(...decorators) {
1305
- return (target, propertyKey) => {
1306
- decorators.filter(Boolean).forEach(decorator => decorator(target, propertyKey, descriptorOf(target, propertyKey)));
1307
- };
1308
- }
1309
-
1310
- /**
1311
- * Remove undefined value
1312
- * @param obj
1313
- * @param ignore
1314
- */
1315
-
1316
- function cleanObject(obj, ignore = []) {
1317
- return Object.entries(obj).reduce((obj, [key, value]) => {
1318
- if (isProtectedKey(key) || ignore.includes(key)) {
1319
- return obj;
1320
- }
1321
-
1322
- return value === undefined ? obj : _extends({}, obj, {
1323
- [key]: value
1324
- });
1325
- }, {});
1326
- }
1327
-
1328
- /**
1329
- * Get the class constructor
1330
- * @param target
1331
- */
1332
- function getConstructor(target) {
1333
- return typeof target === "function" ? target : target.constructor;
1334
- }
1335
- /**
1336
- * Get the class constructor
1337
- * @param target
1338
- */
1339
-
1340
- function constructorOf(target) {
1341
- return getConstructor(target);
1342
- }
1343
-
1344
- function reducer() {
1345
- return (collection, value) => {
1346
- collection.indexOf(value) === -1 && collection.push(value);
1347
- return collection;
1348
- };
1349
- }
1350
- /**
1351
- * Deep extends a model with another one.
1352
- * @param out
1353
- * @param obj
1354
- * @param reducers
1355
- * @returns {any}
1356
- * @deprecated Since 2021-07-16. Use deepMerge instead of
1357
- */
1358
-
1359
-
1360
- function deepExtends(out, obj, reducers = {}) {
1361
- if (obj === undefined || obj === null) {
1362
- return out;
1363
- }
1364
-
1365
- if (isPrimitive(obj) || typeof obj === "symbol" || typeof obj === "function") {
1366
- return obj;
1367
- }
1368
-
1369
- if (isArrayOrArrayClass(obj)) {
1370
- out = out || [];
1371
- } else {
1372
- out = out || createInstance(obj);
1373
- }
1374
-
1375
- const defaultReducer = reducers["default"] ? reducers["default"] : reducer();
1376
-
1377
- const set = (key, value) => {
1378
- if (isArrayOrArrayClass(obj)) {
1379
- out.indexOf(value) === -1 && out.push(value);
1380
- } else {
1381
- out[key] = value;
1382
- }
1383
- };
1384
-
1385
- objectKeys(obj).forEach(key => {
1386
- let value = obj[key]; // istanbul ignore next
1387
-
1388
- if (value === undefined || value === null) {
1389
- return;
1390
- } // istanbul ignore next
1391
-
1392
-
1393
- if (value === "" && out[key] !== "") {
1394
- return;
1395
- }
1396
-
1397
- if (isPrimitive(value) || typeof value === "function") {
1398
- set(key, value);
1399
- return;
1400
- }
1401
-
1402
- if (isArrayOrArrayClass(value)) {
1403
- value = value.map(value => deepExtends(undefined, value));
1404
- set(key, [].concat(out[key] || [], value).reduce((collection, value) => reducers[key] ? reducers[key](collection, value) : defaultReducer(collection, value), []));
1405
- return;
1406
- } // Object
1407
-
1408
-
1409
- if (isArrayOrArrayClass(obj)) {
1410
- set(key, deepExtends(undefined, value, reducers));
1411
- } else {
1412
- set(key, deepExtends(out[key], value, reducers));
1413
- }
1414
- });
1415
-
1416
- if (isArrayOrArrayClass(out)) {
1417
- out.reduce((collection, value) => defaultReducer(collection, value), []);
1418
- }
1419
-
1420
- return out;
1421
- }
1422
-
1423
- function isArrowFn(target) {
1424
- return target && isFunction(target) && !target.prototype;
1425
- }
1426
-
1427
- /**
1428
- *
1429
- * @param target
1430
- * @returns {boolean}
1431
- */
1432
-
1433
- function isClassObject(target) {
1434
- return target === Object;
1435
- }
1436
- function isPlainObject(target) {
1437
- return isClassObject(classOf(target)) && target !== Object;
1438
- }
1439
-
1440
- /**
1441
- * Tests to see if the object is an ES2015 (ES6) Promise
1442
- * @see {@link https://www.ecma-international.org/ecma-262/6.0/#sec-promise-objects}
1443
- * @param target
1444
- * @returns {boolean}
1445
- */
1446
- function isPromise(target) {
1447
- return target === Promise || target instanceof Promise || !!target && typeof target.subscribe !== "function" && typeof target.then === "function";
1448
- }
1449
-
1450
- function isClass(target) {
1451
- if (!target) {
1452
- return false;
1453
- }
1454
-
1455
- if (isArrowFn(target)) {
1456
- return false;
1457
- }
1458
-
1459
- return !(isSymbol(target) || isPrimitiveOrPrimitiveClass(target) || isClassObject(target) || isDate(target) || isPromise(target) || isArrayOrArrayClass(target));
1460
- }
1461
-
1462
- function getClassOrSymbol(target) {
1463
- return isClass(target) ? classOf(target) : target;
1464
- }
1465
-
1466
- function toStringConstructor(target) {
1467
- const ctr = constructorOf(target);
1468
- const strings = ctr.toString().split("\n");
1469
- const ctrString = strings.find(s => s.indexOf("constructor(") > -1) || "constructor()";
1470
- return `${ctrString.replace("{", "").trim()}`;
1471
- }
1472
-
1473
- function getConstructorArgNames(target) {
1474
- return toStringConstructor(target).replace("constructor(", "").replace(")", "").split(", ").filter(Boolean);
1475
- }
1476
-
1477
- /**
1478
- *
1479
- * @param obj
1480
- * @param key
1481
- */
1482
-
1483
- function isEnumerable(obj, key) {
1484
- const klass = classOf(obj);
1485
-
1486
- if (klass) {
1487
- const descriptor = inheritedDescriptorOf(klass, key);
1488
-
1489
- if (descriptor) {
1490
- return descriptor.enumerable;
1491
- }
1492
- }
1493
-
1494
- return Object.prototype.propertyIsEnumerable.call(obj, key);
1495
- }
1496
-
1497
- /**
1498
- * Return all enumerable keys of the given object
1499
- * @param obj
1500
- */
1501
-
1502
- function getEnumerableKeys(obj) {
1503
- const keys = [];
1504
-
1505
- for (const key in obj) {
1506
- if (!isProtectedKey(key) && isEnumerable(obj, key)) {
1507
- keys.push(key);
1508
- }
1509
- }
1510
-
1511
- return keys;
1512
- }
1513
-
1514
- function isObject(target) {
1515
- return typeof target === "object";
1516
- }
1517
-
1518
- const mapOptions = args => {
1519
- const [expression, scope, defaultValue, separator = "."] = args;
1520
-
1521
- if (isObject(scope) || isString(expression)) {
1522
- return {
1523
- expression,
1524
- scope,
1525
- defaultValue,
1526
- separator
1527
- };
1528
- }
1529
-
1530
- return {
1531
- expression: scope,
1532
- scope: expression,
1533
- defaultValue,
1534
- separator
1535
- };
1536
- };
1537
-
1538
- function getValue(...args) {
1539
- const options = mapOptions(args);
1540
- let scope = options.scope;
1541
- const {
1542
- expression,
1543
- defaultValue,
1544
- separator
1545
- } = options;
1546
-
1547
- if (!expression) {
1548
- return scope;
1549
- }
1550
-
1551
- if (!scope) {
1552
- return defaultValue;
1553
- }
1554
-
1555
- const keys = expression.split(separator);
1556
-
1557
- const getValue = key => {
1558
- if (scope) {
1559
- if (scope[key] !== undefined || key in scope) {
1560
- return scope[key];
1561
- }
1562
-
1563
- if (isFunction(scope.get)) {
1564
- return scope.get(key);
1565
- }
1566
- }
1567
- };
1568
-
1569
- while ((scope = getValue(keys.shift())) && keys.length) {}
1570
-
1571
- return scope === undefined ? defaultValue : scope;
1572
- }
1573
-
1574
- /**
1575
- * Return true if the target.
1576
- * @param target
1577
- * @returns {boolean}
1578
- */
1579
-
1580
- function isCollection(target) {
1581
- return isArrayOrArrayClass(target) || target === Map || target instanceof Map || target === Set || target instanceof Set || target === WeakMap || target instanceof WeakMap || target === WeakSet || target instanceof WeakSet;
1582
- }
1583
-
1584
- /**
1585
- * Return true if the value is an empty string, null or undefined.
1586
- * @param value
1587
- * @returns {boolean}
1588
- */
1589
-
1590
- function isEmpty(value) {
1591
- return value === "" || isNil(value);
1592
- }
1593
-
1594
- function isInheritedFrom(target, from, deep = 5) {
1595
- if (!target || !from) {
1596
- return false;
1597
- }
1598
-
1599
- target = classOf(target);
1600
- from = classOf(from);
1601
-
1602
- while (nameOf(target) !== "") {
1603
- if (!deep) {
1604
- return false;
1605
- }
1606
-
1607
- if (target === from) {
1608
- return true;
1609
- }
1610
-
1611
- target = ancestorOf(target);
1612
- deep--;
1613
- }
1614
-
1615
- return false;
1616
- }
1617
-
1618
- function isObservable(obj) {
1619
- return !!obj && typeof obj.lift === "function" && typeof obj.subscribe === "function";
1620
- }
1621
-
1622
- function isStream(obj) {
1623
- return obj !== null && typeof obj === "object" && typeof obj.pipe === "function";
1624
- }
1625
-
1626
- function isSerializable(data) {
1627
- return !(Buffer.isBuffer(data) || isStream(data) || isBoolean(data) || isNumber(data) || isString(data) || isNil(data));
1628
- }
1629
-
1630
- function primitiveOf(target) {
1631
- if (isStringOrStringClass(target)) {
1632
- return "string";
1633
- }
1634
-
1635
- if (isNumberOrNumberClass(target)) {
1636
- return "number";
1637
- }
1638
-
1639
- if (isBooleanOrBooleanClass(target)) {
1640
- return "boolean";
1641
- }
1642
-
1643
- return "any";
1644
- }
1645
-
1646
- function setValue(scope, expression, value, separator = ".") {
1647
- const keys = expression.split(separator);
1648
-
1649
- const setValue = (key, add) => {
1650
- if (isProtectedKey(key)) {
1651
- return false;
1652
- }
1653
-
1654
- if (add) {
1655
- if (typeof scope.set === "function") {
1656
- scope.set(key, value);
1657
- } else {
1658
- scope[key] = value;
1659
- }
1660
-
1661
- return false;
1662
- }
1663
-
1664
- if (typeof scope.set === "function") {
1665
- if (!scope.has(key)) {
1666
- scope.set(key, {});
1667
- }
1668
-
1669
- scope = scope.get(key);
1670
- } else {
1671
- scope = scope[key] = scope[key] || {};
1672
- }
1673
-
1674
- return true;
1675
- };
1676
-
1677
- while (setValue(keys.shift(), !keys.length)) {}
1678
- }
1679
-
1680
- function createIdentityFn(keyOrFn) {
1681
- if (!keyOrFn) {
1682
- return (v, k) => String(k);
1683
- }
1684
-
1685
- if (isString(keyOrFn)) {
1686
- return item => {
1687
- return item[keyOrFn];
1688
- };
1689
- }
1690
-
1691
- return keyOrFn;
1692
- }
1693
-
1694
- function toMap(input, keyOrFn) {
1695
- if (isArray(input)) {
1696
- const _identity = createIdentityFn(keyOrFn || "id");
1697
-
1698
- return input.reduce((map, value, index) => {
1699
- const ids = [].concat(_identity(value, index));
1700
- ids.forEach(id => map.set(id, value));
1701
- return map;
1702
- }, new Map());
1703
- }
1704
-
1705
- const identity = createIdentityFn(keyOrFn);
1706
- return Object.entries(input).reduce((map, [key, value]) => {
1707
- return map.set(identity(value, key), value);
1708
- }, new Map());
1709
- }
1710
-
1711
- /**
1712
- *
1713
- */
1714
- var Env;
1715
-
1716
- (function (Env) {
1717
- Env["PROD"] = "production";
1718
- Env["DEV"] = "development";
1719
- Env["TEST"] = "test";
1720
- })(Env || (Env = {}));
1721
- /**
1722
- * Fallback
1723
- * @type {Env}
1724
- */
1725
- // tslint:disable-next-line: variable-name
1726
-
1727
-
1728
- const EnvTypes = Env;
1729
-
1730
- class Hooks {
1731
- constructor() {
1732
- this.listeners = new Map();
1733
- }
1734
- /**
1735
- * Listen a hook event
1736
- * @param event
1737
- * @param cb
1738
- */
1739
-
1740
-
1741
- on(event, cb) {
1742
- if (!this.listeners.has(event)) {
1743
- this.listeners.set(event, []);
1744
- }
1745
-
1746
- this.listeners.get(event).push(cb);
1747
- return this;
1748
- }
1749
- /**
1750
- * Remove a listener attached to an event
1751
- * @param event
1752
- * @param cb
1753
- */
1754
-
1755
-
1756
- off(event, cb) {
1757
- if (this.listeners.has(event)) {
1758
- this.listeners.set(event, this.listeners.get(event).filter(item => item === cb));
1759
- }
1760
-
1761
- return this;
1762
- }
1763
- /**
1764
- * Trigger an event and call listener.
1765
- * @param event
1766
- * @param args
1767
- * @param callThis
1768
- */
1769
-
1770
-
1771
- emit(event, args = [], callThis = null) {
1772
- if (this.listeners.has(event)) {
1773
- for (const cb of this.listeners.get(event)) {
1774
- cb.call(callThis, ...args);
1775
- }
1776
- }
1777
- }
1778
- /**
1779
- * Trigger an event, listener alter given value and return it.
1780
- * @param event
1781
- * @param value
1782
- * @param args
1783
- * @param callThis
1784
- */
1785
-
1786
-
1787
- alter(event, value, args = [], callThis = null) {
1788
- if (this.listeners.has(event)) {
1789
- for (const cb of this.listeners.get(event)) {
1790
- value = cb.call(callThis, value, ...args);
1791
- }
1792
- }
1793
-
1794
- return value;
1795
- }
1796
- /**
1797
- * Trigger an event and call async listener.
1798
- * @param event
1799
- * @param args
1800
- * @param callThis
1801
- */
1802
-
1803
-
1804
- async asyncEmit(event, args = [], callThis = null) {
1805
- if (this.listeners.has(event)) {
1806
- for (const cb of this.listeners.get(event)) {
1807
- await cb.call(callThis, ...args);
1808
- }
1809
- }
1810
- }
1811
- /**
1812
- * Trigger an event, async listener alter given value and return it.
1813
- * @param event
1814
- * @param value
1815
- * @param args
1816
- * @param callThis
1817
- */
1818
-
1819
-
1820
- async asyncAlter(event, value, args = [], callThis = null) {
1821
- if (this.listeners.has(event)) {
1822
- for (const cb of this.listeners.get(event)) {
1823
- value = await cb.call(callThis, value, ...args);
1824
- }
1825
- }
1826
-
1827
- return value;
1828
- }
1829
-
1830
- }
1831
-
1832
- const Type = Function; // @ts-ignore
1833
-
1834
- global.Type = Type;
1835
-
1836
- /**
1837
- * @ignore
1838
- */
1839
-
1840
- function isResponse(obj) {
1841
- return obj.data && obj.headers && obj.status && obj.statusText;
1842
- }
1843
- /**
1844
- * @ignore
1845
- */
1846
-
1847
-
1848
- var AnyToPromiseStatus;
1849
-
1850
- (function (AnyToPromiseStatus) {
1851
- AnyToPromiseStatus["PENDING"] = "PENDING";
1852
- AnyToPromiseStatus["CANCELED"] = "CANCELED";
1853
- AnyToPromiseStatus["RESOLVED"] = "RESOLVED";
1854
- AnyToPromiseStatus["REJECTED"] = "REJECTED";
1855
- })(AnyToPromiseStatus || (AnyToPromiseStatus = {}));
1856
-
1857
- var AnyToPromiseResponseTypes;
1858
-
1859
- (function (AnyToPromiseResponseTypes) {
1860
- AnyToPromiseResponseTypes["STREAM"] = "STREAM";
1861
- AnyToPromiseResponseTypes["BUFFER"] = "BUFFER";
1862
- AnyToPromiseResponseTypes["DATA"] = "DATA";
1863
- })(AnyToPromiseResponseTypes || (AnyToPromiseResponseTypes = {}));
1864
-
1865
- var _resolves = /*#__PURE__*/_classPrivateFieldLooseKey("resolves");
1866
-
1867
- var _rejects = /*#__PURE__*/_classPrivateFieldLooseKey("rejects");
1868
-
1869
- var _hasNextFunction = /*#__PURE__*/_classPrivateFieldLooseKey("hasNextFunction");
1870
-
1871
- var _promise = /*#__PURE__*/_classPrivateFieldLooseKey("promise");
1872
-
1873
- class AnyToPromise {
1874
- constructor({
1875
- hasNextFunction = false
1876
- } = {}) {
1877
- Object.defineProperty(this, _resolves, {
1878
- writable: true,
1879
- value: void 0
1880
- });
1881
- Object.defineProperty(this, _rejects, {
1882
- writable: true,
1883
- value: void 0
1884
- });
1885
- Object.defineProperty(this, _hasNextFunction, {
1886
- writable: true,
1887
- value: void 0
1888
- });
1889
- Object.defineProperty(this, _promise, {
1890
- writable: true,
1891
- value: void 0
1892
- });
1893
- this.status = AnyToPromiseStatus.PENDING;
1894
- _classPrivateFieldLooseBase(this, _hasNextFunction)[_hasNextFunction] = false;
1895
- _classPrivateFieldLooseBase(this, _hasNextFunction)[_hasNextFunction] = hasNextFunction;
1896
- _classPrivateFieldLooseBase(this, _promise)[_promise] = new Promise((resolve, reject) => {
1897
- _classPrivateFieldLooseBase(this, _resolves)[_resolves] = resolve;
1898
- _classPrivateFieldLooseBase(this, _rejects)[_rejects] = reject;
1899
- });
1900
- }
1901
-
1902
- isDone() {
1903
- return this.status !== AnyToPromiseStatus.PENDING;
1904
- }
1905
-
1906
- get next() {
1907
- _classPrivateFieldLooseBase(this, _hasNextFunction)[_hasNextFunction] = true;
1908
- return error => {
1909
- if (this.isDone()) {
1910
- return;
1911
- }
1912
-
1913
- return error ? this.reject(error) : this.resolve({
1914
- type: AnyToPromiseResponseTypes.DATA
1915
- });
1916
- };
1917
- }
1918
- /**
1919
- *
1920
- */
1921
-
1922
-
1923
- async call(cb) {
1924
- if (this.isDone()) {
1925
- return this;
1926
- }
1927
-
1928
- try {
1929
- this.handle(cb());
1930
- } catch (er) {
1931
- this.reject(er);
1932
- }
1933
-
1934
- return _classPrivateFieldLooseBase(this, _promise)[_promise];
1935
- }
1936
-
1937
- reject(er) {
1938
- if (this.isDone()) {
1939
- return;
1940
- }
1941
-
1942
- this.done(AnyToPromiseStatus.REJECTED);
1943
-
1944
- _classPrivateFieldLooseBase(this, _rejects)[_rejects](er);
1945
- }
1946
-
1947
- resolve(response = {}) {
1948
- if (this.isDone()) {
1949
- return;
1950
- }
1951
-
1952
- this.done(AnyToPromiseStatus.RESOLVED);
1953
-
1954
- _classPrivateFieldLooseBase(this, _resolves)[_resolves](_extends({}, response, {
1955
- state: AnyToPromiseStatus.RESOLVED
1956
- }));
1957
- }
1958
-
1959
- destroy() {}
1960
-
1961
- cancel() {
1962
- if (this.isDone()) {
1963
- return;
1964
- }
1965
-
1966
- this.done(AnyToPromiseStatus.CANCELED);
1967
- return _classPrivateFieldLooseBase(this, _resolves)[_resolves]({
1968
- state: AnyToPromiseStatus.CANCELED
1969
- });
1970
- }
1971
-
1972
- done(status) {
1973
- this.destroy();
1974
- this.status = status;
1975
- }
1976
-
1977
- handle(process, additionalProps = {}) {
1978
- if (this.isDone()) {
1979
- return;
1980
- }
1981
-
1982
- if (process) {
1983
- if (this.isCanceledResponse(process)) {
1984
- // ABANDON
1985
- return this.cancel();
1986
- }
1987
-
1988
- if (isObservable(process)) {
1989
- process = process.toPromise();
1990
- }
1991
-
1992
- if (isResponse(process)) {
1993
- return this.handle(process.data, _extends({}, additionalProps, {
1994
- status: process.status,
1995
- headers: process.headers
1996
- }));
1997
- }
1998
-
1999
- if (isStream(process)) {
2000
- return this.resolve(_extends({}, additionalProps, {
2001
- type: AnyToPromiseResponseTypes.STREAM,
2002
- data: process
2003
- }));
2004
- }
2005
-
2006
- if (isStream(process) || Buffer.isBuffer(process)) {
2007
- return this.resolve(_extends({}, additionalProps, {
2008
- type: AnyToPromiseResponseTypes.BUFFER,
2009
- data: process
2010
- }));
2011
- }
2012
-
2013
- if (isPromise(process)) {
2014
- return process.then(result => this.handle(result, additionalProps)).catch(error => {
2015
- if (error.response && isResponse(error.response)) {
2016
- return this.handle(error.response);
2017
- }
2018
-
2019
- return this.reject(error);
2020
- });
2021
- }
2022
- }
2023
-
2024
- if (!_classPrivateFieldLooseBase(this, _hasNextFunction)[_hasNextFunction]) {
2025
- // no next function and empty response
2026
- return this.resolve(_extends({}, additionalProps, {
2027
- data: process,
2028
- type: AnyToPromiseResponseTypes.DATA
2029
- }));
2030
- }
2031
- }
2032
-
2033
- isCanceledResponse(process) {
2034
- return process === AnyToPromiseStatus.CANCELED;
2035
- }
2036
-
2037
- }
2038
-
2039
- class UnsupportedDecoratorType extends Error {
2040
- constructor(decorator, args) {
2041
- super(UnsupportedDecoratorType.buildMessage(decorator, args));
2042
- }
2043
-
2044
- static buildMessage(decorator, args) {
2045
- const [target, propertyKey, index] = args;
2046
- const bindingType = decoratorTypeOf(args);
2047
- const shortBinding = bindingType.split("/")[0];
2048
- const param = shortBinding === "parameter" ? ".[" + index + "]" : "";
2049
- const cstr = shortBinding === "parameter" ? ".constructor" : "";
2050
- const method = propertyKey ? "." + propertyKey : cstr;
2051
- const path = nameOf(classOf(target)) + method + param;
2052
- return `${decorator.name} cannot be used as ${bindingType} decorator on ${path}`;
2053
- }
2054
-
2055
- }
2056
-
2057
- /**
2058
- * The `@Deprecated()` decorators wraps the given method in such a way that it is marked as deprecated.
2059
- *
2060
- * ```typescript
2061
- * provide Foo {
2062
- *
2063
- * @Deprecated("Foo.method: Use Foo.method2 instead")
2064
- * public method() {
2065
- *
2066
- * }
2067
- * ```
2068
- *
2069
- * When called, @Deprecated() will return a function that will emit a `DeprecationWarning` using the `process.on('warning')` event.
2070
- * By default, this warning will be emitted and printed to `stderr` exactly once, the first time it is called. After the warning is emitted, the wrapped method is called.
2071
- *
2072
- * If either the `--no-deprecation` or `--no-warnings` command line flags are used, or if the `process.noDeprecation`
2073
- * property is set to `true` prior to the first deprecation warning, the `@Deprecated()` decorators does nothing.
2074
- *
2075
- * If the `--trace-deprecation` or `--trace-warnings` command line flags are set, or the `process.traceDeprecation`
2076
- * property is set to `true`, a warning and a stack trace are printed to stderr the first time the deprecated function is called.
2077
- *
2078
- * If the `--throw-deprecation` command line flag is set, or the `process.throwDeprecation` property is set to `true`,
2079
- * then an exception will be thrown when the deprecated function is called.
2080
- *
2081
- * The `--throw-deprecation` command line flag and `process.throwDeprecation` property take precedence over `--trace-deprecation`
2082
- * and `process.traceDeprecation`.
2083
- *
2084
- * @param message
2085
- * @returns {Function}
2086
- * @decorator
2087
- */
2088
- function Deprecated(message) {
2089
- return (target, targetKey, descriptor) => {
2090
- const originalMethod = descriptor.value;
2091
- descriptor.value = require("util").deprecate(originalMethod, message);
2092
- return descriptor;
2093
- };
2094
- }
2095
-
2096
- /**
2097
- * @module common/core
2098
- */
2099
- /** */
2100
-
2101
- function Configurable(value = true) {
2102
- return (target, propertyKey) => {
2103
- const descriptor = descriptorOf(target, propertyKey) || {
2104
- writable: true,
2105
- enumerable: true
2106
- };
2107
- descriptor.configurable = value;
2108
- Object.defineProperty(target && target.prototype || target, propertyKey, descriptor);
2109
- return descriptor;
2110
- };
2111
- }
2112
-
2113
- /**
2114
- * @module common/core
2115
- */
2116
- /** */
2117
-
2118
- function Enumerable(value = true) {
2119
- return (target, propertyKey) => {
2120
- const descriptor = descriptorOf(target, propertyKey) || {
2121
- writable: true,
2122
- configurable: true
2123
- };
2124
- descriptor.enumerable = value;
2125
- Object.defineProperty(target && target.prototype || target, propertyKey, descriptor);
2126
- return descriptor;
2127
- };
2128
- }
2129
-
2130
- /**
2131
- * @module common/core
2132
- */
2133
- /** */
2134
-
2135
- function Writable(value = true) {
2136
- return (target, propertyKey) => {
2137
- const descriptor = descriptorOf(target, propertyKey) || {
2138
- configurable: true,
2139
- enumerable: true
2140
- };
2141
- descriptor.writable = value;
2142
- Object.defineProperty(target && target.prototype || target, propertyKey, descriptor);
2143
- return descriptor;
2144
- };
2145
- }
2146
-
2147
- /**
2148
- * @module common/core
2149
- */
2150
- /** */
2151
-
2152
- function Readonly() {
2153
- return Writable(false);
2154
- }
2155
-
2156
- /**
2157
- * @module common/core
2158
- */
2159
- /** */
2160
-
2161
- function NotConfigurable() {
2162
- return Configurable(false);
2163
- }
2164
-
2165
- /**
2166
- * @module common/core
2167
- */
2168
- /** */
2169
-
2170
- function NotEnumerable() {
2171
- return Enumerable(false);
2172
- }
2173
-
2174
- /**
2175
- * Create a store correctly configured from the parameters given by the decorator.
2176
- * The `fn` can return a decorator that will be initialized with the parameters (target, propertyKey, descriptor).
2177
- * @param {(store: Store, parameters: DecoratorParameters) => void} fn
2178
- * @returns {Function}
2179
- */
2180
-
2181
- function StoreFn(fn) {
2182
- return (...parameters) => {
2183
- const store = Store.from(...parameters);
2184
- const result = fn(store, parameters);
2185
-
2186
- if (typeof result === "function") {
2187
- result(...parameters);
2188
- }
2189
-
2190
- return parameters[2];
2191
- };
2192
- }
2193
-
2194
- function StoreSet(key, value) {
2195
- return StoreFn(store => {
2196
- store.set(key, value);
2197
- });
2198
- }
2199
-
2200
- function StoreMerge(key, value) {
2201
- return StoreFn(store => {
2202
- store.merge(key, value);
2203
- });
2204
- }
2205
-
2206
- export { AnyToPromise, AnyToPromiseResponseTypes, AnyToPromiseStatus, CLASS_STORE, Configurable, DecoratorTypes, Deprecated, Enumerable, Env, EnvTypes, Hooks, METHOD_STORE, Metadata, NotConfigurable, NotEnumerable, PARAM_STORE, PROPERTY_STORE, Readonly, Store, StoreFn, StoreMerge, StoreSet, Type, UnsupportedDecoratorType, Writable, ancestorOf, ancestorsOf, catchAsyncError, catchError, classOf, cleanObject, constructorOf, decorateMethodsOf, decoratorArgs, decoratorTypeOf, deepClone, deepExtends, deepMerge, descriptorOf, getClass, getClassOrSymbol, getConstructor, getConstructorArgNames, getEnumerableKeys, getInheritedClass, getValue, importPackage, inheritedDescriptorOf, isArray, isArrayOrArrayClass, isArrowFn, isBoolean, isBooleanOrBooleanClass, isClass, isClassObject, isCollection, isDate, isEmpty, isEnumerable, isFunction, isInheritedFrom, isMethodDescriptor, isNil, isNumber, isNumberOrNumberClass, isObject, isObservable, isPlainObject, isPrimitive, isPrimitiveClass, isPrimitiveOrPrimitiveClass, isPromise, isProtectedKey, isSerializable, isStream, isString, isStringOrStringClass, isSymbol, isSymbolOrSymbolClass, mergeReducerBuilder, methodsOf, nameOf, nameOfClass, nameOfSymbol, objectKeys, primitiveOf, prototypeOf, proxyDelegation, setValue, toMap, toStringConstructor, uniq, uniqBy, useDecorators, useMethodDecorator, useMethodDecorators };
2207
- //# sourceMappingURL=index.modern.js.map