@webiny/app 6.0.0-beta.0 → 6.0.0-rc.1

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 (436) hide show
  1. package/App.d.ts +6 -14
  2. package/App.js +67 -86
  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 -48
  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.d.ts +1 -1
  27. package/config.js +7 -13
  28. package/config.js.map +1 -1
  29. package/contexts/Ui/index.d.ts +2 -2
  30. package/contexts/Ui/index.js +28 -52
  31. package/contexts/Ui/index.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 +7 -3
  45. package/core/createProvider.js +3 -9
  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.d.ts +3 -3
  237. package/hooks/useHandlers.js +11 -17
  238. package/hooks/useHandlers.js.map +1 -1
  239. package/hooks/useRegisterLegacyPlugin.d.ts +2 -0
  240. package/hooks/useRegisterLegacyPlugin.js +11 -0
  241. package/hooks/useRegisterLegacyPlugin.js.map +1 -0
  242. package/hooks/useUi.d.ts +1 -1
  243. package/hooks/useUi.js +4 -10
  244. package/hooks/useUi.js.map +1 -1
  245. package/i18n/i18n.js +5 -13
  246. package/i18n/i18n.js.map +1 -1
  247. package/i18n/index.d.ts +1 -1
  248. package/i18n/index.js +1 -13
  249. package/i18n/index.js.map +1 -1
  250. package/index.d.ts +22 -14
  251. package/index.js +24 -165
  252. package/index.js.map +1 -1
  253. package/package.json +26 -29
  254. package/plugins/AddQuerySelectionPlugin.d.ts +2 -2
  255. package/plugins/AddQuerySelectionPlugin.js +61 -107
  256. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  257. package/plugins/ApolloCacheObjectIdPlugin.js +12 -31
  258. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  259. package/plugins/ApolloDynamicLink.d.ts +3 -2
  260. package/plugins/ApolloDynamicLink.js +19 -46
  261. package/plugins/ApolloDynamicLink.js.map +1 -1
  262. package/plugins/ApolloLinkPlugin.d.ts +1 -1
  263. package/plugins/ApolloLinkPlugin.js +18 -37
  264. package/plugins/ApolloLinkPlugin.js.map +1 -1
  265. package/plugins/ConsoleLinkPlugin.d.ts +1 -1
  266. package/plugins/ConsoleLinkPlugin.js +20 -41
  267. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  268. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
  269. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +35 -58
  270. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  271. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
  272. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +31 -0
  273. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
  274. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  275. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +31 -0
  276. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  277. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -5
  278. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -12
  279. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  280. package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
  281. package/plugins/NetworkErrorLinkPlugin/Typography.js +18 -0
  282. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
  283. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
  284. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +10 -20
  285. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  286. package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
  287. package/plugins/NetworkErrorLinkPlugin.js +60 -37
  288. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  289. package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
  290. package/plugins/OmitTypenameLinkPlugin.js +11 -30
  291. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  292. package/plugins/TenantHeaderLinkPlugin.d.ts +3 -3
  293. package/plugins/TenantHeaderLinkPlugin.js +29 -48
  294. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  295. package/plugins/components/Image.d.ts +6 -0
  296. package/plugins/components/Image.js +19 -0
  297. package/plugins/components/Image.js.map +1 -0
  298. package/plugins/image.d.ts +1 -1
  299. package/plugins/image.js +46 -53
  300. package/plugins/image.js.map +1 -1
  301. package/plugins/index.d.ts +5 -5
  302. package/plugins/index.js +31 -53
  303. package/plugins/index.js.map +1 -1
  304. package/presentation/localStorage/index.d.ts +3 -0
  305. package/presentation/localStorage/index.js +5 -0
  306. package/presentation/localStorage/index.js.map +1 -0
  307. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  308. package/presentation/localStorage/useLocalStorage.js +21 -0
  309. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  310. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  311. package/presentation/localStorage/useLocalStorageValue.js +20 -0
  312. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  313. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  314. package/presentation/localStorage/useLocalStorageValues.js +39 -0
  315. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  316. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  317. package/presentation/router/RouteElementRegistry.js +32 -0
  318. package/presentation/router/RouteElementRegistry.js.map +1 -0
  319. package/presentation/router/abstractions.d.ts +13 -0
  320. package/presentation/router/abstractions.js +4 -0
  321. package/presentation/router/abstractions.js.map +1 -0
  322. package/presentation/router/components/RouteContent.d.ts +2 -0
  323. package/presentation/router/components/RouteContent.js +17 -0
  324. package/presentation/router/components/RouteContent.js.map +1 -0
  325. package/presentation/router/components/RouteLink.d.ts +50 -0
  326. package/presentation/router/components/RouteLink.js +22 -0
  327. package/presentation/router/components/RouteLink.js.map +1 -0
  328. package/presentation/router/components/SimpleLink.d.ts +44 -0
  329. package/presentation/router/components/SimpleLink.js +30 -0
  330. package/presentation/router/components/SimpleLink.js.map +1 -0
  331. package/presentation/router/hooks/useRoute.d.ts +6 -0
  332. package/presentation/router/hooks/useRoute.js +30 -0
  333. package/presentation/router/hooks/useRoute.js.map +1 -0
  334. package/presentation/router/hooks/useRouter.d.ts +7 -0
  335. package/presentation/router/hooks/useRouter.js +26 -0
  336. package/presentation/router/hooks/useRouter.js.map +1 -0
  337. package/presentation/router/index.d.ts +4 -0
  338. package/presentation/router/index.js +5 -0
  339. package/presentation/router/index.js.map +1 -0
  340. package/presentation/router/types.d.ts +5 -0
  341. package/presentation/router/types.js +3 -0
  342. package/presentation/router/types.js.map +1 -0
  343. package/react-butterfiles/Files.d.ts +69 -0
  344. package/react-butterfiles/Files.js +227 -0
  345. package/react-butterfiles/Files.js.map +1 -0
  346. package/react-butterfiles/file.todo +1 -0
  347. package/react-butterfiles/index.d.ts +2 -0
  348. package/react-butterfiles/index.js +4 -0
  349. package/react-butterfiles/index.js.map +1 -0
  350. package/react-butterfiles/utils/generateId.d.ts +1 -0
  351. package/react-butterfiles/utils/generateId.js +5 -0
  352. package/react-butterfiles/utils/generateId.js.map +1 -0
  353. package/react-butterfiles/utils/readFileContent.d.ts +1 -0
  354. package/react-butterfiles/utils/readFileContent.js +15 -0
  355. package/react-butterfiles/utils/readFileContent.js.map +1 -0
  356. package/renderApp.d.ts +1 -1
  357. package/renderApp.js +4 -11
  358. package/renderApp.js.map +1 -1
  359. package/router.d.ts +5 -0
  360. package/router.js +8 -0
  361. package/router.js.map +1 -0
  362. package/shared/di/DiContainerProvider.d.ts +8 -0
  363. package/shared/di/DiContainerProvider.js +17 -0
  364. package/shared/di/DiContainerProvider.js.map +1 -0
  365. package/shared/di/createFeature.d.ts +11 -0
  366. package/shared/di/createFeature.js +11 -0
  367. package/shared/di/createFeature.js.map +1 -0
  368. package/shared/di/useFeature.d.ts +2 -0
  369. package/shared/di/useFeature.js +18 -0
  370. package/shared/di/useFeature.js.map +1 -0
  371. package/types.d.ts +16 -13
  372. package/types.js +1 -12
  373. package/types.js.map +1 -1
  374. package/utils/createGenericContext.d.ts +13 -0
  375. package/utils/createGenericContext.js +25 -0
  376. package/utils/createGenericContext.js.map +1 -0
  377. package/utils/createHashing.d.ts +2 -0
  378. package/utils/createHashing.js +18 -0
  379. package/utils/createHashing.js.map +1 -0
  380. package/utils/index.d.ts +2 -8
  381. package/utils/index.js +2 -93
  382. package/utils/index.js.map +1 -1
  383. package/utils/legacyPluginToReactComponent.d.ts +7 -0
  384. package/utils/legacyPluginToReactComponent.js +14 -0
  385. package/utils/legacyPluginToReactComponent.js.map +1 -0
  386. package/components/Routes.d.ts +0 -2
  387. package/components/Routes.js +0 -46
  388. package/components/Routes.js.map +0 -1
  389. package/components/View.d.ts +0 -8
  390. package/components/View.js +0 -31
  391. package/components/View.js.map +0 -1
  392. package/core/AddRoute.d.ts +0 -17
  393. package/core/AddRoute.js +0 -21
  394. package/core/AddRoute.js.map +0 -1
  395. package/core/DebounceRender.d.ts +0 -12
  396. package/core/DebounceRender.js +0 -42
  397. package/core/DebounceRender.js.map +0 -1
  398. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  399. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -30
  400. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  401. package/hooks/useDataList/utils/types.d.ts +0 -40
  402. package/hooks/useDataList/utils/types.js +0 -7
  403. package/hooks/useDataList/utils/types.js.map +0 -1
  404. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
  405. package/plugins/LocaleHeaderLinkPlugin.js +0 -49
  406. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  407. package/plugins/RoutePlugin.d.ts +0 -12
  408. package/plugins/RoutePlugin.js +0 -35
  409. package/plugins/RoutePlugin.js.map +0 -1
  410. package/plugins/ViewPlugin.d.ts +0 -14
  411. package/plugins/ViewPlugin.js +0 -40
  412. package/plugins/ViewPlugin.js.map +0 -1
  413. package/utils/getApiUrl.d.ts +0 -1
  414. package/utils/getApiUrl.js +0 -12
  415. package/utils/getApiUrl.js.map +0 -1
  416. package/utils/getGqlApiUrl.d.ts +0 -1
  417. package/utils/getGqlApiUrl.js +0 -12
  418. package/utils/getGqlApiUrl.js.map +0 -1
  419. package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
  420. package/utils/getHeadlessCmsGqlApiUrl.js +0 -18
  421. package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
  422. package/utils/getLocaleCode.d.ts +0 -6
  423. package/utils/getLocaleCode.js +0 -43
  424. package/utils/getLocaleCode.js.map +0 -1
  425. package/utils/getPrerenderId.d.ts +0 -6
  426. package/utils/getPrerenderId.js +0 -11
  427. package/utils/getPrerenderId.js.map +0 -1
  428. package/utils/getTenantId.d.ts +0 -6
  429. package/utils/getTenantId.js +0 -35
  430. package/utils/getTenantId.js.map +0 -1
  431. package/utils/isLocalhost.d.ts +0 -1
  432. package/utils/isLocalhost.js +0 -15
  433. package/utils/isLocalhost.js.map +0 -1
  434. package/utils/isPrerendering.d.ts +0 -1
  435. package/utils/isPrerendering.js +0 -11
  436. package/utils/isPrerendering.js.map +0 -1
