repluggable-core 0.0.0-pr280.413 → 0.0.0-pr282.418

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 (328) hide show
  1. package/__tests__/spec-setup.js +3 -0
  2. package/dist/es/{API.d.ts → src/API.d.ts} +31 -10
  3. package/dist/es/src/API.d.ts.map +1 -0
  4. package/dist/es/src/API.js +2 -0
  5. package/dist/es/src/API.js.map +1 -0
  6. package/dist/es/src/IterableWeakMap.d.ts +20 -0
  7. package/dist/es/src/IterableWeakMap.d.ts.map +1 -0
  8. package/dist/es/src/IterableWeakMap.js +92 -0
  9. package/dist/es/src/IterableWeakMap.js.map +1 -0
  10. package/dist/es/src/appHost.d.ts +7 -0
  11. package/dist/es/src/appHost.d.ts.map +1 -0
  12. package/dist/es/src/appHost.js +848 -0
  13. package/dist/es/src/appHost.js.map +1 -0
  14. package/dist/es/src/appHostServices.d.ts +12 -0
  15. package/dist/es/src/appHostServices.d.ts.map +1 -0
  16. package/dist/es/src/appHostServices.js +25 -0
  17. package/dist/es/src/appHostServices.js.map +1 -0
  18. package/dist/es/src/appHostUtils.d.ts +4 -0
  19. package/dist/es/src/appHostUtils.d.ts.map +1 -0
  20. package/dist/es/src/appHostUtils.js +8 -0
  21. package/dist/es/src/appHostUtils.js.map +1 -0
  22. package/dist/es/src/extensionSlot.d.ts +8 -0
  23. package/dist/es/src/extensionSlot.d.ts.map +1 -0
  24. package/dist/es/src/extensionSlot.js +59 -0
  25. package/dist/es/src/extensionSlot.js.map +1 -0
  26. package/dist/es/src/hot.d.ts +14 -0
  27. package/dist/es/src/hot.d.ts.map +1 -0
  28. package/dist/es/src/hot.js +52 -0
  29. package/dist/es/src/hot.js.map +1 -0
  30. package/dist/es/src/index.d.ts +11 -0
  31. package/dist/es/src/index.d.ts.map +1 -0
  32. package/dist/es/src/index.js +10 -0
  33. package/dist/es/src/index.js.map +1 -0
  34. package/dist/es/src/installedShellsState.d.ts +19 -0
  35. package/dist/es/src/installedShellsState.d.ts.map +1 -0
  36. package/dist/es/src/installedShellsState.js +30 -0
  37. package/dist/es/src/installedShellsState.js.map +1 -0
  38. package/dist/es/src/interceptAnyObject.d.ts +7 -0
  39. package/dist/es/src/interceptAnyObject.d.ts.map +1 -0
  40. package/dist/es/src/interceptAnyObject.js +21 -0
  41. package/dist/es/src/interceptAnyObject.js.map +1 -0
  42. package/dist/es/src/interceptEntryPoints.d.ts +6 -0
  43. package/dist/es/src/interceptEntryPoints.d.ts.map +1 -0
  44. package/dist/es/src/interceptEntryPoints.js +22 -0
  45. package/dist/es/src/interceptEntryPoints.js.map +1 -0
  46. package/dist/es/src/invokeSlotCallbacks.d.ts +3 -0
  47. package/dist/es/src/invokeSlotCallbacks.d.ts.map +1 -0
  48. package/dist/es/src/invokeSlotCallbacks.js +20 -0
  49. package/dist/es/src/invokeSlotCallbacks.js.map +1 -0
  50. package/dist/es/src/loggers.d.ts +4 -0
  51. package/dist/es/src/loggers.d.ts.map +1 -0
  52. package/dist/es/src/loggers.js +100 -0
  53. package/dist/es/src/loggers.js.map +1 -0
  54. package/dist/es/src/monitorAPI.d.ts +3 -0
  55. package/dist/es/src/monitorAPI.d.ts.map +1 -0
  56. package/dist/es/src/monitorAPI.js +53 -0
  57. package/dist/es/src/monitorAPI.js.map +1 -0
  58. package/dist/es/src/repluggableAppDebug/index.d.ts +2 -0
  59. package/dist/es/src/repluggableAppDebug/index.d.ts.map +1 -0
  60. package/dist/es/src/repluggableAppDebug/index.js +2 -0
  61. package/dist/es/src/repluggableAppDebug/index.js.map +1 -0
  62. package/dist/es/src/repluggableAppDebug/performanceDebugInfo.d.ts +15 -0
  63. package/dist/es/src/repluggableAppDebug/performanceDebugInfo.d.ts.map +1 -0
  64. package/dist/es/src/repluggableAppDebug/performanceDebugInfo.js +94 -0
  65. package/dist/es/src/repluggableAppDebug/performanceDebugInfo.js.map +1 -0
  66. package/dist/es/src/repluggableAppDebug/repluggableAppDebug.d.ts +24 -0
  67. package/dist/es/src/repluggableAppDebug/repluggableAppDebug.d.ts.map +1 -0
  68. package/dist/es/src/repluggableAppDebug/repluggableAppDebug.js +132 -0
  69. package/dist/es/src/repluggableAppDebug/repluggableAppDebug.js.map +1 -0
  70. package/dist/es/src/tarjanGraph.d.ts +27 -0
  71. package/dist/es/src/tarjanGraph.d.ts.map +1 -0
  72. package/dist/es/src/tarjanGraph.js +94 -0
  73. package/dist/es/src/tarjanGraph.js.map +1 -0
  74. package/dist/es/src/throttledStore.d.ts +32 -0
  75. package/dist/es/src/throttledStore.d.ts.map +1 -0
  76. package/dist/es/src/throttledStore.js +240 -0
  77. package/dist/es/src/throttledStore.js.map +1 -0
  78. package/dist/es/test/IterableWeakMap.spec.d.ts +2 -0
  79. package/dist/es/test/IterableWeakMap.spec.d.ts.map +1 -0
  80. package/dist/es/test/IterableWeakMap.spec.js +218 -0
  81. package/dist/es/test/IterableWeakMap.spec.js.map +1 -0
  82. package/dist/es/test/appHost.mock.d.ts +4 -0
  83. package/dist/es/test/appHost.mock.d.ts.map +1 -0
  84. package/dist/es/test/appHost.mock.js +54 -0
  85. package/dist/es/test/appHost.mock.js.map +1 -0
  86. package/dist/es/test/appHost.spec.d.ts +2 -0
  87. package/dist/es/test/appHost.spec.d.ts.map +1 -0
  88. package/dist/es/test/appHost.spec.js +1323 -0
  89. package/dist/es/test/appHost.spec.js.map +1 -0
  90. package/dist/es/test/customExtensionSlot.spec.d.ts +2 -0
  91. package/dist/es/test/customExtensionSlot.spec.d.ts.map +1 -0
  92. package/dist/es/test/customExtensionSlot.spec.js +112 -0
  93. package/dist/es/test/customExtensionSlot.spec.js.map +1 -0
  94. package/dist/es/test/extensionSlot.spec.d.ts +2 -0
  95. package/dist/es/test/extensionSlot.spec.d.ts.map +1 -0
  96. package/dist/es/test/extensionSlot.spec.js +73 -0
  97. package/dist/es/test/extensionSlot.spec.js.map +1 -0
  98. package/dist/es/test/installedShellsState.spec.d.ts +2 -0
  99. package/dist/es/test/installedShellsState.spec.d.ts.map +1 -0
  100. package/dist/es/test/installedShellsState.spec.js +28 -0
  101. package/dist/es/test/installedShellsState.spec.js.map +1 -0
  102. package/dist/es/test/interceptAnyObject.spec.d.ts +2 -0
  103. package/dist/es/test/interceptAnyObject.spec.d.ts.map +1 -0
  104. package/dist/es/test/interceptAnyObject.spec.js +166 -0
  105. package/dist/es/test/interceptAnyObject.spec.js.map +1 -0
  106. package/dist/es/test/interceptEntryPoints.spec.d.ts +2 -0
  107. package/dist/es/test/interceptEntryPoints.spec.d.ts.map +1 -0
  108. package/dist/es/test/interceptEntryPoints.spec.js +244 -0
  109. package/dist/es/test/interceptEntryPoints.spec.js.map +1 -0
  110. package/dist/es/test/loggers.spec.d.ts +2 -0
  111. package/dist/es/test/loggers.spec.d.ts.map +1 -0
  112. package/dist/es/test/loggers.spec.js +218 -0
  113. package/dist/es/test/loggers.spec.js.map +1 -0
  114. package/dist/es/test/repluggableAppDebug.spec.d.ts +2 -0
  115. package/dist/es/test/repluggableAppDebug.spec.d.ts.map +1 -0
  116. package/dist/es/test/repluggableAppDebug.spec.js +107 -0
  117. package/dist/es/test/repluggableAppDebug.spec.js.map +1 -0
  118. package/dist/es/test/testKit.spec.d.ts +2 -0
  119. package/dist/es/test/testKit.spec.d.ts.map +1 -0
  120. package/dist/es/test/testKit.spec.js +129 -0
  121. package/dist/es/test/testKit.spec.js.map +1 -0
  122. package/dist/es/testKit/emptyLoggerOptions.d.ts +3 -0
  123. package/dist/es/testKit/emptyLoggerOptions.d.ts.map +1 -0
  124. package/dist/es/testKit/emptyLoggerOptions.js +15 -0
  125. package/dist/es/testKit/emptyLoggerOptions.js.map +1 -0
  126. package/dist/es/testKit/index.d.ts +25 -0
  127. package/dist/es/testKit/index.d.ts.map +1 -0
  128. package/dist/es/testKit/index.js +130 -0
  129. package/dist/es/testKit/index.js.map +1 -0
  130. package/dist/es/testKit/mockPackage.d.ts +21 -0
  131. package/dist/es/testKit/mockPackage.d.ts.map +1 -0
  132. package/dist/es/testKit/mockPackage.js +85 -0
  133. package/dist/es/testKit/mockPackage.js.map +1 -0
  134. package/dist/es/testKit/withConsoleErrors.d.ts +2 -0
  135. package/dist/es/testKit/withConsoleErrors.d.ts.map +1 -0
  136. package/dist/es/testKit/withConsoleErrors.js +12 -0
  137. package/dist/es/testKit/withConsoleErrors.js.map +1 -0
  138. package/dist/es/testKit/withThrowOnError.d.ts +3 -0
  139. package/dist/es/testKit/withThrowOnError.d.ts.map +1 -0
  140. package/dist/es/testKit/withThrowOnError.js +27 -0
  141. package/dist/es/testKit/withThrowOnError.js.map +1 -0
  142. package/dist/src/API.d.ts +31 -10
  143. package/dist/src/API.d.ts.map +1 -1
  144. package/dist/src/API.js +3 -0
  145. package/dist/src/API.js.map +1 -1
  146. package/dist/src/IterableWeakMap.d.ts +20 -0
  147. package/dist/src/IterableWeakMap.d.ts.map +1 -0
  148. package/dist/src/IterableWeakMap.js +96 -0
  149. package/dist/src/IterableWeakMap.js.map +1 -0
  150. package/dist/src/appHost.d.ts +7 -0
  151. package/dist/src/appHost.d.ts.map +1 -0
  152. package/dist/src/appHost.js +856 -0
  153. package/dist/src/appHost.js.map +1 -0
  154. package/dist/src/appHostServices.d.ts +12 -0
  155. package/dist/src/appHostServices.d.ts.map +1 -0
  156. package/dist/src/appHostServices.js +29 -0
  157. package/dist/src/appHostServices.js.map +1 -0
  158. package/dist/src/appHostUtils.d.ts +4 -0
  159. package/dist/src/appHostUtils.d.ts.map +1 -0
  160. package/dist/src/appHostUtils.js +16 -0
  161. package/dist/src/appHostUtils.js.map +1 -0
  162. package/dist/src/extensionSlot.d.ts +8 -0
  163. package/dist/src/extensionSlot.d.ts.map +1 -0
  164. package/dist/src/extensionSlot.js +67 -0
  165. package/dist/src/extensionSlot.js.map +1 -0
  166. package/dist/src/hot.d.ts +14 -0
  167. package/dist/src/hot.d.ts.map +1 -0
  168. package/dist/src/hot.js +56 -0
  169. package/dist/src/hot.js.map +1 -0
  170. package/dist/src/index.d.ts +10 -1
  171. package/dist/src/index.d.ts.map +1 -1
  172. package/dist/src/index.js +23 -0
  173. package/dist/src/index.js.map +1 -1
  174. package/dist/src/installedShellsState.d.ts +19 -0
  175. package/dist/src/installedShellsState.d.ts.map +1 -0
  176. package/dist/src/installedShellsState.js +38 -0
  177. package/dist/src/installedShellsState.js.map +1 -0
  178. package/dist/src/interceptAnyObject.d.ts +7 -0
  179. package/dist/src/interceptAnyObject.d.ts.map +1 -0
  180. package/dist/src/interceptAnyObject.js +28 -0
  181. package/dist/src/interceptAnyObject.js.map +1 -0
  182. package/dist/src/interceptEntryPoints.d.ts +6 -0
  183. package/dist/src/interceptEntryPoints.d.ts.map +1 -0
  184. package/dist/src/interceptEntryPoints.js +30 -0
  185. package/dist/src/interceptEntryPoints.js.map +1 -0
  186. package/dist/src/invokeSlotCallbacks.d.ts +3 -0
  187. package/dist/src/invokeSlotCallbacks.d.ts.map +1 -0
  188. package/dist/src/invokeSlotCallbacks.js +24 -0
  189. package/dist/src/invokeSlotCallbacks.js.map +1 -0
  190. package/dist/src/loggers.d.ts +4 -0
  191. package/dist/src/loggers.d.ts.map +1 -0
  192. package/dist/src/loggers.js +104 -0
  193. package/dist/src/loggers.js.map +1 -0
  194. package/dist/src/monitorAPI.d.ts +3 -0
  195. package/dist/src/monitorAPI.d.ts.map +1 -0
  196. package/dist/src/monitorAPI.js +57 -0
  197. package/dist/src/monitorAPI.js.map +1 -0
  198. package/dist/src/repluggableAppDebug/index.d.ts +2 -0
  199. package/dist/src/repluggableAppDebug/index.d.ts.map +1 -0
  200. package/dist/src/repluggableAppDebug/index.js +6 -0
  201. package/dist/src/repluggableAppDebug/index.js.map +1 -0
  202. package/dist/src/repluggableAppDebug/performanceDebugInfo.d.ts +15 -0
  203. package/dist/src/repluggableAppDebug/performanceDebugInfo.d.ts.map +1 -0
  204. package/dist/src/repluggableAppDebug/performanceDebugInfo.js +101 -0
  205. package/dist/src/repluggableAppDebug/performanceDebugInfo.js.map +1 -0
  206. package/dist/src/repluggableAppDebug/repluggableAppDebug.d.ts +24 -0
  207. package/dist/src/repluggableAppDebug/repluggableAppDebug.d.ts.map +1 -0
  208. package/dist/src/repluggableAppDebug/repluggableAppDebug.js +139 -0
  209. package/dist/src/repluggableAppDebug/repluggableAppDebug.js.map +1 -0
  210. package/dist/src/tarjanGraph.d.ts +27 -0
  211. package/dist/src/tarjanGraph.d.ts.map +1 -0
  212. package/dist/src/tarjanGraph.js +100 -0
  213. package/dist/src/tarjanGraph.js.map +1 -0
  214. package/dist/src/throttledStore.d.ts +32 -0
  215. package/dist/src/throttledStore.d.ts.map +1 -0
  216. package/dist/src/throttledStore.js +249 -0
  217. package/dist/src/throttledStore.js.map +1 -0
  218. package/dist/test/IterableWeakMap.spec.d.ts +2 -0
  219. package/dist/test/IterableWeakMap.spec.d.ts.map +1 -0
  220. package/dist/test/IterableWeakMap.spec.js +220 -0
  221. package/dist/test/IterableWeakMap.spec.js.map +1 -0
  222. package/dist/test/appHost.mock.d.ts +4 -0
  223. package/dist/test/appHost.mock.d.ts.map +1 -0
  224. package/dist/test/appHost.mock.js +59 -0
  225. package/dist/test/appHost.mock.js.map +1 -0
  226. package/dist/test/appHost.spec.d.ts +2 -0
  227. package/dist/test/appHost.spec.d.ts.map +1 -0
  228. package/dist/test/appHost.spec.js +1328 -0
  229. package/dist/test/appHost.spec.js.map +1 -0
  230. package/dist/test/customExtensionSlot.spec.d.ts +2 -0
  231. package/dist/test/customExtensionSlot.spec.d.ts.map +1 -0
  232. package/dist/test/customExtensionSlot.spec.js +117 -0
  233. package/dist/test/customExtensionSlot.spec.js.map +1 -0
  234. package/dist/test/extensionSlot.spec.d.ts +2 -0
  235. package/dist/test/extensionSlot.spec.d.ts.map +1 -0
  236. package/dist/test/extensionSlot.spec.js +75 -0
  237. package/dist/test/extensionSlot.spec.js.map +1 -0
  238. package/dist/test/installedShellsState.spec.d.ts +2 -0
  239. package/dist/test/installedShellsState.spec.d.ts.map +1 -0
  240. package/dist/test/installedShellsState.spec.js +30 -0
  241. package/dist/test/installedShellsState.spec.js.map +1 -0
  242. package/dist/test/interceptAnyObject.spec.d.ts +2 -0
  243. package/dist/test/interceptAnyObject.spec.d.ts.map +1 -0
  244. package/dist/test/interceptAnyObject.spec.js +171 -0
  245. package/dist/test/interceptAnyObject.spec.js.map +1 -0
  246. package/dist/test/interceptEntryPoints.spec.d.ts +2 -0
  247. package/dist/test/interceptEntryPoints.spec.d.ts.map +1 -0
  248. package/dist/test/interceptEntryPoints.spec.js +249 -0
  249. package/dist/test/interceptEntryPoints.spec.js.map +1 -0
  250. package/dist/test/loggers.spec.d.ts +2 -0
  251. package/dist/test/loggers.spec.d.ts.map +1 -0
  252. package/dist/test/loggers.spec.js +220 -0
  253. package/dist/test/loggers.spec.js.map +1 -0
  254. package/dist/test/repluggableAppDebug.spec.d.ts +2 -0
  255. package/dist/test/repluggableAppDebug.spec.d.ts.map +1 -0
  256. package/dist/test/repluggableAppDebug.spec.js +109 -0
  257. package/dist/test/repluggableAppDebug.spec.js.map +1 -0
  258. package/dist/test/testKit.spec.d.ts +2 -0
  259. package/dist/test/testKit.spec.d.ts.map +1 -0
  260. package/dist/test/testKit.spec.js +134 -0
  261. package/dist/test/testKit.spec.js.map +1 -0
  262. package/dist/testKit/emptyLoggerOptions.d.ts +3 -0
  263. package/dist/testKit/emptyLoggerOptions.d.ts.map +1 -0
  264. package/dist/testKit/emptyLoggerOptions.js +18 -0
  265. package/dist/testKit/emptyLoggerOptions.js.map +1 -0
  266. package/dist/testKit/index.d.ts +25 -0
  267. package/dist/testKit/index.d.ts.map +1 -0
  268. package/dist/testKit/index.js +158 -0
  269. package/dist/testKit/index.js.map +1 -0
  270. package/dist/testKit/mockPackage.d.ts +21 -0
  271. package/dist/testKit/mockPackage.d.ts.map +1 -0
  272. package/dist/testKit/mockPackage.js +91 -0
  273. package/dist/testKit/mockPackage.js.map +1 -0
  274. package/dist/testKit/withConsoleErrors.d.ts +2 -0
  275. package/dist/testKit/withConsoleErrors.d.ts.map +1 -0
  276. package/dist/testKit/withConsoleErrors.js +16 -0
  277. package/dist/testKit/withConsoleErrors.js.map +1 -0
  278. package/dist/testKit/withThrowOnError.d.ts +3 -0
  279. package/dist/testKit/withThrowOnError.d.ts.map +1 -0
  280. package/dist/testKit/withThrowOnError.js +31 -0
  281. package/dist/testKit/withThrowOnError.js.map +1 -0
  282. package/jest.config.js +16 -0
  283. package/package.json +5 -3
  284. package/src/API.ts +474 -378
  285. package/src/IterableWeakMap.ts +121 -0
  286. package/src/appHost.ts +1383 -0
  287. package/src/appHostServices.ts +42 -0
  288. package/src/appHostUtils.ts +11 -0
  289. package/src/extensionSlot.ts +96 -0
  290. package/src/hot.ts +53 -0
  291. package/src/index.ts +55 -3
  292. package/src/installedShellsState.ts +54 -0
  293. package/src/interceptAnyObject.ts +39 -0
  294. package/src/interceptEntryPoints.ts +25 -0
  295. package/src/invokeSlotCallbacks.ts +20 -0
  296. package/src/loggers.ts +112 -0
  297. package/src/monitorAPI.ts +71 -0
  298. package/src/repluggableAppDebug/debug.d.ts +37 -0
  299. package/src/repluggableAppDebug/index.ts +1 -0
  300. package/src/repluggableAppDebug/performanceDebugInfo.ts +96 -0
  301. package/src/repluggableAppDebug/repluggableAppDebug.ts +192 -0
  302. package/src/tarjanGraph.ts +96 -0
  303. package/src/throttledStore.ts +355 -0
  304. package/test/IterableWeakMap.spec.ts +284 -0
  305. package/test/appHost.mock.ts +58 -0
  306. package/test/appHost.spec.ts +1629 -0
  307. package/test/customExtensionSlot.spec.ts +153 -0
  308. package/test/extensionSlot.spec.ts +94 -0
  309. package/test/installedShellsState.spec.ts +39 -0
  310. package/test/interceptAnyObject.spec.ts +217 -0
  311. package/test/interceptEntryPoints.spec.ts +291 -0
  312. package/test/loggers.spec.ts +288 -0
  313. package/test/repluggableAppDebug.spec.ts +118 -0
  314. package/test/testKit.spec.tsx +153 -0
  315. package/testKit/emptyLoggerOptions.ts +16 -0
  316. package/testKit/index.ts +172 -0
  317. package/testKit/mockPackage.ts +99 -0
  318. package/testKit/package.json +3 -0
  319. package/testKit/withConsoleErrors.ts +12 -0
  320. package/testKit/withThrowOnError.ts +34 -0
  321. package/tsconfig.json +11 -1
  322. package/dist/es/API.d.ts.map +0 -1
  323. package/dist/es/API.js +0 -2
  324. package/dist/es/API.js.map +0 -1
  325. package/dist/es/index.d.ts +0 -2
  326. package/dist/es/index.d.ts.map +0 -1
  327. package/dist/es/index.js +0 -2
  328. package/dist/es/index.js.map +0 -1
