@webiny/app 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7

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 (403) hide show
  1. package/App.d.ts +5 -6
  2. package/App.js +26 -32
  3. package/App.js.map +1 -1
  4. package/README.md +7 -15
  5. package/apollo-client/InMemoryCache.js +2 -2
  6. package/apollo-client/InMemoryCache.js.map +1 -1
  7. package/components/Image.d.ts +1 -2
  8. package/components/Image.js +1 -1
  9. package/components/Image.js.map +1 -1
  10. package/components/index.d.ts +1 -2
  11. package/components/index.js +1 -2
  12. package/components/index.js.map +1 -1
  13. package/config/RouterConfig/Route.d.ts +9 -10
  14. package/config/RouterConfig/Route.js +5 -14
  15. package/config/RouterConfig/Route.js.map +1 -1
  16. package/config/RouterConfig.d.ts +10 -11
  17. package/config/RouterConfig.js +1 -1
  18. package/config/RouterConfig.js.map +1 -1
  19. package/contexts/Ui/index.js.map +1 -1
  20. package/core/Plugin.d.ts +1 -1
  21. package/core/Plugin.js +2 -2
  22. package/core/Plugin.js.map +1 -1
  23. package/core/Plugins.d.ts +2 -2
  24. package/core/Plugins.js +5 -4
  25. package/core/Plugins.js.map +1 -1
  26. package/core/Provider.d.ts +1 -1
  27. package/core/Provider.js +1 -1
  28. package/core/Provider.js.map +1 -1
  29. package/core/createProviderPlugin.js +1 -1
  30. package/core/createProviderPlugin.js.map +1 -1
  31. package/errors/AuthenticationErrorEvent.d.ts +9 -0
  32. package/errors/AuthenticationErrorEvent.js +10 -0
  33. package/errors/AuthenticationErrorEvent.js.map +1 -0
  34. package/errors/NetworkErrorEvent.d.ts +15 -0
  35. package/errors/NetworkErrorEvent.js +10 -0
  36. package/errors/NetworkErrorEvent.js.map +1 -0
  37. package/errors/abstractions.d.ts +12 -0
  38. package/errors/abstractions.js +5 -0
  39. package/errors/abstractions.js.map +1 -0
  40. package/errors/index.d.ts +6 -0
  41. package/errors/index.js +6 -0
  42. package/errors/index.js.map +1 -0
  43. package/exports/admin/env-config.d.ts +2 -0
  44. package/exports/admin/env-config.js +4 -0
  45. package/exports/admin/env-config.js.map +1 -0
  46. package/exports/admin/graphql-client.d.ts +1 -0
  47. package/exports/admin/graphql-client.js +3 -0
  48. package/exports/admin/graphql-client.js.map +1 -0
  49. package/exports/admin/local-storage.d.ts +2 -0
  50. package/exports/admin/local-storage.js +4 -0
  51. package/exports/admin/local-storage.js.map +1 -0
  52. package/exports/admin/router.d.ts +5 -0
  53. package/exports/admin/router.js +7 -0
  54. package/exports/admin/router.js.map +1 -0
  55. package/exports/admin/security.d.ts +1 -0
  56. package/exports/admin/security.js +3 -0
  57. package/exports/admin/security.js.map +1 -0
  58. package/exports/admin.d.ts +7 -0
  59. package/exports/admin.js +9 -0
  60. package/exports/admin.js.map +1 -0
  61. package/features/envConfig/EnvConfig.d.ts +7 -0
  62. package/features/envConfig/EnvConfig.js +17 -0
  63. package/features/envConfig/EnvConfig.js.map +1 -0
  64. package/features/envConfig/abstractions.d.ts +28 -0
  65. package/features/envConfig/abstractions.js +4 -0
  66. package/features/envConfig/abstractions.js.map +1 -0
  67. package/features/envConfig/feature.d.ts +17 -0
  68. package/features/envConfig/feature.js +14 -0
  69. package/features/envConfig/feature.js.map +1 -0
  70. package/features/envConfig/index.d.ts +1 -0
  71. package/features/envConfig/index.js +3 -0
  72. package/features/envConfig/index.js.map +1 -0
  73. package/features/eventPublisher/EventPublisher.d.ts +8 -0
  74. package/features/eventPublisher/EventPublisher.js +27 -0
  75. package/features/eventPublisher/EventPublisher.js.map +1 -0
  76. package/features/eventPublisher/abstractions.d.ts +18 -0
  77. package/features/eventPublisher/abstractions.js +14 -0
  78. package/features/eventPublisher/abstractions.js.map +1 -0
  79. package/features/eventPublisher/feature.d.ts +3 -0
  80. package/features/eventPublisher/feature.js +16 -0
  81. package/features/eventPublisher/feature.js.map +1 -0
  82. package/features/eventPublisher/index.d.ts +3 -0
  83. package/features/eventPublisher/index.js +4 -0
  84. package/features/eventPublisher/index.js.map +1 -0
  85. package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
  86. package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
  87. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
  88. package/features/graphqlClient/BatchingGraphQLClient.d.ts +16 -0
  89. package/features/graphqlClient/BatchingGraphQLClient.js +163 -0
  90. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
  91. package/features/graphqlClient/FetchGraphQLClient.d.ts +7 -0
  92. package/features/graphqlClient/FetchGraphQLClient.js +58 -0
  93. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
  94. package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
  95. package/features/graphqlClient/NetworkErrorPublishing.js +55 -0
  96. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
  97. package/features/graphqlClient/RequestValue.d.ts +21 -0
  98. package/features/graphqlClient/RequestValue.js +45 -0
  99. package/features/graphqlClient/RequestValue.js.map +1 -0
  100. package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
  101. package/features/graphqlClient/RetryGraphQLClient.js +54 -0
  102. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
  103. package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
  104. package/features/graphqlClient/__tests__/GraphQLClient.test.js +370 -0
  105. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
  106. package/features/graphqlClient/abstractions.d.ts +18 -0
  107. package/features/graphqlClient/abstractions.js +4 -0
  108. package/features/graphqlClient/abstractions.js.map +1 -0
  109. package/features/graphqlClient/feature.d.ts +6 -0
  110. package/features/graphqlClient/feature.js +31 -0
  111. package/features/graphqlClient/feature.js.map +1 -0
  112. package/features/graphqlClient/index.d.ts +1 -0
  113. package/features/graphqlClient/index.js +3 -0
  114. package/features/graphqlClient/index.js.map +1 -0
  115. package/features/graphqlClient/types.d.ts +5 -0
  116. package/features/graphqlClient/types.js.map +1 -0
  117. package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
  118. package/features/localStorage/BrowserLocalStorageGateway.js +68 -0
  119. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
  120. package/features/localStorage/LocalStorage.d.ts +12 -0
  121. package/features/localStorage/LocalStorage.js +31 -0
  122. package/features/localStorage/LocalStorage.js.map +1 -0
  123. package/features/localStorage/LocalStorageRepository.d.ts +20 -0
  124. package/features/localStorage/LocalStorageRepository.js +95 -0
  125. package/features/localStorage/LocalStorageRepository.js.map +1 -0
  126. package/features/localStorage/abstractions.d.ts +48 -0
  127. package/features/localStorage/abstractions.js +19 -0
  128. package/features/localStorage/abstractions.js.map +1 -0
  129. package/features/localStorage/feature.d.ts +12 -0
  130. package/features/localStorage/feature.js +34 -0
  131. package/features/localStorage/feature.js.map +1 -0
  132. package/features/localStorage/index.d.ts +1 -0
  133. package/features/localStorage/index.js +3 -0
  134. package/features/localStorage/index.js.map +1 -0
  135. package/features/mainGraphQLClient/MainGraphQLClient.d.ts +11 -0
  136. package/features/mainGraphQLClient/MainGraphQLClient.js +23 -0
  137. package/features/mainGraphQLClient/MainGraphQLClient.js.map +1 -0
  138. package/features/mainGraphQLClient/abstractions.d.ts +17 -0
  139. package/features/mainGraphQLClient/abstractions.js +4 -0
  140. package/features/mainGraphQLClient/abstractions.js.map +1 -0
  141. package/features/mainGraphQLClient/feature.d.ts +3 -0
  142. package/features/mainGraphQLClient/feature.js +16 -0
  143. package/features/mainGraphQLClient/feature.js.map +1 -0
  144. package/features/mainGraphQLClient/index.d.ts +1 -0
  145. package/features/mainGraphQLClient/index.js +3 -0
  146. package/features/mainGraphQLClient/index.js.map +1 -0
  147. package/features/router/HistoryRouterGateway.d.ts +22 -0
  148. package/features/router/HistoryRouterGateway.js +118 -0
  149. package/features/router/HistoryRouterGateway.js.map +1 -0
  150. package/features/router/HistoryRouterGateway.test.d.ts +1 -0
  151. package/features/router/HistoryRouterGateway.test.js +204 -0
  152. package/features/router/HistoryRouterGateway.test.js.map +1 -0
  153. package/features/router/Route.d.ts +19 -0
  154. package/features/router/Route.js +59 -0
  155. package/features/router/Route.js.map +1 -0
  156. package/features/router/RouteUrl.d.ts +85 -0
  157. package/features/router/RouteUrl.js +232 -0
  158. package/features/router/RouteUrl.js.map +1 -0
  159. package/features/router/Router.d.ts +45 -0
  160. package/features/router/Router.js +129 -0
  161. package/features/router/Router.js.map +1 -0
  162. package/features/router/RouterPresenter.d.ts +21 -0
  163. package/features/router/RouterPresenter.js +57 -0
  164. package/features/router/RouterPresenter.js.map +1 -0
  165. package/features/router/RouterRepository.d.ts +30 -0
  166. package/features/router/RouterRepository.js +125 -0
  167. package/features/router/RouterRepository.js.map +1 -0
  168. package/features/router/RouterRepository.test.d.ts +1 -0
  169. package/features/router/RouterRepository.test.js +169 -0
  170. package/features/router/RouterRepository.test.js.map +1 -0
  171. package/features/router/abstractions.d.ts +81 -0
  172. package/features/router/abstractions.js +17 -0
  173. package/features/router/abstractions.js.map +1 -0
  174. package/features/router/feature.d.ts +4 -0
  175. package/features/router/feature.js +18 -0
  176. package/features/router/feature.js.map +1 -0
  177. package/features/router/index.d.ts +2 -0
  178. package/features/router/index.js +3 -0
  179. package/features/router/index.js.map +1 -0
  180. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  181. package/helpers/InterfaceGenerator/date.js +3 -0
  182. package/helpers/InterfaceGenerator/date.js.map +1 -0
  183. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  184. package/helpers/InterfaceGenerator/id.js +3 -0
  185. package/helpers/InterfaceGenerator/id.js.map +1 -0
  186. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  187. package/helpers/InterfaceGenerator/identity.js +3 -0
  188. package/helpers/InterfaceGenerator/identity.js.map +1 -0
  189. package/helpers/InterfaceGenerator/index.d.ts +5 -0
  190. package/helpers/InterfaceGenerator/index.js +3 -0
  191. package/helpers/InterfaceGenerator/index.js.map +1 -0
  192. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  193. package/helpers/InterfaceGenerator/numeric.js +3 -0
  194. package/helpers/InterfaceGenerator/numeric.js.map +1 -0
  195. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  196. package/helpers/InterfaceGenerator/truthful.js +3 -0
  197. package/helpers/InterfaceGenerator/truthful.js.map +1 -0
  198. package/hooks/useAutocomplete/index.d.ts +1 -1
  199. package/hooks/useAutocomplete/index.js +1 -1
  200. package/hooks/useAutocomplete/index.js.map +1 -1
  201. package/hooks/useAutocomplete/useAutocomplete.js +3 -6
  202. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  203. package/hooks/useDataList/functions/getData.js +1 -1
  204. package/hooks/useDataList/functions/getData.js.map +1 -1
  205. package/hooks/useDataList/functions/getError.js +1 -1
  206. package/hooks/useDataList/functions/getError.js.map +1 -1
  207. package/hooks/useDataList/functions/getMeta.js +1 -1
  208. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  209. package/hooks/useDataList/functions/index.d.ts +3 -3
  210. package/hooks/useDataList/functions/index.js +3 -3
  211. package/hooks/useDataList/functions/index.js.map +1 -1
  212. package/hooks/useDataList/index.d.ts +1 -1
  213. package/hooks/useDataList/index.js +1 -1
  214. package/hooks/useDataList/index.js.map +1 -1
  215. package/hooks/useDataList/useDataList.d.ts +0 -1
  216. package/hooks/useDataList/useDataList.js +6 -26
  217. package/hooks/useDataList/useDataList.js.map +1 -1
  218. package/hooks/useDataList/utils/index.d.ts +1 -2
  219. package/hooks/useDataList/utils/index.js +1 -2
  220. package/hooks/useDataList/utils/index.js.map +1 -1
  221. package/hooks/useDataList/utils/prepareLoadListParams.js +1 -1
  222. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  223. package/hooks/useHandlers.js.map +1 -1
  224. package/hooks/useRegisterLegacyPlugin.d.ts +1 -1
  225. package/hooks/useRegisterLegacyPlugin.js.map +1 -1
  226. package/hooks/useUi.d.ts +1 -1
  227. package/hooks/useUi.js +1 -1
  228. package/hooks/useUi.js.map +1 -1
  229. package/i18n/index.d.ts +1 -1
  230. package/i18n/index.js +1 -1
  231. package/i18n/index.js.map +1 -1
  232. package/index.d.ts +23 -15
  233. package/index.js +22 -14
  234. package/index.js.map +1 -1
  235. package/package.json +33 -28
  236. package/plugins/AddQuerySelectionPlugin.d.ts +1 -1
  237. package/plugins/AddQuerySelectionPlugin.js +1 -1
  238. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  239. package/plugins/ApolloDynamicLink.d.ts +1 -1
  240. package/plugins/ApolloDynamicLink.js.map +1 -1
  241. package/plugins/ConsoleLinkPlugin.d.ts +1 -1
  242. package/plugins/ConsoleLinkPlugin.js +1 -1
  243. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  244. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
  245. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +15 -26
  246. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  247. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
  248. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +31 -0
  249. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
  250. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  251. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +31 -0
  252. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  253. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -5
  254. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +3 -3
  255. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  256. package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
  257. package/plugins/NetworkErrorLinkPlugin/Typography.js +18 -0
  258. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
  259. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
  260. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +4 -13
  261. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  262. package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
  263. package/plugins/NetworkErrorLinkPlugin.js +47 -7
  264. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  265. package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
  266. package/plugins/OmitTypenameLinkPlugin.js +1 -1
  267. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  268. package/plugins/TenantHeaderLinkPlugin.d.ts +2 -2
  269. package/plugins/TenantHeaderLinkPlugin.js +2 -4
  270. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  271. package/plugins/components/Image.d.ts +6 -0
  272. package/plugins/components/Image.js +19 -0
  273. package/plugins/components/Image.js.map +1 -0
  274. package/plugins/image.d.ts +1 -1
  275. package/plugins/image.js +2 -2
  276. package/plugins/image.js.map +1 -1
  277. package/plugins/index.d.ts +3 -3
  278. package/plugins/index.js +1 -1
  279. package/plugins/index.js.map +1 -1
  280. package/presentation/envConfig/useEnvConfig.d.ts +6 -0
  281. package/presentation/envConfig/useEnvConfig.js +13 -0
  282. package/presentation/envConfig/useEnvConfig.js.map +1 -0
  283. package/presentation/localStorage/index.d.ts +3 -0
  284. package/presentation/localStorage/index.js +5 -0
  285. package/presentation/localStorage/index.js.map +1 -0
  286. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  287. package/presentation/localStorage/useLocalStorage.js +21 -0
  288. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  289. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  290. package/presentation/localStorage/useLocalStorageValue.js +20 -0
  291. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  292. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  293. package/presentation/localStorage/useLocalStorageValues.js +39 -0
  294. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  295. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  296. package/presentation/router/RouteElementRegistry.js +32 -0
  297. package/presentation/router/RouteElementRegistry.js.map +1 -0
  298. package/presentation/router/abstractions.d.ts +13 -0
  299. package/presentation/router/abstractions.js +4 -0
  300. package/presentation/router/abstractions.js.map +1 -0
  301. package/presentation/router/components/Redirect.d.ts +14 -0
  302. package/presentation/router/components/Redirect.js +15 -0
  303. package/presentation/router/components/Redirect.js.map +1 -0
  304. package/presentation/router/components/RouteContent.d.ts +2 -0
  305. package/presentation/router/components/RouteContent.js +23 -0
  306. package/presentation/router/components/RouteContent.js.map +1 -0
  307. package/presentation/router/components/RouteLink.d.ts +50 -0
  308. package/presentation/router/components/RouteLink.js +22 -0
  309. package/presentation/router/components/RouteLink.js.map +1 -0
  310. package/presentation/router/components/SimpleLink.d.ts +44 -0
  311. package/presentation/router/components/SimpleLink.js +30 -0
  312. package/presentation/router/components/SimpleLink.js.map +1 -0
  313. package/presentation/router/hooks/useRoute.d.ts +6 -0
  314. package/presentation/router/hooks/useRoute.js +30 -0
  315. package/presentation/router/hooks/useRoute.js.map +1 -0
  316. package/presentation/router/hooks/useRouter.d.ts +11 -0
  317. package/presentation/router/hooks/useRouter.js +30 -0
  318. package/presentation/router/hooks/useRouter.js.map +1 -0
  319. package/presentation/router/index.d.ts +4 -0
  320. package/presentation/router/index.js +5 -0
  321. package/presentation/router/index.js.map +1 -0
  322. package/presentation/router/types.d.ts +5 -0
  323. package/presentation/router/types.js +3 -0
  324. package/presentation/router/types.js.map +1 -0
  325. package/react-butterfiles/Files.js +3 -3
  326. package/react-butterfiles/Files.js.map +1 -1
  327. package/react-butterfiles/file.todo +1 -0
  328. package/react-butterfiles/index.d.ts +1 -1
  329. package/react-butterfiles/index.js +1 -1
  330. package/react-butterfiles/index.js.map +1 -1
  331. package/renderApp.d.ts +1 -1
  332. package/renderApp.js.map +1 -1
  333. package/router.d.ts +5 -0
  334. package/router.js +8 -0
  335. package/router.js.map +1 -0
  336. package/shared/di/DiContainerProvider.d.ts +8 -0
  337. package/shared/di/DiContainerProvider.js +17 -0
  338. package/shared/di/DiContainerProvider.js.map +1 -0
  339. package/shared/di/createFeature.d.ts +11 -0
  340. package/shared/di/createFeature.js +11 -0
  341. package/shared/di/createFeature.js.map +1 -0
  342. package/shared/di/useFeature.d.ts +2 -0
  343. package/shared/di/useFeature.js +8 -0
  344. package/shared/di/useFeature.js.map +1 -0
  345. package/types.d.ts +7 -4
  346. package/types.js +1 -12
  347. package/types.js.map +1 -1
  348. package/utils/index.d.ts +2 -10
  349. package/utils/index.js +2 -10
  350. package/utils/index.js.map +1 -1
  351. package/utils/legacyPluginToReactComponent.js +1 -1
  352. package/utils/legacyPluginToReactComponent.js.map +1 -1
  353. package/components/Routes.d.ts +0 -2
  354. package/components/Routes.js +0 -36
  355. package/components/Routes.js.map +0 -1
  356. package/components/View.d.ts +0 -8
  357. package/components/View.js +0 -19
  358. package/components/View.js.map +0 -1
  359. package/core/DebounceRender.d.ts +0 -12
  360. package/core/DebounceRender.js +0 -31
  361. package/core/DebounceRender.js.map +0 -1
  362. package/core/Routes.d.ts +0 -6
  363. package/core/Routes.js +0 -34
  364. package/core/Routes.js.map +0 -1
  365. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  366. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -26
  367. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  368. package/hooks/useDataList/utils/types.d.ts +0 -40
  369. package/hooks/useDataList/utils/types.js.map +0 -1
  370. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
  371. package/plugins/LocaleHeaderLinkPlugin.js +0 -32
  372. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  373. package/plugins/RoutePlugin.d.ts +0 -12
  374. package/plugins/RoutePlugin.js +0 -16
  375. package/plugins/RoutePlugin.js.map +0 -1
  376. package/plugins/ViewPlugin.d.ts +0 -14
  377. package/plugins/ViewPlugin.js +0 -19
  378. package/plugins/ViewPlugin.js.map +0 -1
  379. package/utils/getApiUrl.d.ts +0 -1
  380. package/utils/getApiUrl.js +0 -5
  381. package/utils/getApiUrl.js.map +0 -1
  382. package/utils/getGqlApiUrl.d.ts +0 -1
  383. package/utils/getGqlApiUrl.js +0 -6
  384. package/utils/getGqlApiUrl.js.map +0 -1
  385. package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
  386. package/utils/getHeadlessCmsGqlApiUrl.js +0 -12
  387. package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
  388. package/utils/getLocaleCode.d.ts +0 -6
  389. package/utils/getLocaleCode.js +0 -33
  390. package/utils/getLocaleCode.js.map +0 -1
  391. package/utils/getPrerenderId.d.ts +0 -6
  392. package/utils/getPrerenderId.js +0 -5
  393. package/utils/getPrerenderId.js.map +0 -1
  394. package/utils/getTenantId.d.ts +0 -6
  395. package/utils/getTenantId.js +0 -45
  396. package/utils/getTenantId.js.map +0 -1
  397. package/utils/isLocalhost.d.ts +0 -1
  398. package/utils/isLocalhost.js +0 -7
  399. package/utils/isLocalhost.js.map +0 -1
  400. package/utils/isPrerendering.d.ts +0 -1
  401. package/utils/isPrerendering.js +0 -5
  402. package/utils/isPrerendering.js.map +0 -1
  403. /package/{hooks/useDataList/utils → features/graphqlClient}/types.js +0 -0