package/App.d.ts CHANGED
@@ -1,32 +1,24 @@
1
- import React, { ReactElement } from "react";
2
- import { RouteProps } from "@webiny/react-router";
3
- import { GenericComponent, Decorator } from "@webiny/react-composition";
4
- declare type RoutesByPath = {
5
- [key: string]: ReactElement<RouteProps>;
6
- };
1
+ import React from "react";
2
+ import { Decorator, DecoratorsCollection, GenericComponent } from "@webiny/react-composition";
7
3
  interface State {
8
- routes: RoutesByPath;
9
4
  plugins: JSX.Element[];
10
5
  providers: Decorator<GenericComponent<ProviderProps>>[];
11
6
  }
12
7
  interface AppContext extends State {
13
- addRoute(route: JSX.Element): void;
14
8
  addProvider(hoc: Decorator<GenericComponent<ProviderProps>>): void;
15
9
  addPlugin(plugin: React.ReactNode): void;
16
10
  }
17
11
  declare const AppContext: React.Context<AppContext | undefined>;
18
12
  export declare const useApp: () => AppContext;
19
13
  export interface AppProps {
20
- debounceRender?: number;
21
- routes?: Array<RouteProps>;
14
+ routes?: Array<any>;
22
15
  providers?: Array<Decorator<GenericComponent<ProviderProps>>>;
16
+ decorators?: DecoratorsCollection;
23
17
  children?: React.ReactNode | React.ReactNode[];
24
18
  }
