@webiny/app 6.4.5 → 6.6.0-alpha.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 (119) hide show
  1. package/config/RouterConfig.d.ts +1 -3
  2. package/core/Plugins.d.ts +2 -1
  3. package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/ErrorOverlay.js +9 -15
  4. package/errors/overlay/ErrorOverlay.js.map +1 -0
  5. package/errors/overlay/GqlErrorOverlay.js.map +1 -0
  6. package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/LocalAwsLambdaTimeoutMessage.js +3 -6
  7. package/errors/overlay/LocalAwsLambdaTimeoutMessage.js.map +1 -0
  8. package/errors/overlay/StyledComponents.d.ts +7 -0
  9. package/errors/overlay/StyledComponents.js +10 -0
  10. package/errors/overlay/StyledComponents.js.map +1 -0
  11. package/errors/overlay/Typography.js.map +1 -0
  12. package/errors/overlay/assets/close_24px.js.map +1 -0
  13. package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/createErrorOverlay.js +2 -2
  14. package/errors/overlay/createErrorOverlay.js.map +1 -0
  15. package/features/router/HistoryRouterGateway.d.ts +3 -0
  16. package/features/router/HistoryRouterGateway.js +12 -0
  17. package/features/router/HistoryRouterGateway.js.map +1 -1
  18. package/features/router/Route.d.ts +1 -1
  19. package/features/router/RouterPresenter.d.ts +2 -0
  20. package/features/router/RouterPresenter.js +10 -0
  21. package/features/router/RouterPresenter.js.map +1 -1
  22. package/features/router/RouterRepository.d.ts +2 -0
  23. package/features/router/RouterRepository.js +8 -2
  24. package/features/router/RouterRepository.js.map +1 -1
  25. package/features/router/abstractions.d.ts +9 -0
  26. package/features/router/abstractions.js.map +1 -1
  27. package/index.d.ts +0 -3
  28. package/index.js +0 -3
  29. package/package.json +9 -22
  30. package/plugins/image.d.ts +1 -1
  31. package/presentation/router/components/RouteParamsSync.d.ts +22 -0
  32. package/presentation/router/components/RouteParamsSync.js +53 -0
  33. package/presentation/router/components/RouteParamsSync.js.map +1 -0
  34. package/presentation/router/hooks/useRoute.d.ts +1 -0
  35. package/presentation/router/hooks/useRoute.js +2 -1
  36. package/presentation/router/hooks/useRoute.js.map +1 -1
  37. package/presentation/router/hooks/useRouter.d.ts +1 -0
  38. package/presentation/router/hooks/useRouter.js +1 -0
  39. package/presentation/router/hooks/useRouter.js.map +1 -1
  40. package/presentation/router/index.d.ts +2 -0
  41. package/presentation/router/index.js +1 -0
  42. package/types.d.ts +0 -21
  43. package/apollo-client/InMemoryCache.d.ts +0 -8
  44. package/apollo-client/InMemoryCache.js +0 -18
  45. package/apollo-client/InMemoryCache.js.map +0 -1
  46. package/apollo-client/IntrospectionFragmentMatcher.d.ts +0 -11
  47. package/apollo-client/IntrospectionFragmentMatcher.js +0 -33
  48. package/apollo-client/IntrospectionFragmentMatcher.js.map +0 -1
  49. package/hooks/useAutocomplete/index.d.ts +0 -1
  50. package/hooks/useAutocomplete/index.js +0 -1
  51. package/hooks/useAutocomplete/useAutocomplete.d.ts +0 -11
  52. package/hooks/useAutocomplete/useAutocomplete.js +0 -17
  53. package/hooks/useAutocomplete/useAutocomplete.js.map +0 -1
  54. package/hooks/useDataList/functions/getData.d.ts +0 -2
  55. package/hooks/useDataList/functions/getData.js +0 -5
  56. package/hooks/useDataList/functions/getData.js.map +0 -1
  57. package/hooks/useDataList/functions/getError.d.ts +0 -2
  58. package/hooks/useDataList/functions/getError.js +0 -5
  59. package/hooks/useDataList/functions/getError.js.map +0 -1
  60. package/hooks/useDataList/functions/getMeta.d.ts +0 -2
  61. package/hooks/useDataList/functions/getMeta.js +0 -5
  62. package/hooks/useDataList/functions/getMeta.js.map +0 -1
  63. package/hooks/useDataList/functions/index.d.ts +0 -3
  64. package/hooks/useDataList/functions/index.js +0 -3
  65. package/hooks/useDataList/functions/searchDataByKey.d.ts +0 -2
  66. package/hooks/useDataList/functions/searchDataByKey.js +0 -13
  67. package/hooks/useDataList/functions/searchDataByKey.js.map +0 -1
  68. package/hooks/useDataList/index.d.ts +0 -1
  69. package/hooks/useDataList/index.js +0 -1
  70. package/hooks/useDataList/useDataList.d.ts +0 -35
  71. package/hooks/useDataList/useDataList.js +0 -142
  72. package/hooks/useDataList/useDataList.js.map +0 -1
  73. package/hooks/useDataList/utils/index.d.ts +0 -1
  74. package/hooks/useDataList/utils/index.js +0 -1
  75. package/hooks/useDataList/utils/prepareLoadListParams.d.ts +0 -10
  76. package/hooks/useDataList/utils/prepareLoadListParams.js +0 -29
  77. package/hooks/useDataList/utils/prepareLoadListParams.js.map +0 -1
  78. package/plugins/AddQuerySelectionPlugin.d.ts +0 -22
  79. package/plugins/AddQuerySelectionPlugin.js +0 -47
  80. package/plugins/AddQuerySelectionPlugin.js.map +0 -1
  81. package/plugins/ApolloCacheObjectIdPlugin.d.ts +0 -15
  82. package/plugins/ApolloCacheObjectIdPlugin.js +0 -17
  83. package/plugins/ApolloCacheObjectIdPlugin.js.map +0 -1
  84. package/plugins/ApolloDynamicLink.d.ts +0 -7
  85. package/plugins/ApolloDynamicLink.js +0 -29
  86. package/plugins/ApolloDynamicLink.js.map +0 -1
  87. package/plugins/ApolloLinkPlugin.d.ts +0 -13
  88. package/plugins/ApolloLinkPlugin.js +0 -23
  89. package/plugins/ApolloLinkPlugin.js.map +0 -1
  90. package/plugins/ConsoleLinkPlugin.d.ts +0 -8
  91. package/plugins/ConsoleLinkPlugin.js +0 -24
  92. package/plugins/ConsoleLinkPlugin.js.map +0 -1
  93. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +0 -1
  94. package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +0 -1
  95. package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +0 -1
  96. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +0 -8
  97. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +0 -69
  98. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +0 -1
  99. package/plugins/NetworkErrorLinkPlugin/Typography.js.map +0 -1
  100. package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js.map +0 -1
  101. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +0 -1
  102. package/plugins/NetworkErrorLinkPlugin.d.ts +0 -10
  103. package/plugins/NetworkErrorLinkPlugin.js +0 -53
  104. package/plugins/NetworkErrorLinkPlugin.js.map +0 -1
  105. package/plugins/OmitTypenameLinkPlugin.d.ts +0 -8
  106. package/plugins/OmitTypenameLinkPlugin.js +0 -16
  107. package/plugins/OmitTypenameLinkPlugin.js.map +0 -1
  108. package/plugins/TenantHeaderLinkPlugin.d.ts +0 -10
  109. package/plugins/TenantHeaderLinkPlugin.js +0 -28
  110. package/plugins/TenantHeaderLinkPlugin.js.map +0 -1
  111. /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/ErrorOverlay.d.ts +0 -0
  112. /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/GqlErrorOverlay.d.ts +0 -0
  113. /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/GqlErrorOverlay.js +0 -0
  114. /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/LocalAwsLambdaTimeoutMessage.d.ts +0 -0
  115. /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/Typography.d.ts +0 -0
  116. /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/Typography.js +0 -0
  117. /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/assets/close_24px.js +0 -0
  118. /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/assets/close_24px.svg +0 -0
  119. /package/{plugins/NetworkErrorLinkPlugin → errors/overlay}/createErrorOverlay.d.ts +0 -0
