@webiny/app 5.44.1-beta.0 → 5.45.0-beta.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 (427) hide show
  1. package/App.d.ts +5 -13
  2. package/App.js +70 -87
  3. package/App.js.map +1 -1
  4. package/AppContainer.d.ts +23 -0
  5. package/AppContainer.js +9 -0
  6. package/AppContainer.js.map +1 -0
  7. package/README.md +7 -15
  8. package/apollo-client/InMemoryCache.d.ts +3 -2
  9. package/apollo-client/InMemoryCache.js +16 -47
  10. package/apollo-client/InMemoryCache.js.map +1 -1
  11. package/apollo-client/IntrospectionFragmentMatcher.d.ts +2 -2
  12. package/apollo-client/IntrospectionFragmentMatcher.js +33 -50
  13. package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -1
  14. package/components/Image.d.ts +1 -2
  15. package/components/Image.js +11 -19
  16. package/components/Image.js.map +1 -1
  17. package/components/index.d.ts +1 -2
  18. package/components/index.js +1 -19
  19. package/components/index.js.map +1 -1
  20. package/config/RouterConfig/Route.d.ts +29 -0
  21. package/config/RouterConfig/Route.js +33 -0
  22. package/config/RouterConfig/Route.js.map +1 -0
  23. package/config/RouterConfig.d.ts +31 -0
  24. package/config/RouterConfig.js +18 -0
  25. package/config/RouterConfig.js.map +1 -0
  26. package/config.js +9 -15
  27. package/config.js.map +1 -1
  28. package/contexts/Ui/index.js +28 -52
  29. package/contexts/Ui/index.js.map +1 -1
  30. package/core/DebounceRender.js +13 -24
  31. package/core/DebounceRender.js.map +1 -1
  32. package/core/Plugin.d.ts +1 -1
  33. package/core/Plugin.js +11 -19
  34. package/core/Plugin.js.map +1 -1
  35. package/core/Plugins.d.ts +1 -1
  36. package/core/Plugins.js +20 -25
  37. package/core/Plugins.js.map +1 -1
  38. package/core/Provider.d.ts +1 -1
  39. package/core/Provider.js +9 -13
  40. package/core/Provider.js.map +1 -1
  41. package/core/Routes.d.ts +2 -1
  42. package/core/Routes.js +13 -23
  43. package/core/Routes.js.map +1 -1
  44. package/core/createProvider.d.ts +2 -2
  45. package/core/createProvider.js +1 -7
  46. package/core/createProvider.js.map +1 -1
  47. package/core/createProviderPlugin.d.ts +1 -1
  48. package/core/createProviderPlugin.js +4 -10
  49. package/core/createProviderPlugin.js.map +1 -1
  50. package/errors/AuthenticationErrorEvent.d.ts +9 -0
  51. package/errors/AuthenticationErrorEvent.js +10 -0
  52. package/errors/AuthenticationErrorEvent.js.map +1 -0
  53. package/errors/NetworkErrorEvent.d.ts +15 -0
  54. package/errors/NetworkErrorEvent.js +10 -0
  55. package/errors/NetworkErrorEvent.js.map +1 -0
  56. package/errors/abstractions.d.ts +12 -0
  57. package/errors/abstractions.js +5 -0
  58. package/errors/abstractions.js.map +1 -0
  59. package/errors/index.d.ts +6 -0
  60. package/errors/index.js +6 -0
  61. package/errors/index.js.map +1 -0
  62. package/exports/admin/envConfig.d.ts +1 -0
  63. package/exports/admin/envConfig.js +3 -0
  64. package/exports/admin/envConfig.js.map +1 -0
  65. package/exports/admin/graphqlClient.d.ts +1 -0
  66. package/exports/admin/graphqlClient.js +3 -0
  67. package/exports/admin/graphqlClient.js.map +1 -0
  68. package/exports/admin/localStorage.d.ts +2 -0
  69. package/exports/admin/localStorage.js +4 -0
  70. package/exports/admin/localStorage.js.map +1 -0
  71. package/exports/admin/router.d.ts +4 -0
  72. package/exports/admin/router.js +6 -0
  73. package/exports/admin/router.js.map +1 -0
  74. package/exports/admin/security.d.ts +1 -0
  75. package/exports/admin/security.js +3 -0
  76. package/exports/admin/security.js.map +1 -0
  77. package/exports/admin.d.ts +6 -0
  78. package/exports/admin.js +8 -0
  79. package/exports/admin.js.map +1 -0
  80. package/features/envConfig/EnvConfig.d.ts +6 -0
  81. package/features/envConfig/EnvConfig.js +14 -0
  82. package/features/envConfig/EnvConfig.js.map +1 -0
  83. package/features/envConfig/abstractions.d.ts +27 -0
  84. package/features/envConfig/abstractions.js +4 -0
  85. package/features/envConfig/abstractions.js.map +1 -0
  86. package/features/envConfig/feature.d.ts +17 -0
  87. package/features/envConfig/feature.js +14 -0
  88. package/features/envConfig/feature.js.map +1 -0
  89. package/features/envConfig/index.d.ts +1 -0
  90. package/features/envConfig/index.js +3 -0
  91. package/features/envConfig/index.js.map +1 -0
  92. package/features/eventPublisher/EventPublisher.d.ts +8 -0
  93. package/features/eventPublisher/EventPublisher.js +27 -0
  94. package/features/eventPublisher/EventPublisher.js.map +1 -0
  95. package/features/eventPublisher/abstractions.d.ts +18 -0
  96. package/features/eventPublisher/abstractions.js +14 -0
  97. package/features/eventPublisher/abstractions.js.map +1 -0
  98. package/features/eventPublisher/feature.d.ts +1 -0
  99. package/features/eventPublisher/feature.js +11 -0
  100. package/features/eventPublisher/feature.js.map +1 -0
  101. package/features/eventPublisher/index.d.ts +3 -0
  102. package/features/eventPublisher/index.js +4 -0
  103. package/features/eventPublisher/index.js.map +1 -0
  104. package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
  105. package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
  106. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
  107. package/features/graphqlClient/BatchingGraphQLClient.d.ts +18 -0
  108. package/features/graphqlClient/BatchingGraphQLClient.js +164 -0
  109. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
  110. package/features/graphqlClient/FetchGraphQLClient.d.ts +10 -0
  111. package/features/graphqlClient/FetchGraphQLClient.js +62 -0
  112. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
  113. package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
  114. package/features/graphqlClient/NetworkErrorPublishing.js +55 -0
  115. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
  116. package/features/graphqlClient/RequestValue.d.ts +20 -0
  117. package/features/graphqlClient/RequestValue.js +42 -0
  118. package/features/graphqlClient/RequestValue.js.map +1 -0
  119. package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
  120. package/features/graphqlClient/RetryGraphQLClient.js +54 -0
  121. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
  122. package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
  123. package/features/graphqlClient/__tests__/GraphQLClient.test.js +350 -0
  124. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
  125. package/features/graphqlClient/abstractions.d.ts +17 -0
  126. package/features/graphqlClient/abstractions.js +4 -0
  127. package/features/graphqlClient/abstractions.js.map +1 -0
  128. package/features/graphqlClient/feature.d.ts +6 -0
  129. package/features/graphqlClient/feature.js +31 -0
  130. package/features/graphqlClient/feature.js.map +1 -0
  131. package/features/graphqlClient/index.d.ts +1 -0
  132. package/features/graphqlClient/index.js +3 -0
  133. package/features/graphqlClient/index.js.map +1 -0
  134. package/features/graphqlClient/types.d.ts +5 -0
  135. package/features/graphqlClient/types.js +3 -0
  136. package/features/graphqlClient/types.js.map +1 -0
  137. package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
  138. package/features/localStorage/BrowserLocalStorageGateway.js +68 -0
  139. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
  140. package/features/localStorage/LocalStorage.d.ts +12 -0
  141. package/features/localStorage/LocalStorage.js +31 -0
  142. package/features/localStorage/LocalStorage.js.map +1 -0
  143. package/features/localStorage/LocalStorageRepository.d.ts +20 -0
  144. package/features/localStorage/LocalStorageRepository.js +95 -0
  145. package/features/localStorage/LocalStorageRepository.js.map +1 -0
  146. package/features/localStorage/abstractions.d.ts +48 -0
  147. package/features/localStorage/abstractions.js +19 -0
  148. package/features/localStorage/abstractions.js.map +1 -0
  149. package/features/localStorage/feature.d.ts +12 -0
  150. package/features/localStorage/feature.js +34 -0
  151. package/features/localStorage/feature.js.map +1 -0
  152. package/features/localStorage/index.d.ts +1 -0
  153. package/features/localStorage/index.js +3 -0
  154. package/features/localStorage/index.js.map +1 -0
  155. package/features/router/HistoryRouterGateway.d.ts +18 -0
  156. package/features/router/HistoryRouterGateway.js +82 -0
  157. package/features/router/HistoryRouterGateway.js.map +1 -0
  158. package/features/router/HistoryRouterGateway.test.d.ts +1 -0
  159. package/features/router/HistoryRouterGateway.test.js +204 -0
  160. package/features/router/HistoryRouterGateway.test.js.map +1 -0
  161. package/features/router/Route.d.ts +19 -0
  162. package/features/router/Route.js +59 -0
  163. package/features/router/Route.js.map +1 -0
  164. package/features/router/RouteUrl.d.ts +85 -0
  165. package/features/router/RouteUrl.js +232 -0
  166. package/features/router/RouteUrl.js.map +1 -0
  167. package/features/router/Router.d.ts +45 -0
  168. package/features/router/Router.js +129 -0
  169. package/features/router/Router.js.map +1 -0
  170. package/features/router/RouterPresenter.d.ts +17 -0
  171. package/features/router/RouterPresenter.js +45 -0
  172. package/features/router/RouterPresenter.js.map +1 -0
  173. package/features/router/RouterRepository.d.ts +21 -0
  174. package/features/router/RouterRepository.js +71 -0
  175. package/features/router/RouterRepository.js.map +1 -0
  176. package/features/router/RouterRepository.test.d.ts +1 -0
  177. package/features/router/RouterRepository.test.js +154 -0
  178. package/features/router/RouterRepository.test.js.map +1 -0
  179. package/features/router/abstractions.d.ts +68 -0
  180. package/features/router/abstractions.js +15 -0
  181. package/features/router/abstractions.js.map +1 -0
  182. package/features/router/feature.d.ts +4 -0
  183. package/features/router/feature.js +18 -0
  184. package/features/router/feature.js.map +1 -0
  185. package/features/router/index.d.ts +1 -0
  186. package/features/router/index.js +3 -0
  187. package/features/router/index.js.map +1 -0
  188. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  189. package/helpers/InterfaceGenerator/date.js +3 -0
  190. package/helpers/InterfaceGenerator/date.js.map +1 -0
  191. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  192. package/helpers/InterfaceGenerator/id.js +3 -0
  193. package/helpers/InterfaceGenerator/id.js.map +1 -0
  194. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  195. package/helpers/InterfaceGenerator/identity.js +3 -0
  196. package/helpers/InterfaceGenerator/identity.js.map +1 -0
  197. package/helpers/InterfaceGenerator/index.d.ts +5 -0
  198. package/helpers/InterfaceGenerator/index.js +3 -0
  199. package/helpers/InterfaceGenerator/index.js.map +1 -0
  200. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  201. package/helpers/InterfaceGenerator/numeric.js +3 -0
  202. package/helpers/InterfaceGenerator/numeric.js.map +1 -0
  203. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  204. package/helpers/InterfaceGenerator/truthful.js +3 -0
  205. package/helpers/InterfaceGenerator/truthful.js.map +1 -0
  206. package/hooks/useAutocomplete/index.d.ts +1 -1
  207. package/hooks/useAutocomplete/index.js +1 -12
  208. package/hooks/useAutocomplete/index.js.map +1 -1
  209. package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
  210. package/hooks/useAutocomplete/useAutocomplete.js +6 -16
  211. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  212. package/hooks/useDataList/functions/getData.js +2 -11
  213. package/hooks/useDataList/functions/getData.js.map +1 -1
  214. package/hooks/useDataList/functions/getError.js +2 -11
  215. package/hooks/useDataList/functions/getError.js.map +1 -1
  216. package/hooks/useDataList/functions/getMeta.js +2 -11
  217. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  218. package/hooks/useDataList/functions/index.d.ts +3 -3
  219. package/hooks/useDataList/functions/index.js +3 -27
  220. package/hooks/useDataList/functions/index.js.map +1 -1
  221. package/hooks/useDataList/functions/searchDataByKey.js +4 -10
  222. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
  223. package/hooks/useDataList/index.d.ts +1 -1
  224. package/hooks/useDataList/index.js +1 -12
  225. package/hooks/useDataList/index.js.map +1 -1
  226. package/hooks/useDataList/useDataList.d.ts +2 -3
  227. package/hooks/useDataList/useDataList.js +74 -94
  228. package/hooks/useDataList/useDataList.js.map +1 -1
  229. package/hooks/useDataList/utils/index.d.ts +1 -2
  230. package/hooks/useDataList/utils/index.js +1 -20
  231. package/hooks/useDataList/utils/index.js.map +1 -1
  232. package/hooks/useDataList/utils/prepareLoadListParams.js +10 -16
  233. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  234. package/hooks/useHandler.js +7 -12
  235. package/hooks/useHandler.js.map +1 -1
  236. package/hooks/useHandlers.js +11 -17
  237. package/hooks/useHandlers.js.map +1 -1
  238. package/hooks/useRegisterLegacyPlugin.d.ts +1 -1
  239. package/hooks/useRegisterLegacyPlugin.js +5 -11
  240. package/hooks/useRegisterLegacyPlugin.js.map +1 -1
  241. package/hooks/useUi.d.ts +1 -1
  242. package/hooks/useUi.js +4 -10
  243. package/hooks/useUi.js.map +1 -1
  244. package/i18n/i18n.js +5 -13
  245. package/i18n/i18n.js.map +1 -1
  246. package/i18n/index.d.ts +1 -1
  247. package/i18n/index.js +1 -13
  248. package/i18n/index.js.map +1 -1
  249. package/index.d.ts +23 -15
  250. package/index.js +25 -177
  251. package/index.js.map +1 -1
  252. package/package.json +25 -22
  253. package/plugins/AddQuerySelectionPlugin.d.ts +2 -2
  254. package/plugins/AddQuerySelectionPlugin.js +61 -107
  255. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  256. package/plugins/ApolloCacheObjectIdPlugin.js +12 -31
  257. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  258. package/plugins/ApolloDynamicLink.d.ts +3 -2
  259. package/plugins/ApolloDynamicLink.js +19 -46
  260. package/plugins/ApolloDynamicLink.js.map +1 -1
  261. package/plugins/ApolloLinkPlugin.d.ts +1 -1
  262. package/plugins/ApolloLinkPlugin.js +18 -37
  263. package/plugins/ApolloLinkPlugin.js.map +1 -1
  264. package/plugins/ConsoleLinkPlugin.d.ts +1 -1
  265. package/plugins/ConsoleLinkPlugin.js +20 -41
  266. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  267. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
  268. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +35 -58
  269. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  270. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
  271. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +31 -0
  272. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
  273. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  274. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +31 -0
  275. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  276. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -5
  277. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -12
  278. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  279. package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
  280. package/plugins/NetworkErrorLinkPlugin/Typography.js +18 -0
  281. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
  282. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
  283. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +10 -25
  284. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  285. package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
  286. package/plugins/NetworkErrorLinkPlugin.js +60 -37
  287. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  288. package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
  289. package/plugins/OmitTypenameLinkPlugin.js +11 -30
  290. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  291. package/plugins/TenantHeaderLinkPlugin.d.ts +3 -3
  292. package/plugins/TenantHeaderLinkPlugin.js +29 -48
  293. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  294. package/plugins/components/Image.d.ts +6 -0
  295. package/plugins/components/Image.js +19 -0
  296. package/plugins/components/Image.js.map +1 -0
  297. package/plugins/image.d.ts +1 -1
  298. package/plugins/image.js +46 -53
  299. package/plugins/image.js.map +1 -1
  300. package/plugins/index.d.ts +4 -4
  301. package/plugins/index.js +31 -53
  302. package/plugins/index.js.map +1 -1
  303. package/presentation/localStorage/index.d.ts +3 -0
  304. package/presentation/localStorage/index.js +5 -0
  305. package/presentation/localStorage/index.js.map +1 -0
  306. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  307. package/presentation/localStorage/useLocalStorage.js +21 -0
  308. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  309. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  310. package/presentation/localStorage/useLocalStorageValue.js +20 -0
  311. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  312. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  313. package/presentation/localStorage/useLocalStorageValues.js +39 -0
  314. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  315. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  316. package/presentation/router/RouteElementRegistry.js +32 -0
  317. package/presentation/router/RouteElementRegistry.js.map +1 -0
  318. package/presentation/router/abstractions.d.ts +13 -0
  319. package/presentation/router/abstractions.js +4 -0
  320. package/presentation/router/abstractions.js.map +1 -0
  321. package/presentation/router/components/RouteContent.d.ts +2 -0
  322. package/presentation/router/components/RouteContent.js +17 -0
  323. package/presentation/router/components/RouteContent.js.map +1 -0
  324. package/presentation/router/components/RouteLink.d.ts +50 -0
  325. package/presentation/router/components/RouteLink.js +22 -0
  326. package/presentation/router/components/RouteLink.js.map +1 -0
  327. package/presentation/router/components/SimpleLink.d.ts +44 -0
  328. package/presentation/router/components/SimpleLink.js +30 -0
  329. package/presentation/router/components/SimpleLink.js.map +1 -0
  330. package/presentation/router/hooks/useRoute.d.ts +6 -0
  331. package/presentation/router/hooks/useRoute.js +30 -0
  332. package/presentation/router/hooks/useRoute.js.map +1 -0
  333. package/presentation/router/hooks/useRouter.d.ts +7 -0
  334. package/presentation/router/hooks/useRouter.js +26 -0
  335. package/presentation/router/hooks/useRouter.js.map +1 -0
  336. package/presentation/router/index.d.ts +4 -0
  337. package/presentation/router/index.js +5 -0
  338. package/presentation/router/index.js.map +1 -0
  339. package/presentation/router/types.d.ts +5 -0
  340. package/presentation/router/types.js +3 -0
  341. package/presentation/router/types.js.map +1 -0
  342. package/react-butterfiles/Files.js +208 -235
  343. package/react-butterfiles/Files.js.map +1 -1
  344. package/react-butterfiles/file.todo +1 -0
  345. package/react-butterfiles/index.d.ts +1 -1
  346. package/react-butterfiles/index.js +2 -8
  347. package/react-butterfiles/index.js.map +1 -1
  348. package/react-butterfiles/utils/generateId.js +1 -7
  349. package/react-butterfiles/utils/generateId.js.map +1 -1
  350. package/react-butterfiles/utils/readFileContent.js +4 -10
  351. package/react-butterfiles/utils/readFileContent.js.map +1 -1
  352. package/renderApp.d.ts +1 -1
  353. package/renderApp.js +4 -11
  354. package/renderApp.js.map +1 -1
  355. package/router.d.ts +5 -0
  356. package/router.js +8 -0
  357. package/router.js.map +1 -0
  358. package/shared/di/DiContainerProvider.d.ts +8 -0
  359. package/shared/di/DiContainerProvider.js +17 -0
  360. package/shared/di/DiContainerProvider.js.map +1 -0
  361. package/shared/di/createFeature.d.ts +11 -0
  362. package/shared/di/createFeature.js +11 -0
  363. package/shared/di/createFeature.js.map +1 -0
  364. package/shared/di/useFeature.d.ts +2 -0
  365. package/shared/di/useFeature.js +18 -0
  366. package/shared/di/useFeature.js.map +1 -0
  367. package/types.d.ts +9 -6
  368. package/types.js +1 -12
  369. package/types.js.map +1 -1
  370. package/utils/createGenericContext.js +13 -22
  371. package/utils/createGenericContext.js.map +1 -1
  372. package/utils/createHashing.js +9 -15
  373. package/utils/createHashing.js.map +1 -1
  374. package/utils/index.d.ts +2 -10
  375. package/utils/index.js +2 -115
  376. package/utils/index.js.map +1 -1
  377. package/utils/legacyPluginToReactComponent.d.ts +1 -1
  378. package/utils/legacyPluginToReactComponent.js +5 -11
  379. package/utils/legacyPluginToReactComponent.js.map +1 -1
  380. package/components/Routes.d.ts +0 -2
  381. package/components/Routes.js +0 -46
  382. package/components/Routes.js.map +0 -1
  383. package/components/View.d.ts +0 -8
  384. package/components/View.js +0 -31
  385. package/components/View.js.map +0 -1
  386. package/core/AddRoute.d.ts +0 -21
  387. package/core/AddRoute.js +0 -21
  388. package/core/AddRoute.js.map +0 -1
  389. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  390. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -30
  391. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  392. package/hooks/useDataList/utils/types.d.ts +0 -40
  393. package/hooks/useDataList/utils/types.js +0 -7
  394. package/hooks/useDataList/utils/types.js.map +0 -1
  395. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
  396. package/plugins/LocaleHeaderLinkPlugin.js +0 -49
  397. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  398. package/plugins/RoutePlugin.d.ts +0 -12
  399. package/plugins/RoutePlugin.js +0 -35
  400. package/plugins/RoutePlugin.js.map +0 -1
  401. package/plugins/ViewPlugin.d.ts +0 -14
  402. package/plugins/ViewPlugin.js +0 -40
  403. package/plugins/ViewPlugin.js.map +0 -1
  404. package/utils/getApiUrl.d.ts +0 -1
  405. package/utils/getApiUrl.js +0 -12
  406. package/utils/getApiUrl.js.map +0 -1
  407. package/utils/getGqlApiUrl.d.ts +0 -1
  408. package/utils/getGqlApiUrl.js +0 -12
  409. package/utils/getGqlApiUrl.js.map +0 -1
  410. package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
  411. package/utils/getHeadlessCmsGqlApiUrl.js +0 -18
  412. package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
  413. package/utils/getLocaleCode.d.ts +0 -6
  414. package/utils/getLocaleCode.js +0 -43
  415. package/utils/getLocaleCode.js.map +0 -1
  416. package/utils/getPrerenderId.d.ts +0 -6
  417. package/utils/getPrerenderId.js +0 -11
  418. package/utils/getPrerenderId.js.map +0 -1
  419. package/utils/getTenantId.d.ts +0 -6
  420. package/utils/getTenantId.js +0 -51
  421. package/utils/getTenantId.js.map +0 -1
  422. package/utils/isLocalhost.d.ts +0 -1
  423. package/utils/isLocalhost.js +0 -15
  424. package/utils/isLocalhost.js.map +0 -1
  425. package/utils/isPrerendering.d.ts +0 -1
  426. package/utils/isPrerendering.js +0 -11
  427. package/utils/isPrerendering.js.map +0 -1
