@webiny/app 6.3.0-beta.4 → 6.4.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 (276) hide show
  1. package/App.js +70 -77
  2. package/App.js.map +1 -1
  3. package/AppContainer.js +3 -6
  4. package/AppContainer.js.map +1 -1
  5. package/apollo-client/InMemoryCache.js +11 -13
  6. package/apollo-client/InMemoryCache.js.map +1 -1
  7. package/apollo-client/IntrospectionFragmentMatcher.js +26 -38
  8. package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -1
  9. package/components/Image.js +11 -17
  10. package/components/Image.js.map +1 -1
  11. package/components/index.js +0 -2
  12. package/config/RouterConfig/Route.js +23 -28
  13. package/config/RouterConfig/Route.js.map +1 -1
  14. package/config/RouterConfig.js +11 -10
  15. package/config/RouterConfig.js.map +1 -1
  16. package/config.js +19 -20
  17. package/config.js.map +1 -1
  18. package/contexts/Ui/index.js +26 -28
  19. package/contexts/Ui/index.js.map +1 -1
  20. package/core/Plugin.js +7 -9
  21. package/core/Plugin.js.map +1 -1
  22. package/core/Plugins.js +15 -34
  23. package/core/Plugins.js.map +1 -1
  24. package/core/Provider.js +5 -13
  25. package/core/Provider.js.map +1 -1
  26. package/core/createProvider.js +3 -6
  27. package/core/createProvider.js.map +1 -1
  28. package/core/createProviderPlugin.js +8 -13
  29. package/core/createProviderPlugin.js.map +1 -1
  30. package/errors/AuthenticationErrorEvent.js +8 -5
  31. package/errors/AuthenticationErrorEvent.js.map +1 -1
  32. package/errors/NetworkErrorEvent.js +8 -5
  33. package/errors/NetworkErrorEvent.js.map +1 -1
  34. package/errors/abstractions.js +3 -2
  35. package/errors/abstractions.js.map +1 -1
  36. package/errors/index.js +1 -4
  37. package/exports/admin/env-config.js +0 -2
  38. package/exports/admin/graphql-client.js +0 -2
  39. package/exports/admin/local-storage.js +0 -2
  40. package/exports/admin/router.js +0 -2
  41. package/exports/admin/security.js +0 -2
  42. package/exports/admin.js +0 -2
  43. package/features/envConfig/EnvConfig.js +12 -13
  44. package/features/envConfig/EnvConfig.js.map +1 -1
  45. package/features/envConfig/abstractions.js +2 -1
  46. package/features/envConfig/abstractions.js.map +1 -1
  47. package/features/envConfig/feature.js +9 -8
  48. package/features/envConfig/feature.js.map +1 -1
  49. package/features/envConfig/index.js +0 -2
  50. package/features/eventPublisher/EventPublisher.js +13 -21
  51. package/features/eventPublisher/EventPublisher.js.map +1 -1
  52. package/features/eventPublisher/abstractions.js +7 -9
  53. package/features/eventPublisher/abstractions.js.map +1 -1
  54. package/features/eventPublisher/feature.js +13 -12
  55. package/features/eventPublisher/feature.js.map +1 -1
  56. package/features/eventPublisher/index.js +1 -3
  57. package/features/graphqlClient/AuthenticationErrorPublishing.js +26 -26
  58. package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -1
  59. package/features/graphqlClient/BatchingGraphQLClient.js +104 -149
  60. package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -1
  61. package/features/graphqlClient/FetchGraphQLClient.js +41 -48
  62. package/features/graphqlClient/FetchGraphQLClient.js.map +1 -1
  63. package/features/graphqlClient/NetworkErrorPublishing.js +35 -42
  64. package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -1
  65. package/features/graphqlClient/RequestValue.js +42 -41
  66. package/features/graphqlClient/RequestValue.js.map +1 -1
  67. package/features/graphqlClient/RetryGraphQLClient.js +36 -45
  68. package/features/graphqlClient/RetryGraphQLClient.js.map +1 -1
  69. package/features/graphqlClient/__tests__/GraphQLClient.test.js +383 -356
  70. package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -1
  71. package/features/graphqlClient/abstractions.js +2 -1
  72. package/features/graphqlClient/abstractions.js.map +1 -1
  73. package/features/graphqlClient/feature.js +14 -20
  74. package/features/graphqlClient/feature.js.map +1 -1
  75. package/features/graphqlClient/index.js +0 -2
  76. package/features/graphqlClient/types.js +0 -3
  77. package/features/localStorage/BrowserLocalStorageGateway.js +56 -63
  78. package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -1
  79. package/features/localStorage/LocalStorage.js +27 -24
  80. package/features/localStorage/LocalStorage.js.map +1 -1
  81. package/features/localStorage/LocalStorageRepository.js +75 -88
  82. package/features/localStorage/LocalStorageRepository.js.map +1 -1
  83. package/features/localStorage/abstractions.js +5 -16
  84. package/features/localStorage/abstractions.js.map +1 -1
  85. package/features/localStorage/feature.js +17 -28
  86. package/features/localStorage/feature.js.map +1 -1
  87. package/features/localStorage/index.js +1 -3
  88. package/features/mainGraphQLClient/MainGraphQLClient.js +18 -14
  89. package/features/mainGraphQLClient/MainGraphQLClient.js.map +1 -1
  90. package/features/mainGraphQLClient/abstractions.js +2 -1
  91. package/features/mainGraphQLClient/abstractions.js.map +1 -1
  92. package/features/mainGraphQLClient/feature.js +11 -10
  93. package/features/mainGraphQLClient/feature.js.map +1 -1
  94. package/features/mainGraphQLClient/index.js +0 -2
  95. package/features/router/HistoryRouterGateway.js +75 -105
  96. package/features/router/HistoryRouterGateway.js.map +1 -1
  97. package/features/router/HistoryRouterGateway.test.js +184 -193
  98. package/features/router/HistoryRouterGateway.test.js.map +1 -1
  99. package/features/router/Route.js +38 -54
  100. package/features/router/Route.js.map +1 -1
  101. package/features/router/RouteUrl.js +84 -217
  102. package/features/router/RouteUrl.js.map +1 -1
  103. package/features/router/Router.js +67 -124
  104. package/features/router/Router.js.map +1 -1
  105. package/features/router/RouterPresenter.js +44 -49
  106. package/features/router/RouterPresenter.js.map +1 -1
  107. package/features/router/RouterRepository.js +103 -111
  108. package/features/router/RouterRepository.js.map +1 -1
  109. package/features/router/RouterRepository.test.js +119 -150
  110. package/features/router/RouterRepository.test.js.map +1 -1
  111. package/features/router/abstractions.js +4 -14
  112. package/features/router/abstractions.js.map +1 -1
  113. package/features/router/feature.js +13 -12
  114. package/features/router/feature.js.map +1 -1
  115. package/features/router/index.js +1 -3
  116. package/helpers/InterfaceGenerator/date.js +0 -3
  117. package/helpers/InterfaceGenerator/id.js +0 -3
  118. package/helpers/InterfaceGenerator/identity.js +0 -3
  119. package/helpers/InterfaceGenerator/index.js +0 -3
  120. package/helpers/InterfaceGenerator/numeric.js +0 -3
  121. package/helpers/InterfaceGenerator/truthful.js +0 -3
  122. package/hooks/useAutocomplete/index.js +0 -2
  123. package/hooks/useAutocomplete/useAutocomplete.js +12 -15
  124. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
  125. package/hooks/useDataList/functions/getData.js +2 -1
  126. package/hooks/useDataList/functions/getData.js.map +1 -1
  127. package/hooks/useDataList/functions/getError.js +2 -1
  128. package/hooks/useDataList/functions/getError.js.map +1 -1
  129. package/hooks/useDataList/functions/getMeta.js +2 -1
  130. package/hooks/useDataList/functions/getMeta.js.map +1 -1
  131. package/hooks/useDataList/functions/index.js +0 -2
  132. package/hooks/useDataList/functions/searchDataByKey.js +9 -14
  133. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
  134. package/hooks/useDataList/index.js +0 -2
  135. package/hooks/useDataList/useDataList.js +131 -152
  136. package/hooks/useDataList/useDataList.js.map +1 -1
  137. package/hooks/useDataList/utils/index.js +0 -2
  138. package/hooks/useDataList/utils/prepareLoadListParams.js +25 -34
  139. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
  140. package/hooks/useHandler.js +12 -16
  141. package/hooks/useHandler.js.map +1 -1
  142. package/hooks/useHandlers.js +18 -20
  143. package/hooks/useHandlers.js.map +1 -1
  144. package/hooks/useRegisterLegacyPlugin.js +7 -6
  145. package/hooks/useRegisterLegacyPlugin.js.map +1 -1
  146. package/hooks/useUi.js +2 -3
  147. package/hooks/useUi.js.map +1 -1
  148. package/i18n/i18n.js +8 -4
  149. package/i18n/i18n.js.map +1 -1
  150. package/i18n/index.js +0 -2
  151. package/index.js +6 -11
  152. package/package.json +13 -13
  153. package/plugins/AddQuerySelectionPlugin.js +36 -61
  154. package/plugins/AddQuerySelectionPlugin.js.map +1 -1
  155. package/plugins/ApolloCacheObjectIdPlugin.js +12 -11
  156. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
  157. package/plugins/ApolloDynamicLink.js +20 -22
  158. package/plugins/ApolloDynamicLink.js.map +1 -1
  159. package/plugins/ApolloLinkPlugin.js +16 -15
  160. package/plugins/ApolloLinkPlugin.js.map +1 -1
  161. package/plugins/ConsoleLinkPlugin.js +19 -21
  162. package/plugins/ConsoleLinkPlugin.js.map +1 -1
  163. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +39 -45
  164. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
  165. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +18 -22
  166. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -1
  167. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +21 -29
  168. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -1
  169. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +6 -15
  170. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
  171. package/plugins/NetworkErrorLinkPlugin/Typography.js +9 -14
  172. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -1
  173. package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js +19 -0
  174. package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js.map +1 -0
  175. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +11 -18
  176. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
  177. package/plugins/NetworkErrorLinkPlugin.js +41 -58
  178. package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
  179. package/plugins/OmitTypenameLinkPlugin.js +9 -14
  180. package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
  181. package/plugins/TenantHeaderLinkPlugin.js +23 -32
  182. package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
  183. package/plugins/components/Image.js +8 -15
  184. package/plugins/components/Image.js.map +1 -1
  185. package/plugins/image.js +94 -133
  186. package/plugins/image.js.map +1 -1
  187. package/plugins/index.js +35 -59
  188. package/plugins/index.js.map +1 -1
  189. package/presentation/envConfig/useEnvConfig.js +4 -8
  190. package/presentation/envConfig/useEnvConfig.js.map +1 -1
  191. package/presentation/localStorage/index.js +0 -2
  192. package/presentation/localStorage/useLocalStorage.js +10 -16
  193. package/presentation/localStorage/useLocalStorage.js.map +1 -1
  194. package/presentation/localStorage/useLocalStorageValue.js +15 -13
  195. package/presentation/localStorage/useLocalStorageValue.js.map +1 -1
  196. package/presentation/localStorage/useLocalStorageValues.js +23 -30
  197. package/presentation/localStorage/useLocalStorageValues.js.map +1 -1
  198. package/presentation/router/RouteElementRegistry.js +22 -25
  199. package/presentation/router/RouteElementRegistry.js.map +1 -1
  200. package/presentation/router/abstractions.js +2 -1
  201. package/presentation/router/abstractions.js.map +1 -1
  202. package/presentation/router/components/Redirect.js +8 -10
  203. package/presentation/router/components/Redirect.js.map +1 -1
  204. package/presentation/router/components/RouteContent.js +14 -17
  205. package/presentation/router/components/RouteContent.js.map +1 -1
  206. package/presentation/router/components/RouteLink.js +11 -16
  207. package/presentation/router/components/RouteLink.js.map +1 -1
  208. package/presentation/router/components/SimpleLink.js +18 -24
  209. package/presentation/router/components/SimpleLink.js.map +1 -1
  210. package/presentation/router/hooks/useRoute.js +15 -23
  211. package/presentation/router/hooks/useRoute.js.map +1 -1
  212. package/presentation/router/hooks/useRouter.js +22 -23
  213. package/presentation/router/hooks/useRouter.js.map +1 -1
  214. package/presentation/router/index.js +0 -2
  215. package/presentation/router/types.js +0 -3
  216. package/react-butterfiles/Files.js +148 -217
  217. package/react-butterfiles/Files.js.map +1 -1
  218. package/react-butterfiles/index.js +2 -1
  219. package/react-butterfiles/index.js.map +1 -1
  220. package/react-butterfiles/utils/generateId.js +2 -3
  221. package/react-butterfiles/utils/generateId.js.map +1 -1
  222. package/react-butterfiles/utils/readFileContent.js +9 -13
  223. package/react-butterfiles/utils/readFileContent.js.map +1 -1
  224. package/renderApp.js +7 -6
  225. package/renderApp.js.map +1 -1
  226. package/router.js +0 -3
  227. package/rslib-runtime.js +14 -0
  228. package/rslib-runtime.js.map +1 -0
  229. package/shared/di/DiContainerProvider.js +8 -12
  230. package/shared/di/DiContainerProvider.js.map +1 -1
  231. package/shared/di/createFeature.js +7 -8
  232. package/shared/di/createFeature.js.map +1 -1
  233. package/shared/di/useFeature.js +7 -3
  234. package/shared/di/useFeature.js.map +1 -1
  235. package/static/svg/close_24px.33adaadc.svg +1 -0
  236. package/types.js +0 -3
  237. package/utils/createGenericContext.js +17 -21
  238. package/utils/createGenericContext.js.map +1 -1
  239. package/utils/createHashing.js +13 -16
  240. package/utils/createHashing.js.map +1 -1
  241. package/utils/index.js +0 -2
  242. package/utils/legacyPluginToReactComponent.js +11 -10
  243. package/utils/legacyPluginToReactComponent.js.map +1 -1
  244. package/components/index.js.map +0 -1
  245. package/errors/index.js.map +0 -1
  246. package/exports/admin/env-config.js.map +0 -1
  247. package/exports/admin/graphql-client.js.map +0 -1
  248. package/exports/admin/local-storage.js.map +0 -1
  249. package/exports/admin/router.js.map +0 -1
  250. package/exports/admin/security.js.map +0 -1
  251. package/exports/admin.js.map +0 -1
  252. package/features/envConfig/index.js.map +0 -1
  253. package/features/eventPublisher/index.js.map +0 -1
  254. package/features/graphqlClient/index.js.map +0 -1
  255. package/features/graphqlClient/types.js.map +0 -1
  256. package/features/localStorage/index.js.map +0 -1
  257. package/features/mainGraphQLClient/index.js.map +0 -1
  258. package/features/router/index.js.map +0 -1
  259. package/helpers/InterfaceGenerator/date.js.map +0 -1
  260. package/helpers/InterfaceGenerator/id.js.map +0 -1
  261. package/helpers/InterfaceGenerator/identity.js.map +0 -1
  262. package/helpers/InterfaceGenerator/index.js.map +0 -1
  263. package/helpers/InterfaceGenerator/numeric.js.map +0 -1
  264. package/helpers/InterfaceGenerator/truthful.js.map +0 -1
  265. package/hooks/useAutocomplete/index.js.map +0 -1
  266. package/hooks/useDataList/functions/index.js.map +0 -1
  267. package/hooks/useDataList/index.js.map +0 -1
  268. package/hooks/useDataList/utils/index.js.map +0 -1
  269. package/i18n/index.js.map +0 -1
  270. package/index.js.map +0 -1
  271. package/presentation/localStorage/index.js.map +0 -1
  272. package/presentation/router/index.js.map +0 -1
  273. package/presentation/router/types.js.map +0 -1
  274. package/router.js.map +0 -1
  275. package/types.js.map +0 -1
  276. package/utils/index.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/app",
