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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (427) hide show
  1. package/App.d.ts +5 -13
  2. package/App.js +70 -87
  3. package/App.js.map +1 -1
  4. package/AppContainer.d.ts +23 -0
  5. package/AppContainer.js +9 -0
  6. package/AppContainer.js.map +1 -0
  7. package/README.md +7 -15
  8. package/apollo-client/InMemoryCache.d.ts +3 -2
  9. package/apollo-client/InMemoryCache.js +16 -47
  10. package/apollo-client/InMemoryCache.js.map +1 -1
  11. package/apollo-client/IntrospectionFragmentMatcher.d.ts +2 -2
  12. package/apollo-client/IntrospectionFragmentMatcher.js +33 -50
  13. package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -1
  14. package/components/Image.d.ts +1 -2
  15. package/components/Image.js +11 -19
  16. package/components/Image.js.map +1 -1
  17. package/components/index.d.ts +1 -2
  18. package/components/index.js +1 -19
  19. package/components/index.js.map +1 -1
  20. package/config/RouterConfig/Route.d.ts +29 -0
  21. package/config/RouterConfig/Route.js +33 -0
  22. package/config/RouterConfig/Route.js.map +1 -0
  23. package/config/RouterConfig.d.ts +31 -0
  24. package/config/RouterConfig.js +18 -0
  25. package/config/RouterConfig.js.map +1 -0
  26. package/config.js +9 -15
  27. package/config.js.map +1 -1
  28. package/contexts/Ui/index.js +28 -52
  29. package/contexts/Ui/index.js.map +1 -1
  30. package/core/DebounceRender.js +13 -24
  31. package/core/DebounceRender.js.map +1 -1
  32. package/core/Plugin.d.ts +1 -1
  33. package/core/Plugin.js +11 -19
  34. package/core/Plugin.js.map +1 -1
  35. package/core/Plugins.d.ts +1 -1
  36. package/core/Plugins.js +20 -25
  37. package/core/Plugins.js.map +1 -1
  38. package/core/Provider.d.ts +1 -1
  39. package/core/Provider.js +9 -13
  40. package/core/Provider.js.map +1 -1
  41. package/core/Routes.d.ts +2 -1
  42. package/core/Routes.js +13 -23
  43. package/core/Routes.js.map +1 -1
  44. package/core/createProvider.d.ts +2 -2
  45. package/core/createProvider.js +1 -7
  46. package/core/createProvider.js.map +1 -1
  47. package/core/createProviderPlugin.d.ts +1 -1
  48. package/core/createProviderPlugin.js +4 -10
  49. package/core/createProviderPlugin.js.map +1 -1
  50. package/errors/AuthenticationErrorEvent.d.ts +9 -0
  51. package/errors/AuthenticationErrorEvent.js +10 -0
  52. package/errors/AuthenticationErrorEvent.js.map +1 -0
  53. package/errors/NetworkErrorEvent.d.ts +15 -0
  54. package/errors/NetworkErrorEvent.js +10 -0
  55. package/errors/NetworkErrorEvent.js.map +1 -0
  56. package/errors/abstractions.d.ts +12 -0
  57. package/errors/abstractions.js +5 -0
  58. package/errors/abstractions.js.map +1 -0
  59. package/errors/index.d.ts +6 -0
  60. package/errors/index.js +6 -0
  61. package/errors/index.js.map +1 -0
  62. package/exports/admin/envConfig.d.ts +1 -0
  63. package/exports/admin/envConfig.js +3 -0
  64. package/exports/admin/envConfig.js.map +1 -0
  65. package/exports/admin/graphqlClient.d.ts +1 -0
  66. package/exports/admin/graphqlClient.js +3 -0
  67. package/exports/admin/graphqlClient.js.map +1 -0
  68. package/exports/admin/localStorage.d.ts +2 -0
  69. package/exports/admin/localStorage.js +4 -0
  70. package/exports/admin/localStorage.js.map +1 -0
  71. package/exports/admin/router.d.ts +4 -0
  72. package/exports/admin/router.js +6 -0
  73. package/exports/admin/router.js.map +1 -0
  74. package/exports/admin/security.d.ts +1 -0
  75. package/exports/admin/security.js +3 -0
  76. package/exports/admin/security.js.map +1 -0
  77. package/exports/admin.d.ts +6 -0
  78. package/exports/admin.js +8 -0
  79. package/exports/admin.js.map +1 -0
  80. package/features/envConfig/EnvConfig.d.ts +6 -0
  81. package/features/envConfig/EnvConfig.js +14 -0
  82. package/features/envConfig/EnvConfig.js.map +1 -0
  83. package/features/envConfig/abstractions.d.ts +27 -0
  84. package/features/envConfig/abstractions.js +4 -0
  85. package/features/envConfig/abstractions.js.map +1 -0
  86. package/features/envConfig/feature.d.ts +17 -0
  87. package/features/envConfig/feature.js +14 -0
  88. package/features/envConfig/feature.js.map +1 -0
  89. package/features/envConfig/index.d.ts +1 -0
  90. package/features/envConfig/index.js +3 -0
  91. package/features/envConfig/index.js.map +1 -0
  92. package/features/eventPublisher/EventPublisher.d.ts +8 -0
  93. package/features/eventPublisher/EventPublisher.js +27 -0
  94. package/features/eventPublisher/EventPublisher.js.map +1 -0
  95. package/features/eventPublisher/abstractions.d.ts +18 -0
  96. package/features/eventPublisher/abstractions.js +14 -0
  97. package/features/eventPublisher/abstractions.js.map +1 -0
  98. package/features/eventPublisher/feature.d.ts +1 -0
  99. package/features/eventPublisher/feature.js +11 -0
  100. package/features/eventPublisher/feature.js.map +1 -0
  101. package/features/eventPublisher/index.d.ts +3 -0
  102. package/features/eventPublisher/index.js +4 -0
  103. package/features/eventPublisher/index.js.map +1 -0
  104. package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
  105. package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
  106. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
  107. package/features/graphqlClient/BatchingGraphQLClient.d.ts +18 -0
  108. package/features/graphqlClient/BatchingGraphQLClient.js +164 -0
  109. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
  110. package/features/graphqlClient/FetchGraphQLClient.d.ts +10 -0
  111. package/features/graphqlClient/FetchGraphQLClient.js +62 -0
  112. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
  113. package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
  114. package/features/graphqlClient/NetworkErrorPublishing.js +55 -0
  115. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
  116. package/features/graphqlClient/RequestValue.d.ts +20 -0
  117. package/features/graphqlClient/RequestValue.js +42 -0
  118. package/features/graphqlClient/RequestValue.js.map +1 -0
  119. package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
  120. package/features/graphqlClient/RetryGraphQLClient.js +54 -0
  121. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
  122. package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
  123. package/features/graphqlClient/__tests__/GraphQLClient.test.js +350 -0
  124. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
  125. package/features/graphqlClient/abstractions.d.ts +17 -0
  126. package/features/graphqlClient/abstractions.js +4 -0
  127. package/features/graphqlClient/abstractions.js.map +1 -0
  128. package/features/graphqlClient/feature.d.ts +6 -0
  129. package/features/graphqlClient/feature.js +31 -0
  130. package/features/graphqlClient/feature.js.map +1 -0
  131. package/features/graphqlClient/index.d.ts +1 -0
  132. package/features/graphqlClient/index.js +3 -0
  133. package/features/graphqlClient/index.js.map +1 -0
  134. package/features/graphqlClient/types.d.ts +5 -0
  135. package/features/graphqlClient/types.js +3 -0
  136. package/features/graphqlClient/types.js.map +1 -0
  137. package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
  138. package/features/localStorage/BrowserLocalStorageGateway.js +68 -0
  139. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
  140. package/features/localStorage/LocalStorage.d.ts +12 -0
  141. package/features/localStorage/LocalStorage.js +31 -0
  142. package/features/localStorage/LocalStorage.js.map +1 -0
  143. package/features/localStorage/LocalStorageRepository.d.ts +20 -0
  144. package/features/localStorage/LocalStorageRepository.js +95 -0
  145. package/features/localStorage/LocalStorageRepository.js.map +1 -0
  146. package/features/localStorage/abstractions.d.ts +48 -0
  147. package/features/localStorage/abstractions.js +19 -0
  148. package/features/localStorage/abstractions.js.map +1 -0
  149. package/features/localStorage/feature.d.ts +12 -0
  150. package/features/localStorage/feature.js +34 -0
  151. package/features/localStorage/feature.js.map +1 -0
  152. package/features/localStorage/index.d.ts +1 -0
  153. package/features/localStorage/index.js +3 -0
  154. package/features/localStorage/index.js.map +1 -0
  155. package/features/router/HistoryRouterGateway.d.ts +18 -0
  156. package/features/router/HistoryRouterGateway.js +82 -0
  157. package/features/router/HistoryRouterGateway.js.map +1 -0
  158. package/features/router/HistoryRouterGateway.test.d.ts +1 -0
  159. package/features/router/HistoryRouterGateway.test.js +204 -0
  160. package/features/router/HistoryRouterGateway.test.js.map +1 -0
  161. package/features/router/Route.d.ts +19 -0
  162. package/features/router/Route.js +59 -0
  163. package/features/router/Route.js.map +1 -0
  164. package/features/router/RouteUrl.d.ts +85 -0
  165. package/features/router/RouteUrl.js +232 -0
  166. package/features/router/RouteUrl.js.map +1 -0
  167. package/features/router/Router.d.ts +45 -0
  168. package/features/router/Router.js +129 -0
  169. package/features/router/Router.js.map +1 -0
  170. package/features/router/RouterPresenter.d.ts +17 -0
  171. package/features/router/RouterPresenter.js +45 -0
  172. package/features/router/RouterPresenter.js.map +1 -0
  173. package/features/router/RouterRepository.d.ts +21 -0
  174. package/features/router/RouterRepository.js +71 -0
  175. package/features/router/RouterRepository.js.map +1 -0
  176. package/features/router/RouterRepository.test.d.ts +1 -0
  177. package/features/router/RouterRepository.test.js +154 -0
  178. package/features/router/RouterRepository.test.js.map +1 -0
  179. package/features/router/abstractions.d.ts +68 -0
  180. package/features/router/abstractions.js +15 -0
  181. package/features/router/abstractions.js.map +1 -0
  182. package/features/router/feature.d.ts +4 -0
  183. package/features/router/feature.js +18 -0
  184. package/features/router/feature.js.map +1 -0
  185. package/features/router/index.d.ts +1 -0
  186. package/features/router/index.js +3 -0
  187. package/features/router/index.js.map +1 -0
  188. package/helpers/InterfaceGenerator/date.d.ts +15 -0
  189. package/helpers/InterfaceGenerator/date.js +3 -0
  190. package/helpers/InterfaceGenerator/date.js.map +1 -0
  191. package/helpers/InterfaceGenerator/id.d.ts +23 -0
  192. package/helpers/InterfaceGenerator/id.js +3 -0
  193. package/helpers/InterfaceGenerator/id.js.map +1 -0
  194. package/helpers/InterfaceGenerator/identity.d.ts +10 -0
  195. package/helpers/InterfaceGenerator/identity.js +3 -0
  196. package/helpers/InterfaceGenerator/identity.js.map +1 -0
  197. package/helpers/InterfaceGenerator/index.d.ts +5 -0
  198. package/helpers/InterfaceGenerator/index.js +3 -0
  199. package/helpers/InterfaceGenerator/index.js.map +1 -0
  200. package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
  201. package/helpers/InterfaceGenerator/numeric.js +3 -0
  202. package/helpers/InterfaceGenerator/numeric.js.map +1 -0
  203. package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
  204. package/helpers/InterfaceGenerator/truthful.js +3 -0
  205. package/helpers/InterfaceGenerator/truthful.js.map +1 -0
  206. package/hooks/useAutocomplete/index.d.ts +1 -1
  207. package/hooks/useAutocomplete/index.js +1 -12
  208. package/hooks/useAutocomplete/index.js.map +1 -1
  209. package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
  210. package/hooks/useAutocomplete/useAutocomplete.js +6 -16
  211. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  212. package/hooks/useDataList/functions/getData.js +2 -11
  213. package/hooks/useDataList/functions/getData.js.map +1 -1
  214. package/hooks/useDataList/functions/getError.js +2 -11
  215. package/hooks/useDataList/functions/getError.js.map +1 -1
  216. package/hooks/useDataList/functions/getMeta.js +2 -11
  217. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  218. package/hooks/useDataList/functions/index.d.ts +3 -3
  219. package/hooks/useDataList/functions/index.js +3 -27
  220. package/hooks/useDataList/functions/index.js.map +1 -1
  221. package/hooks/useDataList/functions/searchDataByKey.js +4 -10
  222. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
  223. package/hooks/useDataList/index.d.ts +1 -1
  224. package/hooks/useDataList/index.js +1 -12
  225. package/hooks/useDataList/index.js.map +1 -1
  226. package/hooks/useDataList/useDataList.d.ts +2 -3
  227. package/hooks/useDataList/useDataList.js +74 -94
  228. package/hooks/useDataList/useDataList.js.map +1 -1
  229. package/hooks/useDataList/utils/index.d.ts +1 -2
  230. package/hooks/useDataList/utils/index.js +1 -20
  231. package/hooks/useDataList/utils/index.js.map +1 -1
  232. package/hooks/useDataList/utils/prepareLoadListParams.js +10 -16
  233. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  234. package/hooks/useHandler.js +7 -12
  235. package/hooks/useHandler.js.map +1 -1
  236. package/hooks/useHandlers.js +11 -17
  237. package/hooks/useHandlers.js.map +1 -1
  238. package/hooks/useRegisterLegacyPlugin.d.ts +1 -1
  239. package/hooks/useRegisterLegacyPlugin.js +5 -11
  240. package/hooks/useRegisterLegacyPlugin.js.map +1 -1
  241. package/hooks/useUi.d.ts +1 -1
  242. package/hooks/useUi.js +4 -10
  243. package/hooks/useUi.js.map +1 -1
  244. package/i18n/i18n.js +5 -13
  245. package/i18n/i18n.js.map +1 -1
  246. package/i18n/index.d.ts +1 -1
  247. package/i18n/index.js +1 -13
  248. package/i18n/index.js.map +1 -1
  249. package/index.d.ts +23 -15
  250. package/index.js +25 -177
  251. package/index.js.map +1 -1
  252. package/package.json +25 -22
  253. package/plugins/AddQuerySelectionPlugin.d.ts +2 -2
  254. package/plugins/AddQuerySelectionPlugin.js +61 -107
  255. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  256. package/plugins/ApolloCacheObjectIdPlugin.js +12 -31
  257. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  258. package/plugins/ApolloDynamicLink.d.ts +3 -2
  259. package/plugins/ApolloDynamicLink.js +19 -46
  260. package/plugins/ApolloDynamicLink.js.map +1 -1
  261. package/plugins/ApolloLinkPlugin.d.ts +1 -1
  262. package/plugins/ApolloLinkPlugin.js +18 -37
  263. package/plugins/ApolloLinkPlugin.js.map +1 -1
  264. package/plugins/ConsoleLinkPlugin.d.ts +1 -1
  265. package/plugins/ConsoleLinkPlugin.js +20 -41
  266. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  267. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
  268. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +35 -58
  269. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  270. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
  271. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +31 -0
  272. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
  273. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
  274. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +31 -0
  275. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  276. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -5
  277. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -12
  278. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  279. package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
  280. package/plugins/NetworkErrorLinkPlugin/Typography.js +18 -0
  281. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
  282. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
  283. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +10 -25
  284. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  285. package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
  286. package/plugins/NetworkErrorLinkPlugin.js +60 -37
  287. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  288. package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
  289. package/plugins/OmitTypenameLinkPlugin.js +11 -30
  290. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  291. package/plugins/TenantHeaderLinkPlugin.d.ts +3 -3
  292. package/plugins/TenantHeaderLinkPlugin.js +29 -48
  293. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  294. package/plugins/components/Image.d.ts +6 -0
  295. package/plugins/components/Image.js +19 -0
  296. package/plugins/components/Image.js.map +1 -0
  297. package/plugins/image.d.ts +1 -1
  298. package/plugins/image.js +46 -53
  299. package/plugins/image.js.map +1 -1
  300. package/plugins/index.d.ts +4 -4
  301. package/plugins/index.js +31 -53
  302. package/plugins/index.js.map +1 -1
  303. package/presentation/localStorage/index.d.ts +3 -0
  304. package/presentation/localStorage/index.js +5 -0
  305. package/presentation/localStorage/index.js.map +1 -0
  306. package/presentation/localStorage/useLocalStorage.d.ts +6 -0
  307. package/presentation/localStorage/useLocalStorage.js +21 -0
  308. package/presentation/localStorage/useLocalStorage.js.map +1 -0
  309. package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
  310. package/presentation/localStorage/useLocalStorageValue.js +20 -0
  311. package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
  312. package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
  313. package/presentation/localStorage/useLocalStorageValues.js +39 -0
  314. package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
  315. package/presentation/router/RouteElementRegistry.d.ts +14 -0
  316. package/presentation/router/RouteElementRegistry.js +32 -0
  317. package/presentation/router/RouteElementRegistry.js.map +1 -0
  318. package/presentation/router/abstractions.d.ts +13 -0
  319. package/presentation/router/abstractions.js +4 -0
  320. package/presentation/router/abstractions.js.map +1 -0
  321. package/presentation/router/components/RouteContent.d.ts +2 -0
  322. package/presentation/router/components/RouteContent.js +17 -0
  323. package/presentation/router/components/RouteContent.js.map +1 -0
  324. package/presentation/router/components/RouteLink.d.ts +50 -0
  325. package/presentation/router/components/RouteLink.js +22 -0
  326. package/presentation/router/components/RouteLink.js.map +1 -0
  327. package/presentation/router/components/SimpleLink.d.ts +44 -0
  328. package/presentation/router/components/SimpleLink.js +30 -0
  329. package/presentation/router/components/SimpleLink.js.map +1 -0
  330. package/presentation/router/hooks/useRoute.d.ts +6 -0
  331. package/presentation/router/hooks/useRoute.js +30 -0
  332. package/presentation/router/hooks/useRoute.js.map +1 -0
  333. package/presentation/router/hooks/useRouter.d.ts +7 -0
  334. package/presentation/router/hooks/useRouter.js +26 -0
  335. package/presentation/router/hooks/useRouter.js.map +1 -0
  336. package/presentation/router/index.d.ts +4 -0
  337. package/presentation/router/index.js +5 -0
  338. package/presentation/router/index.js.map +1 -0
  339. package/presentation/router/types.d.ts +5 -0
  340. package/presentation/router/types.js +3 -0
  341. package/presentation/router/types.js.map +1 -0
  342. package/react-butterfiles/Files.js +208 -235
  343. package/react-butterfiles/Files.js.map +1 -1
  344. package/react-butterfiles/file.todo +1 -0
  345. package/react-butterfiles/index.d.ts +1 -1
  346. package/react-butterfiles/index.js +2 -8
  347. package/react-butterfiles/index.js.map +1 -1
  348. package/react-butterfiles/utils/generateId.js +1 -7
  349. package/react-butterfiles/utils/generateId.js.map +1 -1
  350. package/react-butterfiles/utils/readFileContent.js +4 -10
  351. package/react-butterfiles/utils/readFileContent.js.map +1 -1
  352. package/renderApp.d.ts +1 -1
  353. package/renderApp.js +4 -11
  354. package/renderApp.js.map +1 -1
  355. package/router.d.ts +5 -0
  356. package/router.js +8 -0
  357. package/router.js.map +1 -0
  358. package/shared/di/DiContainerProvider.d.ts +8 -0
  359. package/shared/di/DiContainerProvider.js +17 -0
  360. package/shared/di/DiContainerProvider.js.map +1 -0
  361. package/shared/di/createFeature.d.ts +11 -0
  362. package/shared/di/createFeature.js +11 -0
  363. package/shared/di/createFeature.js.map +1 -0
  364. package/shared/di/useFeature.d.ts +2 -0
  365. package/shared/di/useFeature.js +18 -0
  366. package/shared/di/useFeature.js.map +1 -0
  367. package/types.d.ts +9 -6
  368. package/types.js +1 -12
  369. package/types.js.map +1 -1
  370. package/utils/createGenericContext.js +13 -22
  371. package/utils/createGenericContext.js.map +1 -1
  372. package/utils/createHashing.js +9 -15
  373. package/utils/createHashing.js.map +1 -1
  374. package/utils/index.d.ts +2 -10
  375. package/utils/index.js +2 -115
  376. package/utils/index.js.map +1 -1
  377. package/utils/legacyPluginToReactComponent.d.ts +1 -1
  378. package/utils/legacyPluginToReactComponent.js +5 -11
  379. package/utils/legacyPluginToReactComponent.js.map +1 -1
  380. package/components/Routes.d.ts +0 -2
  381. package/components/Routes.js +0 -46
  382. package/components/Routes.js.map +0 -1
  383. package/components/View.d.ts +0 -8
  384. package/components/View.js +0 -31
  385. package/components/View.js.map +0 -1
  386. package/core/AddRoute.d.ts +0 -21
  387. package/core/AddRoute.js +0 -21
  388. package/core/AddRoute.js.map +0 -1
  389. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
  390. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -30
  391. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
  392. package/hooks/useDataList/utils/types.d.ts +0 -40
  393. package/hooks/useDataList/utils/types.js +0 -7
  394. package/hooks/useDataList/utils/types.js.map +0 -1
  395. package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
  396. package/plugins/LocaleHeaderLinkPlugin.js +0 -49
  397. package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
  398. package/plugins/RoutePlugin.d.ts +0 -12
  399. package/plugins/RoutePlugin.js +0 -35
  400. package/plugins/RoutePlugin.js.map +0 -1
  401. package/plugins/ViewPlugin.d.ts +0 -14
  402. package/plugins/ViewPlugin.js +0 -40
  403. package/plugins/ViewPlugin.js.map +0 -1
  404. package/utils/getApiUrl.d.ts +0 -1
  405. package/utils/getApiUrl.js +0 -12
  406. package/utils/getApiUrl.js.map +0 -1
  407. package/utils/getGqlApiUrl.d.ts +0 -1
  408. package/utils/getGqlApiUrl.js +0 -12
  409. package/utils/getGqlApiUrl.js.map +0 -1
  410. package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
  411. package/utils/getHeadlessCmsGqlApiUrl.js +0 -18
  412. package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
  413. package/utils/getLocaleCode.d.ts +0 -6
  414. package/utils/getLocaleCode.js +0 -43
  415. package/utils/getLocaleCode.js.map +0 -1
  416. package/utils/getPrerenderId.d.ts +0 -6
  417. package/utils/getPrerenderId.js +0 -11
  418. package/utils/getPrerenderId.js.map +0 -1
  419. package/utils/getTenantId.d.ts +0 -6
  420. package/utils/getTenantId.js +0 -51
  421. package/utils/getTenantId.js.map +0 -1
  422. package/utils/isLocalhost.d.ts +0 -1
  423. package/utils/isLocalhost.js +0 -15
  424. package/utils/isLocalhost.js.map +0 -1
  425. package/utils/isPrerendering.d.ts +0 -1
  426. package/utils/isPrerendering.js +0 -11
  427. package/utils/isPrerendering.js.map +0 -1