package/core/Provider.js CHANGED
@@ -1,19 +1,15 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Provider = void 0;
7
- var _react = require("react");
8
- var _ = require("./..");
1
+ import { useEffect } from "react";
2
+ import { useApp } from "../index.js";
9
3
  /**
10
4
  * Register a new React context provider.
11
5
  */
12
- var Provider = exports.Provider = function Provider(_ref) {
13
- var hoc = _ref.hoc;
14
- var _useApp = (0, _.useApp)(),
15
- addProvider = _useApp.addProvider;
16
- (0, _react.useEffect)(function () {
6
+ export const Provider = ({
7
+ hoc
8
+ }) => {
9
+ const {
10
+ addProvider
11
+ } = useApp();
12
+ useEffect(() => {
17
13
  return addProvider(hoc);
18
14
  }, []);
19
15
  return null;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_","Provider","exports","_ref","hoc","_useApp","useApp","addProvider","useEffect"],"sources":["Provider.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { GenericComponent, Decorator, useApp } from \"~/index\";\n\nexport interface ProviderProps {\n hoc: Decorator<GenericComponent>;\n}\n\n/**\n * Register a new React context provider.\n */\nexport const Provider = ({ hoc }: ProviderProps) => {\n const { addProvider } = useApp();\n\n useEffect(() => {\n return addProvider(hoc);\n }, []);\n\n return null;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAD,OAAA;AAMA;AACA;AACA;AACO,IAAME,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,SAAXA,QAAQA,CAAAE,IAAA,EAA+B;EAAA,IAAzBC,GAAG,GAAAD,IAAA,CAAHC,GAAG;EAC1B,IAAAC,OAAA,GAAwB,IAAAC,QAAM,EAAC,CAAC;IAAxBC,WAAW,GAAAF,OAAA,CAAXE,WAAW;EAEnB,IAAAC,gBAAS,EAAC,YAAM;IACZ,OAAOD,WAAW,CAACH,GAAG,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useApp","Provider","hoc","addProvider"],"sources":["Provider.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport type { GenericComponent, Decorator } from \"~/index.js\";\nimport { useApp } from \"~/index.js\";\n\nexport interface ProviderProps {\n hoc: Decorator<GenericComponent>;\n}\n\n/**\n * Register a new React context provider.\n */\nexport const Provider = ({ hoc }: ProviderProps) => {\n const { addProvider } = useApp();\n\n useEffect(() => {\n return addProvider(hoc);\n }, []);\n\n return null;\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AAEjC,SAASC,MAAM;AAMf;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CAAC;EAAEC;AAAmB,CAAC,KAAK;EAChD,MAAM;IAAEC;EAAY,CAAC,GAAGH,MAAM,CAAC,CAAC;EAEhCD,SAAS,CAAC,MAAM;IACZ,OAAOI,WAAW,CAACD,GAAG,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,IAAI;AACf,CAAC","ignoreList":[]}
package/core/Routes.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
+ import type { ReactRoute } from "../presentation/router/index.js";
2
3
  interface RoutesProps {
3
- routes: JSX.Element[];
4
+ routes: ReactRoute[];
4
5
  }
5
6
  export declare const Routes: (props: RoutesProps) => React.JSX.Element;
6
7
  export {};
package/core/Routes.js CHANGED
@@ -1,21 +1,13 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.Routes = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _plugins = require("@webiny/plugins");
11
- var _reactRouter = require("@webiny/react-router");
12
- var Routes = exports.Routes = function Routes(props) {
13
- var routes = [].concat((0, _toConsumableArray2.default)(props.routes), (0, _toConsumableArray2.default)(_plugins.plugins.byType("route").map(function (_ref) {
14
- var route = _ref.route;
15
- return route;
16
- }))).sort(function (a, b) {
17
- var pathA = a.props.path || "*";
18
- var pathB = b.props.path || "*";
1
+ import React from "react";
2
+ import { useRouter } from "../router.js";
3
+ import { RouteContent } from "../presentation/router/components/RouteContent.js";
4
+ export const Routes = props => {
5
+ const {
6
+ setRoutes
7
+ } = useRouter();
8
+ const routes = props.routes.sort((a, b) => {
9
+ const pathA = a.route.path || "*";
10
+ const pathB = b.route.path || "*";
19
11
 
20
12
  // This will sort paths at the very bottom of the list
21
13
  if (pathA === "/" && pathB === "*") {
@@ -33,11 +25,9 @@ var Routes = exports.Routes = function Routes(props) {
33
25
  }
34
26
  return 0;
35
27
  });
36
- return /*#__PURE__*/_react.default.createElement(_reactRouter.Routes, null, routes.map(function (route, index) {
37
- return /*#__PURE__*/_react.default.cloneElement(route, {
38
- key: "".concat(route.props.path, ":").concat(index)
39
- });
40
- }));
28
+ console.log("Call to setRoutes");
29
+ setRoutes(routes);
30
+ return /*#__PURE__*/React.createElement(RouteContent, null);
41
31
  };
42
32
 
43
33
  //# sourceMappingURL=Routes.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_plugins","_reactRouter","Routes","exports","props","routes","concat","_toConsumableArray2","default","plugins","byType","map","_ref","route","sort","a","b","pathA","path","pathB","includes","createElement","index","React","cloneElement","key"],"sources":["Routes.tsx"],"sourcesContent":["import React from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Routes as ReactRouterRoutes } from \"@webiny/react-router\";\nimport { RoutePlugin } from \"~/types\";\n\ninterface RoutesProps {\n routes: JSX.Element[];\n}\n\nexport const Routes = (props: RoutesProps) => {\n const routes = [\n ...props.routes,\n // For backwards compatibility, we need to support the RoutePlugin routes as well.\n ...plugins.byType<RoutePlugin>(\"route\").map(({ route }) => route)\n ].sort((a, b) => {\n const pathA = a.props.path || \"*\";\n const pathB = b.props.path || \"*\";\n\n // This will sort paths at the very bottom of the list\n if (pathA === \"/\" && pathB === \"*\") {\n return -1;\n }\n\n // This will push * and / to the bottom of the list\n if (pathA === \"*\" || pathA === \"/\") {\n return 1;\n }\n\n // This will push * and / to the bottom of the list\n if ([\"*\", \"/\"].includes(pathB)) {\n return -1;\n }\n\n return 0;\n });\n\n return (\n <ReactRouterRoutes>\n {routes.map((route, index) =>\n React.cloneElement(route, { key: `${route.props.path}:${index}` })\n )}\n </ReactRouterRoutes>\n );\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAOO,IAAMG,MAAM,GAAAC,OAAA,CAAAD,MAAA,GAAG,SAATA,MAAMA,CAAIE,KAAkB,EAAK;EAC1C,IAAMC,MAAM,GAAG,GAAAC,MAAA,KAAAC,mBAAA,CAAAC,OAAA,EACRJ,KAAK,CAACC,MAAM,OAAAE,mBAAA,CAAAC,OAAA,EAEZC,gBAAO,CAACC,MAAM,CAAc,OAAO,CAAC,CAACC,GAAG,CAAC,UAAAC,IAAA;IAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAA,OAAOA,KAAK;EAAA,EAAC,GACnEC,IAAI,CAAC,UAACC,CAAC,EAAEC,CAAC,EAAK;IACb,IAAMC,KAAK,GAAGF,CAAC,CAACX,KAAK,CAACc,IAAI,IAAI,GAAG;IACjC,IAAMC,KAAK,GAAGH,CAAC,CAACZ,KAAK,CAACc,IAAI,IAAI,GAAG;;IAEjC;IACA,IAAID,KAAK,KAAK,GAAG,IAAIE,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC,CAAC;IACb;;IAEA;IACA,IAAIF,KAAK,KAAK,GAAG,IAAIA,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC;IACZ;;IAEA;IACA,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAACG,QAAQ,CAACD,KAAK,CAAC,EAAE;MAC5B,OAAO,CAAC,CAAC;IACb;IAEA,OAAO,CAAC;EACZ,CAAC,CAAC;EAEF,oBACItB,MAAA,CAAAW,OAAA,CAAAa,aAAA,CAACpB,YAAA,CAAAC,MAAiB,QACbG,MAAM,CAACM,GAAG,CAAC,UAACE,KAAK,EAAES,KAAK;IAAA,oBACrBC,cAAK,CAACC,YAAY,CAACX,KAAK,EAAE;MAAEY,GAAG,KAAAnB,MAAA,CAAKO,KAAK,CAACT,KAAK,CAACc,IAAI,OAAAZ,MAAA,CAAIgB,KAAK;IAAG,CAAC,CAAC;EAAA,CACtE,CACe,CAAC;AAE5B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useRouter","RouteContent","Routes","props","setRoutes","routes","sort","a","b","pathA","route","path","pathB","includes","console","log","createElement"],"sources":["Routes.tsx"],"sourcesContent":["import React from \"react\";\nimport { useRouter } from \"~/router.js\";\nimport type { ReactRoute } from \"~/presentation/router/index.js\";\nimport { RouteContent } from \"~/presentation/router/components/RouteContent.js\";\n\ninterface RoutesProps {\n routes: ReactRoute[];\n}\n\nexport const Routes = (props: RoutesProps) => {\n const { setRoutes } = useRouter();\n\n const routes = props.routes.sort((a, b) => {\n const pathA: string = a.route.path || \"*\";\n const pathB: string = b.route.path || \"*\";\n\n // This will sort paths at the very bottom of the list\n if (pathA === \"/\" && pathB === \"*\") {\n return -1;\n }\n\n // This will push * and / to the bottom of the list\n if (pathA === \"*\" || pathA === \"/\") {\n return 1;\n }\n\n // This will push * and / to the bottom of the list\n if ([\"*\", \"/\"].includes(pathB)) {\n return -1;\n }\n\n return 0;\n });\n\n console.log(\"Call to setRoutes\");\n setRoutes(routes);\n\n return <RouteContent />;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS;AAElB,SAASC,YAAY;AAMrB,OAAO,MAAMC,MAAM,GAAIC,KAAkB,IAAK;EAC1C,MAAM;IAAEC;EAAU,CAAC,GAAGJ,SAAS,CAAC,CAAC;EAEjC,MAAMK,MAAM,GAAGF,KAAK,CAACE,MAAM,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK;IACvC,MAAMC,KAAa,GAAGF,CAAC,CAACG,KAAK,CAACC,IAAI,IAAI,GAAG;IACzC,MAAMC,KAAa,GAAGJ,CAAC,CAACE,KAAK,CAACC,IAAI,IAAI,GAAG;;IAEzC;IACA,IAAIF,KAAK,KAAK,GAAG,IAAIG,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC,CAAC;IACb;;IAEA;IACA,IAAIH,KAAK,KAAK,GAAG,IAAIA,KAAK,KAAK,GAAG,EAAE;MAChC,OAAO,CAAC;IACZ;;IAEA;IACA,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAACI,QAAQ,CAACD,KAAK,CAAC,EAAE;MAC5B,OAAO,CAAC,CAAC;IACb;IAEA,OAAO,CAAC;EACZ,CAAC,CAAC;EAEFE,OAAO,CAACC,GAAG,CAAC,mBAAmB,CAAC;EAChCX,SAAS,CAACC,MAAM,CAAC;EAEjB,oBAAON,KAAA,CAAAiB,aAAA,CAACf,YAAY,MAAE,CAAC;AAC3B,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import { Decorator, GenericComponent } from "@webiny/react-composition";
1
+ import type React from "react";
2
+ import type { Decorator, GenericComponent } from "@webiny/react-composition";
3
3
  export interface ChildrenProps {
4
4
  children: React.ReactNode;
5
5
  }
@@ -1,14 +1,8 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createProvider = createProvider;
7
1
  /**
8
2
  * Creates a Higher Order Component which wraps the entire app content.
9
3
  * This is mostly useful for adding React Context providers.
10
4
  */
11
- function createProvider(decorator) {
5
+ export function createProvider(decorator) {
12
6
  return decorator;
13
7
  }
14
8
 
@@ -1 +1 @@
1
- {"version":3,"names":["createProvider","decorator"],"sources":["createProvider.tsx"],"sourcesContent":["import React from \"react\";\nimport { Decorator, GenericComponent } from \"@webiny/react-composition\";\n\nexport interface ChildrenProps {\n children: React.ReactNode;\n}\n\n/**\n * Creates a Higher Order Component which wraps the entire app content.\n * This is mostly useful for adding React Context providers.\n */\nexport function createProvider(\n decorator: Decorator<GenericComponent<ChildrenProps>>\n): Decorator<GenericComponent<ChildrenProps>> {\n return decorator;\n}\n"],"mappings":";;;;;;AAOA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAC1BC,SAAqD,EACX;EAC1C,OAAOA,SAAS;AACpB","ignoreList":[]}
1
+ {"version":3,"names":["createProvider","decorator"],"sources":["createProvider.tsx"],"sourcesContent":["import type React from \"react\";\nimport type { Decorator, GenericComponent } from \"@webiny/react-composition\";\n\nexport interface ChildrenProps {\n children: React.ReactNode;\n}\n\n/**\n * Creates a Higher Order Component which wraps the entire app content.\n * This is mostly useful for adding React Context providers.\n */\nexport function createProvider(\n decorator: Decorator<GenericComponent<ChildrenProps>>\n): Decorator<GenericComponent<ChildrenProps>> {\n return decorator;\n}\n"],"mappings":"AAOA;AACA;AACA;AACA;AACA,OAAO,SAASA,cAAcA,CAC1BC,SAAqD,EACX;EAC1C,OAAOA,SAAS;AACpB","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { GenericComponent, Decorator } from "@webiny/react-composition";
2
+ import type { GenericComponent, Decorator } from "@webiny/react-composition";
3
3
  /**
4
4
  * Creates a component, which, when mounted, will register an app provider.
5
5
  * This is particularly useful for wrapping the entire app with custom React Context providers.
@@ -1,20 +1,14 @@
1
- "use strict";
1
+ import React from "react";
2
+ import { Provider } from "./Provider.js";
2
3
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.createProviderPlugin = createProviderPlugin;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _Provider = require("./Provider");
10
4
  /**
11
5
  * Creates a component, which, when mounted, will register an app provider.
12
6
  * This is particularly useful for wrapping the entire app with custom React Context providers.
13
7
  * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.
14
8
  */
15
- function createProviderPlugin(decorator) {
9
+ export function createProviderPlugin(decorator) {
16
10
  return function ProviderPlugin() {
17
- return /*#__PURE__*/_react.default.createElement(_Provider.Provider, {
11
+ return /*#__PURE__*/React.createElement(Provider, {
18
12
  hoc: decorator
19
13
  });
20
14
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_Provider","createProviderPlugin","decorator","ProviderPlugin","default","createElement","Provider","hoc"],"sources":["createProviderPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { GenericComponent, Decorator } from \"@webiny/react-composition\";\nimport { Provider } from \"./Provider\";\n\n/**\n * Creates a component, which, when mounted, will register an app provider.\n * This is particularly useful for wrapping the entire app with custom React Context providers.\n * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.\n */\nexport function createProviderPlugin(decorator: Decorator<GenericComponent>) {\n return function ProviderPlugin() {\n return <Provider hoc={decorator} />;\n };\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,SAASE,oBAAoBA,CAACC,SAAsC,EAAE;EACzE,OAAO,SAASC,cAAcA,CAAA,EAAG;IAC7B,oBAAON,MAAA,CAAAO,OAAA,CAAAC,aAAA,CAACL,SAAA,CAAAM,QAAQ;MAACC,GAAG,EAAEL;IAAU,CAAE,CAAC;EACvC,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"names":["React","Provider","createProviderPlugin","decorator","ProviderPlugin","createElement","hoc"],"sources":["createProviderPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport type { GenericComponent, Decorator } from \"@webiny/react-composition\";\nimport { Provider } from \"./Provider.js\";\n\n/**\n * Creates a component, which, when mounted, will register an app provider.\n * This is particularly useful for wrapping the entire app with custom React Context providers.\n * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.\n */\nexport function createProviderPlugin(decorator: Decorator<GenericComponent>) {\n return function ProviderPlugin() {\n return <Provider hoc={decorator} />;\n };\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,QAAQ;;AAEjB;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,SAAsC,EAAE;EACzE,OAAO,SAASC,cAAcA,CAAA,EAAG;IAC7B,oBAAOJ,KAAA,CAAAK,aAAA,CAACJ,QAAQ;MAACK,GAAG,EAAEH;IAAU,CAAE,CAAC;EACvC,CAAC;AACL","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ import { BaseEvent } from "../features/eventPublisher/index.js";
2
+ export interface AuthenticationErrorPayload {
3
+ message: string;
4
+ code: string;
5
+ }
6
+ export declare class AuthenticationErrorEvent extends BaseEvent<AuthenticationErrorPayload> {
7
+ eventType: "Authentication/Error";
8
+ getHandlerAbstraction(): import("@webiny/di").Abstraction<import("~/features/eventPublisher/index.js").IEventHandler<AuthenticationErrorEvent>>;
9
+ }
@@ -0,0 +1,10 @@
1
+ import { AuthenticationErrorEventHandler } from "./abstractions.js";
2
+ import { BaseEvent } from "../features/eventPublisher/index.js";
3
+ export class AuthenticationErrorEvent extends BaseEvent {
4
+ eventType = "Authentication/Error";
5
+ getHandlerAbstraction() {
6
+ return AuthenticationErrorEventHandler;
7
+ }
8
+ }
9
+
10
+ //# sourceMappingURL=AuthenticationErrorEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AuthenticationErrorEventHandler","BaseEvent","AuthenticationErrorEvent","eventType","getHandlerAbstraction"],"sources":["AuthenticationErrorEvent.ts"],"sourcesContent":["import { AuthenticationErrorEventHandler } from \"./abstractions.js\";\nimport { BaseEvent } from \"~/features/eventPublisher/index.js\";\n\nexport interface AuthenticationErrorPayload {\n message: string;\n code: string;\n}\n\nexport class AuthenticationErrorEvent extends BaseEvent<AuthenticationErrorPayload> {\n eventType = \"Authentication/Error\" as const;\n\n getHandlerAbstraction() {\n return AuthenticationErrorEventHandler;\n }\n}\n"],"mappings":"AAAA,SAASA,+BAA+B;AACxC,SAASC,SAAS;AAOlB,OAAO,MAAMC,wBAAwB,SAASD,SAAS,CAA6B;EAChFE,SAAS,GAAG,sBAAsB;EAElCC,qBAAqBA,CAAA,EAAG;IACpB,OAAOJ,+BAA+B;EAC1C;AACJ","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ import { BaseEvent } from "../features/eventPublisher/index.js";
2
+ export interface NetworkErrorPayload {
3
+ message: string;
4
+ code?: string;
5
+ operationName?: string;
6
+ query?: string;
7
+ variables?: Record<string, any>;
8
+ errorType: "network" | "timeout" | "fetch" | "unknown";
9
+ statusCode?: number;
10
+ result?: any;
11
+ }
12
+ export declare class NetworkErrorEvent extends BaseEvent<NetworkErrorPayload> {
13
+ eventType: "network.error";
14
+ getHandlerAbstraction(): import("@webiny/di").Abstraction<import("~/features/eventPublisher/index.js").IEventHandler<NetworkErrorEvent>>;
15
+ }
@@ -0,0 +1,10 @@
1
+ import { NetworkErrorEventHandler } from "./abstractions.js";
2
+ import { BaseEvent } from "../features/eventPublisher/index.js";
3
+ export class NetworkErrorEvent extends BaseEvent {
4
+ eventType = "network.error";
5
+ getHandlerAbstraction() {
6
+ return NetworkErrorEventHandler;
7
+ }
8
+ }
9
+
10
+ //# sourceMappingURL=NetworkErrorEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NetworkErrorEventHandler","BaseEvent","NetworkErrorEvent","eventType","getHandlerAbstraction"],"sources":["NetworkErrorEvent.ts"],"sourcesContent":["import { NetworkErrorEventHandler } from \"./abstractions.js\";\nimport { BaseEvent } from \"~/features/eventPublisher/index.js\";\n\nexport interface NetworkErrorPayload {\n message: string;\n code?: string;\n operationName?: string;\n query?: string;\n variables?: Record<string, any>;\n errorType: \"network\" | \"timeout\" | \"fetch\" | \"unknown\";\n statusCode?: number;\n result?: any;\n}\n\nexport class NetworkErrorEvent extends BaseEvent<NetworkErrorPayload> {\n eventType = \"network.error\" as const;\n\n getHandlerAbstraction() {\n return NetworkErrorEventHandler;\n }\n}\n"],"mappings":"AAAA,SAASA,wBAAwB;AACjC,SAASC,SAAS;AAalB,OAAO,MAAMC,iBAAiB,SAASD,SAAS,CAAsB;EAClEE,SAAS,GAAG,eAAe;EAE3BC,qBAAqBA,CAAA,EAAG;IACpB,OAAOJ,wBAAwB;EACnC;AACJ","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ import type { NetworkErrorEvent } from "./NetworkErrorEvent.js";
2
+ import type { AuthenticationErrorEvent } from "./AuthenticationErrorEvent.js";
3
+ import type { IEventHandler } from "../features/eventPublisher/index.js";
4
+ export declare const NetworkErrorEventHandler: import("@webiny/di").Abstraction<IEventHandler<NetworkErrorEvent>>;
5
+ export declare namespace NetworkErrorEventHandler {
6
+ type Interface = IEventHandler<NetworkErrorEvent>;
7
+ }
8
+ export declare const AuthenticationErrorEventHandler: import("@webiny/di").Abstraction<IEventHandler<AuthenticationErrorEvent>>;
9
+ export declare namespace AuthenticationErrorEventHandler {
10
+ type Interface = IEventHandler<AuthenticationErrorEvent>;
11
+ type Event = AuthenticationErrorEvent;
12
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/admin";
2
+ export const NetworkErrorEventHandler = createAbstraction("NetworkErrorEventHandler");
3
+ export const AuthenticationErrorEventHandler = createAbstraction("AuthenticationErrorEventHandler");
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createAbstraction","NetworkErrorEventHandler","AuthenticationErrorEventHandler"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { NetworkErrorEvent } from \"./NetworkErrorEvent.js\";\nimport type { AuthenticationErrorEvent } from \"./AuthenticationErrorEvent.js\";\nimport type { IEventHandler } from \"~/features/eventPublisher/index.js\";\n\nexport const NetworkErrorEventHandler = createAbstraction<IEventHandler<NetworkErrorEvent>>(\n \"NetworkErrorEventHandler\"\n);\n\nexport namespace NetworkErrorEventHandler {\n export type Interface = IEventHandler<NetworkErrorEvent>;\n}\n\nexport const AuthenticationErrorEventHandler = createAbstraction<\n IEventHandler<AuthenticationErrorEvent>\n>(\"AuthenticationErrorEventHandler\");\n\nexport namespace AuthenticationErrorEventHandler {\n export type Interface = IEventHandler<AuthenticationErrorEvent>;\n export type Event = AuthenticationErrorEvent;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,uBAAuB;AAKzD,OAAO,MAAMC,wBAAwB,GAAGD,iBAAiB,CACrD,0BACJ,CAAC;AAMD,OAAO,MAAME,+BAA+B,GAAGF,iBAAiB,CAE9D,iCAAiC,CAAC","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ export { NetworkErrorEvent } from "./NetworkErrorEvent.js";
2
+ export type { NetworkErrorPayload } from "./NetworkErrorEvent.js";
3
+ export { NetworkErrorEventHandler } from "./abstractions.js";
4
+ export { AuthenticationErrorEvent } from "./AuthenticationErrorEvent.js";
5
+ export type { AuthenticationErrorPayload } from "./AuthenticationErrorEvent.js";
6
+ export { AuthenticationErrorEventHandler } from "./abstractions.js";
@@ -0,0 +1,6 @@
1
+ export { NetworkErrorEvent } from "./NetworkErrorEvent.js";
2
+ export { NetworkErrorEventHandler } from "./abstractions.js";
3
+ export { AuthenticationErrorEvent } from "./AuthenticationErrorEvent.js";
4
+ export { AuthenticationErrorEventHandler } from "./abstractions.js";
5
+
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NetworkErrorEvent","NetworkErrorEventHandler","AuthenticationErrorEvent","AuthenticationErrorEventHandler"],"sources":["index.ts"],"sourcesContent":["export { NetworkErrorEvent } from \"./NetworkErrorEvent.js\";\nexport type { NetworkErrorPayload } from \"./NetworkErrorEvent.js\";\nexport { NetworkErrorEventHandler } from \"./abstractions.js\";\nexport { AuthenticationErrorEvent } from \"./AuthenticationErrorEvent.js\";\nexport type { AuthenticationErrorPayload } from \"./AuthenticationErrorEvent.js\";\nexport { AuthenticationErrorEventHandler } from \"./abstractions.js\";\n"],"mappings":"AAAA,SAASA,iBAAiB;AAE1B,SAASC,wBAAwB;AACjC,SAASC,wBAAwB;AAEjC,SAASC,+BAA+B","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export { EnvConfig } from "../../features/envConfig/index.js";
@@ -0,0 +1,3 @@
1
+ export { EnvConfig } from "../../features/envConfig/index.js";
2
+
3
+ //# sourceMappingURL=envConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EnvConfig"],"sources":["envConfig.ts"],"sourcesContent":["export { EnvConfig } from \"~/features/envConfig/index.js\";\n"],"mappings":"AAAA,SAASA,SAAS","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export { GraphQLClient } from "../../features/graphqlClient/abstractions.js";
@@ -0,0 +1,3 @@
1
+ export { GraphQLClient } from "../../features/graphqlClient/abstractions.js";
2
+
3
+ //# sourceMappingURL=graphqlClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GraphQLClient"],"sources":["graphqlClient.ts"],"sourcesContent":["export { GraphQLClient } from \"~/features/graphqlClient/abstractions.js\";\n"],"mappings":"AAAA,SAASA,aAAa","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export { LocalStorage } from "../../features/localStorage/abstractions.js";
2
+ export { useLocalStorage, useLocalStorageValue, useLocalStorageValues } from "../../presentation/localStorage/index.js";
@@ -0,0 +1,4 @@
1
+ export { LocalStorage } from "../../features/localStorage/abstractions.js";
2
+ export { useLocalStorage, useLocalStorageValue, useLocalStorageValues } from "../../presentation/localStorage/index.js";
3
+
4
+ //# sourceMappingURL=localStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LocalStorage","useLocalStorage","useLocalStorageValue","useLocalStorageValues"],"sources":["localStorage.ts"],"sourcesContent":["export { LocalStorage } from \"~/features/localStorage/abstractions.js\";\nexport {\n useLocalStorage,\n useLocalStorageValue,\n useLocalStorageValues\n} from \"~/presentation/localStorage/index.js\";\n"],"mappings":"AAAA,SAASA,YAAY;AACrB,SACIC,eAAe,EACfC,oBAAoB,EACpBC,qBAAqB","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ export { Route } from "../../features/router/Route.js";
2
+ export { RouteLinkComponent } from "../../presentation/router/components/RouteLink.js";
3
+ export { LinkComponent } from "../../presentation/router/components/SimpleLink.js";
4
+ export { useRoute, useRouter } from "../../presentation/router/index.js";
@@ -0,0 +1,6 @@
1
+ export { Route } from "../../features/router/Route.js";
2
+ export { RouteLinkComponent } from "../../presentation/router/components/RouteLink.js";
3
+ export { LinkComponent } from "../../presentation/router/components/SimpleLink.js";
4
+ export { useRoute, useRouter } from "../../presentation/router/index.js";
5
+
6
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Route","RouteLinkComponent","LinkComponent","useRoute","useRouter"],"sources":["router.ts"],"sourcesContent":["export { Route } from \"~/features/router/Route.js\";\nexport { RouteLinkComponent } from \"~/presentation/router/components/RouteLink.js\";\nexport { LinkComponent } from \"~/presentation/router/components/SimpleLink.js\";\nexport { useRoute, useRouter } from \"~/presentation/router/index.js\";\n"],"mappings":"AAAA,SAASA,KAAK;AACd,SAASC,kBAAkB;AAC3B,SAASC,aAAa;AACtB,SAASC,QAAQ,EAAEC,SAAS","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export { AuthenticationErrorEventHandler } from "../../errors/abstractions.js";
@@ -0,0 +1,3 @@
1
+ export { AuthenticationErrorEventHandler } from "../../errors/abstractions.js";
2
+
3
+ //# sourceMappingURL=security.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AuthenticationErrorEventHandler"],"sources":["security.ts"],"sourcesContent":["export { AuthenticationErrorEventHandler } from \"~/errors/abstractions.js\";\n"],"mappings":"AAAA,SAASA,+BAA+B","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ export { useFeature } from "../shared/di/useFeature.js";
2
+ export { NetworkErrorEventHandler } from "../errors/index.js";
3
+ export { createProviderPlugin } from "../core/createProviderPlugin.js";
4
+ export { createProvider } from "../core/createProvider.js";
5
+ export { Provider } from "../core/Provider.js";
6
+ export { Plugin } from "../core/Plugin.js";
@@ -0,0 +1,8 @@
1
+ export { useFeature } from "../shared/di/useFeature.js";
2
+ export { NetworkErrorEventHandler } from "../errors/index.js";
3
+ export { createProviderPlugin } from "../core/createProviderPlugin.js";
4
+ export { createProvider } from "../core/createProvider.js";
5
+ export { Provider } from "../core/Provider.js";
6
+ export { Plugin } from "../core/Plugin.js";
7
+
8
+ //# sourceMappingURL=admin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useFeature","NetworkErrorEventHandler","createProviderPlugin","createProvider","Provider","Plugin"],"sources":["admin.ts"],"sourcesContent":["export { useFeature } from \"~/shared/di/useFeature.js\";\nexport { NetworkErrorEventHandler } from \"~/errors/index.js\";\nexport { createProviderPlugin } from \"~/core/createProviderPlugin.js\";\nexport { createProvider } from \"~/core/createProvider.js\";\nexport { Provider } from \"~/core/Provider.js\";\nexport { Plugin } from \"~/core/Plugin.js\";\n"],"mappings":"AAAA,SAASA,UAAU;AACnB,SAASC,wBAAwB;AACjC,SAASC,oBAAoB;AAC7B,SAASC,cAAc;AACvB,SAASC,QAAQ;AACjB,SAASC,MAAM","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import { EnvConfig as Abstraction } from "./abstractions.js";
2
+ export declare class DefaultEnvConfig implements Abstraction.Interface {
3
+ private readonly env;
4
+ constructor(env: Abstraction.Config);
5
+ get<K extends keyof Abstraction.Config>(key: K, defaultValue?: Abstraction.Config[K]): Abstraction.Config[K];
6
+ }
@@ -0,0 +1,14 @@
1
+ export class DefaultEnvConfig {
2
+ constructor(env) {
3
+ this.env = env;
4
+ }
5
+ get(key, defaultValue) {
6
+ const rawValue = this.env[key];
7
+ if ((rawValue === undefined || rawValue === null) && defaultValue !== undefined) {
8
+ return defaultValue;
9
+ }
10
+ return rawValue;
11
+ }
12
+ }
13
+
14
+ //# sourceMappingURL=EnvConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DefaultEnvConfig","constructor","env","get","key","defaultValue","rawValue","undefined"],"sources":["EnvConfig.ts"],"sourcesContent":["import { EnvConfig as Abstraction } from \"./abstractions.js\";\n\nexport class DefaultEnvConfig implements Abstraction.Interface {\n private readonly env: Abstraction.Config;\n\n constructor(env: Abstraction.Config) {\n this.env = env;\n }\n\n public get<K extends keyof Abstraction.Config>(\n key: K,\n defaultValue?: Abstraction.Config[K]\n ): Abstraction.Config[K] {\n const rawValue = this.env[key];\n\n if ((rawValue === undefined || rawValue === null) && defaultValue !== undefined) {\n return defaultValue;\n }\n\n return rawValue;\n }\n}\n"],"mappings":"AAEA,OAAO,MAAMA,gBAAgB,CAAkC;EAG3DC,WAAWA,CAACC,GAAuB,EAAE;IACjC,IAAI,CAACA,GAAG,GAAGA,GAAG;EAClB;EAEOC,GAAGA,CACNC,GAAM,EACNC,YAAoC,EACf;IACrB,MAAMC,QAAQ,GAAG,IAAI,CAACJ,GAAG,CAACE,GAAG,CAAC;IAE9B,IAAI,CAACE,QAAQ,KAAKC,SAAS,IAAID,QAAQ,KAAK,IAAI,KAAKD,YAAY,KAAKE,SAAS,EAAE;MAC7E,OAAOF,YAAY;IACvB;IAEA,OAAOC,QAAQ;EACnB;AACJ","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ import { Abstraction } from "@webiny/di";
2
+ type Env = {
3
+ apiUrl: string;
4
+ debug: boolean;
5
+ deploymentId: string;
6
+ graphqlApiUrl: string;
7
+ telemetryEnabled: boolean;
8
+ telemetryUserId: string | undefined;
9
+ trashBinRetentionPeriodDays: number;
10
+ wcpProjectId: string | undefined;
11
+ websocketUrl: string;
12
+ graphqlClient?: {
13
+ retries: {
14
+ maxRetries: number;
15
+ delayInMillis: number;
16
+ };
17
+ };
18
+ };
19
+ export interface IEnvConfig {
20
+ get<K extends keyof Env>(key: K, defaultValue?: Env[K]): Env[K];
21
+ }
22
+ export declare const EnvConfig: Abstraction<IEnvConfig>;
23
+ export declare namespace EnvConfig {
24
+ type Interface = IEnvConfig;
25
+ type Config = Env;
26
+ }
27
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Abstraction } from "@webiny/di";
2
+ export const EnvConfig = new Abstraction("EnvConfig");
3
+
4
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Abstraction","EnvConfig"],"sources":["abstractions.ts"],"sourcesContent":["import { Abstraction } from \"@webiny/di\";\n\ntype Env = {\n apiUrl: string;\n debug: boolean;\n deploymentId: string;\n graphqlApiUrl: string;\n telemetryEnabled: boolean;\n telemetryUserId: string | undefined;\n trashBinRetentionPeriodDays: number;\n wcpProjectId: string | undefined;\n websocketUrl: string;\n graphqlClient?: {\n retries: {\n maxRetries: number;\n delayInMillis: number;\n };\n };\n};\n\nexport interface IEnvConfig {\n get<K extends keyof Env>(key: K, defaultValue?: Env[K]): Env[K];\n}\n\nexport const EnvConfig = new Abstraction<IEnvConfig>(\"EnvConfig\");\n\nexport namespace EnvConfig {\n export type Interface = IEnvConfig;\n export type Config = Env;\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,YAAY;AAwBxC,OAAO,MAAMC,SAAS,GAAG,IAAID,WAAW,CAAa,WAAW,CAAC","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ export declare const EnvConfigFeature: import("~/shared/di/createFeature.js").FeatureDefinition<import("./abstractions.js").IEnvConfig, [params: {
2
+ apiUrl: string;
3
+ debug: boolean;
4
+ deploymentId: string;
5
+ graphqlApiUrl: string;
6
+ telemetryEnabled: boolean;
7
+ telemetryUserId: string | undefined;
8
+ trashBinRetentionPeriodDays: number;
9
+ wcpProjectId: string | undefined;
10
+ websocketUrl: string;
11
+ graphqlClient?: {
12
+ retries: {
13
+ maxRetries: number;
14
+ delayInMillis: number;
15
+ };
16
+ };
17
+ }]>;
@@ -0,0 +1,14 @@
1
+ import { EnvConfig } from "./abstractions.js";
2
+ import { DefaultEnvConfig } from "./EnvConfig.js";
3
+ import { createFeature } from "../../shared/di/createFeature.js";
4
+ export const EnvConfigFeature = createFeature({
5
+ name: "EnvConfig",
6
+ register(container, params) {
7
+ container.registerInstance(EnvConfig, new DefaultEnvConfig(params));
8
+ },
9
+ resolve(container) {
10
+ return container.resolve(EnvConfig);
11
+ }
12
+ });
13
+
14
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EnvConfig","DefaultEnvConfig","createFeature","EnvConfigFeature","name","register","container","params","registerInstance","resolve"],"sources":["feature.ts"],"sourcesContent":["import { EnvConfig } from \"./abstractions.js\";\nimport { DefaultEnvConfig } from \"./EnvConfig.js\";\nimport { createFeature } from \"~/shared/di/createFeature.js\";\n\nexport const EnvConfigFeature = createFeature({\n name: \"EnvConfig\",\n register(container, params: EnvConfig.Config) {\n container.registerInstance(EnvConfig, new DefaultEnvConfig(params));\n },\n resolve(container) {\n return container.resolve(EnvConfig);\n }\n});\n"],"mappings":"AAAA,SAASA,SAAS;AAClB,SAASC,gBAAgB;AACzB,SAASC,aAAa;AAEtB,OAAO,MAAMC,gBAAgB,GAAGD,aAAa,CAAC;EAC1CE,IAAI,EAAE,WAAW;EACjBC,QAAQA,CAACC,SAAS,EAAEC,MAAwB,EAAE;IAC1CD,SAAS,CAACE,gBAAgB,CAACR,SAAS,EAAE,IAAIC,gBAAgB,CAACM,MAAM,CAAC,CAAC;EACvE,CAAC;EACDE,OAAOA,CAACH,SAAS,EAAE;IACf,OAAOA,SAAS,CAACG,OAAO,CAACT,SAAS,CAAC;EACvC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export { EnvConfig } from "./abstractions.js";
@@ -0,0 +1,3 @@
1
+ export { EnvConfig } from "./abstractions.js";
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EnvConfig"],"sources":["index.ts"],"sourcesContent":["export { EnvConfig } from \"./abstractions.js\";\n"],"mappings":"AAAA,SAASA,SAAS","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ import type { Container } from "@webiny/di";
2
+ import { EventPublisher as Abstraction, BaseEvent } from "./abstractions.js";
3
+ export declare class EventPublisher implements Abstraction.Interface {
4
+ private container;
5
+ constructor(container: Container);
6
+ publish<TEvent extends BaseEvent>(event: TEvent): Promise<void>;
7
+ private logEvent;
8
+ }
@@ -0,0 +1,27 @@
1
+ import { EnvConfig } from "../envConfig/index.js";
2
+ export class EventPublisher {
3
+ constructor(container) {
4
+ this.container = container;
5
+ }
6
+ async publish(event) {
7
+ this.logEvent(event);
8
+ // Get handler abstraction from the event itself
9
+ const handlerAbstraction = event.getHandlerAbstraction();
10
+
11
+ // Resolve ALL implementations of that abstraction
12
+ const handlers = this.container.resolveAll(handlerAbstraction);
13
+
14
+ // Execute all handlers
15
+ for (const handler of handlers) {
16
+ await handler.handle(event);
17
+ }
18
+ }
19
+ logEvent(event) {
20
+ const envConfig = this.container.resolve(EnvConfig);
21
+ if (envConfig.get("debug")) {
22
+ console.log(`[EventPublisher] Publishing event "${event.eventType}".`, event.payload);
23
+ }
24
+ }
25
+ }
26
+
27
+ //# sourceMappingURL=EventPublisher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EnvConfig","EventPublisher","constructor","container","publish","event","logEvent","handlerAbstraction","getHandlerAbstraction","handlers","resolveAll","handler","handle","envConfig","resolve","get","console","log","eventType","payload"],"sources":["EventPublisher.ts"],"sourcesContent":["import type { Container } from \"@webiny/di\";\nimport { EventPublisher as Abstraction, BaseEvent } from \"./abstractions.js\";\nimport { EnvConfig } from \"~/features/envConfig/index.js\";\n\nexport class EventPublisher implements Abstraction.Interface {\n constructor(private container: Container) {}\n\n async publish<TEvent extends BaseEvent>(event: TEvent): Promise<void> {\n this.logEvent(event);\n // Get handler abstraction from the event itself\n const handlerAbstraction = event.getHandlerAbstraction();\n\n // Resolve ALL implementations of that abstraction\n const handlers = this.container.resolveAll(handlerAbstraction);\n\n // Execute all handlers\n for (const handler of handlers) {\n await handler.handle(event);\n }\n }\n\n private logEvent(event: BaseEvent) {\n const envConfig = this.container.resolve(EnvConfig);\n if (envConfig.get(\"debug\")) {\n console.log(`[EventPublisher] Publishing event \"${event.eventType}\".`, event.payload);\n }\n }\n}\n"],"mappings":"AAEA,SAASA,SAAS;AAElB,OAAO,MAAMC,cAAc,CAAkC;EACzDC,WAAWA,CAASC,SAAoB,EAAE;IAAA,KAAtBA,SAAoB,GAApBA,SAAoB;EAAG;EAE3C,MAAMC,OAAOA,CAA2BC,KAAa,EAAiB;IAClE,IAAI,CAACC,QAAQ,CAACD,KAAK,CAAC;IACpB;IACA,MAAME,kBAAkB,GAAGF,KAAK,CAACG,qBAAqB,CAAC,CAAC;;IAExD;IACA,MAAMC,QAAQ,GAAG,IAAI,CAACN,SAAS,CAACO,UAAU,CAACH,kBAAkB,CAAC;;IAE9D;IACA,KAAK,MAAMI,OAAO,IAAIF,QAAQ,EAAE;MAC5B,MAAME,OAAO,CAACC,MAAM,CAACP,KAAK,CAAC;IAC/B;EACJ;EAEQC,QAAQA,CAACD,KAAgB,EAAE;IAC/B,MAAMQ,SAAS,GAAG,IAAI,CAACV,SAAS,CAACW,OAAO,CAACd,SAAS,CAAC;IACnD,IAAIa,SAAS,CAACE,GAAG,CAAC,OAAO,CAAC,EAAE;MACxBC,OAAO,CAACC,GAAG,CAAC,sCAAsCZ,KAAK,CAACa,SAAS,IAAI,EAAEb,KAAK,CAACc,OAAO,CAAC;IACzF;EACJ;AACJ","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import type { Abstraction } from "@webiny/di";
2
+ export declare abstract class BaseEvent<TPayload = void> {
3
+ abstract readonly eventType: string;
4
+ readonly occurredAt: Date;
5
+ readonly payload: TPayload extends void ? undefined : TPayload;
6
+ constructor(payload: TPayload);
7
+ abstract getHandlerAbstraction(): Abstraction<IEventHandler<any>>;
8
+ }
9
+ export interface IEventHandler<TEvent extends BaseEvent<any> = BaseEvent<any>> {
10
+ handle(event: TEvent): Promise<void>;
11
+ }
12
+ export interface IEventPublisher {
13
+ publish<TEvent extends BaseEvent<any>>(event: TEvent): Promise<void>;
14
+ }
15
+ export declare const EventPublisher: Abstraction<IEventPublisher>;
16
+ export declare namespace EventPublisher {
17
+ type Interface = IEventPublisher;
18
+ }
@@ -0,0 +1,14 @@
1
+ import { createAbstraction } from "@webiny/feature/admin";
2
+ export class BaseEvent {
3
+ constructor(payload) {
4
+ this.occurredAt = new Date();
5
+ if (payload === undefined) {
6
+ this.payload = undefined;
7
+ } else {
8
+ this.payload = payload;
9
+ }
10
+ }
11
+ }
12
+ export const EventPublisher = createAbstraction("EventPublisher");
13
+
14
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createAbstraction","BaseEvent","constructor","payload","occurredAt","Date","undefined","EventPublisher"],"sources":["abstractions.ts"],"sourcesContent":["import type { Abstraction } from \"@webiny/di\";\nimport { createAbstraction } from \"@webiny/feature/admin\";\n\nexport abstract class BaseEvent<TPayload = void> {\n public abstract readonly eventType: string;\n public readonly occurredAt: Date;\n public readonly payload: TPayload extends void ? undefined : TPayload;\n\n constructor(payload: TPayload);\n constructor(payload?: never) {\n this.occurredAt = new Date();\n\n if (payload === undefined) {\n this.payload = undefined as any;\n } else {\n this.payload = payload;\n }\n }\n\n abstract getHandlerAbstraction(): Abstraction<IEventHandler<any>>;\n}\n\nexport interface IEventHandler<TEvent extends BaseEvent<any> = BaseEvent<any>> {\n handle(event: TEvent): Promise<void>;\n}\n\nexport interface IEventPublisher {\n publish<TEvent extends BaseEvent<any>>(event: TEvent): Promise<void>;\n}\n\nexport const EventPublisher = createAbstraction<IEventPublisher>(\"EventPublisher\");\n\nexport namespace EventPublisher {\n export type Interface = IEventPublisher;\n}\n"],"mappings":"AACA,SAASA,iBAAiB,QAAQ,uBAAuB;AAEzD,OAAO,MAAeC,SAAS,CAAkB;EAM7CC,WAAWA,CAACC,OAAe,EAAE;IACzB,IAAI,CAACC,UAAU,GAAG,IAAIC,IAAI,CAAC,CAAC;IAE5B,IAAIF,OAAO,KAAKG,SAAS,EAAE;MACvB,IAAI,CAACH,OAAO,GAAGG,SAAgB;IACnC,CAAC,MAAM;MACH,IAAI,CAACH,OAAO,GAAGA,OAAO;IAC1B;EACJ;AAGJ;AAUA,OAAO,MAAMI,cAAc,GAAGP,iBAAiB,CAAkB,gBAAgB,CAAC","ignoreList":[]}