25
19
  interface ProviderProps {
26
20
  children: React.ReactNode;
27
21
  }
28
- export declare const App: {
29
- ({ debounceRender, routes, providers, children }: AppProps): React.JSX.Element;
30
- displayName: string;
31
- };
22
+ export declare const AppBase: React.MemoExoticComponent<({ routes, providers, children }: AppProps) => React.JSX.Element>;
23
+ export declare const App: ({ decorators, ...props }: AppProps) => React.JSX.Element;
32
24
  export {};
package/App.js CHANGED
@@ -1,105 +1,86 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.useApp = exports.App = void 0;
9
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var _objectSpread4 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
- var _react = _interopRequireWildcard(require("react"));
14
- var _reactRouter = require("@webiny/react-router");
15
- var _reactComposition = require("@webiny/react-composition");
16
- var _Routes = require("./core/Routes");
17
- var _DebounceRender = require("./core/DebounceRender");
18
- var _Plugins = require("./core/Plugins");
19
- var AppContext = /*#__PURE__*/(0, _react.createContext)(undefined);
1
+ import React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
2
+ import { compose, CompositionProvider } from "@webiny/react-composition";
3
+ import { PluginsProvider } from "./core/Plugins.js";
4
+ import { RouterWithConfig, useRouterConfig } from "./config/RouterConfig.js";
5
+ import { AppContainer } from "./AppContainer.js";
6
+ import { RouteContent } from "./presentation/router/components/RouteContent.js";
7
+ import { useRouter } from "./router.js";
8
+ const AppContext = /*#__PURE__*/createContext(undefined);
20
9
  AppContext.displayName = "AppContext";
