@webiny/app 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.eb81deee7e

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 (463) hide show
  1. package/App.d.ts +5 -6
  2. package/App.js +75 -88
  3. package/App.js.map +1 -1
  4. package/AppContainer.js +3 -6
  5. package/AppContainer.js.map +1 -1
  6. package/README.md +7 -15
  7. package/components/Image.d.ts +1 -2
  8. package/components/Image.js +12 -18
  9. package/components/Image.js.map +1 -1
  10. package/components/index.d.ts +1 -2
  11. package/components/index.js +1 -4
  12. package/config/RouterConfig/Route.d.ts +9 -10
  13. package/config/RouterConfig/Route.js +23 -37
  14. package/config/RouterConfig/Route.js.map +1 -1
  15. package/config/RouterConfig.d.ts +11 -14
  16. package/config/RouterConfig.js +12 -11
  17. package/config/RouterConfig.js.map +1 -1
  18. package/config.js +19 -20
  19. package/config.js.map +1 -1
  20. package/contexts/Ui/index.js +26 -28
  21. package/contexts/Ui/index.js.map +1 -1
  22. package/core/Plugin.d.ts +1 -1
  23. package/core/Plugin.js +9 -11
  24. package/core/Plugin.js.map +1 -1
  25. package/core/Plugins.d.ts +4 -3
  26. package/core/Plugins.js +18 -36
  27. package/core/Plugins.js.map +1 -1
  28. package/core/Provider.d.ts +1 -1
  29. package/core/Provider.js +6 -14
  30. package/core/Provider.js.map +1 -1
  31. package/core/createProvider.js +3 -6
  32. package/core/createProvider.js.map +1 -1
  33. package/core/createProviderPlugin.js +9 -14
  34. package/core/createProviderPlugin.js.map +1 -1
  35. package/errors/AuthenticationErrorEvent.d.ts +9 -0
  36. package/errors/AuthenticationErrorEvent.js +13 -0
  37. package/errors/AuthenticationErrorEvent.js.map +1 -0
  38. package/errors/NetworkErrorEvent.d.ts +15 -0
  39. package/errors/NetworkErrorEvent.js +13 -0
  40. package/errors/NetworkErrorEvent.js.map +1 -0
  41. package/errors/abstractions.d.ts +12 -0
  42. package/errors/abstractions.js +6 -0
  43. package/errors/abstractions.js.map +1 -0
  44. package/errors/index.d.ts +6 -0
  45. package/errors/index.js +3 -0
  46. package/errors/overlay/ErrorOverlay.d.ts +9 -0
  47. package/errors/overlay/ErrorOverlay.js +43 -0
  48. package/errors/overlay/ErrorOverlay.js.map +1 -0
  49. package/{plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts → errors/overlay/GqlErrorOverlay.d.ts} +2 -2
  50. package/errors/overlay/GqlErrorOverlay.js +27 -0
  51. package/errors/overlay/GqlErrorOverlay.js.map +1 -0
  52. package/errors/overlay/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  53. package/errors/overlay/LocalAwsLambdaTimeoutMessage.js +20 -0
  54. package/errors/overlay/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  55. package/errors/overlay/StyledComponents.d.ts +7 -0
  56. package/errors/overlay/StyledComponents.js +10 -0
  57. package/errors/overlay/StyledComponents.js.map +1 -0
  58. package/errors/overlay/Typography.d.ts +8 -0
  59. package/errors/overlay/Typography.js +13 -0
  60. package/errors/overlay/Typography.js.map +1 -0
  61. package/errors/overlay/assets/close_24px.js +19 -0
  62. package/errors/overlay/assets/close_24px.js.map +1 -0
  63. package/errors/overlay/createErrorOverlay.d.ts +7 -0
  64. package/errors/overlay/createErrorOverlay.js +15 -0
  65. package/errors/overlay/createErrorOverlay.js.map +1 -0
  66. package/exports/admin/env-config.d.ts +2 -0
  67. package/exports/admin/env-config.js +2 -0
  68. package/exports/admin/graphql-client.d.ts +1 -0
  69. package/exports/admin/graphql-client.js +1 -0
  70. package/exports/admin/local-storage.d.ts +2 -0
  71. package/exports/admin/local-storage.js +2 -0
  72. package/exports/admin/router.d.ts +5 -0
  73. package/exports/admin/router.js +5 -0
  74. package/exports/admin/security.d.ts +1 -0
  75. package/exports/admin/security.js +1 -0
  76. package/exports/admin.d.ts +8 -0
  77. package/exports/admin.js +8 -0
  78. package/features/apiStreamClient/FetchApiStreamClient.d.ts +9 -0
  79. package/features/apiStreamClient/FetchApiStreamClient.js +63 -0
  80. package/features/apiStreamClient/FetchApiStreamClient.js.map +1 -0
  81. package/features/apiStreamClient/__tests__/FetchApiStreamClient.test.d.ts +1 -0
  82. package/features/apiStreamClient/__tests__/FetchApiStreamClient.test.js +170 -0
  83. package/features/apiStreamClient/__tests__/FetchApiStreamClient.test.js.map +1 -0
  84. package/features/apiStreamClient/__tests__/readServerSentEvents.test.d.ts +1 -0
  85. package/features/apiStreamClient/__tests__/readServerSentEvents.test.js +160 -0
  86. package/features/apiStreamClient/__tests__/readServerSentEvents.test.js.map +1 -0
  87. package/features/apiStreamClient/abstractions.d.ts +44 -0
  88. package/features/apiStreamClient/abstractions.js +10 -0
  89. package/features/apiStreamClient/abstractions.js.map +1 -0
  90. package/features/apiStreamClient/feature.d.ts +3 -0
  91. package/features/apiStreamClient/feature.js +17 -0
  92. package/features/apiStreamClient/feature.js.map +1 -0
  93. package/features/apiStreamClient/index.d.ts +5 -0
  94. package/features/apiStreamClient/index.js +5 -0
  95. package/features/apiStreamClient/readServerSentEvents.d.ts +10 -0
  96. package/features/apiStreamClient/readServerSentEvents.js +29 -0
  97. package/features/apiStreamClient/readServerSentEvents.js.map +1 -0
  98. package/features/apiStreamClient/toPayloadHash.d.ts +14 -0
  99. package/features/apiStreamClient/toPayloadHash.js +7 -0
  100. package/features/apiStreamClient/toPayloadHash.js.map +1 -0
  101. package/features/envConfig/EnvConfig.d.ts +7 -0
  102. package/features/envConfig/EnvConfig.js +16 -0
  103. package/features/envConfig/EnvConfig.js.map +1 -0
  104. package/features/envConfig/abstractions.d.ts +28 -0
  105. package/features/envConfig/abstractions.js +5 -0
  106. package/features/envConfig/abstractions.js.map +1 -0
  107. package/features/envConfig/feature.d.ts +17 -0
  108. package/features/envConfig/feature.js +15 -0
  109. package/features/envConfig/feature.js.map +1 -0
  110. package/features/envConfig/index.d.ts +1 -0
  111. package/features/envConfig/index.js +1 -0
  112. package/features/eventPublisher/EventPublisher.d.ts +8 -0
  113. package/features/eventPublisher/EventPublisher.js +19 -0
  114. package/features/eventPublisher/EventPublisher.js.map +1 -0
  115. package/features/eventPublisher/abstractions.d.ts +18 -0
  116. package/features/eventPublisher/abstractions.js +12 -0
  117. package/features/eventPublisher/abstractions.js.map +1 -0
  118. package/features/eventPublisher/feature.d.ts +3 -0
  119. package/features/eventPublisher/feature.js +17 -0
  120. package/features/eventPublisher/feature.js.map +1 -0
  121. package/features/eventPublisher/index.d.ts +3 -0
  122. package/features/eventPublisher/index.js +2 -0
  123. package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
  124. package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
  125. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
  126. package/features/graphqlClient/BatchingGraphQLClient.d.ts +16 -0
  127. package/features/graphqlClient/BatchingGraphQLClient.js +118 -0
  128. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
  129. package/features/graphqlClient/FetchGraphQLClient.d.ts +7 -0
  130. package/features/graphqlClient/FetchGraphQLClient.js +51 -0
  131. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
  132. package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
  133. package/features/graphqlClient/NetworkErrorPublishing.js +48 -0
  134. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
  135. package/features/graphqlClient/RequestValue.d.ts +21 -0
  136. package/features/graphqlClient/RequestValue.js +46 -0
  137. package/features/graphqlClient/RequestValue.js.map +1 -0
  138. package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
  139. package/features/graphqlClient/RetryGraphQLClient.js +45 -0
  140. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
  141. package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
  142. package/features/graphqlClient/__tests__/GraphQLClient.test.js +471 -0
  143. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
  144. package/features/graphqlClient/abstractions.d.ts +18 -0
  145. package/features/graphqlClient/abstractions.js +5 -0
  146. package/features/graphqlClient/abstractions.js.map +1 -0
  147. package/features/graphqlClient/feature.d.ts +6 -0
  148. package/features/graphqlClient/feature.js +25 -0
  149. package/features/graphqlClient/feature.js.map +1 -0
  150. package/features/graphqlClient/index.d.ts +1 -0
  151. package/features/graphqlClient/index.js +1 -0
  152. package/features/graphqlClient/types.d.ts +5 -0
  153. package/features/graphqlClient/types.js +0 -0
  154. package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
  155. package/features/localStorage/BrowserLocalStorageGateway.js +61 -0
  156. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
  157. package/features/localStorage/LocalStorage.d.ts +12 -0
  158. package/features/localStorage/LocalStorage.js +34 -0
  159. package/features/localStorage/LocalStorage.js.map +1 -0
  160. package/features/localStorage/LocalStorageRepository.d.ts +20 -0
  161. package/features/localStorage/LocalStorageRepository.js +82 -0
  162. package/features/localStorage/LocalStorageRepository.js.map +1 -0
  163. package/features/localStorage/abstractions.d.ts +48 -0
  164. package/features/localStorage/abstractions.js +8 -0
  165. package/features/localStorage/abstractions.js.map +1 -0
  166. package/features/localStorage/feature.d.ts +12 -0
  167. package/features/localStorage/feature.js +23 -0
  168. package/features/localStorage/feature.js.map +1 -0
  169. package/features/localStorage/index.d.ts +1 -0
  170. package/features/localStorage/index.js +1 -0
  171. package/features/mainGraphQLClient/MainGraphQLClient.d.ts +11 -0
  172. package/features/mainGraphQLClient/MainGraphQLClient.js +27 -0
  173. package/features/mainGraphQLClient/MainGraphQLClient.js.map +1 -0
  174. package/features/mainGraphQLClient/abstractions.d.ts +17 -0
  175. package/features/mainGraphQLClient/abstractions.js +5 -0
  176. package/features/mainGraphQLClient/abstractions.js.map +1 -0
  177. package/features/mainGraphQLClient/feature.d.ts +3 -0
  178. package/features/mainGraphQLClient/feature.js +17 -0
  179. package/features/mainGraphQLClient/feature.js.map +1 -0
  180. package/features/mainGraphQLClient/index.d.ts +1 -0
  181. package/features/mainGraphQLClient/index.js +1 -0
  182. package/features/router/HistoryRouterGateway.d.ts +25 -0
  183. package/features/router/HistoryRouterGateway.js +100 -0
  184. package/features/router/HistoryRouterGateway.js.map +1 -0
  185. package/features/router/HistoryRouterGateway.test.d.ts +1 -0
  186. package/features/router/HistoryRouterGateway.test.js +195 -0
  187. package/features/router/HistoryRouterGateway.test.js.map +1 -0
  188. package/features/router/Route.d.ts +19 -0
  189. package/features/router/Route.js +43 -0
  190. package/features/router/Route.js.map +1 -0
  191. package/features/router/RouteUrl.d.ts +85 -0
  192. package/features/router/RouteUrl.js +99 -0
  193. package/features/router/RouteUrl.js.map +1 -0
  194. package/features/router/Router.d.ts +45 -0
  195. package/features/router/Router.js +72 -0
  196. package/features/router/Router.js.map +1 -0
  197. package/features/router/RouterPresenter.d.ts +23 -0
  198. package/features/router/RouterPresenter.js +62 -0
  199. package/features/router/RouterPresenter.js.map +1 -0
  200. package/features/router/RouterRepository.d.ts +32 -0
  201. package/features/router/RouterRepository.js +123 -0
  202. package/features/router/RouterRepository.js.map +1 -0
  203. package/features/router/RouterRepository.test.d.ts +1 -0
  204. package/features/router/RouterRepository.test.js +138 -0
  205. package/features/router/RouterRepository.test.js.map +1 -0
  206. package/features/router/abstractions.d.ts +90 -0
  207. package/features/router/abstractions.js +7 -0
  208. package/features/router/abstractions.js.map +1 -0
  209. package/features/router/feature.d.ts +4 -0
  210. package/features/router/feature.js +19 -0
  211. package/features/router/feature.js.map +1 -0
  212. package/features/router/index.d.ts +2 -0
  213. package/features/router/index.js +1 -0
  214. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  215. package/helpers/InterfaceGenerator/date.js +0 -0
  216. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  217. package/helpers/InterfaceGenerator/id.js +0 -0
  218. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  219. package/helpers/InterfaceGenerator/identity.js +0 -0
  220. package/helpers/InterfaceGenerator/index.d.ts +5 -0
  221. package/helpers/InterfaceGenerator/index.js +0 -0
  222. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  223. package/helpers/InterfaceGenerator/numeric.js +0 -0
  224. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  225. package/helpers/InterfaceGenerator/truthful.js +0 -0
  226. package/hooks/useHandler.js +12 -16
  227. package/hooks/useHandler.js.map +1 -1
  228. package/hooks/useHandlers.js +18 -20
  229. package/hooks/useHandlers.js.map +1 -1
  230. package/hooks/useRegisterLegacyPlugin.d.ts +1 -1
  231. package/hooks/useRegisterLegacyPlugin.js +7 -6
  232. package/hooks/useRegisterLegacyPlugin.js.map +1 -1
  233. package/hooks/useUi.d.ts +1 -1
  234. package/hooks/useUi.js +3 -4
  235. package/hooks/useUi.js.map +1 -1
  236. package/i18n/i18n.js +8 -4
  237. package/i18n/i18n.js.map +1 -1
  238. package/i18n/index.d.ts +1 -1
  239. package/i18n/index.js +1 -3
  240. package/index.d.ts +20 -15
  241. package/index.js +19 -19
  242. package/package.json +34 -42
  243. package/plugins/components/Image.d.ts +6 -0
  244. package/plugins/components/Image.js +12 -0
  245. package/plugins/components/Image.js.map +1 -0
  246. package/plugins/image.d.ts +2 -2
  247. package/plugins/image.js +95 -134
  248. package/plugins/image.js.map +1 -1
  249. package/plugins/index.d.ts +3 -3
  250. package/plugins/index.js +35 -59
  251. package/plugins/index.js.map +1 -1
  252. package/presentation/envConfig/useEnvConfig.d.ts +6 -0
  253. package/presentation/envConfig/useEnvConfig.js +9 -0
  254. package/presentation/envConfig/useEnvConfig.js.map +1 -0
  255. package/presentation/localStorage/index.d.ts +3 -0
  256. package/presentation/localStorage/index.js +3 -0
  257. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  258. package/presentation/localStorage/useLocalStorage.js +15 -0
  259. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  260. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  261. package/presentation/localStorage/useLocalStorageValue.js +22 -0
  262. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  263. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  264. package/presentation/localStorage/useLocalStorageValues.js +32 -0
  265. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  266. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  267. package/presentation/router/RouteElementRegistry.js +29 -0
  268. package/presentation/router/RouteElementRegistry.js.map +1 -0
  269. package/presentation/router/abstractions.d.ts +13 -0
  270. package/presentation/router/abstractions.js +5 -0
  271. package/presentation/router/abstractions.js.map +1 -0
  272. package/presentation/router/components/Redirect.d.ts +14 -0
  273. package/presentation/router/components/Redirect.js +13 -0
  274. package/presentation/router/components/Redirect.js.map +1 -0
  275. package/presentation/router/components/RouteContent.d.ts +2 -0
  276. package/presentation/router/components/RouteContent.js +20 -0
  277. package/presentation/router/components/RouteContent.js.map +1 -0
  278. package/presentation/router/components/RouteLink.d.ts +50 -0
  279. package/presentation/router/components/RouteLink.js +17 -0
  280. package/presentation/router/components/RouteLink.js.map +1 -0
  281. package/presentation/router/components/RouteParamsSync.d.ts +22 -0
  282. package/presentation/router/components/RouteParamsSync.js +53 -0
  283. package/presentation/router/components/RouteParamsSync.js.map +1 -0
  284. package/presentation/router/components/SimpleLink.d.ts +44 -0
  285. package/presentation/router/components/SimpleLink.js +24 -0
  286. package/presentation/router/components/SimpleLink.js.map +1 -0
  287. package/presentation/router/hooks/useRoute.d.ts +7 -0
  288. package/presentation/router/hooks/useRoute.js +23 -0
  289. package/presentation/router/hooks/useRoute.js.map +1 -0
  290. package/presentation/router/hooks/useRouter.d.ts +12 -0
  291. package/presentation/router/hooks/useRouter.js +30 -0
  292. package/presentation/router/hooks/useRouter.js.map +1 -0
  293. package/presentation/router/index.d.ts +6 -0
  294. package/presentation/router/index.js +4 -0
  295. package/presentation/router/types.d.ts +5 -0
  296. package/presentation/router/types.js +0 -0
  297. package/renderApp.d.ts +1 -1
  298. package/renderApp.js +7 -6
  299. package/renderApp.js.map +1 -1
  300. package/router.d.ts +5 -0
  301. package/router.js +5 -0
  302. package/rslib-runtime.js +14 -0
  303. package/rslib-runtime.js.map +1 -0
  304. package/shared/di/DiContainerProvider.d.ts +8 -0
  305. package/shared/di/DiContainerProvider.js +13 -0
  306. package/shared/di/DiContainerProvider.js.map +1 -0
  307. package/shared/di/createFeature.d.ts +11 -0
  308. package/shared/di/createFeature.js +10 -0
  309. package/shared/di/createFeature.js.map +1 -0
  310. package/shared/di/useFeature.d.ts +2 -0
  311. package/shared/di/useFeature.js +12 -0
  312. package/shared/di/useFeature.js.map +1 -0
  313. package/static/svg/close_24px.33adaadc.svg +1 -0
  314. package/types.d.ts +6 -24
  315. package/types.js +0 -14
  316. package/utils/createGenericContext.js +17 -21
  317. package/utils/createGenericContext.js.map +1 -1
  318. package/utils/createHashing.js +13 -16
  319. package/utils/createHashing.js.map +1 -1
  320. package/utils/index.d.ts +2 -10
  321. package/utils/index.js +2 -12
  322. package/utils/legacyPluginToReactComponent.js +12 -11
  323. package/utils/legacyPluginToReactComponent.js.map +1 -1
  324. package/apollo-client/InMemoryCache.d.ts +0 -8
  325. package/apollo-client/InMemoryCache.js +0 -20
  326. package/apollo-client/InMemoryCache.js.map +0 -1
  327. package/apollo-client/IntrospectionFragmentMatcher.d.ts +0 -11
  328. package/apollo-client/IntrospectionFragmentMatcher.js +0 -45
  329. package/apollo-client/IntrospectionFragmentMatcher.js.map +0 -1
  330. package/components/Routes.d.ts +0 -2
  331. package/components/Routes.js +0 -36
  332. package/components/Routes.js.map +0 -1
  333. package/components/View.d.ts +0 -8
  334. package/components/View.js +0 -19
  335. package/components/View.js.map +0 -1
  336. package/components/index.js.map +0 -1
  337. package/core/DebounceRender.d.ts +0 -12
  338. package/core/DebounceRender.js +0 -31
  339. package/core/DebounceRender.js.map +0 -1
  340. package/core/Routes.d.ts +0 -6
  341. package/core/Routes.js +0 -34
  342. package/core/Routes.js.map +0 -1
  343. package/hooks/useAutocomplete/index.d.ts +0 -1
  344. package/hooks/useAutocomplete/index.js +0 -3
  345. package/hooks/useAutocomplete/index.js.map +0 -1
  346. package/hooks/useAutocomplete/useAutocomplete.d.ts +0 -11
  347. package/hooks/useAutocomplete/useAutocomplete.js +0 -23
  348. package/hooks/useAutocomplete/useAutocomplete.js.map +0 -1
  349. package/hooks/useDataList/functions/getData.d.ts +0 -2
  350. package/hooks/useDataList/functions/getData.js +0 -4
  351. package/hooks/useDataList/functions/getData.js.map +0 -1
  352. package/hooks/useDataList/functions/getError.d.ts +0 -2
  353. package/hooks/useDataList/functions/getError.js +0 -4
  354. package/hooks/useDataList/functions/getError.js.map +0 -1
  355. package/hooks/useDataList/functions/getMeta.d.ts +0 -2
  356. package/hooks/useDataList/functions/getMeta.js +0 -4
  357. package/hooks/useDataList/functions/getMeta.js.map +0 -1
  358. package/hooks/useDataList/functions/index.d.ts +0 -3
  359. package/hooks/useDataList/functions/index.js +0 -5
  360. package/hooks/useDataList/functions/index.js.map +0 -1
  361. package/hooks/useDataList/functions/searchDataByKey.d.ts +0 -2
  362. package/hooks/useDataList/functions/searchDataByKey.js +0 -18
  363. package/hooks/useDataList/functions/searchDataByKey.js.map +0 -1
  364. package/hooks/useDataList/index.d.ts +0 -1
  365. package/hooks/useDataList/index.js +0 -3
  366. package/hooks/useDataList/index.js.map +0 -1
  367. package/hooks/useDataList/useDataList.d.ts +0 -36
  368. package/hooks/useDataList/useDataList.js +0 -183
  369. package/hooks/useDataList/useDataList.js.map +0 -1
  370. package/hooks/useDataList/utils/index.d.ts +0 -2
  371. package/hooks/useDataList/utils/index.js +0 -4
  372. package/hooks/useDataList/utils/index.js.map +0 -1
  373. package/hooks/useDataList/utils/prepareLoadListParams.d.ts +0 -10
  374. package/hooks/useDataList/utils/prepareLoadListParams.js +0 -38
  375. package/hooks/useDataList/utils/prepareLoadListParams.js.map +0 -1
  376. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  377. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -26
  378. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  379. package/hooks/useDataList/utils/types.d.ts +0 -40
  380. package/hooks/useDataList/utils/types.js +0 -3
  381. package/hooks/useDataList/utils/types.js.map +0 -1
  382. package/i18n/index.js.map +0 -1
  383. package/index.js.map +0 -1
  384. package/plugins/AddQuerySelectionPlugin.d.ts +0 -22
  385. package/plugins/AddQuerySelectionPlugin.js +0 -72
  386. package/plugins/AddQuerySelectionPlugin.js.map +0 -1
  387. package/plugins/ApolloCacheObjectIdPlugin.d.ts +0 -15
  388. package/plugins/ApolloCacheObjectIdPlugin.js +0 -16
  389. package/plugins/ApolloCacheObjectIdPlugin.js.map +0 -1
  390. package/plugins/ApolloDynamicLink.d.ts +0 -7
  391. package/plugins/ApolloDynamicLink.js +0 -31
  392. package/plugins/ApolloDynamicLink.js.map +0 -1
  393. package/plugins/ApolloLinkPlugin.d.ts +0 -13
  394. package/plugins/ApolloLinkPlugin.js +0 -22
  395. package/plugins/ApolloLinkPlugin.js.map +0 -1
  396. package/plugins/ConsoleLinkPlugin.d.ts +0 -8
  397. package/plugins/ConsoleLinkPlugin.js +0 -26
  398. package/plugins/ConsoleLinkPlugin.js.map +0 -1
  399. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
  400. package/plugins/LocaleHeaderLinkPlugin.js +0 -32
  401. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  402. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +0 -66
  403. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +0 -1
  404. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +0 -9
  405. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +0 -78
  406. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +0 -1
  407. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +0 -7
  408. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +0 -31
  409. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +0 -1
  410. package/plugins/NetworkErrorLinkPlugin.d.ts +0 -7
  411. package/plugins/NetworkErrorLinkPlugin.js +0 -30
  412. package/plugins/NetworkErrorLinkPlugin.js.map +0 -1
  413. package/plugins/OmitTypenameLinkPlugin.d.ts +0 -8
  414. package/plugins/OmitTypenameLinkPlugin.js +0 -21
  415. package/plugins/OmitTypenameLinkPlugin.js.map +0 -1
  416. package/plugins/RoutePlugin.d.ts +0 -12
  417. package/plugins/RoutePlugin.js +0 -16
  418. package/plugins/RoutePlugin.js.map +0 -1
  419. package/plugins/TenantHeaderLinkPlugin.d.ts +0 -10
  420. package/plugins/TenantHeaderLinkPlugin.js +0 -39
  421. package/plugins/TenantHeaderLinkPlugin.js.map +0 -1
  422. package/plugins/ViewPlugin.d.ts +0 -14
  423. package/plugins/ViewPlugin.js +0 -19
  424. package/plugins/ViewPlugin.js.map +0 -1
  425. package/react-butterfiles/Files.d.ts +0 -69
  426. package/react-butterfiles/Files.js +0 -227
  427. package/react-butterfiles/Files.js.map +0 -1
  428. package/react-butterfiles/index.d.ts +0 -2
  429. package/react-butterfiles/index.js +0 -4
  430. package/react-butterfiles/index.js.map +0 -1
  431. package/react-butterfiles/utils/generateId.d.ts +0 -1
  432. package/react-butterfiles/utils/generateId.js +0 -5
  433. package/react-butterfiles/utils/generateId.js.map +0 -1
  434. package/react-butterfiles/utils/readFileContent.d.ts +0 -1
  435. package/react-butterfiles/utils/readFileContent.js +0 -15
  436. package/react-butterfiles/utils/readFileContent.js.map +0 -1
  437. package/types.js.map +0 -1
  438. package/utils/getApiUrl.d.ts +0 -1
  439. package/utils/getApiUrl.js +0 -5
  440. package/utils/getApiUrl.js.map +0 -1
  441. package/utils/getGqlApiUrl.d.ts +0 -1
  442. package/utils/getGqlApiUrl.js +0 -6
  443. package/utils/getGqlApiUrl.js.map +0 -1
  444. package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
  445. package/utils/getHeadlessCmsGqlApiUrl.js +0 -12
  446. package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
  447. package/utils/getLocaleCode.d.ts +0 -6
  448. package/utils/getLocaleCode.js +0 -33
  449. package/utils/getLocaleCode.js.map +0 -1
  450. package/utils/getPrerenderId.d.ts +0 -6
  451. package/utils/getPrerenderId.js +0 -5
  452. package/utils/getPrerenderId.js.map +0 -1
  453. package/utils/getTenantId.d.ts +0 -6
  454. package/utils/getTenantId.js +0 -45
  455. package/utils/getTenantId.js.map +0 -1
  456. package/utils/index.js.map +0 -1
  457. package/utils/isLocalhost.d.ts +0 -1
  458. package/utils/isLocalhost.js +0 -7
  459. package/utils/isLocalhost.js.map +0 -1
  460. package/utils/isPrerendering.d.ts +0 -1
  461. package/utils/isPrerendering.js +0 -5
  462. package/utils/isPrerendering.js.map +0 -1
  463. /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/assets/close_24px.svg +0 -0