package/src/API.ts CHANGED
@@ -1,8 +1,22 @@
1
- import * as Redux from 'redux'
1
+ import * as Redux from "redux";
2
+
3
+ import { ThrottledStore } from "./throttledStore";
4
+
5
+ export type ScopedStore<S> = Pick<
6
+ ThrottledStore<S>,
7
+ | "dispatch"
8
+ | "getState"
9
+ | "subscribe"
10
+ | "flush"
11
+ | "hasPendingSubscribers"
12
+ | "deferSubscriberNotifications"
13
+ >;
14
+
15
+ export { AppHostAPI } from "./appHostServices";
2
16
 
3
17
  export interface AnySlotKey {
4
- readonly name: string
5
- readonly public?: boolean // TODO: Move to new interface - APIKey
18
+ readonly name: string;
19
+ readonly public?: boolean; // TODO: Move to new interface - APIKey
6
20
  }
7
21
 
8
22
  /**
@@ -16,94 +30,98 @@ export interface AnySlotKey {
16
30
  * @template T
17
31
  */
18
32
  export interface SlotKey<T> extends AnySlotKey {
19
- /**
20
- * Holds no value, only triggers type-checking of T
21
- */
22
- readonly empty?: T
23
- /**
24
- * Application layer/layers that will restrict usage of APIs contributed by this entry point.
25
- * Layers hierarchy is defined in the host options
26
- * @See {AppHostOptions.layers}
27
- */
28
- readonly layer?: string | string[] // TODO: Move to new interface - APIKey
29
- /**
30
- * Version of the API that will be part of the API key unique identification
31
- */
32
- readonly version?: number // TODO: Move to new interface - APIKey
33
+ /**
34
+ * Holds no value, only triggers type-checking of T
35
+ */
36
+ readonly empty?: T;
37
+ /**
38
+ * Application layer/layers that will restrict usage of APIs contributed by this entry point.
39
+ * Layers hierarchy is defined in the host options
40
+ * @See {AppHostOptions.layers}
41
+ */
42
+ readonly layer?: string | string[]; // TODO: Move to new interface - APIKey
43
+ /**
44
+ * Version of the API that will be part of the API key unique identification
45
+ */
46
+ readonly version?: number; // TODO: Move to new interface - APIKey
33
47
  }
