@webiny/app 5.44.1-beta.0 → 5.45.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (427) hide show
  1. package/App.d.ts +5 -13
  2. package/App.js +70 -87
  3. package/App.js.map +1 -1
  4. package/AppContainer.d.ts +23 -0
  5. package/AppContainer.js +9 -0
  6. package/AppContainer.js.map +1 -0
  7. package/README.md +7 -15
  8. package/apollo-client/InMemoryCache.d.ts +3 -2
  9. package/apollo-client/InMemoryCache.js +16 -47
  10. package/apollo-client/InMemoryCache.js.map +1 -1
  11. package/apollo-client/IntrospectionFragmentMatcher.d.ts +2 -2
  12. package/apollo-client/IntrospectionFragmentMatcher.js +33 -50
  13. package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -1
  14. package/components/Image.d.ts +1 -2
  15. package/components/Image.js +11 -19
  16. package/components/Image.js.map +1 -1
  17. package/components/index.d.ts +1 -2
  18. package/components/index.js +1 -19
  19. package/components/index.js.map +1 -1
  20. package/config/RouterConfig/Route.d.ts +29 -0
  21. package/config/RouterConfig/Route.js +33 -0
  22. package/config/RouterConfig/Route.js.map +1 -0
  23. package/config/RouterConfig.d.ts +31 -0
  24. package/config/RouterConfig.js +18 -0
  25. package/config/RouterConfig.js.map +1 -0
  26. package/config.js +9 -15
  27. package/config.js.map +1 -1
  28. package/contexts/Ui/index.js +28 -52
  29. package/contexts/Ui/index.js.map +1 -1
  30. package/core/DebounceRender.js +13 -24
  31. package/core/DebounceRender.js.map +1 -1
  32. package/core/Plugin.d.ts +1 -1
  33. package/core/Plugin.js +11 -19
  34. package/core/Plugin.js.map +1 -1
  35. package/core/Plugins.d.ts +1 -1
  36. package/core/Plugins.js +20 -25
  37. package/core/Plugins.js.map +1 -1
  38. package/core/Provider.d.ts +1 -1
  39. package/core/Provider.js +9 -13
  40. package/core/Provider.js.map +1 -1
  41. package/core/Routes.d.ts +2 -1
  42. package/core/Routes.js +13 -23
  43. package/core/Routes.js.map +1 -1
  44. package/core/createProvider.d.ts +2 -2
  45. package/core/createProvider.js +1 -7
  46. package/core/createProvider.js.map +1 -1
  47. package/core/createProviderPlugin.d.ts +1 -1
  48. package/core/createProviderPlugin.js +4 -10
  49. package/core/createProviderPlugin.js.map +1 -1
  50. package/errors/AuthenticationErrorEvent.d.ts +9 -0
  51. package/errors/AuthenticationErrorEvent.js +10 -0
  52. package/errors/AuthenticationErrorEvent.js.map +1 -0
  53. package/errors/NetworkErrorEvent.d.ts +15 -0
  54. package/errors/NetworkErrorEvent.js +10 -0
  55. package/errors/NetworkErrorEvent.js.map +1 -0
  56. package/errors/abstractions.d.ts +12 -0
  57. package/errors/abstractions.js +5 -0
  58. package/errors/abstractions.js.map +1 -0
  59. package/errors/index.d.ts +6 -0
  60. package/errors/index.js +6 -0
  61. package/errors/index.js.map +1 -0
  62. package/exports/admin/envConfig.d.ts +1 -0
  63. package/exports/admin/envConfig.js +3 -0
  64. package/exports/admin/envConfig.js.map +1 -0
  65. package/exports/admin/graphqlClient.d.ts +1 -0
  66. package/exports/admin/graphqlClient.js +3 -0
  67. package/exports/admin/graphqlClient.js.map +1 -0
  68. package/exports/admin/localStorage.d.ts +2 -0
  69. package/exports/admin/localStorage.js +4 -0
  70. package/exports/admin/localStorage.js.map +1 -0
  71. package/exports/admin/router.d.ts +4 -0
  72. package/exports/admin/router.js +6 -0
  73. package/exports/admin/router.js.map +1 -0
  74. package/exports/admin/security.d.ts +1 -0
  75. package/exports/admin/security.js +3 -0
  76. package/exports/admin/security.js.map +1 -0
  77. package/exports/admin.d.ts +6 -0
  78. package/exports/admin.js +8 -0
  79. package/exports/admin.js.map +1 -0
  80. package/features/envConfig/EnvConfig.d.ts +6 -0
  81. package/features/envConfig/EnvConfig.js +14 -0
  82. package/features/envConfig/EnvConfig.js.map +1 -0
  83. package/features/envConfig/abstractions.d.ts +27 -0
  84. package/features/envConfig/abstractions.js +4 -0
  85. package/features/envConfig/abstractions.js.map +1 -0
  86. package/features/envConfig/feature.d.ts +17 -0
  87. package/features/envConfig/feature.js +14 -0
  88. package/features/envConfig/feature.js.map +1 -0
  89. package/features/envConfig/index.d.ts +1 -0
  90. package/features/envConfig/index.js +3 -0
  91. package/features/envConfig/index.js.map +1 -0
  92. package/features/eventPublisher/EventPublisher.d.ts +8 -0
  93. package/features/eventPublisher/EventPublisher.js +27 -0
  94. package/features/eventPublisher/EventPublisher.js.map +1 -0
  95. package/features/eventPublisher/abstractions.d.ts +18 -0
  96. package/features/eventPublisher/abstractions.js +14 -0
  97. package/features/eventPublisher/abstractions.js.map +1 -0
  98. package/features/eventPublisher/feature.d.ts +1 -0
  99. package/features/eventPublisher/feature.js +11 -0
  100. package/features/eventPublisher/feature.js.map +1 -0
  101. package/features/eventPublisher/index.d.ts +3 -0
  102. package/features/eventPublisher/index.js +4 -0
  103. package/features/eventPublisher/index.js.map +1 -0
  104. package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
  105. package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
  106. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
  107. package/features/graphqlClient/BatchingGraphQLClient.d.ts +18 -0
  108. package/features/graphqlClient/BatchingGraphQLClient.js +164 -0
  109. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
  110. package/features/graphqlClient/FetchGraphQLClient.d.ts +10 -0
  111. package/features/graphqlClient/FetchGraphQLClient.js +62 -0
  112. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
  113. package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
  114. package/features/graphqlClient/NetworkErrorPublishing.js +55 -0
  115. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
  116. package/features/graphqlClient/RequestValue.d.ts +20 -0
  117. package/features/graphqlClient/RequestValue.js +42 -0
  118. package/features/graphqlClient/RequestValue.js.map +1 -0
  119. package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
  120. package/features/graphqlClient/RetryGraphQLClient.js +54 -0
  121. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
  122. package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
  123. package/features/graphqlClient/__tests__/GraphQLClient.test.js +350 -0
  124. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
  125. package/features/graphqlClient/abstractions.d.ts +17 -0
  126. package/features/graphqlClient/abstractions.js +4 -0
  127. package/features/graphqlClient/abstractions.js.map +1 -0
  128. package/features/graphqlClient/feature.d.ts +6 -0
  129. package/features/graphqlClient/feature.js +31 -0
  130. package/features/graphqlClient/feature.js.map +1 -0
  131. package/features/graphqlClient/index.d.ts +1 -0
  132. package/features/graphqlClient/index.js +3 -0
  133. package/features/graphqlClient/index.js.map +1 -0
  134. package/features/graphqlClient/types.d.ts +5 -0
  135. package/features/graphqlClient/types.js +3 -0
  136. package/features/graphqlClient/types.js.map +1 -0
  137. package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
  138. package/features/localStorage/BrowserLocalStorageGateway.js +68 -0
  139. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
  140. package/features/localStorage/LocalStorage.d.ts +12 -0
  141. package/features/localStorage/LocalStorage.js +31 -0
  142. package/features/localStorage/LocalStorage.js.map +1 -0
  143. package/features/localStorage/LocalStorageRepository.d.ts +20 -0
  144. package/features/localStorage/LocalStorageRepository.js +95 -0
  145. package/features/localStorage/LocalStorageRepository.js.map +1 -0
  146. package/features/localStorage/abstractions.d.ts +48 -0
  147. package/features/localStorage/abstractions.js +19 -0
  148. package/features/localStorage/abstractions.js.map +1 -0
  149. package/features/localStorage/feature.d.ts +12 -0
  150. package/features/localStorage/feature.js +34 -0
  151. package/features/localStorage/feature.js.map +1 -0
  152. package/features/localStorage/index.d.ts +1 -0
  153. package/features/localStorage/index.js +3 -0
  154. package/features/localStorage/index.js.map +1 -0
  155. package/features/router/HistoryRouterGateway.d.ts +18 -0
  156. package/features/router/HistoryRouterGateway.js +82 -0
  157. package/features/router/HistoryRouterGateway.js.map +1 -0
  158. package/features/router/HistoryRouterGateway.test.d.ts +1 -0
  159. package/features/router/HistoryRouterGateway.test.js +204 -0
  160. package/features/router/HistoryRouterGateway.test.js.map +1 -0
  161. package/features/router/Route.d.ts +19 -0
  162. package/features/router/Route.js +59 -0
  163. package/features/router/Route.js.map +1 -0
  164. package/features/router/RouteUrl.d.ts +85 -0
  165. package/features/router/RouteUrl.js +232 -0
  166. package/features/router/RouteUrl.js.map +1 -0
  167. package/features/router/Router.d.ts +45 -0
  168. package/features/router/Router.js +129 -0
  169. package/features/router/Router.js.map +1 -0
  170. package/features/router/RouterPresenter.d.ts +17 -0
  171. package/features/router/RouterPresenter.js +45 -0
  172. package/features/router/RouterPresenter.js.map +1 -0
  173. package/features/router/RouterRepository.d.ts +21 -0
  174. package/features/router/RouterRepository.js +71 -0
  175. package/features/router/RouterRepository.js.map +1 -0
  176. package/features/router/RouterRepository.test.d.ts +1 -0
  177. package/features/router/RouterRepository.test.js +154 -0
  178. package/features/router/RouterRepository.test.js.map +1 -0
  179. package/features/router/abstractions.d.ts +68 -0
  180. package/features/router/abstractions.js +15 -0
  181. package/features/router/abstractions.js.map +1 -0
  182. package/features/router/feature.d.ts +4 -0
  183. package/features/router/feature.js +18 -0
  184. package/features/router/feature.js.map +1 -0
  185. package/features/router/index.d.ts +1 -0
  186. package/features/router/index.js +3 -0
  187. package/features/router/index.js.map +1 -0
  188. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  189. package/helpers/InterfaceGenerator/date.js +3 -0
  190. package/helpers/InterfaceGenerator/date.js.map +1 -0
  191. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  192. package/helpers/InterfaceGenerator/id.js +3 -0
  193. package/helpers/InterfaceGenerator/id.js.map +1 -0
  194. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  195. package/helpers/InterfaceGenerator/identity.js +3 -0
  196. package/helpers/InterfaceGenerator/identity.js.map +1 -0
  197. package/helpers/InterfaceGenerator/index.d.ts +5 -0
  198. package/helpers/InterfaceGenerator/index.js +3 -0
  199. package/helpers/InterfaceGenerator/index.js.map +1 -0
  200. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  201. package/helpers/InterfaceGenerator/numeric.js +3 -0
  202. package/helpers/InterfaceGenerator/numeric.js.map +1 -0
  203. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  204. package/helpers/InterfaceGenerator/truthful.js +3 -0
  205. package/helpers/InterfaceGenerator/truthful.js.map +1 -0
  206. package/hooks/useAutocomplete/index.d.ts +1 -1
  207. package/hooks/useAutocomplete/index.js +1 -12
  208. package/hooks/useAutocomplete/index.js.map +1 -1
  209. package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
  210. package/hooks/useAutocomplete/useAutocomplete.js +6 -16
  211. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  212. package/hooks/useDataList/functions/getData.js +2 -11
  213. package/hooks/useDataList/functions/getData.js.map +1 -1
  214. package/hooks/useDataList/functions/getError.js +2 -11
  215. package/hooks/useDataList/functions/getError.js.map +1 -1
  216. package/hooks/useDataList/functions/getMeta.js +2 -11
  217. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  218. package/hooks/useDataList/functions/index.d.ts +3 -3
  219. package/hooks/useDataList/functions/index.js +3 -27
  220. package/hooks/useDataList/functions/index.js.map +1 -1
  221. package/hooks/useDataList/functions/searchDataByKey.js +4 -10
  222. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
  223. package/hooks/useDataList/index.d.ts +1 -1
  224. package/hooks/useDataList/index.js +1 -12
  225. package/hooks/useDataList/index.js.map +1 -1
  226. package/hooks/useDataList/useDataList.d.ts +2 -3
  227. package/hooks/useDataList/useDataList.js +74 -94
  228. package/hooks/useDataList/useDataList.js.map +1 -1
  229. package/hooks/useDataList/utils/index.d.ts +1 -2
  230. package/hooks/useDataList/utils/index.js +1 -20
  231. package/hooks/useDataList/utils/index.js.map +1 -1
  232. package/hooks/useDataList/utils/prepareLoadListParams.js +10 -16
  233. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  234. package/hooks/useHandler.js +7 -12
  235. package/hooks/useHandler.js.map +1 -1
  236. package/hooks/useHandlers.js +11 -17
  237. package/hooks/useHandlers.js.map +1 -1
  238. package/hooks/useRegisterLegacyPlugin.d.ts +1 -1
  239. package/hooks/useRegisterLegacyPlugin.js +5 -11
  240. package/hooks/useRegisterLegacyPlugin.js.map +1 -1
  241. package/hooks/useUi.d.ts +1 -1
  242. package/hooks/useUi.js +4 -10
  243. package/hooks/useUi.js.map +1 -1
  244. package/i18n/i18n.js +5 -13
  245. package/i18n/i18n.js.map +1 -1
  246. package/i18n/index.d.ts +1 -1
  247. package/i18n/index.js +1 -13
  248. package/i18n/index.js.map +1 -1
  249. package/index.d.ts +23 -15
  250. package/index.js +25 -177
  251. package/index.js.map +1 -1
  252. package/package.json +25 -22
  253. package/plugins/AddQuerySelectionPlugin.d.ts +2 -2
  254. package/plugins/AddQuerySelectionPlugin.js +61 -107
  255. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  256. package/plugins/ApolloCacheObjectIdPlugin.js +12 -31
  257. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  258. package/plugins/ApolloDynamicLink.d.ts +3 -2
  259. package/plugins/ApolloDynamicLink.js +19 -46
  260. package/plugins/ApolloDynamicLink.js.map +1 -1
  261. package/plugins/ApolloLinkPlugin.d.ts +1 -1
  262. package/plugins/ApolloLinkPlugin.js +18 -37
  263. package/plugins/ApolloLinkPlugin.js.map +1 -1
  264. package/plugins/ConsoleLinkPlugin.d.ts +1 -1
  265. package/plugins/ConsoleLinkPlugin.js +20 -41
  266. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  267. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
  268. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +35 -58
  269. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  270. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
  271. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +31 -0
  272. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
  273. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  274. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +31 -0
  275. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  276. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -5
  277. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -12
  278. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  279. package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
  280. package/plugins/NetworkErrorLinkPlugin/Typography.js +18 -0
  281. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
  282. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
  283. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +10 -25
  284. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  285. package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
  286. package/plugins/NetworkErrorLinkPlugin.js +60 -37
  287. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  288. package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
  289. package/plugins/OmitTypenameLinkPlugin.js +11 -30
  290. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  291. package/plugins/TenantHeaderLinkPlugin.d.ts +3 -3
  292. package/plugins/TenantHeaderLinkPlugin.js +29 -48
  293. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  294. package/plugins/components/Image.d.ts +6 -0
  295. package/plugins/components/Image.js +19 -0
  296. package/plugins/components/Image.js.map +1 -0
  297. package/plugins/image.d.ts +1 -1
  298. package/plugins/image.js +46 -53
  299. package/plugins/image.js.map +1 -1
  300. package/plugins/index.d.ts +4 -4
  301. package/plugins/index.js +31 -53
  302. package/plugins/index.js.map +1 -1
  303. package/presentation/localStorage/index.d.ts +3 -0
  304. package/presentation/localStorage/index.js +5 -0
  305. package/presentation/localStorage/index.js.map +1 -0
  306. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  307. package/presentation/localStorage/useLocalStorage.js +21 -0
  308. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  309. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  310. package/presentation/localStorage/useLocalStorageValue.js +20 -0
  311. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  312. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  313. package/presentation/localStorage/useLocalStorageValues.js +39 -0
  314. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  315. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  316. package/presentation/router/RouteElementRegistry.js +32 -0
  317. package/presentation/router/RouteElementRegistry.js.map +1 -0
  318. package/presentation/router/abstractions.d.ts +13 -0
  319. package/presentation/router/abstractions.js +4 -0
  320. package/presentation/router/abstractions.js.map +1 -0
  321. package/presentation/router/components/RouteContent.d.ts +2 -0
  322. package/presentation/router/components/RouteContent.js +17 -0
  323. package/presentation/router/components/RouteContent.js.map +1 -0
  324. package/presentation/router/components/RouteLink.d.ts +50 -0
  325. package/presentation/router/components/RouteLink.js +22 -0
  326. package/presentation/router/components/RouteLink.js.map +1 -0
  327. package/presentation/router/components/SimpleLink.d.ts +44 -0
  328. package/presentation/router/components/SimpleLink.js +30 -0
  329. package/presentation/router/components/SimpleLink.js.map +1 -0
  330. package/presentation/router/hooks/useRoute.d.ts +6 -0
  331. package/presentation/router/hooks/useRoute.js +30 -0
  332. package/presentation/router/hooks/useRoute.js.map +1 -0
  333. package/presentation/router/hooks/useRouter.d.ts +7 -0
  334. package/presentation/router/hooks/useRouter.js +26 -0
  335. package/presentation/router/hooks/useRouter.js.map +1 -0
  336. package/presentation/router/index.d.ts +4 -0
  337. package/presentation/router/index.js +5 -0
  338. package/presentation/router/index.js.map +1 -0
  339. package/presentation/router/types.d.ts +5 -0
  340. package/presentation/router/types.js +3 -0
  341. package/presentation/router/types.js.map +1 -0
  342. package/react-butterfiles/Files.js +208 -235
  343. package/react-butterfiles/Files.js.map +1 -1
  344. package/react-butterfiles/file.todo +1 -0
  345. package/react-butterfiles/index.d.ts +1 -1
  346. package/react-butterfiles/index.js +2 -8
  347. package/react-butterfiles/index.js.map +1 -1
  348. package/react-butterfiles/utils/generateId.js +1 -7
  349. package/react-butterfiles/utils/generateId.js.map +1 -1
  350. package/react-butterfiles/utils/readFileContent.js +4 -10
  351. package/react-butterfiles/utils/readFileContent.js.map +1 -1
  352. package/renderApp.d.ts +1 -1
  353. package/renderApp.js +4 -11
  354. package/renderApp.js.map +1 -1
  355. package/router.d.ts +5 -0
  356. package/router.js +8 -0
  357. package/router.js.map +1 -0
  358. package/shared/di/DiContainerProvider.d.ts +8 -0
  359. package/shared/di/DiContainerProvider.js +17 -0
  360. package/shared/di/DiContainerProvider.js.map +1 -0
  361. package/shared/di/createFeature.d.ts +11 -0
  362. package/shared/di/createFeature.js +11 -0
  363. package/shared/di/createFeature.js.map +1 -0
  364. package/shared/di/useFeature.d.ts +2 -0
  365. package/shared/di/useFeature.js +18 -0
  366. package/shared/di/useFeature.js.map +1 -0
  367. package/types.d.ts +9 -6
  368. package/types.js +1 -12
  369. package/types.js.map +1 -1
  370. package/utils/createGenericContext.js +13 -22
  371. package/utils/createGenericContext.js.map +1 -1
  372. package/utils/createHashing.js +9 -15
  373. package/utils/createHashing.js.map +1 -1
  374. package/utils/index.d.ts +2 -10
  375. package/utils/index.js +2 -115
  376. package/utils/index.js.map +1 -1
  377. package/utils/legacyPluginToReactComponent.d.ts +1 -1
  378. package/utils/legacyPluginToReactComponent.js +5 -11
  379. package/utils/legacyPluginToReactComponent.js.map +1 -1
  380. package/components/Routes.d.ts +0 -2
  381. package/components/Routes.js +0 -46
  382. package/components/Routes.js.map +0 -1
  383. package/components/View.d.ts +0 -8
  384. package/components/View.js +0 -31
  385. package/components/View.js.map +0 -1
  386. package/core/AddRoute.d.ts +0 -21
  387. package/core/AddRoute.js +0 -21
  388. package/core/AddRoute.js.map +0 -1
  389. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  390. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -30
  391. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  392. package/hooks/useDataList/utils/types.d.ts +0 -40
  393. package/hooks/useDataList/utils/types.js +0 -7
  394. package/hooks/useDataList/utils/types.js.map +0 -1
  395. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
  396. package/plugins/LocaleHeaderLinkPlugin.js +0 -49
  397. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  398. package/plugins/RoutePlugin.d.ts +0 -12
  399. package/plugins/RoutePlugin.js +0 -35
  400. package/plugins/RoutePlugin.js.map +0 -1
  401. package/plugins/ViewPlugin.d.ts +0 -14
  402. package/plugins/ViewPlugin.js +0 -40
  403. package/plugins/ViewPlugin.js.map +0 -1
  404. package/utils/getApiUrl.d.ts +0 -1
  405. package/utils/getApiUrl.js +0 -12
  406. package/utils/getApiUrl.js.map +0 -1
  407. package/utils/getGqlApiUrl.d.ts +0 -1
  408. package/utils/getGqlApiUrl.js +0 -12
  409. package/utils/getGqlApiUrl.js.map +0 -1
  410. package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
  411. package/utils/getHeadlessCmsGqlApiUrl.js +0 -18
  412. package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
  413. package/utils/getLocaleCode.d.ts +0 -6
  414. package/utils/getLocaleCode.js +0 -43
  415. package/utils/getLocaleCode.js.map +0 -1
  416. package/utils/getPrerenderId.d.ts +0 -6
  417. package/utils/getPrerenderId.js +0 -11
  418. package/utils/getPrerenderId.js.map +0 -1
  419. package/utils/getTenantId.d.ts +0 -6
  420. package/utils/getTenantId.js +0 -51
  421. package/utils/getTenantId.js.map +0 -1
  422. package/utils/isLocalhost.d.ts +0 -1
  423. package/utils/isLocalhost.js +0 -15
  424. package/utils/isLocalhost.js.map +0 -1
  425. package/utils/isPrerendering.d.ts +0 -1
  426. package/utils/isPrerendering.js +0 -11
  427. package/utils/isPrerendering.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@webiny/app",