@@ -0,0 +1,471 @@
1
+ import { beforeEach, describe, expect, it, vi } from "vitest";
2
+ import { Container } from "@webiny/di";
3
+ import { GraphQLClient } from "../abstractions.js";
4
+ import { FetchGraphQLClient } from "../FetchGraphQLClient.js";
5
+ import { BatchingGraphQLClient } from "../BatchingGraphQLClient.js";
6
+ import { RetryGraphQLClient } from "../RetryGraphQLClient.js";
7
+ import { EnvConfig } from "../../envConfig/index.js";
8
+ import { __webpack_require__ } from "../../../rslib-runtime.js";
9
+ describe("GraphQLClient Feature", ()=>{
10
+ let container;
11
+ let mockEnvConfig;
12
+ beforeEach(()=>{
13
+ container = new Container();
14
+ mockEnvConfig = {
15
+ get: vi.fn((key)=>{
16
+ if ("graphqlApiUrl" === key) return "https://api.example.com/graphql";
17
+ })
18
+ };
19
+ container.registerInstance(EnvConfig, mockEnvConfig);
20
+ });
21
+ describe("FetchGraphQLClient", ()=>{
22
+ beforeEach(()=>{
23
+ container.register(FetchGraphQLClient).inSingletonScope();
24
+ });
25
+ it("should execute a query successfully", async ()=>{
26
+ const mockResponse = {
27
+ data: {
28
+ user: {
29
+ id: "1",
30
+ name: "John"
31
+ }
32
+ }
33
+ };
34
+ __webpack_require__.g.fetch = vi.fn().mockResolvedValue({
35
+ status: 200,
36
+ json: async ()=>mockResponse
37
+ });
38
+ const client = container.resolve(GraphQLClient);
39
+ const result = await client.execute({
40
+ endpoint: "https://api.example.com/graphql",
41
+ query: "query GetUser { user { id name } }"
42
+ });
43
+ expect(result).toEqual(mockResponse.data);
44
+ expect(__webpack_require__.g.fetch).toHaveBeenCalledWith("https://api.example.com/graphql", expect.objectContaining({
45
+ method: "POST",
46
+ headers: {
47
+ "Content-Type": "application/json"
48
+ }
49
+ }));
50
+ });
51
+ it("should execute a mutation successfully", async ()=>{
52
+ const mockResponse = {
53
+ data: {
54
+ createUser: {
55
+ id: "2",
56
+ name: "Jane"
57
+ }
58
+ }
59
+ };
60
+ __webpack_require__.g.fetch = vi.fn().mockResolvedValue({
61
+ status: 200,
62
+ json: async ()=>mockResponse
63
+ });
64
+ const client = container.resolve(GraphQLClient);
65
+ const result = await client.execute({
66
+ endpoint: "https://api.example.com/graphql",
67
+ query: "mutation CreateUser($name: String!) { createUser(name: $name) { id name } }",
68
+ variables: {
69
+ name: "Jane"
70
+ }
71
+ });
72
+ expect(result).toEqual(mockResponse.data);
73
+ });
74
+ it("should include custom headers", async ()=>{
75
+ const mockResponse = {
76
+ data: {
77
+ user: {
78
+ id: "1"
79
+ }
80
+ }
81
+ };
82
+ __webpack_require__.g.fetch = vi.fn().mockResolvedValue({
83
+ status: 200,
84
+ json: async ()=>mockResponse
85
+ });
86
+ const client = container.resolve(GraphQLClient);
87
+ await client.execute({
88
+ endpoint: "https://api.example.com/graphql",
89
+ query: "query GetUser { user { id } }",
90
+ headers: {
91
+ "x-tenant": "root",
92
+ Authorization: "Bearer token"
93
+ }
94
+ });
95
+ expect(__webpack_require__.g.fetch).toHaveBeenCalledWith("https://api.example.com/graphql", expect.objectContaining({
96
+ headers: {
97
+ "Content-Type": "application/json",
98
+ "x-tenant": "root",
99
+ Authorization: "Bearer token"
100
+ }
101
+ }));
102
+ });
103
+ it("should throw on network error", async ()=>{
104
+ __webpack_require__.g.fetch = vi.fn().mockRejectedValue(new Error("Network failure"));
105
+ const client = container.resolve(GraphQLClient);
106
+ await expect(client.execute({
107
+ endpoint: "https://api.example.com/graphql",
108
+ query: "query { user { id } }"
109
+ })).rejects.toThrow("Network error: Network failure");
110
+ });
111
+ it("should throw on GraphQL errors", async ()=>{
112
+ const mockResponse = {
113
+ errors: [
114
+ {
115
+ message: "User not found"
116
+ }
117
+ ],
118
+ data: null
119
+ };
120
+ __webpack_require__.g.fetch = vi.fn().mockResolvedValue({
121
+ status: 200,
122
+ json: async ()=>mockResponse
123
+ });
124
+ const client = container.resolve(GraphQLClient);
125
+ await expect(client.execute({
126
+ endpoint: "https://api.example.com/graphql",
127
+ query: "query { user { id } }"
128
+ })).rejects.toThrow("GraphQL errors");
129
+ });
130
+ it("should return partial data when the response carries both data and errors", async ()=>{
131
+ const mockResponse = {
132
+ data: {
133
+ content: {
134
+ data: [
135
+ {
136
+ id: "1"
137
+ },
138
+ {
139
+ id: "2"
140
+ }
141
+ ]
142
+ }
143
+ },
144
+ errors: [
145
+ {
146
+ message: "Cannot return null for non-nullable field RefField.id."
147
+ }
148
+ ]
149
+ };
150
+ __webpack_require__.g.fetch = vi.fn().mockResolvedValue({
151
+ status: 200,
152
+ json: async ()=>mockResponse
153
+ });
154
+ const client = container.resolve(GraphQLClient);
155
+ const result = await client.execute({
156
+ endpoint: "https://api.example.com/graphql",
157
+ query: "query { content { data { id } } }"
158
+ });
159
+ expect(result).toEqual(mockResponse.data);
160
+ });
161
+ it("should throw on invalid JSON response", async ()=>{
162
+ __webpack_require__.g.fetch = vi.fn().mockResolvedValue({
163
+ json: async ()=>{
164
+ throw new Error("Invalid JSON");
165
+ }
166
+ });
167
+ const client = container.resolve(GraphQLClient);
168
+ await expect(client.execute({
169
+ endpoint: "https://api.example.com/graphql",
170
+ query: "query { user { id } }"
171
+ })).rejects.toThrow("Failed to parse GraphQL response as JSON");
172
+ });
173
+ });
174
+ describe("BatchingGraphQLClient", ()=>{
175
+ beforeEach(()=>{
176
+ container.register(FetchGraphQLClient).inSingletonScope();
177
+ container.registerDecorator(BatchingGraphQLClient);
178
+ });
179
+ it("should batch multiple requests within the batch window", async ()=>{
180
+ const mockResponse = [
181
+ {
182
+ data: {
183
+ user: {
184
+ id: "1",
185
+ name: "John"
186
+ }
187
+ }
188
+ },
189
+ {
190
+ data: {
191
+ post: {
192
+ id: "2",
193
+ title: "Hello"
194
+ }
195
+ }
196
+ }
197
+ ];
198
+ __webpack_require__.g.fetch = vi.fn().mockResolvedValue({
199
+ json: async ()=>mockResponse
200
+ });
201
+ const client = container.resolve(GraphQLClient);
202
+ const [result1, result2] = await Promise.all([
203
+ client.execute({
204
+ endpoint: "https://api.example.com/graphql",
205
+ query: "query GetUser { user { id name } }"
206
+ }),
207
+ client.execute({
208
+ endpoint: "https://api.example.com/graphql",
209
+ query: "query GetPost { post { id title } }"
210
+ })
211
+ ]);
212
+ expect(result1).toEqual(mockResponse[0].data);
213
+ expect(result2).toEqual(mockResponse[1].data);
214
+ expect(__webpack_require__.g.fetch).toHaveBeenCalledTimes(1);
215
+ const callBody = JSON.parse(__webpack_require__.g.fetch.mock.calls[0][1].body);
216
+ expect(callBody).toHaveLength(2);
217
+ });
218
+ it("should execute single request without batching", async ()=>{
219
+ const mockResponse = {
220
+ data: {
221
+ user: {
222
+ id: "1",
223
+ name: "John"
224
+ }
225
+ }
226
+ };
227
+ __webpack_require__.g.fetch = vi.fn().mockResolvedValue({
228
+ status: 200,
229
+ json: async ()=>mockResponse
230
+ });
231
+ const client = container.resolve(GraphQLClient);
232
+ const result = await client.execute({
233
+ endpoint: "https://api.example.com/graphql",
234
+ query: "query GetUser { user { id name } }"
235
+ });
236
+ expect(result).toEqual(mockResponse.data);
237
+ const callBody = JSON.parse(__webpack_require__.g.fetch.mock.calls[0][1].body);
238
+ expect(callBody).toHaveProperty("query");
239
+ expect(callBody).not.toBeInstanceOf(Array);
240
+ });
241
+ it("should handle mixed queries and mutations in batch", async ()=>{
242
+ const mockResponse = [
243
+ {
244
+ data: {
245
+ user: {
246
+ id: "1"
247
+ }
248
+ }
249
+ },
250
+ {
251
+ data: {
252
+ createPost: {
253
+ id: "2"
254
+ }
255
+ }
256
+ }
257
+ ];
258
+ __webpack_require__.g.fetch = vi.fn().mockResolvedValue({
259
+ status: 200,
260
+ json: async ()=>mockResponse
261
+ });
262
+ const client = container.resolve(GraphQLClient);
263
+ await Promise.all([
264
+ client.execute({
265
+ endpoint: "https://api.example.com/graphql",
266
+ query: "query { user { id } }"
267
+ }),
268
+ client.execute({
269
+ endpoint: "https://api.example.com/graphql",
270
+ query: "mutation { createPost { id } }"
271
+ })
272
+ ]);
273
+ expect(__webpack_require__.g.fetch).toHaveBeenCalledTimes(1);
274
+ const callBody = JSON.parse(__webpack_require__.g.fetch.mock.calls[0][1].body);
275
+ expect(callBody[0]).toHaveProperty("query");
276
+ expect(callBody[1]).toHaveProperty("query");
277
+ });
278
+ it("should reject all requests if batch fails", async ()=>{
279
+ __webpack_require__.g.fetch = vi.fn().mockRejectedValue(new Error("Network error"));
280
+ const client = container.resolve(GraphQLClient);
281
+ const promises = [
282
+ client.execute({
283
+ endpoint: "https://api.example.com/graphql",
284
+ query: "query { user { id } }"
285
+ }),
286
+ client.execute({
287
+ endpoint: "https://api.example.com/graphql",
288
+ query: "query { post { id } }"
289
+ })
290
+ ];
291
+ await expect(Promise.all(promises)).rejects.toThrow("Network error");
292
+ });
293
+ it("should handle GraphQL errors in batched operations", async ()=>{
294
+ const mockResponse = [
295
+ {
296
+ data: {
297
+ user: {
298
+ id: "1"
299
+ }
300
+ }
301
+ },
302
+ {
303
+ errors: [
304
+ {
305
+ message: "Post not found"
306
+ }
307
+ ],
308
+ data: null
309
+ }
310
+ ];
311
+ __webpack_require__.g.fetch = vi.fn().mockResolvedValue({
312
+ json: async ()=>mockResponse
313
+ });
314
+ const client = container.resolve(GraphQLClient);
315
+ const promises = [
316
+ client.execute({
317
+ endpoint: "https://api.example.com/graphql",
318
+ query: "query { user { id } }"
319
+ }),
320
+ client.execute({
321
+ endpoint: "https://api.example.com/graphql",
322
+ query: "query { post { id } }"
323
+ })
324
+ ];
325
+ await expect(Promise.all(promises)).rejects.toThrow("GraphQL errors in operation 1");
326
+ });
327
+ it("should return partial data for a batched operation that has data and errors", async ()=>{
328
+ const mockResponse = [
329
+ {
330
+ data: {
331
+ user: {
332
+ id: "1"
333
+ }
334
+ }
335
+ },
336
+ {
337
+ data: {
338
+ content: {
339
+ data: [
340
+ {
341
+ id: "2"
342
+ }
343
+ ]
344
+ }
345
+ },
346
+ errors: [
347
+ {
348
+ message: "Cannot return null for non-nullable field RefField.id."
349
+ }
350
+ ]
351
+ }
352
+ ];
353
+ __webpack_require__.g.fetch = vi.fn().mockResolvedValue({
354
+ json: async ()=>mockResponse
355
+ });
356
+ const client = container.resolve(GraphQLClient);
357
+ const [result1, result2] = await Promise.all([
358
+ client.execute({
359
+ endpoint: "https://api.example.com/graphql",
360
+ query: "query { user { id } }"
361
+ }),
362
+ client.execute({
363
+ endpoint: "https://api.example.com/graphql",
364
+ query: "query { content { data { id } } }"
365
+ })
366
+ ]);
367
+ expect(result1).toEqual(mockResponse[0].data);
368
+ expect(result2).toEqual(mockResponse[1].data);
369
+ });
370
+ });
371
+ describe("RetryGraphQLClient", ()=>{
372
+ beforeEach(()=>{
373
+ container.register(FetchGraphQLClient).inSingletonScope();
374
+ container.registerDecorator(RetryGraphQLClient);
375
+ });
376
+ it("should retry on network errors", async ()=>{
377
+ const mockResponse = {
378
+ data: {
379
+ user: {
380
+ id: "1"
381
+ }
382
+ }
383
+ };
384
+ __webpack_require__.g.fetch = vi.fn().mockRejectedValueOnce(new Error("Network timeout")).mockRejectedValueOnce(new Error("Network timeout")).mockResolvedValueOnce({
385
+ status: 200,
386
+ json: async ()=>mockResponse
387
+ });
388
+ const client = container.resolve(GraphQLClient);
389
+ const result = await client.execute({
390
+ endpoint: "https://api.example.com/graphql",
391
+ query: "query { user { id } }"
392
+ });
393
+ expect(result).toEqual(mockResponse.data);
394
+ expect(__webpack_require__.g.fetch).toHaveBeenCalledTimes(3);
395
+ });
396
+ it("should not retry on GraphQL errors", async ()=>{
397
+ const mockResponse = {
398
+ errors: [
399
+ {
400
+ message: "Unauthorized"
401
+ }
402
+ ],
403
+ data: null
404
+ };
405
+ __webpack_require__.g.fetch = vi.fn().mockResolvedValue({
406
+ status: 200,
407
+ json: async ()=>mockResponse
408
+ });
409
+ const client = container.resolve(GraphQLClient);
410
+ await expect(client.execute({
411
+ endpoint: "https://api.example.com/graphql",
412
+ query: "query { user { id } }"
413
+ })).rejects.toThrow("GraphQL errors");
414
+ expect(__webpack_require__.g.fetch).toHaveBeenCalledTimes(1);
415
+ });
416
+ it("should give up after max retries", async ()=>{
417
+ __webpack_require__.g.fetch = vi.fn().mockRejectedValue(new Error("Network error"));
418
+ const client = container.resolve(GraphQLClient);
419
+ await expect(client.execute({
420
+ endpoint: "https://api.example.com/graphql",
421
+ query: "query { user { id } }"
422
+ })).rejects.toThrow("Network error");
423
+ expect(__webpack_require__.g.fetch).toHaveBeenCalledTimes(4);
424
+ });
425
+ });
426
+ describe("Combined decorators (Retry + Batching)", ()=>{
427
+ beforeEach(()=>{
428
+ container.register(FetchGraphQLClient).inSingletonScope();
429
+ container.registerDecorator(BatchingGraphQLClient);
430
+ container.registerDecorator(RetryGraphQLClient);
431
+ });
432
+ it("should retry batched requests on failure", async ()=>{
433
+ const mockResponse = [
434
+ {
435
+ data: {
436
+ user: {
437
+ id: "1"
438
+ }
439
+ }
440
+ },
441
+ {
442
+ data: {
443
+ post: {
444
+ id: "2"
445
+ }
446
+ }
447
+ }
448
+ ];
449
+ __webpack_require__.g.fetch = vi.fn().mockRejectedValueOnce(new Error("Network error")).mockResolvedValueOnce({
450
+ status: 200,
451
+ json: async ()=>mockResponse
452
+ });
453
+ const client = container.resolve(GraphQLClient);
454
+ const [result1, result2] = await Promise.all([
455
+ client.execute({
456
+ endpoint: "https://api.example.com/graphql",
457
+ query: "query { user { id } }"
458
+ }),
459
+ client.execute({
460
+ endpoint: "https://api.example.com/graphql",
461
+ query: "query { post { id } }"
462
+ })
463
+ ]);
464
+ expect(result1).toEqual(mockResponse[0].data);
465
+ expect(result2).toEqual(mockResponse[1].data);
466
+ expect(__webpack_require__.g.fetch).toHaveBeenCalledTimes(2);
467
+ });
468
+ });
469
+ });
470
+
471
+ //# sourceMappingURL=GraphQLClient.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/graphqlClient/__tests__/GraphQLClient.test.js","sources":["../../../../src/features/graphqlClient/__tests__/GraphQLClient.test.ts"],"sourcesContent":["import { describe, it, expect, vi, beforeEach } from \"vitest\";\nimport { Container } from \"@webiny/di\";\nimport { GraphQLClient } from \"../abstractions.js\";\nimport { FetchGraphQLClient } from \"../FetchGraphQLClient.js\";\nimport { BatchingGraphQLClient } from \"../BatchingGraphQLClient.js\";\nimport { RetryGraphQLClient } from \"../RetryGraphQLClient.js\";\nimport { EnvConfig } from \"~/features/envConfig/index.js\";\n\ndescribe(\"GraphQLClient Feature\", () => {\n let container: Container;\n let mockEnvConfig: EnvConfig.Interface;\n\n beforeEach(() => {\n container = new Container();\n\n mockEnvConfig = {\n get: vi.fn((key: string) => {\n if (key === \"graphqlApiUrl\") {\n return \"https://api.example.com/graphql\";\n }\n return undefined;\n })\n } as any;\n\n container.registerInstance(EnvConfig, mockEnvConfig);\n });\n\n describe(\"FetchGraphQLClient\", () => {\n beforeEach(() => {\n container.register(FetchGraphQLClient).inSingletonScope();\n });\n\n it(\"should execute a query successfully\", async () => {\n const mockResponse = {\n data: { user: { id: \"1\", name: \"John\" } }\n };\n\n global.fetch = vi.fn().mockResolvedValue({\n status: 200,\n json: async () => mockResponse\n });\n\n const client = container.resolve(GraphQLClient);\n const result = await client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query GetUser { user { id name } }\"\n });\n\n expect(result).toEqual(mockResponse.data);\n expect(global.fetch).toHaveBeenCalledWith(\n \"https://api.example.com/graphql\",\n expect.objectContaining({\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" }\n })\n );\n });\n\n it(\"should execute a mutation successfully\", async () => {\n const mockResponse = {\n data: { createUser: { id: \"2\", name: \"Jane\" } }\n };\n\n global.fetch = vi.fn().mockResolvedValue({\n status: 200,\n json: async () => mockResponse\n });\n\n const client = container.resolve(GraphQLClient);\n const result = await client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"mutation CreateUser($name: String!) { createUser(name: $name) { id name } }\",\n variables: { name: \"Jane\" }\n });\n\n expect(result).toEqual(mockResponse.data);\n });\n\n it(\"should include custom headers\", async () => {\n const mockResponse = { data: { user: { id: \"1\" } } };\n\n global.fetch = vi.fn().mockResolvedValue({\n status: 200,\n json: async () => mockResponse\n });\n\n const client = container.resolve(GraphQLClient);\n await client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query GetUser { user { id } }\",\n headers: { \"x-tenant\": \"root\", Authorization: \"Bearer token\" }\n });\n\n expect(global.fetch).toHaveBeenCalledWith(\n \"https://api.example.com/graphql\",\n expect.objectContaining({\n headers: {\n \"Content-Type\": \"application/json\",\n \"x-tenant\": \"root\",\n Authorization: \"Bearer token\"\n }\n })\n );\n });\n\n it(\"should throw on network error\", async () => {\n global.fetch = vi.fn().mockRejectedValue(new Error(\"Network failure\"));\n\n const client = container.resolve(GraphQLClient);\n\n await expect(\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { user { id } }\"\n })\n ).rejects.toThrow(\"Network error: Network failure\");\n });\n\n it(\"should throw on GraphQL errors\", async () => {\n const mockResponse = {\n errors: [{ message: \"User not found\" }],\n data: null\n };\n\n global.fetch = vi.fn().mockResolvedValue({\n status: 200,\n json: async () => mockResponse\n });\n\n const client = container.resolve(GraphQLClient);\n\n await expect(\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { user { id } }\"\n })\n ).rejects.toThrow(\"GraphQL errors\");\n });\n\n it(\"should return partial data when the response carries both data and errors\", async () => {\n const mockResponse = {\n data: { content: { data: [{ id: \"1\" }, { id: \"2\" }] } },\n errors: [{ message: \"Cannot return null for non-nullable field RefField.id.\" }]\n };\n\n global.fetch = vi.fn().mockResolvedValue({\n status: 200,\n json: async () => mockResponse\n });\n\n const client = container.resolve(GraphQLClient);\n const result = await client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { content { data { id } } }\"\n });\n\n expect(result).toEqual(mockResponse.data);\n });\n\n it(\"should throw on invalid JSON response\", async () => {\n global.fetch = vi.fn().mockResolvedValue({\n json: async () => {\n throw new Error(\"Invalid JSON\");\n }\n });\n\n const client = container.resolve(GraphQLClient);\n\n await expect(\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { user { id } }\"\n })\n ).rejects.toThrow(\"Failed to parse GraphQL response as JSON\");\n });\n });\n\n describe(\"BatchingGraphQLClient\", () => {\n beforeEach(() => {\n container.register(FetchGraphQLClient).inSingletonScope();\n container.registerDecorator(BatchingGraphQLClient);\n });\n\n it(\"should batch multiple requests within the batch window\", async () => {\n const mockResponse = [\n { data: { user: { id: \"1\", name: \"John\" } } },\n { data: { post: { id: \"2\", title: \"Hello\" } } }\n ];\n\n global.fetch = vi.fn().mockResolvedValue({\n json: async () => mockResponse\n });\n\n const client = container.resolve(GraphQLClient);\n\n const [result1, result2] = await Promise.all([\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query GetUser { user { id name } }\"\n }),\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query GetPost { post { id title } }\"\n })\n ]);\n\n expect(result1).toEqual(mockResponse[0].data);\n expect(result2).toEqual(mockResponse[1].data);\n expect(global.fetch).toHaveBeenCalledTimes(1);\n\n const callBody = JSON.parse((global.fetch as any).mock.calls[0][1].body);\n expect(callBody).toHaveLength(2);\n });\n\n it(\"should execute single request without batching\", async () => {\n const mockResponse = {\n data: { user: { id: \"1\", name: \"John\" } }\n };\n\n global.fetch = vi.fn().mockResolvedValue({\n status: 200,\n json: async () => mockResponse\n });\n\n const client = container.resolve(GraphQLClient);\n const result = await client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query GetUser { user { id name } }\"\n });\n\n expect(result).toEqual(mockResponse.data);\n\n // Should use decoratee directly for single request\n const callBody = JSON.parse((global.fetch as any).mock.calls[0][1].body);\n expect(callBody).toHaveProperty(\"query\");\n expect(callBody).not.toBeInstanceOf(Array);\n });\n\n it(\"should handle mixed queries and mutations in batch\", async () => {\n const mockResponse = [\n { data: { user: { id: \"1\" } } },\n { data: { createPost: { id: \"2\" } } }\n ];\n\n global.fetch = vi.fn().mockResolvedValue({\n status: 200,\n json: async () => mockResponse\n });\n\n const client = container.resolve(GraphQLClient);\n\n await Promise.all([\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { user { id } }\"\n }),\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"mutation { createPost { id } }\"\n })\n ]);\n\n expect(global.fetch).toHaveBeenCalledTimes(1);\n const callBody = JSON.parse((global.fetch as any).mock.calls[0][1].body);\n expect(callBody[0]).toHaveProperty(\"query\");\n expect(callBody[1]).toHaveProperty(\"query\");\n });\n\n it(\"should reject all requests if batch fails\", async () => {\n global.fetch = vi.fn().mockRejectedValue(new Error(\"Network error\"));\n\n const client = container.resolve(GraphQLClient);\n\n const promises = [\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { user { id } }\"\n }),\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { post { id } }\"\n })\n ];\n\n await expect(Promise.all(promises)).rejects.toThrow(\"Network error\");\n });\n\n it(\"should handle GraphQL errors in batched operations\", async () => {\n const mockResponse = [\n { data: { user: { id: \"1\" } } },\n { errors: [{ message: \"Post not found\" }], data: null }\n ];\n\n global.fetch = vi.fn().mockResolvedValue({\n json: async () => mockResponse\n });\n\n const client = container.resolve(GraphQLClient);\n\n const promises = [\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { user { id } }\"\n }),\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { post { id } }\"\n })\n ];\n\n await expect(Promise.all(promises)).rejects.toThrow(\"GraphQL errors in operation 1\");\n });\n\n it(\"should return partial data for a batched operation that has data and errors\", async () => {\n const mockResponse = [\n { data: { user: { id: \"1\" } } },\n {\n data: { content: { data: [{ id: \"2\" }] } },\n errors: [{ message: \"Cannot return null for non-nullable field RefField.id.\" }]\n }\n ];\n\n global.fetch = vi.fn().mockResolvedValue({\n json: async () => mockResponse\n });\n\n const client = container.resolve(GraphQLClient);\n\n const [result1, result2] = await Promise.all([\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { user { id } }\"\n }),\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { content { data { id } } }\"\n })\n ]);\n\n expect(result1).toEqual(mockResponse[0].data);\n expect(result2).toEqual(mockResponse[1].data);\n });\n });\n\n describe(\"RetryGraphQLClient\", () => {\n beforeEach(() => {\n container.register(FetchGraphQLClient).inSingletonScope();\n container.registerDecorator(RetryGraphQLClient);\n });\n\n it(\"should retry on network errors\", async () => {\n const mockResponse = { data: { user: { id: \"1\" } } };\n\n global.fetch = vi\n .fn()\n .mockRejectedValueOnce(new Error(\"Network timeout\"))\n .mockRejectedValueOnce(new Error(\"Network timeout\"))\n .mockResolvedValueOnce({\n status: 200,\n json: async () => mockResponse\n });\n\n const client = container.resolve(GraphQLClient);\n const result = await client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { user { id } }\"\n });\n\n expect(result).toEqual(mockResponse.data);\n expect(global.fetch).toHaveBeenCalledTimes(3);\n });\n\n it(\"should not retry on GraphQL errors\", async () => {\n const mockResponse = {\n errors: [{ message: \"Unauthorized\" }],\n data: null\n };\n\n global.fetch = vi.fn().mockResolvedValue({\n status: 200,\n json: async () => mockResponse\n });\n\n const client = container.resolve(GraphQLClient);\n\n await expect(\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { user { id } }\"\n })\n ).rejects.toThrow(\"GraphQL errors\");\n\n expect(global.fetch).toHaveBeenCalledTimes(1);\n });\n\n it(\"should give up after max retries\", async () => {\n global.fetch = vi.fn().mockRejectedValue(new Error(\"Network error\"));\n\n const client = container.resolve(GraphQLClient);\n\n await expect(\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { user { id } }\"\n })\n ).rejects.toThrow(\"Network error\");\n\n // Should try 4 times: initial + 3 retries\n expect(global.fetch).toHaveBeenCalledTimes(4);\n });\n });\n\n describe(\"Combined decorators (Retry + Batching)\", () => {\n beforeEach(() => {\n container.register(FetchGraphQLClient).inSingletonScope();\n container.registerDecorator(BatchingGraphQLClient);\n container.registerDecorator(RetryGraphQLClient);\n });\n\n it(\"should retry batched requests on failure\", async () => {\n const mockResponse = [{ data: { user: { id: \"1\" } } }, { data: { post: { id: \"2\" } } }];\n\n global.fetch = vi\n .fn()\n .mockRejectedValueOnce(new Error(\"Network error\"))\n .mockResolvedValueOnce({\n status: 200,\n json: async () => mockResponse\n });\n\n const client = container.resolve(GraphQLClient);\n\n const [result1, result2] = await Promise.all([\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { user { id } }\"\n }),\n client.execute({\n endpoint: \"https://api.example.com/graphql\",\n query: \"query { post { id } }\"\n })\n ]);\n\n expect(result1).toEqual(mockResponse[0].data);\n expect(result2).toEqual(mockResponse[1].data);\n expect(global.fetch).toHaveBeenCalledTimes(2);\n });\n });\n});\n"],"names":["describe","container","mockEnvConfig","beforeEach","Container","vi","key","EnvConfig","FetchGraphQLClient","it","mockResponse","global","client","GraphQLClient","result","expect","Error","BatchingGraphQLClient","result1","result2","Promise","callBody","JSON","Array","promises","RetryGraphQLClient"],"mappings":";;;;;;;;AAQAA,SAAS,yBAAyB;IAC9B,IAAIC;IACJ,IAAIC;IAEJC,WAAW;QACPF,YAAY,IAAIG;QAEhBF,gBAAgB;YACZ,KAAKG,GAAG,E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ACwB;QAChC;QAEAhB,GAAG,4CAA4C;YAC3C,MAAMC,eAAe;gBAAC;oBAAE,MAAM;wBAAE,MAAM;4BAAE,IAAI;wBAAI;oBAAE;gBAAE;gBAAG;oBAAE,MAAM;wBAAE,MAAM;4BAAE,IAAI;wBAAI;oBAAE;gBAAE;aAAE;YAEvFC,oBAAAA,CAAMA,CAAC,KAAK,GAAGN,GAAAA,EACR,GACF,qBAAqB,CAAC,IAAIW,MAAM,kBAChC,qBAAqB,CAAC;gBACnB,QAAQ;gBACR,MAAM,UAAYN;YACtB;YAEJ,MAAME,SAASX,UAAU,OAAO,CAACY;YAEjC,MAAM,CAACK,SAASC,QAAQ,GAAG,MAAMC,QAAQ,GAAG,CAAC;gBACzCR,OAAO,OAAO,CAAC;oBACX,UAAU;oBACV,OAAO;gBACX;gBACAA,OAAO,OAAO,CAAC;oBACX,UAAU;oBACV,OAAO;gBACX;aACH;YAEDG,OAAOG,SAAS,OAAO,CAACR,YAAY,CAAC,EAAE,CAAC,IAAI;YAC5CK,OAAOI,SAAS,OAAO,CAACT,YAAY,CAAC,EAAE,CAAC,IAAI;YAC5CK,OAAOJ,oBAAAA,CAAMA,CAAC,KAAK,EAAE,qBAAqB,CAAC;QAC/C;IACJ;AACJ"}
@@ -0,0 +1,18 @@
1
+ import type { DocumentNode } from "graphql";
2
+ type IHeaders = Record<string, string | number | undefined>;
3
+ type GraphQLRequest<TVariables = any> = {
4
+ endpoint: string;
5
+ query: DocumentNode | string;
6
+ variables?: TVariables;
7
+ headers?: IHeaders;
8
+ };
9
+ export interface IGraphQLClient {
10
+ execute<TResult = any, TVariables = any>(params: GraphQLRequest<TVariables>): Promise<TResult>;
11
+ }
12
+ export declare const GraphQLClient: import("@webiny/di").Abstraction<IGraphQLClient>;
13
+ export declare namespace GraphQLClient {
14
+ type Headers = IHeaders;
15
+ type Interface = IGraphQLClient;
16
+ type Request<TVariables = any> = GraphQLRequest<TVariables>;
17
+ }
18
+ export {};
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/admin";
2
+ const GraphQLClient = createAbstraction("GraphQLClient");
3
+ export { GraphQLClient };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/graphqlClient/abstractions.js","sources":["../../../src/features/graphqlClient/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { DocumentNode } from \"graphql\";\n\ntype IHeaders = Record<string, string | number | undefined>;\n\ntype GraphQLRequest<TVariables = any> = {\n endpoint: string;\n query: DocumentNode | string;\n variables?: TVariables;\n headers?: IHeaders;\n};\n\nexport interface IGraphQLClient {\n execute<TResult = any, TVariables = any>(params: GraphQLRequest<TVariables>): Promise<TResult>;\n}\nexport const GraphQLClient = createAbstraction<IGraphQLClient>(\"GraphQLClient\");\n\nexport namespace GraphQLClient {\n export type Headers = IHeaders;\n export type Interface = IGraphQLClient;\n export type Request<TVariables = any> = GraphQLRequest<TVariables>;\n}\n"],"names":["GraphQLClient","createAbstraction"],"mappings":";AAeO,MAAMA,gBAAgBC,kBAAkC"}
@@ -0,0 +1,6 @@
1
+ export declare const GraphQLClientFeature: import("~/shared/di/createFeature.js").FeatureDefinition<{
2
+ client: import("./abstractions.js").IGraphQLClient;
3
+ }, [options: {
4
+ batching: boolean;
5
+ retry: boolean;
6
+ }]>;
@@ -0,0 +1,25 @@
1
+ import { GraphQLClient } from "./abstractions.js";
2
+ import { BatchingGraphQLClient } from "./BatchingGraphQLClient.js";
3
+ import { FetchGraphQLClient } from "./FetchGraphQLClient.js";
4
+ import { createFeature } from "../../shared/di/createFeature.js";
5
+ import { RetryGraphQLClient } from "./RetryGraphQLClient.js";
6
+ import { NetworkErrorPublishing } from "./NetworkErrorPublishing.js";
7
+ import { AuthenticationErrorPublishing } from "./AuthenticationErrorPublishing.js";
8
+ const GraphQLClientFeature = createFeature({
9
+ name: "GraphQLClient",
10
+ register (container, options) {
11
+ container.register(FetchGraphQLClient).inSingletonScope();
12
+ if (options.batching) container.registerDecorator(BatchingGraphQLClient);
13
+ if (options.retry) container.registerDecorator(RetryGraphQLClient);
14
+ container.registerDecorator(NetworkErrorPublishing);
15
+ container.registerDecorator(AuthenticationErrorPublishing);
16
+ },
17
+ resolve (container) {
18
+ return {
19
+ client: container.resolve(GraphQLClient)
20
+ };
21
+ }
22
+ });
23
+ export { GraphQLClientFeature };
24
+
25
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/graphqlClient/feature.js","sources":["../../../src/features/graphqlClient/feature.ts"],"sourcesContent":["import { GraphQLClient } from \"./abstractions.js\";\nimport { BatchingGraphQLClient } from \"./BatchingGraphQLClient.js\";\nimport { FetchGraphQLClient } from \"./FetchGraphQLClient.js\";\nimport { createFeature } from \"~/shared/di/createFeature.js\";\nimport { RetryGraphQLClient } from \"./RetryGraphQLClient.js\";\nimport { NetworkErrorPublishing } from \"./NetworkErrorPublishing.js\";\nimport { AuthenticationErrorPublishing } from \"./AuthenticationErrorPublishing.js\";\n\nexport const GraphQLClientFeature = createFeature({\n name: \"GraphQLClient\",\n register(\n container,\n options: {\n batching: boolean;\n retry: boolean;\n }\n ) {\n // Base implementation\n container.register(FetchGraphQLClient).inSingletonScope();\n\n // Optional decorators (order matters: retry wraps batching)\n if (options.batching) {\n container.registerDecorator(BatchingGraphQLClient);\n }\n\n if (options.retry) {\n container.registerDecorator(RetryGraphQLClient);\n }\n\n container.registerDecorator(NetworkErrorPublishing);\n container.registerDecorator(AuthenticationErrorPublishing);\n },\n resolve(container) {\n return {\n client: container.resolve(GraphQLClient)\n };\n }\n});\n"],"names":["GraphQLClientFeature","createFeature","container","options","FetchGraphQLClient","BatchingGraphQLClient","RetryGraphQLClient","NetworkErrorPublishing","AuthenticationErrorPublishing","GraphQLClient"],"mappings":";;;;;;;AAQO,MAAMA,uBAAuBC,cAAc;IAC9C,MAAM;IACN,UACIC,SAAS,EACTC,OAGC;QAGDD,UAAU,QAAQ,CAACE,oBAAoB,gBAAgB;QAGvD,IAAID,QAAQ,QAAQ,EAChBD,UAAU,iBAAiB,CAACG;QAGhC,IAAIF,QAAQ,KAAK,EACbD,UAAU,iBAAiB,CAACI;QAGhCJ,UAAU,iBAAiB,CAACK;QAC5BL,UAAU,iBAAiB,CAACM;IAChC;IACA,SAAQN,SAAS;QACb,OAAO;YACH,QAAQA,UAAU,OAAO,CAACO;QAC9B;IACJ;AACJ"}
@@ -0,0 +1 @@
1
+ export { GraphQLClient } from "./abstractions.js";
@@ -0,0 +1 @@
1
+ export { GraphQLClient } from "./abstractions.js";
@@ -0,0 +1,5 @@
1
+ export interface BatchingOptions {
2
+ enabled?: boolean;
3
+ batchWindowMs?: number;
4
+ maxBatchSize?: number;
5
+ }
File without changes
@@ -0,0 +1,9 @@
1
+ import { ILocalStorageGateway } from "./abstractions.js";
2
+ export declare class BrowserLocalStorageGateway implements ILocalStorageGateway {
3
+ get<T = string>(key: string): T | null;
4
+ set<T = string>(key: string, value: T): void;
5
+ remove(key: string): void;
6
+ clear(): void;
7
+ getAll(): Record<string, unknown>;
8
+ subscribe(listener: (event: StorageEvent | CustomEvent) => void): () => void;
9
+ }