21
- var useApp = exports.useApp = function useApp() {
22
- var appContext = (0, _react.useContext)(AppContext);
10
+ export const useApp = () => {
11
+ const appContext = useContext(AppContext);
23
12
  if (!appContext) {
24
- throw Error("AppContext provider was not found. Are you using the \"useApp()\" hook in the right place?");
13
+ throw Error(`AppContext provider was not found. Are you using the "useApp()" hook in the right place?`);
25
14
  }
26
15
  return appContext;
27
16
  };
28
- var App = exports.App = function App(_ref) {
29
- var _ref$debounceRender = _ref.debounceRender,
30
- debounceRender = _ref$debounceRender === void 0 ? 50 : _ref$debounceRender,
31
- _ref$routes = _ref.routes,
32
- routes = _ref$routes === void 0 ? [] : _ref$routes,
33
- _ref$providers = _ref.providers,
34
- providers = _ref$providers === void 0 ? [] : _ref$providers,
35
- children = _ref.children;
36
- var _useState = (0, _react.useState)({
37
- routes: routes.reduce(function (acc, item) {
38
- return (0, _objectSpread4.default)((0, _objectSpread4.default)({}, acc), {}, (0, _defineProperty2.default)({}, item.path, /*#__PURE__*/_react.default.createElement(_reactRouter.Route, item)));
39
- }, {}),
40
- plugins: [],
41
- providers: providers
42
- }),
43
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
44
- state = _useState2[0],
45
- setState = _useState2[1];
46
- var addRoute = (0, _react.useCallback)(function (route) {
47
- setState(function (state) {
48
- return (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state), {}, {
49
- routes: (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.routes), {}, (0, _defineProperty2.default)({}, route.props.path, route))
50
- });
51
- });
52
- }, []);
53
- var addProvider = (0, _react.useCallback)(function (component) {
54
- setState(function (state) {
55
- if (state.providers.findIndex(function (m) {
56
- return m === component;
57
- }) > -1) {
17
+ export const AppBase = /*#__PURE__*/React.memo(({
18
+ routes = [],
19
+ providers = [],
20
+ children
21
+ }) => {
22
+ const [state, setState] = useState({
23
+ plugins: [],
24
+ providers
25
+ });
26
+ const addProvider = useCallback(component => {
27
+ setState(state => {
28
+ if (state.providers.findIndex(m => m === component) > -1) {
58
29
  return state;
59
30
  }
60
- return (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state), {}, {
61
- providers: [].concat((0, _toConsumableArray2.default)(state.providers), [component])
62
- });
31
+ return {
32
+ ...state,
33
+ providers: [...state.providers, component]
34
+ };
63
35
  });
64
36
  }, []);
65
- var addPlugin = (0, _react.useCallback)(function (element) {
66
- setState(function (state) {
67
- return (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state), {}, {
68
- plugins: [].concat((0, _toConsumableArray2.default)(state.plugins), [element])
69
- });
37
+ const addPlugin = useCallback(element => {
38
+ setState(state => {
39
+ return {
40
+ ...state,
41
+ plugins: [...state.plugins, element]
42
+ };
70
43
  });
71
44
  }, []);
72
- var appContext = (0, _react.useMemo)(function () {
73
- return (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state), {}, {
74
- addRoute: addRoute,
75
- addProvider: addProvider,
76
- addPlugin: addPlugin
77
- });
78
- }, [state]);
79
- var AppRouter = (0, _react.useMemo)(function () {
45
+ const appContext = useMemo(() => ({
46
+ ...state,
47
+ addProvider,
48
+ addPlugin
49
+ }), [state]);
50
+ const AppRouter = useMemo(() => {
80
51
  return function AppRouter() {
81
- var routes = Object.values(state.routes);
82
- return /*#__PURE__*/_react.default.createElement(_Routes.Routes, {
83
- key: routes.length,
84
- routes: routes
85
- });
52
+ const router = useRouter();
53
+ const routerConfig = useRouterConfig();
54
+ const routesFromConfig = routerConfig.routes;
55
+ const combinedRoutes = [...routes, ...routesFromConfig];
56
+ useEffect(() => {
57
+ router.setRoutes(combinedRoutes);
58
+ }, [combinedRoutes.length]);
59
+ return null;
86
60
  };
87
- }, [state.routes]);
88
- var Providers = (0, _react.useMemo)(function () {
89
- return _reactComposition.compose.apply(void 0, (0, _toConsumableArray2.default)(state.providers || []))(function (_ref2) {
90
- var children = _ref2.children;
91
- return /*#__PURE__*/_react.default.createElement(_DebounceRender.DebounceRender, {
92
- wait: debounceRender
93
- }, children);
94
- });
61
+ }, []);
62
+ const Providers = useMemo(() => {
63
+ return /*#__PURE__*/React.memo(compose(...(state.providers || []))(({
64
+ children
65
+ }) => {
66
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
67
+ }));
95
68
  }, [state.providers.length]);
96
69
  Providers.displayName = "Providers";
97
- return /*#__PURE__*/_react.default.createElement(AppContext.Provider, {
70
+ return /*#__PURE__*/React.createElement(AppContext.Provider, {
98
71
  value: appContext
99
- }, /*#__PURE__*/_react.default.createElement(_reactComposition.CompositionProvider, null, children, /*#__PURE__*/_react.default.createElement(_reactRouter.BrowserRouter, null, /*#__PURE__*/_react.default.createElement(Providers, null, /*#__PURE__*/_react.default.createElement(_Plugins.PluginsProvider, null, state.plugins), /*#__PURE__*/_react.default.createElement(_DebounceRender.DebounceRender, {
100
- wait: debounceRender
101
- }, /*#__PURE__*/_react.default.createElement(AppRouter, null))))));
72
+ }, children, /*#__PURE__*/React.createElement(AppContainer, null, /*#__PURE__*/React.createElement(Providers, null, /*#__PURE__*/React.createElement(PluginsProvider, null, state.plugins), /*#__PURE__*/React.createElement(RouterWithConfig, null, /*#__PURE__*/React.createElement(AppRouter, null), /*#__PURE__*/React.createElement(RouteContent, null)))));
73
+ });
74
+ AppBase.displayName = "AppBase";
75
+ export const App = ({
76
+ decorators,
77
+ ...props
78
+ }) => {
79
+ return /*#__PURE__*/React.createElement(CompositionProvider, {
80
+ decorators: decorators
81
+ }, /*#__PURE__*/React.createElement(AppBase, Object.assign({
82
+ decorators: decorators
83
+ }, props)));
102
84
  };
103
- App.displayName = "App";
104
85
 
105
86
  //# sourceMappingURL=App.js.map
package/App.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactRouter","_reactComposition","_Routes","_DebounceRender","_Plugins","AppContext","createContext","undefined","displayName","useApp","exports","appContext","useContext","Error","App","_ref","_ref$debounceRender","debounceRender","_ref$routes","routes","_ref$providers","providers","children","_useState","useState","reduce","acc","item","_objectSpread4","default","_defineProperty2","path","createElement","Route","plugins","_useState2","_slicedToArray2","state","setState","addRoute","useCallback","route","props","addProvider","component","findIndex","m","concat","_toConsumableArray2","addPlugin","element","useMemo","AppRouter","Object","values","Routes","key","length","Providers","compose","apply","_ref2","DebounceRender","wait","Provider","value","CompositionProvider","BrowserRouter","PluginsProvider"],"sources":["App.tsx"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useMemo,\n useState,\n useCallback,\n FunctionComponentElement,\n ReactElement\n} from \"react\";\nimport { BrowserRouter, RouteProps, Route } from \"@webiny/react-router\";\nimport {\n CompositionProvider,\n GenericComponent,\n compose,\n Decorator,\n HigherOrderComponent\n} from \"@webiny/react-composition\";\nimport { Routes as SortRoutes } from \"./core/Routes\";\nimport { DebounceRender } from \"./core/DebounceRender\";\nimport { PluginsProvider } from \"./core/Plugins\";\n\ntype RoutesByPath = {\n [key: string]: ReactElement<RouteProps>;\n};\n\ninterface State {\n routes: RoutesByPath;\n plugins: JSX.Element[];\n providers: Decorator<GenericComponent<ProviderProps>>[];\n}\n\ninterface AppContext extends State {\n addRoute(route: JSX.Element): void;\n addProvider(hoc: Decorator<GenericComponent<ProviderProps>>): void;\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<RouteProps>;\n providers?: Array<Decorator<GenericComponent<ProviderProps>>>;\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 App = ({ debounceRender = 50, routes = [], providers = [], children }: AppProps) => {\n const [state, setState] = useState<State>({\n routes: routes.reduce<RoutesByPath>((acc, item) => {\n return { ...acc, [item.path as string]: <Route {...item} /> };\n }, {}),\n plugins: [],\n providers\n });\n\n const addRoute = useCallback((route: FunctionComponentElement<RouteProps>) => {\n setState(state => {\n return {\n ...state,\n routes: { ...state.routes, [route.props.path as string]: route }\n };\n });\n }, []);\n\n const addProvider = useCallback((component: HigherOrderComponent<any, 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 addRoute,\n addProvider,\n addPlugin\n }),\n [state]\n );\n\n const AppRouter = useMemo(() => {\n return function AppRouter() {\n const routes = Object.values(state.routes);\n return <SortRoutes key={routes.length} routes={routes} />;\n };\n }, [state.routes]);\n\n const Providers = useMemo(() => {\n return compose(...(state.providers || []))(({ children }: ProviderProps) => {\n return <DebounceRender wait={debounceRender}>{children}</DebounceRender>;\n });\n }, [state.providers.length]) as ComponentWithChildren;\n\n Providers.displayName = \"Providers\";\n\n return (\n <AppContext.Provider value={appContext}>\n <CompositionProvider>\n {children}\n <BrowserRouter>\n <Providers>\n <PluginsProvider>{state.plugins}</PluginsProvider>\n <DebounceRender wait={debounceRender}>\n <AppRouter />\n </DebounceRender>\n </Providers>\n </BrowserRouter>\n </CompositionProvider>\n </AppContext.Provider>\n );\n};\n\nApp.displayName = \"App\";\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAOA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAkBA,IAAMM,UAAU,gBAAG,IAAAC,oBAAa,EAAyBC,SAAS,CAAC;AAEnEF,UAAU,CAACG,WAAW,GAAG,YAAY;AAE9B,IAAMC,MAAM,GAAAC,OAAA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AAA,CAAAgC,OAAA,CAAAG,aAAA,CAAChC,YAAA,CAAAmE,aAAa,qBACVtE,MAAA,CAAAgC,OAAA,CAAAG,aAAA,CAAC0B,SAAS,qBACN7D,MAAA,CAAAgC,OAAA,CAAAG,aAAA,CAAC5B,QAAA,CAAAgE,eAAe,QAAE/B,KAAK,CAACH,OAAyB,CAAC,eAClDrC,MAAA,CAAAgC,OAAA,CAAAG,aAAA,CAAC7B,eAAA,CAAA2D,cAAc;IAACC,IAAI,EAAE9C;EAAe,gBACjCpB,MAAA,CAAAgC,OAAA,CAAAG,aAAA,CAACoB,SAAS,MAAE,CACA,CACT,CACA,CACE,CACJ,CAAC;AAE9B,CAAC;AAEDtC,GAAG,CAACN,WAAW,GAAG,KAAK","ignoreList":[]}
1
+ {"version":3,"names":["React","createContext","useCallback","useContext","useEffect","useMemo","useState","compose","CompositionProvider","PluginsProvider","RouterWithConfig","useRouterConfig","AppContainer","RouteContent","useRouter","AppContext","undefined","displayName","useApp","appContext","Error","AppBase","memo","routes","providers","children","state","setState","plugins","addProvider","component","findIndex","m","addPlugin","element","AppRouter","router","routerConfig","routesFromConfig","combinedRoutes","setRoutes","length","Providers","createElement","Fragment","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 { 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 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(({ 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 <>{children}</>;\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 <RouterWithConfig>\n <AppRouter />\n <RouteContent />\n </RouterWithConfig>\n </Providers>\n </AppContainer>\n </AppContext.Provider>\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":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACnG,SACIC,OAAO,EACPC,mBAAmB,QAIhB,2BAA2B;AAClC,SAASC,eAAe;AACxB,SAASC,gBAAgB,EAAEC,eAAe;AAC1C,SAASC,YAAY;AACrB,SAASC,YAAY;AACrB,SAASC,SAAS;AAalB,MAAMC,UAAU,gBAAGd,aAAa,CAAyBe,SAAS,CAAC;AAEnED,UAAU,CAACE,WAAW,GAAG,YAAY;AAErC,OAAO,MAAMC,MAAM,GAAGA,CAAA,KAAM;EACxB,MAAMC,UAAU,GAAGhB,UAAU,CAACY,UAAU,CAAC;EACzC,IAAI,CAACI,UAAU,EAAE;IACb,MAAMC,KAAK,CACP,0FACJ,CAAC;EACL;EACA,OAAOD,UAAU;AACrB,CAAC;AAeD,OAAO,MAAME,OAAO,gBAAGrB,KAAK,CAACsB,IAAI,CAAC,CAAC;EAAEC,MAAM,GAAG,EAAE;EAAEC,SAAS,GAAG,EAAE;EAAEC;AAAmB,CAAC,KAAK;EACvF,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGrB,QAAQ,CAAQ;IACtCsB,OAAO,EAAE,EAAE;IACXJ;EACJ,CAAC,CAAC;EAEF,MAAMK,WAAW,GAAG3B,WAAW,CAAE4B,SAAyB,IAAK;IAC3DH,QAAQ,CAACD,KAAK,IAAI;MACd,IAAIA,KAAK,CAACF,SAAS,CAACO,SAAS,CAACC,CAAC,IAAIA,CAAC,KAAKF,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE;QACtD,OAAOJ,KAAK;MAChB;MAEA,OAAO;QACH,GAAG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QAAGnB,QAAW,CAAC;IAC1B,CAAC,CACL,CAAC;EACL,CAAC,EAAE,CAACC,KAAK,CAACF,SAAS,CAACiB,MAAM,CAAC,CAA0B;EAErDC,SAAS,CAACzB,WAAW,GAAG,WAAW;EAEnC,oBACIjB,KAAA,CAAA2C,aAAA,CAAC5B,UAAU,CAAC8B,QAAQ;IAACC,KAAK,EAAE3B;EAAW,GAClCM,QAAQ,eACTzB,KAAA,CAAA2C,aAAA,CAAC/B,YAAY,qBACTZ,KAAA,CAAA2C,aAAA,CAACD,SAAS,qBACN1C,KAAA,CAAA2C,aAAA,CAAClC,eAAe,QAAEiB,KAAK,CAACE,OAAyB,CAAC,eAClD5B,KAAA,CAAA2C,aAAA,CAACjC,gBAAgB,qBACbV,KAAA,CAAA2C,aAAA,CAACR,SAAS,MAAE,CAAC,eACbnC,KAAA,CAAA2C,aAAA,CAAC9B,YAAY,MAAE,CACD,CACX,CACD,CACG,CAAC;AAE9B,CAAC,CAAC;AAEFQ,OAAO,CAACJ,WAAW,GAAG,SAAS;AAE/B,OAAO,MAAM8B,GAAG,GAAGA,CAAC;EAAEC,UAAU;EAAE,GAAGC;AAAgB,CAAC,KAAK;EACvD,oBACIjD,KAAA,CAAA2C,aAAA,CAACnC,mBAAmB;IAACwC,UAAU,EAAEA;EAAW,gBACxChD,KAAA,CAAA2C,aAAA,CAACtB,OAAO,EAAA6B,MAAA,CAAAC,MAAA;IAACH,UAAU,EAAEA;EAAW,GAAKC,KAAK,CAAG,CAC5B,CAAC;AAE9B,CAAC","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,52 +1,20 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.InMemoryCache = void 0;
8
- var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
- var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
12
- var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
13
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
- var _apolloCacheInmemory = require("apollo-cache-inmemory");
16
- var _plugins = require("@webiny/plugins");
17
- var _AddQuerySelectionPlugin = require("../plugins/AddQuerySelectionPlugin");
18
- var _ApolloLinkPlugin = require("../plugins/ApolloLinkPlugin");
19
- var InMemoryCache = exports.InMemoryCache = /*#__PURE__*/function (_BaseInMemoryCache) {
20
- function InMemoryCache(config) {
21
- var _this;
22
- (0, _classCallCheck2.default)(this, InMemoryCache);
23
- _this = (0, _callSuper2.default)(this, InMemoryCache, [config]);
24
- _this.transformPlugins = _plugins.plugins.byType(_ApolloLinkPlugin.ApolloLinkPlugin.type).filter(function (pl) {
25
- return pl instanceof _AddQuerySelectionPlugin.AddQuerySelectionPlugin;
26
- });
27
- 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);
28
9
  }
29
- (0, _inherits2.default)(InMemoryCache, _BaseInMemoryCache);
30
- return (0, _createClass2.default)(InMemoryCache, [{
31
- key: "transformDocument",
32
- value: function transformDocument(document) {
33
- // @ts-expect-error
34
- var operationName = document.definitions[0].name.value;
35
- var _iterator = (0, _createForOfIteratorHelper2.default)(this.transformPlugins),
36
- _step;
37
- try {
38
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
39
- var pl = _step.value;
40
- pl.addSelectionToQuery(operationName, document);
41
- }
42
- } catch (err) {
43
- _iterator.e(err);
44
- } finally {
45
- _iterator.f();
46
- }
47
- 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);
48
15
  }
49
- }]);
50
- }(_apolloCacheInmemory.InMemoryCache);
16
+ return super.transformDocument(document);
17
+ }
18
+ }
51
19
 
52
20
  //# sourceMappingURL=InMemoryCache.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_apolloCacheInmemory","require","_plugins","_AddQuerySelectionPlugin","_ApolloLinkPlugin","InMemoryCache","exports","_BaseInMemoryCache","config","_this","_classCallCheck2","default","_callSuper2","transformPlugins","plugins","byType","ApolloLinkPlugin","type","filter","pl","AddQuerySelectionPlugin","_inherits2","_createClass2","key","value","transformDocument","document","operationName","definitions","name","_iterator","_createForOfIteratorHelper2","_step","s","n","done","addSelectionToQuery","err","e","f","_get2","_getPrototypeOf2","prototype","call","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-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":";;;;;;;;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,O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,gBAAA,CAAA9B,OAAA,EAAAN,aAAA,CAAAqC,SAAA,8BAAAC,IAAA,OAA+BjB,QAAQ;IAC3C;EAAC;AAAA,EApB8BkB,kCAAiB","ignoreList":[]}
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":[]}
@@ -1,5 +1,5 @@
1
- import { IdValue } from "apollo-utilities";
2
- import { ReadStoreContext, FragmentMatcherInterface, IntrospectionResultData } from "apollo-cache-inmemory";
1
+ import type { IdValue } from "apollo-utilities";
2
+ import type { ReadStoreContext, FragmentMatcherInterface, IntrospectionResultData } from "apollo-cache-inmemory";
3
3
  export declare class IntrospectionFragmentMatcher implements FragmentMatcherInterface {
4
4
  private readonly isReady;
5
5
  private readonly possibleTypesMap;
@@ -1,18 +1,7 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.IntrospectionFragmentMatcher = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var _tsInvariant = require("ts-invariant");
12
- var IntrospectionFragmentMatcher = exports.IntrospectionFragmentMatcher = /*#__PURE__*/function () {
13
- function IntrospectionFragmentMatcher(options) {
14
- (0, _classCallCheck2.default)(this, IntrospectionFragmentMatcher);
15
- (0, _defineProperty2.default)(this, "possibleTypesMap", {});
1
+ import { invariant } from "ts-invariant";
2
+ export class IntrospectionFragmentMatcher {
3
+ possibleTypesMap = {};
4
+ constructor(options) {
16
5
  if (options && options.introspectionQueryResultData) {
17
6
  this.possibleTypesMap = this.parseIntrospectionResult(options.introspectionQueryResultData);
18
7
  this.isReady = true;
@@ -21,42 +10,36 @@ var IntrospectionFragmentMatcher = exports.IntrospectionFragmentMatcher = /*#__P
21
10
  }
22
11
  this.match = this.match.bind(this);
23
12
  }
24
- return (0, _createClass2.default)(IntrospectionFragmentMatcher, [{
25
- key: "match",
26
- value: function match(idValue, typeCondition, context) {
27
- (0, _tsInvariant.invariant)(this.isReady, "FragmentMatcher.match() was called before FragmentMatcher.init()");
28
- var obj = context.store.get(idValue.id);
29
- var isRootQuery = idValue.id === "ROOT_QUERY";
30
- if (!obj) {
31
- // https://github.com/apollographql/apollo-client/pull/4620
32
- return isRootQuery;
33
- }
34
- var _obj$__typename = obj.__typename,
35
- __typename = _obj$__typename === void 0 ? isRootQuery && "Query" : _obj$__typename;
36
- (0, _tsInvariant.invariant)(__typename, "Cannot match fragment because __typename property is missing: ".concat(JSON.stringify(obj)));
37
- if (__typename === typeCondition) {
38
- return true;
39
- }
40
- var implementingTypes = this.possibleTypesMap[typeCondition];
41
- if (__typename && implementingTypes && implementingTypes.indexOf(__typename) > -1) {
42
- return true;
43
- }
44
- return false;
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;
45
20
  }
46
- }, {
47
- key: "parseIntrospectionResult",
48
- value: function parseIntrospectionResult(introspectionResultData) {
49
- var typeMap = {};
50
- introspectionResultData.__schema.types.forEach(function (type) {
51
- if (type.kind === "UNION" || type.kind === "INTERFACE") {
52
- typeMap[type.name] = type.possibleTypes.map(function (implementingType) {
53
- return implementingType.name;
54
- });
55
- }
56
- });
57
- return typeMap;
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;
58
27
  }
59
- }]);
60
- }();
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
+ }
61
44
 
62
45
  //# sourceMappingURL=IntrospectionFragmentMatcher.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_tsInvariant","require","IntrospectionFragmentMatcher","exports","options","_classCallCheck2","default","_defineProperty2","introspectionQueryResultData","possibleTypesMap","parseIntrospectionResult","isReady","match","bind","_createClass2","key","value","idValue","typeCondition","context","invariant","obj","store","get","id","isRootQuery","_obj$__typename","__typename","concat","JSON","stringify","implementingTypes","indexOf","introspectionResultData","typeMap","__schema","types","forEach","type","kind","name","possibleTypes","map","implementingType"],"sources":["IntrospectionFragmentMatcher.ts"],"sourcesContent":["import { IdValue } from \"apollo-utilities\";\nimport { invariant } from \"ts-invariant\";\n\nimport {\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,IAAAA,YAAA,GAAAC,OAAA;AAAyC,IAS5BC,4BAA4B,GAAAC,OAAA,CAAAD,4BAAA;EAIrC,SAAAA,6BAAYE,OAAoE,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAJ,4BAAA;IAAA,IAAAK,gBAAA,CAAAD,OAAA,4BAF5B,CAAC,CAAC;IAGpD,IAAIF,OAAO,IAAIA,OAAO,CAACI,4BAA4B,EAAE;MACjD,IAAI,CAACC,gBAAgB,GAAG,IAAI,CAACC,wBAAwB,CACjDN,OAAO,CAACI,4BACZ,CAAC;MACD,IAAI,CAACG,OAAO,GAAG,IAAI;IACvB,CAAC,MAAM;MACH,IAAI,CAACA,OAAO,GAAG,KAAK;IACxB;IAEA,IAAI,CAACC,KAAK,GAAG,IAAI,CAACA,KAAK,CAACC,IAAI,C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AAI,CAAC,GAAGF,IAAI,CAACG,aAAa,CAACC,GAAG,CACvC,UAAAC,gBAAgB;YAAA,OAAIA,gBAAgB,CAACH,IAAI;UAAA,CAC7C,CAAC;QACL;MACJ,CAAC,CAAC;MACF,OAAON,OAAO;IAClB;EAAC;AAAA","ignoreList":[]}
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
- /// <reference types="react" />
2
- import { ImageProps } from "../types";
1
+ import type { ImageProps } from "../types.js";
3
2
  export declare const Image: ({ preset: presetName, ...props }: ImageProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;