3
- "version": "5.44.1-beta.0",
3
+ "version": "5.45.0-beta.0",
4
+ "type": "module",
4
5
  "main": "index.js",
5
6
  "repository": {
6
7
  "type": "git",
@@ -17,12 +18,13 @@
17
18
  "@apollo/react-hooks": "3.1.5",
18
19
  "@emotion/styled": "11.10.6",
19
20
  "@types/react": "18.2.79",
20
- "@webiny/i18n": "5.44.1-beta.0",
21
- "@webiny/i18n-react": "5.44.1-beta.0",
22
- "@webiny/plugins": "5.44.1-beta.0",
23
- "@webiny/react-composition": "5.44.1-beta.0",
24
- "@webiny/react-router": "5.44.1-beta.0",
25
- "@webiny/ui": "5.44.1-beta.0",
21
+ "@webiny/di": "0.2.3",
22
+ "@webiny/feature": "5.45.0-beta.0",
23
+ "@webiny/i18n": "5.45.0-beta.0",
24
+ "@webiny/i18n-react": "5.45.0-beta.0",
25
+ "@webiny/plugins": "5.45.0-beta.0",
26
+ "@webiny/react-composition": "5.45.0-beta.0",
27
+ "@webiny/react-properties": "5.45.0-beta.0",
26
28
  "apollo-cache": "1.3.5",
27
29
  "apollo-cache-inmemory": "1.6.6",
28
30
  "apollo-client": "2.6.10",
@@ -33,31 +35,32 @@
33
35
  "apollo-utilities": "1.3.4",
34
36
  "boolean": "3.2.0",
35
37
  "bytes": "3.1.2",
36
- "graphql": "15.9.0",
38
+ "graphql": "16.12.0",
39
+ "history": "5.3.0",
37
40
  "invariant": "2.2.4",
38
- "lodash": "4.17.21",
39
- "minimatch": "5.1.6",
40
- "nanoid": "3.3.11",
41
+ "lodash": "4.17.23",
42
+ "minimatch": "10.2.2",
43
+ "mobx": "6.15.0",
44
+ "nanoid": "5.1.6",
41
45
  "react": "18.2.0",
42
46
  "react-dom": "18.2.0",
43
47
  "ts-invariant": "0.10.3",
44
- "warning": "4.0.3"
48
+ "warning": "4.0.3",
49
+ "zod": "3.25.76"
45
50
  },