@@ -0,0 +1,370 @@
1
+ import { describe, it, expect, vi, beforeEach } 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
+ describe("GraphQLClient Feature", () => {
9
+ let container;
10
+ let mockEnvConfig;
11
+ beforeEach(() => {
12
+ container = new Container();
13
+ mockEnvConfig = {
14
+ get: vi.fn(key => {
15
+ if (key === "graphqlApiUrl") {
16
+ return "https://api.example.com/graphql";
17
+ }
18
+ return undefined;
19
+ })
20
+ };
21
+ container.registerInstance(EnvConfig, mockEnvConfig);
22
+ });
23
+ describe("FetchGraphQLClient", () => {
24
+ beforeEach(() => {
25
+ container.register(FetchGraphQLClient).inSingletonScope();
26
+ });
27
+ it("should execute a query successfully", async () => {
28
+ const mockResponse = {
29
+ data: {
30
+ user: {
31
+ id: "1",
32
+ name: "John"
33
+ }
34
+ }
35
+ };
36
+ global.fetch = vi.fn().mockResolvedValue({
37
+ status: 200,
38
+ json: async () => mockResponse
39
+ });
40
+ const client = container.resolve(GraphQLClient);
41
+ const result = await client.execute({
42
+ endpoint: "https://api.example.com/graphql",
43
+ query: "query GetUser { user { id name } }"
44
+ });
45
+ expect(result).toEqual(mockResponse.data);
46
+ expect(global.fetch).toHaveBeenCalledWith("https://api.example.com/graphql", expect.objectContaining({
47
+ method: "POST",
48
+ headers: {
49
+ "Content-Type": "application/json"
50
+ }
51
+ }));
52
+ });
53
+ it("should execute a mutation successfully", async () => {
54
+ const mockResponse = {
55
+ data: {
56
+ createUser: {
57
+ id: "2",
58
+ name: "Jane"
59
+ }
60
+ }
61
+ };
62
+ global.fetch = vi.fn().mockResolvedValue({
63
+ status: 200,
64
+ json: async () => mockResponse
65
+ });
66
+ const client = container.resolve(GraphQLClient);
67
+ const result = await client.execute({
68
+ endpoint: "https://api.example.com/graphql",
69
+ query: "mutation CreateUser($name: String!) { createUser(name: $name) { id name } }",
70
+ variables: {
71
+ name: "Jane"
72
+ }
73
+ });
74
+ expect(result).toEqual(mockResponse.data);
75
+ });
76
+ it("should include custom headers", async () => {
77
+ const mockResponse = {
78
+ data: {
79
+ user: {
80
+ id: "1"
81
+ }
82
+ }
83
+ };
84
+ global.fetch = vi.fn().mockResolvedValue({
85
+ status: 200,
86
+ json: async () => mockResponse
87
+ });
88
+ const client = container.resolve(GraphQLClient);
89
+ await client.execute({
90
+ endpoint: "https://api.example.com/graphql",
91
+ query: "query GetUser { user { id } }",
92
+ headers: {
93
+ "x-tenant": "root",
94
+ Authorization: "Bearer token"
95
+ }
96
+ });
97
+ expect(global.fetch).toHaveBeenCalledWith("https://api.example.com/graphql", expect.objectContaining({
98
+ headers: {
99
+ "Content-Type": "application/json",
100
+ "x-tenant": "root",
101
+ Authorization: "Bearer token"
102
+ }
103
+ }));
104
+ });
105
+ it("should throw on network error", async () => {
106
+ global.fetch = vi.fn().mockRejectedValue(new Error("Network failure"));
107
+ const client = container.resolve(GraphQLClient);
108
+ await expect(client.execute({
109
+ endpoint: "https://api.example.com/graphql",
110
+ query: "query { user { id } }"
111
+ })).rejects.toThrow("Network error: Network failure");
112
+ });
113
+ it("should throw on GraphQL errors", async () => {
114
+ const mockResponse = {
115
+ errors: [{
116
+ message: "User not found"
117
+ }],
118
+ data: null
119
+ };
120
+ global.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 throw on invalid JSON response", async () => {
131
+ global.fetch = vi.fn().mockResolvedValue({
132
+ json: async () => {
133
+ throw new Error("Invalid JSON");
134
+ }
135
+ });
136
+ const client = container.resolve(GraphQLClient);
137
+ await expect(client.execute({
138
+ endpoint: "https://api.example.com/graphql",
139
+ query: "query { user { id } }"
140
+ })).rejects.toThrow("Failed to parse GraphQL response as JSON");
141
+ });
142
+ });
143
+ describe("BatchingGraphQLClient", () => {
144
+ beforeEach(() => {
145
+ container.register(FetchGraphQLClient).inSingletonScope();
146
+ container.registerDecorator(BatchingGraphQLClient);
147
+ });
148
+ it("should batch multiple requests within the batch window", async () => {
149
+ const mockResponse = [{
150
+ data: {
151
+ user: {
152
+ id: "1",
153
+ name: "John"
154
+ }
155
+ }
156
+ }, {
157
+ data: {
158
+ post: {
159
+ id: "2",
160
+ title: "Hello"
161
+ }
162
+ }
163
+ }];
164
+ global.fetch = vi.fn().mockResolvedValue({
165
+ json: async () => mockResponse
166
+ });
167
+ const client = container.resolve(GraphQLClient);
168
+ const [result1, result2] = await Promise.all([client.execute({
169
+ endpoint: "https://api.example.com/graphql",
170
+ query: "query GetUser { user { id name } }"
171
+ }), client.execute({
172
+ endpoint: "https://api.example.com/graphql",
173
+ query: "query GetPost { post { id title } }"
174
+ })]);
175
+ expect(result1).toEqual(mockResponse[0].data);
176
+ expect(result2).toEqual(mockResponse[1].data);
177
+ expect(global.fetch).toHaveBeenCalledTimes(1);
178
+ const callBody = JSON.parse(global.fetch.mock.calls[0][1].body);
179
+ expect(callBody).toHaveLength(2);
180
+ });
181
+ it("should execute single request without batching", async () => {
182
+ const mockResponse = {
183
+ data: {
184
+ user: {
185
+ id: "1",
186
+ name: "John"
187
+ }
188
+ }
189
+ };
190
+ global.fetch = vi.fn().mockResolvedValue({
191
+ status: 200,
192
+ json: async () => mockResponse
193
+ });
194
+ const client = container.resolve(GraphQLClient);
195
+ const result = await client.execute({
196
+ endpoint: "https://api.example.com/graphql",
197
+ query: "query GetUser { user { id name } }"
198
+ });
199
+ expect(result).toEqual(mockResponse.data);
200
+
201
+ // Should use decoratee directly for single request
202
+ const callBody = JSON.parse(global.fetch.mock.calls[0][1].body);
203
+ expect(callBody).toHaveProperty("query");
204
+ expect(callBody).not.toBeInstanceOf(Array);
205
+ });
206
+ it("should handle mixed queries and mutations in batch", async () => {
207
+ const mockResponse = [{
208
+ data: {
209
+ user: {
210
+ id: "1"
211
+ }
212
+ }
213
+ }, {
214
+ data: {
215
+ createPost: {
216
+ id: "2"
217
+ }
218
+ }
219
+ }];
220
+ global.fetch = vi.fn().mockResolvedValue({
221
+ status: 200,
222
+ json: async () => mockResponse
223
+ });
224
+ const client = container.resolve(GraphQLClient);
225
+ await Promise.all([client.execute({
226
+ endpoint: "https://api.example.com/graphql",
227
+ query: "query { user { id } }"
228
+ }), client.execute({
229
+ endpoint: "https://api.example.com/graphql",
230
+ query: "mutation { createPost { id } }"
231
+ })]);
232
+ expect(global.fetch).toHaveBeenCalledTimes(1);
233
+ const callBody = JSON.parse(global.fetch.mock.calls[0][1].body);
234
+ expect(callBody[0]).toHaveProperty("query");
235
+ expect(callBody[1]).toHaveProperty("query");
236
+ });
237
+ it("should reject all requests if batch fails", async () => {
238
+ global.fetch = vi.fn().mockRejectedValue(new Error("Network error"));
239
+ const client = container.resolve(GraphQLClient);
240
+ const promises = [client.execute({
241
+ endpoint: "https://api.example.com/graphql",
242
+ query: "query { user { id } }"
243
+ }), client.execute({
244
+ endpoint: "https://api.example.com/graphql",
245
+ query: "query { post { id } }"
246
+ })];
247
+ await expect(Promise.all(promises)).rejects.toThrow("Network error");
248
+ });
249
+ it("should handle GraphQL errors in batched operations", async () => {
250
+ const mockResponse = [{
251
+ data: {
252
+ user: {
253
+ id: "1"
254
+ }
255
+ }
256
+ }, {
257
+ errors: [{
258
+ message: "Post not found"
259
+ }],
260
+ data: null
261
+ }];
262
+ global.fetch = vi.fn().mockResolvedValue({
263
+ json: async () => mockResponse
264
+ });
265
+ const client = container.resolve(GraphQLClient);
266
+ const promises = [client.execute({
267
+ endpoint: "https://api.example.com/graphql",
268
+ query: "query { user { id } }"
269
+ }), client.execute({
270
+ endpoint: "https://api.example.com/graphql",
271
+ query: "query { post { id } }"
272
+ })];
273
+ await expect(Promise.all(promises)).rejects.toThrow("GraphQL errors in operation 1");
274
+ });
275
+ });
276
+ describe("RetryGraphQLClient", () => {
277
+ beforeEach(() => {
278
+ container.register(FetchGraphQLClient).inSingletonScope();
279
+ container.registerDecorator(RetryGraphQLClient);
280
+ });
281
+ it("should retry on network errors", async () => {
282
+ const mockResponse = {
283
+ data: {
284
+ user: {
285
+ id: "1"
286
+ }
287
+ }
288
+ };
289
+ global.fetch = vi.fn().mockRejectedValueOnce(new Error("Network timeout")).mockRejectedValueOnce(new Error("Network timeout")).mockResolvedValueOnce({
290
+ status: 200,
291
+ json: async () => mockResponse
292
+ });
293
+ const client = container.resolve(GraphQLClient);
294
+ const result = await client.execute({
295
+ endpoint: "https://api.example.com/graphql",
296
+ query: "query { user { id } }"
297
+ });
298
+ expect(result).toEqual(mockResponse.data);
299
+ expect(global.fetch).toHaveBeenCalledTimes(3);
300
+ });
301
+ it("should not retry on GraphQL errors", async () => {
302
+ const mockResponse = {
303
+ errors: [{
304
+ message: "Unauthorized"
305
+ }],
306
+ data: null
307
+ };
308
+ global.fetch = vi.fn().mockResolvedValue({
309
+ status: 200,
310
+ json: async () => mockResponse
311
+ });
312
+ const client = container.resolve(GraphQLClient);
313
+ await expect(client.execute({
314
+ endpoint: "https://api.example.com/graphql",
315
+ query: "query { user { id } }"
316
+ })).rejects.toThrow("GraphQL errors");
317
+ expect(global.fetch).toHaveBeenCalledTimes(1);
318
+ });
319
+ it("should give up after max retries", async () => {
320
+ global.fetch = vi.fn().mockRejectedValue(new Error("Network error"));
321
+ const client = container.resolve(GraphQLClient);
322
+ await expect(client.execute({
323
+ endpoint: "https://api.example.com/graphql",
324
+ query: "query { user { id } }"
325
+ })).rejects.toThrow("Network error");
326
+
327
+ // Should try 4 times: initial + 3 retries
328
+ expect(global.fetch).toHaveBeenCalledTimes(4);
329
+ });
330
+ });
331
+ describe("Combined decorators (Retry + Batching)", () => {
332
+ beforeEach(() => {
333
+ container.register(FetchGraphQLClient).inSingletonScope();
334
+ container.registerDecorator(BatchingGraphQLClient);
335
+ container.registerDecorator(RetryGraphQLClient);
336
+ });
337
+ it("should retry batched requests on failure", async () => {
338
+ const mockResponse = [{
339
+ data: {
340
+ user: {
341
+ id: "1"
342
+ }
343
+ }
344
+ }, {
345
+ data: {
346
+ post: {
347
+ id: "2"
348
+ }
349
+ }
350
+ }];
351
+ global.fetch = vi.fn().mockRejectedValueOnce(new Error("Network error")).mockResolvedValueOnce({
352
+ status: 200,
353
+ json: async () => mockResponse
354
+ });
355
+ const client = container.resolve(GraphQLClient);
356
+ const [result1, result2] = await Promise.all([client.execute({
357
+ endpoint: "https://api.example.com/graphql",
358
+ query: "query { user { id } }"
359
+ }), client.execute({
360
+ endpoint: "https://api.example.com/graphql",
361
+ query: "query { post { id } }"
362
+ })]);
363
+ expect(result1).toEqual(mockResponse[0].data);
364
+ expect(result2).toEqual(mockResponse[1].data);
365
+ expect(global.fetch).toHaveBeenCalledTimes(2);
366
+ });
367
+ });
368
+ });
369
+
370
+ //# sourceMappingURL=GraphQLClient.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["describe","it","expect","vi","beforeEach","Container","GraphQLClient","FetchGraphQLClient","BatchingGraphQLClient","RetryGraphQLClient","EnvConfig","container","mockEnvConfig","get","fn","key","undefined","registerInstance","register","inSingletonScope","mockResponse","data","user","id","name","global","fetch","mockResolvedValue","status","json","client","resolve","result","execute","endpoint","query","toEqual","toHaveBeenCalledWith","objectContaining","method","headers","createUser","variables","Authorization","mockRejectedValue","Error","rejects","toThrow","errors","message","registerDecorator","post","title","result1","result2","Promise","all","toHaveBeenCalledTimes","callBody","JSON","parse","mock","calls","body","toHaveLength","toHaveProperty","not","toBeInstanceOf","Array","createPost","promises","mockRejectedValueOnce","mockResolvedValueOnce"],"sources":["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 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\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"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,EAAEC,EAAE,EAAEC,UAAU,QAAQ,QAAQ;AAC7D,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,aAAa;AACtB,SAASC,kBAAkB;AAC3B,SAASC,qBAAqB;AAC9B,SAASC,kBAAkB;AAC3B,SAASC,SAAS;AAElBV,QAAQ,CAAC,uBAAuB,EAAE,MAAM;EACpC,IAAIW,SAAoB;EACxB,IAAIC,aAAkC;EAEtCR,UAAU,CAAC,MAAM;IACbO,SAAS,GAAG,IAAIN,SAAS,CAAC,CAAC;IAE3BO,aAAa,GAAG;MACZC,GAAG,EAAEV,EAAE,CAACW,EAAE,CAAEC,GAAW,IAAK;QACxB,IAAIA,GAAG,KAAK,eAAe,EAAE;UACzB,OAAO,iCAAiC;QAC5C;QACA,OAAOC,SAAS;MACpB,CAAC;IACL,CAAQ;IAERL,SAAS,CAACM,gBAAgB,CAACP,SAAS,EAAEE,aAAa,CAAC;EACxD,CAAC,CAAC;EAEFZ,QAAQ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;MAEFjC,MAAM,CAACmD,OAAO,CAAC,CAACjB,OAAO,CAAChB,YAAY,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC;MAC7CnB,MAAM,CAACoD,OAAO,CAAC,CAAClB,OAAO,CAAChB,YAAY,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC;MAC7CnB,MAAM,CAACuB,MAAM,CAACC,KAAK,CAAC,CAAC+B,qBAAqB,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -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,4 @@
1
+ import { createAbstraction } from "@webiny/feature/admin";
2
+ export const GraphQLClient = createAbstraction("GraphQLClient");
3
+
4
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createAbstraction","GraphQLClient"],"sources":["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"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,uBAAuB;AAezD,OAAO,MAAMC,aAAa,GAAGD,iBAAiB,CAAiB,eAAe,CAAC","ignoreList":[]}
@@ -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,31 @@
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
+ export const GraphQLClientFeature = createFeature({
9
+ name: "GraphQLClient",
10
+ register(container, options) {
11
+ // Base implementation
12
+ container.register(FetchGraphQLClient).inSingletonScope();
13
+
14
+ // Optional decorators (order matters: retry wraps batching)
15
+ if (options.batching) {
16
+ container.registerDecorator(BatchingGraphQLClient);
17
+ }
18
+ if (options.retry) {
19
+ container.registerDecorator(RetryGraphQLClient);
20
+ }
21
+ container.registerDecorator(NetworkErrorPublishing);
22
+ container.registerDecorator(AuthenticationErrorPublishing);
23
+ },
24
+ resolve(container) {
25
+ return {
26
+ client: container.resolve(GraphQLClient)
27
+ };
28
+ }
29
+ });
30
+
31
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GraphQLClient","BatchingGraphQLClient","FetchGraphQLClient","createFeature","RetryGraphQLClient","NetworkErrorPublishing","AuthenticationErrorPublishing","GraphQLClientFeature","name","register","container","options","inSingletonScope","batching","registerDecorator","retry","resolve","client"],"sources":["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"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,qBAAqB;AAC9B,SAASC,kBAAkB;AAC3B,SAASC,aAAa;AACtB,SAASC,kBAAkB;AAC3B,SAASC,sBAAsB;AAC/B,SAASC,6BAA6B;AAEtC,OAAO,MAAMC,oBAAoB,GAAGJ,aAAa,CAAC;EAC9CK,IAAI,EAAE,eAAe;EACrBC,QAAQA,CACJC,SAAS,EACTC,OAGC,EACH;IACE;IACAD,SAAS,CAACD,QAAQ,CAACP,kBAAkB,CAAC,CAACU,gBAAgB,CAAC,CAAC;;IAEzD;IACA,IAAID,OAAO,CAACE,QAAQ,EAAE;MAClBH,SAAS,CAACI,iBAAiB,CAACb,qBAAqB,CAAC;IACtD;IAEA,IAAIU,OAAO,CAACI,KAAK,EAAE;MACfL,SAAS,CAACI,iBAAiB,CAACV,kBAAkB,CAAC;IACnD;IAEAM,SAAS,CAACI,iBAAiB,CAACT,sBAAsB,CAAC;IACnDK,SAAS,CAACI,iBAAiB,CAACR,6BAA6B,CAAC;EAC9D,CAAC;EACDU,OAAOA,CAACN,SAAS,EAAE;IACf,OAAO;MACHO,MAAM,EAAEP,SAAS,CAACM,OAAO,CAAChB,aAAa;IAC3C,CAAC;EACL;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export { GraphQLClient } from "./abstractions.js";
@@ -0,0 +1,3 @@
1
+ export { GraphQLClient } from "./abstractions.js";
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GraphQLClient"],"sources":["index.ts"],"sourcesContent":["export { GraphQLClient } from \"./abstractions.js\";\n"],"mappings":"AAAA,SAASA,aAAa","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export interface BatchingOptions {
2
+ enabled?: boolean;
3
+ batchWindowMs?: number;
4
+ maxBatchSize?: number;
5
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export interface BatchingOptions {\n enabled?: boolean;\n batchWindowMs?: number;\n maxBatchSize?: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -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
+ }
@@ -0,0 +1,68 @@
1
+ export class BrowserLocalStorageGateway {
2
+ get(key) {
3
+ const value = window.localStorage.getItem(key);
4
+ try {
5
+ return value ? JSON.parse(value) : null;
6
+ } catch {
7
+ return value;
8
+ }
9
+ }
10
+ set(key, value) {
11
+ const serialized = typeof value === "string" ? value : JSON.stringify(value);
12
+ window.localStorage.setItem(key, serialized);
13
+
14
+ // Dispatch local event so same-tab listeners are notified.
15
+ window.dispatchEvent(new CustomEvent("localstorage:changed", {
16
+ detail: {
17
+ key,
18
+ value,
19
+ action: "set"
20
+ }
21
+ }));
22
+ }
23
+ remove(key) {
24
+ window.localStorage.removeItem(key);
25
+ window.dispatchEvent(new CustomEvent("localstorage:changed", {
26
+ detail: {
27
+ key,
28
+ action: "remove"
29
+ }
30
+ }));
31
+ }
32
+ clear() {
33
+ window.localStorage.clear();
34
+ window.dispatchEvent(new CustomEvent("localstorage:changed", {
35
+ detail: {
36
+ action: "clear"
37
+ }
38
+ }));
39
+ }
40
+ getAll() {
41
+ const result = {};
42
+ for (let i = 0; i < window.localStorage.length; i++) {
43
+ const key = window.localStorage.key(i);
44
+ const val = this.get(key);
45
+ if (val !== null) {
46
+ result[key] = val;
47
+ }
48
+ }
49
+ return result;
50
+ }
51
+
52
+ // Subscribe to changes (cross-tab + same-tab)
53
+ subscribe(listener) {
54
+ const handler = ev => {
55
+ if (ev instanceof StorageEvent || ev instanceof CustomEvent) {
56
+ listener(ev);
57
+ }
58
+ };
59
+ window.addEventListener("storage", handler);
60
+ window.addEventListener("localstorage:changed", handler);
61
+ return () => {
62
+ window.removeEventListener("storage", handler);
63
+ window.removeEventListener("localstorage:changed", handler);
64
+ };
65
+ }
66
+ }
67
+
68
+ //# sourceMappingURL=BrowserLocalStorageGateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BrowserLocalStorageGateway","get","key","value","window","localStorage","getItem","JSON","parse","set","serialized","stringify","setItem","dispatchEvent","CustomEvent","detail","action","remove","removeItem","clear","getAll","result","i","length","val","subscribe","listener","handler","ev","StorageEvent","addEventListener","removeEventListener"],"sources":["BrowserLocalStorageGateway.ts"],"sourcesContent":["import { ILocalStorageGateway } from \"./abstractions.js\";\n\nexport class BrowserLocalStorageGateway implements ILocalStorageGateway {\n get<T = string>(key: string): T | null {\n const value = window.localStorage.getItem(key);\n try {\n return value ? (JSON.parse(value) as T) : null;\n } catch {\n return value as unknown as T;\n }\n }\n\n set<T = string>(key: string, value: T): void {\n const serialized = typeof value === \"string\" ? value : JSON.stringify(value);\n window.localStorage.setItem(key, serialized);\n\n // Dispatch local event so same-tab listeners are notified.\n window.dispatchEvent(\n new CustomEvent(\"localstorage:changed\", {\n detail: { key, value, action: \"set\" }\n })\n );\n }\n\n remove(key: string): void {\n window.localStorage.removeItem(key);\n window.dispatchEvent(\n new CustomEvent(\"localstorage:changed\", {\n detail: { key, action: \"remove\" }\n })\n );\n }\n\n clear(): void {\n window.localStorage.clear();\n window.dispatchEvent(\n new CustomEvent(\"localstorage:changed\", {\n detail: { action: \"clear\" }\n })\n );\n }\n\n getAll(): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (let i = 0; i < window.localStorage.length; i++) {\n const key = window.localStorage.key(i)!;\n const val = this.get(key);\n if (val !== null) {\n result[key] = val;\n }\n }\n return result;\n }\n\n // Subscribe to changes (cross-tab + same-tab)\n subscribe(listener: (event: StorageEvent | CustomEvent) => void): () => void {\n const handler = (ev: Event) => {\n if (ev instanceof StorageEvent || ev instanceof CustomEvent) {\n listener(ev);\n }\n };\n window.addEventListener(\"storage\", handler);\n window.addEventListener(\"localstorage:changed\", handler as any);\n\n return () => {\n window.removeEventListener(\"storage\", handler);\n window.removeEventListener(\"localstorage:changed\", handler as any);\n };\n }\n}\n"],"mappings":"AAEA,OAAO,MAAMA,0BAA0B,CAAiC;EACpEC,GAAGA,CAAaC,GAAW,EAAY;IACnC,MAAMC,KAAK,GAAGC,MAAM,CAACC,YAAY,CAACC,OAAO,CAACJ,GAAG,CAAC;IAC9C,IAAI;MACA,OAAOC,KAAK,GAAII,IAAI,CAACC,KAAK,CAACL,KAAK,CAAC,GAAS,IAAI;IAClD,CAAC,CAAC,MAAM;MACJ,OAAOA,KAAK;IAChB;EACJ;EAEAM,GAAGA,CAAaP,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B,GAAG;MACrB;IACJ;IACA,OAAOH,MAAM;EACjB;;EAEA;EACAI,SAASA,CAACC,QAAqD,EAAc;IACzE,MAAMC,OAAO,GAAIC,EAAS,IAAK;MAC3B,IAAIA,EAAE,YAAYC,YAAY,IAAID,EAAE,YAAYd,WAAW,EAAE;QACzDY,QAAQ,CAACE,EAAE,CAAC;MAChB;IACJ,CAAC;IACDxB,MAAM,CAAC0B,gBAAgB,CAAC,SAAS,EAAEH,OAAO,CAAC;IAC3CvB,MAAM,CAAC0B,gBAAgB,CAAC,sBAAsB,EAAEH,OAAc,CAAC;IAE/D,OAAO,MAAM;MACTvB,MAAM,CAAC2B,mBAAmB,CAAC,SAAS,EAAEJ,OAAO,CAAC;MAC9CvB,MAAM,CAAC2B,mBAAmB,CAAC,sBAAsB,EAAEJ,OAAc,CAAC;IACtE,CAAC;EACL;AACJ","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ import { LocalStorage as LocalStorageAbstraction, LocalStorageRepository } from "./abstractions.js";
2
+ declare class LocalStorageImpl implements LocalStorageAbstraction.Interface {
3
+ private readonly repo;
4
+ constructor(repo: LocalStorageRepository.Interface);
5
+ get<T = string>(key: string): T | undefined;
6
+ set<T = string>(key: string, value: T): void;
7
+ remove(key: string): void;
8
+ clear(): void;
9
+ keys(): string[];
10
+ }
11
+ export declare const LocalStorage: import("@webiny/di").Implementation<typeof LocalStorageImpl>;
12
+ export {};