@@ -0,0 +1 @@
1
+ export declare const EventPublisherFeature: import("@webiny/feature/admin").FeatureDefinition<any, []>;
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/admin";
2
+ import { EventPublisher as EventPublisherAbstraction } from "./abstractions.js";
3
+ import { EventPublisher } from "./EventPublisher.js";
4
+ export const EventPublisherFeature = createFeature({
5
+ name: "EventPublisher",
6
+ register(container) {
7
+ container.registerInstance(EventPublisherAbstraction, new EventPublisher(container));
8
+ }
9
+ });
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createFeature","EventPublisher","EventPublisherAbstraction","EventPublisherFeature","name","register","container","registerInstance"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { Container } from \"@webiny/di\";\nimport { EventPublisher as EventPublisherAbstraction } from \"./abstractions.js\";\nimport { EventPublisher } from \"./EventPublisher.js\";\n\nexport const EventPublisherFeature = createFeature({\n name: \"EventPublisher\",\n register(container: Container) {\n container.registerInstance(EventPublisherAbstraction, new EventPublisher(container));\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,uBAAuB;AAErD,SAASC,cAAc,IAAIC,yBAAyB;AACpD,SAASD,cAAc;AAEvB,OAAO,MAAME,qBAAqB,GAAGH,aAAa,CAAC;EAC/CI,IAAI,EAAE,gBAAgB;EACtBC,QAAQA,CAACC,SAAoB,EAAE;IAC3BA,SAAS,CAACC,gBAAgB,CAACL,yBAAyB,EAAE,IAAID,cAAc,CAACK,SAAS,CAAC,CAAC;EACxF;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ export { EventPublisher, BaseEvent } from "./abstractions.js";
2
+ export type { IEventHandler, IEventPublisher } from "./abstractions.js";
3
+ export { EventPublisherFeature } from "./feature.js";
@@ -0,0 +1,4 @@
1
+ export { EventPublisher, BaseEvent } from "./abstractions.js";
2
+ export { EventPublisherFeature } from "./feature.js";
3
+
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EventPublisher","BaseEvent","EventPublisherFeature"],"sources":["index.ts"],"sourcesContent":["export { EventPublisher, BaseEvent } from \"./abstractions.js\";\nexport type { IEventHandler, IEventPublisher } from \"./abstractions.js\";\nexport { EventPublisherFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,cAAc,EAAEC,SAAS;AAElC,SAASC,qBAAqB","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import { GraphQLClient } from "./abstractions.js";
2
+ import { EventPublisher } from "../../features/eventPublisher/index.js";
3
+ declare class AuthenticationErrorPublishingDecorator implements GraphQLClient.Interface {
4
+ private eventPublisher;
5
+ private decoratee;
6
+ constructor(eventPublisher: EventPublisher.Interface, decoratee: GraphQLClient.Interface);
7
+ execute<TResult = any, TVariables = any>(params: GraphQLClient.Request<TVariables>): Promise<TResult>;
8
+ private isAuthenticationError;
9
+ }
10
+ export declare const AuthenticationErrorPublishing: typeof AuthenticationErrorPublishingDecorator & {
11
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGraphQLClient>;
12
+ };
13
+ export {};
@@ -0,0 +1,35 @@
1
+ import { GraphQLClient } from "./abstractions.js";
2
+ import { EventPublisher } from "../eventPublisher/index.js";
3
+ import { AuthenticationErrorEvent } from "../../errors/index.js";
4
+ class AuthenticationErrorPublishingDecorator {
5
+ constructor(eventPublisher, decoratee) {
6
+ this.eventPublisher = eventPublisher;
7
+ this.decoratee = decoratee;
8
+ }
9
+ async execute(params) {
10
+ try {
11
+ return await this.decoratee.execute(params);
12
+ } catch (error) {
13
+ // Only publish authentication errors
14
+ if (this.isAuthenticationError(error)) {
15
+ const event = new AuthenticationErrorEvent({
16
+ message: error.message,
17
+ code: error.code
18
+ });
19
+ await this.eventPublisher.publish(event);
20
+ }
21
+
22
+ // Re-throw to preserve existing behavior
23
+ throw error;
24
+ }
25
+ }
26
+ isAuthenticationError(error) {
27
+ return error.code?.startsWith("Authentication/") ?? false;
28
+ }
29
+ }
30
+ export const AuthenticationErrorPublishing = GraphQLClient.createDecorator({
31
+ decorator: AuthenticationErrorPublishingDecorator,
32
+ dependencies: [EventPublisher]
33
+ });
34
+
35
+ //# sourceMappingURL=AuthenticationErrorPublishing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GraphQLClient","EventPublisher","AuthenticationErrorEvent","AuthenticationErrorPublishingDecorator","constructor","eventPublisher","decoratee","execute","params","error","isAuthenticationError","event","message","code","publish","startsWith","AuthenticationErrorPublishing","createDecorator","decorator","dependencies"],"sources":["AuthenticationErrorPublishing.ts"],"sourcesContent":["import { BaseError } from \"@webiny/feature/admin\";\nimport { GraphQLClient } from \"./abstractions.js\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { AuthenticationErrorEvent } from \"~/errors/index.js\";\n\nclass AuthenticationErrorPublishingDecorator implements GraphQLClient.Interface {\n constructor(\n private eventPublisher: EventPublisher.Interface,\n private decoratee: GraphQLClient.Interface\n ) {}\n\n async execute<TResult = any, TVariables = any>(\n params: GraphQLClient.Request<TVariables>\n ): Promise<TResult> {\n try {\n return await this.decoratee.execute(params);\n } catch (error) {\n // Only publish authentication errors\n if (this.isAuthenticationError(error as BaseError)) {\n const event = new AuthenticationErrorEvent({\n message: (error as Error).message,\n code: (error as BaseError).code\n });\n\n await this.eventPublisher.publish(event);\n }\n\n // Re-throw to preserve existing behavior\n throw error;\n }\n }\n\n private isAuthenticationError(error: BaseError): boolean {\n return error.code?.startsWith(\"Authentication/\") ?? false;\n }\n}\n\nexport const AuthenticationErrorPublishing = GraphQLClient.createDecorator({\n decorator: AuthenticationErrorPublishingDecorator,\n dependencies: [EventPublisher]\n});\n"],"mappings":"AACA,SAASA,aAAa;AACtB,SAASC,cAAc;AACvB,SAASC,wBAAwB;AAEjC,MAAMC,sCAAsC,CAAoC;EAC5EC,WAAWA,CACCC,cAAwC,EACxCC,SAAkC,EAC5C;IAAA,KAFUD,cAAwC,GAAxCA,cAAwC;IAAA,KACxCC,SAAkC,GAAlCA,SAAkC;EAC3C;EAEH,MAAMC,OAAOA,CACTC,MAAyC,EACzB;IAChB,IAAI;MACA,OAAO,MAAM,IAAI,CAACF,SAAS,CAACC,OAAO,CAACC,MAAM,CAAC;IAC/C,CAAC,CAAC,OAAOC,KAAK,EAAE;MACZ;MACA,IAAI,IAAI,CAACC,qBAAqB,CAACD,KAAkB,CAAC,EAAE;QAChD,MAAME,KAAK,GAAG,IAAIT,wBAAwB,CAAC;UACvCU,OAAO,EAAGH,KAAK,CAAWG,OAAO;UACjCC,IAAI,EAAGJ,KAAK,CAAeI;QAC/B,CAAC,CAAC;QAEF,MAAM,IAAI,CAACR,cAAc,CAACS,OAAO,CAACH,KAAK,CAAC;MAC5C;;MAEA;MACA,MAAMF,KAAK;IACf;EACJ;EAEQC,qBAAqBA,CAACD,KAAgB,EAAW;IACrD,OAAOA,KAAK,CAACI,IAAI,EAAEE,UAAU,CAAC,iBAAiB,CAAC,IAAI,KAAK;EAC7D;AACJ;AAEA,OAAO,MAAMC,6BAA6B,GAAGhB,aAAa,CAACiB,eAAe,CAAC;EACvEC,SAAS,EAAEf,sCAAsC;EACjDgB,YAAY,EAAE,CAAClB,cAAc;AACjC,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import { GraphQLClient } from "./abstractions.js";
2
+ import { EnvConfig } from "../../features/envConfig/index.js";
3
+ declare class BatchingGraphQLClientImpl implements GraphQLClient.Interface {
4
+ private envConfig;
5
+ private decoratee;
6
+ private queue;
7
+ private batchTimeout;
8
+ private readonly batchWindowMs;
9
+ private readonly maxBatchSize;
10
+ constructor(envConfig: EnvConfig.Interface, decoratee: GraphQLClient.Interface);
11
+ execute<TVariables = any, TResult = any>(params: GraphQLClient.Request<TVariables>): Promise<TResult>;
12
+ private flush;
13
+ private executeBatchGroup;
14
+ private serializeHeaders;
15
+ private executeBatch;
16
+ }
17
+ export declare const BatchingGraphQLClient: typeof BatchingGraphQLClientImpl;
18
+ export {};
@@ -0,0 +1,164 @@
1
+ import { createDecorator } from "@webiny/di";
2
+ import { GraphQLClient } from "./abstractions.js";
3
+ import { EnvConfig } from "../envConfig/index.js";
4
+ import { RequestValue } from "./RequestValue.js";
5
+ class BatchingGraphQLClientImpl {
6
+ queue = [];
7
+ batchTimeout = null;
8
+ constructor(envConfig, decoratee) {
9
+ this.envConfig = envConfig;
10
+ this.decoratee = decoratee;
11
+ // Default: 10ms window, max 10 operations per batch
12
+ this.batchWindowMs = 10;
13
+ this.maxBatchSize = 10;
14
+ }
15
+ async execute(params) {
16
+ return new Promise((resolve, reject) => {
17
+ this.queue.push({
18
+ request: RequestValue.from(params),
19
+ resolve,
20
+ reject
21
+ });
22
+ if (this.queue.length >= this.maxBatchSize) {
23
+ this.flush();
24
+ return;
25
+ }
26
+ if (!this.batchTimeout) {
27
+ this.batchTimeout = setTimeout(() => {
28
+ this.flush();
29
+ }, this.batchWindowMs);
30
+ }
31
+ });
32
+ }
33
+ async flush() {
34
+ if (this.batchTimeout) {
35
+ clearTimeout(this.batchTimeout);
36
+ this.batchTimeout = null;
37
+ }
38
+ if (this.queue.length === 0) {
39
+ return;
40
+ }
41
+ const batch = this.queue.splice(0, this.queue.length);
42
+
43
+ // Single request - use decoratee directly (no batching needed)
44
+ if (batch.length === 1) {
45
+ const {
46
+ request,
47
+ resolve,
48
+ reject
49
+ } = batch[0];
50
+ try {
51
+ const result = await this.decoratee.execute(request.request);
52
+ resolve(result);
53
+ } catch (error) {
54
+ reject(error);
55
+ }
56
+ return;
57
+ }
58
+
59
+ // Group requests by headers (only batch requests with identical headers)
60
+ const groupedByHeaders = new Map();
61
+ for (const item of batch) {
62
+ const headersKey = this.serializeHeaders(item.request.headers);
63
+ if (!groupedByHeaders.has(headersKey)) {
64
+ groupedByHeaders.set(headersKey, []);
65
+ }
66
+ groupedByHeaders.get(headersKey).push(item);
67
+ }
68
+
69
+ // Process each group separately
70
+ const batchPromises = Array.from(groupedByHeaders.entries()).map(requests => {
71
+ const group = requests[1];
72
+ if (group.length === 1) {
73
+ // Single request in this group - use decoratee directly
74
+ const {
75
+ request,
76
+ resolve,
77
+ reject
78
+ } = group[0];
79
+ return this.decoratee.execute(request.request).then(resolve).catch(reject);
80
+ }
81
+
82
+ // Multiple requests with same headers - batch them
83
+ return this.executeBatchGroup(group);
84
+ });
85
+ await Promise.all(batchPromises);
86
+ }
87
+ async executeBatchGroup(group) {
88
+ const batchedOperations = group.map(({
89
+ request
90
+ }) => {
91
+ return {
92
+ query: request.queryAsString,
93
+ operationName: request.operationName,
94
+ variables: request.variables
95
+ };
96
+ });
97
+ const headers = group[0].request.headers;
98
+ try {
99
+ const results = await this.executeBatch(batchedOperations, headers);
100
+ group.forEach(({
101
+ resolve
102
+ }, index) => {
103
+ resolve(results[index]);
104
+ });
105
+ } catch (error) {
106
+ group.forEach(({
107
+ reject
108
+ }) => {
109
+ reject(error);
110
+ });
111
+ }
112
+ }
113
+ serializeHeaders(headers) {
114
+ if (!headers) {
115
+ return "{}";
116
+ }
117
+ // Sort keys for consistent serialization
118
+ const sortedKeys = Object.keys(headers).sort();
119
+ const sortedHeaders = {};
120
+ for (const key of sortedKeys) {
121
+ sortedHeaders[key] = String(headers[key]);
122
+ }
123
+ return JSON.stringify(sortedHeaders);
124
+ }
125
+ async executeBatch(operations, headers) {
126
+ let response;
127
+ try {
128
+ response = await fetch(this.envConfig.get("graphqlApiUrl"), {
129
+ method: "POST",
130
+ headers: {
131
+ "Content-Type": "application/json",
132
+ ...(headers || {})
133
+ },
134
+ body: JSON.stringify(operations)
135
+ });
136
+ } catch (err) {
137
+ throw new Error(`Network error: ${err.message}`);
138
+ }
139
+ let json;
140
+ try {
141
+ json = await response.json();
142
+ } catch {
143
+ throw new Error("Failed to parse GraphQL batch response as JSON.");
144
+ }
145
+ if (!Array.isArray(json)) {
146
+ throw new Error("Expected batch response to be an array");
147
+ }
148
+
149
+ // Map each result, handling individual errors
150
+ return json.map((result, index) => {
151
+ if (result.errors && result.errors.length > 0) {
152
+ throw new Error(`GraphQL errors in operation ${index}: ${JSON.stringify(result.errors)}`);
153
+ }
154
+ return result.data;
155
+ });
156
+ }
157
+ }
158
+ export const BatchingGraphQLClient = createDecorator({
159
+ abstraction: GraphQLClient,
160
+ decorator: BatchingGraphQLClientImpl,
161
+ dependencies: [EnvConfig]
162
+ });
163
+
164
+ //# sourceMappingURL=BatchingGraphQLClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createDecorator","GraphQLClient","EnvConfig","RequestValue","BatchingGraphQLClientImpl","queue","batchTimeout","constructor","envConfig","decoratee","batchWindowMs","maxBatchSize","execute","params","Promise","resolve","reject","push","request","from","length","flush","setTimeout","clearTimeout","batch","splice","result","error","groupedByHeaders","Map","item","headersKey","serializeHeaders","headers","has","set","get","batchPromises","Array","entries","map","requests","group","then","catch","executeBatchGroup","all","batchedOperations","query","queryAsString","operationName","variables","results","executeBatch","forEach","index","sortedKeys","Object","keys","sort","sortedHeaders","key","String","JSON","stringify","operations","response","fetch","method","body","err","Error","message","json","isArray","errors","data","BatchingGraphQLClient","abstraction","decorator","dependencies"],"sources":["BatchingGraphQLClient.ts"],"sourcesContent":["import { createDecorator } from \"@webiny/di\";\nimport { GraphQLClient } from \"./abstractions.js\";\nimport { EnvConfig } from \"~/features/envConfig/index.js\";\nimport { RequestValue } from \"~/features/graphqlClient/RequestValue.js\";\n\ninterface BatchedRequest {\n request: RequestValue;\n resolve: (value: any) => void;\n reject: (error: any) => void;\n}\n\ninterface BatchOperation {\n operationName: string | undefined;\n query: string;\n variables?: any;\n}\n\nclass BatchingGraphQLClientImpl implements GraphQLClient.Interface {\n private queue: BatchedRequest[] = [];\n private batchTimeout: NodeJS.Timeout | null = null;\n private readonly batchWindowMs: number;\n private readonly maxBatchSize: number;\n\n constructor(\n private envConfig: EnvConfig.Interface,\n private decoratee: GraphQLClient.Interface\n ) {\n // Default: 10ms window, max 10 operations per batch\n this.batchWindowMs = 10;\n this.maxBatchSize = 10;\n }\n\n async execute<TVariables = any, TResult = any>(\n params: GraphQLClient.Request<TVariables>\n ): Promise<TResult> {\n return new Promise((resolve, reject) => {\n this.queue.push({ request: RequestValue.from(params), resolve, reject });\n\n if (this.queue.length >= this.maxBatchSize) {\n this.flush();\n return;\n }\n\n if (!this.batchTimeout) {\n this.batchTimeout = setTimeout(() => {\n this.flush();\n }, this.batchWindowMs);\n }\n });\n }\n\n private async flush(): Promise<void> {\n if (this.batchTimeout) {\n clearTimeout(this.batchTimeout);\n this.batchTimeout = null;\n }\n\n if (this.queue.length === 0) {\n return;\n }\n\n const batch = this.queue.splice(0, this.queue.length);\n\n // Single request - use decoratee directly (no batching needed)\n if (batch.length === 1) {\n const { request, resolve, reject } = batch[0];\n try {\n const result = await this.decoratee.execute(request.request);\n resolve(result);\n } catch (error) {\n reject(error);\n }\n return;\n }\n\n // Group requests by headers (only batch requests with identical headers)\n const groupedByHeaders = new Map<string, BatchedRequest[]>();\n for (const item of batch) {\n const headersKey = this.serializeHeaders(item.request.headers);\n if (!groupedByHeaders.has(headersKey)) {\n groupedByHeaders.set(headersKey, []);\n }\n groupedByHeaders.get(headersKey)!.push(item);\n }\n\n // Process each group separately\n const batchPromises = Array.from(groupedByHeaders.entries()).map(requests => {\n const group = requests[1];\n\n if (group.length === 1) {\n // Single request in this group - use decoratee directly\n const { request, resolve, reject } = group[0];\n return this.decoratee.execute(request.request).then(resolve).catch(reject);\n }\n\n // Multiple requests with same headers - batch them\n return this.executeBatchGroup(group);\n });\n\n await Promise.all(batchPromises);\n }\n\n private async executeBatchGroup(group: BatchedRequest[]): Promise<void> {\n const batchedOperations = group.map(({ request }): BatchOperation => {\n return {\n query: request.queryAsString,\n operationName: request.operationName,\n variables: request.variables\n };\n });\n\n const headers = group[0].request.headers;\n\n try {\n const results = await this.executeBatch(batchedOperations, headers);\n group.forEach(({ resolve }, index) => {\n resolve(results[index]);\n });\n } catch (error) {\n group.forEach(({ reject }) => {\n reject(error);\n });\n }\n }\n\n private serializeHeaders(headers?: GraphQLClient.Headers): string {\n if (!headers) {\n return \"{}\";\n }\n // Sort keys for consistent serialization\n const sortedKeys = Object.keys(headers).sort();\n const sortedHeaders: Record<string, string> = {};\n for (const key of sortedKeys) {\n sortedHeaders[key] = String(headers[key]);\n }\n return JSON.stringify(sortedHeaders);\n }\n\n private async executeBatch(\n operations: BatchOperation[],\n headers?: GraphQLClient.Headers\n ): Promise<any[]> {\n let response: Response;\n\n try {\n response = await fetch(this.envConfig.get(\"graphqlApiUrl\"), {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...(headers || {})\n },\n body: JSON.stringify(operations)\n });\n } catch (err) {\n throw new Error(`Network error: ${(err as Error).message}`);\n }\n\n let json: any;\n try {\n json = await response.json();\n } catch {\n throw new Error(\"Failed to parse GraphQL batch response as JSON.\");\n }\n\n if (!Array.isArray(json)) {\n throw new Error(\"Expected batch response to be an array\");\n }\n\n // Map each result, handling individual errors\n return json.map((result: any, index: number) => {\n if (result.errors && result.errors.length > 0) {\n throw new Error(\n `GraphQL errors in operation ${index}: ${JSON.stringify(result.errors)}`\n );\n }\n return result.data;\n });\n }\n}\n\nexport const BatchingGraphQLClient = createDecorator({\n abstraction: GraphQLClient,\n decorator: BatchingGraphQLClientImpl,\n dependencies: [EnvConfig]\n});\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,YAAY;AAC5C,SAASC,aAAa;AACtB,SAASC,SAAS;AAClB,SAASC,YAAY;AAcrB,MAAMC,yBAAyB,CAAoC;EACvDC,KAAK,GAAqB,EAAE;EAC5BC,YAAY,GAA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3E,yBAAyB;EACpC4E,YAAY,EAAE,CAAC9E,SAAS;AAC5B,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import { GraphQLClient } from "./abstractions.js";
2
+ import { EnvConfig } from "../../features/envConfig/index.js";
3
+ declare class GraphQLClientImpl implements GraphQLClient.Interface {
4
+ private readonly graphqlApiUrl;
5
+ constructor(envConfig: EnvConfig.Interface);
6
+ execute<TResult = any, TVariables = any>(params: GraphQLClient.Request<TVariables>): Promise<TResult>;
7
+ private fetch;
8
+ }
9
+ export declare const FetchGraphQLClient: import("@webiny/di").Implementation<typeof GraphQLClientImpl>;
10
+ export {};
@@ -0,0 +1,62 @@
1
+ import { createImplementation } from "@webiny/di";
2
+ import { GraphQLClient } from "./abstractions.js";
3
+ import { EnvConfig } from "../envConfig/index.js";
4
+ import { RequestValue } from "./RequestValue.js";
5
+ class GraphQLClientImpl {
6
+ constructor(envConfig) {
7
+ this.graphqlApiUrl = envConfig.get("graphqlApiUrl");
8
+ }
9
+ async execute(params) {
10
+ const request = RequestValue.from(params);
11
+ const body = JSON.stringify({
12
+ query: request.queryAsString,
13
+ variables: request.variables,
14
+ operationName: request.operationName
15
+ });
16
+ return this.fetch(body, request.headers);
17
+ }
18
+ async fetch(body, headers = {}) {
19
+ let response;
20
+ try {
21
+ response = await fetch(this.graphqlApiUrl, {
22
+ method: "POST",
23
+ headers: {
24
+ "Content-Type": "application/json",
25
+ ...(headers || {})
26
+ },
27
+ body
28
+ });
29
+ } catch (err) {
30
+ throw new Error(`Network error: ${err.message}`);
31
+ }
32
+ let json;
33
+ try {
34
+ json = await response.json();
35
+ } catch {
36
+ throw new Error("Failed to parse GraphQL response as JSON.");
37
+ }
38
+
39
+ // Check for generic API errors
40
+ if (response.status !== 200) {
41
+ throw {
42
+ message: json.message,
43
+ code: json.code
44
+ };
45
+ }
46
+
47
+ // Check for GraphQL errors
48
+ if (json.errors && json.errors.length > 0) {
49
+ throw new Error(`GraphQL errors`, {
50
+ cause: json.errors
51
+ });
52
+ }
53
+ return json.data;
54
+ }
55
+ }
56
+ export const FetchGraphQLClient = createImplementation({
57
+ abstraction: GraphQLClient,
58
+ implementation: GraphQLClientImpl,
59
+ dependencies: [EnvConfig]
60
+ });
61
+
62
+ //# sourceMappingURL=FetchGraphQLClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createImplementation","GraphQLClient","EnvConfig","RequestValue","GraphQLClientImpl","constructor","envConfig","graphqlApiUrl","get","execute","params","request","from","body","JSON","stringify","query","queryAsString","variables","operationName","fetch","headers","response","method","err","Error","message","json","status","code","errors","length","cause","data","FetchGraphQLClient","abstraction","implementation","dependencies"],"sources":["FetchGraphQLClient.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { GraphQLClient } from \"./abstractions.js\";\nimport { EnvConfig } from \"~/features/envConfig/index.js\";\nimport { RequestValue } from \"~/features/graphqlClient/RequestValue.js\";\n\nclass GraphQLClientImpl implements GraphQLClient.Interface {\n private readonly graphqlApiUrl: string;\n\n constructor(envConfig: EnvConfig.Interface) {\n this.graphqlApiUrl = envConfig.get(\"graphqlApiUrl\");\n }\n\n async execute<TResult = any, TVariables = any>(\n params: GraphQLClient.Request<TVariables>\n ): Promise<TResult> {\n const request = RequestValue.from(params);\n\n const body = JSON.stringify({\n query: request.queryAsString,\n variables: request.variables,\n operationName: request.operationName\n });\n\n return this.fetch<TResult>(body, request.headers);\n }\n\n private async fetch<TResult = any>(\n body: string,\n headers: GraphQLClient.Headers = {}\n ): Promise<TResult> {\n let response: Response;\n try {\n response = await fetch(this.graphqlApiUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n ...(headers || {})\n },\n body\n });\n } catch (err) {\n throw new Error(`Network error: ${(err as Error).message}`);\n }\n let json: any;\n try {\n json = await response.json();\n } catch {\n throw new Error(\"Failed to parse GraphQL response as JSON.\");\n }\n\n // Check for generic API errors\n if (response.status !== 200) {\n throw { message: json.message, code: json.code };\n }\n\n // Check for GraphQL errors\n if (json.errors && json.errors.length > 0) {\n throw new Error(`GraphQL errors`, { cause: json.errors });\n }\n return json.data as TResult;\n }\n}\n\nexport const FetchGraphQLClient = createImplementation({\n abstraction: GraphQLClient,\n implementation: GraphQLClientImpl,\n dependencies: [EnvConfig]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,YAAY;AACjD,SAASC,aAAa;AACtB,SAASC,SAAS;AAClB,SAASC,YAAY;AAErB,MAAMC,iBAAiB,CAAoC;EAGvDC,WAAWA,CAACC,SAA8B,EAAE;IACxC,IAAI,CAACC,aAAa,GAAGD,SAAS,CAACE,GAAG,CAAC,eAAe,CAAC;EACvD;EAEA,MAAMC,OAAOA,CACTC,MAAyC,EACzB;IAChB,MAAMC,OAAO,GAAGR,YAAY,CAACS,IAAI,CAACF,MAAM,CAAC;IAEzC,MAAMG,IAAI,GAAGC,IAAI,CAACC,SAAS,CAAC;MACxBC,KAAK,EAAEL,OAAO,CAACM,aAAa;MAC5BC,SAAS,EAAEP,OAAO,CAACO,SAAS;MAC5BC,aAAa,EAAER,OAAO,CAACQ;IAC3B,CAAC,CAAC;IAEF,OAAO,IAAI,CAACC,KAAK,CAAUP,IAAI,EAAEF,OAAO,CAACU,OAAO,CAAC;EACrD;EAEA,MAAcD,KAAKA,CACfP,IAAY,EACZQ,OAA8B,GAAG,CAAC,CAAC,EACnB;IAChB,IAAIC,QAAkB;IACtB,IAAI;MACAA,QAAQ,GAAG,MAAMF,KAAK,CAAC,IAAI,CAACb,aAAa,EAAE;QACvCgB,MAAM,EAAE,MAAM;QACdF,OAAO,EAAE;UACL,cAAc,EAAE,kBAAkB;UAClC,IAAIA,OAAO,IAAI,CAAC,CAAC;QACrB,CAAC;QACDR;MACJ,CAAC,CAAC;IACN,CAAC,CAAC,OAAOW,GAAG,EAAE;MACV,MAAM,IAAIC,KAAK,CAAC,kBAAmBD,GAAG,CAAWE,OAAO,EAAE,CAAC;IAC/D;IACA,IAAIC,IAAS;IACb,IAAI;MACAA,IAAI,GAAG,MAAML,QAAQ,CAACK,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC,MAAM;MACJ,MAAM,IAAIF,KAAK,CAAC,2CAA2C,CAAC;IAChE;;IAEA;IACA,IAAIH,QAAQ,CAACM,MAAM,KAAK,GAAG,EAAE;MACzB,MAAM;QAAEF,OAAO,EAAEC,IAAI,CAACD,OAAO;QAAEG,IAAI,EAAEF,IAAI,CAACE;MAAK,CAAC;IACpD;;IAEA;IACA,IAAIF,IAAI,CAACG,MAAM,IAAIH,IAAI,CAACG,MAAM,CAACC,MAAM,GAAG,CAAC,EAAE;MACvC,MAAM,IAAIN,KAAK,CAAC,gBAAgB,EAAE;QAAEO,KAAK,EAAEL,IAAI,CAACG;MAAO,CAAC,CAAC;IAC7D;IACA,OAAOH,IAAI,CAACM,IAAI;EACpB;AACJ;AAEA,OAAO,MAAMC,kBAAkB,GAAGlC,oBAAoB,CAAC;EACnDmC,WAAW,EAAElC,aAAa;EAC1BmC,cAAc,EAAEhC,iBAAiB;EACjCiC,YAAY,EAAE,CAACnC,SAAS;AAC5B,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import { GraphQLClient } from "./abstractions.js";
2
+ import { EventPublisher } from "../../features/eventPublisher/index.js";
3
+ declare class NetworkErrorPublishingDecorator implements GraphQLClient.Interface {
4
+ private eventPublisher;
5
+ private decoratee;
6
+ constructor(eventPublisher: EventPublisher.Interface, decoratee: GraphQLClient.Interface);
7
+ execute<TResult = any, TVariables = any>(params: GraphQLClient.Request<TVariables>): Promise<TResult>;
8
+ private isNetworkError;
9
+ private determineErrorType;
10
+ }
11
+ export declare const NetworkErrorPublishing: typeof NetworkErrorPublishingDecorator & {
12
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGraphQLClient>;
13
+ };
14
+ export {};
@@ -0,0 +1,55 @@
1
+ import { GraphQLClient } from "./abstractions.js";
2
+ import { EventPublisher } from "../eventPublisher/index.js";
3
+ import { NetworkErrorEvent } from "../../errors/index.js";
4
+ import { RequestValue } from "./RequestValue.js";
5
+ class NetworkErrorPublishingDecorator {
6
+ constructor(eventPublisher, decoratee) {
7
+ this.eventPublisher = eventPublisher;
8
+ this.decoratee = decoratee;
9
+ }
10
+ async execute(params) {
11
+ try {
12
+ return await this.decoratee.execute(params);
13
+ } catch (error) {
14
+ // Only publish network errors, not GraphQL errors
15
+ if (this.isNetworkError(error)) {
16
+ const request = RequestValue.from(params);
17
+ const event = new NetworkErrorEvent({
18
+ message: error.message,
19
+ code: error.code ?? undefined,
20
+ operationName: request.operationName,
21
+ query: request.queryAsString,
22
+ variables: request.variables,
23
+ errorType: this.determineErrorType(error)
24
+ });
25
+ await this.eventPublisher.publish(event);
26
+ }
27
+
28
+ // Re-throw to preserve existing behavior
29
+ throw error;
30
+ }
31
+ }
32
+ isNetworkError(error) {
33
+ // Network errors typically have these patterns in the message
34
+ return error.message.includes("Tenant is disabled") || error.message.includes("Network error") || error.message.includes("Failed to fetch") || error.message.includes("network failure") || error.message.includes("Local AWS Lambda");
35
+ }
36
+ determineErrorType(error) {
37
+ const message = error.message.toLowerCase();
38
+ if (message.includes("timeout")) {
39
+ return "timeout";
40
+ }
41
+ if (message.includes("fetch") || message.includes("failed to fetch")) {
42
+ return "fetch";
43
+ }
44
+ if (message.includes("network")) {
45
+ return "network";
46
+ }
47
+ return "unknown";
48
+ }
49
+ }
50
+ export const NetworkErrorPublishing = GraphQLClient.createDecorator({
51
+ decorator: NetworkErrorPublishingDecorator,
52
+ dependencies: [EventPublisher]
53
+ });
54
+
55
+ //# sourceMappingURL=NetworkErrorPublishing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GraphQLClient","EventPublisher","NetworkErrorEvent","RequestValue","NetworkErrorPublishingDecorator","constructor","eventPublisher","decoratee","execute","params","error","isNetworkError","request","from","event","message","code","undefined","operationName","query","queryAsString","variables","errorType","determineErrorType","publish","includes","toLowerCase","NetworkErrorPublishing","createDecorator","decorator","dependencies"],"sources":["NetworkErrorPublishing.ts"],"sourcesContent":["import { GraphQLClient } from \"./abstractions.js\";\nimport { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { NetworkErrorEvent } from \"~/errors/index.js\";\nimport { RequestValue } from \"./RequestValue.js\";\n\nclass NetworkErrorPublishingDecorator implements GraphQLClient.Interface {\n constructor(\n private eventPublisher: EventPublisher.Interface,\n private decoratee: GraphQLClient.Interface\n ) {}\n\n async execute<TResult = any, TVariables = any>(\n params: GraphQLClient.Request<TVariables>\n ): Promise<TResult> {\n try {\n return await this.decoratee.execute(params);\n } catch (error) {\n // Only publish network errors, not GraphQL errors\n if (this.isNetworkError(error as Error)) {\n const request = RequestValue.from(params);\n\n const event = new NetworkErrorEvent({\n message: (error as Error).message,\n code: error.code ?? undefined,\n operationName: request.operationName,\n query: request.queryAsString,\n variables: request.variables,\n errorType: this.determineErrorType(error as Error)\n });\n\n await this.eventPublisher.publish(event);\n }\n\n // Re-throw to preserve existing behavior\n throw error;\n }\n }\n\n private isNetworkError(error: Error): boolean {\n // Network errors typically have these patterns in the message\n return (\n error.message.includes(\"Tenant is disabled\") ||\n error.message.includes(\"Network error\") ||\n error.message.includes(\"Failed to fetch\") ||\n error.message.includes(\"network failure\") ||\n error.message.includes(\"Local AWS Lambda\")\n );\n }\n\n private determineErrorType(error: Error): \"network\" | \"timeout\" | \"fetch\" | \"unknown\" {\n const message = error.message.toLowerCase();\n\n if (message.includes(\"timeout\")) {\n return \"timeout\";\n }\n\n if (message.includes(\"fetch\") || message.includes(\"failed to fetch\")) {\n return \"fetch\";\n }\n\n if (message.includes(\"network\")) {\n return \"network\";\n }\n\n return \"unknown\";\n }\n}\n\nexport const NetworkErrorPublishing = GraphQLClient.createDecorator({\n decorator: NetworkErrorPublishingDecorator,\n dependencies: [EventPublisher]\n});\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,cAAc;AACvB,SAASC,iBAAiB;AAC1B,SAASC,YAAY;AAErB,MAAMC,+BAA+B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AClF,MAAMK,OAAO,GAAGL,KAAK,CAACK,OAAO,CAACW,WAAW,CAAC,CAAC;IAE3C,IAAIX,OAAO,CAACU,QAAQ,CAAC,SAAS,CAAC,EAAE;MAC7B,OAAO,SAAS;IACpB;IAEA,IAAIV,OAAO,CAACU,QAAQ,CAAC,OAAO,CAAC,IAAIV,OAAO,CAACU,QAAQ,CAAC,iBAAiB,CAAC,EAAE;MAClE,OAAO,OAAO;IAClB;IAEA,IAAIV,OAAO,CAACU,QAAQ,CAAC,SAAS,CAAC,EAAE;MAC7B,OAAO,SAAS;IACpB;IAEA,OAAO,SAAS;EACpB;AACJ;AAEA,OAAO,MAAME,sBAAsB,GAAG3B,aAAa,CAAC4B,eAAe,CAAC;EAChEC,SAAS,EAAEzB,+BAA+B;EAC1C0B,YAAY,EAAE,CAAC7B,cAAc;AACjC,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ import { type DocumentNode } from "graphql";
2
+ import { GraphQLClient } from "./abstractions.js";
3
+ export declare class RequestValue {
4
+ readonly value: GraphQLClient.Request;
5
+ private readonly _operationName;
6
+ private readonly _queryAsString;
7
+ private readonly _queryAsDocumentNode;
8
+ private readonly _request;
9
+ static from(value: GraphQLClient.Request): RequestValue;
10
+ private constructor();
11
+ get request(): GraphQLClient.Request<any>;
12
+ get variables(): any;
13
+ get queryAsString(): string;
14
+ get queryAsDocumentNode(): DocumentNode;
15
+ get headers(): {
16
+ [x: string]: string | number | undefined;
17
+ } | undefined;
18
+ get operationName(): string | undefined;
19
+ private getOperationName;
20
+ }
@@ -0,0 +1,42 @@
1
+ import { getOperationAST, parse, print } from "graphql";
2
+ export class RequestValue {
3
+ static from(value) {
4
+ return new RequestValue(value);
5
+ }
6
+ constructor(value) {
7
+ this.value = value;
8
+ this._request = value;
9
+ if (typeof value.query === "string") {
10
+ this._queryAsString = value.query;
11
+ this._queryAsDocumentNode = parse(value.query);
12
+ } else {
13
+ this._queryAsString = print(value.query);
14
+ this._queryAsDocumentNode = value.query;
15
+ }
16
+ this._operationName = this.getOperationName(this._queryAsDocumentNode);
17
+ }
18
+ get request() {
19
+ return this._request;
20
+ }
21
+ get variables() {
22
+ return this._request.variables;
23
+ }
24
+ get queryAsString() {
25
+ return this._queryAsString;
26
+ }
27
+ get queryAsDocumentNode() {
28
+ return this._queryAsDocumentNode;
29
+ }
30
+ get headers() {
31
+ return this._request.headers;
32
+ }
33
+ get operationName() {
34
+ return this._operationName;
35
+ }
36
+ getOperationName(query) {
37
+ const operationAST = getOperationAST(query, undefined);
38
+ return operationAST?.name?.value;
39
+ }
40
+ }
41
+
42
+ //# sourceMappingURL=RequestValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getOperationAST","parse","print","RequestValue","from","value","constructor","_request","query","_queryAsString","_queryAsDocumentNode","_operationName","getOperationName","request","variables","queryAsString","queryAsDocumentNode","headers","operationName","operationAST","undefined","name"],"sources":["RequestValue.ts"],"sourcesContent":["import { getOperationAST, parse, print, type DocumentNode } from \"graphql\";\nimport { GraphQLClient } from \"./abstractions.js\";\n\nexport class RequestValue {\n private readonly _operationName: string | undefined;\n private readonly _queryAsString: string;\n private readonly _queryAsDocumentNode: DocumentNode;\n private readonly _request: GraphQLClient.Request;\n\n static from(value: GraphQLClient.Request) {\n return new RequestValue(value);\n }\n\n private constructor(readonly value: GraphQLClient.Request) {\n this._request = value;\n if (typeof value.query === \"string\") {\n this._queryAsString = value.query;\n this._queryAsDocumentNode = parse(value.query);\n } else {\n this._queryAsString = print(value.query);\n this._queryAsDocumentNode = value.query;\n }\n\n this._operationName = this.getOperationName(this._queryAsDocumentNode);\n }\n\n get request() {\n return this._request;\n }\n\n get variables() {\n return this._request.variables;\n }\n\n get queryAsString() {\n return this._queryAsString;\n }\n\n get queryAsDocumentNode() {\n return this._queryAsDocumentNode;\n }\n\n get headers() {\n return this._request.headers;\n }\n\n get operationName() {\n return this._operationName;\n }\n\n private getOperationName(query: DocumentNode): string | undefined {\n const operationAST = getOperationAST(query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MAAMW,YAAY,GAAGnB,eAAe,CAACQ,KAAK,EAAEY,SAAS,CAAC;IACtD,OAAOD,YAAY,EAAEE,IAAI,EAAEhB,KAAK;EACpC;AACJ","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import { GraphQLClient } from "./abstractions.js";
2
+ import { EnvConfig } from "../../features/envConfig/index.js";
3
+ declare class RetryGraphQLClientImpl implements GraphQLClient.Interface {
4
+ private decoratee;
5
+ private readonly maxRetries;
6
+ private readonly baseDelayMs;
7
+ constructor(envConfig: EnvConfig.Interface, decoratee: GraphQLClient.Interface);
8
+ execute<TResult = any, TVariables = any>(params: GraphQLClient.Request<TVariables>): Promise<TResult>;
9
+ private isGraphQLError;
10
+ private isAuthenticationError;
11
+ private isMaintenanceError;
12
+ private calculateBackoff;
13
+ private delay;
14
+ }
15
+ export declare const RetryGraphQLClient: typeof RetryGraphQLClientImpl & {
16
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGraphQLClient>;
17
+ };
18
+ export {};
@@ -0,0 +1,54 @@
1
+ import { GraphQLClient } from "./abstractions.js";
2
+ import { EnvConfig } from "../envConfig/index.js";
3
+ class RetryGraphQLClientImpl {
4
+ constructor(envConfig, decoratee) {
5
+ this.decoratee = decoratee;
6
+ const gqlClientConfig = envConfig.get("graphqlClient");
7
+ this.maxRetries = gqlClientConfig?.retries.maxRetries ?? 3;
8
+ this.baseDelayMs = gqlClientConfig?.retries.delayInMillis ?? 100;
9
+ }
10
+ async execute(params) {
11
+ let lastError;
12
+ for (let attempt = 0; attempt <= this.maxRetries; attempt++) {
13
+ try {
14
+ return await this.decoratee.execute(params);
15
+ } catch (error) {
16
+ lastError = error;
17
+
18
+ // Don't retry GraphQL errors (business logic errors)
19
+ // Only retry network/infrastructure errors
20
+ if (this.isGraphQLError(error) || this.isAuthenticationError(error) || this.isMaintenanceError(error)) {
21
+ throw error;
22
+ }
23
+
24
+ // Don't delay after the last attempt
25
+ if (attempt < this.maxRetries) {
26
+ await this.delay(this.calculateBackoff(attempt));
27
+ }
28
+ }
29
+ }
30
+ throw lastError;
31
+ }
32
+ isGraphQLError(error) {
33
+ return error.message.includes("GraphQL");
34
+ }
35
+ isAuthenticationError(error) {
36
+ return error.code?.includes("Authentication/");
37
+ }
38
+ isMaintenanceError(error) {
39
+ return error.code?.includes("Tenancy/");
40
+ }
41
+ calculateBackoff(attempt) {
42
+ // Exponential backoff: 100ms, 200ms, 400ms, etc.
43
+ return Math.pow(2, attempt) * this.baseDelayMs;
44
+ }
45
+ delay(ms) {
46
+ return new Promise(resolve => setTimeout(resolve, ms));
47
+ }
48
+ }
49
+ export const RetryGraphQLClient = GraphQLClient.createDecorator({
50
+ decorator: RetryGraphQLClientImpl,
51
+ dependencies: [EnvConfig]
52
+ });
53
+
54
+ //# sourceMappingURL=RetryGraphQLClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GraphQLClient","EnvConfig","RetryGraphQLClientImpl","constructor","envConfig","decoratee","gqlClientConfig","get","maxRetries","retries","baseDelayMs","delayInMillis","execute","params","lastError","attempt","error","isGraphQLError","isAuthenticationError","isMaintenanceError","delay","calculateBackoff","message","includes","code","Math","pow","ms","Promise","resolve","setTimeout","RetryGraphQLClient","createDecorator","decorator","dependencies"],"sources":["RetryGraphQLClient.ts"],"sourcesContent":["import { BaseError } from \"@webiny/feature/admin\";\nimport { GraphQLClient } from \"./abstractions.js\";\nimport { EnvConfig } from \"~/features/envConfig/index.js\";\n\nclass RetryGraphQLClientImpl implements GraphQLClient.Interface {\n private readonly maxRetries: number;\n private readonly baseDelayMs: number;\n\n constructor(\n envConfig: EnvConfig.Interface,\n private decoratee: GraphQLClient.Interface\n ) {\n const gqlClientConfig = envConfig.get(\"graphqlClient\");\n\n this.maxRetries = gqlClientConfig?.retries.maxRetries ?? 3;\n this.baseDelayMs = gqlClientConfig?.retries.delayInMillis ?? 100;\n }\n\n async execute<TResult = any, TVariables = any>(\n params: GraphQLClient.Request<TVariables>\n ): Promise<TResult> {\n let lastError: Error | undefined;\n\n for (let attempt = 0; attempt <= this.maxRetries; attempt++) {\n try {\n return await this.decoratee.execute(params);\n } catch (error) {\n lastError = error as Error;\n\n // Don't retry GraphQL errors (business logic errors)\n // Only retry network/infrastructure errors\n if (\n this.isGraphQLError(error as Error) ||\n this.isAuthenticationError(error as BaseError) ||\n this.isMaintenanceError(error as BaseError)\n ) {\n throw error;\n }\n\n // Don't delay after the last attempt\n if (attempt < this.maxRetries) {\n await this.delay(this.calculateBackoff(attempt));\n }\n }\n }\n\n throw lastError!;\n }\n\n private isGraphQLError(error: Error): boolean {\n return error.message.includes(\"GraphQL\");\n }\n\n private isAuthenticationError(error: BaseError): boolean {\n return error.code?.includes(\"Authentication/\");\n }\n\n private isMaintenanceError(error: BaseError): boolean {\n return error.code?.includes(\"Tenancy/\");\n }\n\n private calculateBackoff(attempt: number): number {\n // Exponential backoff: 100ms, 200ms, 400ms, etc.\n return Math.pow(2, attempt) * this.baseDelayMs;\n }\n\n private delay(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n }\n}\n\nexport const RetryGraphQLClient = GraphQLClient.createDecorator({\n decorator: RetryGraphQLClientImpl,\n dependencies: [EnvConfig]\n});\n"],"mappings":"AACA,SAASA,aAAa;AACtB,SAASC,SAAS;AAElB,MAAMC,sBAAsB,CAAoC;EAI5DC,WAAWA,CACPC,SAA8B,EACtBC,SAAkC,EAC5C;IAAA,KADUA,SAAkC,GAAlCA,SAAkC;IAE1C,MAAMC,eAAe,GAAGF,SAAS,CAACG,GAAG,CAAC,eAAe,CAAC;IAEtD,IAAI,CAACC,UAAU,GAAGF,eAAe,EAAEG,OAAO,CAACD,UAAU,IAAI,CAAC;IAC1D,IAAI,CAACE,WAAW,GAAGJ,eAAe,EAAEG,OAAO,CAACE,aAAa,IAAI,GAAG;EACpE;EAEA,MAAMC,OAAOA,CACTC,MAAyC,EACzB;IAChB,IAAIC,SAA4B;IAEhC,KAAK,IAAIC,OAAO,GAAG,CAAC,E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