46
51
  "devDependencies": {
47
- "@types/lodash": "4.17.13",
48
- "@types/warning": "3.0.0",
49
- "@webiny/project-utils": "5.44.1-beta.0",
50
- "rimraf": "6.0.1",
51
- "typescript": "5.3.3"
52
+ "@types/lodash": "4.17.23",
53
+ "@types/warning": "3.0.3",
54
+ "@webiny/build-tools": "5.45.0-beta.0",
55
+ "rimraf": "6.1.3",
56
+ "type-fest": "5.4.4",
57
+ "typescript": "5.9.3",
58
+ "vitest": "4.0.18"
52
59
  },
53
60
  "publishConfig": {
54
61
  "access": "public",
55
62
  "directory": "dist"
56
63
  },
57
- "scripts": {
58
- "build": "node ../cli/bin.js run build",
59
- "watch": "node ../cli/bin.js run watch"
60
- },
61
64
  "adio": {
62
65
  "ignore": {
63
66
  "dependencies": [
@@ -65,5 +68,5 @@
65
68
  ]
66
69
  }
67
70
  },
68
- "gitHead": "c80e6d88501ac84229f6577dee7b30163a906379"
71
+ "gitHead": "b85c33cfbe7c02c130445c918d913ef4b2c09cb2"
69
72
  }