3
- "version": "6.3.0-beta.4",
3
+ "version": "6.4.0-beta.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -22,12 +22,12 @@
22
22
  "@emotion/styled": "11.14.1",
23
23
  "@types/react": "18.3.28",
24
24
  "@webiny/di": "0.2.3",
25
- "@webiny/feature": "6.3.0-beta.4",
26
- "@webiny/i18n": "6.3.0-beta.4",
27
- "@webiny/i18n-react": "6.3.0-beta.4",
28
- "@webiny/plugins": "6.3.0-beta.4",
29
- "@webiny/react-composition": "6.3.0-beta.4",
30
- "@webiny/react-properties": "6.3.0-beta.4",
25
+ "@webiny/feature": "6.4.0-beta.0",
26
+ "@webiny/i18n": "6.4.0-beta.0",
27
+ "@webiny/i18n-react": "6.4.0-beta.0",
28
+ "@webiny/plugins": "6.4.0-beta.0",
29
+ "@webiny/react-composition": "6.4.0-beta.0",
30
+ "@webiny/react-properties": "6.4.0-beta.0",
31
31
  "apollo-cache": "1.3.5",
32
32
  "apollo-cache-inmemory": "1.6.6",
33
33
  "apollo-client": "2.6.10",
@@ -38,27 +38,27 @@
38
38
  "apollo-utilities": "1.3.4",
39
39
  "boolean": "3.2.0",
40
40
  "bytes": "3.1.2",
41
- "graphql": "16.13.2",
41
+ "graphql": "16.14.0",
42
42
  "history": "5.3.0",
43
43
  "invariant": "2.2.4",
44
44
  "lodash": "4.18.1",
45
45
  "minimatch": "10.2.5",
46
- "mobx": "6.15.1",
46
+ "mobx": "6.15.3",
47
47
  "nanoid": "5.1.11",
48
48
  "react": "18.3.1",
49
49
  "react-dom": "18.3.1",
50
50
  "ts-invariant": "0.10.3",
51
51
  "warning": "4.0.3",
52
- "zod": "4.3.6"
52
+ "zod": "4.4.3"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/lodash": "4.17.24",
56
56
  "@types/warning": "3.0.4",
57
- "@webiny/build-tools": "6.3.0-beta.4",
57
+ "@webiny/build-tools": "6.4.0-beta.0",
58
58
  "rimraf": "6.1.3",
59
59
  "type-fest": "5.6.0",
60
60
  "typescript": "6.0.3",
61
- "vitest": "4.1.5"
61
+ "vitest": "4.1.6"
62
62
  },
63
63
  "publishConfig": {
64
64
  "access": "public",
@@ -71,5 +71,5 @@
71
71
  ]
72
72
  }
73
73
  },
74
- "gitHead": "7cefe15431dbd65504e1f58147dc9e55bcbfa693"
74
+ "gitHead": "a545d7529828af07d08d49c3da1bcb967483b9ce"
75
75
  }
@@ -1,72 +1,47 @@
1
1
  import { ApolloLink } from "apollo-link";
2
2
  import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
