@webiny/app 0.0.0-unstable.aad28a72ae → 0.0.0-unstable.ac6ebf63c6

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 (410) hide show
  1. package/App.d.ts +25 -0
  2. package/App.js +92 -0
  3. package/App.js.map +1 -0
  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 +17 -76
  10. package/apollo-client/InMemoryCache.js.map +1 -1
  11. package/apollo-client/IntrospectionFragmentMatcher.d.ts +11 -0
  12. package/apollo-client/IntrospectionFragmentMatcher.js +45 -0
  13. package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -0
  14. package/components/Image.d.ts +2 -3
  15. package/components/Image.js +12 -32
  16. package/components/Image.js.map +1 -1
  17. package/components/index.d.ts +1 -2
  18. package/components/index.js +2 -20
  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.d.ts +1 -1
  27. package/config.js +8 -16
  28. package/config.js.map +1 -1
  29. package/contexts/Ui/index.d.ts +4 -8
  30. package/contexts/Ui/index.js +29 -89
  31. package/contexts/Ui/index.js.map +1 -1
  32. package/core/DebounceRender.d.ts +12 -0
  33. package/core/DebounceRender.js +31 -0
  34. package/core/DebounceRender.js.map +1 -0
  35. package/core/Plugin.d.ts +8 -0
  36. package/core/Plugin.js +14 -0
  37. package/core/Plugin.js.map +1 -0
  38. package/core/Plugins.d.ts +15 -0
  39. package/core/Plugins.js +40 -0
  40. package/core/Plugins.js.map +1 -0
  41. package/core/Provider.d.ts +8 -0
  42. package/core/Provider.js +18 -0
  43. package/core/Provider.js.map +1 -0
  44. package/core/Routes.d.ts +7 -0
  45. package/core/Routes.js +33 -0
  46. package/core/Routes.js.map +1 -0
  47. package/core/createProvider.d.ts +10 -0
  48. package/core/createProvider.js +9 -0
  49. package/core/createProvider.js.map +1 -0
  50. package/core/createProviderPlugin.d.ts +8 -0
  51. package/core/createProviderPlugin.js +17 -0
  52. package/core/createProviderPlugin.js.map +1 -0
  53. package/errors/AuthenticationErrorEvent.d.ts +9 -0
  54. package/errors/AuthenticationErrorEvent.js +10 -0
  55. package/errors/AuthenticationErrorEvent.js.map +1 -0
  56. package/errors/NetworkErrorEvent.d.ts +15 -0
  57. package/errors/NetworkErrorEvent.js +10 -0
  58. package/errors/NetworkErrorEvent.js.map +1 -0
  59. package/errors/abstractions.d.ts +12 -0
  60. package/errors/abstractions.js +5 -0
  61. package/errors/abstractions.js.map +1 -0
  62. package/errors/index.d.ts +6 -0
  63. package/errors/index.js +6 -0
  64. package/errors/index.js.map +1 -0
  65. package/exports/admin/envConfig.d.ts +1 -0
  66. package/exports/admin/envConfig.js +3 -0
  67. package/exports/admin/envConfig.js.map +1 -0
  68. package/exports/admin/graphqlClient.d.ts +1 -0
  69. package/exports/admin/graphqlClient.js +3 -0
  70. package/exports/admin/graphqlClient.js.map +1 -0
  71. package/exports/admin/localStorage.d.ts +2 -0
  72. package/exports/admin/localStorage.js +4 -0
  73. package/exports/admin/localStorage.js.map +1 -0
  74. package/exports/admin/router.d.ts +4 -0
  75. package/exports/admin/router.js +6 -0
  76. package/exports/admin/router.js.map +1 -0
  77. package/exports/admin/security.d.ts +1 -0
  78. package/exports/admin/security.js +3 -0
  79. package/exports/admin/security.js.map +1 -0
  80. package/exports/admin.d.ts +6 -0
  81. package/exports/admin.js +8 -0
  82. package/exports/admin.js.map +1 -0
  83. package/features/envConfig/EnvConfig.d.ts +6 -0
  84. package/features/envConfig/EnvConfig.js +14 -0
  85. package/features/envConfig/EnvConfig.js.map +1 -0
  86. package/features/envConfig/abstractions.d.ts +27 -0
  87. package/features/envConfig/abstractions.js +4 -0
  88. package/features/envConfig/abstractions.js.map +1 -0
  89. package/features/envConfig/feature.d.ts +17 -0
  90. package/features/envConfig/feature.js +14 -0
  91. package/features/envConfig/feature.js.map +1 -0
  92. package/features/envConfig/index.d.ts +1 -0
  93. package/features/envConfig/index.js +3 -0
  94. package/features/envConfig/index.js.map +1 -0
  95. package/features/eventPublisher/EventPublisher.d.ts +8 -0
  96. package/features/eventPublisher/EventPublisher.js +27 -0
  97. package/features/eventPublisher/EventPublisher.js.map +1 -0
  98. package/features/eventPublisher/abstractions.d.ts +18 -0
  99. package/features/eventPublisher/abstractions.js +14 -0
  100. package/features/eventPublisher/abstractions.js.map +1 -0
  101. package/features/eventPublisher/feature.d.ts +1 -0
  102. package/features/eventPublisher/feature.js +11 -0
  103. package/features/eventPublisher/feature.js.map +1 -0
  104. package/features/eventPublisher/index.d.ts +3 -0
  105. package/features/eventPublisher/index.js +4 -0
  106. package/features/eventPublisher/index.js.map +1 -0
  107. package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
  108. package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
  109. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
  110. package/features/graphqlClient/BatchingGraphQLClient.d.ts +18 -0
  111. package/features/graphqlClient/BatchingGraphQLClient.js +164 -0
  112. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
  113. package/features/graphqlClient/FetchGraphQLClient.d.ts +10 -0
  114. package/features/graphqlClient/FetchGraphQLClient.js +62 -0
  115. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
  116. package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
  117. package/features/graphqlClient/NetworkErrorPublishing.js +55 -0
  118. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
  119. package/features/graphqlClient/RequestValue.d.ts +20 -0
  120. package/features/graphqlClient/RequestValue.js +42 -0
  121. package/features/graphqlClient/RequestValue.js.map +1 -0
  122. package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
  123. package/features/graphqlClient/RetryGraphQLClient.js +54 -0
  124. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
  125. package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
  126. package/features/graphqlClient/__tests__/GraphQLClient.test.js +350 -0
  127. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
  128. package/features/graphqlClient/abstractions.d.ts +17 -0
  129. package/features/graphqlClient/abstractions.js +4 -0
  130. package/features/graphqlClient/abstractions.js.map +1 -0
  131. package/features/graphqlClient/feature.d.ts +6 -0
  132. package/features/graphqlClient/feature.js +31 -0
  133. package/features/graphqlClient/feature.js.map +1 -0
  134. package/features/graphqlClient/index.d.ts +1 -0
  135. package/features/graphqlClient/index.js +3 -0
  136. package/features/graphqlClient/index.js.map +1 -0
  137. package/features/graphqlClient/types.d.ts +5 -0
  138. package/features/graphqlClient/types.js +3 -0
  139. package/features/graphqlClient/types.js.map +1 -0
  140. package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
  141. package/features/localStorage/BrowserLocalStorageGateway.js +68 -0
  142. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
  143. package/features/localStorage/LocalStorage.d.ts +12 -0
  144. package/features/localStorage/LocalStorage.js +31 -0
  145. package/features/localStorage/LocalStorage.js.map +1 -0
  146. package/features/localStorage/LocalStorageRepository.d.ts +20 -0
  147. package/features/localStorage/LocalStorageRepository.js +95 -0
  148. package/features/localStorage/LocalStorageRepository.js.map +1 -0
  149. package/features/localStorage/abstractions.d.ts +48 -0
  150. package/features/localStorage/abstractions.js +19 -0
  151. package/features/localStorage/abstractions.js.map +1 -0
  152. package/features/localStorage/feature.d.ts +12 -0
  153. package/features/localStorage/feature.js +34 -0
  154. package/features/localStorage/feature.js.map +1 -0
  155. package/features/localStorage/index.d.ts +1 -0
  156. package/features/localStorage/index.js +3 -0
  157. package/features/localStorage/index.js.map +1 -0
  158. package/features/router/HistoryRouterGateway.d.ts +18 -0
  159. package/features/router/HistoryRouterGateway.js +82 -0
  160. package/features/router/HistoryRouterGateway.js.map +1 -0
  161. package/features/router/HistoryRouterGateway.test.d.ts +1 -0
  162. package/features/router/HistoryRouterGateway.test.js +204 -0
  163. package/features/router/HistoryRouterGateway.test.js.map +1 -0
  164. package/features/router/Route.d.ts +19 -0
  165. package/features/router/Route.js +59 -0
  166. package/features/router/Route.js.map +1 -0
  167. package/features/router/RouteUrl.d.ts +85 -0
  168. package/features/router/RouteUrl.js +232 -0
  169. package/features/router/RouteUrl.js.map +1 -0
  170. package/features/router/Router.d.ts +45 -0
  171. package/features/router/Router.js +129 -0
  172. package/features/router/Router.js.map +1 -0
  173. package/features/router/RouterPresenter.d.ts +17 -0
  174. package/features/router/RouterPresenter.js +45 -0
  175. package/features/router/RouterPresenter.js.map +1 -0
  176. package/features/router/RouterRepository.d.ts +21 -0
  177. package/features/router/RouterRepository.js +71 -0
  178. package/features/router/RouterRepository.js.map +1 -0
  179. package/features/router/RouterRepository.test.d.ts +1 -0
  180. package/features/router/RouterRepository.test.js +154 -0
  181. package/features/router/RouterRepository.test.js.map +1 -0
  182. package/features/router/abstractions.d.ts +68 -0
  183. package/features/router/abstractions.js +15 -0
  184. package/features/router/abstractions.js.map +1 -0
  185. package/features/router/feature.d.ts +4 -0
  186. package/features/router/feature.js +18 -0
  187. package/features/router/feature.js.map +1 -0
  188. package/features/router/index.d.ts +1 -0
  189. package/features/router/index.js +3 -0
  190. package/features/router/index.js.map +1 -0
  191. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  192. package/helpers/InterfaceGenerator/date.js +3 -0
  193. package/helpers/InterfaceGenerator/date.js.map +1 -0
  194. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  195. package/helpers/InterfaceGenerator/id.js +3 -0
  196. package/helpers/InterfaceGenerator/id.js.map +1 -0
  197. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  198. package/helpers/InterfaceGenerator/identity.js +3 -0
  199. package/helpers/InterfaceGenerator/identity.js.map +1 -0
  200. package/helpers/InterfaceGenerator/index.d.ts +5 -0
  201. package/helpers/InterfaceGenerator/index.js +3 -0
  202. package/helpers/InterfaceGenerator/index.js.map +1 -0
  203. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  204. package/helpers/InterfaceGenerator/numeric.js +3 -0
  205. package/helpers/InterfaceGenerator/numeric.js.map +1 -0
  206. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  207. package/helpers/InterfaceGenerator/truthful.js +3 -0
  208. package/helpers/InterfaceGenerator/truthful.js.map +1 -0
  209. package/hooks/useAutocomplete/index.d.ts +1 -1
  210. package/hooks/useAutocomplete/index.js +2 -12
  211. package/hooks/useAutocomplete/index.js.map +1 -1
  212. package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
  213. package/hooks/useAutocomplete/useAutocomplete.js +7 -25
  214. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  215. package/hooks/useDataList/functions/getData.js +3 -15
  216. package/hooks/useDataList/functions/getData.js.map +1 -1
  217. package/hooks/useDataList/functions/getError.js +3 -15
  218. package/hooks/useDataList/functions/getError.js.map +1 -1
  219. package/hooks/useDataList/functions/getMeta.js +3 -15
  220. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  221. package/hooks/useDataList/functions/index.d.ts +3 -3
  222. package/hooks/useDataList/functions/index.js +4 -30
  223. package/hooks/useDataList/functions/index.js.map +1 -1
  224. package/hooks/useDataList/functions/searchDataByKey.js +5 -16
  225. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
  226. package/hooks/useDataList/index.d.ts +1 -1
  227. package/hooks/useDataList/index.js +2 -12
  228. package/hooks/useDataList/index.js.map +1 -1
  229. package/hooks/useDataList/useDataList.d.ts +2 -3
  230. package/hooks/useDataList/useDataList.js +76 -121
  231. package/hooks/useDataList/useDataList.js.map +1 -1
  232. package/hooks/useDataList/utils/index.d.ts +1 -2
  233. package/hooks/useDataList/utils/index.js +2 -22
  234. package/hooks/useDataList/utils/index.js.map +1 -1
  235. package/hooks/useDataList/utils/prepareLoadListParams.d.ts +1 -2
  236. package/hooks/useDataList/utils/prepareLoadListParams.js +33 -43
  237. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  238. package/hooks/useHandler.js +13 -14
  239. package/hooks/useHandler.js.map +1 -1
  240. package/hooks/useHandlers.d.ts +3 -3
  241. package/hooks/useHandlers.js +14 -21
  242. package/hooks/useHandlers.js.map +1 -1
  243. package/hooks/useRegisterLegacyPlugin.d.ts +2 -0
  244. package/hooks/useRegisterLegacyPlugin.js +11 -0
  245. package/hooks/useRegisterLegacyPlugin.js.map +1 -0
  246. package/hooks/useUi.d.ts +1 -1
  247. package/hooks/useUi.js +5 -14
  248. package/hooks/useUi.js.map +1 -1
  249. package/i18n/i18n.js +6 -20
  250. package/i18n/i18n.js.map +1 -1
  251. package/i18n/index.d.ts +1 -1
  252. package/i18n/index.js +2 -14
  253. package/i18n/index.js.map +1 -1
  254. package/index.d.ts +25 -4
  255. package/index.js +26 -35
  256. package/index.js.map +1 -1
  257. package/package.json +31 -34
  258. package/plugins/AddQuerySelectionPlugin.d.ts +10 -3
  259. package/plugins/AddQuerySelectionPlugin.js +64 -124
  260. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  261. package/plugins/ApolloCacheObjectIdPlugin.js +13 -50
  262. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  263. package/plugins/ApolloDynamicLink.d.ts +3 -2
  264. package/plugins/ApolloDynamicLink.js +20 -72
  265. package/plugins/ApolloDynamicLink.js.map +1 -1
  266. package/plugins/ApolloLinkPlugin.d.ts +1 -1
  267. package/plugins/ApolloLinkPlugin.js +19 -60
  268. package/plugins/ApolloLinkPlugin.js.map +1 -1
  269. package/plugins/ConsoleLinkPlugin.d.ts +1 -1
  270. package/plugins/ConsoleLinkPlugin.js +21 -58
  271. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  272. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
  273. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +36 -78
  274. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  275. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
  276. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +31 -0
  277. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
  278. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  279. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +31 -0
  280. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  281. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +8 -5
  282. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +76 -19
  283. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  284. package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
  285. package/plugins/NetworkErrorLinkPlugin/Typography.js +18 -0
  286. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
  287. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
  288. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +18 -34
  289. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  290. package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
  291. package/plugins/NetworkErrorLinkPlugin.js +62 -57
  292. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  293. package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
  294. package/plugins/OmitTypenameLinkPlugin.js +13 -47
  295. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  296. package/plugins/TenantHeaderLinkPlugin.d.ts +3 -8
  297. package/plugins/TenantHeaderLinkPlugin.js +30 -78
  298. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  299. package/plugins/components/Image.d.ts +6 -0
  300. package/plugins/components/Image.js +19 -0
  301. package/plugins/components/Image.js.map +1 -0
  302. package/plugins/image.d.ts +1 -1
  303. package/plugins/image.js +55 -94
  304. package/plugins/image.js.map +1 -1
  305. package/plugins/index.d.ts +5 -5
  306. package/plugins/index.js +34 -78
  307. package/plugins/index.js.map +1 -1
  308. package/presentation/localStorage/index.d.ts +3 -0
  309. package/presentation/localStorage/index.js +5 -0
  310. package/presentation/localStorage/index.js.map +1 -0
  311. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  312. package/presentation/localStorage/useLocalStorage.js +21 -0
  313. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  314. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  315. package/presentation/localStorage/useLocalStorageValue.js +20 -0
  316. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  317. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  318. package/presentation/localStorage/useLocalStorageValues.js +39 -0
  319. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  320. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  321. package/presentation/router/RouteElementRegistry.js +32 -0
  322. package/presentation/router/RouteElementRegistry.js.map +1 -0
  323. package/presentation/router/abstractions.d.ts +13 -0
  324. package/presentation/router/abstractions.js +4 -0
  325. package/presentation/router/abstractions.js.map +1 -0
  326. package/presentation/router/components/RouteContent.d.ts +2 -0
  327. package/presentation/router/components/RouteContent.js +17 -0
  328. package/presentation/router/components/RouteContent.js.map +1 -0
  329. package/presentation/router/components/RouteLink.d.ts +50 -0
  330. package/presentation/router/components/RouteLink.js +22 -0
  331. package/presentation/router/components/RouteLink.js.map +1 -0
  332. package/presentation/router/components/SimpleLink.d.ts +44 -0
  333. package/presentation/router/components/SimpleLink.js +30 -0
  334. package/presentation/router/components/SimpleLink.js.map +1 -0
  335. package/presentation/router/hooks/useRoute.d.ts +6 -0
  336. package/presentation/router/hooks/useRoute.js +30 -0
  337. package/presentation/router/hooks/useRoute.js.map +1 -0
  338. package/presentation/router/hooks/useRouter.d.ts +7 -0
  339. package/presentation/router/hooks/useRouter.js +26 -0
  340. package/presentation/router/hooks/useRouter.js.map +1 -0
  341. package/presentation/router/index.d.ts +4 -0
  342. package/presentation/router/index.js +5 -0
  343. package/presentation/router/index.js.map +1 -0
  344. package/presentation/router/types.d.ts +5 -0
  345. package/presentation/router/types.js +3 -0
  346. package/presentation/router/types.js.map +1 -0
  347. package/react-butterfiles/Files.d.ts +69 -0
  348. package/react-butterfiles/Files.js +227 -0
  349. package/react-butterfiles/Files.js.map +1 -0
  350. package/react-butterfiles/file.todo +1 -0
  351. package/react-butterfiles/index.d.ts +2 -0
  352. package/react-butterfiles/index.js +4 -0
  353. package/react-butterfiles/index.js.map +1 -0
  354. package/react-butterfiles/utils/generateId.d.ts +1 -0
  355. package/react-butterfiles/utils/generateId.js +5 -0
  356. package/react-butterfiles/utils/generateId.js.map +1 -0
  357. package/react-butterfiles/utils/readFileContent.d.ts +1 -0
  358. package/react-butterfiles/utils/readFileContent.js +15 -0
  359. package/react-butterfiles/utils/readFileContent.js.map +1 -0
  360. package/renderApp.d.ts +2 -0
  361. package/renderApp.js +9 -0
  362. package/renderApp.js.map +1 -0
  363. package/router.d.ts +5 -0
  364. package/router.js +8 -0
  365. package/router.js.map +1 -0
  366. package/shared/di/DiContainerProvider.d.ts +8 -0
  367. package/shared/di/DiContainerProvider.js +17 -0
  368. package/shared/di/DiContainerProvider.js.map +1 -0
  369. package/shared/di/createFeature.d.ts +11 -0
  370. package/shared/di/createFeature.js +11 -0
  371. package/shared/di/createFeature.js.map +1 -0
  372. package/shared/di/useFeature.d.ts +2 -0
  373. package/shared/di/useFeature.js +18 -0
  374. package/shared/di/useFeature.js.map +1 -0
  375. package/types.d.ts +30 -30
  376. package/types.js +2 -12
  377. package/types.js.map +1 -1
  378. package/utils/createGenericContext.d.ts +13 -0
  379. package/utils/createGenericContext.js +25 -0
  380. package/utils/createGenericContext.js.map +1 -0
  381. package/utils/createHashing.d.ts +2 -0
  382. package/utils/createHashing.js +18 -0
  383. package/utils/createHashing.js.map +1 -0
  384. package/utils/index.d.ts +2 -0
  385. package/utils/index.js +4 -0
  386. package/utils/index.js.map +1 -0
  387. package/utils/legacyPluginToReactComponent.d.ts +7 -0
  388. package/utils/legacyPluginToReactComponent.js +14 -0
  389. package/utils/legacyPluginToReactComponent.js.map +1 -0
  390. package/components/Routes.d.ts +0 -2
  391. package/components/Routes.js +0 -49
  392. package/components/Routes.js.map +0 -1
  393. package/components/View.d.ts +0 -8
  394. package/components/View.js +0 -41
  395. package/components/View.js.map +0 -1
  396. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  397. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -31
  398. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  399. package/hooks/useDataList/utils/types.d.ts +0 -34
  400. package/hooks/useDataList/utils/types.js +0 -5
  401. package/hooks/useDataList/utils/types.js.map +0 -1
  402. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -15
  403. package/plugins/LocaleHeaderLinkPlugin.js +0 -77
  404. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  405. package/plugins/RoutePlugin.d.ts +0 -12
  406. package/plugins/RoutePlugin.js +0 -53
  407. package/plugins/RoutePlugin.js.map +0 -1
  408. package/plugins/ViewPlugin.d.ts +0 -14
  409. package/plugins/ViewPlugin.js +0 -58
  410. package/plugins/ViewPlugin.js.map +0 -1
