@celljs/core 3.7.8 → 3.9.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 (479) hide show
  1. package/esm/browser/application/frontend-application-state.d.ts +4 -0
  2. package/esm/browser/application/frontend-application-state.js +14 -0
  3. package/esm/browser/application/frontend-application-state.js.map +1 -0
  4. package/esm/browser/application/frontend-application.d.ts +30 -0
  5. package/esm/browser/application/frontend-application.js +142 -0
  6. package/esm/browser/application/frontend-application.js.map +1 -0
  7. package/esm/browser/application/index.d.ts +2 -0
  8. package/esm/browser/application/index.js +3 -0
  9. package/esm/browser/application/index.js.map +1 -0
  10. package/esm/browser/browser.d.ts +22 -0
  11. package/esm/browser/browser.js +48 -0
  12. package/esm/browser/browser.js.map +1 -0
  13. package/esm/browser/index.d.ts +3 -0
  14. package/esm/browser/index.js +4 -0
  15. package/esm/browser/index.js.map +1 -0
  16. package/esm/browser/shell/application-shell.d.ts +4 -0
  17. package/esm/browser/shell/application-shell.js +18 -0
  18. package/esm/browser/shell/application-shell.js.map +1 -0
  19. package/esm/browser/shell/index.d.ts +2 -0
  20. package/esm/browser/shell/index.js +3 -0
  21. package/esm/browser/shell/index.js.map +1 -0
  22. package/esm/browser/shell/shell-protocol.d.ts +4 -0
  23. package/esm/browser/shell/shell-protocol.js +2 -0
  24. package/esm/browser/shell/shell-protocol.js.map +1 -0
  25. package/esm/browser/static-module.d.ts +3 -0
  26. package/esm/browser/static-module.js +4 -0
  27. package/esm/browser/static-module.js.map +1 -0
  28. package/esm/common/annotation/aspect.d.ts +7 -0
  29. package/esm/common/annotation/aspect.js +10 -0
  30. package/esm/common/annotation/aspect.js.map +1 -0
  31. package/esm/common/annotation/autowired-provider.d.ts +7 -0
  32. package/esm/common/annotation/autowired-provider.js +25 -0
  33. package/esm/common/annotation/autowired-provider.js.map +1 -0
  34. package/esm/common/annotation/autowired.d.ts +22 -0
  35. package/esm/common/annotation/autowired.js +48 -0
  36. package/esm/common/annotation/autowired.js.map +1 -0
  37. package/esm/common/annotation/component.d.ts +57 -0
  38. package/esm/common/annotation/component.js +71 -0
  39. package/esm/common/annotation/component.js.map +1 -0
  40. package/esm/common/annotation/constant.d.ts +8 -0
  41. package/esm/common/annotation/constant.js +12 -0
  42. package/esm/common/annotation/constant.js.map +1 -0
  43. package/esm/common/annotation/decorate.d.ts +1 -0
  44. package/esm/common/annotation/decorate.js +2 -0
  45. package/esm/common/annotation/decorate.js.map +1 -0
  46. package/esm/common/annotation/detached/autowired-provider.d.ts +2 -0
  47. package/esm/common/annotation/detached/autowired-provider.js +12 -0
  48. package/esm/common/annotation/detached/autowired-provider.js.map +1 -0
  49. package/esm/common/annotation/detached/autowired.d.ts +2 -0
  50. package/esm/common/annotation/detached/autowired.js +9 -0
  51. package/esm/common/annotation/detached/autowired.js.map +1 -0
  52. package/esm/common/annotation/detached/index.d.ts +3 -0
  53. package/esm/common/annotation/detached/index.js +4 -0
  54. package/esm/common/annotation/detached/index.js.map +1 -0
  55. package/esm/common/annotation/detached/value.d.ts +2 -0
  56. package/esm/common/annotation/detached/value.js +9 -0
  57. package/esm/common/annotation/detached/value.js.map +1 -0
  58. package/esm/common/annotation/index.d.ts +17 -0
  59. package/esm/common/annotation/index.js +18 -0
  60. package/esm/common/annotation/index.js.map +1 -0
  61. package/esm/common/annotation/inject.d.ts +1 -0
  62. package/esm/common/annotation/inject.js +2 -0
  63. package/esm/common/annotation/inject.js.map +1 -0
  64. package/esm/common/annotation/injectable.d.ts +1 -0
  65. package/esm/common/annotation/injectable.js +2 -0
  66. package/esm/common/annotation/injectable.js.map +1 -0
  67. package/esm/common/annotation/named.d.ts +1 -0
  68. package/esm/common/annotation/named.js +2 -0
  69. package/esm/common/annotation/named.js.map +1 -0
  70. package/esm/common/annotation/optional.d.ts +1 -0
  71. package/esm/common/annotation/optional.js +2 -0
  72. package/esm/common/annotation/optional.js.map +1 -0
  73. package/esm/common/annotation/post-construct.d.ts +1 -0
  74. package/esm/common/annotation/post-construct.js +2 -0
  75. package/esm/common/annotation/post-construct.js.map +1 -0
  76. package/esm/common/annotation/pre-destroy.d.ts +1 -0
  77. package/esm/common/annotation/pre-destroy.js +2 -0
  78. package/esm/common/annotation/pre-destroy.js.map +1 -0
  79. package/esm/common/annotation/service.d.ts +4 -0
  80. package/esm/common/annotation/service.js +14 -0
  81. package/esm/common/annotation/service.js.map +1 -0
  82. package/esm/common/annotation/tagged.d.ts +1 -0
  83. package/esm/common/annotation/tagged.js +2 -0
  84. package/esm/common/annotation/tagged.js.map +1 -0
  85. package/esm/common/annotation/target-name.d.ts +1 -0
  86. package/esm/common/annotation/target-name.js +2 -0
  87. package/esm/common/annotation/target-name.js.map +1 -0
  88. package/esm/common/annotation/unmanaged.d.ts +1 -0
  89. package/esm/common/annotation/unmanaged.js +2 -0
  90. package/esm/common/annotation/unmanaged.js.map +1 -0
  91. package/esm/common/annotation/value.d.ts +15 -0
  92. package/esm/common/annotation/value.js +50 -0
  93. package/esm/common/annotation/value.js.map +1 -0
  94. package/esm/common/aop/aop-protocol.d.ts +38 -0
  95. package/esm/common/aop/aop-protocol.js +8 -0
  96. package/esm/common/aop/aop-protocol.js.map +1 -0
  97. package/esm/common/aop/aop-proxy-factory.d.ts +6 -0
  98. package/esm/common/aop/aop-proxy-factory.js +67 -0
  99. package/esm/common/aop/aop-proxy-factory.js.map +1 -0
  100. package/esm/common/aop/class-filter.d.ts +6 -0
  101. package/esm/common/aop/class-filter.js +28 -0
  102. package/esm/common/aop/class-filter.js.map +1 -0
  103. package/esm/common/aop/index.d.ts +3 -0
  104. package/esm/common/aop/index.js +4 -0
  105. package/esm/common/aop/index.js.map +1 -0
  106. package/esm/common/application/application-entry.d.ts +1 -0
  107. package/esm/common/application/application-entry.js +23 -0
  108. package/esm/common/application/application-entry.js.map +1 -0
  109. package/esm/common/application/application-error.d.ts +20 -0
  110. package/esm/common/application/application-error.js +44 -0
  111. package/esm/common/application/application-error.js.map +1 -0
  112. package/esm/common/application/application-factory.d.ts +8 -0
  113. package/esm/common/application/application-factory.js +19 -0
  114. package/esm/common/application/application-factory.js.map +1 -0
  115. package/esm/common/application/application-protocol.d.ts +52 -0
  116. package/esm/common/application/application-protocol.js +103 -0
  117. package/esm/common/application/application-protocol.js.map +1 -0
  118. package/esm/common/application/application-state.d.ts +3 -0
  119. package/esm/common/application/application-state.js +15 -0
  120. package/esm/common/application/application-state.js.map +1 -0
  121. package/esm/common/application/application.d.ts +6 -0
  122. package/esm/common/application/application.js +31 -0
  123. package/esm/common/application/application.js.map +1 -0
  124. package/esm/common/application/index.d.ts +2 -0
  125. package/esm/common/application/index.js +3 -0
  126. package/esm/common/application/index.js.map +1 -0
  127. package/esm/common/config/config-protocol.d.ts +4 -0
  128. package/esm/common/config/config-protocol.js +2 -0
  129. package/esm/common/config/config-protocol.js.map +1 -0
  130. package/esm/common/config/config-provider.d.ts +6 -0
  131. package/esm/common/config/config-provider.js +26 -0
  132. package/esm/common/config/config-provider.js.map +1 -0
  133. package/esm/common/config/config-util.d.ts +4 -0
  134. package/esm/common/config/config-util.js +16 -0
  135. package/esm/common/config/config-util.js.map +1 -0
  136. package/esm/common/config/dynamic-config.d.ts +3 -0
  137. package/esm/common/config/dynamic-config.js +3 -0
  138. package/esm/common/config/dynamic-config.js.map +1 -0
  139. package/esm/common/config/index.d.ts +3 -0
  140. package/esm/common/config/index.js +4 -0
  141. package/esm/common/config/index.js.map +1 -0
  142. package/esm/common/constants.d.ts +5 -0
  143. package/esm/common/constants.js +6 -0
  144. package/esm/common/constants.js.map +1 -0
  145. package/esm/common/container/auto-bind.d.ts +3 -0
  146. package/esm/common/container/auto-bind.js +98 -0
  147. package/esm/common/container/auto-bind.js.map +1 -0
  148. package/esm/common/container/container-factory.d.ts +4 -0
  149. package/esm/common/container/container-factory.js +9 -0
  150. package/esm/common/container/container-factory.js.map +1 -0
  151. package/esm/common/container/container-provider.d.ts +6 -0
  152. package/esm/common/container/container-provider.js +23 -0
  153. package/esm/common/container/container-provider.js.map +1 -0
  154. package/esm/common/container/container-util.d.ts +9 -0
  155. package/esm/common/container/container-util.js +29 -0
  156. package/esm/common/container/container-util.js.map +1 -0
  157. package/esm/common/container/dynamic-container.d.ts +2 -0
  158. package/esm/common/container/dynamic-container.js +4 -0
  159. package/esm/common/container/dynamic-container.js.map +1 -0
  160. package/esm/common/container/index.d.ts +8 -0
  161. package/esm/common/container/index.js +6 -0
  162. package/esm/common/container/index.js.map +1 -0
  163. package/esm/common/container/scope.d.ts +5 -0
  164. package/esm/common/container/scope.js +7 -0
  165. package/esm/common/container/scope.js.map +1 -0
  166. package/esm/common/el/core-context-initializer.d.ts +6 -0
  167. package/esm/common/el/core-context-initializer.js +36 -0
  168. package/esm/common/el/core-context-initializer.js.map +1 -0
  169. package/esm/common/el/expression-compiler.d.ts +19 -0
  170. package/esm/common/el/expression-compiler.js +187 -0
  171. package/esm/common/el/expression-compiler.js.map +1 -0
  172. package/esm/common/el/expression-context-provider.d.ts +9 -0
  173. package/esm/common/el/expression-context-provider.js +43 -0
  174. package/esm/common/el/expression-context-provider.js.map +1 -0
  175. package/esm/common/el/expression-handler.d.ts +11 -0
  176. package/esm/common/el/expression-handler.js +95 -0
  177. package/esm/common/el/expression-handler.js.map +1 -0
  178. package/esm/common/el/expression-protocol.d.ts +32 -0
  179. package/esm/common/el/expression-protocol.js +6 -0
  180. package/esm/common/el/expression-protocol.js.map +1 -0
  181. package/esm/common/el/index.d.ts +6 -0
  182. package/esm/common/el/index.js +7 -0
  183. package/esm/common/el/index.js.map +1 -0
  184. package/esm/common/el/jexl-engine-provider.d.ts +5 -0
  185. package/esm/common/el/jexl-engine-provider.js +22 -0
  186. package/esm/common/el/jexl-engine-provider.js.map +1 -0
  187. package/esm/common/error/custom-error.d.ts +26 -0
  188. package/esm/common/error/custom-error.js +40 -0
  189. package/esm/common/error/custom-error.js.map +1 -0
  190. package/esm/common/error/error-protocol.d.ts +3 -0
  191. package/esm/common/error/error-protocol.js +2 -0
  192. package/esm/common/error/error-protocol.js.map +1 -0
  193. package/esm/common/error/illegal-argument-error.d.ts +3 -0
  194. package/esm/common/error/illegal-argument-error.js +4 -0
  195. package/esm/common/error/illegal-argument-error.js.map +1 -0
  196. package/esm/common/error/illegal-state-error.d.ts +3 -0
  197. package/esm/common/error/illegal-state-error.js +4 -0
  198. package/esm/common/error/illegal-state-error.js.map +1 -0
  199. package/esm/common/error/index.d.ts +5 -0
  200. package/esm/common/error/index.js +6 -0
  201. package/esm/common/error/index.js.map +1 -0
  202. package/esm/common/error/invalid-mime-type-error.d.ts +5 -0
  203. package/esm/common/error/invalid-mime-type-error.js +8 -0
  204. package/esm/common/error/invalid-mime-type-error.js.map +1 -0
  205. package/esm/common/index.d.ts +12 -0
  206. package/esm/common/index.js +13 -0
  207. package/esm/common/index.js.map +1 -0
  208. package/esm/common/logger/abstract-logger.d.ts +18 -0
  209. package/esm/common/logger/abstract-logger.js +69 -0
  210. package/esm/common/logger/abstract-logger.js.map +1 -0
  211. package/esm/common/logger/index.d.ts +4 -0
  212. package/esm/common/logger/index.js +5 -0
  213. package/esm/common/logger/index.js.map +1 -0
  214. package/esm/common/logger/logger-protocol.d.ts +30 -0
  215. package/esm/common/logger/logger-protocol.js +8 -0
  216. package/esm/common/logger/logger-protocol.js.map +1 -0
  217. package/esm/common/logger/logger-service.d.ts +4 -0
  218. package/esm/common/logger/logger-service.js +18 -0
  219. package/esm/common/logger/logger-service.js.map +1 -0
  220. package/esm/common/logger/logger.d.ts +7 -0
  221. package/esm/common/logger/logger.js +35 -0
  222. package/esm/common/logger/logger.js.map +1 -0
  223. package/esm/common/provider/component-filter-registry.d.ts +11 -0
  224. package/esm/common/provider/component-filter-registry.js +66 -0
  225. package/esm/common/provider/component-filter-registry.js.map +1 -0
  226. package/esm/common/provider/index.d.ts +5 -0
  227. package/esm/common/provider/index.js +6 -0
  228. package/esm/common/provider/index.js.map +1 -0
  229. package/esm/common/provider/provider-creator.d.ts +6 -0
  230. package/esm/common/provider/provider-creator.js +19 -0
  231. package/esm/common/provider/provider-creator.js.map +1 -0
  232. package/esm/common/provider/provider-protocol.d.ts +48 -0
  233. package/esm/common/provider/provider-protocol.js +5 -0
  234. package/esm/common/provider/provider-protocol.js.map +1 -0
  235. package/esm/common/provider/provider-util.d.ts +5 -0
  236. package/esm/common/provider/provider-util.js +10 -0
  237. package/esm/common/provider/provider-util.js.map +1 -0
  238. package/esm/common/provider/provider.d.ts +13 -0
  239. package/esm/common/provider/provider.js +54 -0
  240. package/esm/common/provider/provider.js.map +1 -0
  241. package/esm/common/static-module.d.ts +3 -0
  242. package/esm/common/static-module.js +9 -0
  243. package/esm/common/static-module.js.map +1 -0
  244. package/esm/common/test/index.d.ts +1 -0
  245. package/esm/common/test/index.js +2 -0
  246. package/esm/common/test/index.js.map +1 -0
  247. package/esm/common/test/mock-logger.d.ts +14 -0
  248. package/esm/common/test/mock-logger.js +41 -0
  249. package/esm/common/test/mock-logger.js.map +1 -0
  250. package/esm/common/test/test-module.d.ts +2 -0
  251. package/esm/common/test/test-module.js +12 -0
  252. package/esm/common/test/test-module.js.map +1 -0
  253. package/esm/common/utils/annotation-util.d.ts +4 -0
  254. package/esm/common/utils/annotation-util.js +24 -0
  255. package/esm/common/utils/annotation-util.js.map +1 -0
  256. package/esm/common/utils/assert.d.ts +173 -0
  257. package/esm/common/utils/assert.js +283 -0
  258. package/esm/common/utils/assert.js.map +1 -0
  259. package/esm/common/utils/async.d.ts +367 -0
  260. package/esm/common/utils/async.js +935 -0
  261. package/esm/common/utils/async.js.map +1 -0
  262. package/esm/common/utils/byte-util.d.ts +11 -0
  263. package/esm/common/utils/byte-util.js +75 -0
  264. package/esm/common/utils/byte-util.js.map +1 -0
  265. package/esm/common/utils/cancellation.d.ts +21 -0
  266. package/esm/common/utils/cancellation.js +89 -0
  267. package/esm/common/utils/cancellation.js.map +1 -0
  268. package/esm/common/utils/class-util.d.ts +2 -0
  269. package/esm/common/utils/class-util.js +19 -0
  270. package/esm/common/utils/class-util.js.map +1 -0
  271. package/esm/common/utils/disposable.d.ts +29 -0
  272. package/esm/common/utils/disposable.js +78 -0
  273. package/esm/common/utils/disposable.js.map +1 -0
  274. package/esm/common/utils/emitter.d.ts +63 -0
  275. package/esm/common/utils/emitter.js +221 -0
  276. package/esm/common/utils/emitter.js.map +1 -0
  277. package/esm/common/utils/error-util.d.ts +19 -0
  278. package/esm/common/utils/error-util.js +35 -0
  279. package/esm/common/utils/error-util.js.map +1 -0
  280. package/esm/common/utils/event.d.ts +40 -0
  281. package/esm/common/utils/event.js +90 -0
  282. package/esm/common/utils/event.js.map +1 -0
  283. package/esm/common/utils/global-util.d.ts +1 -0
  284. package/esm/common/utils/global-util.js +16 -0
  285. package/esm/common/utils/global-util.js.map +1 -0
  286. package/esm/common/utils/index.d.ts +21 -0
  287. package/esm/common/utils/index.js +22 -0
  288. package/esm/common/utils/index.js.map +1 -0
  289. package/esm/common/utils/metadata-util.d.ts +1 -0
  290. package/esm/common/utils/metadata-util.js +25 -0
  291. package/esm/common/utils/metadata-util.js.map +1 -0
  292. package/esm/common/utils/mime-type-util.d.ts +36 -0
  293. package/esm/common/utils/mime-type-util.js +168 -0
  294. package/esm/common/utils/mime-type-util.js.map +1 -0
  295. package/esm/common/utils/mime-type.d.ts +36 -0
  296. package/esm/common/utils/mime-type.js +284 -0
  297. package/esm/common/utils/mime-type.js.map +1 -0
  298. package/esm/common/utils/os.d.ts +19 -0
  299. package/esm/common/utils/os.js +46 -0
  300. package/esm/common/utils/os.js.map +1 -0
  301. package/esm/common/utils/prioritizeable.d.ts +17 -0
  302. package/esm/common/utils/prioritizeable.js +38 -0
  303. package/esm/common/utils/prioritizeable.js.map +1 -0
  304. package/esm/common/utils/promise-util.d.ts +5 -0
  305. package/esm/common/utils/promise-util.js +9 -0
  306. package/esm/common/utils/promise-util.js.map +1 -0
  307. package/esm/common/utils/proxy-util.d.ts +4 -0
  308. package/esm/common/utils/proxy-util.js +34 -0
  309. package/esm/common/utils/proxy-util.js.map +1 -0
  310. package/esm/common/utils/types.d.ts +16 -0
  311. package/esm/common/utils/types.js +2 -0
  312. package/esm/common/utils/types.js.map +1 -0
  313. package/esm/common/utils/url-util.d.ts +3 -0
  314. package/esm/common/utils/url-util.js +56 -0
  315. package/esm/common/utils/url-util.js.map +1 -0
  316. package/esm/common/utils/uuid.d.ts +2 -0
  317. package/esm/common/utils/uuid.js +61 -0
  318. package/esm/common/utils/uuid.js.map +1 -0
  319. package/esm/node/application/backend-application-state.d.ts +4 -0
  320. package/esm/node/application/backend-application-state.js +14 -0
  321. package/esm/node/application/backend-application-state.js.map +1 -0
  322. package/esm/node/application/backend-application.d.ts +10 -0
  323. package/esm/node/application/backend-application.js +52 -0
  324. package/esm/node/application/backend-application.js.map +1 -0
  325. package/esm/node/application/index.d.ts +2 -0
  326. package/esm/node/application/index.js +3 -0
  327. package/esm/node/application/index.js.map +1 -0
  328. package/esm/node/constants.d.ts +15 -0
  329. package/esm/node/constants.js +16 -0
  330. package/esm/node/constants.js.map +1 -0
  331. package/esm/node/context/context.d.ts +15 -0
  332. package/esm/node/context/context.js +58 -0
  333. package/esm/node/context/context.js.map +1 -0
  334. package/esm/node/context/index.d.ts +1 -0
  335. package/esm/node/context/index.js +2 -0
  336. package/esm/node/context/index.js.map +1 -0
  337. package/esm/node/index.d.ts +3 -0
  338. package/esm/node/index.js +4 -0
  339. package/esm/node/index.js.map +1 -0
  340. package/esm/node/static-module.d.ts +3 -0
  341. package/esm/node/static-module.js +4 -0
  342. package/esm/node/static-module.js.map +1 -0
  343. package/esm/node/utils/crc.d.ts +1 -0
  344. package/esm/node/utils/crc.js +7 -0
  345. package/esm/node/utils/crc.js.map +1 -0
  346. package/esm/node/utils/index.d.ts +1 -0
  347. package/esm/node/utils/index.js +2 -0
  348. package/esm/node/utils/index.js.map +1 -0
  349. package/esm/package.json +3 -0
  350. package/lib/browser/application/frontend-application-state.js.map +1 -1
  351. package/lib/browser/application/frontend-application.d.ts.map +1 -1
  352. package/lib/browser/application/frontend-application.js.map +1 -1
  353. package/lib/browser/browser.js.map +1 -1
  354. package/lib/browser/shell/application-shell.d.ts.map +1 -1
  355. package/lib/browser/shell/application-shell.js.map +1 -1
  356. package/lib/browser/static-module.d.ts.map +1 -1
  357. package/lib/browser/static-module.js.map +1 -1
  358. package/lib/common/annotation/aspect.d.ts.map +1 -1
  359. package/lib/common/annotation/aspect.js.map +1 -1
  360. package/lib/common/annotation/autowired-provider.d.ts.map +1 -1
  361. package/lib/common/annotation/autowired-provider.js.map +1 -1
  362. package/lib/common/annotation/autowired.d.ts.map +1 -1
  363. package/lib/common/annotation/autowired.js.map +1 -1
  364. package/lib/common/annotation/component.js.map +1 -1
  365. package/lib/common/annotation/constant.d.ts.map +1 -1
  366. package/lib/common/annotation/constant.js.map +1 -1
  367. package/lib/common/annotation/detached/autowired-provider.d.ts.map +1 -1
  368. package/lib/common/annotation/detached/autowired-provider.js.map +1 -1
  369. package/lib/common/annotation/detached/autowired.d.ts.map +1 -1
  370. package/lib/common/annotation/detached/autowired.js.map +1 -1
  371. package/lib/common/annotation/detached/value.d.ts.map +1 -1
  372. package/lib/common/annotation/detached/value.js.map +1 -1
  373. package/lib/common/annotation/service.js.map +1 -1
  374. package/lib/common/annotation/value.d.ts.map +1 -1
  375. package/lib/common/annotation/value.js.map +1 -1
  376. package/lib/common/aop/aop-proxy-factory.d.ts.map +1 -1
  377. package/lib/common/aop/aop-proxy-factory.js.map +1 -1
  378. package/lib/common/aop/class-filter.d.ts.map +1 -1
  379. package/lib/common/aop/class-filter.js.map +1 -1
  380. package/lib/common/application/application-error.js.map +1 -1
  381. package/lib/common/application/application-factory.d.ts +1 -0
  382. package/lib/common/application/application-factory.d.ts.map +1 -1
  383. package/lib/common/application/application-factory.js +5 -2
  384. package/lib/common/application/application-factory.js.map +1 -1
  385. package/lib/common/application/application-protocol.d.ts.map +1 -1
  386. package/lib/common/application/application-protocol.js.map +1 -1
  387. package/lib/common/application/application-state.js.map +1 -1
  388. package/lib/common/application/application.d.ts.map +1 -1
  389. package/lib/common/application/application.js.map +1 -1
  390. package/lib/common/config/config-provider.d.ts.map +1 -1
  391. package/lib/common/config/config-provider.js.map +1 -1
  392. package/lib/common/config/config-util.js.map +1 -1
  393. package/lib/common/constants.d.ts.map +1 -1
  394. package/lib/common/container/auto-bind.js.map +1 -1
  395. package/lib/common/container/container-factory.d.ts.map +1 -1
  396. package/lib/common/container/container-factory.js.map +1 -1
  397. package/lib/common/container/container-provider.js.map +1 -1
  398. package/lib/common/container/container-util.js.map +1 -1
  399. package/lib/common/container/scope.js.map +1 -1
  400. package/lib/common/el/core-context-initializer.d.ts.map +1 -1
  401. package/lib/common/el/core-context-initializer.js.map +1 -1
  402. package/lib/common/el/expression-compiler.d.ts.map +1 -1
  403. package/lib/common/el/expression-compiler.js.map +1 -1
  404. package/lib/common/el/expression-context-provider.d.ts.map +1 -1
  405. package/lib/common/el/expression-context-provider.js.map +1 -1
  406. package/lib/common/el/expression-handler.d.ts.map +1 -1
  407. package/lib/common/el/expression-handler.js +5 -2
  408. package/lib/common/el/expression-handler.js.map +1 -1
  409. package/lib/common/el/jexl-engine-provider.d.ts.map +1 -1
  410. package/lib/common/el/jexl-engine-provider.js.map +1 -1
  411. package/lib/common/error/custom-error.d.ts.map +1 -1
  412. package/lib/common/error/custom-error.js.map +1 -1
  413. package/lib/common/error/illegal-argument-error.js.map +1 -1
  414. package/lib/common/error/illegal-state-error.js.map +1 -1
  415. package/lib/common/error/invalid-mime-type-error.d.ts.map +1 -1
  416. package/lib/common/error/invalid-mime-type-error.js.map +1 -1
  417. package/lib/common/logger/abstract-logger.d.ts.map +1 -1
  418. package/lib/common/logger/abstract-logger.js.map +1 -1
  419. package/lib/common/logger/logger-protocol.js.map +1 -1
  420. package/lib/common/logger/logger-service.js.map +1 -1
  421. package/lib/common/logger/logger.d.ts.map +1 -1
  422. package/lib/common/logger/logger.js.map +1 -1
  423. package/lib/common/provider/component-filter-registry.d.ts.map +1 -1
  424. package/lib/common/provider/component-filter-registry.js.map +1 -1
  425. package/lib/common/provider/provider-creator.d.ts.map +1 -1
  426. package/lib/common/provider/provider-creator.js.map +1 -1
  427. package/lib/common/provider/provider-util.js.map +1 -1
  428. package/lib/common/provider/provider.d.ts.map +1 -1
  429. package/lib/common/provider/provider.js.map +1 -1
  430. package/lib/common/static-module.d.ts.map +1 -1
  431. package/lib/common/static-module.js.map +1 -1
  432. package/lib/common/test/mock-logger.d.ts.map +1 -1
  433. package/lib/common/test/mock-logger.js.map +1 -1
  434. package/lib/common/utils/annotation-util.js.map +1 -1
  435. package/lib/common/utils/assert.d.ts.map +1 -1
  436. package/lib/common/utils/assert.js.map +1 -1
  437. package/lib/common/utils/async.d.ts.map +1 -1
  438. package/lib/common/utils/async.js.map +1 -1
  439. package/lib/common/utils/byte-util.d.ts.map +1 -1
  440. package/lib/common/utils/byte-util.js.map +1 -1
  441. package/lib/common/utils/cancellation.d.ts.map +1 -1
  442. package/lib/common/utils/cancellation.js.map +1 -1
  443. package/lib/common/utils/class-util.js.map +1 -1
  444. package/lib/common/utils/disposable.d.ts.map +1 -1
  445. package/lib/common/utils/disposable.js.map +1 -1
  446. package/lib/common/utils/emitter.d.ts.map +1 -1
  447. package/lib/common/utils/emitter.js.map +1 -1
  448. package/lib/common/utils/error-util.d.ts.map +1 -1
  449. package/lib/common/utils/error-util.js.map +1 -1
  450. package/lib/common/utils/event.d.ts.map +1 -1
  451. package/lib/common/utils/event.js.map +1 -1
  452. package/lib/common/utils/metadata-util.js.map +1 -1
  453. package/lib/common/utils/mime-type-util.d.ts.map +1 -1
  454. package/lib/common/utils/mime-type-util.js.map +1 -1
  455. package/lib/common/utils/mime-type.d.ts.map +1 -1
  456. package/lib/common/utils/mime-type.js.map +1 -1
  457. package/lib/common/utils/os.js.map +1 -1
  458. package/lib/common/utils/prioritizeable.js.map +1 -1
  459. package/lib/common/utils/promise-util.js.map +1 -1
  460. package/lib/common/utils/proxy-util.js.map +1 -1
  461. package/lib/common/utils/url-util.js.map +1 -1
  462. package/lib/common/utils/uuid.js.map +1 -1
  463. package/lib/node/application/backend-application-state.js.map +1 -1
  464. package/lib/node/application/backend-application.d.ts.map +1 -1
  465. package/lib/node/application/backend-application.js.map +1 -1
  466. package/lib/node/constants.d.ts.map +1 -1
  467. package/lib/node/context/context.d.ts.map +1 -1
  468. package/lib/node/context/context.js.map +1 -1
  469. package/lib/node/static-module.d.ts.map +1 -1
  470. package/lib/node/static-module.js.map +1 -1
  471. package/lib/node/utils/crc.js.map +1 -1
  472. package/lib/package.spec.d.ts +1 -0
  473. package/lib/package.spec.js +5 -2
  474. package/lib/package.spec.js.map +1 -1
  475. package/package.json +126 -9
  476. package/src/common/application/application-factory.ts +1 -1
  477. package/src/common/el/expression-handler.ts +1 -1
  478. package/src/package.spec.ts +1 -0
  479. package/LICENSE +0 -21
