@celljs/core 3.8.0 → 4.0.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 (393) hide show
  1. package/cell.remote.yml +8 -0
  2. package/cell.yml +0 -3
  3. package/esm/browser/application/frontend-application-state.d.ts +4 -0
  4. package/esm/browser/application/frontend-application-state.js +14 -0
  5. package/esm/browser/application/frontend-application-state.js.map +1 -0
  6. package/esm/browser/application/frontend-application.d.ts +30 -0
  7. package/esm/browser/application/frontend-application.js +142 -0
  8. package/esm/browser/application/frontend-application.js.map +1 -0
  9. package/esm/browser/application/index.d.ts +2 -0
  10. package/esm/browser/application/index.js +3 -0
  11. package/esm/browser/application/index.js.map +1 -0
  12. package/esm/browser/browser.d.ts +22 -0
  13. package/esm/browser/browser.js +48 -0
  14. package/esm/browser/browser.js.map +1 -0
  15. package/esm/browser/index.d.ts +3 -0
  16. package/esm/browser/index.js +4 -0
  17. package/esm/browser/index.js.map +1 -0
  18. package/esm/browser/shell/application-shell.d.ts +4 -0
  19. package/esm/browser/shell/application-shell.js +18 -0
  20. package/esm/browser/shell/application-shell.js.map +1 -0
  21. package/esm/browser/shell/index.d.ts +2 -0
  22. package/esm/browser/shell/index.js +3 -0
  23. package/esm/browser/shell/index.js.map +1 -0
  24. package/esm/browser/shell/shell-protocol.d.ts +4 -0
  25. package/esm/browser/shell/shell-protocol.js +2 -0
  26. package/esm/browser/shell/shell-protocol.js.map +1 -0
  27. package/esm/browser/static-module.d.ts +3 -0
  28. package/esm/browser/static-module.js +4 -0
  29. package/esm/browser/static-module.js.map +1 -0
  30. package/esm/common/annotation/aspect.d.ts +7 -0
  31. package/esm/common/annotation/aspect.js +10 -0
  32. package/esm/common/annotation/aspect.js.map +1 -0
  33. package/esm/common/annotation/autowired-provider.d.ts +7 -0
  34. package/esm/common/annotation/autowired-provider.js +25 -0
  35. package/esm/common/annotation/autowired-provider.js.map +1 -0
  36. package/esm/common/annotation/autowired.d.ts +22 -0
  37. package/esm/common/annotation/autowired.js +48 -0
  38. package/esm/common/annotation/autowired.js.map +1 -0
  39. package/esm/common/annotation/component.d.ts +57 -0
  40. package/esm/common/annotation/component.js +71 -0
  41. package/esm/common/annotation/component.js.map +1 -0
  42. package/esm/common/annotation/constant.d.ts +8 -0
  43. package/esm/common/annotation/constant.js +12 -0
  44. package/esm/common/annotation/constant.js.map +1 -0
  45. package/esm/common/annotation/decorate.d.ts +1 -0
  46. package/esm/common/annotation/decorate.js +2 -0
  47. package/esm/common/annotation/decorate.js.map +1 -0
  48. package/esm/common/annotation/detached/autowired-provider.d.ts +2 -0
  49. package/esm/common/annotation/detached/autowired-provider.js +12 -0
  50. package/esm/common/annotation/detached/autowired-provider.js.map +1 -0
  51. package/esm/common/annotation/detached/autowired.d.ts +2 -0
  52. package/esm/common/annotation/detached/autowired.js +9 -0
  53. package/esm/common/annotation/detached/autowired.js.map +1 -0
  54. package/esm/common/annotation/detached/index.d.ts +3 -0
  55. package/esm/common/annotation/detached/index.js +4 -0
  56. package/esm/common/annotation/detached/index.js.map +1 -0
  57. package/esm/common/annotation/detached/value.d.ts +2 -0
  58. package/esm/common/annotation/detached/value.js +9 -0
  59. package/esm/common/annotation/detached/value.js.map +1 -0
  60. package/esm/common/annotation/index.d.ts +17 -0
  61. package/esm/common/annotation/index.js +18 -0
  62. package/esm/common/annotation/index.js.map +1 -0
  63. package/esm/common/annotation/inject.d.ts +1 -0
  64. package/esm/common/annotation/inject.js +2 -0
  65. package/esm/common/annotation/inject.js.map +1 -0
  66. package/esm/common/annotation/injectable.d.ts +1 -0
  67. package/esm/common/annotation/injectable.js +2 -0
  68. package/esm/common/annotation/injectable.js.map +1 -0
  69. package/esm/common/annotation/named.d.ts +1 -0
  70. package/esm/common/annotation/named.js +2 -0
  71. package/esm/common/annotation/named.js.map +1 -0
  72. package/esm/common/annotation/optional.d.ts +1 -0
  73. package/esm/common/annotation/optional.js +2 -0
  74. package/esm/common/annotation/optional.js.map +1 -0
  75. package/esm/common/annotation/post-construct.d.ts +1 -0
  76. package/esm/common/annotation/post-construct.js +2 -0
  77. package/esm/common/annotation/post-construct.js.map +1 -0
  78. package/esm/common/annotation/pre-destroy.d.ts +1 -0
  79. package/esm/common/annotation/pre-destroy.js +2 -0
  80. package/esm/common/annotation/pre-destroy.js.map +1 -0
  81. package/esm/common/annotation/service.d.ts +4 -0
  82. package/esm/common/annotation/service.js +14 -0
  83. package/esm/common/annotation/service.js.map +1 -0
  84. package/esm/common/annotation/tagged.d.ts +1 -0
  85. package/esm/common/annotation/tagged.js +2 -0
  86. package/esm/common/annotation/tagged.js.map +1 -0
  87. package/esm/common/annotation/target-name.d.ts +1 -0
  88. package/esm/common/annotation/target-name.js +2 -0
  89. package/esm/common/annotation/target-name.js.map +1 -0
  90. package/esm/common/annotation/unmanaged.d.ts +1 -0
  91. package/esm/common/annotation/unmanaged.js +2 -0
  92. package/esm/common/annotation/unmanaged.js.map +1 -0
  93. package/esm/common/annotation/value.d.ts +15 -0
  94. package/esm/common/annotation/value.js +50 -0
  95. package/esm/common/annotation/value.js.map +1 -0
  96. package/esm/common/aop/aop-protocol.d.ts +38 -0
  97. package/esm/common/aop/aop-protocol.js +8 -0
  98. package/esm/common/aop/aop-protocol.js.map +1 -0
  99. package/esm/common/aop/aop-proxy-factory.d.ts +6 -0
  100. package/esm/common/aop/aop-proxy-factory.js +67 -0
  101. package/esm/common/aop/aop-proxy-factory.js.map +1 -0
  102. package/esm/common/aop/class-filter.d.ts +6 -0
  103. package/esm/common/aop/class-filter.js +28 -0
  104. package/esm/common/aop/class-filter.js.map +1 -0
  105. package/esm/common/aop/index.d.ts +3 -0
  106. package/esm/common/aop/index.js +4 -0
  107. package/esm/common/aop/index.js.map +1 -0
  108. package/esm/common/application/application-entry.d.ts +1 -0
  109. package/esm/common/application/application-entry.js +41 -0
  110. package/esm/common/application/application-entry.js.map +1 -0
  111. package/esm/common/application/application-error.d.ts +20 -0
  112. package/esm/common/application/application-error.js +44 -0
  113. package/esm/common/application/application-error.js.map +1 -0
  114. package/esm/common/application/application-factory.d.ts +8 -0
  115. package/esm/common/application/application-factory.js +19 -0
  116. package/esm/common/application/application-factory.js.map +1 -0
  117. package/esm/common/application/application-host.d.ts +38 -0
  118. package/esm/common/application/application-host.js +17 -0
  119. package/esm/common/application/application-host.js.map +1 -0
  120. package/esm/common/application/application-protocol.d.ts +52 -0
  121. package/esm/common/application/application-protocol.js +103 -0
  122. package/esm/common/application/application-protocol.js.map +1 -0
  123. package/esm/common/application/application-state.d.ts +3 -0
  124. package/esm/common/application/application-state.js +15 -0
  125. package/esm/common/application/application-state.js.map +1 -0
  126. package/esm/common/application/application.d.ts +6 -0
  127. package/esm/common/application/application.js +31 -0
  128. package/esm/common/application/application.js.map +1 -0
  129. package/esm/common/application/index.d.ts +3 -0
  130. package/esm/common/application/index.js +4 -0
  131. package/esm/common/application/index.js.map +1 -0
  132. package/esm/common/config/config-protocol.d.ts +4 -0
  133. package/esm/common/config/config-protocol.js +2 -0
  134. package/esm/common/config/config-protocol.js.map +1 -0
  135. package/esm/common/config/config-provider.d.ts +6 -0
  136. package/esm/common/config/config-provider.js +26 -0
  137. package/esm/common/config/config-provider.js.map +1 -0
  138. package/esm/common/config/config-util.d.ts +4 -0
  139. package/esm/common/config/config-util.js +16 -0
  140. package/esm/common/config/config-util.js.map +1 -0
  141. package/esm/common/config/dynamic-config.d.ts +3 -0
  142. package/esm/common/config/dynamic-config.js +3 -0
  143. package/esm/common/config/dynamic-config.js.map +1 -0
  144. package/esm/common/config/env-config-util.d.ts +48 -0
  145. package/esm/common/config/env-config-util.js +185 -0
  146. package/esm/common/config/env-config-util.js.map +1 -0
  147. package/esm/common/config/index.d.ts +4 -0
  148. package/esm/common/config/index.js +5 -0
  149. package/esm/common/config/index.js.map +1 -0
  150. package/esm/common/constants.d.ts +5 -0
  151. package/esm/common/constants.js +6 -0
  152. package/esm/common/constants.js.map +1 -0
  153. package/esm/common/container/auto-bind.d.ts +3 -0
  154. package/esm/common/container/auto-bind.js +98 -0
  155. package/esm/common/container/auto-bind.js.map +1 -0
  156. package/esm/common/container/container-factory.d.ts +4 -0
  157. package/esm/common/container/container-factory.js +9 -0
  158. package/esm/common/container/container-factory.js.map +1 -0
  159. package/esm/common/container/container-provider.d.ts +6 -0
  160. package/esm/common/container/container-provider.js +23 -0
  161. package/esm/common/container/container-provider.js.map +1 -0
  162. package/esm/common/container/container-util.d.ts +9 -0
  163. package/esm/common/container/container-util.js +29 -0
  164. package/esm/common/container/container-util.js.map +1 -0
  165. package/esm/common/container/dynamic-container.d.ts +2 -0
  166. package/esm/common/container/dynamic-container.js +4 -0
  167. package/esm/common/container/dynamic-container.js.map +1 -0
  168. package/esm/common/container/index.d.ts +8 -0
  169. package/esm/common/container/index.js +6 -0
  170. package/esm/common/container/index.js.map +1 -0
  171. package/esm/common/container/scope.d.ts +5 -0
  172. package/esm/common/container/scope.js +7 -0
  173. package/esm/common/container/scope.js.map +1 -0
  174. package/esm/common/el/core-context-initializer.d.ts +6 -0
  175. package/esm/common/el/core-context-initializer.js +36 -0
  176. package/esm/common/el/core-context-initializer.js.map +1 -0
  177. package/esm/common/el/expression-compiler.d.ts +19 -0
  178. package/esm/common/el/expression-compiler.js +187 -0
  179. package/esm/common/el/expression-compiler.js.map +1 -0
  180. package/esm/common/el/expression-context-provider.d.ts +9 -0
  181. package/esm/common/el/expression-context-provider.js +43 -0
  182. package/esm/common/el/expression-context-provider.js.map +1 -0
  183. package/esm/common/el/expression-handler.d.ts +11 -0
  184. package/esm/common/el/expression-handler.js +95 -0
  185. package/esm/common/el/expression-handler.js.map +1 -0
  186. package/esm/common/el/expression-protocol.d.ts +32 -0
  187. package/esm/common/el/expression-protocol.js +6 -0
  188. package/esm/common/el/expression-protocol.js.map +1 -0
  189. package/esm/common/el/index.d.ts +6 -0
  190. package/esm/common/el/index.js +7 -0
  191. package/esm/common/el/index.js.map +1 -0
  192. package/esm/common/el/jexl-engine-provider.d.ts +5 -0
  193. package/esm/common/el/jexl-engine-provider.js +22 -0
  194. package/esm/common/el/jexl-engine-provider.js.map +1 -0
  195. package/esm/common/error/custom-error.d.ts +26 -0
  196. package/esm/common/error/custom-error.js +40 -0
  197. package/esm/common/error/custom-error.js.map +1 -0
  198. package/esm/common/error/error-protocol.d.ts +3 -0
  199. package/esm/common/error/error-protocol.js +2 -0
  200. package/esm/common/error/error-protocol.js.map +1 -0
  201. package/esm/common/error/illegal-argument-error.d.ts +3 -0
  202. package/esm/common/error/illegal-argument-error.js +4 -0
  203. package/esm/common/error/illegal-argument-error.js.map +1 -0
  204. package/esm/common/error/illegal-state-error.d.ts +3 -0
  205. package/esm/common/error/illegal-state-error.js +4 -0
  206. package/esm/common/error/illegal-state-error.js.map +1 -0
  207. package/esm/common/error/index.d.ts +5 -0
  208. package/esm/common/error/index.js +6 -0
  209. package/esm/common/error/index.js.map +1 -0
  210. package/esm/common/error/invalid-mime-type-error.d.ts +5 -0
  211. package/esm/common/error/invalid-mime-type-error.js +8 -0
  212. package/esm/common/error/invalid-mime-type-error.js.map +1 -0
  213. package/esm/common/index.d.ts +12 -0
  214. package/esm/common/index.js +13 -0
  215. package/esm/common/index.js.map +1 -0
  216. package/esm/common/logger/abstract-logger.d.ts +18 -0
  217. package/esm/common/logger/abstract-logger.js +69 -0
  218. package/esm/common/logger/abstract-logger.js.map +1 -0
  219. package/esm/common/logger/index.d.ts +4 -0
  220. package/esm/common/logger/index.js +5 -0
  221. package/esm/common/logger/index.js.map +1 -0
  222. package/esm/common/logger/logger-protocol.d.ts +30 -0
  223. package/esm/common/logger/logger-protocol.js +8 -0
  224. package/esm/common/logger/logger-protocol.js.map +1 -0
  225. package/esm/common/logger/logger-service.d.ts +4 -0
  226. package/esm/common/logger/logger-service.js +18 -0
  227. package/esm/common/logger/logger-service.js.map +1 -0
  228. package/esm/common/logger/logger.d.ts +7 -0
  229. package/esm/common/logger/logger.js +35 -0
  230. package/esm/common/logger/logger.js.map +1 -0
  231. package/esm/common/provider/component-filter-registry.d.ts +11 -0
  232. package/esm/common/provider/component-filter-registry.js +66 -0
  233. package/esm/common/provider/component-filter-registry.js.map +1 -0
  234. package/esm/common/provider/index.d.ts +5 -0
  235. package/esm/common/provider/index.js +6 -0
  236. package/esm/common/provider/index.js.map +1 -0
  237. package/esm/common/provider/provider-creator.d.ts +6 -0
  238. package/esm/common/provider/provider-creator.js +19 -0
  239. package/esm/common/provider/provider-creator.js.map +1 -0
  240. package/esm/common/provider/provider-protocol.d.ts +48 -0
  241. package/esm/common/provider/provider-protocol.js +5 -0
  242. package/esm/common/provider/provider-protocol.js.map +1 -0
  243. package/esm/common/provider/provider-util.d.ts +5 -0
  244. package/esm/common/provider/provider-util.js +10 -0
  245. package/esm/common/provider/provider-util.js.map +1 -0
  246. package/esm/common/provider/provider.d.ts +13 -0
  247. package/esm/common/provider/provider.js +54 -0
  248. package/esm/common/provider/provider.js.map +1 -0
  249. package/esm/common/static-module.d.ts +3 -0
  250. package/esm/common/static-module.js +9 -0
  251. package/esm/common/static-module.js.map +1 -0
  252. package/esm/common/test/index.d.ts +1 -0
  253. package/esm/common/test/index.js +2 -0
  254. package/esm/common/test/index.js.map +1 -0
  255. package/esm/common/test/mock-logger.d.ts +14 -0
  256. package/esm/common/test/mock-logger.js +41 -0
  257. package/esm/common/test/mock-logger.js.map +1 -0
  258. package/esm/common/test/test-module.d.ts +2 -0
  259. package/esm/common/test/test-module.js +12 -0
  260. package/esm/common/test/test-module.js.map +1 -0
  261. package/esm/common/utils/annotation-util.d.ts +4 -0
  262. package/esm/common/utils/annotation-util.js +24 -0
  263. package/esm/common/utils/annotation-util.js.map +1 -0
  264. package/esm/common/utils/assert.d.ts +173 -0
  265. package/esm/common/utils/assert.js +283 -0
  266. package/esm/common/utils/assert.js.map +1 -0
  267. package/esm/common/utils/async.d.ts +367 -0
  268. package/esm/common/utils/async.js +935 -0
  269. package/esm/common/utils/async.js.map +1 -0
  270. package/esm/common/utils/byte-util.d.ts +11 -0
  271. package/esm/common/utils/byte-util.js +75 -0
  272. package/esm/common/utils/byte-util.js.map +1 -0
  273. package/esm/common/utils/cancellation.d.ts +21 -0
  274. package/esm/common/utils/cancellation.js +89 -0
  275. package/esm/common/utils/cancellation.js.map +1 -0
  276. package/esm/common/utils/class-util.d.ts +2 -0
  277. package/esm/common/utils/class-util.js +19 -0
  278. package/esm/common/utils/class-util.js.map +1 -0
  279. package/esm/common/utils/disposable.d.ts +29 -0
  280. package/esm/common/utils/disposable.js +78 -0
  281. package/esm/common/utils/disposable.js.map +1 -0
  282. package/esm/common/utils/emitter.d.ts +63 -0
  283. package/esm/common/utils/emitter.js +221 -0
  284. package/esm/common/utils/emitter.js.map +1 -0
  285. package/esm/common/utils/error-util.d.ts +19 -0
  286. package/esm/common/utils/error-util.js +35 -0
  287. package/esm/common/utils/error-util.js.map +1 -0
  288. package/esm/common/utils/event.d.ts +40 -0
  289. package/esm/common/utils/event.js +90 -0
  290. package/esm/common/utils/event.js.map +1 -0
  291. package/esm/common/utils/global-util.d.ts +1 -0
  292. package/esm/common/utils/global-util.js +16 -0
  293. package/esm/common/utils/global-util.js.map +1 -0
  294. package/esm/common/utils/index.d.ts +21 -0
  295. package/esm/common/utils/index.js +22 -0
  296. package/esm/common/utils/index.js.map +1 -0
  297. package/esm/common/utils/metadata-util.d.ts +1 -0
  298. package/esm/common/utils/metadata-util.js +25 -0
  299. package/esm/common/utils/metadata-util.js.map +1 -0
  300. package/esm/common/utils/mime-type-util.d.ts +36 -0
  301. package/esm/common/utils/mime-type-util.js +168 -0
  302. package/esm/common/utils/mime-type-util.js.map +1 -0
  303. package/esm/common/utils/mime-type.d.ts +36 -0
  304. package/esm/common/utils/mime-type.js +284 -0
  305. package/esm/common/utils/mime-type.js.map +1 -0
  306. package/esm/common/utils/os.d.ts +19 -0
  307. package/esm/common/utils/os.js +46 -0
  308. package/esm/common/utils/os.js.map +1 -0
  309. package/esm/common/utils/prioritizeable.d.ts +17 -0
  310. package/esm/common/utils/prioritizeable.js +38 -0
  311. package/esm/common/utils/prioritizeable.js.map +1 -0
  312. package/esm/common/utils/promise-util.d.ts +5 -0
  313. package/esm/common/utils/promise-util.js +9 -0
  314. package/esm/common/utils/promise-util.js.map +1 -0
  315. package/esm/common/utils/proxy-util.d.ts +4 -0
  316. package/esm/common/utils/proxy-util.js +34 -0
  317. package/esm/common/utils/proxy-util.js.map +1 -0
  318. package/esm/common/utils/types.d.ts +16 -0
  319. package/esm/common/utils/types.js +2 -0
  320. package/esm/common/utils/types.js.map +1 -0
  321. package/esm/common/utils/url-util.d.ts +3 -0
  322. package/esm/common/utils/url-util.js +56 -0
  323. package/esm/common/utils/url-util.js.map +1 -0
  324. package/esm/common/utils/uuid.d.ts +2 -0
  325. package/esm/common/utils/uuid.js +61 -0
  326. package/esm/common/utils/uuid.js.map +1 -0
  327. package/esm/node/application/backend-application-state.d.ts +4 -0
  328. package/esm/node/application/backend-application-state.js +14 -0
  329. package/esm/node/application/backend-application-state.js.map +1 -0
  330. package/esm/node/application/backend-application.d.ts +10 -0
  331. package/esm/node/application/backend-application.js +52 -0
  332. package/esm/node/application/backend-application.js.map +1 -0
  333. package/esm/node/application/index.d.ts +2 -0
  334. package/esm/node/application/index.js +3 -0
  335. package/esm/node/application/index.js.map +1 -0
  336. package/esm/node/constants.d.ts +15 -0
  337. package/esm/node/constants.js +16 -0
  338. package/esm/node/constants.js.map +1 -0
  339. package/esm/node/context/context.d.ts +15 -0
  340. package/esm/node/context/context.js +58 -0
  341. package/esm/node/context/context.js.map +1 -0
  342. package/esm/node/context/index.d.ts +1 -0
  343. package/esm/node/context/index.js +2 -0
  344. package/esm/node/context/index.js.map +1 -0
  345. package/esm/node/index.d.ts +3 -0
  346. package/esm/node/index.js +4 -0
  347. package/esm/node/index.js.map +1 -0
  348. package/esm/node/static-module.d.ts +3 -0
  349. package/esm/node/static-module.js +4 -0
  350. package/esm/node/static-module.js.map +1 -0
  351. package/esm/node/utils/crc.d.ts +1 -0
  352. package/esm/node/utils/crc.js +7 -0
  353. package/esm/node/utils/crc.js.map +1 -0
  354. package/esm/node/utils/index.d.ts +1 -0
  355. package/esm/node/utils/index.js +2 -0
  356. package/esm/node/utils/index.js.map +1 -0
  357. package/esm/package.json +3 -0
  358. package/lib/common/application/application-entry.d.ts.map +1 -1
  359. package/lib/common/application/application-entry.js +21 -3
  360. package/lib/common/application/application-entry.js.map +1 -1
  361. package/lib/common/application/application-factory.d.ts +1 -0
  362. package/lib/common/application/application-factory.d.ts.map +1 -1
  363. package/lib/common/application/application-factory.js +1 -1
  364. package/lib/common/application/application-factory.js.map +1 -1
  365. package/lib/common/application/application-host.d.ts +39 -0
  366. package/lib/common/application/application-host.d.ts.map +1 -0
  367. package/lib/common/application/application-host.js +20 -0
  368. package/lib/common/application/application-host.js.map +1 -0
  369. package/lib/common/application/index.d.ts +1 -0
  370. package/lib/common/application/index.d.ts.map +1 -1
  371. package/lib/common/application/index.js +1 -0
  372. package/lib/common/application/index.js.map +1 -1
  373. package/lib/common/config/env-config-util.d.ts +49 -0
  374. package/lib/common/config/env-config-util.d.ts.map +1 -0
  375. package/lib/common/config/env-config-util.js +188 -0
  376. package/lib/common/config/env-config-util.js.map +1 -0
  377. package/lib/common/config/env-config-util.spec.d.ts +2 -0
  378. package/lib/common/config/env-config-util.spec.d.ts.map +1 -0
  379. package/lib/common/config/env-config-util.spec.js +314 -0
  380. package/lib/common/config/env-config-util.spec.js.map +1 -0
  381. package/lib/common/config/index.d.ts +1 -0
  382. package/lib/common/config/index.d.ts.map +1 -1
  383. package/lib/common/config/index.js +1 -0
  384. package/lib/common/config/index.js.map +1 -1
  385. package/package.json +114 -5
  386. package/src/common/application/application-entry.ts +20 -4
  387. package/src/common/application/application-factory.ts +1 -1
  388. package/src/common/application/application-host.ts +46 -0
  389. package/src/common/application/index.ts +1 -0
  390. package/src/common/config/env-config-util.spec.ts +341 -0
  391. package/src/common/config/env-config-util.ts +225 -0
  392. package/src/common/config/index.ts +1 -0
  393. package/cell-remote.yml +0 -3