3
- export class AddQuerySelectionPlugin extends ApolloLinkPlugin {
4
- constructor(config) {
5
- super();
6
- this.config = config;
7
- }
8
- createLink() {
9
- return new ApolloLink((operation, forward) => {
10
- if (operation.operationName !== this.config.operationName) {
11
- return forward(operation);
12
- }
13
- this.addSelectionToQuery(operation.operationName, operation.query);
14
- return forward(operation);
15
- });
16
- }
17
- addSelectionToQuery(operationName, document) {
18
- if (operationName !== this.config.operationName) {
19
- return;
3
+ class AddQuerySelectionPlugin extends ApolloLinkPlugin {
4
+ constructor(config){
5
+ super();
6
+ this.config = config;
20
7
  }
21
-
22
- // If this plugin already processed the given document (documents are always passed by reference),
23
- // then we don't want to apply the selection again, to avoid adding duplicate selections.
24
- if (this.isProcessed(document)) {
25
- return;
26
- }
27
- this.markProcessed(document);
28
- const {
29
- addSelection,
30
- selectionPath
31
- } = this.config;
32
- const firstQueryDefinition = document.definitions[0];
33
- if (!firstQueryDefinition) {
34
- return;
35
- } else if (!firstQueryDefinition.selectionSet) {
36
- return;
8
+ createLink() {
9
+ return new ApolloLink((operation, forward)=>{
10
+ if (operation.operationName !== this.config.operationName) return forward(operation);
11
+ this.addSelectionToQuery(operation.operationName, operation.query);
12
+ return forward(operation);
13
+ });
37
14
  }
38
- let tree = firstQueryDefinition.selectionSet.selections;
39
- const fields = selectionPath.split(".");
40
- fieldLoop: for (const field of fields) {
41
- for (const selection of tree) {
42
- if (!selection.selectionSet) {
43
- continue;
44
- }
45
- if (selection.name.value === field) {
46
- tree = selection.selectionSet.selections;
47
- continue fieldLoop;
15
+ addSelectionToQuery(operationName, document) {
16
+ if (operationName !== this.config.operationName) return;
17
+ if (this.isProcessed(document)) return;
18
+ this.markProcessed(document);
19
+ const { addSelection, selectionPath } = this.config;
20
+ const firstQueryDefinition = document.definitions[0];
21
+ if (!firstQueryDefinition) return;
22
+ if (!firstQueryDefinition.selectionSet) return;
23
+ let tree = firstQueryDefinition.selectionSet.selections;
24
+ const fields = selectionPath.split(".");
25
+ fieldLoop: for (const field of fields){
26
+ for (const selection of tree)if (selection.selectionSet) {
27
+ if (selection.name.value === field) {
28
+ tree = selection.selectionSet.selections;
29
+ continue fieldLoop;
30
+ }
31
+ }
32
+ return;
48
33
  }
49
- }
50
- // If we get here, it means we didn't find the necessary selection
51
- return;
34
+ tree.push(...addSelection.definitions[0].selectionSet.selections);
52
35
  }
53
- /**
54
- * We must cast because there are a lot of types that are not intertwined and TS is complaining
55
- */
56
- tree.push(...addSelection.definitions[0].selectionSet.selections);
57
- }
58
- isProcessed(document) {
59
- if (!document.hasOwnProperty("__webiny__")) {
60
- document.__webiny__ = new Set();
36
+ isProcessed(document) {
37
+ if (!document.hasOwnProperty("__webiny__")) document.__webiny__ = new Set();
38
+ return document.__webiny__.has(this.cacheKey);
61
39
  }
62
- return document.__webiny__.has(this.cacheKey);
63
- }
64
- markProcessed(document) {
65
- if (!document.hasOwnProperty("__webiny__")) {
66
- document.__webiny__ = new Set();
40
+ markProcessed(document) {
41
+ if (!document.hasOwnProperty("__webiny__")) document.__webiny__ = new Set();
42
+ document.__webiny__.add(this.cacheKey);
67
43
  }
68
- document.__webiny__.add(this.cacheKey);
69
- }
70
44
  }
45
+ export { AddQuerySelectionPlugin };
71
46
 
72
47
  //# sourceMappingURL=AddQuerySelectionPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ApolloLink","ApolloLinkPlugin","AddQuerySelectionPlugin","constructor","config","createLink","operation","forward","operationName","addSelectionToQuery","query","document","isProcessed","markProcessed","addSelection","selectionPath","firstQueryDefinition","definitions","selectionSet","tree","selections","fields","split","fieldLoop","field","selection","name","value","push","hasOwnProperty","__webiny__","Set","has","cacheKey","add"],"sources":["AddQuerySelectionPlugin.ts"],"sourcesContent":["import { ApolloLink } from \"apollo-link\";\nimport type { DocumentNode } from \"graphql\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport type { ExecutableDefinitionNode, FieldNode } from \"graphql/language/ast.js\";\n\ndeclare module \"graphql\" {\n interface DocumentNode {\n __webiny__: Set<string>;\n }\n}\n\ninterface Config {\n operationName: string;\n selectionPath: string;\n addSelection: DocumentNode;\n}\n\nexport class AddQuerySelectionPlugin extends ApolloLinkPlugin {\n private readonly config: Config;\n\n constructor(config: Config) {\n super();\n this.config = config;\n }\n\n public override createLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if (operation.operationName !== this.config.operationName) {\n return forward(operation);\n }\n\n this.addSelectionToQuery(operation.operationName, operation.query);\n\n return forward(operation);\n });\n }\n\n public addSelectionToQuery(operationName: string, document: DocumentNode): void {\n if (operationName !== this.config.operationName) {\n return;\n }\n\n // If this plugin already processed the given document (documents are always passed by reference),\n // then we don't want to apply the selection again, to avoid adding duplicate selections.\n if (this.isProcessed(document)) {\n return;\n }\n\n this.markProcessed(document);\n\n const { addSelection, selectionPath } = this.config;\n\n const firstQueryDefinition = document.definitions[0] as ExecutableDefinitionNode;\n if (!firstQueryDefinition) {\n return;\n } else if (!firstQueryDefinition.selectionSet) {\n return;\n }\n\n let tree = firstQueryDefinition.selectionSet.selections as FieldNode[];\n const fields = selectionPath.split(\".\");\n\n fieldLoop: for (const field of fields) {\n for (const selection of tree) {\n if (!selection.selectionSet) {\n continue;\n }\n if (selection.name.value === field) {\n tree = selection.selectionSet.selections as FieldNode[];\n continue fieldLoop;\n }\n }\n // If we get here, it means we didn't find the necessary selection\n return;\n }\n /**\n * We must cast because there are a lot of types that are not intertwined and TS is complaining\n */\n tree.push(\n ...((addSelection.definitions[0] as ExecutableDefinitionNode).selectionSet\n .selections as FieldNode[])\n );\n }\n\n private isProcessed(document: DocumentNode) {\n if (!document.hasOwnProperty(\"__webiny__\")) {\n document.__webiny__ = new Set();\n }\n\n return document.__webiny__.has(this.cacheKey);\n }\n\n private markProcessed(document: DocumentNode) {\n if (!document.hasOwnProperty(\"__webiny__\")) {\n document.__webiny__ = new Set();\n }\n\n document.__webiny__.add(this.cacheKey);\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,aAAa;AAExC,SAASC,gBAAgB;AAezB,OAAO,MAAMC,uBAAuB,SAASD,gBAAgB,CAAC;EAG1DE,WAAWA,CAACC,MAAc,EAAE;IACxB,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEgBC,UAAUA,CAAA,EAAe;IACrC,OAAO,IAAIL,UAAU,CAAC,CAACM,SAAS,EAAEC,OAAO,KAAK;MAC1C,IAAID,SAAS,CAACE,aAAa,KAAK,IAAI,CAACJ,MAAM,CAACI,aAAa,EAAE;QACvD,OAAOD,OAAO,CAACD,SAAS,CAAC;MAC7B;MAEA,IAAI,CAACG,mBAAmB,CAACH,SAAS,CAACE,aAAa,EAAEF,SAAS,CAACI,KAAK,CAAC;MAElE,OAAOH,OAAO,CAACD,SAAS,CAAC;IAC7B,CAAC,CAAC;EACN;EAEOG,mBAAmBA,CAACD,aAAqB,EAAEG,QAAsB,EAAQ;IAC5E,IAAIH,aAAa,KAAK,IAAI,CAACJ,MAAM,CAACI,aAAa,EAAE;MAC7C;IACJ;;IAEA;IACA;IACA,IAAI,IAAI,CAACI,WAAW,CAACD,QAAQ,CAAC,EAAE;MAC5B;IACJ;IAEA,IAAI,CAACE,aAAa,CAACF,QAAQ,CAAC;IAE5B,MAAM;MAAEG,YAAY;MAAEC;IAAc,CAAC,GAAG,IAAI,CAACX,MAAM;IAEnD,MAAMY,oBAAoB,GAAGL,QAAQ,CAACM,WAAW,CAAC,CAAC,CAA6B;IAChF,IAAI,CAACD,oBAAoB,EAAE;MACvB;IACJ,CAAC,MAAM,IAAI,CAACA,oBAAoB,CAACE,YAAY,EAAE;MAC3C;IACJ;IAEA,IAAIC,IAAI,GAAGH,oBAAoB,CAACE,YAAY,CAACE,UAAyB;IACtE,MAAMC,MAAM,GAAGN,aAAa,CAACO,KAAK,CAAC,GAAG,CAAC;IAEvCC,SAAS,EAAE,KAAK,MAAMC,KAAK,IAAIH,MAAM,EAAE;MACnC,KAAK,MAAMI,SAAS,IAAIN,IAAI,EAAE;QAC1B,IAAI,CAACM,SAAS,CAACP,YAAY,EAAE;UACzB;QACJ;QACA,IAAIO,SAAS,CAACC,IAAI,CAACC,KAAK,KAAKH,KAAK,EAAE;UAChCL,IAAI,GAAGM,SAAS,CAACP,YAAY,CAACE,UAAyB;UACvD,SAASG,SAAS;QACtB;MACJ;MACA;MACA;IACJ;IACA;AACR;AACA;IACQJ,IAAI,CAACS,IAAI,CACL,GAAKd,YAAY,CAACG,WAAW,CAAC,CAAC,CAAC,CAA8BC,YAAY,CACrEE,UACT,CAAC;EACL;EAEQR,WAAWA,CAACD,QAAsB,EAAE;IACxC,IAAI,CAACA,QAAQ,CAACkB,cAAc,CAAC,YAAY,CAAC,EAAE;MACxClB,QAAQ,CAACmB,UAAU,GAAG,IAAIC,GAAG,CAAC,CAAC;IACnC;IAEA,OAAOpB,QAAQ,CAACmB,UAAU,CAACE,GAAG,CAAC,IAAI,CAACC,QAAQ,CAAC;EACjD;EAEQpB,aAAaA,CAACF,QAAsB,EAAE;IAC1C,IAAI,CAACA,QAAQ,CAACkB,cAAc,CAAC,YAAY,CAAC,EAAE;MACxClB,QAAQ,CAACmB,UAAU,GAAG,IAAIC,GAAG,CAAC,CAAC;IACnC;IAEApB,QAAQ,CAACmB,UAAU,CAACI,GAAG,CAAC,IAAI,CAACD,QAAQ,CAAC;EAC1C;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"plugins/AddQuerySelectionPlugin.js","sources":["../../src/plugins/AddQuerySelectionPlugin.ts"],"sourcesContent":["import { ApolloLink } from \"apollo-link\";\nimport type { DocumentNode } from \"graphql\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport type { ExecutableDefinitionNode, FieldNode } from \"graphql/language/ast.js\";\n\ndeclare module \"graphql\" {\n interface DocumentNode {\n __webiny__: Set<string>;\n }\n}\n\ninterface Config {\n operationName: string;\n selectionPath: string;\n addSelection: DocumentNode;\n}\n\nexport class AddQuerySelectionPlugin extends ApolloLinkPlugin {\n private readonly config: Config;\n\n constructor(config: Config) {\n super();\n this.config = config;\n }\n\n public override createLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if (operation.operationName !== this.config.operationName) {\n return forward(operation);\n }\n\n this.addSelectionToQuery(operation.operationName, operation.query);\n\n return forward(operation);\n });\n }\n\n public addSelectionToQuery(operationName: string, document: DocumentNode): void {\n if (operationName !== this.config.operationName) {\n return;\n }\n\n // If this plugin already processed the given document (documents are always passed by reference),\n // then we don't want to apply the selection again, to avoid adding duplicate selections.\n if (this.isProcessed(document)) {\n return;\n }\n\n this.markProcessed(document);\n\n const { addSelection, selectionPath } = this.config;\n\n const firstQueryDefinition = document.definitions[0] as ExecutableDefinitionNode;\n if (!firstQueryDefinition) {\n return;\n } else if (!firstQueryDefinition.selectionSet) {\n return;\n }\n\n let tree = firstQueryDefinition.selectionSet.selections as FieldNode[];\n const fields = selectionPath.split(\".\");\n\n fieldLoop: for (const field of fields) {\n for (const selection of tree) {\n if (!selection.selectionSet) {\n continue;\n }\n if (selection.name.value === field) {\n tree = selection.selectionSet.selections as FieldNode[];\n continue fieldLoop;\n }\n }\n // If we get here, it means we didn't find the necessary selection\n return;\n }\n /**\n * We must cast because there are a lot of types that are not intertwined and TS is complaining\n */\n tree.push(\n ...((addSelection.definitions[0] as ExecutableDefinitionNode).selectionSet\n .selections as FieldNode[])\n );\n }\n\n private isProcessed(document: DocumentNode) {\n if (!document.hasOwnProperty(\"__webiny__\")) {\n document.__webiny__ = new Set();\n }\n\n return document.__webiny__.has(this.cacheKey);\n }\n\n private markProcessed(document: DocumentNode) {\n if (!document.hasOwnProperty(\"__webiny__\")) {\n document.__webiny__ = new Set();\n }\n\n document.__webiny__.add(this.cacheKey);\n }\n}\n"],"names":["AddQuerySelectionPlugin","ApolloLinkPlugin","config","ApolloLink","operation","forward","operationName","document","addSelection","selectionPath","firstQueryDefinition","tree","fields","fieldLoop","field","selection","Set"],"mappings":";;AAiBO,MAAMA,gCAAgCC;IAGzC,YAAYC,MAAc,CAAE;QACxB,KAAK;QACL,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEgB,aAAyB;QACrC,OAAO,IAAIC,WAAW,CAACC,WAAWC;YAC9B,IAAID,UAAU,aAAa,KAAK,IAAI,CAAC,MAAM,CAAC,aAAa,EACrD,OAAOC,QAAQD;YAGnB,IAAI,CAAC,mBAAmB,CAACA,UAAU,aAAa,EAAEA,UAAU,KAAK;YAEjE,OAAOC,QAAQD;QACnB;IACJ;IAEO,oBAAoBE,aAAqB,EAAEC,QAAsB,EAAQ;QAC5E,IAAID,kBAAkB,IAAI,CAAC,MAAM,CAAC,aAAa,EAC3C;QAKJ,IAAI,IAAI,CAAC,WAAW,CAACC,WACjB;QAGJ,IAAI,CAAC,aAAa,CAACA;QAEnB,MAAM,EAAEC,YAAY,EAAEC,aAAa,EAAE,GAAG,IAAI,CAAC,MAAM;QAEnD,MAAMC,uBAAuBH,SAAS,WAAW,CAAC,EAAE;QACpD,IAAI,CAACG,sBACD;QACG,IAAI,CAACA,qBAAqB,YAAY,EACzC;QAGJ,IAAIC,OAAOD,qBAAqB,YAAY,CAAC,UAAU;QACvD,MAAME,SAASH,cAAc,KAAK,CAAC;QAEnCI,WAAW,KAAK,MAAMC,SAASF,OAAQ;YACnC,KAAK,MAAMG,aAAaJ,KACpB,IAAKI,UAAU,YAAY,EAG3B;gBAAA,IAAIA,UAAU,IAAI,CAAC,KAAK,KAAKD,OAAO;oBAChCH,OAAOI,UAAU,YAAY,CAAC,UAAU;oBACxC,SAASF;gBACb;YAAA;YAGJ;QACJ;QAIAF,KAAK,IAAI,IACAH,aAAa,WAAW,CAAC,EAAE,CAA8B,YAAY,CACrE,UAAU;IAEvB;IAEQ,YAAYD,QAAsB,EAAE;QACxC,IAAI,CAACA,SAAS,cAAc,CAAC,eACzBA,SAAS,UAAU,GAAG,IAAIS;QAG9B,OAAOT,SAAS,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ;IAChD;IAEQ,cAAcA,QAAsB,EAAE;QAC1C,IAAI,CAACA,SAAS,cAAc,CAAC,eACzBA,SAAS,UAAU,GAAG,IAAIS;QAG9BT,SAAS,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ;IACzC;AACJ"}
@@ -1,16 +1,17 @@
1
1
  import { Plugin } from "@webiny/plugins";
2
- export class ApolloCacheObjectIdPlugin extends Plugin {
3
- static type = "cache-get-object-id";
4
- constructor(getObjectId) {
5
- super();
6
- this._getObjectId = getObjectId;
7
- }
8
- getObjectId(data) {
9
- if (typeof this._getObjectId !== "function") {
10
- throw Error(`You must provide a "getObjectId" callable to the plugin constructor or extend the ApolloCacheObjectIdPlugin.`);
2
+ class ApolloCacheObjectIdPlugin extends Plugin {
3
+ static{
4
+ this.type = "cache-get-object-id";
5
+ }
6
+ constructor(getObjectId){
7
+ super();
8
+ this._getObjectId = getObjectId;
9
+ }
10
+ getObjectId(data) {
11
+ if ("function" != typeof this._getObjectId) throw Error('You must provide a "getObjectId" callable to the plugin constructor or extend the ApolloCacheObjectIdPlugin.');
12
+ return this._getObjectId(data);
11
13
  }
12
- return this._getObjectId(data);
13
- }
14
14
  }
15
+ export { ApolloCacheObjectIdPlugin };
15
16
 
16
17
  //# sourceMappingURL=ApolloCacheObjectIdPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Plugin","ApolloCacheObjectIdPlugin","type","constructor","getObjectId","_getObjectId","data","Error"],"sources":["ApolloCacheObjectIdPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\n\nexport interface ApolloCacheObject {\n __typename?: string;\n [key: string]: any;\n}\n\ninterface ApolloCacheObjectIdPluginCallable<T> {\n // A value for `id`, null to prevent normalization, or undefined to continue with defaults.\n (data: T): string | null | undefined;\n}\n\nexport class ApolloCacheObjectIdPlugin<\n T extends ApolloCacheObject = ApolloCacheObject\n> extends Plugin {\n public static override readonly type: string = \"cache-get-object-id\";\n private readonly _getObjectId?: ApolloCacheObjectIdPluginCallable<T>;\n\n public constructor(getObjectId?: ApolloCacheObjectIdPluginCallable<T>) {\n super();\n this._getObjectId = getObjectId;\n }\n\n public getObjectId(data: T) {\n if (typeof this._getObjectId !== \"function\") {\n throw Error(\n `You must provide a \"getObjectId\" callable to the plugin constructor or extend the ApolloCacheObjectIdPlugin.`\n );\n }\n\n return this._getObjectId(data);\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAYxC,OAAO,MAAMC,yBAAyB,SAE5BD,MAAM,CAAC;EACb,OAAgCE,IAAI,GAAW,qBAAqB;EAG7DC,WAAWA,CAACC,WAAkD,EAAE;IACnE,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,YAAY,GAAGD,WAAW;EACnC;EAEOA,WAAWA,CAACE,IAAO,EAAE;IACxB,IAAI,OAAO,IAAI,CAACD,YAAY,KAAK,UAAU,EAAE;MACzC,MAAME,KAAK,CACP,8GACJ,CAAC;IACL;IAEA,OAAO,IAAI,CAACF,YAAY,CAACC,IAAI,CAAC;EAClC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"plugins/ApolloCacheObjectIdPlugin.js","sources":["../../src/plugins/ApolloCacheObjectIdPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\n\nexport interface ApolloCacheObject {\n __typename?: string;\n [key: string]: any;\n}\n\ninterface ApolloCacheObjectIdPluginCallable<T> {\n // A value for `id`, null to prevent normalization, or undefined to continue with defaults.\n (data: T): string | null | undefined;\n}\n\nexport class ApolloCacheObjectIdPlugin<\n T extends ApolloCacheObject = ApolloCacheObject\n> extends Plugin {\n public static override readonly type: string = \"cache-get-object-id\";\n private readonly _getObjectId?: ApolloCacheObjectIdPluginCallable<T>;\n\n public constructor(getObjectId?: ApolloCacheObjectIdPluginCallable<T>) {\n super();\n this._getObjectId = getObjectId;\n }\n\n public getObjectId(data: T) {\n if (typeof this._getObjectId !== \"function\") {\n throw Error(\n `You must provide a \"getObjectId\" callable to the plugin constructor or extend the ApolloCacheObjectIdPlugin.`\n );\n }\n\n return this._getObjectId(data);\n }\n}\n"],"names":["ApolloCacheObjectIdPlugin","Plugin","getObjectId","data","Error"],"mappings":";AAYO,MAAMA,kCAEHC;;aAC0B,IAAI,GAAW;;IAG/C,YAAmBC,WAAkD,CAAE;QACnE,KAAK;QACL,IAAI,CAAC,YAAY,GAAGA;IACxB;IAEO,YAAYC,IAAO,EAAE;QACxB,IAAI,AAA6B,cAA7B,OAAO,IAAI,CAAC,YAAY,EACxB,MAAMC,MACF;QAIR,OAAO,IAAI,CAAC,YAAY,CAACD;IAC7B;AACJ"}
@@ -1,31 +1,29 @@
1
1
  import { ApolloLink } from "apollo-link";
2
2
  import { plugins } from "@webiny/plugins";
3
3
  function createLink(plugin) {
4
- try {
5
- return plugin.createLink();
6
- } catch (e) {
7
- console.error(`Caught an error while executing "createLink" on plugin`, plugin);
8
- console.error(e);
9
- }
10
- return null;
4
+ try {
5
+ return plugin.createLink();
6
+ } catch (e) {
7
+ console.error('Caught an error while executing "createLink" on plugin', plugin);
8
+ console.error(e);
9
+ }
10
+ return null;
11
11
  }
12
- export class ApolloDynamicLink extends ApolloLink {
13
- cache = new Map();
14
- request(operation, forward) {
15
- const linkPlugins = plugins.byType("apollo-link");
16
- if (!linkPlugins.length) {
17
- return forward(operation);
12
+ class ApolloDynamicLink extends ApolloLink {
13
+ request(operation, forward) {
14
+ const linkPlugins = plugins.byType("apollo-link");
15
+ if (!linkPlugins.length) return forward(operation);
16
+ const cacheKey = linkPlugins.map((pl)=>pl.cacheKey).join(",");
17
+ if (!this.cache.has(cacheKey)) {
18
+ const links = linkPlugins.map(createLink).filter(Boolean);
19
+ this.cache.set(cacheKey, ApolloLink.from(links));
20
+ }
21
+ return this.cache.get(cacheKey).request(operation, forward);
18
22
  }
19
- const cacheKey = linkPlugins.map(pl => pl.cacheKey).join(",");
20
- if (!this.cache.has(cacheKey)) {
21
- /**
22
- * We filter out falsy items from the linkPlugins because there might be some error while creating link.
23
- */
24
- const links = linkPlugins.map(createLink).filter(Boolean);
25
- this.cache.set(cacheKey, ApolloLink.from(links));
23
+ constructor(...args){
24
+ super(...args), this.cache = new Map();
26
25
  }
27
- return this.cache.get(cacheKey).request(operation, forward);
28
- }
29
26
  }
27
+ export { ApolloDynamicLink };
30
28
 
31
29
  //# sourceMappingURL=ApolloDynamicLink.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ApolloLink","plugins","createLink","plugin","e","console","error","ApolloDynamicLink","cache","Map","request","operation","forward","linkPlugins","byType","length","cacheKey","map","pl","join","has","links","filter","Boolean","set","from","get"],"sources":["ApolloDynamicLink.ts"],"sourcesContent":["import type { NextLink } from \"apollo-link\";\nimport { ApolloLink } from \"apollo-link\";\nimport { plugins } from \"@webiny/plugins\";\nimport type { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport type { Operation } from \"apollo-link/lib/types.js\";\n\nfunction createLink(plugin: ApolloLinkPlugin) {\n try {\n return plugin.createLink();\n } catch (e) {\n console.error(`Caught an error while executing \"createLink\" on plugin`, plugin);\n console.error(e);\n }\n return null;\n}\n\nexport class ApolloDynamicLink extends ApolloLink {\n private cache = new Map();\n\n public override request(operation: Operation, forward: NextLink) {\n const linkPlugins = plugins.byType<ApolloLinkPlugin>(\"apollo-link\");\n\n if (!linkPlugins.length) {\n return forward(operation);\n }\n\n const cacheKey = linkPlugins.map(pl => pl.cacheKey).join(\",\");\n\n if (!this.cache.has(cacheKey)) {\n /**\n * We filter out falsy items from the linkPlugins because there might be some error while creating link.\n */\n const links = linkPlugins.map(createLink).filter(Boolean) as ApolloLink[];\n this.cache.set(cacheKey, ApolloLink.from(links));\n }\n\n return this.cache.get(cacheKey).request(operation, forward);\n }\n}\n"],"mappings":"AACA,SAASA,UAAU,QAAQ,aAAa;AACxC,SAASC,OAAO,QAAQ,iBAAiB;AAIzC,SAASC,UAAUA,CAACC,MAAwB,EAAE;EAC1C,IAAI;IACA,OAAOA,MAAM,CAACD,UAAU,CAAC,CAAC;EAC9B,CAAC,CAAC,OAAOE,CAAC,EAAE;IACRC,OAAO,CAACC,KAAK,CAAC,wDAAwD,EAAEH,MAAM,CAAC;IAC/EE,OAAO,CAACC,KAAK,CAACF,CAAC,CAAC;EACpB;EACA,OAAO,IAAI;AACf;AAEA,OAAO,MAAMG,iBAAiB,SAASP,UAAU,CAAC;EACtCQ,KAAK,GAAG,IAAIC,GAAG,CAAC,CAAC;EAETC,OAAOA,CAACC,SAAoB,EAAEC,OAAiB,EAAE;IAC7D,MAAMC,WAAW,GAAGZ,OAAO,CAACa,MAAM,CAAmB,aAAa,CAAC;IAEnE,IAAI,CAACD,WAAW,CAACE,MAAM,EAAE;MACrB,OAAOH,OAAO,CAACD,SAAS,CAAC;IAC7B;IAEA,MAAMK,QAAQ,GAAGH,WAAW,CAACI,GAAG,CAACC,EAAE,IAAIA,EAAE,CAACF,QAAQ,CAAC,CAACG,IAAI,CAAC,GAAG,CAAC;IAE7D,IAAI,CAAC,IAAI,CAACX,KAAK,CAACY,GAAG,CAACJ,QAAQ,CAAC,EAAE;MAC3B;AACZ;AACA;MACY,MAAMK,KAAK,GAAGR,WAAW,CAACI,GAAG,CAACf,UAAU,CAAC,CAACoB,MAAM,CAACC,OAAO,CAAiB;MACzE,IAAI,CAACf,KAAK,CAACgB,GAAG,CAACR,QAAQ,EAAEhB,UAAU,CAACyB,IAAI,CAACJ,KAAK,CAAC,CAAC;IACpD;IAEA,OAAO,IAAI,CAACb,KAAK,CAACkB,GAAG,CAACV,QAAQ,CAAC,CAACN,OAAO,CAACC,SAAS,EAAEC,OAAO,CAAC;EAC/D;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"plugins/ApolloDynamicLink.js","sources":["../../src/plugins/ApolloDynamicLink.ts"],"sourcesContent":["import type { NextLink } from \"apollo-link\";\nimport { ApolloLink } from \"apollo-link\";\nimport { plugins } from \"@webiny/plugins\";\nimport type { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport type { Operation } from \"apollo-link/lib/types.js\";\n\nfunction createLink(plugin: ApolloLinkPlugin) {\n try {\n return plugin.createLink();\n } catch (e) {\n console.error(`Caught an error while executing \"createLink\" on plugin`, plugin);\n console.error(e);\n }\n return null;\n}\n\nexport class ApolloDynamicLink extends ApolloLink {\n private cache = new Map();\n\n public override request(operation: Operation, forward: NextLink) {\n const linkPlugins = plugins.byType<ApolloLinkPlugin>(\"apollo-link\");\n\n if (!linkPlugins.length) {\n return forward(operation);\n }\n\n const cacheKey = linkPlugins.map(pl => pl.cacheKey).join(\",\");\n\n if (!this.cache.has(cacheKey)) {\n /**\n * We filter out falsy items from the linkPlugins because there might be some error while creating link.\n */\n const links = linkPlugins.map(createLink).filter(Boolean) as ApolloLink[];\n this.cache.set(cacheKey, ApolloLink.from(links));\n }\n\n return this.cache.get(cacheKey).request(operation, forward);\n }\n}\n"],"names":["createLink","plugin","e","console","ApolloDynamicLink","ApolloLink","operation","forward","linkPlugins","plugins","cacheKey","pl","links","Boolean","Map"],"mappings":";;AAMA,SAASA,WAAWC,MAAwB;IACxC,IAAI;QACA,OAAOA,OAAO,UAAU;IAC5B,EAAE,OAAOC,GAAG;QACRC,QAAQ,KAAK,CAAC,0DAA0DF;QACxEE,QAAQ,KAAK,CAACD;IAClB;IACA,OAAO;AACX;AAEO,MAAME,0BAA0BC;IAGnB,QAAQC,SAAoB,EAAEC,OAAiB,EAAE;QAC7D,MAAMC,cAAcC,QAAQ,MAAM,CAAmB;QAErD,IAAI,CAACD,YAAY,MAAM,EACnB,OAAOD,QAAQD;QAGnB,MAAMI,WAAWF,YAAY,GAAG,CAACG,CAAAA,KAAMA,GAAG,QAAQ,EAAE,IAAI,CAAC;QAEzD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAACD,WAAW;YAI3B,MAAME,QAAQJ,YAAY,GAAG,CAACR,YAAY,MAAM,CAACa;YACjD,IAAI,CAAC,KAAK,CAAC,GAAG,CAACH,UAAUL,WAAW,IAAI,CAACO;QAC7C;QAEA,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAACF,UAAU,OAAO,CAACJ,WAAWC;IACvD;;QArBG,qBACK,KAAK,GAAG,IAAIO;;AAqBxB"}
@@ -1,22 +1,23 @@
1
1
  import { nanoid } from "nanoid";
2
2
  import { Plugin } from "@webiny/plugins";
3
- export class ApolloLinkPlugin extends Plugin {
4
- static type = "apollo-link";
5
- constructor(factory) {
6
- super();
7
- this.factory = factory;
8
- this.cacheKey = nanoid();
9
- }
10
- createLink() {
11
- if (this.cache) {
12
- return this.cache;
3
+ class ApolloLinkPlugin extends Plugin {
4
+ static{
5
+ this.type = "apollo-link";
13
6
  }
14
- if (typeof this.factory === "function") {
15
- this.cache = this.factory();
16
- return this.cache;
7
+ constructor(factory){
8
+ super();
9
+ this.factory = factory;
10
+ this.cacheKey = nanoid();
11
+ }
12
+ createLink() {
13
+ if (this.cache) return this.cache;
14
+ if ("function" == typeof this.factory) {
15
+ this.cache = this.factory();
16
+ return this.cache;
17
+ }
18
+ throw Error(`Missing ApolloLinkFactory in plugin "${this.name}"! Either pass a factory to ApolloLinkPlugin constructor or extend the class and override the "createLink" method.`);
17
19
  }
18
- throw Error(`Missing ApolloLinkFactory in plugin "${this.name}"! Either pass a factory to ApolloLinkPlugin constructor or extend the class and override the "createLink" method.`);
19
- }
20
20
  }
21
+ export { ApolloLinkPlugin };
21
22
 
22
23
  //# sourceMappingURL=ApolloLinkPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["nanoid","Plugin","ApolloLinkPlugin","type","constructor","factory","cacheKey","createLink","cache","Error","name"],"sources":["ApolloLinkPlugin.ts"],"sourcesContent":["import type { ApolloLink } from \"apollo-link\";\nimport { nanoid } from \"nanoid\";\nimport { Plugin } from \"@webiny/plugins\";\n\nexport interface ApolloLinkFactory {\n (): ApolloLink;\n}\n\nexport class ApolloLinkPlugin extends Plugin {\n public static override readonly type: string = \"apollo-link\";\n public readonly cacheKey;\n private readonly factory?: ApolloLinkFactory;\n private cache?: ApolloLink;\n\n constructor(factory?: ApolloLinkFactory) {\n super();\n this.factory = factory;\n this.cacheKey = nanoid();\n }\n\n public createLink(): ApolloLink {\n if (this.cache) {\n return this.cache;\n }\n\n if (typeof this.factory === \"function\") {\n this.cache = this.factory();\n\n return this.cache;\n }\n\n throw Error(\n `Missing ApolloLinkFactory in plugin \"${this.name}\"! Either pass a factory to ApolloLinkPlugin constructor or extend the class and override the \"createLink\" method.`\n );\n }\n}\n"],"mappings":"AACA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,SAASC,MAAM,QAAQ,iBAAiB;AAMxC,OAAO,MAAMC,gBAAgB,SAASD,MAAM,CAAC;EACzC,OAAgCE,IAAI,GAAW,aAAa;EAK5DC,WAAWA,CAACC,OAA2B,EAAE;IACrC,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,QAAQ,GAAGN,MAAM,CAAC,CAAC;EAC5B;EAEOO,UAAUA,CAAA,EAAe;IAC5B,IAAI,IAAI,CAACC,KAAK,EAAE;MACZ,OAAO,IAAI,CAACA,KAAK;IACrB;IAEA,IAAI,OAAO,IAAI,CAACH,OAAO,KAAK,UAAU,EAAE;MACpC,IAAI,CAACG,KAAK,GAAG,IAAI,CAACH,OAAO,CAAC,CAAC;MAE3B,OAAO,IAAI,CAACG,KAAK;IACrB;IAEA,MAAMC,KAAK,CACP,wCAAwC,IAAI,CAACC,IAAI,oHACrD,CAAC;EACL;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"plugins/ApolloLinkPlugin.js","sources":["../../src/plugins/ApolloLinkPlugin.ts"],"sourcesContent":["import type { ApolloLink } from \"apollo-link\";\nimport { nanoid } from \"nanoid\";\nimport { Plugin } from \"@webiny/plugins\";\n\nexport interface ApolloLinkFactory {\n (): ApolloLink;\n}\n\nexport class ApolloLinkPlugin extends Plugin {\n public static override readonly type: string = \"apollo-link\";\n public readonly cacheKey;\n private readonly factory?: ApolloLinkFactory;\n private cache?: ApolloLink;\n\n constructor(factory?: ApolloLinkFactory) {\n super();\n this.factory = factory;\n this.cacheKey = nanoid();\n }\n\n public createLink(): ApolloLink {\n if (this.cache) {\n return this.cache;\n }\n\n if (typeof this.factory === \"function\") {\n this.cache = this.factory();\n\n return this.cache;\n }\n\n throw Error(\n `Missing ApolloLinkFactory in plugin \"${this.name}\"! Either pass a factory to ApolloLinkPlugin constructor or extend the class and override the \"createLink\" method.`\n );\n }\n}\n"],"names":["ApolloLinkPlugin","Plugin","factory","nanoid","Error"],"mappings":";;AAQO,MAAMA,yBAAyBC;;aACF,IAAI,GAAW;;IAK/C,YAAYC,OAA2B,CAAE;QACrC,KAAK;QACL,IAAI,CAAC,OAAO,GAAGA;QACf,IAAI,CAAC,QAAQ,GAAGC;IACpB;IAEO,aAAyB;QAC5B,IAAI,IAAI,CAAC,KAAK,EACV,OAAO,IAAI,CAAC,KAAK;QAGrB,IAAI,AAAwB,cAAxB,OAAO,IAAI,CAAC,OAAO,EAAiB;YACpC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO;YAEzB,OAAO,IAAI,CAAC,KAAK;QACrB;QAEA,MAAMC,MACF,CAAC,qCAAqC,EAAE,IAAI,CAAC,IAAI,CAAC,kHAAkH,CAAC;IAE7K;AACJ"}
@@ -1,26 +1,24 @@
1
1
  import { ApolloLink } from "apollo-link";
2
2
  import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
3
- /**
4
- * This link checks for presence of `extensions.console` in the response and logs all items to browser console.
5
- */
6
- export class ConsoleLinkPlugin extends ApolloLinkPlugin {
7
- createLink() {
8
- return new ApolloLink((operation, forward) => {
9
- const firstDefinition = operation.query.definitions[0];
10
- const isQuery = firstDefinition["operation"] === "query";
11
- return forward(operation).map(data => {
12
- if (data.extensions && Array.isArray(data.extensions.console) && data.extensions.console.length) {
13
- const variables = isQuery ? JSON.stringify(operation.variables) : "{ see request details in the Network tab }";
14
- console.groupCollapsed(`Logs for graphQL ${isQuery ? "query" : "mutation"}: %c${operation.operationName || "anonymous operation"} %c${variables}%c`, "color: #fa5a28", "color: #6b6b6b", "color: black");
15
- data.extensions.console.forEach(log => {
16
- console[log.method](...log.args);
17
- });
18
- console.groupEnd();
19
- }
20
- return data;
21
- });
22
- });
23
- }
3
+ class ConsoleLinkPlugin extends ApolloLinkPlugin {
4
+ createLink() {
5
+ return new ApolloLink((operation, forward)=>{
6
+ const firstDefinition = operation.query.definitions[0];
7
+ const isQuery = "query" === firstDefinition["operation"];
8
+ return forward(operation).map((data)=>{
9
+ if (data.extensions && Array.isArray(data.extensions.console) && data.extensions.console.length) {
10
+ const variables = isQuery ? JSON.stringify(operation.variables) : "{ see request details in the Network tab }";
11
+ console.groupCollapsed(`Logs for graphQL ${isQuery ? "query" : "mutation"}: %c${operation.operationName || "anonymous operation"} %c${variables}%c`, "color: #fa5a28", "color: #6b6b6b", "color: black");
12
+ data.extensions.console.forEach((log)=>{
13
+ console[log.method](...log.args);
14
+ });
15
+ console.groupEnd();
16
+ }
17
+ return data;
18
+ });
19
+ });
20
+ }
24
21
  }
22
+ export { ConsoleLinkPlugin };
25
23
 
26
24
  //# sourceMappingURL=ConsoleLinkPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ApolloLink","ApolloLinkPlugin","ConsoleLinkPlugin","createLink","operation","forward","firstDefinition","query","definitions","isQuery","map","data","extensions","Array","isArray","console","length","variables","JSON","stringify","groupCollapsed","operationName","forEach","log","method","args","groupEnd"],"sources":["ConsoleLinkPlugin.ts"],"sourcesContent":["import type { FetchResult as BaseFetchResult } from \"apollo-link\";\nimport { ApolloLink } from \"apollo-link\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport type { OperationDefinitionNode } from \"graphql/language/ast.js\";\n\ninterface Log {\n args: any[];\n method: \"error\" | \"info\" | \"log\" | \"warn\";\n}\n\ninterface FetchResult extends BaseFetchResult {\n extensions?: {\n console?: Log[];\n };\n}\n\n/**\n * This link checks for presence of `extensions.console` in the response and logs all items to browser console.\n */\nexport class ConsoleLinkPlugin extends ApolloLinkPlugin {\n public override createLink() {\n return new ApolloLink((operation, forward) => {\n const firstDefinition = operation.query.definitions[0] as OperationDefinitionNode;\n const isQuery = firstDefinition[\"operation\"] === \"query\";\n\n return forward(operation).map((data: FetchResult) => {\n if (\n data.extensions &&\n Array.isArray(data.extensions.console) &&\n data.extensions.console.length\n ) {\n const variables = isQuery\n ? JSON.stringify(operation.variables)\n : \"{ see request details in the Network tab }\";\n console.groupCollapsed(\n `Logs for graphQL ${isQuery ? \"query\" : \"mutation\"}: %c${\n operation.operationName || \"anonymous operation\"\n } %c${variables}%c`,\n \"color: #fa5a28\",\n \"color: #6b6b6b\",\n \"color: black\"\n );\n data.extensions.console.forEach((log: Log) => {\n console[log.method](...log.args);\n });\n console.groupEnd();\n }\n\n return data;\n });\n });\n }\n}\n"],"mappings":"AACA,SAASA,UAAU,QAAQ,aAAa;AACxC,SAASC,gBAAgB;AAczB;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,SAASD,gBAAgB,CAAC;EACpCE,UAAUA,CAAA,EAAG;IACzB,OAAO,IAAIH,UAAU,CAAC,CAACI,SAAS,EAAEC,OAAO,KAAK;MAC1C,MAAMC,eAAe,GAAGF,SAAS,CAACG,KAAK,CAACC,WAAW,CAAC,CAAC,CAA4B;MACjF,MAAMC,OAAO,GAAGH,eAAe,CAAC,WAAW,CAAC,KAAK,OAAO;MAExD,OAAOD,OAAO,CAACD,SAAS,CAAC,CAACM,GAAG,CAAEC,IAAiB,IAAK;QACjD,IACIA,IAAI,CAACC,UAAU,IACfC,KAAK,CAACC,OAAO,CAACH,IAAI,CAACC,UAAU,CAACG,OAAO,CAAC,IACtCJ,IAAI,CAACC,UAAU,CAACG,OAAO,CAACC,MAAM,EAChC;UACE,MAAMC,SAAS,GAAGR,OAAO,GACnBS,IAAI,CAACC,SAAS,CAACf,SAAS,CAACa,SAAS,CAAC,GACnC,4CAA4C;UAClDF,OAAO,CAACK,cAAc,CAClB,oBAAoBX,OAAO,GAAG,OAAO,GAAG,UAAU,OAC9CL,SAAS,CAACiB,aAAa,IAAI,qBAAqB,MAC9CJ,SAAS,IAAI,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,cACJ,CAAC;UACDN,IAAI,CAACC,UAAU,CAACG,OAAO,CAACO,OAAO,CAAEC,GAAQ,IAAK;YAC1CR,OAAO,CAACQ,GAAG,CAACC,MAAM,CAAC,CAAC,GAAGD,GAAG,CAACE,IAAI,CAAC;UACpC,CAAC,CAAC;UACFV,OAAO,CAACW,QAAQ,CAAC,CAAC;QACtB;QAEA,OAAOf,IAAI;MACf,CAAC,CAAC;IACN,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"plugins/ConsoleLinkPlugin.js","sources":["../../src/plugins/ConsoleLinkPlugin.ts"],"sourcesContent":["import type { FetchResult as BaseFetchResult } from \"apollo-link\";\nimport { ApolloLink } from \"apollo-link\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport type { OperationDefinitionNode } from \"graphql/language/ast.js\";\n\ninterface Log {\n args: any[];\n method: \"error\" | \"info\" | \"log\" | \"warn\";\n}\n\ninterface FetchResult extends BaseFetchResult {\n extensions?: {\n console?: Log[];\n };\n}\n\n/**\n * This link checks for presence of `extensions.console` in the response and logs all items to browser console.\n */\nexport class ConsoleLinkPlugin extends ApolloLinkPlugin {\n public override createLink() {\n return new ApolloLink((operation, forward) => {\n const firstDefinition = operation.query.definitions[0] as OperationDefinitionNode;\n const isQuery = firstDefinition[\"operation\"] === \"query\";\n\n return forward(operation).map((data: FetchResult) => {\n if (\n data.extensions &&\n Array.isArray(data.extensions.console) &&\n data.extensions.console.length\n ) {\n const variables = isQuery\n ? JSON.stringify(operation.variables)\n : \"{ see request details in the Network tab }\";\n console.groupCollapsed(\n `Logs for graphQL ${isQuery ? \"query\" : \"mutation\"}: %c${\n operation.operationName || \"anonymous operation\"\n } %c${variables}%c`,\n \"color: #fa5a28\",\n \"color: #6b6b6b\",\n \"color: black\"\n );\n data.extensions.console.forEach((log: Log) => {\n console[log.method](...log.args);\n });\n console.groupEnd();\n }\n\n return data;\n });\n });\n }\n}\n"],"names":["ConsoleLinkPlugin","ApolloLinkPlugin","ApolloLink","operation","forward","firstDefinition","isQuery","data","Array","variables","JSON","console","log"],"mappings":";;AAmBO,MAAMA,0BAA0BC;IACnB,aAAa;QACzB,OAAO,IAAIC,WAAW,CAACC,WAAWC;YAC9B,MAAMC,kBAAkBF,UAAU,KAAK,CAAC,WAAW,CAAC,EAAE;YACtD,MAAMG,UAAUD,AAAiC,YAAjCA,eAAe,CAAC,YAAY;YAE5C,OAAOD,QAAQD,WAAW,GAAG,CAAC,CAACI;gBAC3B,IACIA,KAAK,UAAU,IACfC,MAAM,OAAO,CAACD,KAAK,UAAU,CAAC,OAAO,KACrCA,KAAK,UAAU,CAAC,OAAO,CAAC,MAAM,EAChC;oBACE,MAAME,YAAYH,UACZI,KAAK,SAAS,CAACP,UAAU,SAAS,IAClC;oBACNQ,QAAQ,cAAc,CAClB,CAAC,iBAAiB,EAAEL,UAAU,UAAU,WAAW,IAAI,EACnDH,UAAU,aAAa,IAAI,sBAC9B,GAAG,EAAEM,UAAU,EAAE,CAAC,EACnB,kBACA,kBACA;oBAEJF,KAAK,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAACK;wBAC7BD,OAAO,CAACC,IAAI,MAAM,CAAC,IAAIA,IAAI,IAAI;oBACnC;oBACAD,QAAQ,QAAQ;gBACpB;gBAEA,OAAOJ;YACX;QACJ;IACJ;AACJ"}
@@ -1,55 +1,49 @@
1
- import React, { useState } from "react";
1
+ import react, { useState } from "react";
2
2
  import { Typography } from "./Typography.js";
3
3
  import { i18n } from "../../i18n/index.js";
4
4
  import { OverlayWrapper } from "./StyledComponents.js";
5
- import { ReactComponent as CloseIcon } from "./assets/close_24px.svg";
5
+ import { ReactComponent } from "./assets/close_24px.js";
6
6
  const t = i18n.ns("app/graphql/error-overlay");
7
7
  const ENVIRONMENT_VARIABLES_ARTICLE_LINK = "https://www.webiny.com/docs/how-to-guides/environment-variables";
8
- export const ErrorOverlay = props => {
9
- const {
10
- title = "An error occurred",
11
- message,
12
- description,
13
- closeable
14
- } = props;
15
- const [open, setOpen] = useState(true);
16
- if (!open) {
17
- return null;
18
- }
19
- return /*#__PURE__*/React.createElement(OverlayWrapper, null, /*#__PURE__*/React.createElement("div", {
20
- className: "inner"
21
- }, /*#__PURE__*/React.createElement("div", {
22
- className: "header"
23
- }, /*#__PURE__*/React.createElement("div", {
24
- className: "header__title"
25
- }, /*#__PURE__*/React.createElement(Typography, {
26
- use: "headline"
27
- }, title)), closeable !== false && /*#__PURE__*/React.createElement("div", {
28
- className: "header__action"
29
- }, /*#__PURE__*/React.createElement("span", {
30
- onClick: () => setOpen(false)
31
- }, /*#__PURE__*/React.createElement(CloseIcon, null)))), /*#__PURE__*/React.createElement("div", {
32
- className: "body"
33
- }, /*#__PURE__*/React.createElement("div", {
34
- className: "body__summary"
35
- }, message), description && /*#__PURE__*/React.createElement("div", {
36
- className: "body__description"
37
- }, description)), /*#__PURE__*/React.createElement("div", {
38
- className: "footer"
39
- }, /*#__PURE__*/React.createElement(Typography, {
40
- use: "body"
41
- }, t`
8
+ const ErrorOverlay = (props)=>{
9
+ const { title = "An error occurred", message, description, closeable } = props;
10
+ const [open, setOpen] = useState(true);
11
+ if (!open) return null;
12
+ return /*#__PURE__*/ react.createElement(OverlayWrapper, null, /*#__PURE__*/ react.createElement("div", {
13
+ className: "inner"
14
+ }, /*#__PURE__*/ react.createElement("div", {
15
+ className: "header"
16
+ }, /*#__PURE__*/ react.createElement("div", {
17
+ className: "header__title"
18
+ }, /*#__PURE__*/ react.createElement(Typography, {
19
+ use: "headline"
20
+ }, title)), false !== closeable && /*#__PURE__*/ react.createElement("div", {
21
+ className: "header__action"
22
+ }, /*#__PURE__*/ react.createElement("span", {
23
+ onClick: ()=>setOpen(false)
24
+ }, /*#__PURE__*/ react.createElement(ReactComponent, null)))), /*#__PURE__*/ react.createElement("div", {
25
+ className: "body"
26
+ }, /*#__PURE__*/ react.createElement("div", {
27
+ className: "body__summary"
28
+ }, message), description && /*#__PURE__*/ react.createElement("div", {
29
+ className: "body__description"
30
+ }, description)), /*#__PURE__*/ react.createElement("div", {
31
+ className: "footer"
32
+ }, /*#__PURE__*/ react.createElement(Typography, {
33
+ use: "body"
34
+ }, t`
42
35
  This screen is only visible if {message} environment variable is set.
43
36
  Read more about it in the {link}. `({
44
- message: /*#__PURE__*/React.createElement("span", {
45
- className: "highlight"
46
- }, "`REACT_APP_DEBUG=true`"),
47
- link: /*#__PURE__*/React.createElement("a", {
48
- href: ENVIRONMENT_VARIABLES_ARTICLE_LINK,
49
- target: "_blank",
50
- rel: "noreferrer noopener"
51
- }, "environment variables article")
52
- }), /*#__PURE__*/React.createElement("br", null), t`Open your browser's developer console to further inspect this error.`))));
37
+ message: /*#__PURE__*/ react.createElement("span", {
38
+ className: "highlight"
39
+ }, "`REACT_APP_DEBUG=true`"),
40
+ link: /*#__PURE__*/ react.createElement("a", {
41
+ href: ENVIRONMENT_VARIABLES_ARTICLE_LINK,
42
+ target: "_blank",
43
+ rel: "noreferrer noopener"
44
+ }, "environment variables article")
45
+ }), /*#__PURE__*/ react.createElement("br", null), t`Open your browser's developer console to further inspect this error.`))));
53
46
  };
47
+ export { ErrorOverlay };
54
48
 
55
49
  //# sourceMappingURL=ErrorOverlay.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","useState","Typography","i18n","OverlayWrapper","ReactComponent","CloseIcon","t","ns","ENVIRONMENT_VARIABLES_ARTICLE_LINK","ErrorOverlay","props","title","message","description","closeable","open","setOpen","createElement","className","use","onClick","link","href","target","rel"],"sources":["ErrorOverlay.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { Typography } from \"./Typography.js\";\nimport { i18n } from \"../../i18n/index.js\";\nimport { OverlayWrapper } from \"./StyledComponents.js\";\nimport { ReactComponent as CloseIcon } from \"./assets/close_24px.svg\";\n\nconst t = i18n.ns(\"app/graphql/error-overlay\");\n\nconst ENVIRONMENT_VARIABLES_ARTICLE_LINK =\n \"https://www.webiny.com/docs/how-to-guides/environment-variables\";\n\ntype ErrorOverlayProps = Partial<{\n title: React.ReactNode;\n message: React.ReactNode;\n description: React.ReactNode;\n closeable?: boolean;\n}>;\n\nexport const ErrorOverlay = (props: ErrorOverlayProps) => {\n const { title = \"An error occurred\", message, description, closeable } = props;\n const [open, setOpen] = useState(true);\n if (!open) {\n return null;\n }\n\n return (\n <OverlayWrapper>\n <div className=\"inner\">\n <div className=\"header\">\n <div className=\"header__title\">\n <Typography use={\"headline\"}>{title}</Typography>\n </div>\n {closeable !== false && (\n <div className=\"header__action\">\n <span onClick={() => setOpen(false)}>\n <CloseIcon />\n </span>\n </div>\n )}\n </div>\n <div className=\"body\">\n <div className=\"body__summary\">{message}</div>\n {description && <div className=\"body__description\">{description}</div>}\n </div>\n <div className=\"footer\">\n <Typography use={\"body\"}>\n {t`\n This screen is only visible if {message} environment variable is set.\n Read more about it in the {link}. `({\n message: <span className={\"highlight\"}>`REACT_APP_DEBUG=true`</span>,\n link: (\n <a\n href={ENVIRONMENT_VARIABLES_ARTICLE_LINK}\n target={\"_blank\"}\n rel={\"noreferrer noopener\"}\n >\n environment variables article\n </a>\n )\n })}\n <br />\n {t`Open your browser's developer console to further inspect this error.`}\n </Typography>\n </div>\n </div>\n </OverlayWrapper>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,UAAU;AACnB,SAASC,IAAI;AACb,SAASC,cAAc;AACvB,SAASC,cAAc,IAAIC,SAAS;AAEpC,MAAMC,CAAC,GAAGJ,IAAI,CAACK,EAAE,CAAC,2BAA2B,CAAC;AAE9C,MAAMC,kCAAkC,GACpC,iEAAiE;AASrE,OAAO,MAAMC,YAAY,GAAIC,KAAwB,IAAK;EACtD,MAAM;IAAEC,KAAK,GAAG,mBAAmB;IAAEC,OAAO;IAAEC,WAAW;IAAEC;EAAU,CAAC,GAAGJ,KAAK;EAC9E,MAAM,CAACK,IAAI,EAAEC,OAAO,CAAC,GAAGhB,QAAQ,CAAC,IAAI,CAAC;EACtC,IAAI,CAACe,IAAI,EAAE;IACP,OAAO,IAAI;EACf;EAEA,oBACIhB,KAAA,CAAAkB,aAAA,CAACd,cAAc,qBACXJ,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC;EAAO,gBAClBnB,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC;EAAQ,gBACnBnB,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC;EAAe,gBAC1BnB,KAAA,CAAAkB,aAAA,CAAChB,UAAU;IAACkB,GAAG,EAAE;EAAW,GAAER,KAAkB,CAC/C,CAAC,EACLG,SAAS,KAAK,KAAK,iBAChBf,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC;EAAgB,gBAC3BnB,KAAA,CAAAkB,aAAA;IAAMG,OAAO,EAAEA,CAAA,KAAMJ,OAAO,CAAC,KAAK;EAAE,gBAChCjB,KAAA,CAAAkB,aAAA,CAACZ,SAAS,MAAE,CACV,CACL,CAER,CAAC,eACNN,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC;EAAM,gBACjBnB,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC;EAAe,GAAEN,OAAa,CAAC,EAC7CC,WAAW,iBAAId,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC;EAAmB,GAAEL,WAAiB,CACpE,CAAC,eACNd,KAAA,CAAAkB,aAAA;IAAKC,SAAS,EAAC;EAAQ,gBACnBnB,KAAA,CAAAkB,aAAA,CAAChB,UAAU;IAACkB,GAAG,EAAE;EAAO,GACnBb,CAAC;AAC1B;AACA,2DAA2D,CAAC;IAChCM,OAAO,eAAEb,KAAA,CAAAkB,aAAA;MAAMC,SAAS,EAAE;IAAY,GAAC,wBAA4B,CAAC;IACpEG,IAAI,eACAtB,KAAA,CAAAkB,aAAA;MACIK,IAAI,EAAEd,kCAAmC;MACzCe,MAAM,EAAE,QAAS;MACjBC,GAAG,EAAE;IAAsB,GAC9B,+BAEE;EAEX,CAAC,CAAC,eACFzB,KAAA,CAAAkB,aAAA,WAAK,CAAC,EACLX,CAAC,sEACM,CACX,CACJ,CACO,CAAC;AAEzB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"plugins/NetworkErrorLinkPlugin/ErrorOverlay.js","sources":["../../../src/plugins/NetworkErrorLinkPlugin/ErrorOverlay.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { Typography } from \"./Typography.js\";\nimport { i18n } from \"../../i18n/index.js\";\nimport { OverlayWrapper } from \"./StyledComponents.js\";\nimport { ReactComponent as CloseIcon } from \"./assets/close_24px.svg\";\n\nconst t = i18n.ns(\"app/graphql/error-overlay\");\n\nconst ENVIRONMENT_VARIABLES_ARTICLE_LINK =\n \"https://www.webiny.com/docs/how-to-guides/environment-variables\";\n\ntype ErrorOverlayProps = Partial<{\n title: React.ReactNode;\n message: React.ReactNode;\n description: React.ReactNode;\n closeable?: boolean;\n}>;\n\nexport const ErrorOverlay = (props: ErrorOverlayProps) => {\n const { title = \"An error occurred\", message, description, closeable } = props;\n const [open, setOpen] = useState(true);\n if (!open) {\n return null;\n }\n\n return (\n <OverlayWrapper>\n <div className=\"inner\">\n <div className=\"header\">\n <div className=\"header__title\">\n <Typography use={\"headline\"}>{title}</Typography>\n </div>\n {closeable !== false && (\n <div className=\"header__action\">\n <span onClick={() => setOpen(false)}>\n <CloseIcon />\n </span>\n </div>\n )}\n </div>\n <div className=\"body\">\n <div className=\"body__summary\">{message}</div>\n {description && <div className=\"body__description\">{description}</div>}\n </div>\n <div className=\"footer\">\n <Typography use={\"body\"}>\n {t`\n This screen is only visible if {message} environment variable is set.\n Read more about it in the {link}. `({\n message: <span className={\"highlight\"}>`REACT_APP_DEBUG=true`</span>,\n link: (\n <a\n href={ENVIRONMENT_VARIABLES_ARTICLE_LINK}\n target={\"_blank\"}\n rel={\"noreferrer noopener\"}\n >\n environment variables article\n </a>\n )\n })}\n <br />\n {t`Open your browser's developer console to further inspect this error.`}\n </Typography>\n </div>\n </div>\n </OverlayWrapper>\n );\n};\n"],"names":["t","i18n","ENVIRONMENT_VARIABLES_ARTICLE_LINK","ErrorOverlay","props","title","message","description","closeable","open","setOpen","useState","OverlayWrapper","Typography","CloseIcon"],"mappings":";;;;;AAMA,MAAMA,IAAIC,KAAK,EAAE,CAAC;AAElB,MAAMC,qCACF;AASG,MAAMC,eAAe,CAACC;IACzB,MAAM,EAAEC,QAAQ,mBAAmB,EAAEC,OAAO,EAAEC,WAAW,EAAEC,SAAS,EAAE,GAAGJ;IACzE,MAAM,CAACK,MAAMC,QAAQ,GAAGC,SAAS;IACjC,IAAI,CAACF,MACD,OAAO;IAGX,OAAO,WAAP,GACI,oBAACG,gBAAcA,MAAAA,WAAAA,GACX,oBAAC;QAAI,WAAU;qBACX,oBAAC;QAAI,WAAU;qBACX,oBAAC;QAAI,WAAU;qBACX,oBAACC,YAAUA;QAAC,KAAK;OAAaR,SAEjCG,AAAc,UAAdA,aAAuB,WAAT,GACX,oBAAC;QAAI,WAAU;qBACX,oBAAC;QAAK,SAAS,IAAME,QAAQ;qBACzB,oBAACI,gBAASA,UAAAA,WAAAA,GAK1B,oBAAC;QAAI,WAAU;qBACX,oBAAC;QAAI,WAAU;OAAiBR,UAC/BC,eAAe,WAAfA,GAAe,oBAAC;QAAI,WAAU;OAAqBA,eAAAA,WAAAA,GAExD,oBAAC;QAAI,WAAU;qBACX,oBAACM,YAAUA;QAAC,KAAK;OACZb,CAAC,CAAC;;0DAE+B,CAAC,CAAC;QAChC,SAAS,WAAT,GAAS,oBAAC;YAAK,WAAW;WAAa;QACvC,MAAM,WAAN,GACI,oBAAC;YACG,MAAME;YACN,QAAQ;YACR,KAAK;WACR;IAIT,kBACA,oBAAC,aACAF,CAAC,CAAC,oEAAoE,CAAC;AAMhG"}