package/App.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { Decorator, DecoratorsCollection, GenericComponent } from "@webiny/react-composition";
3
+ interface State {
4
+ plugins: JSX.Element[];
5
+ providers: Decorator<GenericComponent<ProviderProps>>[];
6
+ }
7
+ interface AppContext extends State {
8
+ addProvider(hoc: Decorator<GenericComponent<ProviderProps>>): void;
9
+ addPlugin(plugin: React.ReactNode): void;
10
+ }
11
+ declare const AppContext: React.Context<AppContext | undefined>;
12
+ export declare const useApp: () => AppContext;
13
+ export interface AppProps {
14
+ debounceRender?: number;
15
+ routes?: Array<any>;
16
+ providers?: Array<Decorator<GenericComponent<ProviderProps>>>;
17
+ decorators?: DecoratorsCollection;
18
+ children?: React.ReactNode | React.ReactNode[];
19
+ }
20
+ interface ProviderProps {
21
+ children: React.ReactNode;
22
+ }
23
+ export declare const AppBase: React.MemoExoticComponent<({ debounceRender, routes, providers, children }: AppProps) => React.JSX.Element>;
24
+ export declare const App: ({ decorators, ...props }: AppProps) => React.JSX.Element;
25
+ export {};
package/App.js ADDED
@@ -0,0 +1,92 @@
1
+ import React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
2
+ import { compose, CompositionProvider } from "@webiny/react-composition";
3
+ import { DebounceRender } from "./core/DebounceRender.js";
4
+ import { PluginsProvider } from "./core/Plugins.js";
5
+ import { RouterWithConfig, useRouterConfig } from "./config/RouterConfig.js";
6
+ import { AppContainer } from "./AppContainer.js";
7
+ import { RouteContent } from "./presentation/router/components/RouteContent.js";
8
+ import { useRouter } from "./router.js";
9
+ const AppContext = /*#__PURE__*/createContext(undefined);
10
+ AppContext.displayName = "AppContext";
11
+ export const useApp = () => {
12
+ const appContext = useContext(AppContext);
13
+ if (!appContext) {
14
+ throw Error(`AppContext provider was not found. Are you using the "useApp()" hook in the right place?`);
15
+ }
16
+ return appContext;
17
+ };
18
+ export const AppBase = /*#__PURE__*/React.memo(({
19
+ debounceRender = 50,
20
+ routes = [],
21
+ providers = [],
22
+ children
23
+ }) => {
24
+ const [state, setState] = useState({
25
+ plugins: [],
26
+ providers
27
+ });
28
+ const addProvider = useCallback(component => {
29
+ setState(state => {
30
+ if (state.providers.findIndex(m => m === component) > -1) {
31
+ return state;
32
+ }
33
+ return {
34
+ ...state,
35
+ providers: [...state.providers, component]
36
+ };
37
+ });
38
+ }, []);
39
+ const addPlugin = useCallback(element => {
40
+ setState(state => {
41
+ return {
42
+ ...state,
43
+ plugins: [...state.plugins, element]
44
+ };
45
+ });
46
+ }, []);
47
+ const appContext = useMemo(() => ({
48
+ ...state,
49
+ addProvider,
50
+ addPlugin
51
+ }), [state]);
52
+ const AppRouter = useMemo(() => {
53
+ return function AppRouter() {
54
+ const router = useRouter();
55
+ const routerConfig = useRouterConfig();
56
+ const routesFromConfig = routerConfig.routes;
57
+ const combinedRoutes = [...routes, ...routesFromConfig];
58
+ useEffect(() => {
59
+ router.setRoutes(combinedRoutes);
60
+ }, [combinedRoutes.length]);
61
+ return null;
62
+ };
63
+ }, []);
64
+ const Providers = useMemo(() => {
65
+ return /*#__PURE__*/React.memo(compose(...(state.providers || []))(({
66
+ children
67
+ }) => {
68
+ return /*#__PURE__*/React.createElement(DebounceRender, {
69
+ wait: debounceRender
70
+ }, children);
71
+ }));
72
+ }, [state.providers.length]);
73
+ Providers.displayName = "Providers";
74
+ return /*#__PURE__*/React.createElement(AppContext.Provider, {
75
+ value: appContext
76
+ }, children, /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement(Providers, null, /*#__PURE__*/React.createElement(PluginsProvider, null, state.plugins), /*#__PURE__*/React.createElement(DebounceRender, {
77
+ wait: debounceRender
78
+ }, /*#__PURE__*/React.createElement(RouterWithConfig, null, /*#__PURE__*/React.createElement(AppRouter, null), /*#__PURE__*/React.createElement(RouteContent, null))))));
79
+ });
80
+ AppBase.displayName = "AppBase";
81
+ export const App = ({
82
+ decorators,
83
+ ...props
84
+ }) => {
85
+ return /*#__PURE__*/React.createElement(CompositionProvider, {
86
+ decorators: decorators
87
+ }, /*#__PURE__*/React.createElement(AppBase, Object.assign({
88
+ decorators: decorators
89
+ }, props)));
90
+ };
91
+
92
+ //# sourceMappingURL=App.js.map
package/App.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","createContext","useCallback","useContext","useEffect","useMemo","useState","compose","CompositionProvider","DebounceRender","PluginsProvider","RouterWithConfig","useRouterConfig","AppContainer","RouteContent","useRouter","AppContext","undefined","displayName","useApp","appContext","Error","AppBase","memo","debounceRender","routes","providers","children","state","setState","plugins","addProvider","component","findIndex","m","addPlugin","element","AppRouter","router","routerConfig","routesFromConfig","combinedRoutes","setRoutes","length","Providers","createElement","wait","Provider","value","App","decorators","props","Object","assign"],"sources":["App.tsx"],"sourcesContent":["import React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from \"react\";\nimport {\n compose,\n CompositionProvider,\n Decorator,\n DecoratorsCollection,\n GenericComponent\n} from \"@webiny/react-composition\";\nimport { DebounceRender } from \"./core/DebounceRender.js\";\nimport { PluginsProvider } from \"./core/Plugins.js\";\nimport { RouterWithConfig, useRouterConfig } from \"./config/RouterConfig.js\";\nimport { AppContainer } from \"./AppContainer.js\";\nimport { RouteContent } from \"~/presentation/router/components/RouteContent.js\";\nimport { useRouter } from \"~/router.js\";\n\ninterface State {\n plugins: JSX.Element[];\n providers: Decorator<GenericComponent<ProviderProps>>[];\n}\n\ninterface AppContext extends State {\n addProvider(hoc: Decorator<GenericComponent<ProviderProps>>): void;\n\n addPlugin(plugin: React.ReactNode): void;\n}\n\nconst AppContext = createContext<AppContext | undefined>(undefined);\n\nAppContext.displayName = \"AppContext\";\n\nexport const useApp = () => {\n const appContext = useContext(AppContext);\n if (!appContext) {\n throw Error(\n `AppContext provider was not found. Are you using the \"useApp()\" hook in the right place?`\n );\n }\n return appContext;\n};\n\nexport interface AppProps {\n debounceRender?: number;\n routes?: Array<any>;\n providers?: Array<Decorator<GenericComponent<ProviderProps>>>;\n decorators?: DecoratorsCollection;\n children?: React.ReactNode | React.ReactNode[];\n}\n\ninterface ProviderProps {\n children: React.ReactNode;\n}\n\ntype ComponentWithChildren = React.ComponentType<{ children?: React.ReactNode }>;\n\nexport const AppBase = React.memo(\n ({ debounceRender = 50, routes = [], providers = [], children }: AppProps) => {\n const [state, setState] = useState<State>({\n plugins: [],\n providers\n });\n\n const addProvider = useCallback((component: Decorator<any>) => {\n setState(state => {\n if (state.providers.findIndex(m => m === component) > -1) {\n return state;\n }\n\n return {\n ...state,\n providers: [...state.providers, component]\n };\n });\n }, []);\n\n const addPlugin = useCallback((element: JSX.Element) => {\n setState(state => {\n return {\n ...state,\n plugins: [...state.plugins, element]\n };\n });\n }, []);\n\n const appContext = useMemo(\n () => ({\n ...state,\n addProvider,\n addPlugin\n }),\n [state]\n );\n\n const AppRouter = useMemo(() => {\n return function AppRouter() {\n const router = useRouter();\n const routerConfig = useRouterConfig();\n const routesFromConfig = routerConfig.routes;\n const combinedRoutes = [...routes, ...routesFromConfig];\n\n useEffect(() => {\n router.setRoutes(combinedRoutes);\n }, [combinedRoutes.length]);\n\n return null;\n };\n }, []);\n\n const Providers = useMemo(() => {\n return React.memo(\n compose(...(state.providers || []))(({ children }: ProviderProps) => {\n return <DebounceRender wait={debounceRender}>{children}</DebounceRender>;\n })\n );\n }, [state.providers.length]) as ComponentWithChildren;\n\n Providers.displayName = \"Providers\";\n\n return (\n <AppContext.Provider value={appContext}>\n {children}\n <AppContainer>\n <Providers>\n <PluginsProvider>{state.plugins}</PluginsProvider>\n <DebounceRender wait={debounceRender}>\n <RouterWithConfig>\n <AppRouter />\n <RouteContent />\n </RouterWithConfig>\n </DebounceRender>\n </Providers>\n </AppContainer>\n </AppContext.Provider>\n );\n }\n);\n\nAppBase.displayName = \"AppBase\";\n\nexport const App = ({ decorators, ...props }: AppProps) => {\n return (\n <CompositionProvider decorators={decorators}>\n <AppBase decorators={decorators} {...props} />\n </CompositionProvider>\n );\n};\n"],"mappings":"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","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ export interface AppContentProps {
3
+ children: React.ReactNode;
4
+ }
5
+ export declare const AppContainer: (({ children }: AppContentProps) => React.JSX.Element) & {
6
+ original: ({ children }: AppContentProps) => React.JSX.Element;
7
+ originalName: string;
8
+ displayName: string;
9
+ } & {
10
+ original: (({ children }: AppContentProps) => React.JSX.Element) & {
11
+ original: ({ children }: AppContentProps) => React.JSX.Element;
12
+ originalName: string;
13
+ displayName: string;
14
+ };
15
+ originalName: string;
16
+ displayName: string;
17
+ } & {
18
+ createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({ children }: AppContentProps) => React.JSX.Element) & {
19
+ original: ({ children }: AppContentProps) => React.JSX.Element;
20
+ originalName: string;
21
+ displayName: string;
22
+ }>) => (props: unknown) => React.JSX.Element;
23
+ };
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { makeDecoratable } from "@webiny/react-composition";
3
+ export const AppContainer = makeDecoratable("AppContainer", ({
4
+ children
5
+ }) => {
6
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
7
+ });
8
+
9
+ //# sourceMappingURL=AppContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","makeDecoratable","AppContainer","children","createElement","Fragment"],"sources":["AppContainer.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\n\nexport interface AppContentProps {\n children: React.ReactNode;\n}\n\nexport const AppContainer = makeDecoratable(\"AppContainer\", ({ children }: AppContentProps) => {\n return <>{children}</>;\n});\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,QAAQ,2BAA2B;AAM3D,OAAO,MAAMC,YAAY,GAAGD,eAAe,CAAC,cAAc,EAAE,CAAC;EAAEE;AAA0B,CAAC,KAAK;EAC3F,oBAAOH,KAAA,CAAAI,aAAA,CAAAJ,KAAA,CAAAK,QAAA,QAAGF,QAAW,CAAC;AAC1B,CAAC,CAAC","ignoreList":[]}
package/README.md CHANGED
@@ -1,19 +1,11 @@
1
1
  # @webiny/app
