@webiny/app 0.0.0-unstable.79032b23a5 → 0.0.0-unstable.7be00a75a9

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 (423) hide show
  1. package/App.d.ts +14 -18
  2. package/App.js +79 -102
  3. package/App.js.map +1 -1
  4. package/AppContainer.d.ts +23 -0
  5. package/AppContainer.js +6 -0
  6. package/AppContainer.js.map +1 -0
  7. package/README.md +7 -15
  8. package/apollo-client/InMemoryCache.d.ts +3 -2
  9. package/apollo-client/InMemoryCache.js +17 -55
  10. package/apollo-client/InMemoryCache.js.map +1 -1
  11. package/apollo-client/IntrospectionFragmentMatcher.d.ts +11 -0
  12. package/apollo-client/IntrospectionFragmentMatcher.js +33 -0
  13. package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -0
  14. package/components/Image.d.ts +2 -3
  15. package/components/Image.js +16 -29
  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/config/RouterConfig/Route.d.ts +29 -0
  20. package/config/RouterConfig/Route.js +28 -0
  21. package/config/RouterConfig/Route.js.map +1 -0
  22. package/config/RouterConfig.d.ts +31 -0
  23. package/config/RouterConfig.js +19 -0
  24. package/config/RouterConfig.js.map +1 -0
  25. package/config.d.ts +1 -1
  26. package/config.js +21 -27
  27. package/config.js.map +1 -1
  28. package/contexts/Ui/index.d.ts +4 -4
  29. package/contexts/Ui/index.js +28 -57
  30. package/contexts/Ui/index.js.map +1 -1
  31. package/core/Plugin.d.ts +3 -3
  32. package/core/Plugin.js +11 -20
  33. package/core/Plugin.js.map +1 -1
  34. package/core/Plugins.d.ts +6 -3
  35. package/core/Plugins.js +19 -43
  36. package/core/Plugins.js.map +1 -1
  37. package/core/Provider.d.ts +3 -4
  38. package/core/Provider.js +9 -20
  39. package/core/Provider.js.map +1 -1
  40. package/core/createProvider.d.ts +7 -3
  41. package/core/createProvider.js +5 -12
  42. package/core/createProvider.js.map +1 -1
  43. package/core/createProviderPlugin.d.ts +2 -2
  44. package/core/createProviderPlugin.js +11 -20
  45. package/core/createProviderPlugin.js.map +1 -1
  46. package/errors/AuthenticationErrorEvent.d.ts +9 -0
  47. package/errors/AuthenticationErrorEvent.js +13 -0
  48. package/errors/AuthenticationErrorEvent.js.map +1 -0
  49. package/errors/NetworkErrorEvent.d.ts +15 -0
  50. package/errors/NetworkErrorEvent.js +13 -0
  51. package/errors/NetworkErrorEvent.js.map +1 -0
  52. package/errors/abstractions.d.ts +12 -0
  53. package/errors/abstractions.js +6 -0
  54. package/errors/abstractions.js.map +1 -0
  55. package/errors/index.d.ts +6 -0
  56. package/errors/index.js +3 -0
  57. package/exports/admin/env-config.d.ts +2 -0
  58. package/exports/admin/env-config.js +2 -0
  59. package/exports/admin/graphql-client.d.ts +1 -0
  60. package/exports/admin/graphql-client.js +1 -0
  61. package/exports/admin/local-storage.d.ts +2 -0
  62. package/exports/admin/local-storage.js +2 -0
  63. package/exports/admin/router.d.ts +5 -0
  64. package/exports/admin/router.js +5 -0
  65. package/exports/admin/security.d.ts +1 -0
  66. package/exports/admin/security.js +1 -0
  67. package/exports/admin.d.ts +7 -0
  68. package/exports/admin.js +7 -0
  69. package/features/envConfig/EnvConfig.d.ts +7 -0
  70. package/features/envConfig/EnvConfig.js +16 -0
  71. package/features/envConfig/EnvConfig.js.map +1 -0
  72. package/features/envConfig/abstractions.d.ts +28 -0
  73. package/features/envConfig/abstractions.js +5 -0
  74. package/features/envConfig/abstractions.js.map +1 -0
  75. package/features/envConfig/feature.d.ts +17 -0
  76. package/features/envConfig/feature.js +15 -0
  77. package/features/envConfig/feature.js.map +1 -0
  78. package/features/envConfig/index.d.ts +1 -0
  79. package/features/envConfig/index.js +1 -0
  80. package/features/eventPublisher/EventPublisher.d.ts +8 -0
  81. package/features/eventPublisher/EventPublisher.js +19 -0
  82. package/features/eventPublisher/EventPublisher.js.map +1 -0
  83. package/features/eventPublisher/abstractions.d.ts +18 -0
  84. package/features/eventPublisher/abstractions.js +12 -0
  85. package/features/eventPublisher/abstractions.js.map +1 -0
  86. package/features/eventPublisher/feature.d.ts +3 -0
  87. package/features/eventPublisher/feature.js +17 -0
  88. package/features/eventPublisher/feature.js.map +1 -0
  89. package/features/eventPublisher/index.d.ts +3 -0
  90. package/features/eventPublisher/index.js +2 -0
  91. package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
  92. package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
  93. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
  94. package/features/graphqlClient/BatchingGraphQLClient.d.ts +16 -0
  95. package/features/graphqlClient/BatchingGraphQLClient.js +118 -0
  96. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
  97. package/features/graphqlClient/FetchGraphQLClient.d.ts +7 -0
  98. package/features/graphqlClient/FetchGraphQLClient.js +51 -0
  99. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
  100. package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
  101. package/features/graphqlClient/NetworkErrorPublishing.js +48 -0
  102. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
  103. package/features/graphqlClient/RequestValue.d.ts +21 -0
  104. package/features/graphqlClient/RequestValue.js +46 -0
  105. package/features/graphqlClient/RequestValue.js.map +1 -0
  106. package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
  107. package/features/graphqlClient/RetryGraphQLClient.js +45 -0
  108. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
  109. package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
  110. package/features/graphqlClient/__tests__/GraphQLClient.test.js +397 -0
  111. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
  112. package/features/graphqlClient/abstractions.d.ts +18 -0
  113. package/features/graphqlClient/abstractions.js +5 -0
  114. package/features/graphqlClient/abstractions.js.map +1 -0
  115. package/features/graphqlClient/feature.d.ts +6 -0
  116. package/features/graphqlClient/feature.js +25 -0
  117. package/features/graphqlClient/feature.js.map +1 -0
  118. package/features/graphqlClient/index.d.ts +1 -0
  119. package/features/graphqlClient/index.js +1 -0
  120. package/features/graphqlClient/types.d.ts +5 -0
  121. package/features/graphqlClient/types.js +0 -0
  122. package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
  123. package/features/localStorage/BrowserLocalStorageGateway.js +61 -0
  124. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
  125. package/features/localStorage/LocalStorage.d.ts +12 -0
  126. package/features/localStorage/LocalStorage.js +34 -0
  127. package/features/localStorage/LocalStorage.js.map +1 -0
  128. package/features/localStorage/LocalStorageRepository.d.ts +20 -0
  129. package/features/localStorage/LocalStorageRepository.js +82 -0
  130. package/features/localStorage/LocalStorageRepository.js.map +1 -0
  131. package/features/localStorage/abstractions.d.ts +48 -0
  132. package/features/localStorage/abstractions.js +8 -0
  133. package/features/localStorage/abstractions.js.map +1 -0
  134. package/features/localStorage/feature.d.ts +12 -0
  135. package/features/localStorage/feature.js +23 -0
  136. package/features/localStorage/feature.js.map +1 -0
  137. package/features/localStorage/index.d.ts +1 -0
  138. package/features/localStorage/index.js +1 -0
  139. package/features/mainGraphQLClient/MainGraphQLClient.d.ts +11 -0
  140. package/features/mainGraphQLClient/MainGraphQLClient.js +27 -0
  141. package/features/mainGraphQLClient/MainGraphQLClient.js.map +1 -0
  142. package/features/mainGraphQLClient/abstractions.d.ts +17 -0
  143. package/features/mainGraphQLClient/abstractions.js +5 -0
  144. package/features/mainGraphQLClient/abstractions.js.map +1 -0
  145. package/features/mainGraphQLClient/feature.d.ts +3 -0
  146. package/features/mainGraphQLClient/feature.js +17 -0
  147. package/features/mainGraphQLClient/feature.js.map +1 -0
  148. package/features/mainGraphQLClient/index.d.ts +1 -0
  149. package/features/mainGraphQLClient/index.js +1 -0
  150. package/features/router/HistoryRouterGateway.d.ts +22 -0
  151. package/features/router/HistoryRouterGateway.js +88 -0
  152. package/features/router/HistoryRouterGateway.js.map +1 -0
  153. package/features/router/HistoryRouterGateway.test.d.ts +1 -0
  154. package/features/router/HistoryRouterGateway.test.js +195 -0
  155. package/features/router/HistoryRouterGateway.test.js.map +1 -0
  156. package/features/router/Route.d.ts +19 -0
  157. package/features/router/Route.js +43 -0
  158. package/features/router/Route.js.map +1 -0
  159. package/features/router/RouteUrl.d.ts +85 -0
  160. package/features/router/RouteUrl.js +99 -0
  161. package/features/router/RouteUrl.js.map +1 -0
  162. package/features/router/Router.d.ts +45 -0
  163. package/features/router/Router.js +72 -0
  164. package/features/router/Router.js.map +1 -0
  165. package/features/router/RouterPresenter.d.ts +21 -0
  166. package/features/router/RouterPresenter.js +52 -0
  167. package/features/router/RouterPresenter.js.map +1 -0
  168. package/features/router/RouterRepository.d.ts +30 -0
  169. package/features/router/RouterRepository.js +117 -0
  170. package/features/router/RouterRepository.js.map +1 -0
  171. package/features/router/RouterRepository.test.d.ts +1 -0
  172. package/features/router/RouterRepository.test.js +138 -0
  173. package/features/router/RouterRepository.test.js.map +1 -0
  174. package/features/router/abstractions.d.ts +81 -0
  175. package/features/router/abstractions.js +7 -0
  176. package/features/router/abstractions.js.map +1 -0
  177. package/features/router/feature.d.ts +4 -0
  178. package/features/router/feature.js +19 -0
  179. package/features/router/feature.js.map +1 -0
  180. package/features/router/index.d.ts +2 -0
  181. package/features/router/index.js +1 -0
  182. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  183. package/helpers/InterfaceGenerator/date.js +0 -0
  184. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  185. package/helpers/InterfaceGenerator/id.js +0 -0
  186. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  187. package/helpers/InterfaceGenerator/identity.js +0 -0
  188. package/helpers/InterfaceGenerator/index.d.ts +5 -0
  189. package/helpers/InterfaceGenerator/index.js +0 -0
  190. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  191. package/helpers/InterfaceGenerator/numeric.js +0 -0
  192. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  193. package/helpers/InterfaceGenerator/truthful.js +0 -0
  194. package/hooks/useAutocomplete/index.d.ts +1 -1
  195. package/hooks/useAutocomplete/index.js +1 -12
  196. package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
  197. package/hooks/useAutocomplete/useAutocomplete.js +16 -28
  198. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  199. package/hooks/useDataList/functions/getData.js +4 -11
  200. package/hooks/useDataList/functions/getData.js.map +1 -1
  201. package/hooks/useDataList/functions/getError.js +4 -11
  202. package/hooks/useDataList/functions/getError.js.map +1 -1
  203. package/hooks/useDataList/functions/getMeta.js +4 -11
  204. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  205. package/hooks/useDataList/functions/index.d.ts +3 -3
  206. package/hooks/useDataList/functions/index.js +3 -27
  207. package/hooks/useDataList/functions/searchDataByKey.js +11 -21
  208. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
  209. package/hooks/useDataList/index.d.ts +1 -1
  210. package/hooks/useDataList/index.js +1 -12
  211. package/hooks/useDataList/useDataList.d.ts +2 -3
  212. package/hooks/useDataList/useDataList.js +140 -180
  213. package/hooks/useDataList/useDataList.js.map +1 -1
  214. package/hooks/useDataList/utils/index.d.ts +1 -2
  215. package/hooks/useDataList/utils/index.js +1 -20
  216. package/hooks/useDataList/utils/prepareLoadListParams.d.ts +1 -2
  217. package/hooks/useDataList/utils/prepareLoadListParams.js +27 -36
  218. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  219. package/hooks/useHandler.js +14 -17
  220. package/hooks/useHandler.js.map +1 -1
  221. package/hooks/useHandlers.d.ts +3 -3
  222. package/hooks/useHandlers.js +20 -26
  223. package/hooks/useHandlers.js.map +1 -1
  224. package/hooks/useRegisterLegacyPlugin.d.ts +2 -0
  225. package/hooks/useRegisterLegacyPlugin.js +12 -0
  226. package/hooks/useRegisterLegacyPlugin.js.map +1 -0
  227. package/hooks/useUi.d.ts +1 -1
  228. package/hooks/useUi.js +5 -11
  229. package/hooks/useUi.js.map +1 -1
  230. package/i18n/i18n.js +10 -13
  231. package/i18n/i18n.js.map +1 -1
  232. package/i18n/index.d.ts +1 -1
  233. package/i18n/index.js +1 -13
  234. package/index.d.ts +23 -13
  235. package/index.js +23 -147
  236. package/package.json +38 -41
  237. package/plugins/AddQuerySelectionPlugin.d.ts +2 -2
  238. package/plugins/AddQuerySelectionPlugin.js +41 -116
  239. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  240. package/plugins/ApolloCacheObjectIdPlugin.js +16 -37
  241. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  242. package/plugins/ApolloDynamicLink.d.ts +3 -2
  243. package/plugins/ApolloDynamicLink.js +25 -56
  244. package/plugins/ApolloDynamicLink.js.map +1 -1
  245. package/plugins/ApolloLinkPlugin.d.ts +1 -1
  246. package/plugins/ApolloLinkPlugin.js +22 -45
  247. package/plugins/ApolloLinkPlugin.js.map +1 -1
  248. package/plugins/ConsoleLinkPlugin.d.ts +1 -1
  249. package/plugins/ConsoleLinkPlugin.js +21 -45
  250. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  251. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
  252. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +48 -76
  253. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  254. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
  255. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +27 -0
  256. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
  257. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  258. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +23 -0
  259. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  260. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -7
  261. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -17
  262. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  263. package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
  264. package/plugins/NetworkErrorLinkPlugin/Typography.js +13 -0
  265. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
  266. package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js +19 -0
  267. package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js.map +1 -0
  268. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
  269. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +14 -30
  270. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  271. package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
  272. package/plugins/NetworkErrorLinkPlugin.js +52 -47
  273. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  274. package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
  275. package/plugins/OmitTypenameLinkPlugin.js +13 -38
  276. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  277. package/plugins/TenantHeaderLinkPlugin.d.ts +3 -3
  278. package/plugins/TenantHeaderLinkPlugin.js +27 -59
  279. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  280. package/plugins/components/Image.d.ts +6 -0
  281. package/plugins/components/Image.js +12 -0
  282. package/plugins/components/Image.js.map +1 -0
  283. package/plugins/image.d.ts +1 -1
  284. package/plugins/image.js +97 -142
  285. package/plugins/image.js.map +1 -1
  286. package/plugins/index.d.ts +5 -5
  287. package/plugins/index.js +39 -86
  288. package/plugins/index.js.map +1 -1
  289. package/presentation/envConfig/useEnvConfig.d.ts +6 -0
  290. package/presentation/envConfig/useEnvConfig.js +9 -0
  291. package/presentation/envConfig/useEnvConfig.js.map +1 -0
  292. package/presentation/localStorage/index.d.ts +3 -0
  293. package/presentation/localStorage/index.js +3 -0
  294. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  295. package/presentation/localStorage/useLocalStorage.js +15 -0
  296. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  297. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  298. package/presentation/localStorage/useLocalStorageValue.js +22 -0
  299. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  300. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  301. package/presentation/localStorage/useLocalStorageValues.js +32 -0
  302. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  303. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  304. package/presentation/router/RouteElementRegistry.js +29 -0
  305. package/presentation/router/RouteElementRegistry.js.map +1 -0
  306. package/presentation/router/abstractions.d.ts +13 -0
  307. package/presentation/router/abstractions.js +5 -0
  308. package/presentation/router/abstractions.js.map +1 -0
  309. package/presentation/router/components/Redirect.d.ts +14 -0
  310. package/presentation/router/components/Redirect.js +13 -0
  311. package/presentation/router/components/Redirect.js.map +1 -0
  312. package/presentation/router/components/RouteContent.d.ts +2 -0
  313. package/presentation/router/components/RouteContent.js +20 -0
  314. package/presentation/router/components/RouteContent.js.map +1 -0
  315. package/presentation/router/components/RouteLink.d.ts +50 -0
  316. package/presentation/router/components/RouteLink.js +17 -0
  317. package/presentation/router/components/RouteLink.js.map +1 -0
  318. package/presentation/router/components/SimpleLink.d.ts +44 -0
  319. package/presentation/router/components/SimpleLink.js +24 -0
  320. package/presentation/router/components/SimpleLink.js.map +1 -0
  321. package/presentation/router/hooks/useRoute.d.ts +6 -0
  322. package/presentation/router/hooks/useRoute.js +22 -0
  323. package/presentation/router/hooks/useRoute.js.map +1 -0
  324. package/presentation/router/hooks/useRouter.d.ts +11 -0
  325. package/presentation/router/hooks/useRouter.js +29 -0
  326. package/presentation/router/hooks/useRouter.js.map +1 -0
  327. package/presentation/router/index.d.ts +4 -0
  328. package/presentation/router/index.js +3 -0
  329. package/presentation/router/types.d.ts +5 -0
  330. package/presentation/router/types.js +0 -0
  331. package/renderApp.d.ts +2 -0
  332. package/renderApp.js +10 -0
  333. package/renderApp.js.map +1 -0
  334. package/router.d.ts +5 -0
  335. package/router.js +5 -0
  336. package/rslib-runtime.js +14 -0
  337. package/rslib-runtime.js.map +1 -0
  338. package/shared/di/DiContainerProvider.d.ts +8 -0
  339. package/shared/di/DiContainerProvider.js +13 -0
  340. package/shared/di/DiContainerProvider.js.map +1 -0
  341. package/shared/di/createFeature.d.ts +11 -0
  342. package/shared/di/createFeature.js +10 -0
  343. package/shared/di/createFeature.js.map +1 -0
  344. package/shared/di/useFeature.d.ts +2 -0
  345. package/shared/di/useFeature.js +12 -0
  346. package/shared/di/useFeature.js.map +1 -0
  347. package/static/svg/close_24px.33adaadc.svg +1 -0
  348. package/types.d.ts +16 -28
  349. package/types.js +0 -12
  350. package/utils/createGenericContext.d.ts +13 -0
  351. package/utils/createGenericContext.js +21 -0
  352. package/utils/createGenericContext.js.map +1 -0
  353. package/utils/createHashing.d.ts +2 -0
  354. package/utils/createHashing.js +15 -0
  355. package/utils/createHashing.js.map +1 -0
  356. package/utils/index.d.ts +2 -8
  357. package/utils/index.js +2 -93
  358. package/utils/legacyPluginToReactComponent.d.ts +7 -0
  359. package/utils/legacyPluginToReactComponent.js +15 -0
  360. package/utils/legacyPluginToReactComponent.js.map +1 -0
  361. package/components/Routes.d.ts +0 -2
  362. package/components/Routes.js +0 -45
  363. package/components/Routes.js.map +0 -1
  364. package/components/View.d.ts +0 -8
  365. package/components/View.js +0 -30
  366. package/components/View.js.map +0 -1
  367. package/components/index.js.map +0 -1
  368. package/core/AddRoute.d.ts +0 -3
  369. package/core/AddRoute.js +0 -19
  370. package/core/AddRoute.js.map +0 -1
  371. package/core/DebounceRender.d.ts +0 -11
  372. package/core/DebounceRender.js +0 -41
  373. package/core/DebounceRender.js.map +0 -1
  374. package/core/Routes.d.ts +0 -6
  375. package/core/Routes.js +0 -42
  376. package/core/Routes.js.map +0 -1
  377. package/hooks/useAutocomplete/index.js.map +0 -1
  378. package/hooks/useDataList/functions/index.js.map +0 -1
  379. package/hooks/useDataList/index.js.map +0 -1
  380. package/hooks/useDataList/utils/index.js.map +0 -1
  381. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  382. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -29
  383. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  384. package/hooks/useDataList/utils/types.d.ts +0 -34
  385. package/hooks/useDataList/utils/types.js +0 -5
  386. package/hooks/useDataList/utils/types.js.map +0 -1
  387. package/i18n/index.js.map +0 -1
  388. package/index.js.map +0 -1
  389. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
  390. package/plugins/LocaleHeaderLinkPlugin.js +0 -53
  391. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  392. package/plugins/RoutePlugin.d.ts +0 -12
  393. package/plugins/RoutePlugin.js +0 -38
  394. package/plugins/RoutePlugin.js.map +0 -1
  395. package/plugins/ViewPlugin.d.ts +0 -14
  396. package/plugins/ViewPlugin.js +0 -43
  397. package/plugins/ViewPlugin.js.map +0 -1
  398. package/types.js.map +0 -1
  399. package/utils/getApiUrl.d.ts +0 -1
  400. package/utils/getApiUrl.js +0 -11
  401. package/utils/getApiUrl.js.map +0 -1
  402. package/utils/getGqlApiUrl.d.ts +0 -1
  403. package/utils/getGqlApiUrl.js +0 -11
  404. package/utils/getGqlApiUrl.js.map +0 -1
  405. package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
  406. package/utils/getHeadlessCmsGqlApiUrl.js +0 -17
  407. package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
  408. package/utils/getLocaleCode.d.ts +0 -6
  409. package/utils/getLocaleCode.js +0 -42
  410. package/utils/getLocaleCode.js.map +0 -1
  411. package/utils/getPrerenderId.d.ts +0 -6
  412. package/utils/getPrerenderId.js +0 -10
  413. package/utils/getPrerenderId.js.map +0 -1
  414. package/utils/getTenantId.d.ts +0 -6
  415. package/utils/getTenantId.js +0 -34
  416. package/utils/getTenantId.js.map +0 -1
  417. package/utils/index.js.map +0 -1
  418. package/utils/isLocalhost.d.ts +0 -1
  419. package/utils/isLocalhost.js +0 -14
  420. package/utils/isLocalhost.js.map +0 -1
  421. package/utils/isPrerendering.d.ts +0 -1
  422. package/utils/isPrerendering.js +0 -10
  423. package/utils/isPrerendering.js.map +0 -1
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@webiny/app",
3
- "version": "0.0.0-unstable.79032b23a5",
4
- "main": "index.js",
3
+ "version": "0.0.0-unstable.7be00a75a9",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": "./index.js",
7
+ "./*": "./*"
8
+ },
5
9
  "repository": {
6
10
  "type": "git",
7
11
  "url": "https://github.com/webiny/webiny-js.git"
@@ -15,16 +19,16 @@
15
19
  "license": "MIT",
16
20
  "dependencies": {
17
21
  "@apollo/react-hooks": "3.1.5",
18
- "@babel/runtime": "7.20.13",
19
- "@emotion/styled": "11.10.6",
20
- "@types/react": "17.0.39",
21
- "@types/web": "0.0.61",
22
- "@webiny/i18n": "0.0.0-unstable.79032b23a5",
23
- "@webiny/i18n-react": "0.0.0-unstable.79032b23a5",
24
- "@webiny/plugins": "0.0.0-unstable.79032b23a5",
25
- "@webiny/react-composition": "0.0.0-unstable.79032b23a5",
26
- "@webiny/react-router": "0.0.0-unstable.79032b23a5",
27
- "@webiny/ui": "0.0.0-unstable.79032b23a5",
22
+ "@emotion/styled": "11.14.1",
23
+ "@types/react": "18.3.29",
24
+ "@webiny/di": "0.0.0-unstable.7be00a75a9",
25
+ "@webiny/feature": "0.0.0-unstable.7be00a75a9",
26
+ "@webiny/i18n": "0.0.0-unstable.7be00a75a9",
27
+ "@webiny/i18n-react": "0.0.0-unstable.7be00a75a9",
28
+ "@webiny/plugins": "0.0.0-unstable.7be00a75a9",
29
+ "@webiny/react-composition": "0.0.0-unstable.7be00a75a9",
30
+ "@webiny/react-properties": "0.0.0-unstable.7be00a75a9",
31
+ "@webiny/stdlib": "0.0.0-unstable.7be00a75a9",
28
32
  "apollo-cache": "1.3.5",
29
33
  "apollo-cache-inmemory": "1.6.6",
30
34
  "apollo-client": "2.6.10",
@@ -33,46 +37,39 @@
33
37
  "apollo-link-error": "1.1.13",
34
38
  "apollo-link-http-common": "0.2.16",
35
39
  "apollo-utilities": "1.3.4",
36
- "boolean": "3.2.0",
37
- "graphql": "15.8.0",
40
+ "graphql": "16.14.0",
41
+ "history": "5.3.0",
38
42
  "invariant": "2.2.4",
39
- "lodash": "4.17.21",
40
- "lodash.debounce": "4.0.8",
41
- "nanoid": "3.3.4",
42
- "react": "17.0.2",
43
- "react-dom": "17.0.2",
44
- "warning": "4.0.3"
43
+ "lodash": "4.18.1",
44
+ "mobx": "6.15.3",
45
+ "nanoid": "5.1.11",
46
+ "react": "18.3.1",
47
+ "react-dom": "18.3.1",
48
+ "ts-invariant": "0.10.3",
49
+ "warning": "4.0.3",
50
+ "zod": "4.4.3"
45
51
  },
46
52
  "devDependencies": {
47
- "@babel/cli": "^7.19.3",
48
- "@babel/core": "^7.19.3",
49
- "@babel/plugin-proposal-class-properties": "^7.18.6",
50
- "@babel/preset-env": "^7.19.4",
51
- "@babel/preset-react": "^7.18.6",
52
- "@babel/preset-typescript": "^7.18.6",
53
- "@types/lodash.debounce": "^4.0.7",
54
- "@types/warning": "^3.0.0",
55
- "@webiny/cli": "^0.0.0-unstable.79032b23a5",
56
- "@webiny/project-utils": "^0.0.0-unstable.79032b23a5",
57
- "babel-plugin-lodash": "^3.3.4",
58
- "rimraf": "^3.0.2",
59
- "typescript": "4.7.4"
53
+ "@types/lodash": "4.17.24",
54
+ "@types/warning": "3.0.4",
55
+ "@webiny/build-tools": "0.0.0-unstable.7be00a75a9",
56
+ "rimraf": "6.1.3",
57
+ "type-fest": "5.6.0",
58
+ "typescript": "6.0.3",
59
+ "vitest": "4.1.7"
60
60
  },
61
61
  "publishConfig": {
62
- "access": "public",
63
- "directory": "dist"
64
- },
65
- "scripts": {
66
- "build": "yarn webiny run build",
67
- "watch": "yarn webiny run watch"
62
+ "access": "public"
68
63
  },
69
64
  "adio": {
70
65
  "ignore": {
71
66
  "dependencies": [
72
- "@types/web",
73
67
  "react-dom"
74
68
  ]
75
69
  }
76
70
  },
77
- "gitHead": "79032b23a5e5b580fb21be88e8cc66d0dce7afdc"
71
+ "gitHead": "8476da73b653c89cc1474d968baf55c1b0ae0e5f",
72
+ "webiny": {
73
+ "publishFrom": "dist"
74
+ }
78
75
  }