@@ -1,6 +1,6 @@
1
1
  import { ApolloLink } from "apollo-link";
2
- import { DocumentNode } from "graphql";
3
- import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
2
+ import type { DocumentNode } from "graphql";
3
+ import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
4
4
  declare module "graphql" {
5
5
  interface DocumentNode {
6
6
  __webiny__: Set<string>;
@@ -1,118 +1,72 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.AddQuerySelectionPlugin = void 0;
8
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
- var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
- var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
13
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
- var _apolloLink = require("apollo-link");
15
- var _graphql = require("graphql");
16
- var _ApolloLinkPlugin2 = require("./ApolloLinkPlugin");
17
- var AddQuerySelectionPlugin = exports.AddQuerySelectionPlugin = /*#__PURE__*/function (_ApolloLinkPlugin) {
18
- function AddQuerySelectionPlugin(config) {
19
- var _this;
20
- (0, _classCallCheck2.default)(this, AddQuerySelectionPlugin);
21
- _this = (0, _callSuper2.default)(this, AddQuerySelectionPlugin);
22
- _this.config = config;
23
- return _this;
1
+ import { ApolloLink } from "apollo-link";
2
+ import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
3
+ export class AddQuerySelectionPlugin extends ApolloLinkPlugin {
4
+ constructor(config) {
5
+ super();
6
+ this.config = config;
24
7
  }
25
- (0, _inherits2.default)(AddQuerySelectionPlugin, _ApolloLinkPlugin);
26
- return (0, _createClass2.default)(AddQuerySelectionPlugin, [{
27
- key: "createLink",
28
- value: function createLink() {
29
- var _this2 = this;
30
- return new _apolloLink.ApolloLink(function (operation, forward) {
31
- if (operation.operationName !== _this2.config.operationName) {
32
- return forward(operation);
33
- }
34
- _this2.addSelectionToQuery(operation.operationName, operation.query);
8
+ createLink() {
9
+ return new ApolloLink((operation, forward) => {
10
+ if (operation.operationName !== this.config.operationName) {
35
11
  return forward(operation);
36
- });
37
- }
38
- }, {
39
- key: "addSelectionToQuery",
40
- value: function addSelectionToQuery(operationName, document) {
41
- var _tree;
42
- if (operationName !== this.config.operationName) {
43
- return;
44
12
  }
13
+ this.addSelectionToQuery(operation.operationName, operation.query);
14
+ return forward(operation);
15
+ });
16
+ }
17
+ addSelectionToQuery(operationName, document) {
18
+ if (operationName !== this.config.operationName) {
19
+ return;
20
+ }
45
21
 
46
- // If this plugin already processed the given document (documents are always passed by reference),
47
- // then we don't want to apply the selection again, to avoid adding duplicate selections.
48
- if (this.isProcessed(document)) {
49
- return;
50
- }
51
- this.markProcessed(document);
52
- var _this$config = this.config,
53
- addSelection = _this$config.addSelection,
54
- selectionPath = _this$config.selectionPath;
55
- var firstQueryDefinition = document.definitions[0];
56
- if (!firstQueryDefinition) {
57
- return;
58
- } else if (!firstQueryDefinition.selectionSet) {
59
- return;
60
- }
61
- var tree = firstQueryDefinition.selectionSet.selections;
62
- var fields = selectionPath.split(".");
63
- var _iterator = (0, _createForOfIteratorHelper2.default)(fields),
64
- _step;
65
- try {
66
- fieldLoop: for (_iterator.s(); !(_step = _iterator.n()).done;) {
67
- var field = _step.value;
68
- var _iterator2 = (0, _createForOfIteratorHelper2.default)(tree),
69
- _step2;
70
- try {
71
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
72
- var selection = _step2.value;
73
- if (!selection.selectionSet) {
74
- continue;
75
- }
76
- if (selection.name.value === field) {
77
- tree = selection.selectionSet.selections;
78
- continue fieldLoop;
79
- }
80
- }
81
- // If we get here, it means we didn't find the necessary selection
82
- } catch (err) {
83
- _iterator2.e(err);
84
- } finally {
85
- _iterator2.f();
86
- }
87
- return;
22
+ // If this plugin already processed the given document (documents are always passed by reference),
23
+ // then we don't want to apply the selection again, to avoid adding duplicate selections.
24
+ if (this.isProcessed(document)) {
25
+ return;
26
+ }
27
+ this.markProcessed(document);
28
+ const {
29
+ addSelection,
30
+ selectionPath
31
+ } = this.config;
32
+ const firstQueryDefinition = document.definitions[0];
33
+ if (!firstQueryDefinition) {
34
+ return;
35
+ } else if (!firstQueryDefinition.selectionSet) {
36
+ return;
37
+ }
38
+ let tree = firstQueryDefinition.selectionSet.selections;
39
+ const fields = selectionPath.split(".");
40
+ fieldLoop: for (const field of fields) {
41
+ for (const selection of tree) {
42
+ if (!selection.selectionSet) {
43
+ continue;
44
+ }
45
+ if (selection.name.value === field) {
46
+ tree = selection.selectionSet.selections;
47
+ continue fieldLoop;
88
48
  }
89
- } catch (err) {
90
- _iterator.e(err);
91
- } finally {
92
- _iterator.f();
93
49
  }
94
- /**
95
- * We must cast because there are a lot of types that are not intertwined and TS is complaining
96
- */
97
- (_tree = tree).push.apply(_tree, (0, _toConsumableArray2.default)(addSelection.definitions[0].selectionSet.selections));
50
+ // If we get here, it means we didn't find the necessary selection
51
+ return;
98
52
  }
99
- }, {
100
- key: "isProcessed",
101
- value: function isProcessed(document) {
102
- if (!document.hasOwnProperty("__webiny__")) {
103
- document.__webiny__ = new Set();
104
- }
105
- return document.__webiny__.has(this.cacheKey);
53
+ /**
54
+ * We must cast because there are a lot of types that are not intertwined and TS is complaining
55
+ */
56
+ tree.push(...addSelection.definitions[0].selectionSet.selections);
57
+ }
58
+ isProcessed(document) {
59
+ if (!document.hasOwnProperty("__webiny__")) {
60
+ document.__webiny__ = new Set();
106
61
  }
107
- }, {
108
- key: "markProcessed",
109
- value: function markProcessed(document) {
110
- if (!document.hasOwnProperty("__webiny__")) {
111
- document.__webiny__ = new Set();
112
- }
113
- document.__webiny__.add(this.cacheKey);
62
+ return document.__webiny__.has(this.cacheKey);
63
+ }
64
+ markProcessed(document) {
65
+ if (!document.hasOwnProperty("__webiny__")) {
66
+ document.__webiny__ = new Set();
114
67
  }
115
- }]);
116
- }(_ApolloLinkPlugin2.ApolloLinkPlugin);
68
+ document.__webiny__.add(this.cacheKey);
69
+ }
70
+ }
117
71
 
118
72
  //# sourceMappingURL=AddQuerySelectionPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_apolloLink","require","_graphql","_ApolloLinkPlugin2","AddQuerySelectionPlugin","exports","_ApolloLinkPlugin","config","_this","_classCallCheck2","default","_callSuper2","_inherits2","_createClass2","key","value","createLink","_this2","ApolloLink","operation","forward","operationName","addSelectionToQuery","query","document","_tree","isProcessed","markProcessed","_this$config","addSelection","selectionPath","firstQueryDefinition","definitions","selectionSet","tree","selections","fields","split","_iterator","_createForOfIteratorHelper2","_step","fieldLoop","s","n","done","field","_iterator2","_step2","selection","name","err","e","f","push","apply","_toConsumableArray2","hasOwnProperty","__webiny__","Set","has","cacheKey","add","ApolloLinkPlugin"],"sources":["AddQuerySelectionPlugin.ts"],"sourcesContent":["import { ApolloLink } from \"apollo-link\";\nimport { DocumentNode } from \"graphql\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport { ExecutableDefinitionNode, FieldNode } from \"graphql/language/ast\";\n\ndeclare module \"graphql\" {\n interface DocumentNode {\n __webiny__: Set<string>;\n }\n}\n\ninterface Config {\n operationName: string;\n selectionPath: string;\n addSelection: DocumentNode;\n}\n\nexport class AddQuerySelectionPlugin extends ApolloLinkPlugin {\n private readonly config: Config;\n\n constructor(config: Config) {\n super();\n this.config = config;\n }\n\n public override createLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if (operation.operationName !== this.config.operationName) {\n return forward(operation);\n }\n\n this.addSelectionToQuery(operation.operationName, operation.query);\n\n return forward(operation);\n });\n }\n\n public addSelectionToQuery(operationName: string, document: DocumentNode): void {\n if (operationName !== this.config.operationName) {\n return;\n }\n\n // If this plugin already processed the given document (documents are always passed by reference),\n // then we don't want to apply the selection again, to avoid adding duplicate selections.\n if (this.isProcessed(document)) {\n return;\n }\n\n this.markProcessed(document);\n\n const { addSelection, selectionPath } = this.config;\n\n const firstQueryDefinition = document.definitions[0] as ExecutableDefinitionNode;\n if (!firstQueryDefinition) {\n return;\n } else if (!firstQueryDefinition.selectionSet) {\n return;\n }\n\n let tree = firstQueryDefinition.selectionSet.selections as FieldNode[];\n const fields = selectionPath.split(\".\");\n\n fieldLoop: for (const field of fields) {\n for (const selection of tree) {\n if (!selection.selectionSet) {\n continue;\n }\n if (selection.name.value === field) {\n tree = selection.selectionSet.selections as FieldNode[];\n continue fieldLoop;\n }\n }\n // If we get here, it means we didn't find the necessary selection\n return;\n }\n /**\n * We must cast because there are a lot of types that are not intertwined and TS is complaining\n */\n tree.push(\n ...((addSelection.definitions[0] as ExecutableDefinitionNode).selectionSet\n .selections as FieldNode[])\n );\n }\n\n private isProcessed(document: DocumentNode) {\n if (!document.hasOwnProperty(\"__webiny__\")) {\n document.__webiny__ = new Set();\n }\n\n return document.__webiny__.has(this.cacheKey);\n }\n\n private markProcessed(document: DocumentNode) {\n if (!document.hasOwnProperty(\"__webiny__\")) {\n document.__webiny__ = new Set();\n }\n\n document.__webiny__.add(this.cacheKey);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AAAsD,IAezCG,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,0BAAAE,iBAAA;EAGhC,SAAAF,wBAAYG,MAAc,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAN,uBAAA;IACxBI,KAAA,OAAAG,WAAA,CAAAD,OAAA,QAAAN,uBAAA;IACAI,KAAA,CAAKD,MAAM,GAAGA,MAAM;IAAC,OAAAC,KAAA;EACzB;EAAC,IAAAI,UAAA,CAAAF,OAAA,EAAAN,uBAAA,EAAAE,iBAAA;EAAA,WAAAO,aAAA,CAAAH,OAAA,EAAAN,uBAAA;IAAAU,GAAA;IAAAC,KAAA,EAED,SAAgBC,UAAUA,CAAA,EAAe;MAAA,IAAAC,MAAA;MACrC,OAAO,IAAIC,sBAAU,CAAC,UAACC,SAAS,EAAEC,OAAO,EAAK;QAC1C,IAAID,SAAS,CAACE,aAAa,KAAKJ,MAAI,CAACV,MAAM,CAACc,aAAa,EAAE;UACvD,OAAOD,OAAO,CAACD,SAAS,CAAC;QAC7B;QAEAF,MAAI,CAACK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AACI,GAAG,CAAC,IAAI,CAACD,QAAQ,CAAC;IAC1C;EAAC;AAAA,EAjFwCE,mCAAgB","ignoreList":[]}
1
+ {"version":3,"names":["ApolloLink","ApolloLinkPlugin","AddQuerySelectionPlugin","constructor","config","createLink","operation","forward","operationName","addSelectionToQuery","query","document","isProcessed","markProcessed","addSelection","selectionPath","firstQueryDefinition","definitions","selectionSet","tree","selections","fields","split","fieldLoop","field","selection","name","value","push","hasOwnProperty","__webiny__","Set","has","cacheKey","add"],"sources":["AddQuerySelectionPlugin.ts"],"sourcesContent":["import { ApolloLink } from \"apollo-link\";\nimport type { DocumentNode } from \"graphql\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport type { ExecutableDefinitionNode, FieldNode } from \"graphql/language/ast.js\";\n\ndeclare module \"graphql\" {\n interface DocumentNode {\n __webiny__: Set<string>;\n }\n}\n\ninterface Config {\n operationName: string;\n selectionPath: string;\n addSelection: DocumentNode;\n}\n\nexport class AddQuerySelectionPlugin extends ApolloLinkPlugin {\n private readonly config: Config;\n\n constructor(config: Config) {\n super();\n this.config = config;\n }\n\n public override createLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if (operation.operationName !== this.config.operationName) {\n return forward(operation);\n }\n\n this.addSelectionToQuery(operation.operationName, operation.query);\n\n return forward(operation);\n });\n }\n\n public addSelectionToQuery(operationName: string, document: DocumentNode): void {\n if (operationName !== this.config.operationName) {\n return;\n }\n\n // If this plugin already processed the given document (documents are always passed by reference),\n // then we don't want to apply the selection again, to avoid adding duplicate selections.\n if (this.isProcessed(document)) {\n return;\n }\n\n this.markProcessed(document);\n\n const { addSelection, selectionPath } = this.config;\n\n const firstQueryDefinition = document.definitions[0] as ExecutableDefinitionNode;\n if (!firstQueryDefinition) {\n return;\n } else if (!firstQueryDefinition.selectionSet) {\n return;\n }\n\n let tree = firstQueryDefinition.selectionSet.selections as FieldNode[];\n const fields = selectionPath.split(\".\");\n\n fieldLoop: for (const field of fields) {\n for (const selection of tree) {\n if (!selection.selectionSet) {\n continue;\n }\n if (selection.name.value === field) {\n tree = selection.selectionSet.selections as FieldNode[];\n continue fieldLoop;\n }\n }\n // If we get here, it means we didn't find the necessary selection\n return;\n }\n /**\n * We must cast because there are a lot of types that are not intertwined and TS is complaining\n */\n tree.push(\n ...((addSelection.definitions[0] as ExecutableDefinitionNode).selectionSet\n .selections as FieldNode[])\n );\n }\n\n private isProcessed(document: DocumentNode) {\n if (!document.hasOwnProperty(\"__webiny__\")) {\n document.__webiny__ = new Set();\n }\n\n return document.__webiny__.has(this.cacheKey);\n }\n\n private markProcessed(document: DocumentNode) {\n if (!document.hasOwnProperty(\"__webiny__\")) {\n document.__webiny__ = new Set();\n }\n\n document.__webiny__.add(this.cacheKey);\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,aAAa;AAExC,SAASC,gBAAgB;AAezB,OAAO,MAAMC,uBAAuB,SAASD,gBAAgB,CAAC;EAG1DE,WAAWA,CAACC,MAAc,EAAE;IACxB,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEgBC,UAAUA,CAAA,EAAe;IACrC,OAAO,IAAIL,UAAU,CAAC,CAACM,SAAS,EAAEC,OAAO,KAAK;MAC1C,IAAID,SAAS,CAACE,aAAa,KAAK,IAAI,CAACJ,MAAM,CAACI,aAAa,EAAE;QACvD,OAAOD,OAAO,CAACD,SAAS,CAAC;MAC7B;MAEA,IAAI,CAACG,mBAAmB,CAACH,SAAS,CAACE,aAAa,EAAEF,SAAS,CAACI,KAAK,CAAC;MAElE,OAAOH,OAAO,CAACD,SAAS,CAAC;IAC7B,CAAC,CAAC;EACN;EAEOG,mBAAmBA,CAACD,aAAqB,EAAEG,QAAsB,EAAQ;IAC5E,IAAIH,aAAa,KAAK,IAAI,CAACJ,MAAM,CAACI,aAAa,EAAE;MAC7C;IACJ;;IAEA;IACA;IACA,IAAI,IAAI,CAACI,WAAW,CAACD,QAAQ,CAAC,E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CAACmB,UAAU,GAAG,IAAIC,GAAG,CAAC,CAAC;IACnC;IAEApB,QAAQ,CAACmB,UAAU,CAACI,GAAG,CAAC,IAAI,CAACD,QAAQ,CAAC;EAC1C;AACJ","ignoreList":[]}
@@ -1,35 +1,16 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.ApolloCacheObjectIdPlugin = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
- var _plugins = require("@webiny/plugins");
14
- var ApolloCacheObjectIdPlugin = exports.ApolloCacheObjectIdPlugin = /*#__PURE__*/function (_Plugin) {
15
- function ApolloCacheObjectIdPlugin(getObjectId) {
16
- var _this;
17
- (0, _classCallCheck2.default)(this, ApolloCacheObjectIdPlugin);
18
- _this = (0, _callSuper2.default)(this, ApolloCacheObjectIdPlugin);
19
- _this._getObjectId = getObjectId;
20
- return _this;
1
+ import { Plugin } from "@webiny/plugins";
2
+ export class ApolloCacheObjectIdPlugin extends Plugin {
3
+ static type = "cache-get-object-id";
4
+ constructor(getObjectId) {
5
+ super();
6
+ this._getObjectId = getObjectId;
21
7
  }
22
- (0, _inherits2.default)(ApolloCacheObjectIdPlugin, _Plugin);
23
- return (0, _createClass2.default)(ApolloCacheObjectIdPlugin, [{
24
- key: "getObjectId",
25
- value: function getObjectId(data) {
26
- if (typeof this._getObjectId !== "function") {
27
- throw Error("You must provide a \"getObjectId\" callable to the plugin constructor or extend the ApolloCacheObjectIdPlugin.");
28
- }
29
- return this._getObjectId(data);
8
+ getObjectId(data) {
9
+ if (typeof this._getObjectId !== "function") {
10
+ throw Error(`You must provide a "getObjectId" callable to the plugin constructor or extend the ApolloCacheObjectIdPlugin.`);
30
11
  }
31
- }]);
32
- }(_plugins.Plugin);
33
- (0, _defineProperty2.default)(ApolloCacheObjectIdPlugin, "type", "cache-get-object-id");
12
+ return this._getObjectId(data);
13
+ }
14
+ }
34
15
 
35
16
  //# sourceMappingURL=ApolloCacheObjectIdPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","ApolloCacheObjectIdPlugin","exports","_Plugin","getObjectId","_this","_classCallCheck2","default","_callSuper2","_getObjectId","_inherits2","_createClass2","key","value","data","Error","Plugin","_defineProperty2"],"sources":["ApolloCacheObjectIdPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\n\nexport interface ApolloCacheObject {\n __typename?: string;\n [key: string]: any;\n}\n\ninterface ApolloCacheObjectIdPluginCallable<T> {\n // A value for `id`, null to prevent normalization, or undefined to continue with defaults.\n (data: T): string | null | undefined;\n}\n\nexport class ApolloCacheObjectIdPlugin<\n T extends ApolloCacheObject = ApolloCacheObject\n> extends Plugin {\n public static override readonly type: string = \"cache-get-object-id\";\n private readonly _getObjectId?: ApolloCacheObjectIdPluginCallable<T>;\n\n public constructor(getObjectId?: ApolloCacheObjectIdPluginCallable<T>) {\n super();\n this._getObjectId = getObjectId;\n }\n\n public getObjectId(data: T) {\n if (typeof this._getObjectId !== \"function\") {\n throw Error(\n `You must provide a \"getObjectId\" callable to the plugin constructor or extend the ApolloCacheObjectIdPlugin.`\n );\n }\n\n return this._getObjectId(data);\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAyC,IAY5BC,yBAAyB,GAAAC,OAAA,CAAAD,yBAAA,0BAAAE,OAAA;EAMlC,SAAAF,0BAAmBG,WAAkD,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAN,yBAAA;IACnEI,KAAA,OAAAG,WAAA,CAAAD,OAAA,QAAAN,yBAAA;IACAI,KAAA,CAAKI,YAAY,GAAGL,WAAW;IAAC,OAAAC,KAAA;EACpC;EAAC,IAAAK,UAAA,CAAAH,OAAA,EAAAN,yBAAA,EAAAE,OAAA;EAAA,WAAAQ,aAAA,CAAAJ,OAAA,EAAAN,yBAAA;IAAAW,GAAA;IAAAC,KAAA,EAED,SAAOT,WAAWA,CAACU,IAAO,EAAE;MACxB,IAAI,OAAO,IAAI,CAACL,YAAY,KAAK,UAAU,EAAE;QACzC,MAAMM,KAAK,iHAEX,CAAC;MACL;MAEA,OAAO,IAAI,CAACN,YAAY,CAACK,IAAI,CAAC;IAClC;EAAC;AAAA,EAjBKE,eAAM;AAAA,IAAAC,gBAAA,CAAAV,OAAA,EAFHN,yBAAyB,UAGa,qBAAqB","ignoreList":[]}
1
+ {"version":3,"names":["Plugin","ApolloCacheObjectIdPlugin","type","constructor","getObjectId","_getObjectId","data","Error"],"sources":["ApolloCacheObjectIdPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\n\nexport interface ApolloCacheObject {\n __typename?: string;\n [key: string]: any;\n}\n\ninterface ApolloCacheObjectIdPluginCallable<T> {\n // A value for `id`, null to prevent normalization, or undefined to continue with defaults.\n (data: T): string | null | undefined;\n}\n\nexport class ApolloCacheObjectIdPlugin<\n T extends ApolloCacheObject = ApolloCacheObject\n> extends Plugin {\n public static override readonly type: string = \"cache-get-object-id\";\n private readonly _getObjectId?: ApolloCacheObjectIdPluginCallable<T>;\n\n public constructor(getObjectId?: ApolloCacheObjectIdPluginCallable<T>) {\n super();\n this._getObjectId = getObjectId;\n }\n\n public getObjectId(data: T) {\n if (typeof this._getObjectId !== \"function\") {\n throw Error(\n `You must provide a \"getObjectId\" callable to the plugin constructor or extend the ApolloCacheObjectIdPlugin.`\n );\n }\n\n return this._getObjectId(data);\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAYxC,OAAO,MAAMC,yBAAyB,SAE5BD,MAAM,CAAC;EACb,OAAgCE,IAAI,GAAW,qBAAqB;EAG7DC,WAAWA,CAACC,WAAkD,EAAE;IACnE,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,YAAY,GAAGD,WAAW;EACnC;EAEOA,WAAWA,CAACE,IAAO,EAAE;IACxB,IAAI,OAAO,IAAI,CAACD,YAAY,KAAK,UAAU,EAAE;MACzC,MAAME,KAAK,CACP,8GACJ,CAAC;IACL;IAEA,OAAO,IAAI,CAACF,YAAY,CAACC,IAAI,CAAC;EAClC;AACJ","ignoreList":[]}
@@ -1,5 +1,6 @@
1
- import { ApolloLink, NextLink } from "apollo-link";
2
- import { Operation } from "apollo-link/lib/types";
1
+ import type { NextLink } from "apollo-link";
2
+ import { ApolloLink } from "apollo-link";
3
+ import type { Operation } from "apollo-link/lib/types.js";
3
4
  export declare class ApolloDynamicLink extends ApolloLink {
4
5
  private cache;
5
6
  request(operation: Operation, forward: NextLink): any;
@@ -1,58 +1,31 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.ApolloDynamicLink = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
- var _apolloLink = require("apollo-link");
14
- var _plugins = require("@webiny/plugins");
1
+ import { ApolloLink } from "apollo-link";
2
+ import { plugins } from "@webiny/plugins";
15
3
  function createLink(plugin) {
16
4
  try {
17
5
  return plugin.createLink();
18
6
  } catch (e) {
19
- console.error("Caught an error while executing \"createLink\" on plugin", plugin);
7
+ console.error(`Caught an error while executing "createLink" on plugin`, plugin);
20
8
  console.error(e);
21
9
  }
22
10
  return null;
23
11
  }
24
- var ApolloDynamicLink = exports.ApolloDynamicLink = /*#__PURE__*/function (_ApolloLink) {
25
- function ApolloDynamicLink() {
26
- var _this;
27
- (0, _classCallCheck2.default)(this, ApolloDynamicLink);
28
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29
- args[_key] = arguments[_key];
12
+ export class ApolloDynamicLink extends ApolloLink {
13
+ cache = new Map();
14
+ request(operation, forward) {
15
+ const linkPlugins = plugins.byType("apollo-link");
16
+ if (!linkPlugins.length) {
17
+ return forward(operation);
30
18
  }
31
- _this = (0, _callSuper2.default)(this, ApolloDynamicLink, [].concat(args));
32
- (0, _defineProperty2.default)(_this, "cache", new Map());
33
- return _this;
34
- }
35
- (0, _inherits2.default)(ApolloDynamicLink, _ApolloLink);
36
- return (0, _createClass2.default)(ApolloDynamicLink, [{
37
- key: "request",
38
- value: function request(operation, forward) {
39
- var linkPlugins = _plugins.plugins.byType("apollo-link");
40
- if (!linkPlugins.length) {
41
- return forward(operation);
42
- }
43
- var cacheKey = linkPlugins.map(function (pl) {
44
- return pl.cacheKey;
45
- }).join(",");
46
- if (!this.cache.has(cacheKey)) {
47
- /**
48
- * We filter out falsy items from the linkPlugins because there might be some error while creating link.
49
- */
50
- var links = linkPlugins.map(createLink).filter(Boolean);
51
- this.cache.set(cacheKey, _apolloLink.ApolloLink.from(links));
52
- }
53
- return this.cache.get(cacheKey).request(operation, forward);
19
+ const cacheKey = linkPlugins.map(pl => pl.cacheKey).join(",");
20
+ if (!this.cache.has(cacheKey)) {
21
+ /**
22
+ * We filter out falsy items from the linkPlugins because there might be some error while creating link.
23
+ */
24
+ const links = linkPlugins.map(createLink).filter(Boolean);
25
+ this.cache.set(cacheKey, ApolloLink.from(links));
54
26
  }
55
- }]);
56
- }(_apolloLink.ApolloLink);
27
+ return this.cache.get(cacheKey).request(operation, forward);
28
+ }
29
+ }
57
30
 
58
31
  //# sourceMappingURL=ApolloDynamicLink.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_apolloLink","require","_plugins","createLink","plugin","e","console","error","ApolloDynamicLink","exports","_ApolloLink","_this","_classCallCheck2","default","_len","arguments","length","args","Array","_key","_callSuper2","concat","_defineProperty2","Map","_inherits2","_createClass2","key","value","request","operation","forward","linkPlugins","plugins","byType","cacheKey","map","pl","join","cache","has","links","filter","Boolean","set","ApolloLink","from","get"],"sources":["ApolloDynamicLink.ts"],"sourcesContent":["import { ApolloLink, NextLink } from \"apollo-link\";\nimport { plugins } from \"@webiny/plugins\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport { Operation } from \"apollo-link/lib/types\";\n\nfunction createLink(plugin: ApolloLinkPlugin) {\n try {\n return plugin.createLink();\n } catch (e) {\n console.error(`Caught an error while executing \"createLink\" on plugin`, plugin);\n console.error(e);\n }\n return null;\n}\n\nexport class ApolloDynamicLink extends ApolloLink {\n private cache = new Map();\n\n public override request(operation: Operation, forward: NextLink) {\n const linkPlugins = plugins.byType<ApolloLinkPlugin>(\"apollo-link\");\n\n if (!linkPlugins.length) {\n return forward(operation);\n }\n\n const cacheKey = linkPlugins.map(pl => pl.cacheKey).join(\",\");\n\n if (!this.cache.has(cacheKey)) {\n /**\n * We filter out falsy items from the linkPlugins because there might be some error while creating link.\n */\n const links = linkPlugins.map(createLink).filter(Boolean) as ApolloLink[];\n this.cache.set(cacheKey, ApolloLink.from(links));\n }\n\n return this.cache.get(cacheKey).request(operation, forward);\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAIA,SAASE,UAAUA,CAACC,MAAwB,EAAE;EAC1C,IAAI;IACA,OAAOA,MAAM,CAACD,UAAU,CAAC,CAAC;EAC9B,CAAC,CAAC,OAAOE,CAAC,EAAE;IACRC,OAAO,CAACC,KAAK,6DAA2DH,M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ACI,GAAG,CAAChC,UAAU,CAAC,CAACsC,MAAM,CAACC,OAAO,CAAiB;QACzE,IAAI,CAACJ,KAAK,CAACK,GAAG,CAACT,QAAQ,EAAEU,sBAAU,CAACC,IAAI,CAACL,KAAK,CAAC,CAAC;MACpD;MAEA,OAAO,IAAI,CAACF,KAAK,CAACQ,GAAG,CAACZ,QAAQ,CAAC,CAACN,OAAO,CAACC,SAAS,EAAEC,OAAO,CAAC;IAC/D;EAAC;AAAA,EArBkCc,sBAAU","ignoreList":[]}
1
+ {"version":3,"names":["ApolloLink","plugins","createLink","plugin","e","console","error","ApolloDynamicLink","cache","Map","request","operation","forward","linkPlugins","byType","length","cacheKey","map","pl","join","has","links","filter","Boolean","set","from","get"],"sources":["ApolloDynamicLink.ts"],"sourcesContent":["import type { NextLink } from \"apollo-link\";\nimport { ApolloLink } from \"apollo-link\";\nimport { plugins } from \"@webiny/plugins\";\nimport type { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport type { Operation } from \"apollo-link/lib/types.js\";\n\nfunction createLink(plugin: ApolloLinkPlugin) {\n try {\n return plugin.createLink();\n } catch (e) {\n console.error(`Caught an error while executing \"createLink\" on plugin`, plugin);\n console.error(e);\n }\n return null;\n}\n\nexport class ApolloDynamicLink extends ApolloLink {\n private cache = new Map();\n\n public override request(operation: Operation, forward: NextLink) {\n const linkPlugins = plugins.byType<ApolloLinkPlugin>(\"apollo-link\");\n\n if (!linkPlugins.length) {\n return forward(operation);\n }\n\n const cacheKey = linkPlugins.map(pl => pl.cacheKey).join(\",\");\n\n if (!this.cache.has(cacheKey)) {\n /**\n * We filter out falsy items from the linkPlugins because there might be some error while creating link.\n */\n const links = linkPlugins.map(createLink).filter(Boolean) as ApolloLink[];\n this.cache.set(cacheKey, ApolloLink.from(links));\n }\n\n return this.cache.get(cacheKey).request(operation, forward);\n }\n}\n"],"mappings":"AACA,SAASA,UAAU,QAAQ,aAAa;AACxC,SAASC,OAAO,QAAQ,iBAAiB;AAIzC,SAASC,UAAUA,CAACC,MAAwB,EAAE;EAC1C,IAAI;IACA,OAAOA,MAAM,CAACD,UAAU,CAAC,CAAC;EAC9B,CAAC,CAAC,OAAOE,CAAC,EAAE;IACRC,OAAO,CAACC,KAAK,CAAC,wDAAwD,EAAEH,MAAM,CAAC;IAC/EE,OAAO,CAACC,KAAK,CAACF,CAAC,CAAC;EACpB;EACA,OAAO,IAAI;AACf;AAEA,OAAO,MAAMG,iBAAiB,SAASP,UAAU,CAAC;EACtCQ,KAAK,GAAG,IAAIC,GAAG,CAAC,CAAC;EAETC,OAAOA,CAACC,SAAoB,EAAEC,OAAiB,EAAE;IAC7D,MAAMC,WAAW,GAAGZ,OAAO,CAACa,MAAM,CAAmB,aAAa,CAAC;IAEnE,IAAI,CAACD,WAAW,CAACE,MAAM,EAAE;MACrB,OAAOH,OAAO,CAACD,SAAS,CAAC;IAC7B;IAEA,MAAMK,QAAQ,GAAGH,WAAW,CAACI,GAAG,CAACC,EAAE,IAAIA,EAAE,CAACF,QAAQ,CAAC,CAACG,IAAI,CAAC,GAAG,CAAC;IAE7D,IAAI,CAAC,IAAI,CAACX,KAAK,CAACY,GAAG,CAACJ,QAAQ,CAAC,EAAE;MAC3B;AACZ;AACA;MACY,MAAMK,KAAK,GAAGR,WAAW,CAACI,GAAG,CAACf,UAAU,CAAC,CAACoB,MAAM,CAACC,OAAO,CAAiB;MACzE,IAAI,CAACf,KAAK,CAACgB,GAAG,CAACR,QAAQ,EAAEhB,UAAU,CAACyB,IAAI,CAACJ,KAAK,CAAC,CAAC;IACpD;IAEA,OAAO,IAAI,CAACb,KAAK,CAACkB,GAAG,CAACV,QAAQ,CAAC,CAACN,OAAO,CAACC,SAAS,EAAEC,OAAO,CAAC;EAC/D;AACJ","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ApolloLink } from "apollo-link";
1
+ import type { ApolloLink } from "apollo-link";
2
2
  import { Plugin } from "@webiny/plugins";
3
3
  export interface ApolloLinkFactory {
4
4
  (): ApolloLink;
@@ -1,41 +1,22 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.ApolloLinkPlugin = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
- var _nanoid = require("nanoid");
14
- var _plugins = require("@webiny/plugins");
15
- var ApolloLinkPlugin = exports.ApolloLinkPlugin = /*#__PURE__*/function (_Plugin) {
16
- function ApolloLinkPlugin(factory) {
17
- var _this;
18
- (0, _classCallCheck2.default)(this, ApolloLinkPlugin);
19
- _this = (0, _callSuper2.default)(this, ApolloLinkPlugin);
20
- _this.factory = factory;
21
- _this.cacheKey = (0, _nanoid.nanoid)();
22
- return _this;
1
+ import { nanoid } from "nanoid";
2
+ import { Plugin } from "@webiny/plugins";
3
+ export class ApolloLinkPlugin extends Plugin {
4
+ static type = "apollo-link";
5
+ constructor(factory) {
6
+ super();
7
+ this.factory = factory;
8
+ this.cacheKey = nanoid();
23
9
  }
24
- (0, _inherits2.default)(ApolloLinkPlugin, _Plugin);
25
- return (0, _createClass2.default)(ApolloLinkPlugin, [{
26
- key: "createLink",
27
- value: function createLink() {
28
- if (this.cache) {
29
- return this.cache;
30
- }
31
- if (typeof this.factory === "function") {
32
- this.cache = this.factory();
33
- return this.cache;
34
- }
35
- throw Error("Missing ApolloLinkFactory in plugin \"".concat(this.name, "\"! Either pass a factory to ApolloLinkPlugin constructor or extend the class and override the \"createLink\" method."));
10
+ createLink() {
11
+ if (this.cache) {
12
+ return this.cache;
13
+ }
14
+ if (typeof this.factory === "function") {
15
+ this.cache = this.factory();
16
+ return this.cache;
36
17
  }
37
- }]);
38
- }(_plugins.Plugin);
39
- (0, _defineProperty2.default)(ApolloLinkPlugin, "type", "apollo-link");
18
+ throw Error(`Missing ApolloLinkFactory in plugin "${this.name}"! Either pass a factory to ApolloLinkPlugin constructor or extend the class and override the "createLink" method.`);
19
+ }
20
+ }
40
21
 
41
22
  //# sourceMappingURL=ApolloLinkPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_nanoid","require","_plugins","ApolloLinkPlugin","exports","_Plugin","factory","_this","_classCallCheck2","default","_callSuper2","cacheKey","nanoid","_inherits2","_createClass2","key","value","createLink","cache","Error","concat","name","Plugin","_defineProperty2"],"sources":["ApolloLinkPlugin.ts"],"sourcesContent":["import { ApolloLink } from \"apollo-link\";\nimport { nanoid } from \"nanoid\";\nimport { Plugin } from \"@webiny/plugins\";\n\nexport interface ApolloLinkFactory {\n (): ApolloLink;\n}\n\nexport class ApolloLinkPlugin extends Plugin {\n public static override readonly type: string = \"apollo-link\";\n public readonly cacheKey;\n private readonly factory?: ApolloLinkFactory;\n private cache?: ApolloLink;\n\n constructor(factory?: ApolloLinkFactory) {\n super();\n this.factory = factory;\n this.cacheKey = nanoid();\n }\n\n public createLink(): ApolloLink {\n if (this.cache) {\n return this.cache;\n }\n\n if (typeof this.factory === \"function\") {\n this.cache = this.factory();\n\n return this.cache;\n }\n\n throw Error(\n `Missing ApolloLinkFactory in plugin \"${this.name}\"! Either pass a factory to ApolloLinkPlugin constructor or extend the class and override the \"createLink\" method.`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAAyC,IAM5BE,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,0BAAAE,OAAA;EAMzB,SAAAF,iBAAYG,OAA2B,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,QAAAN,gBAAA;IACrCI,KAAA,OAAAG,WAAA,CAAAD,OAAA,QAAAN,gBAAA;IACAI,KAAA,CAAKD,OAAO,GAAGA,OAAO;IACtBC,KAAA,CAAKI,QAAQ,GAAG,IAAAC,cAAM,EAAC,CAAC;IAAC,OAAAL,KAAA;EAC7B;EAAC,IAAAM,UAAA,CAAAJ,OAAA,EAAAN,gBAAA,EAAAE,OAAA;EAAA,WAAAS,aAAA,CAAAL,OAAA,EAAAN,gBAAA;IAAAY,GAAA;IAAAC,KAAA,EAED,SAAOC,UAAUA,CAAA,EAAe;MAC5B,IAAI,IAAI,CAACC,KAAK,EAAE;QACZ,OAAO,IAAI,CAACA,KAAK;MACrB;MAEA,IAAI,OAAO,IAAI,CAACZ,OAAO,KAAK,UAAU,EAAE;QACpC,IAAI,CAACY,KAAK,GAAG,IAAI,CAACZ,OAAO,CAAC,CAAC;QAE3B,OAAO,IAAI,CAACY,KAAK;MACrB;MAEA,MAAMC,KAAK,0CAAAC,MAAA,CACiC,IAAI,CAACC,IAAI,0HACrD,CAAC;IACL;EAAC;AAAA,EA1BiCC,eAAM;AAAA,IAAAC,gBAAA,CAAAd,OAAA,EAA/BN,gBAAgB,UACsB,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["nanoid","Plugin","ApolloLinkPlugin","type","constructor","factory","cacheKey","createLink","cache","Error","name"],"sources":["ApolloLinkPlugin.ts"],"sourcesContent":["import type { ApolloLink } from \"apollo-link\";\nimport { nanoid } from \"nanoid\";\nimport { Plugin } from \"@webiny/plugins\";\n\nexport interface ApolloLinkFactory {\n (): ApolloLink;\n}\n\nexport class ApolloLinkPlugin extends Plugin {\n public static override readonly type: string = \"apollo-link\";\n public readonly cacheKey;\n private readonly factory?: ApolloLinkFactory;\n private cache?: ApolloLink;\n\n constructor(factory?: ApolloLinkFactory) {\n super();\n this.factory = factory;\n this.cacheKey = nanoid();\n }\n\n public createLink(): ApolloLink {\n if (this.cache) {\n return this.cache;\n }\n\n if (typeof this.factory === \"function\") {\n this.cache = this.factory();\n\n return this.cache;\n }\n\n throw Error(\n `Missing ApolloLinkFactory in plugin \"${this.name}\"! Either pass a factory to ApolloLinkPlugin constructor or extend the class and override the \"createLink\" method.`\n );\n }\n}\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,SAASC,MAAM,QAAQ,iBAAiB;AAMxC,OAAO,MAAMC,gBAAgB,SAASD,MAAM,CAAC;EACzC,OAAgCE,IAAI,GAAW,aAAa;EAK5DC,WAAWA,CAACC,OAA2B,EAAE;IACrC,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,QAAQ,GAAGN,MAAM,CAAC,CAAC;EAC5B;EAEOO,UAAUA,CAAA,EAAe;IAC5B,IAAI,IAAI,CAACC,KAAK,EAAE;MACZ,OAAO,IAAI,CAACA,KAAK;IACrB;IAEA,IAAI,OAAO,IAAI,CAACH,OAAO,KAAK,UAAU,EAAE;MACpC,IAAI,CAACG,KAAK,GAAG,IAAI,CAACH,OAAO,CAAC,CAAC;MAE3B,OAAO,IAAI,CAACG,KAAK;IACrB;IAEA,MAAMC,KAAK,CACP,wCAAwC,IAAI,CAACC,IAAI,oHACrD,CAAC;EACL;AACJ","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { ApolloLink } from "apollo-link";
2
- import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
2
+ import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
3
3
  /**
4
4
  * This link checks for presence of `extensions.console` in the response and logs all items to browser console.
5
5
  */