2
- [![](https://img.shields.io/npm/dw/@webiny/app.svg)](https://www.npmjs.com/package/@webiny/app)
3
- [![](https://img.shields.io/npm/v/@webiny/app.svg)](https://www.npmjs.com/package/@webiny/app)
4
- [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
5
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
6
2
 
7
- The base package for building Webiny and React powered web apps.
3
+ > [!NOTE]
4
+ > This package is part of the [Webiny](https://www.webiny.com) monorepo.
5
+ > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
8
6
 
9
- For more information, please visit [the official docs](https://docs.webiny.com/docs/webiny/introduction).
10
-
11
- ## Install
12
- ```
13
- npm install --save @webiny/app
14
- ```
7
+ 📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
15
8
 
16
- Or if you prefer yarn:
17
- ```
18
- yarn add @webiny/app
19
- ```
9
+ ---
10
+
11
+ _This README file is automatically generated during the publish process._
@@ -1,5 +1,6 @@
1
- import { InMemoryCache as BaseInMemoryCache, InMemoryCacheConfig } from "apollo-cache-inmemory";
2
- import { DocumentNode } from "graphql";
1
+ import type { InMemoryCacheConfig } from "apollo-cache-inmemory";
2
+ import { InMemoryCache as BaseInMemoryCache } from "apollo-cache-inmemory";
3
+ import type { DocumentNode } from "graphql";
3
4
  export declare class InMemoryCache extends BaseInMemoryCache {
4
5
  private readonly transformPlugins;
5
6
  constructor(config?: InMemoryCacheConfig);
@@ -1,79 +1,20 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.InMemoryCache = void 0;
9
-
10
- var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
- var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
19
-
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
23
-
24
- var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
25
-
26
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
-
28
- var _apolloCacheInmemory = require("apollo-cache-inmemory");
29
-
30
- var _plugins = require("@webiny/plugins");
31
-
32
- var _AddQuerySelectionPlugin = require("../plugins/AddQuerySelectionPlugin");
33
-
34
- var _ApolloLinkPlugin = require("../plugins/ApolloLinkPlugin");
35
-
36
- var InMemoryCache = /*#__PURE__*/function (_BaseInMemoryCache) {
37
- (0, _inherits2.default)(InMemoryCache, _BaseInMemoryCache);
38
-
39
- var _super = (0, _createSuper2.default)(InMemoryCache);
40
-
41
- function InMemoryCache(config) {
42
- var _this;
43
-
44
- (0, _classCallCheck2.default)(this, InMemoryCache);
45
- _this = _super.call(this, config);
46
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "transformPlugins", void 0);
47
- _this.transformPlugins = _plugins.plugins.byType(_ApolloLinkPlugin.ApolloLinkPlugin.type).filter(function (pl) {
48
- return pl instanceof _AddQuerySelectionPlugin.AddQuerySelectionPlugin;
49
- });
50
- return _this;
1
+ import { InMemoryCache as BaseInMemoryCache } from "apollo-cache-inmemory";
2
+ import { plugins } from "@webiny/plugins";
3
+ import { AddQuerySelectionPlugin } from "../plugins/AddQuerySelectionPlugin.js";
4
+ import { ApolloLinkPlugin } from "../plugins/ApolloLinkPlugin.js";
5
+ export class InMemoryCache extends BaseInMemoryCache {
6
+ constructor(config) {
7
+ super(config);
8
+ this.transformPlugins = plugins.byType(ApolloLinkPlugin.type).filter(pl => pl instanceof AddQuerySelectionPlugin);
51
9
  }
52
-
53
- (0, _createClass2.default)(InMemoryCache, [{
54
- key: "transformDocument",
55
- value: function transformDocument(document) {
56
- // @ts-ignore
57
- var operationName = document.definitions[0].name.value;
58
-
59
- var _iterator = (0, _createForOfIteratorHelper2.default)(this.transformPlugins),
60
- _step;
61
-
62
- try {
63
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
64
- var pl = _step.value;
65
- pl.addSelectionToQuery(operationName, document);
66
- }
67
- } catch (err) {
68
- _iterator.e(err);
69
- } finally {
70
- _iterator.f();
71
- }
72
-
73
- return (0, _get2.default)((0, _getPrototypeOf2.default)(InMemoryCache.prototype), "transformDocument", this).call(this, document);
10
+ transformDocument(document) {
11
+ // @ts-expect-error
12
+ const operationName = document.definitions[0].name.value;
13
+ for (const pl of this.transformPlugins) {
14
+ pl.addSelectionToQuery(operationName, document);
74
15
  }
75
- }]);
76
- return InMemoryCache;
77
- }(_apolloCacheInmemory.InMemoryCache);
16
+ return super.transformDocument(document);
17
+ }
18
+ }
78
19
 
79
- exports.InMemoryCache = InMemoryCache;
20
+ //# sourceMappingURL=InMemoryCache.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["InMemoryCache","config","transformPlugins","plugins","byType","ApolloLinkPlugin","type","filter","pl","AddQuerySelectionPlugin","document","operationName","definitions","name","value","addSelectionToQuery","BaseInMemoryCache"],"sources":["InMemoryCache.ts"],"sourcesContent":["import { InMemoryCache as BaseInMemoryCache, InMemoryCacheConfig } from \"apollo-cache-inmemory\";\nimport { DocumentNode } from \"graphql\";\nimport { plugins } from \"@webiny/plugins\";\nimport { AddQuerySelectionPlugin } from \"../plugins/AddQuerySelectionPlugin\";\nimport { ApolloLinkPlugin } from \"../plugins/ApolloLinkPlugin\";\n\nexport class InMemoryCache extends BaseInMemoryCache {\n private readonly transformPlugins: AddQuerySelectionPlugin[];\n\n constructor(config?: InMemoryCacheConfig) {\n super(config);\n\n this.transformPlugins = plugins\n .byType<AddQuerySelectionPlugin>(ApolloLinkPlugin.type)\n .filter(pl => pl instanceof AddQuerySelectionPlugin);\n }\n\n public override transformDocument(document: DocumentNode): DocumentNode {\n // @ts-ignore\n const operationName = document.definitions[0].name.value;\n\n for (const pl of this.transformPlugins) {\n pl.addSelectionToQuery(operationName, document);\n }\n\n return super.transformDocument(document);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;IAEaA,a;;;;;EAGT,uBAAYC,MAAZ,EAA0C;IAAA;;IAAA;IACtC,0BAAMA,MAAN;IADsC;IAGtC,MAAKC,gBAAL,GAAwBC,gBAAA,CACnBC,MADmB,CACaC,kCAAA,CAAiBC,IAD9B,EAEnBC,MAFmB,CAEZ,UAAAC,EAAE;MAAA,OAAIA,EAAE,YAAYC,gDAAlB;IAAA,CAFU,CAAxB;IAHsC;EAMzC;;;;WAED,2BAAkCC,QAAlC,EAAwE;MACpE;MACA,IAAMC,aAAa,GAAGD,QAAQ,CAACE,WAAT,CAAqB,CAArB,EAAwBC,IAAxB,CAA6BC,KAAnD;;MAFoE,yDAInD,KAAKZ,gBAJ8C;MAAA;;MAAA;QAIpE,oDAAwC;UAAA,IAA7BM,EAA6B;UACpCA,EAAE,CAACO,mBAAH,CAAuBJ,aAAvB,EAAsCD,QAAtC;QACH;MANmE;QAAA;MAAA;QAAA;MAAA;;MAQpE,wHAA+BA,QAA/B;IACH;;;EApB8BM,kC"}
1
+ {"version":3,"names":["InMemoryCache","BaseInMemoryCache","plugins","AddQuerySelectionPlugin","ApolloLinkPlugin","constructor","config","transformPlugins","byType","type","filter","pl","transformDocument","document","operationName","definitions","name","value","addSelectionToQuery"],"sources":["InMemoryCache.ts"],"sourcesContent":["import type { InMemoryCacheConfig } from \"apollo-cache-inmemory\";\nimport { InMemoryCache as BaseInMemoryCache } from \"apollo-cache-inmemory\";\nimport type { DocumentNode } from \"graphql\";\nimport { plugins } from \"@webiny/plugins\";\nimport { AddQuerySelectionPlugin } from \"../plugins/AddQuerySelectionPlugin.js\";\nimport { ApolloLinkPlugin } from \"../plugins/ApolloLinkPlugin.js\";\n\nexport class InMemoryCache extends BaseInMemoryCache {\n private readonly transformPlugins: AddQuerySelectionPlugin[];\n\n constructor(config?: InMemoryCacheConfig) {\n super(config);\n\n this.transformPlugins = plugins\n .byType<AddQuerySelectionPlugin>(ApolloLinkPlugin.type)\n .filter(pl => pl instanceof AddQuerySelectionPlugin);\n }\n\n public override transformDocument(document: DocumentNode): DocumentNode {\n // @ts-expect-error\n const operationName = document.definitions[0].name.value;\n\n for (const pl of this.transformPlugins) {\n pl.addSelectionToQuery(operationName, document);\n }\n\n return super.transformDocument(document);\n }\n}\n"],"mappings":"AACA,SAASA,aAAa,IAAIC,iBAAiB,QAAQ,uBAAuB;AAE1E,SAASC,OAAO,QAAQ,iBAAiB;AACzC,SAASC,uBAAuB;AAChC,SAASC,gBAAgB;AAEzB,OAAO,MAAMJ,aAAa,SAASC,iBAAiB,CAAC;EAGjDI,WAAWA,CAACC,MAA4B,EAAE;IACtC,KAAK,CAACA,MAAM,CAAC;IAEb,IAAI,CAACC,gBAAgB,GAAGL,OAAO,CAC1BM,MAAM,CAA0BJ,gBAAgB,CAACK,IAAI,CAAC,CACtDC,MAAM,CAACC,EAAE,IAAIA,EAAE,YAAYR,uBAAuB,CAAC;EAC5D;EAEgBS,iBAAiBA,CAACC,QAAsB,EAAgB;IACpE;IACA,MAAMC,aAAa,GAAGD,QAAQ,CAACE,WAAW,CAAC,CAAC,CAAC,CAACC,IAAI,CAACC,KAAK;IAExD,KAAK,MAAMN,EAAE,IAAI,IAAI,CAACJ,gBAAgB,EAAE;MACpCI,EAAE,CAACO,mBAAmB,CAACJ,aAAa,EAAED,QAAQ,CAAC;IACnD;IAEA,OAAO,KAAK,CAACD,iBAAiB,CAACC,QAAQ,CAAC;EAC5C;AACJ","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import type { IdValue } from "apollo-utilities";
2
+ import type { ReadStoreContext, FragmentMatcherInterface, IntrospectionResultData } from "apollo-cache-inmemory";
3
+ export declare class IntrospectionFragmentMatcher implements FragmentMatcherInterface {
4
+ private readonly isReady;
5
+ private readonly possibleTypesMap;
6
+ constructor(options?: {
7
+ introspectionQueryResultData?: IntrospectionResultData;
8
+ });
9
+ match(idValue: IdValue, typeCondition: string, context: ReadStoreContext): boolean;
10
+ private parseIntrospectionResult;
11
+ }
@@ -0,0 +1,45 @@
1
+ import { invariant } from "ts-invariant";
2
+ export class IntrospectionFragmentMatcher {
3
+ possibleTypesMap = {};
4
+ constructor(options) {
5
+ if (options && options.introspectionQueryResultData) {
6
+ this.possibleTypesMap = this.parseIntrospectionResult(options.introspectionQueryResultData);
7
+ this.isReady = true;
8
+ } else {
9
+ this.isReady = false;
10
+ }
11
+ this.match = this.match.bind(this);
12
+ }
13
+ match(idValue, typeCondition, context) {
14
+ invariant(this.isReady, "FragmentMatcher.match() was called before FragmentMatcher.init()");
15
+ const obj = context.store.get(idValue.id);
16
+ const isRootQuery = idValue.id === "ROOT_QUERY";
17
+ if (!obj) {
18
+ // https://github.com/apollographql/apollo-client/pull/4620
19
+ return isRootQuery;
20
+ }
21
+ const {
22
+ __typename = isRootQuery && "Query"
23
+ } = obj;
24
+ invariant(__typename, `Cannot match fragment because __typename property is missing: ${JSON.stringify(obj)}`);
25
+ if (__typename === typeCondition) {
26
+ return true;
27
+ }
28
+ const implementingTypes = this.possibleTypesMap[typeCondition];
29
+ if (__typename && implementingTypes && implementingTypes.indexOf(__typename) > -1) {
30
+ return true;
31
+ }
32
+ return false;
33
+ }
34
+ parseIntrospectionResult(introspectionResultData) {
35
+ const typeMap = {};
36
+ introspectionResultData.__schema.types.forEach(type => {
37
+ if (type.kind === "UNION" || type.kind === "INTERFACE") {
38
+ typeMap[type.name] = type.possibleTypes.map(implementingType => implementingType.name);
39
+ }
40
+ });
41
+ return typeMap;
42
+ }
43
+ }
44
+
45
+ //# sourceMappingURL=IntrospectionFragmentMatcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["invariant","IntrospectionFragmentMatcher","possibleTypesMap","constructor","options","introspectionQueryResultData","parseIntrospectionResult","isReady","match","bind","idValue","typeCondition","context","obj","store","get","id","isRootQuery","__typename","JSON","stringify","implementingTypes","indexOf","introspectionResultData","typeMap","__schema","types","forEach","type","kind","name","possibleTypes","map","implementingType"],"sources":["IntrospectionFragmentMatcher.ts"],"sourcesContent":["import type { IdValue } from \"apollo-utilities\";\nimport { invariant } from \"ts-invariant\";\n\nimport type {\n ReadStoreContext,\n FragmentMatcherInterface,\n PossibleTypesMap,\n IntrospectionResultData\n} from \"apollo-cache-inmemory\";\n\nexport class IntrospectionFragmentMatcher implements FragmentMatcherInterface {\n private readonly isReady: boolean;\n private readonly possibleTypesMap: PossibleTypesMap = {};\n\n constructor(options?: { introspectionQueryResultData?: IntrospectionResultData }) {\n if (options && options.introspectionQueryResultData) {\n this.possibleTypesMap = this.parseIntrospectionResult(\n options.introspectionQueryResultData\n );\n this.isReady = true;\n } else {\n this.isReady = false;\n }\n\n this.match = this.match.bind(this);\n }\n\n public match(idValue: IdValue, typeCondition: string, context: ReadStoreContext) {\n invariant(this.isReady, \"FragmentMatcher.match() was called before FragmentMatcher.init()\");\n\n const obj = context.store.get(idValue.id);\n const isRootQuery = idValue.id === \"ROOT_QUERY\";\n\n if (!obj) {\n // https://github.com/apollographql/apollo-client/pull/4620\n return isRootQuery;\n }\n\n const { __typename = isRootQuery && \"Query\" } = obj;\n\n invariant(\n __typename,\n `Cannot match fragment because __typename property is missing: ${JSON.stringify(obj)}`\n );\n\n if (__typename === typeCondition) {\n return true;\n }\n\n const implementingTypes = this.possibleTypesMap[typeCondition];\n if (__typename && implementingTypes && implementingTypes.indexOf(__typename) > -1) {\n return true;\n }\n\n return false;\n }\n\n private parseIntrospectionResult(\n introspectionResultData: IntrospectionResultData\n ): PossibleTypesMap {\n const typeMap: PossibleTypesMap = {};\n introspectionResultData.__schema.types.forEach(type => {\n if (type.kind === \"UNION\" || type.kind === \"INTERFACE\") {\n typeMap[type.name] = type.possibleTypes.map(\n implementingType => implementingType.name\n );\n }\n });\n return typeMap;\n }\n}\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,cAAc;AASxC,OAAO,MAAMC,4BAA4B,CAAqC;EAEzDC,gBAAgB,GAAqB,CAAC,CAAC;EAExDC,WAAWA,CAACC,OAAoE,EAAE;IAC9E,IAAIA,OAAO,IAAIA,OAAO,CAACC,4BAA4B,EAAE;MACjD,IAAI,CAACH,gBAAgB,GAAG,IAAI,CAACI,wBAAwB,CACjDF,OAAO,CAACC,4BACZ,CAAC;MACD,IAAI,CAACE,OAAO,GAAG,IAAI;IACvB,CAAC,MAAM;MACH,IAAI,CAACA,OAAO,GAAG,KAAK;IACxB;IAEA,IAAI,CAACC,KAAK,GAAG,IAAI,CAACA,KAAK,CAACC,IAAI,CAAC,IAAI,CAAC;EACtC;EAEOD,KAAKA,CAACE,OAAgB,EAAEC,aAAqB,EAAEC,OAAyB,EAAE;IAC7EZ,SAAS,CAAC,IAAI,CAACO,OAAO,EAAE,kEAAkE,CAAC;IAE3F,MAAMM,GAAG,GAAGD,OAAO,CAACE,KAAK,CAACC,GAAG,CAACL,OAAO,CAACM,EAAE,CAAC;IACzC,MAAMC,WAAW,GAAGP,OAAO,CAACM,EAAE,KAAK,YAAY;IAE/C,IAAI,CAACH,GAAG,EAAE;MACN;MACA,OAAOI,WAAW;IACtB;IAEA,MAAM;MAAEC,UAAU,GAAGD,WAAW,IAAI;IAAQ,CAAC,GAAGJ,GAAG;IAEnDb,SAAS,CACLkB,UAAU,EACV,iEAAiEC,IAAI,CAACC,SAAS,CAACP,GAAG,CAAC,EACxF,CAAC;IAED,IAAIK,UAAU,KAAKP,aAAa,EAAE;MAC9B,OAAO,IAAI;IACf;IAEA,MAAMU,iBAAiB,GAAG,IAAI,CAACnB,gBAAgB,CAACS,aAAa,CAAC;IAC9D,IAAIO,UAAU,IAAIG,iBAAiB,IAAIA,iBAAiB,CAACC,OAAO,CAACJ,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE;MAC/E,OAAO,IAAI;IACf;IAEA,OAAO,KAAK;EAChB;EAEQZ,wBAAwBA,CAC5BiB,uBAAgD,EAChC;IAChB,MAAMC,OAAyB,GAAG,CAAC,CAAC;IACpCD,uBAAuB,CAACE,QAAQ,CAACC,KAAK,CAACC,OAAO,CAACC,IAAI,IAAI;MACnD,IAAIA,IAAI,CAACC,IAAI,KAAK,OAAO,IAAID,IAAI,CAACC,IAAI,KAAK,WAAW,EAAE;QACpDL,OAAO,CAACI,IAAI,CAACE,IAAI,CAAC,GAAGF,IAAI,CAACG,aAAa,CAACC,GAAG,CACvCC,gBAAgB,IAAIA,gBAAgB,CAACH,IACzC,CAAC;MACL;IACJ,CAAC,CAAC;IACF,OAAON,OAAO;EAClB;AACJ","ignoreList":[]}
@@ -1,3 +1,2 @@
1
- import * as React from "react";
2
- import { ImageProps } from "../types";
3
- export declare const Image: React.FC<ImageProps>;
1
+ import type { ImageProps } from "../types.js";
2
+ export declare const Image: ({ preset: presetName, ...props }: ImageProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
@@ -1,43 +1,23 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.Image = void 0;
9
-
10
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
-
12
- var _get2 = _interopRequireDefault(require("lodash/get"));
13
-
14
- var _invariant = _interopRequireDefault(require("invariant"));
15
-
16
- var _plugins = require("@webiny/plugins");
17
-
18
- var _excluded = ["preset"];
19
-
20
- var Image = function Image(_ref) {
21
- var presetName = _ref.preset,
22
- props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
23
-
24
- var plugin = _plugins.plugins.byName("image-component");
25
-
1
+ import invariant from "invariant";
2
+ import { plugins } from "@webiny/plugins";
3
+ import get from "lodash/get.js";
4
+ export const Image = ({
5
+ preset: presetName,
6
+ ...props
7
+ }) => {
8
+ const plugin = plugins.byName("image-component");
26
9
  if (!plugin) {
27
- throw new Error("Image component plugin (type \"image-component\") not defined.");
10
+ throw new Error(`Image component plugin (type "image-component") not defined.`);
28
11
  }
29
-
30
12
  if (presetName) {
31
- var preset = (0, _get2.default)(plugin, "presets.".concat(presetName));
32
- (0, _invariant.default)(preset, "Transform preset \"".concat(presetName, "\" not found."));
13
+ const preset = get(plugin, `presets.${presetName}`);
14
+ invariant(preset, `Transform preset "${presetName}" not found.`);
33
15
  props.transform = preset;
34
16
  }
35
-
36
17
  if (props.transform) {
37
18
  props.src = plugin.getImageSrc(props);
38
19
  }
39
-
40
20
  return plugin.render(props);
41
21
  };
42
22
 
43
- exports.Image = Image;
23
+ //# sourceMappingURL=Image.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Image","presetName","preset","props","plugin","plugins","byName","Error","invariant","transform","src","getImageSrc","render"],"sources":["Image.tsx"],"sourcesContent":["import * as React from \"react\";\nimport invariant from \"invariant\";\nimport { plugins } from \"@webiny/plugins\";\nimport { get } from \"lodash\";\nimport { ImageComponentPlugin, ImageProps } from \"~/types\";\n\nexport const Image: React.FC<ImageProps> = ({ preset: presetName, ...props }) => {\n const plugin = plugins.byName<ImageComponentPlugin>(\"image-component\");\n if (!plugin) {\n throw new Error(`Image component plugin (type \"image-component\") not defined.`);\n }\n\n if (presetName) {\n const preset = get(plugin, `presets.${presetName}`);\n invariant(preset, `Transform preset \"${presetName}\" not found.`);\n props.transform = preset;\n }\n\n if (props.transform) {\n props.src = plugin.getImageSrc(props);\n }\n\n return plugin.render(props);\n};\n"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;;;AAIO,IAAMA,KAA2B,GAAG,SAA9BA,KAA8B,OAAsC;EAAA,IAA3BC,UAA2B,QAAnCC,MAAmC;EAAA,IAAZC,KAAY;;EAC7E,IAAMC,MAAM,GAAGC,gBAAA,CAAQC,MAAR,CAAqC,iBAArC,CAAf;;EACA,IAAI,CAACF,MAAL,EAAa;IACT,MAAM,IAAIG,KAAJ,kEAAN;EACH;;EAED,IAAIN,UAAJ,EAAgB;IACZ,IAAMC,MAAM,GAAG,mBAAIE,MAAJ,oBAAuBH,UAAvB,EAAf;IACA,IAAAO,kBAAA,EAAUN,MAAV,+BAAuCD,UAAvC;IACAE,KAAK,CAACM,SAAN,GAAkBP,MAAlB;EACH;;EAED,IAAIC,KAAK,CAACM,SAAV,EAAqB;IACjBN,KAAK,CAACO,GAAN,GAAYN,MAAM,CAACO,WAAP,CAAmBR,KAAnB,CAAZ;EACH;;EAED,OAAOC,MAAM,CAACQ,MAAP,CAAcT,KAAd,CAAP;AACH,CAjBM"}
1
+ {"version":3,"names":["invariant","plugins","get","Image","preset","presetName","props","plugin","byName","Error","transform","src","getImageSrc","render"],"sources":["Image.tsx"],"sourcesContent":["import invariant from \"invariant\";\nimport { plugins } from \"@webiny/plugins\";\nimport get from \"lodash/get.js\";\nimport type { ImageComponentPlugin, ImageProps } from \"~/types.js\";\n\nexport const Image = ({ preset: presetName, ...props }: ImageProps) => {\n const plugin = plugins.byName<ImageComponentPlugin>(\"image-component\");\n if (!plugin) {\n throw new Error(`Image component plugin (type \"image-component\") not defined.`);\n }\n\n if (presetName) {\n const preset = get(plugin, `presets.${presetName}`);\n invariant(preset, `Transform preset \"${presetName}\" not found.`);\n props.transform = preset;\n }\n\n if (props.transform) {\n props.src = plugin.getImageSrc(props);\n }\n\n return plugin.render(props);\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,WAAW;AACjC,SAASC,OAAO,QAAQ,iBAAiB;AACzC,OAAOC,GAAG,MAAM,eAAe;AAG/B,OAAO,MAAMC,KAAK,GAAGA,CAAC;EAAEC,MAAM,EAAEC,UAAU;EAAE,GAAGC;AAAkB,CAAC,KAAK;EACnE,MAAMC,MAAM,GAAGN,OAAO,CAACO,MAAM,CAAuB,iBAAiB,CAAC;EACtE,IAAI,CAACD,MAAM,EAAE;IACT,MAAM,IAAIE,KAAK,CAAC,8DAA8D,CAAC;EACnF;EAEA,IAAIJ,UAAU,EAAE;IACZ,MAAMD,MAAM,GAAGF,GAAG,CAACK,MAAM,EAAE,WAAWF,UAAU,EAAE,CAAC;IACnDL,SAAS,CAACI,MAAM,EAAE,qBAAqBC,UAAU,cAAc,CAAC;IAChEC,KAAK,CAACI,SAAS,GAAGN,MAAM;EAC5B;EAEA,IAAIE,KAAK,CAACI,SAAS,EAAE;IACjBJ,KAAK,CAACK,GAAG,GAAGJ,MAAM,CAACK,WAAW,CAACN,KAAK,CAAC;EACzC;EAEA,OAAOC,MAAM,CAACM,MAAM,CAACP,KAAK,CAAC;AAC/B,CAAC","ignoreList":[]}
@@ -1,2 +1 @@
1
- export { Image } from "./Image";
2
- export { Routes } from "./Routes";
1
+ export { Image } from "./Image.js";
@@ -1,21 +1,3 @@
1
- "use strict";
1
+ export { Image } from "./Image.js";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Image", {
7
- enumerable: true,
8
- get: function get() {
9
- return _Image.Image;
10
- }
11
- });
12
- Object.defineProperty(exports, "Routes", {
13
- enumerable: true,
14
- get: function get() {
15
- return _Routes.Routes;
16
- }
17
- });
18
-
19
- var _Image = require("./Image");
20
-
21
- var _Routes = require("./Routes");
3
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Image } from \"./Image\";\nexport { Routes } from \"./Routes\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA"}
1
+ {"version":3,"names":["Image"],"sources":["index.ts"],"sourcesContent":["export { Image } from \"./Image.js\";\n"],"mappings":"AAAA,SAASA,KAAK","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import type { Route as BaseRoute } from "../../router.js";
3
+ export interface RouteProps {
4
+ route: BaseRoute<any>;
5
+ element: React.ReactElement;
6
+ remove?: boolean;
7
+ before?: string;
8
+ after?: string;
9
+ }
10
+ export type RouteConfig = Pick<RouteProps, "route" | "element">;
11
+ export declare const Route: (({ route, element, remove, before, after }: RouteProps) => React.JSX.Element) & {
12
+ original: ({ route, element, remove, before, after }: RouteProps) => React.JSX.Element;
13
+ originalName: string;
14
+ displayName: string;
15
+ } & {
16
+ original: (({ route, element, remove, before, after }: RouteProps) => React.JSX.Element) & {
17
+ original: ({ route, element, remove, before, after }: RouteProps) => React.JSX.Element;
18
+ originalName: string;
19
+ displayName: string;
20
+ };
21
+ originalName: string;
22
+ displayName: string;
23
+ } & {
24
+ createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<(({ route, element, remove, before, after }: RouteProps) => React.JSX.Element) & {
25
+ original: ({ route, element, remove, before, after }: RouteProps) => React.JSX.Element;
26
+ originalName: string;
27
+ displayName: string;
28
+ }>) => (props: unknown) => React.JSX.Element;
29
+ };
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import { makeDecoratable } from "@webiny/react-composition";
3
+ import { Property, useIdGenerator } from "@webiny/react-properties";
4
+ export const Route = makeDecoratable("Route", ({
5
+ route,
6
+ element,
7
+ remove,
8
+ before,
9
+ after
10
+ }) => {
11
+ const name = route.name;
12
+ const getId = useIdGenerator("Route");
13
+ const placeAfter = after !== undefined ? getId(after) : undefined;
14
+ const placeBefore = before !== undefined ? getId(before) : undefined;
15
+ return /*#__PURE__*/React.createElement(Property, {
16
+ id: getId(name),
17
+ name: "routes",
18
+ remove: remove,
19
+ array: true,
20
+ before: placeBefore,
21
+ after: placeAfter
22
+ }, /*#__PURE__*/React.createElement(Property, {
23
+ id: getId(name, "route"),
24
+ name: "route",
25
+ value: route
26
+ }), /*#__PURE__*/React.createElement(Property, {
27
+ id: getId(name, "element"),
28
+ name: "element",
29
+ value: element
30
+ }));
31
+ });
32
+
33
+ //# sourceMappingURL=Route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","makeDecoratable","Property","useIdGenerator","Route","route","element","remove","before","after","name","getId","placeAfter","undefined","placeBefore","createElement","id","array","value"],"sources":["Route.tsx"],"sourcesContent":["import React from \"react\";\nimport { makeDecoratable } from \"@webiny/react-composition\";\nimport { Property, useIdGenerator } from \"@webiny/react-properties\";\nimport type { Route as BaseRoute } from \"~/router.js\";\n\nexport interface RouteProps {\n route: BaseRoute<any>;\n element: React.ReactElement;\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nexport type RouteConfig = Pick<RouteProps, \"route\" | \"element\">;\n\nexport const Route = makeDecoratable(\n \"Route\",\n ({ route, element, remove, before, after }: RouteProps) => {\n const name = route.name;\n\n const getId = useIdGenerator(\"Route\");\n\n const placeAfter = after !== undefined ? getId(after) : undefined;\n const placeBefore = before !== undefined ? getId(before) : undefined;\n\n return (\n <Property\n id={getId(name)}\n name={\"routes\"}\n remove={remove}\n array={true}\n before={placeBefore}\n after={placeAfter}\n >\n <Property id={getId(name, \"route\")} name={\"route\"} value={route} />\n <Property id={getId(name, \"element\")} name={\"element\"} value={element} />\n </Property>\n );\n }\n);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,QAAQ,EAAEC,cAAc,QAAQ,0BAA0B;AAanE,OAAO,MAAMC,KAAK,GAAGH,eAAe,CAChC,OAAO,EACP,CAAC;EAAEI,KAAK;EAAEC,OAAO;EAAEC,MAAM;EAAEC,MAAM;EAAEC;AAAkB,CAAC,KAAK;EACvD,MAAMC,IAAI,GAAGL,KAAK,CAACK,IAAI;EAEvB,MAAMC,KAAK,GAAGR,cAAc,CAAC,OAAO,CAAC;EAErC,MAAMS,UAAU,GAAGH,KAAK,KAAKI,SAAS,GAAGF,KAAK,CAACF,KAAK,CAAC,GAAGI,SAAS;EACjE,MAAMC,WAAW,GAAGN,MAAM,KAAKK,SAAS,GAAGF,KAAK,CAACH,MAAM,CAAC,GAAGK,SAAS;EAEpE,oBACIb,KAAA,CAAAe,aAAA,CAACb,QAAQ;IACLc,EAAE,EAAEL,KAAK,CAACD,IAAI,CAAE;IAChBA,IAAI,EAAE,QAAS;IACfH,MAAM,EAAEA,MAAO;IACfU,KAAK,EAAE,IAAK;IACZT,MAAM,EAAEM,WAAY;IACpBL,KAAK,EAAEG;EAAW,gBAElBZ,KAAA,CAAAe,aAAA,CAACb,QAAQ;IAACc,EAAE,EAAEL,KAAK,CAACD,IAAI,EAAE,OAAO,CAAE;IAACA,IAAI,EAAE,OAAQ;IAACQ,KAAK,EAAEb;EAAM,CAAE,CAAC,eACnEL,KAAA,CAAAe,aAAA,CAACb,QAAQ;IAACc,EAAE,EAAEL,KAAK,CAACD,IAAI,EAAE,SAAS,CAAE;IAACA,IAAI,EAAE,SAAU;IAACQ,KAAK,EAAEZ;EAAQ,CAAE,CAClE,CAAC;AAEnB,CACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ import { type RouteConfig } from "./RouterConfig/Route.js";
2
+ export declare const RouterWithConfig: (({ onProperties, children }: import("@webiny/react-properties").WithConfigProps) => React.JSX.Element) & {
3
+ displayName: string;
4
+ };
5
+ export declare const useRouterConfig: () => {
6
+ routes: RouteConfig[];
7
+ };
8
+ export declare const RouterConfig: (({ priority, children }: import("@webiny/react-properties").ConfigProps) => React.JSX.Element) & {
9
+ Route: (({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element) & {
10
+ original: ({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element;
11
+ originalName: string;
12
+ displayName: string;
13
+ } & {
14
+ original: (({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element) & {
15
+ original: ({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element;
16
+ originalName: string;
17
+ displayName: string;
18
+ };
19
+ originalName: string;
20
+ displayName: string;
21
+ } & {
22
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element) & {
23
+ original: ({ route, element, remove, before, after }: import("./RouterConfig/Route.js").RouteProps) => import("react").JSX.Element;
24
+ originalName: string;
25
+ displayName: string;
26
+ }>) => (props: unknown) => React.JSX.Element;
27
+ };
28
+ useRouterConfig: () => {
29
+ routes: RouteConfig[];
30
+ };
31
+ };