34
48
 
35
- export type ReactComponentContributor<TProps = {}> = (props?: TProps) => React.ReactNode
36
- export type ReducersMapObjectContributor<TState = {}, TAction extends Redux.AnyAction = Redux.AnyAction> = () => Redux.ReducersMapObject<
37
- TState,
38
- TAction
39
- >
40
- export type ContributionPredicate = () => boolean
49
+ export type ReactComponentContributor<TProps = {}> = (
50
+ props?: TProps
51
+ ) => React.ReactNode;
52
+ export type ReducersMapObjectContributor<
53
+ TState = {},
54
+ TAction extends Redux.AnyAction = Redux.AnyAction
55
+ > = () => Redux.ReducersMapObject<TState, TAction>;
56
+ export type ContributionPredicate = () => boolean;
41
57
  export interface EntryPointTags {
42
- [name: string]: string
58
+ [name: string]: string;
43
59
  }
44
- export type LazyEntryPointFactory = () => Promise<EntryPoint> //TODO: get rid of these
45
- export type ShellsChangedCallback = (shellNames: string[]) => void
46
- export type ShellBoundaryAspect = React.FunctionComponent<React.PropsWithChildren<unknown>>
60
+ export type LazyEntryPointFactory = () => Promise<EntryPoint>; //TODO: get rid of these
61
+ export type ShellsChangedCallback = (shellNames: string[]) => void;
62
+ export type ShellBoundaryAspect = React.FunctionComponent<
63
+ React.PropsWithChildren<unknown>
64
+ >;
47
65
 