@@ -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;Q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,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9F,CAAC;IAEO,MAAM,CAAC,mBAAmB,CAAC,GAAW,EAAE,QAAa;QACzD,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;IACnG,CAAC;IAEO,MAAM,CAAC,cAAc,CAAC,OAAiC;QAC3D,OAAO,OAAO,OAAO,KAAK,UAAU,CAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;IAChE,CAAC;CACJ"}
@@ -0,0 +1,367 @@
1
+ import { CancellationToken } from './cancellation.js';
2
+ import { Disposable } from './disposable.js';
3
+ import { Event } from './event.js';
4
+ interface Thenable<T> {
5
+ then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
6
+ then<TResult>(onfulfilled?: (value: T) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
7
+ }
8
+ export declare function isThenable<T>(obj: unknown): obj is Promise<T>;
9
+ export interface CancelablePromise<T> extends Promise<T> {
10
+ cancel(): void;
11
+ }
12
+ /**
13
+ * A function to allow a promise resolution to be delayed by a number of milliseconds. Usage is as follows:
14
+ *
15
+ * `const stringValue = await myPromise.then(delay(600)).then(value => value.toString());`
16
+ *
17
+ * @param ms the number of millisecond to delay
18
+ * @returns a function that returns a promise that returns the given value, but delayed
19
+ */
20
+ export declare function delay<T>(ms: number): (value: T) => Promise<T>;
21
+ /**
22
+ * Constructs a promise that will resolve after a given delay.
23
+ * @param ms the number of milliseconds to wait
24
+ */
25
+ export declare function wait(ms: number): Promise<void>;
26
+ export declare function waitForEvent<T>(event: Event<T>, ms: number, thisArg?: any, disposables?: Disposable[]): Promise<T>;
27
+ export declare function createCancelablePromise<T>(callback: (token: CancellationToken) => Promise<T>): CancelablePromise<T>;
28
+ export declare function raceCancellation<T>(promise: Promise<T>, token: CancellationToken): Promise<T | undefined>;
29
+ export declare function raceCancellation<T>(promise: Promise<T>, token: CancellationToken, defaultValue: T): Promise<T>;
30
+ export declare function raceCancellationError<T>(promise: Promise<T>, token: CancellationToken): Promise<T>;
31
+ export declare function raceCancellablePromises<T>(cancellablePromises: CancelablePromise<T>[]): Promise<T>;
32
+ export declare function raceTimeout<T>(promise: Promise<T>, timeout: number, onTimeout?: () => void): Promise<T | undefined>;
33
+ export declare function asPromise<T>(callback: () => T | Thenable<T>): Promise<T>;
34
+ export interface ITask<T> {
35
+ (): T;
36
+ }
37
+ /**
38
+ * A helper to prevent accumulation of sequential async tasks.
39
+ *
40
+ * Imagine a mail man with the sole task of delivering letters. As soon as
41
+ * a letter submitted for delivery, he drives to the destination, delivers it
42
+ * and returns to his base. Imagine that during the trip, N more letters were submitted.
43
+ * When the mail man returns, he picks those N letters and delivers them all in a
44
+ * single trip. Even though N+1 submissions occurred, only 2 deliveries were made.
45
+ *
46
+ * The throttler implements this via the queue() method, by providing it a task
47
+ * factory. Following the example:
48
+ *
49
+ * const throttler = new Throttler();
50
+ * const letters = [];
51
+ *
52
+ * function deliver() {
53
+ * const lettersToDeliver = letters;
54
+ * letters = [];
55
+ * return makeTheTrip(lettersToDeliver);
56
+ * }
57
+ *
58
+ * function onLetterReceived(l) {
59
+ * letters.push(l);
60
+ * throttler.queue(deliver);
61
+ * }
62
+ */
63
+ export declare class Throttler {
64
+ private activePromise;
65
+ private queuedPromise;
66
+ private queuedPromiseFactory;
67
+ constructor();
68
+ queue<T>(promiseFactory: ITask<Promise<T>>): Promise<T>;
69
+ }
70
+ export declare class Sequencer {
71
+ private current;
72
+ queue<T>(promiseTask: ITask<Promise<T>>): Promise<T>;
73
+ }
74
+ export declare class SequencerByKey<TKey> {
75
+ private promiseMap;
76
+ queue<T>(key: TKey, promiseTask: ITask<Promise<T>>): Promise<T>;
77
+ }
78
+ /** Can be passed into the Delayed to defer using a microtask */
79
+ export declare const MicrotaskDelay: unique symbol;
80
+ /**
81
+ * A helper to delay (debounce) execution of a task that is being requested often.
82
+ *
83
+ * Following the throttler, now imagine the mail man wants to optimize the number of
84
+ * trips proactively. The trip itself can be long, so he decides not to make the trip
85
+ * as soon as a letter is submitted. Instead he waits a while, in case more
86
+ * letters are submitted. After said waiting period, if no letters were submitted, he
87
+ * decides to make the trip. Imagine that N more letters were submitted after the first
88
+ * one, all within a short period of time between each other. Even though N+1
89
+ * submissions occurred, only 1 delivery was made.
90
+ *
91
+ * The delayer offers this behavior via the trigger() method, into which both the task
92
+ * to be executed and the waiting period (delay) must be passed in as arguments. Following
93
+ * the example:
94
+ *
95
+ * const delayer = new Delayer(WAITING_PERIOD);
96
+ * const letters = [];
97
+ *
98
+ * function letterReceived(l) {
99
+ * letters.push(l);
100
+ * delayer.trigger(() => { return makeTheTrip(); });
101
+ * }
102
+ */
103
+ export declare class Delayer<T> implements Disposable {
104
+ defaultDelay: number | typeof MicrotaskDelay;
105
+ private deferred;
106
+ private completionPromise;
107
+ private doResolve;
108
+ private doReject;
109
+ private task;
110
+ constructor(defaultDelay: number | typeof MicrotaskDelay);
111
+ trigger(task: ITask<T | Promise<T>>, delay?: number | typeof MicrotaskDelay): Promise<T>;
112
+ isTriggered(): boolean;
113
+ cancel(): void;
114
+ private cancelTimeout;
115
+ dispose(): void;
116
+ }
117
+ /**
118
+ * A helper to delay execution of a task that is being requested often, while
119
+ * preventing accumulation of consecutive executions, while the task runs.
120
+ *
121
+ * The mail man is clever and waits for a certain amount of time, before going
122
+ * out to deliver letters. While the mail man is going out, more letters arrive
123
+ * and can only be delivered once he is back. Once he is back the mail man will
124
+ * do one more trip to deliver the letters that have accumulated while he was out.
125
+ */
126
+ export declare class ThrottledDelayer<T> {
127
+ private delayer;
128
+ private throttler;
129
+ constructor(defaultDelay: number);
130
+ trigger(promiseFactory: ITask<Promise<T>>, delay?: number): Promise<T>;
131
+ isTriggered(): boolean;
132
+ cancel(): void;
133
+ dispose(): void;
134
+ }
135
+ /**
136
+ * A barrier that is initially closed and then becomes opened permanently.
137
+ */
138
+ export declare class Barrier {
139
+ private _isOpen;
140
+ private _promise;
141
+ private _completePromise;
142
+ constructor();
143
+ isOpen(): boolean;
144
+ open(): void;
145
+ wait(): Promise<boolean>;
146
+ }
147
+ /**
148
+ * A barrier that is initially closed and then becomes opened permanently after a certain period of
149
+ * time or when open is called explicitly
150
+ */
151
+ export declare class AutoOpenBarrier extends Barrier {
152
+ private readonly _timeout;
153
+ constructor(autoOpenTimeMs: number);
154
+ open(): void;
155
+ }
156
+ export declare function timeout(millis: number): CancelablePromise<void>;
157
+ export declare function timeout(millis: number, token: CancellationToken): Promise<void>;
158
+ export declare function disposableTimeout(handler: () => void, timeout?: number): Disposable;
159
+ /**
160
+ * Runs the provided list of promise factories in sequential order. The returned
161
+ * promise will complete to an array of results from each promise.
162
+ */
163
+ export declare function sequence<T>(promiseFactories: ITask<Promise<T>>[]): Promise<T[]>;
164
+ export declare function first<T>(promiseFactories: ITask<Promise<T>>[], shouldStop?: (t: T) => boolean, defaultValue?: T | undefined): Promise<T | undefined>;
165
+ /**
166
+ * Returns the result of the first promise that matches the "shouldStop",
167
+ * running all promises in parallel. Supports cancelable promises.
168
+ */
169
+ export declare function firstParallel<T>(promiseList: Promise<T>[], shouldStop?: (t: T) => boolean, defaultValue?: T | undefined): Promise<T | undefined>;
170
+ export declare function firstParallel<T, R extends T>(promiseList: Promise<T>[], shouldStop: (t: T) => t is R, defaultValue?: R | undefined): Promise<R | undefined>;
171
+ export interface ILimiter<T> {
172
+ readonly size: number;
173
+ queue(factory: ITask<Promise<T>>): Promise<T>;
174
+ }
175
+ /**
176
+ * A helper to queue N promises and run them all with a max degree of parallelism. The helper
177
+ * ensures that at any time no more than M promises are running at the same time.
178
+ */
179
+ export declare class Limiter<T> implements ILimiter<T> {
180
+ private _size;
181
+ private runningPromises;
182
+ private readonly maxDegreeOfParalellism;
183
+ private readonly outstandingPromises;
184
+ private readonly _onDrained;
185
+ constructor(maxDegreeOfParalellism: number);
186
+ /**
187
+ * An event that fires when every promise in the queue
188
+ * has started to execute. In other words: no work is
189
+ * pending to be scheduled.
190
+ *
191
+ * This is NOT an event that signals when all promises
192
+ * have finished though.
193
+ */
194
+ get onDrained(): Event<void>;
195
+ get size(): number;
196
+ queue(factory: ITask<Promise<T>>): Promise<T>;
197
+ private consume;
198
+ private consumed;
199
+ dispose(): void;
200
+ }
201
+ /**
202
+ * A queue is handles one promise at a time and guarantees that at any time only one promise is executing.
203
+ */
204
+ export declare class Queue<T> extends Limiter<T> {
205
+ constructor();
206
+ }
207
+ export declare class TimeoutTimer implements Disposable {
208
+ private _token;
209
+ constructor();
210
+ constructor(runner: () => void, timeout: number);
211
+ dispose(): void;
212
+ cancel(): void;
213
+ cancelAndSet(runner: () => void, timeout: number): void;
214
+ setIfNotSet(runner: () => void, timeout: number): void;
215
+ }
216
+ export declare class IntervalTimer implements Disposable {
217
+ private _token;
218
+ constructor();
219
+ dispose(): void;
220
+ cancel(): void;
221
+ cancelAndSet(runner: () => void, interval: number): void;
222
+ }
223
+ export declare class RunOnceScheduler {
224
+ protected runner: ((...args: unknown[]) => void) | undefined;
225
+ private timeoutToken;
226
+ private timeout;
227
+ private timeoutHandler;
228
+ constructor(runner: (...args: any[]) => void, delay: number);
229
+ /**
230
+ * Dispose RunOnceScheduler
231
+ */
232
+ dispose(): void;
233
+ /**
234
+ * Cancel current scheduled runner (if any).
235
+ */
236
+ cancel(): void;
237
+ /**
238
+ * Cancel previous runner (if any) & schedule a new runner.
239
+ */
240
+ schedule(delay?: number): void;
241
+ get delay(): number;
242
+ set delay(value: number);
243
+ /**
244
+ * Returns true if scheduled.
245
+ */
246
+ isScheduled(): boolean;
247
+ private onTimeout;
248
+ protected doRun(): void;
249
+ }
250
+ /**
251
+ * Same as `RunOnceScheduler`, but doesn't count the time spent in sleep mode.
252
+ * > **NOTE**: Only offers 1s resolution.
253
+ *
254
+ * When calling `setTimeout` with 3hrs, and putting the computer immediately to sleep
255
+ * for 8hrs, `setTimeout` will fire **as soon as the computer wakes from sleep**. But
256
+ * this scheduler will execute 3hrs **after waking the computer from sleep**.
257
+ */
258
+ export declare class ProcessTimeRunOnceScheduler {
259
+ private runner;
260
+ private timeout;
261
+ private counter;
262
+ private intervalToken;
263
+ private intervalHandler;
264
+ constructor(runner: () => void, delay: number);
265
+ dispose(): void;
266
+ cancel(): void;
267
+ /**
268
+ * Cancel previous runner (if any) & schedule a new runner.
269
+ */
270
+ schedule(delay?: number): void;
271
+ /**
272
+ * Returns true if scheduled.
273
+ */
274
+ isScheduled(): boolean;
275
+ private onInterval;
276
+ }
277
+ export declare class RunOnceWorker<T> extends RunOnceScheduler {
278
+ private units;
279
+ constructor(runner: (units: T[]) => void, timeout: number);
280
+ work(unit: T): void;
281
+ protected doRun(): void;
282
+ dispose(): void;
283
+ }
284
+ export interface IThrottledWorkerOptions {
285
+ /**
286
+ * maximum of units the worker will pass onto handler at once
287
+ */
288
+ maxWorkChunkSize: number;
289
+ /**
290
+ * maximum of units the worker will keep in memory for processing
291
+ */
292
+ maxBufferedWork: number | undefined;
293
+ /**
294
+ * delay before processing the next round of chunks when chunk size exceeds limits
295
+ */
296
+ throttleDelay: number;
297
+ }
298
+ export declare function retry<T>(task: ITask<Promise<T>>, delay: number, retries: number): Promise<T>;
299
+ export interface ITaskSequentializerWithPendingTask {
300
+ readonly pending: Promise<void>;
301
+ }
302
+ export declare class TaskSequentializer {
303
+ private _pending?;
304
+ private _next?;
305
+ hasPending(taskId?: number): this is ITaskSequentializerWithPendingTask;
306
+ get pending(): Promise<void> | undefined;
307
+ cancelPending(): void;
308
+ setPending(taskId: number, promise: Promise<void>, onCancel?: () => void): Promise<void>;
309
+ private donePending;
310
+ private triggerNext;
311
+ setNext(run: () => Promise<void>): Promise<void>;
312
+ }
313
+ /**
314
+ * The `IntervalCounter` allows to count the number
315
+ * of calls to `increment()` over a duration of
316
+ * `interval`. This utility can be used to conditionally
317
+ * throttle a frequent task when a certain threshold
318
+ * is reached.
319
+ */
320
+ export declare class IntervalCounter {
321
+ private readonly interval;
322
+ private readonly nowFn;
323
+ private lastIncrementTime;
324
+ private value;
325
+ constructor(interval: number, nowFn?: () => number);
326
+ increment(): number;
327
+ }
328
+ export type ValueCallback<T = unknown> = (value: T | Promise<T>) => void;
329
+ /**
330
+ * Creates a promise whose resolution or rejection can be controlled imperatively.
331
+ */
332
+ export declare class DeferredPromise<T> {
333
+ private completeCallback;
334
+ private errorCallback;
335
+ private rejected;
336
+ private resolved;
337
+ get isRejected(): boolean;
338
+ get isResolved(): boolean;
339
+ get isSettled(): boolean;
340
+ p: Promise<T>;
341
+ constructor();
342
+ complete(value: T): Promise<void>;
343
+ error(err: unknown): Promise<void>;
344
+ cancel(): void;
345
+ }
346
+ export declare namespace Promises {
347
+ /**
348
+ * A drop-in replacement for `Promise.all` with the only difference
349
+ * that the method awaits every promise to either fulfill or reject.
350
+ *
351
+ * Similar to `Promise.all`, only the first error will be returned
352
+ * if any.
353
+ */
354
+ function settled<T>(promises: Promise<T>[]): Promise<T[]>;
355
+ /**
356
+ * A helper to create a new `Promise<T>` with a body that is a promise
357
+ * itself. By default, an error that raises from the async body will
358
+ * end up as a unhandled rejection, so this utility properly awaits the
359
+ * body and rejects the promise as a normal promise does without async
360
+ * body.
361
+ *
362
+ * This method should only be used in rare cases where otherwise `async`
363
+ * cannot be used (e.g. when callbacks are involved that require this).
364
+ */
365
+ function withAsyncBody<T, E = Error>(bodyFn: (resolve: (value: T) => unknown, reject: (error: E) => unknown) => Promise<unknown>): Promise<T>;
366
+ }
367
+ export {};