@@ -0,0 +1,41 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { Injectable } from '../annotation/index.js';
8
+ import { Emitter } from '../utils/index.js';
9
+ let MockLogger = class MockLogger {
10
+ constructor() {
11
+ this.level = 'info';
12
+ this.onLogEmitter = new Emitter();
13
+ this.onLog = this.onLogEmitter.event;
14
+ }
15
+ time(label) {
16
+ // do nothing
17
+ }
18
+ timeEnd(label, context) {
19
+ return undefined;
20
+ }
21
+ setContext(context) {
22
+ // do nothing
23
+ }
24
+ info(message, context) {
25
+ // do nothing
26
+ }
27
+ error(message, context) {
28
+ // do nothing
29
+ }
30
+ warn(message, context) {
31
+ // do nothing
32
+ }
33
+ debug(message, context) {
34
+ // do nothing
35
+ }
36
+ };
37
+ MockLogger = __decorate([
38
+ Injectable()
39
+ ], MockLogger);
40
+ export { MockLogger };
41
+ //# sourceMappingURL=mock-logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-logger.js","sourceRoot":"","sources":["../../../src/common/test/mock-logger.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAG5B,IAAM,UAAU,GAAhB,MAAM,UAAU;IAAhB;QACH,UAAK,GAAa,MAAM,CAAC;QACN,iBAAY,GAAG,IAAI,OAAO,EAAc,CAAC;QAC5D,UAAK,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;IAsBpC,CAAC;IArBG,IAAI,CAAC,KAAa;QACd,aAAa;IACjB,CAAC;IACD,OAAO,CAAC,KAAa,EAAE,OAAgB;QACnC,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,UAAU,CAAC,OAAgB;QACvB,aAAa;IACjB,CAAC;IACD,IAAI,CAAC,OAAY,EAAE,OAAgB;QAC/B,aAAa;IACjB,CAAC;IACD,KAAK,CAAC,OAAY,EAAE,OAAgB;QAChC,aAAa;IACjB,CAAC;IACD,IAAI,CAAC,OAAY,EAAE,OAAgB;QAC/B,aAAa;IACjB,CAAC;IACD,KAAK,CAAC,OAAY,EAAE,OAAgB;QAChC,aAAa;IACjB,CAAC;CACJ,CAAA;AAzBY,UAAU;IADtB,UAAU,EAAE;GACA,UAAU,CAyBtB"}
@@ -0,0 +1,2 @@
1
+ import '../index.js';
2
+ export declare const coreTestModule: import("inversify").interfaces.ContainerModule;
@@ -0,0 +1,12 @@
1
+ import { bindAutowiredProvider } from '../annotation/autowired-provider.js';
2
+ import { bindValue } from '../annotation/value.js';
3
+ import { autoBind } from '../container/index.js';
4
+ import { Logger } from '../logger/index.js';
5
+ import { MockLogger } from './mock-logger.js';
6
+ import '../index.js';
7
+ export const coreTestModule = autoBind((bind, unbind, isBound, rebind) => {
8
+ bindValue(bind);
9
+ bindAutowiredProvider(bind);
10
+ rebind(Logger).to(MockLogger).inSingletonScope();
11
+ });
12
+ //# sourceMappingURL=test-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-module.js","sourceRoot":"","sources":["../../../src/common/test/test-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,UAAU,CAAC;AAElB,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IACrE,SAAS,CAAC,IAAI,CAAC,CAAC;IAChB,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACrD,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare namespace AnnotationUtil {
2
+ function getValueOrOption<T>(valueOrOption?: any, primaryProperty?: string): T;
3
+ function getType(target: any, targetKey: string | symbol, index?: number): any;
4
+ }
@@ -0,0 +1,24 @@
1
+ export var AnnotationUtil;
2
+ (function (AnnotationUtil) {
3
+ function getValueOrOption(valueOrOption, primaryProperty = 'id') {
4
+ let option = {};
5
+ if (typeof valueOrOption === 'object' && !Array.isArray(valueOrOption)) {
6
+ option = valueOrOption;
7
+ }
8
+ else if (valueOrOption) {
9
+ option = { [primaryProperty]: valueOrOption };
10
+ }
11
+ return option;
12
+ }
13
+ AnnotationUtil.getValueOrOption = getValueOrOption;
14
+ function getType(target, targetKey, index) {
15
+ if (index !== undefined) {
16
+ return Reflect.getMetadata('design:paramtypes', target, targetKey)[index];
17
+ }
18
+ else {
19
+ return Reflect.getMetadata('design:type', target, targetKey);
20
+ }
21
+ }
22
+ AnnotationUtil.getType = getType;
23
+ })(AnnotationUtil || (AnnotationUtil = {}));
24
+ //# sourceMappingURL=annotation-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotation-util.js","sourceRoot":"","sources":["../../../src/common/utils/annotation-util.ts"],"names":[],"mappings":"AAAA,MAAM,KAAW,cAAc,CAoB9B;AApBD,WAAiB,cAAc;IAE3B,SAAgB,gBAAgB,CAAI,aAAmB,EAAE,eAAe,GAAG,IAAI;QAC3E,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAI,OAAO,aAAa,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;YACrE,MAAM,GAAG,aAAa,CAAC;QAC3B,CAAC;aAAM,IAAI,aAAa,EAAE,CAAC;YACvB,MAAM,GAAG,EAAE,CAAC,eAAe,CAAC,EAAE,aAAa,EAAE,CAAC;QAClD,CAAC;QACD,OAAO,MAAW,CAAC;IACvB,CAAC;IARe,eAAA,gBAAgB,mBAQ/B,CAAA;IAED,SAAgB,OAAO,CAAC,MAAW,EAAE,SAA0B,EAAE,KAAc;QAC3E,IAAI,KAAK,KAAK,SAAS,EAAG,CAAC;YACvB,OAAO,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9E,CAAC;aAAM,CAAC;YACJ,OAAO,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QACjE,CAAC;IACL,CAAC;IANe,eAAA,OAAO,UAMtB,CAAA;AAEL,CAAC,EApBgB,cAAc,KAAd,cAAc,QAoB9B"}
@@ -0,0 +1,173 @@
1
+ export declare abstract class Assert {
2
+ /**
3
+ * Assert a boolean expression, throwing an `IllegalStateError`
4
+ * if the expression evaluates to `false`.
5
+ * @param expression a boolean expression
6
+ * @param message the exception message to use if the assertion fails
7
+ * @throws IllegalStateError if `expression` is `false`
8
+ * @example
9
+ * Assert.state(id === undefined, "The id property must not already be initialized");
10
+ * Assert.state(entity.getId() === undefined,
11
+ * () => "ID for entity " + entity.getName() + " must not already be initialized");
12
+ */
13
+ static state(expression: boolean, message: string | (() => string)): void;
14
+ /**
15
+ * Assert a boolean expression, throwing an `IllegalStateError`
16
+ * if the expression evaluates to `false`.
17
+ * @param expression a boolean expression
18
+ * @param message the exception message to use if the assertion fails
19
+ * @throws IllegalStateError if `expression` is `false`
20
+ * @example
21
+ * Assert.isTrue(i > 0, "The value must be greater than zero");
22
+ * Assert.isTrue(i > 0, () => "The value '" + i + "' must be greater than zero");
23
+ */
24
+ static isTrue(expression: boolean, message: string | (() => string)): void;
25
+ /**
26
+ * Assert that an object is `undefined`.
27
+ * @param object the object to check
28
+ * @param message the exception message to use if the assertion fails
29
+ * @throws IllegalStateError if the object is not `undefined`
30
+ * @example
31
+ * Assert.isNull(value, "The value must be null");
32
+ * Assert.isNull(value, () => "The value '" + value + "' must be null");
33
+ */
34
+ static isNull(object: any, message: string | (() => string)): void;
35
+ /**
36
+ * Assert that an object is not `undefined`.
37
+ * @param object the object to check
38
+ * @param message the exception message to use if the assertion fails
39
+ * @throws IllegalStateError if the object is `undefined`
40
+ * @example
41
+ * Assert.notNull(clazz, "The class must not be null");
42
+ * Assert.notNull(entity.getId(),
43
+ * () => "ID for entity " + entity.getName() + " must not be null");
44
+ */
45
+ static notNull(object: unknown, message: string | (() => string)): void;
46
+ /**
47
+ * Assert that the given String is not empty; that is,
48
+ * it must not be `undefined` and not the empty String.
49
+ * @param text the String to check
50
+ * @param message the exception message to use if the assertion fails
51
+ * @throws IllegalStateError if the text is empty
52
+ * @example
53
+ * Assert.hasLength(name, "Name must not be empty");
54
+ * Assert.hasLength(name, () => "Name for account '" + account.getId() + "' must not be empty");
55
+ */
56
+ static hasLength(text: string | undefined, message: string | (() => string)): void;
57
+ /**
58
+ * Assert that the given String contains valid text content; that is, it must not
59
+ * be `undefined` and must contain at least one non-whitespace character.
60
+ * @param text the String to check
61
+ * @param message the exception message to use if the assertion fails
62
+ * @throws IllegalStateError if the text does not contain valid text content
63
+ * @example
64
+ * Assert.hasText(account.getName(), "Name must not be empty");
65
+ * Assert.hasText(account.getName(),
66
+ * () => "Name for account '" + account.getId() + "' must not be empty");
67
+ */
68
+ static hasText(text: string | undefined, message: string | (() => string)): void;
69
+ /**
70
+ * Assert that the given text does not contain the given substring.
71
+ * @param textToSearch the text to search
72
+ * @param substring the substring to find within the text
73
+ * @param message the exception message to use if the assertion fails
74
+ * @throws IllegalStateError if the text contains the substring
75
+ * @example
76
+ * Assert.doesNotContain(name, forbidden, "Name must not contain '" + forbidden + "'");
77
+ * Assert.doesNotContain(name, forbidden,
78
+ * () => "Name must not contain '" + forbidden + "'");
79
+ */
80
+ static doesNotContain(textToSearch: string | undefined, substring: string, message: string | (() => string)): void;
81
+ /**
82
+ * Assert that an array contains elements; that is, it must not be
83
+ * `undefined` and must contain at least one element.
84
+ * @param array the array to check
85
+ * @param message the exception message to use if the assertion fails
86
+ * @throws IllegalStateError if the object array is `undefined` or contains no elements
87
+ * @example
88
+ * Assert.notEmpty(array, "The array must contain elements");
89
+ * Assert.notEmpty(array, () => "The " + arrayType + " array must contain elements");
90
+ */
91
+ static notEmpty(array: unknown[] | undefined, message: string | (() => string)): void;
92
+ /**
93
+ * Assert that an array contains no `undefined` elements.
94
+ * <p>Note: Does not complain if the array is empty!
95
+ * @param array the array to check
96
+ * @param message the exception message to use if the assertion fails
97
+ * @throws IllegalStateError if the object array contains a `undefined` element
98
+ * @example
99
+ * Assert.noNullElements(array, "The array must contain non-null elements");
100
+ * Assert.noNullElements(array, () => "The " + arrayType + " array must contain non-null elements");
101
+ */
102
+ static noNullElements(array: unknown[] | undefined, message: string | (() => string)): void;
103
+ /**
104
+ * Assert that a collection contains elements; that is, it must not be
105
+ * `undefined` and must contain at least one element.
106
+ * @param collection the collection to check
107
+ * @param message the exception message to use if the assertion fails
108
+ * @throws IllegalStateError if the collection is `undefined` or
109
+ * contains no elements
110
+ * @example
111
+ * Assert.notEmpty(collection, "Collection must contain elements");
112
+ * Assert.notEmpty(collection, () => "The " + collectionType + " collection must contain elements");
113
+ */
114
+ static notEmptyCollection(collection: unknown[] | undefined, message: string | (() => string)): void;
115
+ /**
116
+ * Assert that a collection contains no `undefined` elements.
117
+ * <p>Note: Does not complain if the collection is empty!
118
+ * @param collection the collection to check
119
+ * @param message the exception message to use if the assertion fails
120
+ * @throws IllegalStateError if the collection contains a `undefined`
121
+ * @example
122
+ * Assert.noNullElements(collection, "Collection must contain non-null elements");
123
+ * Assert.noNullElements(collection, () => "The " + collectionName + " must contain non-null elements");
124
+ */
125
+ static noNullElementsCollection(collection: unknown[] | undefined, message: string | (() => string)): void;
126
+ /**
127
+ * Assert that a Map contains entries; that is, it must not be `undefined`
128
+ * and must contain at least one entry.
129
+ * @param map the map to check
130
+ * @param message the exception message to use if the assertion fails
131
+ * @throws IllegalStateError if the map is `undefined` or contains no entries
132
+ * @example
133
+ * Assert.notEmpty(map, "The map must contain entries");
134
+ * Assert.notEmpty(map, () => "The " + mapType + " map must contain entries");
135
+ */
136
+ static notEmptyMap(map: Map<unknown, unknown> | undefined, message: string | (() => string)): void;
137
+ /**
138
+ * Assert that the provided object is an instance of the provided class.
139
+ * @param type the type to check against
140
+ * @param obj the object to check
141
+ * @param message a message which will be prepended to provide further context.
142
+ * If it is empty or ends in ":" or ";" or "," or ".", a full exception message
143
+ * will be appended. If it ends in a space, the name of the offending object's
144
+ * type will be appended. In any other case, a ":" with a space and the name
145
+ * of the offending object's type will be appended.
146
+ * @throws IllegalStateError if the object is not an instance of type
147
+ * @example
148
+ * Assert.instanceOf(Foo, foo, "Foo expected");
149
+ * Assert.instanceOf(Foo, foo, () => "Processing " + Foo.name + ":");
150
+ * Assert.instanceOf(Foo, foo);
151
+ */
152
+ static isInstanceOf(type: any, obj: unknown, message?: string | (() => string)): void;
153
+ /**
154
+ * Assert that `superType.isAssignableFrom(subType)` is `true`.
155
+ * @param superType the supertype to check against
156
+ * @param subType the subtype to check
157
+ * @param message a message which will be prepended to provide further context.
158
+ * If it is empty or ends in ":" or ";" or "," or ".", a full exception message
159
+ * will be appended. If it ends in a space, the name of the offending subtype
160
+ * will be appended. In any other case, a ":" with a space and the name of the
161
+ * offending subtype will be appended.
162
+ * @throws IllegalStateError if the classes are not assignable
163
+ * @example
164
+ * Assert.isAssignable(Number, myClass, "Number expected");
165
+ * Assert.isAssignable(Number, myClass, () => "Processing " + myAttributeName + ":");
166
+ */
167
+ static isAssignable(superType: unknown, subType: any | undefined, message?: string | (() => string)): void;
168
+ private static instanceCheckFailed;
169
+ private static assignableCheckFailed;
170
+ private static endsWithSeparator;
171
+ private static messageWithTypeName;
172
+ private static resolveMessage;
173
+ }
@@ -0,0 +1,283 @@
1
+ import { IllegalStateError } from '../error/illegal-state-error.js';
2
+ import { getSuperClasses } from './class-util.js';
3
+ /* eslint-disable @typescript-eslint/no-explicit-any */
4
+ /* eslint-disable no-null/no-null */
5
+ export class Assert {
6
+ /**
7
+ * Assert a boolean expression, throwing an `IllegalStateError`
8
+ * if the expression evaluates to `false`.
9
+ * @param expression a boolean expression
10
+ * @param message the exception message to use if the assertion fails
11
+ * @throws IllegalStateError if `expression` is `false`
12
+ * @example
13
+ * Assert.state(id === undefined, "The id property must not already be initialized");
14
+ * Assert.state(entity.getId() === undefined,
15
+ * () => "ID for entity " + entity.getName() + " must not already be initialized");
16
+ */
17
+ static state(expression, message) {
18
+ if (!expression) {
19
+ throw new IllegalStateError(this.resolveMessage(message));
20
+ }
21
+ }
22
+ /**
23
+ * Assert a boolean expression, throwing an `IllegalStateError`
24
+ * if the expression evaluates to `false`.
25
+ * @param expression a boolean expression
26
+ * @param message the exception message to use if the assertion fails
27
+ * @throws IllegalStateError if `expression` is `false`
28
+ * @example
29
+ * Assert.isTrue(i > 0, "The value must be greater than zero");
30
+ * Assert.isTrue(i > 0, () => "The value '" + i + "' must be greater than zero");
31
+ */
32
+ static isTrue(expression, message) {
33
+ if (!expression) {
34
+ throw new IllegalStateError(this.resolveMessage(message));
35
+ }
36
+ }
37
+ /**
38
+ * Assert that an object is `undefined`.
39
+ * @param object the object to check
40
+ * @param message the exception message to use if the assertion fails
41
+ * @throws IllegalStateError if the object is not `undefined`
42
+ * @example
43
+ * Assert.isNull(value, "The value must be null");
44
+ * Assert.isNull(value, () => "The value '" + value + "' must be null");
45
+ */
46
+ static isNull(object, message) {
47
+ if (object !== undefined || object !== null) {
48
+ throw new IllegalStateError(this.resolveMessage(message));
49
+ }
50
+ }
51
+ /**
52
+ * Assert that an object is not `undefined`.
53
+ * @param object the object to check
54
+ * @param message the exception message to use if the assertion fails
55
+ * @throws IllegalStateError if the object is `undefined`
56
+ * @example
57
+ * Assert.notNull(clazz, "The class must not be null");
58
+ * Assert.notNull(entity.getId(),
59
+ * () => "ID for entity " + entity.getName() + " must not be null");
60
+ */
61
+ static notNull(object, message) {
62
+ if (object === undefined || object === null) {
63
+ throw new IllegalStateError(this.resolveMessage(message));
64
+ }
65
+ }
66
+ /**
67
+ * Assert that the given String is not empty; that is,
68
+ * it must not be `undefined` and not the empty String.
69
+ * @param text the String to check
70
+ * @param message the exception message to use if the assertion fails
71
+ * @throws IllegalStateError if the text is empty
72
+ * @example
73
+ * Assert.hasLength(name, "Name must not be empty");
74
+ * Assert.hasLength(name, () => "Name for account '" + account.getId() + "' must not be empty");
75
+ */
76
+ static hasLength(text, message) {
77
+ if (!text || text.length === 0) {
78
+ throw new IllegalStateError(this.resolveMessage(message));
79
+ }
80
+ }
81
+ /**
82
+ * Assert that the given String contains valid text content; that is, it must not
83
+ * be `undefined` and must contain at least one non-whitespace character.
84
+ * @param text the String to check
85
+ * @param message the exception message to use if the assertion fails
86
+ * @throws IllegalStateError if the text does not contain valid text content
87
+ * @example
88
+ * Assert.hasText(account.getName(), "Name must not be empty");
89
+ * Assert.hasText(account.getName(),
90
+ * () => "Name for account '" + account.getId() + "' must not be empty");
91
+ */
92
+ static hasText(text, message) {
93
+ if (!text || text.trim().length === 0) {
94
+ throw new IllegalStateError(this.resolveMessage(message));
95
+ }
96
+ }
97
+ /**
98
+ * Assert that the given text does not contain the given substring.
99
+ * @param textToSearch the text to search
100
+ * @param substring the substring to find within the text
101
+ * @param message the exception message to use if the assertion fails
102
+ * @throws IllegalStateError if the text contains the substring
103
+ * @example
104
+ * Assert.doesNotContain(name, forbidden, "Name must not contain '" + forbidden + "'");
105
+ * Assert.doesNotContain(name, forbidden,
106
+ * () => "Name must not contain '" + forbidden + "'");
107
+ */
108
+ static doesNotContain(textToSearch, substring, message) {
109
+ if (textToSearch && substring && textToSearch.includes(substring)) {
110
+ throw new IllegalStateError(this.resolveMessage(message));
111
+ }
112
+ }
113
+ /**
114
+ * Assert that an array contains elements; that is, it must not be
115
+ * `undefined` and must contain at least one element.
116
+ * @param array the array to check
117
+ * @param message the exception message to use if the assertion fails
118
+ * @throws IllegalStateError if the object array is `undefined` or contains no elements
119
+ * @example
120
+ * Assert.notEmpty(array, "The array must contain elements");
121
+ * Assert.notEmpty(array, () => "The " + arrayType + " array must contain elements");
122
+ */
123
+ static notEmpty(array, message) {
124
+ if (!array || array.length === 0) {
125
+ throw new IllegalStateError(this.resolveMessage(message));
126
+ }
127
+ }
128
+ /**
129
+ * Assert that an array contains no `undefined` elements.
130
+ * <p>Note: Does not complain if the array is empty!
131
+ * @param array the array to check
132
+ * @param message the exception message to use if the assertion fails
133
+ * @throws IllegalStateError if the object array contains a `undefined` element
134
+ * @example
135
+ * Assert.noNullElements(array, "The array must contain non-null elements");
136
+ * Assert.noNullElements(array, () => "The " + arrayType + " array must contain non-null elements");
137
+ */
138
+ static noNullElements(array, message) {
139
+ if (array) {
140
+ for (const element of array) {
141
+ if (element === undefined || element === null) {
142
+ throw new IllegalStateError(this.resolveMessage(message));
143
+ }
144
+ }
145
+ }
146
+ }
147
+ /**
148
+ * Assert that a collection contains elements; that is, it must not be
149
+ * `undefined` and must contain at least one element.
150
+ * @param collection the collection to check
151
+ * @param message the exception message to use if the assertion fails
152
+ * @throws IllegalStateError if the collection is `undefined` or
153
+ * contains no elements
154
+ * @example
155
+ * Assert.notEmpty(collection, "Collection must contain elements");
156
+ * Assert.notEmpty(collection, () => "The " + collectionType + " collection must contain elements");
157
+ */
158
+ static notEmptyCollection(collection, message) {
159
+ if (!collection || collection.length === 0) {
160
+ throw new IllegalStateError(this.resolveMessage(message));
161
+ }
162
+ }
163
+ /**
164
+ * Assert that a collection contains no `undefined` elements.
165
+ * <p>Note: Does not complain if the collection is empty!
166
+ * @param collection the collection to check
167
+ * @param message the exception message to use if the assertion fails
168
+ * @throws IllegalStateError if the collection contains a `undefined`
169
+ * @example
170
+ * Assert.noNullElements(collection, "Collection must contain non-null elements");
171
+ * Assert.noNullElements(collection, () => "The " + collectionName + " must contain non-null elements");
172
+ */
173
+ static noNullElementsCollection(collection, message) {
174
+ if (collection) {
175
+ for (const element of collection) {
176
+ if (element === undefined || element === null) {
177
+ throw new IllegalStateError(this.resolveMessage(message));
178
+ }
179
+ }
180
+ }
181
+ }
182
+ /**
183
+ * Assert that a Map contains entries; that is, it must not be `undefined`
184
+ * and must contain at least one entry.
185
+ * @param map the map to check
186
+ * @param message the exception message to use if the assertion fails
187
+ * @throws IllegalStateError if the map is `undefined` or contains no entries
188
+ * @example
189
+ * Assert.notEmpty(map, "The map must contain entries");
190
+ * Assert.notEmpty(map, () => "The " + mapType + " map must contain entries");
191
+ */
192
+ static notEmptyMap(map, message) {
193
+ if (!map || map.size === 0) {
194
+ throw new IllegalStateError(this.resolveMessage(message));
195
+ }
196
+ }
197
+ /**
198
+ * Assert that the provided object is an instance of the provided class.
199
+ * @param type the type to check against
200
+ * @param obj the object to check
201
+ * @param message a message which will be prepended to provide further context.
202
+ * If it is empty or ends in ":" or ";" or "," or ".", a full exception message
203
+ * will be appended. If it ends in a space, the name of the offending object's
204
+ * type will be appended. In any other case, a ":" with a space and the name
205
+ * of the offending object's type will be appended.
206
+ * @throws IllegalStateError if the object is not an instance of type
207
+ * @example
208
+ * Assert.instanceOf(Foo, foo, "Foo expected");
209
+ * Assert.instanceOf(Foo, foo, () => "Processing " + Foo.name + ":");
210
+ * Assert.instanceOf(Foo, foo);
211
+ */
212
+ static isInstanceOf(type, obj, message) {
213
+ this.notNull(type, 'Type to check against must not be null');
214
+ if (!(obj instanceof type)) {
215
+ this.instanceCheckFailed(type, obj, this.resolveMessage(message));
216
+ }
217
+ }
218
+ /**
219
+ * Assert that `superType.isAssignableFrom(subType)` is `true`.
220
+ * @param superType the supertype to check against
221
+ * @param subType the subtype to check
222
+ * @param message a message which will be prepended to provide further context.
223
+ * If it is empty or ends in ":" or ";" or "," or ".", a full exception message
224
+ * will be appended. If it ends in a space, the name of the offending subtype
225
+ * will be appended. In any other case, a ":" with a space and the name of the
226
+ * offending subtype will be appended.
227
+ * @throws IllegalStateError if the classes are not assignable
228
+ * @example
229
+ * Assert.isAssignable(Number, myClass, "Number expected");
230
+ * Assert.isAssignable(Number, myClass, () => "Processing " + myAttributeName + ":");
231
+ */
232
+ static isAssignable(superType, subType, message) {
233
+ this.notNull(superType, 'Supertype to check against must not be null');
234
+ if (subType === undefined || !getSuperClasses(subType).includes(superType)) {
235
+ this.assignableCheckFailed(superType, subType, this.resolveMessage(message));
236
+ }
237
+ }
238
+ static instanceCheckFailed(type, obj, msg) {
239
+ const className = (obj !== undefined ? obj.constructor.name : 'undefined');
240
+ let result = '';
241
+ let defaultMessage = true;
242
+ if (msg && msg.length > 0) {
243
+ if (this.endsWithSeparator(msg)) {
244
+ result = msg + ' ';
245
+ }
246
+ else {
247
+ result = this.messageWithTypeName(msg, className);
248
+ defaultMessage = false;
249
+ }
250
+ }
251
+ if (defaultMessage) {
252
+ result = result + (`Object of class [${className}] must be an instance of ${type}`);
253
+ }
254
+ throw new IllegalStateError(result);
255
+ }
256
+ static assignableCheckFailed(superType, subType, msg) {
257
+ let result = '';
258
+ let defaultMessage = true;
259
+ if (msg && msg.length > 0) {
260
+ if (this.endsWithSeparator(msg)) {
261
+ result = msg + ' ';
262
+ }
263
+ else {
264
+ result = this.messageWithTypeName(msg, subType);
265
+ defaultMessage = false;
266
+ }
267
+ }
268
+ if (defaultMessage) {
269
+ result = result + (`${subType} is not assignable to ${superType}`);
270
+ }
271
+ throw new IllegalStateError(result);
272
+ }
273
+ static endsWithSeparator(msg) {
274
+ return (msg.endsWith(':') || msg.endsWith(';') || msg.endsWith(',') || msg.endsWith('.'));
275
+ }
276
+ static messageWithTypeName(msg, typeName) {
277
+ return msg + (msg.endsWith(' ') ? '' : ': ') + ('name' in typeName) ? typeName.name : typeName;
278
+ }
279
+ static resolveMessage(message) {
280
+ return typeof message === 'function' ? message() : message;
281
+ }
282
+ }
283
+ //# sourceMappingURL=assert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.js","sourceRoot":"","sources":["../../../src/common/utils/assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,uDAAuD;AACvD,oCAAoC;AAEpC,MAAM,OAAgB,MAAM;IACxB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAAK,CAAC,UAAmB,EAAE,OAAgC;QAC9D,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,MAAM,IAAI,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9D,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,MAAM,CAAC,UAAmB,EAAE,OAAgC;QAC/D,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,MAAM,IAAI,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9D,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAM,CAAC,MAAW,EAAE,OAAgC;QACvD,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YAC1C,MAAM,IAAI,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9D,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,OAAO,CAAC,MAAe,EAAE,OAAgC;QAC5D,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YAC1C,MAAM,IAAI,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,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