48
66
  export interface LazyEntryPointDescriptor {
49
- readonly name: string
50
- readonly factory: LazyEntryPointFactory
67
+ readonly name: string;
68
+ readonly factory: LazyEntryPointFactory;
51
69
  }
52
70
 
53
-
54
-
55
71
  /**
56
72
  * Application part that will receive a {Shell} when loaded into the {AppHost}
57
73
  * @export
58
74
  * @interface EntryPoint
59
75
  */
60
76
  export interface EntryPoint {
61
- /**
62
- * Unique name that will represent this entry point in the host
63
- */
64
- readonly name: string
65
- readonly tags?: EntryPointTags
66
- /**
67
- * Application layer / layers that will restrict usage of APIs contributed by this entry point.
68
- * Layers hierarchy is defined in the host options
69
- * See {AppHostOptions.layers}
70
- */
71
- readonly layer?: string | string[]
72
- /**
73
- * Define which API keys (a.k.a. contracts) are mandatory for this entry point to be executed
74
- * @return {SlotKey<any>[]} API keys to wait for implementation
75
- */
76
- getDependencyAPIs?(): SlotKey<any>[]
77
- /**
78
- * Define which API keys (a.k.a. contracts) this entry point is going to implement and contribute
79
- * @return {SlotKey<any>[]} API keys that will be contributed
80
- */
81
- declareAPIs?(): SlotKey<any>[]
82
- /**
83
- * Execute logic that is independent from other entry points
84
- * Most commonly - contribute APIs and state
85
- * @param {Shell} shell
86
- */
87
- attach?(shell: Shell): void
88
- /**
89
- * Execute logic that is dependent on other entry points
90
- * @param {Shell} shell
91
- */
92
- extend?(shell: Shell): void
93
- /**
94
- * Clean side effects
95
- * @param {Shell} shell
96
- */
97
- detach?(shell: Shell): void
77
+ /**
78
+ * Unique name that will represent this entry point in the host
79
+ */
80
+ readonly name: string;
81
+ readonly tags?: EntryPointTags;
82
+ /**
83
+ * Application layer / layers that will restrict usage of APIs contributed by this entry point.
84
+ * Layers hierarchy is defined in the host options
85
+ * See {AppHostOptions.layers}
86
+ */
87
+ readonly layer?: string | string[];
88
+ /**
89
+ * Define which API keys (a.k.a. contracts) are mandatory for this entry point to be executed
90
+ * @return {SlotKey<any>[]} API keys to wait for implementation
91
+ */
92
+ getDependencyAPIs?(): SlotKey<any>[];
93
+ /**
94
+ * Define which API keys (a.k.a. contracts) this entry point is going to implement and contribute
95
+ * @return {SlotKey<any>[]} API keys that will be contributed
96
+ */
97
+ declareAPIs?(): SlotKey<any>[];
98
+ /**
99
+ * Execute logic that is independent from other entry points
100
+ * Most commonly - contribute APIs and state
101
+ * @param {Shell} shell
102
+ */
103
+ attach?(shell: Shell): void;
104
+ /**
105
+ * Execute logic that is dependent on other entry points
106
+ * @param {Shell} shell
107
+ */
108
+ extend?(shell: Shell): void;
109
+ /**
110
+ * Clean side effects
111
+ * @param {Shell} shell
112
+ */
113
+ detach?(shell: Shell): void;
98
114
  }
99
115
 
100
- export type AnyEntryPoint = EntryPoint | LazyEntryPointDescriptor
101
- export type EntryPointOrPackage = AnyEntryPoint | AnyEntryPoint[]
116
+ export type AnyEntryPoint = EntryPoint | LazyEntryPointDescriptor;
117
+ export type EntryPointOrPackage = AnyEntryPoint | AnyEntryPoint[];
102
118
  export interface EntryPointOrPackagesMap {
103
- [name: string]: EntryPointOrPackage
119
+ [name: string]: EntryPointOrPackage;
104
120
  }
105
121
 
106
- export type ExtensionItemFilter<T> = (extensionItem: ExtensionItem<T>) => boolean
122
+ export type ExtensionItemFilter<T> = (
123
+ extensionItem: ExtensionItem<T>
124
+ ) => boolean;
107
125
  /**
108
126
  * A slot/container for holding any contribution of shape T
109
127
  * Access to the slot is scoped to the {Shell}
@@ -113,64 +131,68 @@ export type ExtensionItemFilter<T> = (extensionItem: ExtensionItem<T>) => boolea
113
131
  * @template T
114
132
  */