@@ -1,22 +0,0 @@
1
- import { ApolloLink } from "apollo-link";
2
- import type { DocumentNode } from "graphql";
3
- import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
4
- declare module "graphql" {
5
- interface DocumentNode {
6
- __webiny__: Set<string>;
7
- }
8
- }
9
- interface Config {
10
- operationName: string;
11
- selectionPath: string;
12
- addSelection: DocumentNode;
13
- }
14
- export declare class AddQuerySelectionPlugin extends ApolloLinkPlugin {
15
- private readonly config;
16
- constructor(config: Config);
17
- createLink(): ApolloLink;
18
- addSelectionToQuery(operationName: string, document: DocumentNode): void;
19
- private isProcessed;
20
- private markProcessed;
21
- }
22
- export {};
@@ -1,47 +0,0 @@
1
- import { ApolloLink } from "apollo-link";
2
- import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
3
- class AddQuerySelectionPlugin extends ApolloLinkPlugin {
4
- constructor(config){
5
- super();
6
- this.config = config;
7
- }
8
- createLink() {
9
- return new ApolloLink((operation, forward)=>{
10
- if (operation.operationName !== this.config.operationName) return forward(operation);
11
- this.addSelectionToQuery(operation.operationName, operation.query);
12
- return forward(operation);
13
- });
14
- }
15
- addSelectionToQuery(operationName, document) {
16
- if (operationName !== this.config.operationName) return;
17
- if (this.isProcessed(document)) return;
18
- this.markProcessed(document);
19
- const { addSelection, selectionPath } = this.config;
20
- const firstQueryDefinition = document.definitions[0];
21
- if (!firstQueryDefinition) return;
22
- if (!firstQueryDefinition.selectionSet) return;
23
- let tree = firstQueryDefinition.selectionSet.selections;
24
- const fields = selectionPath.split(".");
25
- fieldLoop: for (const field of fields){
26
- for (const selection of tree)if (selection.selectionSet) {
27
- if (selection.name.value === field) {
28
- tree = selection.selectionSet.selections;
29
- continue fieldLoop;
30
- }
31
- }
32
- return;
33
- }
34
- tree.push(...addSelection.definitions[0].selectionSet.selections);
35
- }
36
- isProcessed(document) {
37
- if (!document.hasOwnProperty("__webiny__")) document.__webiny__ = new Set();
38
- return document.__webiny__.has(this.cacheKey);
39
- }
40
- markProcessed(document) {
41
- if (!document.hasOwnProperty("__webiny__")) document.__webiny__ = new Set();
42
- document.__webiny__.add(this.cacheKey);
43
- }
44
- }
45
- export { AddQuerySelectionPlugin };
46
-
47
- //# sourceMappingURL=AddQuerySelectionPlugin.js.map
@@ -1 +0,0 @@
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,15 +0,0 @@
1
- import { Plugin } from "@webiny/plugins";
2
- export interface ApolloCacheObject {
3
- __typename?: string;
4
- [key: string]: any;
5
- }
6
- interface ApolloCacheObjectIdPluginCallable<T> {
7
- (data: T): string | null | undefined;
8
- }
9
- export declare class ApolloCacheObjectIdPlugin<T extends ApolloCacheObject = ApolloCacheObject> extends Plugin {
10
- static readonly type: string;
11
- private readonly _getObjectId?;
12
- constructor(getObjectId?: ApolloCacheObjectIdPluginCallable<T>);
13
- getObjectId(data: T): string | null | undefined;
14
- }
15
- export {};
@@ -1,17 +0,0 @@
1
- import { Plugin } from "@webiny/plugins";
2
- class ApolloCacheObjectIdPlugin extends Plugin {
3
- static{
4
- this.type = "cache-get-object-id";
5
- }
6
- constructor(getObjectId){
7
- super();
8
- this._getObjectId = getObjectId;
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);
13
- }
14
- }
15
- export { ApolloCacheObjectIdPlugin };
16
-
17
- //# sourceMappingURL=ApolloCacheObjectIdPlugin.js.map
@@ -1 +0,0 @@
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,7 +0,0 @@
1
- import type { NextLink } from "apollo-link";
2
- import { ApolloLink } from "apollo-link";
3
- import type { Operation } from "apollo-link/lib/types.js";
4
- export declare class ApolloDynamicLink extends ApolloLink {
5
- private cache;
6
- request(operation: Operation, forward: NextLink): any;
7
- }
@@ -1,29 +0,0 @@
1
- import { ApolloLink } from "apollo-link";
2
- import { plugins } from "@webiny/plugins";
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;
11
- }
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);
22
- }
23
- constructor(...args){
24
- super(...args), this.cache = new Map();
25
- }
26
- }
27
- export { ApolloDynamicLink };
28
-
29
- //# sourceMappingURL=ApolloDynamicLink.js.map
@@ -1 +0,0 @@
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,13 +0,0 @@
1
- import type { ApolloLink } from "apollo-link";
2
- import { Plugin } from "@webiny/plugins";
3
- export interface ApolloLinkFactory {
4
- (): ApolloLink;
5
- }
6
- export declare class ApolloLinkPlugin extends Plugin {
7
- static readonly type: string;
8
- readonly cacheKey: string;
9
- private readonly factory?;
10
- private cache?;
11
- constructor(factory?: ApolloLinkFactory);
12
- createLink(): ApolloLink;
13
- }
@@ -1,23 +0,0 @@
1
- import { nanoid } from "nanoid";
2
- import { Plugin } from "@webiny/plugins";
3
- class ApolloLinkPlugin extends Plugin {
4
- static{
5
- this.type = "apollo-link";
6
- }
7
- constructor(factory){
8
- super();
9
- this.factory = factory;
10
- this.cacheKey = nanoid();
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.`);
19
- }
20
- }
21
- export { ApolloLinkPlugin };
22
-
23
- //# sourceMappingURL=ApolloLinkPlugin.js.map
@@ -1 +0,0 @@
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,8 +0,0 @@
1
- import { ApolloLink } from "apollo-link";
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 declare class ConsoleLinkPlugin extends ApolloLinkPlugin {
7
- createLink(): ApolloLink;
8
- }
@@ -1,24 +0,0 @@
1
- import { ApolloLink } from "apollo-link";
2
- import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
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
- }
21
- }
22
- export { ConsoleLinkPlugin };
23
-
24
- //# sourceMappingURL=ConsoleLinkPlugin.js.map
@@ -1 +0,0 @@
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 +0,0 @@
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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js","sources":["../../../src/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.tsx"],"sourcesContent":["import React from \"react\";\nimport get from \"lodash/get.js\";\nimport { Typography } from \"./Typography.js\";\nimport { i18n } from \"../../i18n/index.js\";\nimport { Pre } from \"./StyledComponents.js\";\nimport { ErrorOverlay } from \"./ErrorOverlay.js\";\n\nconst t = i18n.ns(\"app/graphql/error-overlay\");\n\ninterface ErrorOverlayProps {\n query: string;\n networkError: {\n message: string;\n result?: {\n error?: {\n stack?: string;\n };\n };\n };\n}\n\nexport const GqlErrorOverlay = (props: ErrorOverlayProps) => {\n const { query, networkError } = props;\n const stackTrace = get(networkError, \"result.error.stack\");\n\n const title = networkError.message;\n\n const message = (\n <>\n <Typography use={\"subtitle\"}>{t`Error occurred while executing operation:`}</Typography>\n <Pre>\n <code>{query}</code>\n </Pre>\n </>\n );\n\n let description: React.ReactNode = null;\n if (stackTrace) {\n description = (\n <>\n <Typography use={\"subtitle\"}>{t`Complete stack trace:`}</Typography>\n <Pre>\n <code>{stackTrace}</code>\n </Pre>\n </>\n );\n }\n\n return <ErrorOverlay title={title} message={message} description={description} />;\n};\n"],"names":["t","i18n","GqlErrorOverlay","props","query","networkError","stackTrace","get","title","message","Typography","Pre","description","ErrorOverlay"],"mappings":";;;;;;AAOA,MAAMA,IAAIC,KAAK,EAAE,CAAC;AAcX,MAAMC,kBAAkB,CAACC;IAC5B,MAAM,EAAEC,KAAK,EAAEC,YAAY,EAAE,GAAGF;IAChC,MAAMG,aAAaC,IAAIF,cAAc;IAErC,MAAMG,QAAQH,aAAa,OAAO;IAElC,MAAMI,UAAU,WAAVA,GACF,wDACI,oBAACC,YAAUA;QAAC,KAAK;OAAaV,CAAC,CAAC,yCAAyC,CAAC,iBAC1E,oBAACW,KAAGA,MAAAA,WAAAA,GACA,oBAAC,cAAMP;IAKnB,IAAIQ,cAA+B;IACnC,IAAIN,YACAM,cAAc,WAAdA,GACI,wDACI,oBAACF,YAAUA;QAAC,KAAK;OAAaV,CAAC,CAAC,qBAAqB,CAAC,iBACtD,oBAACW,KAAGA,MAAAA,WAAAA,GACA,oBAAC,cAAML;IAMvB,OAAO,WAAP,GAAO,oBAACO,cAAYA;QAAC,OAAOL;QAAO,SAASC;QAAS,aAAaG;;AACtE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js","sources":["../../../src/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.tsx"],"sourcesContent":["import React from \"react\";\nimport styled from \"@emotion/styled\";\n\nconst Code = styled.code`\n font-family: monospace;\n font-size: 0.85rem;\n line-height: 1rem;\n`;\n\nexport const LocalAwsLambdaTimeoutMessage = () => (\n <>\n Local AWS Lambda function execution timed out.\n <br />\n <br />\n Did you stop the&nbsp;\n <a\n href={\"https://www.webiny.com/docs/core-development-concepts/basics/watch-command\"}\n rel={\"noreferrer noopener\"}\n target={\"_blank\"}\n >\n <Code>webiny watch</Code>\n </a>\n &nbsp;command? If so, please restart the command or deploy your changes via the&nbsp;\n <a\n href={\"https://www.webiny.com/docs/core-development-concepts/basics/project-deployment\"}\n rel={\"noreferrer noopener\"}\n target={\"_blank\"}\n >\n <Code>webiny deploy</Code>\n </a>\n &nbsp;command. For example: <Code>yarn webiny deploy api --env dev</Code>.\n <br />\n <br />\n Learn more:&nbsp;\n <a\n href={\"https://webiny.link/local-aws-lambda-development\"}\n rel={\"noreferrer noopener\"}\n target={\"_blank\"}\n >\n https://webiny.link/local-aws-lambda-development\n </a>\n </>\n);\n"],"names":["Code","styled","LocalAwsLambdaTimeoutMessage"],"mappings":";;AAGA,MAAMA,OAAOC,OAAO,IAAI,CAAC;;;;AAIzB,CAAC;AAEM,MAAMC,+BAA+B,kBACxC,0CAAE,gEAEE,oBAAC,2BACD,oBAAC,aAAK,sCAEN,oBAAC;QACG,MAAM;QACN,KAAK;QACL,QAAQ;qBAER,oBAACF,MAAIA,MAAC,kBACN,mGAEJ,oBAAC;QACG,MAAM;QACN,KAAK;QACL,QAAQ;qBAER,oBAACA,MAAIA,MAAC,mBACN,4CACwB,oBAACA,MAAIA,MAAC,qCAAuC,mBACzE,oBAAC,2BACD,oBAAC,aAAK,iCAEN,oBAAC;QACG,MAAM;QACN,KAAK;QACL,QAAQ;OACX"}
@@ -1,8 +0,0 @@
1
- export declare const OverlayWrapper: import("@emotion/styled").StyledComponent<{
2
- theme?: import("@emotion/react").Theme;
3
- as?: React.ElementType;
4
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
5
- export declare const Pre: import("@emotion/styled").StyledComponent<{
6
- theme?: import("@emotion/react").Theme;
7
- as?: React.ElementType;
8
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLPreElement>, HTMLPreElement>, {}>;
@@ -1,69 +0,0 @@
1
- import styled from "@emotion/styled";
2
- const OverlayWrapper = styled("div")(`
3
- width: 100vw;
4
- height: 100vh;
5
- position: fixed;
6
- top: 0;
7
- left: 0;
8
- z-index: 105; // The highest z-index value is 100 for Dialogs
9
-
10
- .inner {
11
- box-sizing: border-box;
12
- display: flex;
13
- flex-direction: column;
14
- width: 100%;
15
- height: 100%;
16
- overflow: auto;
17
- background-color: white;
18
- padding: 1rem;
19
- }
20
-
21
- .header {
22
- display: flex;
23
- justify-content: space-between;
24
- align-items: center;
25
- margin-bottom: 1rem;
26
- .header__title {
27
- color: var(--mdc-theme-error);
28
- }
29
- }
30
-
31
- .body {
32
- grow: 1;
33
- .body__summary {
34
- margin-bottom: 1rem;
35
- }
36
- }
37
-
38
- .footer {
39
- color: var(--mdc-theme-text-secondary-on-background);
40
-
41
- .highlight {
42
- background-color: rgba(251, 245, 180, 0.5);
43
- padding: 0 4px;
44
- border-radius: 6px;
45
- font-family: monospace;
46
- }
47
- }
48
- `);
49
- const Pre = styled("pre")(`
50
- position: relative;
51
- display: block;
52
- padding: 0.5em;
53
- margin-top: 0.5em;
54
- margin-bottom: 0.5em;
55
- overflow-x: auto;
56
- white-space: pre-wrap;
57
- border-radius: 0.25rem;
58
- background-color: rgba(251, 245, 180, 0.3);
59
- color: inherit;
60
-
61
- code {
62
- font-family: monospace;
63
- font-size: 0.85rem;
64
- line-height: 1rem;
65
- }
66
- `);
67
- export { OverlayWrapper, Pre };
68
-
69
- //# sourceMappingURL=StyledComponents.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins/NetworkErrorLinkPlugin/StyledComponents.js","sources":["../../../src/plugins/NetworkErrorLinkPlugin/StyledComponents.tsx"],"sourcesContent":["import styled from \"@emotion/styled\";\n\nexport const OverlayWrapper = styled(\"div\")(`\n width: 100vw;\n height: 100vh;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 105; // The highest z-index value is 100 for Dialogs\n \n .inner {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n overflow: auto;\n background-color: white;\n padding: 1rem;\n }\n \n .header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 1rem;\n .header__title {\n color: var(--mdc-theme-error);\n }\n }\n \n .body {\n grow: 1;\n .body__summary {\n margin-bottom: 1rem;\n }\n }\n \n .footer {\n color: var(--mdc-theme-text-secondary-on-background);\n \n .highlight {\n background-color: rgba(251, 245, 180, 0.5);\n padding: 0 4px;\n border-radius: 6px;\n font-family: monospace;\n }\n }\n`);\n\nexport const Pre = styled(\"pre\")(`\n position: relative;\n display: block;\n padding: 0.5em;\n margin-top: 0.5em;\n margin-bottom: 0.5em;\n overflow-x: auto;\n white-space: pre-wrap;\n border-radius: 0.25rem;\n background-color: rgba(251, 245, 180, 0.3);\n color: inherit;\n \n code {\n font-family: monospace;\n font-size: 0.85rem;\n line-height: 1rem;\n }\n`);\n"],"names":["OverlayWrapper","styled","Pre"],"mappings":";AAEO,MAAMA,iBAAiBC,OAAO,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8C7C,CAAC;AAEM,MAAMC,MAAMD,OAAO,OAAO,CAAC;;;;;;;;;;;;;;;;;AAiBlC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins/NetworkErrorLinkPlugin/Typography.js","sources":["../../../src/plugins/NetworkErrorLinkPlugin/Typography.tsx"],"sourcesContent":["import React from \"react\";\n\nexport declare type TypographyT = \"headline\" | \"body\" | \"subtitle\";\n\nexport interface TypographyProps {\n use: TypographyT;\n children?: React.ReactNode;\n className?: string;\n}\n\nexport const Typography = (props: TypographyProps) => {\n const { children, use, className } = props;\n\n if (use === \"headline\") {\n return <h4 className={className}>{children}</h4>;\n }\n\n return <p className={className}>{children}</p>;\n};\n"],"names":["Typography","props","children","use","className"],"mappings":";AAUO,MAAMA,aAAa,CAACC;IACvB,MAAM,EAAEC,QAAQ,EAAEC,GAAG,EAAEC,SAAS,EAAE,GAAGH;IAErC,IAAIE,AAAQ,eAARA,KACA,OAAO,WAAP,GAAO,oBAAC;QAAG,WAAWC;OAAYF;IAGtC,OAAO,WAAP,GAAO,oBAAC;QAAE,WAAWE;OAAYF;AACrC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins/NetworkErrorLinkPlugin/assets/close_24px.js","sources":["../../../../src/plugins/NetworkErrorLinkPlugin/assets/close_24px.svg"],"sourcesContent":["import * as React from \"react\";\nconst SvgClose24Px = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={24} height={24} viewBox=\"0 0 24 24\" {...props}><path fill=\"none\" d=\"M0 0h24v24H0z\" /><path d=\"M18.3 5.71a.996.996 0 0 0-1.41 0L12 10.59 7.11 5.7A.996.996 0 1 0 5.7 7.11L10.59 12 5.7 16.89a.996.996 0 1 0 1.41 1.41L12 13.41l4.89 4.89a.996.996 0 1 0 1.41-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4\" /></svg>;\nexport { SvgClose24Px as ReactComponent };\nexport default \"__RSLIB_SVGR_AUTO_PUBLIC_PATH__static/svg/close_24px.33adaadc.svg\";"],"names":["SvgClose24Px","props"],"mappings":";;AACA,MAAMA,eAAeC,CAAAA,QAAAA,WAAAA,GAAS,sCAAC;QAAI,OAAM;QAA6B,OAAO;QAAI,QAAQ;QAAI,SAAQ;QAAa,GAAGA,KAAK;qBAAE,sCAAC;QAAK,MAAK;QAAO,GAAE;sBAAkB,sCAAC;QAAK,GAAE;;AAE1K"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins/NetworkErrorLinkPlugin/createErrorOverlay.js","sources":["../../../src/plugins/NetworkErrorLinkPlugin/createErrorOverlay.tsx"],"sourcesContent":["import type React from \"react\";\nimport { createRoot } from \"react-dom/client\";\n\ninterface CreateErrorOverlayParams {\n element: React.ReactElement;\n closeable?: boolean;\n}\n\nconst createErrorOverlay = (params: CreateErrorOverlayParams): void => {\n const { element } = params;\n // If the element already present in DOM, return immediately.\n if (document.getElementById(\"overlay-root\")) {\n return;\n }\n // Create root element to hold React tree.\n const container: HTMLDivElement = document.createElement(\"div\");\n container.id = \"overlay-root\";\n // Insert root element into body.\n const body: HTMLBodyElement = document.getElementsByTagName(\"body\")[0];\n body.appendChild(container);\n // Mount the ErrorOverlay component into root element.\n const root = createRoot(container);\n root.render(element);\n};\n\nexport default createErrorOverlay;\n"],"names":["createErrorOverlay","params","element","document","container","body","root","createRoot"],"mappings":";AAQA,MAAMA,qBAAqB,CAACC;IACxB,MAAM,EAAEC,OAAO,EAAE,GAAGD;IAEpB,IAAIE,SAAS,cAAc,CAAC,iBACxB;IAGJ,MAAMC,YAA4BD,SAAS,aAAa,CAAC;IACzDC,UAAU,EAAE,GAAG;IAEf,MAAMC,OAAwBF,SAAS,oBAAoB,CAAC,OAAO,CAAC,EAAE;IACtEE,KAAK,WAAW,CAACD;IAEjB,MAAME,OAAOC,WAAWH;IACxBE,KAAK,MAAM,CAACJ;AAChB;AAEA,kDAAeF"}
@@ -1,10 +0,0 @@
1
- import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
2
- import type { EventPublisher } from "../features/eventPublisher/index.js";
3
- /**
4
- * This plugin creates an ApolloLink that checks for `NetworkError` and shows an ErrorOverlay in the browser.
5
- */
6
- export declare class NetworkErrorLinkPlugin extends ApolloLinkPlugin {
7
- private getEventPublisher;
8
- constructor(getEventPublisher: () => EventPublisher.Interface);
9
- createLink(): import("apollo-link").ApolloLink;
10
- }
@@ -1,53 +0,0 @@
1
- import react from "react";
2
- import { onError } from "apollo-link-error";
3
- import { print } from "graphql/language/index.js";
4
- import { toBoolean } from "@webiny/stdlib";
5
- import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
6
- import createErrorOverlay from "./NetworkErrorLinkPlugin/createErrorOverlay.js";
7
- import { LocalAwsLambdaTimeoutMessage } from "./NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js";
8
- import { config } from "../config.js";
9
- import { ErrorOverlay } from "./NetworkErrorLinkPlugin/ErrorOverlay.js";
10
- import { GqlErrorOverlay } from "./NetworkErrorLinkPlugin/GqlErrorOverlay.js";
11
- import { NetworkErrorEvent } from "../errors/index.js";
12
- const isLocalAwsLambdaFnInvocationTimeoutError = (error)=>error.result && "LOCAL_AWS_LAMBDA_TIMEOUT" === error.result.code;
13
- class NetworkErrorLinkPlugin extends ApolloLinkPlugin {
14
- constructor(getEventPublisher){
15
- super(), this.getEventPublisher = getEventPublisher;
16
- }
17
- createLink() {
18
- return onError(({ networkError, operation })=>{
19
- const debug = config.getKey("DEBUG", toBoolean(process.env.REACT_APP_DEBUG));
20
- if (networkError) {
21
- const errorType = isLocalAwsLambdaFnInvocationTimeoutError(networkError) ? "timeout" : "network";
22
- const event = new NetworkErrorEvent({
23
- message: networkError.message,
24
- operationName: operation.operationName,
25
- query: print(operation.query),
26
- variables: operation.variables,
27
- errorType,
28
- statusCode: networkError.statusCode,
29
- result: networkError.result
30
- });
31
- this.getEventPublisher().publish(event);
32
- if (debug) {
33
- if (isLocalAwsLambdaFnInvocationTimeoutError(networkError)) return void createErrorOverlay({
34
- element: /*#__PURE__*/ react.createElement(ErrorOverlay, {
35
- message: /*#__PURE__*/ react.createElement(LocalAwsLambdaTimeoutMessage, null),
36
- closeable: false
37
- }),
38
- closeable: false
39
- });
40
- createErrorOverlay({
41
- element: /*#__PURE__*/ react.createElement(GqlErrorOverlay, {
42
- query: print(operation.query),
43
- networkError: networkError
44
- })
45
- });
46
- }
47
- }
48
- });
49
- }
50
- }
51
- export { NetworkErrorLinkPlugin };
52
-
53
- //# sourceMappingURL=NetworkErrorLinkPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins/NetworkErrorLinkPlugin.js","sources":["../../src/plugins/NetworkErrorLinkPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { onError } from \"apollo-link-error\";\nimport { type ServerError } from \"apollo-link-http-common\";\nimport { print } from \"graphql/language/index.js\";\nimport { toBoolean } from \"@webiny/stdlib\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport createErrorOverlay from \"./NetworkErrorLinkPlugin/createErrorOverlay.js\";\nimport { LocalAwsLambdaTimeoutMessage } from \"./NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js\";\nimport { config as appConfig } from \"~/config.js\";\nimport { ErrorOverlay } from \"~/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js\";\nimport { GqlErrorOverlay } from \"./NetworkErrorLinkPlugin/GqlErrorOverlay.js\";\nimport type { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { NetworkErrorEvent } from \"~/errors/index.js\";\n\nconst isLocalAwsLambdaFnInvocationTimeoutError = (error: any): error is ServerError => {\n return error.result && error.result.code === \"LOCAL_AWS_LAMBDA_TIMEOUT\";\n};\n\n/**\n * This plugin creates an ApolloLink that checks for `NetworkError` and shows an ErrorOverlay in the browser.\n */\nexport class NetworkErrorLinkPlugin extends ApolloLinkPlugin {\n constructor(private getEventPublisher: () => EventPublisher.Interface) {\n super();\n }\n\n public override createLink() {\n return onError(({ networkError, operation }) => {\n const debug = appConfig.getKey(\"DEBUG\", toBoolean(process.env.REACT_APP_DEBUG));\n\n if (networkError) {\n // Publish network error event\n const errorType = isLocalAwsLambdaFnInvocationTimeoutError(networkError)\n ? \"timeout\"\n : \"network\";\n\n const event = new NetworkErrorEvent({\n message: networkError.message,\n operationName: operation.operationName,\n query: print(operation.query),\n variables: operation.variables,\n errorType,\n statusCode: (networkError as any).statusCode,\n result: (networkError as any).result\n });\n\n this.getEventPublisher().publish(event);\n\n // Keep existing overlay logic for now\n if (debug) {\n if (isLocalAwsLambdaFnInvocationTimeoutError(networkError)) {\n createErrorOverlay({\n element: (\n <ErrorOverlay\n message={<LocalAwsLambdaTimeoutMessage />}\n closeable={false}\n />\n ),\n closeable: false\n });\n return;\n }\n\n createErrorOverlay({\n element: (\n <GqlErrorOverlay\n query={print(operation.query)}\n networkError={networkError}\n />\n )\n });\n }\n }\n\n // TODO: also print graphQLErrors\n });\n }\n}\n"],"names":["isLocalAwsLambdaFnInvocationTimeoutError","error","NetworkErrorLinkPlugin","ApolloLinkPlugin","getEventPublisher","onError","networkError","operation","debug","appConfig","toBoolean","process","errorType","event","NetworkErrorEvent","print","createErrorOverlay","ErrorOverlay","LocalAwsLambdaTimeoutMessage","GqlErrorOverlay"],"mappings":";;;;;;;;;;;AAcA,MAAMA,2CAA2C,CAACC,QACvCA,MAAM,MAAM,IAAIA,AAAsB,+BAAtBA,MAAM,MAAM,CAAC,IAAI;AAMrC,MAAMC,+BAA+BC;IACxC,YAAoBC,iBAAiD,CAAE;QACnE,KAAK,SADWA,iBAAiB,GAAjBA;IAEpB;IAEgB,aAAa;QACzB,OAAOC,QAAQ,CAAC,EAAEC,YAAY,EAAEC,SAAS,EAAE;YACvC,MAAMC,QAAQC,OAAAA,MAAgB,CAAC,SAASC,UAAUC,QAAQ,GAAG,CAAC,eAAe;YAE7E,IAAIL,cAAc;gBAEd,MAAMM,YAAYZ,yCAAyCM,gBACrD,YACA;gBAEN,MAAMO,QAAQ,IAAIC,kBAAkB;oBAChC,SAASR,aAAa,OAAO;oBAC7B,eAAeC,UAAU,aAAa;oBACtC,OAAOQ,MAAMR,UAAU,KAAK;oBAC5B,WAAWA,UAAU,SAAS;oBAC9BK;oBACA,YAAaN,aAAqB,UAAU;oBAC5C,QAASA,aAAqB,MAAM;gBACxC;gBAEA,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAACO;gBAGjC,IAAIL,OAAO;oBACP,IAAIR,yCAAyCM,eAAe,YACxDU,mBAAmB;wBACf,SAAS,WAAT,GACI,oBAACC,cAAYA;4BACT,uBAAS,oBAACC,8BAA4BA;4BACtC,WAAW;;wBAGnB,WAAW;oBACf;oBAIJF,mBAAmB;wBACf,SAAS,WAAT,GACI,oBAACG,iBAAeA;4BACZ,OAAOJ,MAAMR,UAAU,KAAK;4BAC5B,cAAcD;;oBAG1B;gBACJ;YACJ;QAGJ;IACJ;AACJ"}
@@ -1,8 +0,0 @@
1
- import { ApolloLink } from "apollo-link";
2
- import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
3
- /**
4
- * This link removes `__typename` from the variables being sent to the API.
5
- */
6
- export declare class OmitTypenameLinkPlugin extends ApolloLinkPlugin {
7
- createLink(): ApolloLink;
8
- }
@@ -1,16 +0,0 @@
1
- import { ApolloLink } from "apollo-link";
2
- import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
3
- function omitTypename(key, value) {
4
- return "__typename" === key ? void 0 : value;
5
- }
6
- class OmitTypenameLinkPlugin extends ApolloLinkPlugin {
7
- createLink() {
8
- return new ApolloLink((operation, forward)=>{
9
- if (operation.variables) operation.variables = JSON.parse(JSON.stringify(operation.variables), omitTypename);
10
- return forward(operation);
11
- });
12
- }
13
- }
14
- export { OmitTypenameLinkPlugin };
15
-
16
- //# sourceMappingURL=OmitTypenameLinkPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins/OmitTypenameLinkPlugin.js","sources":["../../src/plugins/OmitTypenameLinkPlugin.ts"],"sourcesContent":["import { ApolloLink } from \"apollo-link\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\n\nfunction omitTypename(key: string, value: string): string | undefined {\n return key === \"__typename\" ? undefined : value;\n}\n\n/**\n * This link removes `__typename` from the variables being sent to the API.\n */\nexport class OmitTypenameLinkPlugin extends ApolloLinkPlugin {\n public override createLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if (operation.variables) {\n operation.variables = JSON.parse(JSON.stringify(operation.variables), omitTypename);\n }\n return forward(operation);\n });\n }\n}\n"],"names":["omitTypename","key","value","undefined","OmitTypenameLinkPlugin","ApolloLinkPlugin","ApolloLink","operation","forward","JSON"],"mappings":";;AAGA,SAASA,aAAaC,GAAW,EAAEC,KAAa;IAC5C,OAAOD,AAAQ,iBAARA,MAAuBE,SAAYD;AAC9C;AAKO,MAAME,+BAA+BC;IACxB,aAAyB;QACrC,OAAO,IAAIC,WAAW,CAACC,WAAWC;YAC9B,IAAID,UAAU,SAAS,EACnBA,UAAU,SAAS,GAAGE,KAAK,KAAK,CAACA,KAAK,SAAS,CAACF,UAAU,SAAS,GAAGP;YAE1E,OAAOQ,QAAQD;QACnB;IACJ;AACJ"}
@@ -1,10 +0,0 @@
1
- import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
2
- import type { ApolloLink } from "apollo-link";
3
- /**
4
- * Append `x-tenant` header from URL query (necessary for prerendering service).
5
- */
6
- export declare class TenantHeaderLinkPlugin extends ApolloLinkPlugin {
7
- private readonly tenant;
8
- constructor(tenant: string);
9
- createLink(): ApolloLink;
10
- }
@@ -1,28 +0,0 @@
1
- import { setContext } from "apollo-link-context";
2
- import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
3
- class TenantHeaderLinkPlugin extends ApolloLinkPlugin {
4
- constructor(tenant){
5
- super();
6
- this.name = "tenant-header-link";
7
- this.tenant = tenant;
8
- }
9
- createLink() {
10
- return setContext((_, { headers })=>{
11
- if (headers && "x-tenant" in headers) return {
12
- headers
13
- };
14
- if (this.tenant) return {
15
- headers: {
16
- ...headers,
17
- "x-tenant": this.tenant
18
- }
19
- };
20
- return {
21
- headers
22
- };
23
- });
24
- }
25
- }
26
- export { TenantHeaderLinkPlugin };
27
-
28
- //# sourceMappingURL=TenantHeaderLinkPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugins/TenantHeaderLinkPlugin.js","sources":["../../src/plugins/TenantHeaderLinkPlugin.ts"],"sourcesContent":["import { setContext } from \"apollo-link-context\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport type { ApolloLink } from \"apollo-link\";\n\n/**\n * Append `x-tenant` header from URL query (necessary for prerendering service).\n */\nexport class TenantHeaderLinkPlugin extends ApolloLinkPlugin {\n private readonly tenant: string;\n\n public constructor(tenant: string) {\n super();\n this.name = \"tenant-header-link\";\n\n this.tenant = tenant;\n }\n\n public override createLink(): ApolloLink {\n return setContext((_, { headers }) => {\n // If tenant header is already set, do not overwrite it.\n if (headers && \"x-tenant\" in headers) {\n return { headers };\n }\n\n if (this.tenant) {\n return {\n headers: {\n ...headers,\n \"x-tenant\": this.tenant\n }\n };\n }\n\n return { headers };\n });\n }\n}\n"],"names":["TenantHeaderLinkPlugin","ApolloLinkPlugin","tenant","setContext","_","headers"],"mappings":";;AAOO,MAAMA,+BAA+BC;IAGxC,YAAmBC,MAAc,CAAE;QAC/B,KAAK;QACL,IAAI,CAAC,IAAI,GAAG;QAEZ,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEgB,aAAyB;QACrC,OAAOC,WAAW,CAACC,GAAG,EAAEC,OAAO,EAAE;YAE7B,IAAIA,WAAW,cAAcA,SACzB,OAAO;gBAAEA;YAAQ;YAGrB,IAAI,IAAI,CAAC,MAAM,EACX,OAAO;gBACH,SAAS;oBACL,GAAGA,OAAO;oBACV,YAAY,IAAI,CAAC,MAAM;gBAC3B;YACJ;YAGJ,OAAO;gBAAEA;YAAQ;QACrB;IACJ;AACJ"}