@@ -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,122 +1,47 @@
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 _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
13
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
- var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
15
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
- var _apolloLink = require("apollo-link");
17
- var _graphql = require("graphql");
18
- var _ApolloLinkPlugin2 = require("./ApolloLinkPlugin");
19
- var AddQuerySelectionPlugin = /*#__PURE__*/function (_ApolloLinkPlugin) {
20
- (0, _inherits2.default)(AddQuerySelectionPlugin, _ApolloLinkPlugin);
21
- var _super = (0, _createSuper2.default)(AddQuerySelectionPlugin);
22
- function AddQuerySelectionPlugin(config) {
23
- var _this;
24
- (0, _classCallCheck2.default)(this, AddQuerySelectionPlugin);
25
- _this = _super.call(this);
26
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "config", void 0);
27
- _this.config = config;
28
- return _this;
29
- }
30
- (0, _createClass2.default)(AddQuerySelectionPlugin, [{
31
- key: "createLink",
32
- value: function createLink() {
33
- var _this2 = this;
34
- return new _apolloLink.ApolloLink(function (operation, forward) {
35
- if (operation.operationName !== _this2.config.operationName) {
36
- return forward(operation);
37
- }
38
- _this2.addSelectionToQuery(operation.operationName, operation.query);
39
- return forward(operation);
40
- });
1
+ import { ApolloLink } from "apollo-link";
2
+ import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
3
+ class AddQuerySelectionPlugin extends ApolloLinkPlugin {
4
+ constructor(config){
5
+ super();
6
+ this.config = config;
41
7
  }
42
- }, {
43
- key: "addSelectionToQuery",
44
- value: function addSelectionToQuery(operationName, document) {
45
- var _tree;
46
- if (operationName !== this.config.operationName) {
47
- return;
48
- }
49
-
50
- // If this plugin already processed the given document (documents are always passed by reference),
51
- // then we don't want to apply the selection again, to avoid adding duplicate selections.
52
- if (this.isProcessed(document)) {
53
- return;
54
- }
55
- this.markProcessed(document);
56
- var _this$config = this.config,
57
- addSelection = _this$config.addSelection,
58
- selectionPath = _this$config.selectionPath;
59
- var firstQueryDefinition = document.definitions[0];
60
- if (!firstQueryDefinition) {
61
- return;
62
- } else if (!firstQueryDefinition.selectionSet) {
63
- return;
64
- }
65
- var tree = firstQueryDefinition.selectionSet.selections;
66
- var fields = selectionPath.split(".");
67
- var _iterator = (0, _createForOfIteratorHelper2.default)(fields),
68
- _step;
69
- try {
70
- fieldLoop: for (_iterator.s(); !(_step = _iterator.n()).done;) {
71
- var field = _step.value;
72
- var _iterator2 = (0, _createForOfIteratorHelper2.default)(tree),
73
- _step2;
74
- try {
75
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
76
- var selection = _step2.value;
77
- if (!selection.selectionSet) {
78
- continue;
79
- }
80
- if (selection.name.value === field) {
81
- tree = selection.selectionSet.selections;
82
- continue fieldLoop;
83
- }
8
+ createLink() {
9
+ return new ApolloLink((operation, forward)=>{
10
+ if (operation.operationName !== this.config.operationName) return forward(operation);
11
+ this.addSelectionToQuery(operation.operationName, operation.query);
12
+ return forward(operation);
13
+ });
14
+ }
15
+ addSelectionToQuery(operationName, document) {
16
+ if (operationName !== this.config.operationName) return;
17
+ if (this.isProcessed(document)) return;
18
+ this.markProcessed(document);
19
+ const { addSelection, selectionPath } = this.config;
20
+ const firstQueryDefinition = document.definitions[0];
21
+ if (!firstQueryDefinition) return;
22
+ if (!firstQueryDefinition.selectionSet) return;
23
+ let tree = firstQueryDefinition.selectionSet.selections;
24
+ const fields = selectionPath.split(".");
25
+ fieldLoop: for (const field of fields){
26
+ for (const selection of tree)if (selection.selectionSet) {
27
+ if (selection.name.value === field) {
28
+ tree = selection.selectionSet.selections;
29
+ continue fieldLoop;
30
+ }
84
31
  }
85
- // If we get here, it means we didn't find the necessary selection
86
- } catch (err) {
87
- _iterator2.e(err);
88
- } finally {
89
- _iterator2.f();
90
- }
91
- return;
32
+ return;
92
33
  }
93
- } catch (err) {
94
- _iterator.e(err);
95
- } finally {
96
- _iterator.f();
97
- }
98
- /**
99
- * We must cast because there are a lot of types that are not intertwined and TS is complaining
100
- */
101
- (_tree = tree).push.apply(_tree, (0, _toConsumableArray2.default)(addSelection.definitions[0].selectionSet.selections));
34
+ tree.push(...addSelection.definitions[0].selectionSet.selections);
102
35
  }
103
- }, {
104
- key: "isProcessed",
105
- value: function isProcessed(document) {
106
- if (!document.hasOwnProperty("__webiny__")) {
107
- document.__webiny__ = new Set();
108
- }
109
- return document.__webiny__.has(this.cacheKey);
36
+ isProcessed(document) {
37
+ if (!document.hasOwnProperty("__webiny__")) document.__webiny__ = new Set();
38
+ return document.__webiny__.has(this.cacheKey);
110
39
  }
111
- }, {
112
- key: "markProcessed",
113
- value: function markProcessed(document) {
114
- if (!document.hasOwnProperty("__webiny__")) {
115
- document.__webiny__ = new Set();
116
- }
117
- document.__webiny__.add(this.cacheKey);
40
+ markProcessed(document) {
41
+ if (!document.hasOwnProperty("__webiny__")) document.__webiny__ = new Set();
42
+ document.__webiny__.add(this.cacheKey);
118
43
  }
119
- }]);
120
- return AddQuerySelectionPlugin;
121
- }(_ApolloLinkPlugin2.ApolloLinkPlugin);
122
- exports.AddQuerySelectionPlugin = AddQuerySelectionPlugin;
44
+ }
45
+ export { AddQuerySelectionPlugin };
46
+
47
+ //# sourceMappingURL=AddQuerySelectionPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AddQuerySelectionPlugin","config","ApolloLink","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","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;AACA;AACA;AAAsD,IAezCA,uBAAuB;EAAA;EAAA;EAGhC,iCAAYC,MAAc,EAAE;IAAA;IAAA;IACxB;IAAQ;IACR,MAAKA,MAAM,GAAGA,MAAM;IAAC;EACzB;EAAC;IAAA;IAAA,OAED,sBAAyC;MAAA;MACrC,OAAO,IAAIC,sBAAU,CAAC,UAACC,SAAS,EAAEC,OAAO,EAAK;QAC1C,IAAID,SAAS,CAACE,aAAa,KAAK,MAAI,CAACJ,MAAM,CAACI,aAAa,EAAE;UACvD,OAAOD,OAAO,CAACD,SAAS,CAAC;QAC7B;QAEA,MAAI,CAACG,mBAAmB,CAACH,SAAS,CAACE,aAAa,EAAEF,SAAS,CAACI,KAAK,CAAC;QAElE,OAAOH,OAAO,CAACD,SAAS,CAAC;MAC7B,CAAC,CAAC;IACN;EAAC;IAAA;IAAA,OAED,6BAA2BE,aAAqB,EAAEG,QAAsB,EAAQ;MAAA;MAC5E,IAAIH,aAAa,KAAK,IAAI,CAACJ,MAAM,CAACI,aAAa,EAAE;QAC7C;MACJ;;MAEA;MACA;MACA,IAAI,IAAI,CAACI,WAAW,CAACD,QAAQ,CAAC,EAAE;QAC5B;MACJ;MAEA,IAAI,CAACE,aAAa,CAACF,QAAQ,CAAC;MAE5B,mBAAwC,IAAI,CAACP,MAAM;QAA3CU,YAAY,gBAAZA,YAAY;QAAEC,aAAa,gBAAbA,aAAa;MAEnC,IAAMC,oBAAoB,GAAGL,QAAQ,CAACM,WAAW,CAAC,CAAC,CAA6B;MAChF,IAAI,CAACD,oBAAoB,EAAE;QACvB;MACJ,CAAC,MAAM,IAAI,CAACA,oBAAoB,CAACE,YAAY,EAAE;QAC3C;MACJ;MAEA,IAAIC,IAAI,GAAGH,oBAAoB,CAACE,YAAY,CAACE,UAAyB;MACtE,IAAMC,MAAM,GAAGN,aAAa,CAACO,KAAK,CAAC,GAAG,CAAC;MAAC,yDAETD,MAAM;QAAA;MAAA;QAArCE,SAAS,EAAE,oDAA4B;UAAA,IAAjBC,KAAK;UAAA,0DACCL,IAAI;YAAA;UAAA;YAA5B,uDAA8B;cAAA,IAAnBM,SAAS;cAChB,IAAI,CAACA,SAAS,CAACP,YAAY,EAAE;gBACzB;cACJ;cACA,IAAIO,SAAS,CAACC,IAAI,CAACC,KAAK,KAAKH,KAAK,EAAE;gBAChCL,IAAI,GAAGM,SAAS,CAACP,YAAY,CAACE,UAAyB;gBACvD,SAASG,SAAS;cACtB;YACJ;YACA;UAAA;YAAA;UAAA;YAAA;UAAA;UACA;QACJ;MAAC;QAAA;MAAA;QAAA;MAAA;MACD;AACR;AACA;MACQ,SAAAJ,IAAI,EAACS,IAAI,+CACAd,YAAY,CAACG,WAAW,CAAC,CAAC,CAAC,CAA8BC,YAAY,CACrEE,UAAU,EAClB;IACL;EAAC;IAAA;IAAA,OAED,qBAAoBT,QAAsB,EAAE;MACxC,IAAI,CAACA,QAAQ,CAACkB,cAAc,CAAC,YAAY,CAAC,EAAE;QACxClB,QAAQ,CAACmB,UAAU,GAAG,IAAIC,GAAG,EAAE;MACnC;MAEA,OAAOpB,QAAQ,CAACmB,UAAU,CAACE,GAAG,CAAC,IAAI,CAACC,QAAQ,CAAC;IACjD;EAAC;IAAA;IAAA,OAED,uBAAsBtB,QAAsB,EAAE;MAC1C,IAAI,CAACA,QAAQ,CAACkB,cAAc,CAAC,YAAY,CAAC,EAAE;QACxClB,QAAQ,CAACmB,UAAU,GAAG,IAAIC,GAAG,EAAE;MACnC;MAEApB,QAAQ,CAACmB,UAAU,CAACI,GAAG,CAAC,IAAI,CAACD,QAAQ,CAAC;IAC1C;EAAC;EAAA;AAAA,EAjFwCE,mCAAgB;AAAA"}
1
+ {"version":3,"file":"plugins/AddQuerySelectionPlugin.js","sources":["../../src/plugins/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"],"names":["AddQuerySelectionPlugin","ApolloLinkPlugin","config","ApolloLink","operation","forward","operationName","document","addSelection","selectionPath","firstQueryDefinition","tree","fields","fieldLoop","field","selection","Set"],"mappings":";;AAiBO,MAAMA,gCAAgCC;IAGzC,YAAYC,MAAc,CAAE;QACxB,KAAK;QACL,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEgB,aAAyB;QACrC,OAAO,IAAIC,WAAW,CAACC,WAAWC;YAC9B,IAAID,UAAU,aAAa,KAAK,IAAI,CAAC,MAAM,CAAC,aAAa,EACrD,OAAOC,QAAQD;YAGnB,IAAI,CAAC,mBAAmB,CAACA,UAAU,aAAa,EAAEA,UAAU,KAAK;YAEjE,OAAOC,QAAQD;QACnB;IACJ;IAEO,oBAAoBE,aAAqB,EAAEC,QAAsB,EAAQ;QAC5E,IAAID,kBAAkB,IAAI,CAAC,MAAM,CAAC,aAAa,EAC3C;QAKJ,IAAI,IAAI,CAAC,WAAW,CAACC,WACjB;QAGJ,IAAI,CAAC,aAAa,CAACA;QAEnB,MAAM,EAAEC,YAAY,EAAEC,aAAa,EAAE,GAAG,IAAI,CAAC,MAAM;QAEnD,MAAMC,uBAAuBH,SAAS,WAAW,CAAC,EAAE;QACpD,IAAI,CAACG,sBACD;QACG,IAAI,CAACA,qBAAqB,YAAY,EACzC;QAGJ,IAAIC,OAAOD,qBAAqB,YAAY,CAAC,UAAU;QACvD,MAAME,SAASH,cAAc,KAAK,CAAC;QAEnCI,WAAW,KAAK,MAAMC,SAASF,OAAQ;YACnC,KAAK,MAAMG,aAAaJ,KACpB,IAAKI,UAAU,YAAY,EAG3B;gBAAA,IAAIA,UAAU,IAAI,CAAC,KAAK,KAAKD,OAAO;oBAChCH,OAAOI,UAAU,YAAY,CAAC,UAAU;oBACxC,SAASF;gBACb;YAAA;YAGJ;QACJ;QAIAF,KAAK,IAAI,IACAH,aAAa,WAAW,CAAC,EAAE,CAA8B,YAAY,CACrE,UAAU;IAEvB;IAEQ,YAAYD,QAAsB,EAAE;QACxC,IAAI,CAACA,SAAS,cAAc,CAAC,eACzBA,SAAS,UAAU,GAAG,IAAIS;QAG9B,OAAOT,SAAS,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ;IAChD;IAEQ,cAAcA,QAAsB,EAAE;QAC1C,IAAI,CAACA,SAAS,cAAc,CAAC,eACzBA,SAAS,UAAU,GAAG,IAAIS;QAG9BT,SAAS,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ;IACzC;AACJ"}
@@ -1,38 +1,17 @@
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 _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
13
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _plugins = require("@webiny/plugins");
15
- var ApolloCacheObjectIdPlugin = /*#__PURE__*/function (_Plugin) {
16
- (0, _inherits2.default)(ApolloCacheObjectIdPlugin, _Plugin);
17
- var _super = (0, _createSuper2.default)(ApolloCacheObjectIdPlugin);
18
- function ApolloCacheObjectIdPlugin(getObjectId) {
19
- var _this;
20
- (0, _classCallCheck2.default)(this, ApolloCacheObjectIdPlugin);
21
- _this = _super.call(this);
22
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_getObjectId", void 0);
23
- _this._getObjectId = getObjectId;
24
- return _this;
25
- }
26
- (0, _createClass2.default)(ApolloCacheObjectIdPlugin, [{
27
- key: "getObjectId",
28
- value: function getObjectId(data) {
29
- if (typeof this._getObjectId !== "function") {
30
- throw Error("You must provide a \"getObjectId\" callable to the plugin constructor or extend the ApolloCacheObjectIdPlugin.");
31
- }
32
- return this._getObjectId(data);
1
+ import { Plugin } from "@webiny/plugins";
2
+ class ApolloCacheObjectIdPlugin extends Plugin {
3
+ static{
4
+ this.type = "cache-get-object-id";
5
+ }
6
+ constructor(getObjectId){
7
+ super();
8
+ this._getObjectId = getObjectId;
33
9
  }
34
- }]);
35
- return ApolloCacheObjectIdPlugin;
36
- }(_plugins.Plugin);
37
- exports.ApolloCacheObjectIdPlugin = ApolloCacheObjectIdPlugin;
38
- (0, _defineProperty2.default)(ApolloCacheObjectIdPlugin, "type", "cache-get-object-id");
10
+ getObjectId(data) {
11
+ if ("function" != typeof this._getObjectId) throw Error('You must provide a "getObjectId" callable to the plugin constructor or extend the ApolloCacheObjectIdPlugin.');
12
+ return this._getObjectId(data);
13
+ }
14
+ }
15
+ export { ApolloCacheObjectIdPlugin };
16
+
17
+ //# sourceMappingURL=ApolloCacheObjectIdPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ApolloCacheObjectIdPlugin","getObjectId","_getObjectId","data","Error","Plugin"],"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;AAAyC,IAY5BA,yBAAyB;EAAA;EAAA;EAMlC,mCAAmBC,WAAkD,EAAE;IAAA;IAAA;IACnE;IAAQ;IACR,MAAKC,YAAY,GAAGD,WAAW;IAAC;EACpC;EAAC;IAAA;IAAA,OAED,qBAAmBE,IAAO,EAAE;MACxB,IAAI,OAAO,IAAI,CAACD,YAAY,KAAK,UAAU,EAAE;QACzC,MAAME,KAAK,kHAEV;MACL;MAEA,OAAO,IAAI,CAACF,YAAY,CAACC,IAAI,CAAC;IAClC;EAAC;EAAA;AAAA,EAjBKE,eAAM;AAAA;AAAA,8BAFHL,yBAAyB,UAGa,qBAAqB"}
1
+ {"version":3,"file":"plugins/ApolloCacheObjectIdPlugin.js","sources":["../../src/plugins/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"],"names":["ApolloCacheObjectIdPlugin","Plugin","getObjectId","data","Error"],"mappings":";AAYO,MAAMA,kCAEHC;;aAC0B,IAAI,GAAW;;IAG/C,YAAmBC,WAAkD,CAAE;QACnE,KAAK;QACL,IAAI,CAAC,YAAY,GAAGA;IACxB;IAEO,YAAYC,IAAO,EAAE;QACxB,IAAI,AAA6B,cAA7B,OAAO,IAAI,CAAC,YAAY,EACxB,MAAMC,MACF;QAIR,OAAO,IAAI,CAAC,YAAY,CAACD;IAC7B;AACJ"}
@@ -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,60 +1,29 @@
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 _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
13
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _apolloLink = require("apollo-link");
15
- var _plugins = require("@webiny/plugins");
1
+ import { ApolloLink } from "apollo-link";
2
+ import { plugins } from "@webiny/plugins";
16
3
  function createLink(plugin) {
17
- try {
18
- return plugin.createLink();
19
- } catch (e) {
20
- console.error("Caught an error while executing \"createLink\" on plugin", plugin);
21
- console.error(e);
22
- }
23
- return null;
4
+ try {
5
+ return plugin.createLink();
6
+ } catch (e) {
7
+ console.error('Caught an error while executing "createLink" on plugin', plugin);
8
+ console.error(e);
9
+ }
10
+ return null;
24
11
  }
25
- var ApolloDynamicLink = /*#__PURE__*/function (_ApolloLink) {
26
- (0, _inherits2.default)(ApolloDynamicLink, _ApolloLink);
27
- var _super = (0, _createSuper2.default)(ApolloDynamicLink);
28
- function ApolloDynamicLink() {
29
- var _this;
30
- (0, _classCallCheck2.default)(this, ApolloDynamicLink);
31
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
32
- args[_key] = arguments[_key];
12
+ class ApolloDynamicLink extends ApolloLink {
13
+ request(operation, forward) {
14
+ const linkPlugins = plugins.byType("apollo-link");
15
+ if (!linkPlugins.length) return forward(operation);
16
+ const cacheKey = linkPlugins.map((pl)=>pl.cacheKey).join(",");
17
+ if (!this.cache.has(cacheKey)) {
18
+ const links = linkPlugins.map(createLink).filter(Boolean);
19
+ this.cache.set(cacheKey, ApolloLink.from(links));
20
+ }
21
+ return this.cache.get(cacheKey).request(operation, forward);
33
22
  }
34
- _this = _super.call.apply(_super, [this].concat(args));
35
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "cache", new Map());
36
- return _this;
37
- }
38
- (0, _createClass2.default)(ApolloDynamicLink, [{
39
- key: "request",
40
- value: function request(operation, forward) {
41
- var linkPlugins = _plugins.plugins.byType("apollo-link");
42
- if (!linkPlugins.length) {
43
- return forward(operation);
44
- }
45
- var cacheKey = linkPlugins.map(function (pl) {
46
- return pl.cacheKey;
47
- }).join(",");
48
- if (!this.cache.has(cacheKey)) {
49
- /**
50
- * We filter out falsy items from the linkPlugins because there might be some error while creating link.
51
- */
52
- var links = linkPlugins.map(createLink).filter(Boolean);
53
- this.cache.set(cacheKey, _apolloLink.ApolloLink.from(links));
54
- }
55
- return this.cache.get(cacheKey).request(operation, forward);
23
+ constructor(...args){
24
+ super(...args), this.cache = new Map();
56
25
  }
57
- }]);
58
- return ApolloDynamicLink;
59
- }(_apolloLink.ApolloLink);
60
- exports.ApolloDynamicLink = ApolloDynamicLink;
26
+ }
27
+ export { ApolloDynamicLink };
28
+
29
+ //# sourceMappingURL=ApolloDynamicLink.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createLink","plugin","e","console","error","ApolloDynamicLink","Map","operation","forward","linkPlugins","plugins","byType","length","cacheKey","map","pl","join","cache","has","links","filter","Boolean","set","ApolloLink","from","get","request"],"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;AACA;AAIA,SAASA,UAAU,CAACC,MAAwB,EAAE;EAC1C,IAAI;IACA,OAAOA,MAAM,CAACD,UAAU,EAAE;EAC9B,CAAC,CAAC,OAAOE,CAAC,EAAE;IACRC,OAAO,CAACC,KAAK,6DAA2DH,MAAM,CAAC;IAC/EE,OAAO,CAACC,KAAK,CAACF,CAAC,CAAC;EACpB;EACA,OAAO,IAAI;AACf;AAAC,IAEYG,iBAAiB;EAAA;EAAA;EAAA;IAAA;IAAA;IAAA;MAAA;IAAA;IAAA;IAAA,oFACV,IAAIC,GAAG,EAAE;IAAA;EAAA;EAAA;IAAA;IAAA,OAEzB,iBAAwBC,SAAoB,EAAEC,OAAiB,EAAE;MAC7D,IAAMC,WAAW,GAAGC,gBAAO,CAACC,MAAM,CAAmB,aAAa,CAAC;MAEnE,IAAI,CAACF,WAAW,CAACG,MAAM,EAAE;QACrB,OAAOJ,OAAO,CAACD,SAAS,CAAC;MAC7B;MAEA,IAAMM,QAAQ,GAAGJ,WAAW,CAACK,GAAG,CAAC,UAAAC,EAAE;QAAA,OAAIA,EAAE,CAACF,QAAQ;MAAA,EAAC,CAACG,IAAI,CAAC,GAAG,CAAC;MAE7D,IAAI,CAAC,IAAI,CAACC,KAAK,CAACC,GAAG,CAACL,QAAQ,CAAC,EAAE;QAC3B;AACZ;AACA;QACY,IAAMM,KAAK,GAAGV,WAAW,CAACK,GAAG,CAACd,UAAU,CAAC,CAACoB,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,CAACa,OAAO,CAACnB,SAAS,EAAEC,OAAO,CAAC;IAC/D;EAAC;EAAA;AAAA,EArBkCe,sBAAU;AAAA"}
1
+ {"version":3,"file":"plugins/ApolloDynamicLink.js","sources":["../../src/plugins/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"],"names":["createLink","plugin","e","console","ApolloDynamicLink","ApolloLink","operation","forward","linkPlugins","plugins","cacheKey","pl","links","Boolean","Map"],"mappings":";;AAMA,SAASA,WAAWC,MAAwB;IACxC,IAAI;QACA,OAAOA,OAAO,UAAU;IAC5B,EAAE,OAAOC,GAAG;QACRC,QAAQ,KAAK,CAAC,0DAA0DF;QACxEE,QAAQ,KAAK,CAACD;IAClB;IACA,OAAO;AACX;AAEO,MAAME,0BAA0BC;IAGnB,QAAQC,SAAoB,EAAEC,OAAiB,EAAE;QAC7D,MAAMC,cAAcC,QAAQ,MAAM,CAAmB;QAErD,IAAI,CAACD,YAAY,MAAM,EACnB,OAAOD,QAAQD;QAGnB,MAAMI,WAAWF,YAAY,GAAG,CAACG,CAAAA,KAAMA,GAAG,QAAQ,EAAE,IAAI,CAAC;QAEzD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAACD,WAAW;YAI3B,MAAME,QAAQJ,YAAY,GAAG,CAACR,YAAY,MAAM,CAACa;YACjD,IAAI,CAAC,KAAK,CAAC,GAAG,CAACH,UAAUL,WAAW,IAAI,CAACO;QAC7C;QAEA,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAACF,UAAU,OAAO,CAACJ,WAAWC;IACvD;;QArBG,qBACK,KAAK,GAAG,IAAIO;;AAqBxB"}
@@ -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,46 +1,23 @@
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 _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
13
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
- var _nanoid = require("nanoid");
15
- var _plugins = require("@webiny/plugins");
16
- var ApolloLinkPlugin = /*#__PURE__*/function (_Plugin) {
17
- (0, _inherits2.default)(ApolloLinkPlugin, _Plugin);
18
- var _super = (0, _createSuper2.default)(ApolloLinkPlugin);
19
- function ApolloLinkPlugin(factory) {
20
- var _this;
21
- (0, _classCallCheck2.default)(this, ApolloLinkPlugin);
22
- _this = _super.call(this);
23
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "cacheKey", void 0);
24
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "factory", void 0);
25
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "cache", void 0);
26
- _this.factory = factory;
27
- _this.cacheKey = (0, _nanoid.nanoid)();
28
- return _this;
29
- }
30
- (0, _createClass2.default)(ApolloLinkPlugin, [{
31
- key: "createLink",
32
- value: function createLink() {
33
- if (this.cache) {
34
- return this.cache;
35
- }
36
- if (typeof this.factory === "function") {
37
- this.cache = this.factory();
38
- return this.cache;
39
- }
40
- 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."));
1
+ import { nanoid } from "nanoid";
2
+ import { Plugin } from "@webiny/plugins";
3
+ class ApolloLinkPlugin extends Plugin {
4
+ static{
5
+ this.type = "apollo-link";
6
+ }
7
+ constructor(factory){
8
+ super();
9
+ this.factory = factory;
10
+ this.cacheKey = nanoid();
41
11
  }
42
- }]);
43
- return ApolloLinkPlugin;
44
- }(_plugins.Plugin);
45
- exports.ApolloLinkPlugin = ApolloLinkPlugin;
46
- (0, _defineProperty2.default)(ApolloLinkPlugin, "type", "apollo-link");
12
+ createLink() {
13
+ if (this.cache) return this.cache;
14
+ if ("function" == typeof this.factory) {
15
+ this.cache = this.factory();
16
+ return this.cache;
17
+ }
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
+ }
21
+ export { ApolloLinkPlugin };
22
+
23
+ //# sourceMappingURL=ApolloLinkPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ApolloLinkPlugin","factory","cacheKey","nanoid","cache","Error","name","Plugin"],"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;AACA;AAAyC,IAM5BA,gBAAgB;EAAA;EAAA;EAMzB,0BAAYC,OAA2B,EAAE;IAAA;IAAA;IACrC;IAAQ;IAAA;IAAA;IACR,MAAKA,OAAO,GAAGA,OAAO;IACtB,MAAKC,QAAQ,GAAG,IAAAC,cAAM,GAAE;IAAC;EAC7B;EAAC;IAAA;IAAA,OAED,sBAAgC;MAC5B,IAAI,IAAI,CAACC,KAAK,EAAE;QACZ,OAAO,IAAI,CAACA,KAAK;MACrB;MAEA,IAAI,OAAO,IAAI,CAACH,OAAO,KAAK,UAAU,EAAE;QACpC,IAAI,CAACG,KAAK,GAAG,IAAI,CAACH,OAAO,EAAE;QAE3B,OAAO,IAAI,CAACG,KAAK;MACrB;MAEA,MAAMC,KAAK,iDACiC,IAAI,CAACC,IAAI,2HACpD;IACL;EAAC;EAAA;AAAA,EA1BiCC,eAAM;AAAA;AAAA,8BAA/BP,gBAAgB,UACsB,aAAa"}
1
+ {"version":3,"file":"plugins/ApolloLinkPlugin.js","sources":["../../src/plugins/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"],"names":["ApolloLinkPlugin","Plugin","factory","nanoid","Error"],"mappings":";;AAQO,MAAMA,yBAAyBC;;aACF,IAAI,GAAW;;IAK/C,YAAYC,OAA2B,CAAE;QACrC,KAAK;QACL,IAAI,CAAC,OAAO,GAAGA;QACf,IAAI,CAAC,QAAQ,GAAGC;IACpB;IAEO,aAAyB;QAC5B,IAAI,IAAI,CAAC,KAAK,EACV,OAAO,IAAI,CAAC,KAAK;QAGrB,IAAI,AAAwB,cAAxB,OAAO,IAAI,CAAC,OAAO,EAAiB;YACpC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO;YAEzB,OAAO,IAAI,CAAC,KAAK;QACrB;QAEA,MAAMC,MACF,CAAC,qCAAqC,EAAE,IAAI,CAAC,IAAI,CAAC,kHAAkH,CAAC;IAE7K;AACJ"}
@@ -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
  */