115
133
  export interface ExtensionSlot<T> {
116
- /**
117
- * a unique identifier for the slot
118
- */
119
- readonly name: string
120
- readonly host: AppHost
121
- /**
122
- * Which {Shell} owns this slot
123
- */
124
- readonly declaringShell?: Shell
125
- /**
126
- * Add an item to the slot
127
- *
128
- * @param {Shell} shell Who owns the contributed item
129
- * @param {T} item Extension item to be added to the slot
130
- * @param {ContributionPredicate} [condition] A predicate to condition the retrieval of the item when slot items are requested with {ExtensionSlot<T>.getItems}
131
- */
132
- contribute(shell: Shell, item: T, condition?: ContributionPredicate): void
133
- /**
134
- * Get all items contributed to the slot
135
- *
136
- * @param {boolean} [forceAll] Ignore items' contribution predicates and get all anyway
137
- * @return {ExtensionItem<T>[]} All items contributed to the slot
138
- */
139
- getItems(forceAll?: boolean): ExtensionItem<T>[]
140
- /**
141
- * Get the first item in the slot
142
- *
143
- * @return {ExtensionItem<T>} The first item in the slot
144
- */
145
- getSingleItem(): ExtensionItem<T> | undefined
146
- /**
147
- * Get a specific item in the slot
148
- *
149
- * @param {string} name Extension item name
150
- * @return {ExtensionItem<T> | undefined} Extension item
151
- */
152
- getItemByName(name: string): ExtensionItem<T> | undefined
153
- /**
154
- * Remove items from the slot by predicate
155
- *
156
- * @param {ExtensionItemFilter<T> | undefined} predicate Remove all items matching this predicate
157
- */
158
- discardBy(predicate: ExtensionItemFilter<T>): void
134
+ /**
135
+ * a unique identifier for the slot
136
+ */
137
+ readonly name: string;
138
+ readonly host: AppHost;
139
+ /**
140
+ * Which {Shell} owns this slot
141
+ */
142
+ readonly declaringShell?: Shell;
143
+ /**
144
+ * Add an item to the slot
145
+ *
146
+ * @param {Shell} shell Who owns the contributed item
147
+ * @param {T} item Extension item to be added to the slot
148
+ * @param {ContributionPredicate} [condition] A predicate to condition the retrieval of the item when slot items are requested with {ExtensionSlot<T>.getItems}
149
+ */
150
+ contribute(shell: Shell, item: T, condition?: ContributionPredicate): void;
151
+ /**
152
+ * Get all items contributed to the slot
153
+ *
154
+ * @param {boolean} [forceAll] Ignore items' contribution predicates and get all anyway
155
+ * @return {ExtensionItem<T>[]} All items contributed to the slot
156
+ */
157
+ getItems(forceAll?: boolean): ExtensionItem<T>[];
158
+ /**
159
+ * Get the first item in the slot
160
+ *
161
+ * @return {ExtensionItem<T>} The first item in the slot
162
+ */
163
+ getSingleItem(): ExtensionItem<T> | undefined;
164
+ /**
165
+ * Get a specific item in the slot
166
+ *
167
+ * @param {string} name Extension item name
168
+ * @return {ExtensionItem<T> | undefined} Extension item
169
+ */
170
+ getItemByName(name: string): ExtensionItem<T> | undefined;
171
+ /**
172
+ * Remove items from the slot by predicate
173
+ *
174
+ * @param {ExtensionItemFilter<T> | undefined} predicate Remove all items matching this predicate
175
+ */
176
+ discardBy(predicate: ExtensionItemFilter<T>): void;
159
177
  }
160
178
 
161
179
  export interface PrivateExtensionSlot<T> extends ExtensionSlot<T> {
162
- subscribe(callback: () => void): () => void
180
+ subscribe(callback: () => void): () => void;
163
181
  }
164
182
 
165
183
  export interface CustomExtensionSlotHandler<T> {
166
- contribute(fromShell: Shell, item: T, condition?: ContributionPredicate): void
167
- discardBy(predicate: ExtensionItemFilter<T>): void
184
+ contribute(
185
+ fromShell: Shell,
186
+ item: T,
187
+ condition?: ContributionPredicate
188
+ ): void;
189
+ discardBy(predicate: ExtensionItemFilter<T>): void;
168
190
  }
169
191
 
170
192
  export interface CustomExtensionSlot<T> extends CustomExtensionSlotHandler<T> {
171
- readonly name: string
172
- readonly host: AppHost
173
- readonly declaringShell?: Shell
193
+ readonly name: string;
194
+ readonly host: AppHost;
195
+ readonly declaringShell?: Shell;
174
196
  }
175
197
 
176
198
  /**
@@ -181,20 +203,20 @@ export interface CustomExtensionSlot<T> extends CustomExtensionSlotHandler<T> {
181
203
  * @template T
182
204
  */
183
205
  export interface ExtensionItem<T> {
184
- readonly name?: string
185
- /**
186
- * Which {Shell} owns this item
187
- */
188
- readonly shell: Shell
189
- /**
190
- * Contribution content
191
- */
192
- readonly contribution: T
193
- /**
194
- * Condition for the retrieval of this item by {ExtensionSlot<T>.getItems}
195
- */
196
- readonly condition: ContributionPredicate
197
- readonly uniqueId: string
206
+ readonly name?: string;
207
+ /**
208
+ * Which {Shell} owns this item
209
+ */
210
+ readonly shell: Shell;
211
+ /**
212
+ * Contribution content
213
+ */
214
+ readonly contribution: T;
215
+ /**
216
+ * Condition for the retrieval of this item by {ExtensionSlot<T>.getItems}
217
+ */
218
+ readonly condition: ContributionPredicate;
219
+ readonly uniqueId: string;
198
220
  }
199
221
 
200
222
  // addEntryPoints(entryPoints: EntryPoint[])
@@ -208,130 +230,143 @@ export interface ExtensionItem<T> {
208
230
  * @interface AppHost
209
231
  */
210
232
  export interface AppHost {
211
- /**
212
- * Get an implementation of API previously contributed to the {AppHost}
213
- *
214
- * @template TAPI
215
- * @param {SlotKey<TAPI>} key API Key
216
- * @return {*} {TAPI}
217
- */
218
- getAPI<TAPI>(key: SlotKey<TAPI>): TAPI
219
- /**
220
- * Get an extension slot defined on the host
221
- *
222
- * @template TItem
223
- * @param {SlotKey<TItem>} key
224
- * @return {ExtensionSlot<TItem>}
225
- */
226
- getSlot<TItem>(key: SlotKey<TItem>): ExtensionSlot<TItem>
227
- /**
228
- * Get all the extension slots defined on the host
229
- *
230
- * @return {*} {AnySlotKey[]}
231
- */
232
- getAllSlotKeys(): AnySlotKey[]
233
- /**
234
- * Get all {EntryPoint}s addded to the {AppHost}
235
- *
236
- * @return {EntryPointsInfo[]}
237
- */
238
- getAllEntryPoints(): EntryPointsInfo[]
239
- /**
240
- * Does the {AppHost} contain a specific {Shell}
241
- *
242
- * @param {string} name
243
- * @return {boolean}
244
- */
245
- hasShell(name: string): boolean
246
- // TODO: Deprecate
247
- isLazyEntryPoint(name: string): boolean
248
- /**
249
- * Dynamically add {Shell}s after the host is created
250
- *
251
- * @param {EntryPointOrPackage[]} entryPointsOrPackages New packages or entry points to be added to the {AppHost}
252
- * @return {Promise<void>}
253
- */
254
- addShells(entryPointsOrPackages: EntryPointOrPackage[]): Promise<void>
255
- /**
256
- * Dynamically remove {Shell}s after the host is created
257
- *
258
- * @param {string[]} names {Shell} names to be removed
259
- * @return {Promise<void>}
260
- */
261
- removeShells(names: string[]): Promise<void>
262
- onShellsChanged(callback: ShellsChangedCallback): string
263
- removeShellsChangedCallback(callbackId: string): void
264
- readonly log: HostLogger
265
- readonly options: AppHostOptions
233
+ /**
234
+ * Get the root store of the application
235
+ *
236
+ * @return {ThrottledStore}
237
+ */
238
+ getStore(): ThrottledStore;
239
+ /**
240
+ * Get an implementation of API previously contributed to the {AppHost}
241
+ *
242
+ * @template TAPI
243
+ * @param {SlotKey<TAPI>} key API Key
244
+ * @return {*} {TAPI}
245
+ */
246
+ getAPI<TAPI>(key: SlotKey<TAPI>): TAPI;
247
+ /**
248
+ * Get an extension slot defined on the host
249
+ *
250
+ * @template TItem
251
+ * @param {SlotKey<TItem>} key
252
+ * @return {ExtensionSlot<TItem>}
253
+ */
254
+ getSlot<TItem>(key: SlotKey<TItem>): ExtensionSlot<TItem>;
255
+ /**
256
+ * Get all the extension slots defined on the host
257
+ *
258
+ * @return {*} {AnySlotKey[]}
259
+ */
260
+ getAllSlotKeys(): AnySlotKey[];
261
+ /**
262
+ * Get all {EntryPoint}s addded to the {AppHost}
263
+ *
264
+ * @return {EntryPointsInfo[]}
265
+ */
266
+ getAllEntryPoints(): EntryPointsInfo[];
267
+ /**
268
+ * Does the {AppHost} contain a specific {Shell}
269
+ *
270
+ * @param {string} name
271
+ * @return {boolean}
272
+ */
273
+ hasShell(name: string): boolean;
274
+ // TODO: Deprecate
275
+ isLazyEntryPoint(name: string): boolean;
276
+ /**
277
+ * Dynamically add {Shell}s after the host is created
278
+ *
279
+ * @param {EntryPointOrPackage[]} entryPointsOrPackages New packages or entry points to be added to the {AppHost}
280
+ * @return {Promise<void>}
281
+ */
282
+ addShells(entryPointsOrPackages: EntryPointOrPackage[]): Promise<void>;
283
+ /**
284
+ * Dynamically remove {Shell}s after the host is created
285
+ *
286
+ * @param {string[]} names {Shell} names to be removed
287
+ * @return {Promise<void>}
288
+ */
289
+ removeShells(names: string[]): Promise<void>;
290
+ onShellsChanged(callback: ShellsChangedCallback): string;
291
+ removeShellsChangedCallback(callbackId: string): void;
292
+ readonly log: HostLogger;
293
+ readonly options: AppHostOptions;
266
294
  }
267
295
 
268
296
  export interface PrivateAppHost extends AppHost {
269
- executeWhenFree(identifier: string, callback: () => void): void
297
+ executeWhenFree(identifier: string, callback: () => void): void;
270
298
  }
271
299
 
272
300
  export interface MonitoringOptions {
273
- enablePerformance?: boolean
274
- readonly disableMonitoring?: boolean
275
- readonly disableMemoization?: boolean
276
- readonly debugMemoization?: boolean
301
+ enablePerformance?: boolean;
302
+ readonly disableMonitoring?: boolean;
303
+ readonly disableMemoization?: boolean;
304
+ readonly debugMemoization?: boolean;
277
305
  }
278
306
 
279
307
  export interface Trace {
280
- name: string
281
- duration: number
282
- startTime: number
283
- res: any
284
- args: any[]
308
+ name: string;
309
+ duration: number;
310
+ startTime: number;
311
+ res: any;
312
+ args: any[];
285
313
  }
286
314
 
287
315
  export interface APILayer {
288
- level: number
289
- name: string
316
+ level: number;
317
+ name: string;
290
318
  }
291
319
 
292
320
  export interface AppHostOptions {
293
- readonly logger?: HostLogger
294
- readonly monitoring: MonitoringOptions
295
- readonly layers?: APILayer[] | APILayer[][]
296
- readonly disableLayersValidation?: boolean
297
- readonly disableCheckCircularDependencies?: boolean
298
- readonly enableStickyErrorBoundaries?: boolean
299
- readonly enableReduxDevtoolsExtension?: boolean
300
- readonly experimentalCyclicMode?: boolean
301
- readonly shouldScopeReducers?: boolean
321
+ readonly logger?: HostLogger;
322
+ readonly monitoring: MonitoringOptions;
323
+ readonly layers?: APILayer[] | APILayer[][];
324
+ readonly disableLayersValidation?: boolean;
325
+ readonly disableCheckCircularDependencies?: boolean;
326
+ readonly enableStickyErrorBoundaries?: boolean;
327
+ readonly enableReduxDevtoolsExtension?: boolean;
328
+ readonly experimentalCyclicMode?: boolean;
329
+ readonly shouldScopeReducers?: boolean;
302
330
  }
303
331
 
304
332
  export interface MemoizeMissHit {
305
- miss: number
306
- calls: number
307
- hit: number
308
- printHitMiss(): void
333
+ miss: number;
334
+ calls: number;
335
+ hit: number;
336
+ printHitMiss(): void;
309
337
  }
310
338
 
311
- export type enrichedMemoizationFunction = MemoizeMissHit & AnyFunction & _.MemoizedFunction
339
+ export type enrichedMemoizationFunction = MemoizeMissHit &
340
+ AnyFunction &
341
+ _.MemoizedFunction;
312
342
 
313
343
  export interface StatisticsMemoization {
314
- func: enrichedMemoizationFunction
315
- name: string
344
+ func: enrichedMemoizationFunction;
345
+ name: string;
316
346
  }
317
347
 
318
348
  export interface ContributeAPIOptions<TAPI> {
319
- includesNamespaces?: boolean
320
- disableMonitoring?: boolean | (keyof TAPI)[]
349
+ includesNamespaces?: boolean;
350
+ disableMonitoring?: boolean | (keyof TAPI)[];
321
351
  }
322
352
 
323
- export type StateObserverUnsubscribe = () => void
324
- export type StateObserver<TSelectorAPI> = (next: TSelectorAPI) => void
353
+ export type StateObserverUnsubscribe = () => void;
354
+ export type StateObserver<TSelectorAPI> = (next: TSelectorAPI) => void;
325
355
  export interface ObservableState<TSelectorAPI> {
326
- subscribe(fromShell: Shell, callback: StateObserver<TSelectorAPI>): StateObserverUnsubscribe
327
- current(allowUnsafeReading?: boolean): TSelectorAPI
356
+ subscribe(
357
+ fromShell: Shell,
358
+ callback: StateObserver<TSelectorAPI>
359
+ ): StateObserverUnsubscribe;
360
+ current(allowUnsafeReading?: boolean): TSelectorAPI;
328
361
  }
329
362
 
330
- export type AnyFunction = (...args: any[]) => any
331
- export type FunctionWithSameArgs<F extends AnyFunction> = (...args: Parameters<F>) => any
363
+ export type AnyFunction = (...args: any[]) => any;
364
+ export type FunctionWithSameArgs<F extends AnyFunction> = (
365
+ ...args: Parameters<F>
366
+ ) => any;
332
367
 
333
368
  export interface Lazy<T> {
334
- get(): T
369
+ get(): T;
335
370
  }
336
371
 
337
372
  /**
@@ -342,174 +377,235 @@ export interface Lazy<T> {
342
377
  * @interface Shell
343
378
  * @extends {(Pick<AppHost, Exclude<keyof AppHost, 'getStore' | 'log' | 'options'>>)}
344
379
  */
345
- export interface Shell extends Pick<AppHost, Exclude<keyof AppHost, 'getStore' | 'log' | 'options'>> {
346
- /**
347
- * Are APIs ready to be requested
348
- *
349
- * @return {*} {boolean}
350
- */
351
- canUseAPIs(): boolean
352
- /**
353
- * Is store ready to be requested
354
- *
355
- * @return {*} {boolean}
356
- */
357
- canUseStore(): boolean
358
- /**
359
- * Did the execution of {EntryPoint}s' lifecycle phases (attach, detach) are done
360
- *
361
- * @return {*} {boolean}
362
- */
363
- wasInitializationCompleted(): boolean
364
- runLateInitializer<T>(initializer: () => T): T
365
- /**
366
- * Create an {ExtensionSlot}
367
- *
368
- * @template TItem
369
- * @param {SlotKey<TItem>} key Key that will represent the slot (an will be used for retrieval)
370
- * @return {ExtensionSlot<TItem>} Actual slot
371
- */
372
- declareSlot<TItem>(key: SlotKey<TItem>): ExtensionSlot<TItem>
373
- declareCustomSlot<TItem>(key: SlotKey<TItem>, handler: CustomExtensionSlotHandler<TItem>): CustomExtensionSlot<TItem>
374
-
375
- // TODO: Fix contributeAPI factory type not to resort to lowest common
376
- /**
377
- * Contribute an implementation of an API (a.k.a contract)
378
- *
379
- * @template TAPI
380
- * @param {SlotKey<TAPI>} key API Key that represents an interface TAPI
381
- * @param {() => TAPI} factory Create an implementation of TAPI
382
- * @param {ContributeAPIOptions<TAPI>} [options] Contribution options {ContributeAPIOptions}
383
- * @return {TAPI} Result of the factory execution
384
- */
385
- contributeAPI<TAPI>(key: SlotKey<TAPI>, factory: () => TAPI, options?: ContributeAPIOptions<TAPI>): TAPI
386
- /**
387
- * Contribute a Redux reducer that will be added to the host store.
388
- * Use it for slowly changing state (e.g. not changing because of mouse movement)
389
- *
390
- * @template TState
391
- * @param {ReducersMapObjectContributor<TState>} contributor
392
- */
393
- contributeState<TState, TAction extends Redux.AnyAction = Redux.AnyAction>(
394
- contributor: ReducersMapObjectContributor<TState, TAction>
395
- ): void
396
-
397
- /**
398
- * Contribute a Redux reducer that will be added to the host store
399
- * Use it for rapidly changing state (e.g. changing on every mouse movement event)
400
- * Changes to this state won't trigger the usual subscribers.
401
- * In order to subscribe to changes in this state, use the observer object returned by this function.
402
- *
403
- * @template TState
404
- * @param {ReducersMapObjectContributor<TState>} contributor
405
- * @return {TAPI} Observer object for subscribing to state changes. The observer can also be passed to {connectWithShell}.
406
- */
407
- contributeObservableState<TState, TSelector, TAction extends Redux.AnyAction = Redux.AnyAction>(
408
- contributor: ReducersMapObjectContributor<TState, TAction>,
409
- selectorFactory: (state: TState) => TSelector
410
- ): ObservableState<TSelector>
411
-
412
- /**
413
- * Contribute the main view (root) of the application
414
- * Intended to be used by a single {Shell} in an application
415
- *
416
- * @param {Shell} fromShell Who owns the main view
417
- * @param {ReactComponentContributor} contributor Create the main view component
418
- */
419
- contributeMainView(fromShell: Shell, contributor: ReactComponentContributor): void
420
- contributeBoundaryAspect(component: ShellBoundaryAspect): void
421
- /**
422
- * Create a function with internal cache until any state change in the {AppHost} store
423
- *
424
- * @template T
425
- * @param {T} func Function to build cache for
426
- * @param {FunctionWithSameArgs<T>} resolver Key creator to index results by
427
- * @param {() => boolean} [shouldClear] Custom clear condition (if not provided, behaves like () => true)
428
- * @return {*} {(((...args: Parameters<T>) => ReturnType<T>) & Partial<_.MemoizedFunction> & Partial<MemoizeMissHit>)}
429
- */
430
- memoizeForState<T extends AnyFunction>(
431
- func: T,
432
- resolver: FunctionWithSameArgs<T>,
433
- shouldClear?: () => boolean
434
- ): ((...args: Parameters<T>) => ReturnType<T>) & Partial<_.MemoizedFunction> & Partial<MemoizeMissHit>
435
- /**
436
- * Manually trigger clear condition for function memoized with {Shell.memoizeForState}
437
- */
438
- flushMemoizedForState(): void
439
- /**
440
- * Create a function with internal cache
441
- *
442
- * @template T
443
- * @param {T} func Function to build cache for
444
- * @param {FunctionWithSameArgs<T>} resolver Key creator to index results by
445
- * @return {*} {(((...args: Parameters<T>) => ReturnType<T>) & Partial<_.MemoizedFunction> & Partial<MemoizeMissHit>)}
446
- */
447
- memoize<T extends AnyFunction>(
448
- func: T,
449
- resolver: FunctionWithSameArgs<T>
450
- ): ((...args: Parameters<T>) => ReturnType<T>) & Partial<_.MemoizedFunction> & Partial<MemoizeMissHit>
451
- /**
452
- * Clear cache of a memoized function
453
- *
454
- * @param {(Partial<_.MemoizedFunction> & Partial<MemoizeMissHit>)} memoizedFunction
455
- */
456
- clearCache(memoizedFunction: Partial<_.MemoizedFunction> & Partial<MemoizeMissHit>): void
457
- /**
458
- * Creates a lazy-evaluated value. The function `func` is only executed once when `get` is called for the first time,
459
- * and the result is cached for subsequent calls.
460
- *
461
- * @template T
462
- * @param {F} func - The function that will be lazily evaluated. It should not take any arguments.
463
- * @returns {Lazy<T>} An object with a `get` method that returns the lazily evaluated value of type `T`.
464
- */
465
- lazyEvaluator<F extends AnyFunction, T extends ReturnType<F>>(func: F): Lazy<T>
380
+ export interface Shell
381
+ extends Pick<
382
+ AppHost,
383
+ Exclude<keyof AppHost, "getStore" | "log" | "options">
384
+ > {
385
+ /**
386
+ * Unique name of the matching {EntryPoint}
387
+ */
388
+ readonly name: string;
389
+ readonly log: ShellLogger;
390
+ /**
391
+ * Get store that is scoped for this {Shell}
392
+ *
393
+ * @template TState
394
+ * @return {ScopedStore<TState>} Scoped store for this {Shell}
395
+ */
396
+ getStore<TState>(): ScopedStore<TState>;
397
+ /**
398
+ * Are APIs ready to be requested
399
+ *
400
+ * @return {*} {boolean}
401
+ */
402
+ canUseAPIs(): boolean;
403
+ /**
404
+ * Is store ready to be requested
405
+ *
406
+ * @return {*} {boolean}
407
+ */
408
+ canUseStore(): boolean;
409
+ /**
410
+ * Did the execution of {EntryPoint}s' lifecycle phases (attach, detach) are done
411
+ *
412
+ * @return {*} {boolean}
413
+ */
414
+ wasInitializationCompleted(): boolean;
415
+ runLateInitializer<T>(initializer: () => T): T;
416
+ /**
417
+ * Create an {ExtensionSlot}
418
+ *
419
+ * @template TItem
420
+ * @param {SlotKey<TItem>} key Key that will represent the slot (an will be used for retrieval)
421
+ * @return {ExtensionSlot<TItem>} Actual slot
422
+ */
423
+ declareSlot<TItem>(key: SlotKey<TItem>): ExtensionSlot<TItem>;
424
+ declareCustomSlot<TItem>(
425
+ key: SlotKey<TItem>,
426
+ handler: CustomExtensionSlotHandler<TItem>
427
+ ): CustomExtensionSlot<TItem>;
428
+
429
+ // TODO: Fix contributeAPI factory type not to resort to lowest common
430
+ /**
431
+ * Contribute an implementation of an API (a.k.a contract)
432
+ *
433
+ * @template TAPI
434
+ * @param {SlotKey<TAPI>} key API Key that represents an interface TAPI
435
+ * @param {() => TAPI} factory Create an implementation of TAPI
436
+ * @param {ContributeAPIOptions<TAPI>} [options] Contribution options {ContributeAPIOptions}
437
+ * @return {TAPI} Result of the factory execution
438
+ */
439
+ contributeAPI<TAPI>(
440
+ key: SlotKey<TAPI>,
441
+ factory: () => TAPI,
442
+ options?: ContributeAPIOptions<TAPI>
443
+ ): TAPI;
444
+ /**
445
+ * Contribute a Redux reducer that will be added to the host store.
446
+ * Use it for slowly changing state (e.g. not changing because of mouse movement)
447
+ *
448
+ * @template TState
449
+ * @param {ReducersMapObjectContributor<TState>} contributor
450
+ */
451
+ contributeState<TState, TAction extends Redux.AnyAction = Redux.AnyAction>(
452
+ contributor: ReducersMapObjectContributor<TState, TAction>
453
+ ): void;
454
+
455
+ /**
456
+ * Contribute a Redux reducer that will be added to the host store
457
+ * Use it for rapidly changing state (e.g. changing on every mouse movement event)
458
+ * Changes to this state won't trigger the usual subscribers.
459
+ * In order to subscribe to changes in this state, use the observer object returned by this function.
460
+ *
461
+ * @template TState
462
+ * @param {ReducersMapObjectContributor<TState>} contributor
463
+ * @return {TAPI} Observer object for subscribing to state changes. The observer can also be passed to {connectWithShell}.
464
+ */
465
+ contributeObservableState<
466
+ TState,
467
+ TSelector,
468
+ TAction extends Redux.AnyAction = Redux.AnyAction
469
+ >(
470
+ contributor: ReducersMapObjectContributor<TState, TAction>,
471
+ selectorFactory: (state: TState) => TSelector
472
+ ): ObservableState<TSelector>;
473
+
474
+ /**
475
+ * Contribute the main view (root) of the application
476
+ * Intended to be used by a single {Shell} in an application
477
+ *
478
+ * @param {Shell} fromShell Who owns the main view
479
+ * @param {ReactComponentContributor} contributor Create the main view component
480
+ */
481
+ contributeMainView(
482
+ fromShell: Shell,
483
+ contributor: ReactComponentContributor
484
+ ): void;
485
+ contributeBoundaryAspect(component: ShellBoundaryAspect): void;
486
+ /**
487
+ * Create a function with internal cache until any state change in the {AppHost} store
488
+ *
489
+ * @template T
490
+ * @param {T} func Function to build cache for
491
+ * @param {FunctionWithSameArgs<T>} resolver Key creator to index results by
492
+ * @param {() => boolean} [shouldClear] Custom clear condition (if not provided, behaves like () => true)
493
+ * @return {*} {(((...args: Parameters<T>) => ReturnType<T>) & Partial<_.MemoizedFunction> & Partial<MemoizeMissHit>)}
494
+ */
495
+ memoizeForState<T extends AnyFunction>(
496
+ func: T,
497
+ resolver: FunctionWithSameArgs<T>,
498
+ shouldClear?: () => boolean
499
+ ): ((...args: Parameters<T>) => ReturnType<T>) &
500
+ Partial<_.MemoizedFunction> &
501
+ Partial<MemoizeMissHit>;
502
+ /**
503
+ * Manually trigger clear condition for function memoized with {Shell.memoizeForState}
504
+ */
505
+ flushMemoizedForState(): void;
506
+ /**
507
+ * Create a function with internal cache
508
+ *
509
+ * @template T
510
+ * @param {T} func Function to build cache for
511
+ * @param {FunctionWithSameArgs<T>} resolver Key creator to index results by
512
+ * @return {*} {(((...args: Parameters<T>) => ReturnType<T>) & Partial<_.MemoizedFunction> & Partial<MemoizeMissHit>)}
513
+ */
514
+ memoize<T extends AnyFunction>(
515
+ func: T,
516
+ resolver: FunctionWithSameArgs<T>
517
+ ): ((...args: Parameters<T>) => ReturnType<T>) &
518
+ Partial<_.MemoizedFunction> &
519
+ Partial<MemoizeMissHit>;
520
+ /**
521
+ * Clear cache of a memoized function
522
+ *
523
+ * @param {(Partial<_.MemoizedFunction> & Partial<MemoizeMissHit>)} memoizedFunction
524
+ */
525
+ clearCache(
526
+ memoizedFunction: Partial<_.MemoizedFunction> & Partial<MemoizeMissHit>
527
+ ): void;
528
+ /**
529
+ * Creates a lazy-evaluated value. The function `func` is only executed once when `get` is called for the first time,
530
+ * and the result is cached for subsequent calls.
531
+ *
532
+ * @template T
533
+ * @param {F} func - The function that will be lazily evaluated. It should not take any arguments.
534
+ * @returns {Lazy<T>} An object with a `get` method that returns the lazily evaluated value of type `T`.
535
+ */
536
+ lazyEvaluator<F extends AnyFunction, T extends ReturnType<F>>(
537
+ func: F
538
+ ): Lazy<T>;
466
539
  }
467
540
 
468
541
  export interface PrivateShell extends Shell {
469
- readonly entryPoint: EntryPoint
470
- setDependencyAPIs(APIs: AnySlotKey[]): void
471
- setLifecycleState(enableStore: boolean, enableAPIs: boolean, initCompleted: boolean): void
472
- getBoundaryAspects(): ShellBoundaryAspect[]
473
- getHostOptions(): AppHostOptions
474
- wrapWithShellRenderer(component: JSX.Element): JSX.Element
542
+ readonly entryPoint: EntryPoint;
543
+ setDependencyAPIs(APIs: AnySlotKey[]): void;
544
+ setLifecycleState(
545
+ enableStore: boolean,
546
+ enableAPIs: boolean,
547
+ initCompleted: boolean
548
+ ): void;
549
+ getBoundaryAspects(): ShellBoundaryAspect[];
550
+ getHostOptions(): AppHostOptions;
551
+ getAppHost(): AppHost;
475
552
  }
476
553
 
477
554
  export interface EntryPointsInfo {
478
- readonly name: string
479
- readonly lazy: boolean
480
- readonly attached: boolean
555
+ readonly name: string;
556
+ readonly lazy: boolean;
557
+ readonly attached: boolean;
481
558
  }
482
559
 
483
560
  export interface EntryPointInterceptor {
484
- interceptName?(innerName: string): string
485
- interceptTags?(innerTags?: EntryPointTags): EntryPointTags
486
- interceptGetDependencyAPIs?(innerGetDependencyAPIs?: EntryPoint['getDependencyAPIs']): EntryPoint['getDependencyAPIs']
487
- interceptDeclareAPIs?(innerDeclareAPIs?: EntryPoint['declareAPIs']): EntryPoint['declareAPIs']
488
- interceptAttach?(innerAttach?: EntryPoint['attach']): EntryPoint['attach']
489
- interceptDetach?(innerDetach?: EntryPoint['detach']): EntryPoint['detach']
490
- interceptExtend?(innerExtend?: EntryPoint['extend']): EntryPoint['extend']
561
+ interceptName?(innerName: string): string;
562
+ interceptTags?(innerTags?: EntryPointTags): EntryPointTags;
563
+ interceptGetDependencyAPIs?(
564
+ innerGetDependencyAPIs?: EntryPoint["getDependencyAPIs"]
565
+ ): EntryPoint["getDependencyAPIs"];
566
+ interceptDeclareAPIs?(
567
+ innerDeclareAPIs?: EntryPoint["declareAPIs"]
568
+ ): EntryPoint["declareAPIs"];
569
+ interceptAttach?(innerAttach?: EntryPoint["attach"]): EntryPoint["attach"];
570
+ interceptDetach?(innerDetach?: EntryPoint["detach"]): EntryPoint["detach"];
571
+ interceptExtend?(innerExtend?: EntryPoint["extend"]): EntryPoint["extend"];
491
572
  }
492
573
 
493
- export type LogSeverity = 'debug' | 'info' | 'event' | 'warning' | 'error' | 'critical'
494
- export type LogSpanFlag = 'begin' | 'end' //TODO:deprecated-kept-for-backward-compat
574
+ export type LogSeverity =
575
+ | "debug"
576
+ | "info"
577
+ | "event"
578
+ | "warning"
579
+ | "error"
580
+ | "critical";
581
+ export type LogSpanFlag = "begin" | "end"; //TODO:deprecated-kept-for-backward-compat
495
582
 
496
583
  export interface HostLogger {
497
- log(severity: LogSeverity, id: string, error?: Error, keyValuePairs?: Object): void
498
- spanChild(messageId: string, keyValuePairs?: Object): ShellLoggerSpan
499
- spanRoot(messageId: string, keyValuePairs?: Object): ShellLoggerSpan
584
+ log(
585
+ severity: LogSeverity,
586
+ id: string,
587
+ error?: Error,
588
+ keyValuePairs?: Object
589
+ ): void;
590
+ spanChild(messageId: string, keyValuePairs?: Object): ShellLoggerSpan;
591
+ spanRoot(messageId: string, keyValuePairs?: Object): ShellLoggerSpan;
500
592
  }
501
593
 
502
594
  export interface ShellLogger extends HostLogger {
503
- debug(messageId: string, keyValuePairs?: Object): void
504
- info(messageId: string, keyValuePairs?: Object): void
505
- warning(messageId: string, keyValuePairs?: Object): void
506
- error(messageId: string, error?: Error, keyValuePairs?: Object): void
507
- critical(messageId: string, error?: Error, keyValuePairs?: Object): void
508
- spanChild(messageId: string, keyValuePairs?: Object): ShellLoggerSpan
509
- spanRoot(messageId: string, keyValuePairs?: Object): ShellLoggerSpan
510
- monitor<T>(messageId: string, keyValuePairs: Object, monitoredCode: () => T): T
595
+ debug(messageId: string, keyValuePairs?: Object): void;
596
+ info(messageId: string, keyValuePairs?: Object): void;
597
+ warning(messageId: string, keyValuePairs?: Object): void;
598
+ error(messageId: string, error?: Error, keyValuePairs?: Object): void;
599
+ critical(messageId: string, error?: Error, keyValuePairs?: Object): void;
600
+ spanChild(messageId: string, keyValuePairs?: Object): ShellLoggerSpan;
601
+ spanRoot(messageId: string, keyValuePairs?: Object): ShellLoggerSpan;
602
+ monitor<T>(
603
+ messageId: string,
604
+ keyValuePairs: Object,
605
+ monitoredCode: () => T
606
+ ): T;
511
607
  }
512
608
 
513
609
  export interface ShellLoggerSpan {
514
- end(success: boolean, error?: Error, keyValuePairs?: Object): void
610
+ end(success: boolean, error?: Error, keyValuePairs?: Object): void;
515
611
  }