@webiny/app 0.0.0-mt-3 → 0.0.0-unstable.085ff6572f
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.
- package/App.d.ts +29 -0
- package/App.js +105 -0
- package/App.js.map +1 -0
- package/apollo-client/InMemoryCache.d.ts +1 -1
- package/apollo-client/InMemoryCache.js +33 -36
- package/apollo-client/InMemoryCache.js.map +1 -0
- package/components/Image.js +18 -16
- package/components/Image.js.map +1 -0
- package/components/Routes.js +27 -17
- package/components/Routes.js.map +1 -0
- package/components/View.js +21 -14
- package/components/View.js.map +1 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +19 -1
- package/components/index.js.map +1 -0
- package/config.d.ts +8 -0
- package/config.js +30 -0
- package/config.js.map +1 -0
- package/contexts/Ui/index.d.ts +1 -4
- package/contexts/Ui/index.js +32 -42
- package/contexts/Ui/index.js.map +1 -0
- package/core/AddRoute.d.ts +3 -0
- package/core/AddRoute.js +19 -0
- package/core/AddRoute.js.map +1 -0
- package/core/DebounceRender.d.ts +11 -0
- package/core/DebounceRender.js +41 -0
- package/core/DebounceRender.js.map +1 -0
- package/core/Plugin.d.ts +8 -0
- package/core/Plugin.js +21 -0
- package/core/Plugin.js.map +1 -0
- package/core/Plugins.d.ts +12 -0
- package/core/Plugins.js +45 -0
- package/core/Plugins.js.map +1 -0
- package/core/Provider.d.ts +9 -0
- package/core/Provider.js +21 -0
- package/core/Provider.js.map +1 -0
- package/core/Routes.d.ts +6 -0
- package/core/Routes.js +42 -0
- package/core/Routes.js.map +1 -0
- package/core/createProvider.d.ts +6 -0
- package/core/createProvider.js +13 -0
- package/core/createProvider.js.map +1 -0
- package/core/createProviderPlugin.d.ts +8 -0
- package/core/createProviderPlugin.js +21 -0
- package/core/createProviderPlugin.js.map +1 -0
- package/hooks/useAutocomplete/index.js +12 -1
- package/hooks/useAutocomplete/index.js.map +1 -0
- package/hooks/useAutocomplete/useAutocomplete.d.ts +6 -1
- package/hooks/useAutocomplete/useAutocomplete.js +16 -14
- package/hooks/useAutocomplete/useAutocomplete.js.map +1 -0
- package/hooks/useDataList/functions/getData.d.ts +1 -1
- package/hooks/useDataList/functions/getData.js +12 -4
- package/hooks/useDataList/functions/getData.js.map +1 -0
- package/hooks/useDataList/functions/getError.d.ts +1 -1
- package/hooks/useDataList/functions/getError.js +12 -4
- package/hooks/useDataList/functions/getError.js.map +1 -0
- package/hooks/useDataList/functions/getMeta.d.ts +1 -1
- package/hooks/useDataList/functions/getMeta.js +12 -4
- package/hooks/useDataList/functions/getMeta.js.map +1 -0
- package/hooks/useDataList/functions/index.js +27 -3
- package/hooks/useDataList/functions/index.js.map +1 -0
- package/hooks/useDataList/functions/searchDataByKey.d.ts +1 -1
- package/hooks/useDataList/functions/searchDataByKey.js +8 -6
- package/hooks/useDataList/functions/searchDataByKey.js.map +1 -0
- package/hooks/useDataList/index.js +12 -1
- package/hooks/useDataList/index.js.map +1 -0
- package/hooks/useDataList/useDataList.d.ts +4 -4
- package/hooks/useDataList/useDataList.js +47 -58
- package/hooks/useDataList/useDataList.js.map +1 -0
- package/hooks/useDataList/utils/index.js +20 -2
- package/hooks/useDataList/utils/index.js.map +1 -0
- package/hooks/useDataList/utils/prepareLoadListParams.d.ts +10 -3
- package/hooks/useDataList/utils/prepareLoadListParams.js +19 -15
- package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -0
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +13 -4
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +11 -4
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +1 -0
- package/hooks/useDataList/utils/types.js +5 -1
- package/hooks/useDataList/utils/types.js.map +1 -0
- package/hooks/useHandler.d.ts +11 -1
- package/hooks/useHandler.js +11 -5
- package/hooks/useHandler.js.map +1 -0
- package/hooks/useHandlers.d.ts +1 -1
- package/hooks/useHandlers.js +14 -6
- package/hooks/useHandlers.js.map +1 -0
- package/hooks/useUi.js +12 -5
- package/hooks/useUi.js.map +1 -0
- package/i18n/i18n.js +14 -5
- package/i18n/i18n.js.map +1 -0
- package/i18n/index.js +13 -1
- package/i18n/index.js.map +1 -0
- package/index.d.ts +15 -0
- package/index.js +147 -0
- package/index.js.map +1 -0
- package/package.json +33 -25
- package/plugins/AddQuerySelectionPlugin.d.ts +9 -2
- package/plugins/AddQuerySelectionPlugin.js +73 -52
- package/plugins/AddQuerySelectionPlugin.js.map +1 -0
- package/plugins/ApolloCacheObjectIdPlugin.d.ts +8 -8
- package/plugins/ApolloCacheObjectIdPlugin.js +23 -25
- package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -0
- package/plugins/ApolloDynamicLink.d.ts +3 -2
- package/plugins/ApolloDynamicLink.js +30 -32
- package/plugins/ApolloDynamicLink.js.map +1 -0
- package/plugins/ApolloLinkPlugin.d.ts +5 -5
- package/plugins/ApolloLinkPlugin.js +32 -29
- package/plugins/ApolloLinkPlugin.js.map +1 -0
- package/plugins/ConsoleLinkPlugin.js +25 -24
- package/plugins/ConsoleLinkPlugin.js.map +1 -0
- package/plugins/LocaleHeaderLinkPlugin.d.ts +3 -7
- package/plugins/LocaleHeaderLinkPlugin.js +28 -36
- package/plugins/LocaleHeaderLinkPlugin.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +13 -5
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +46 -45
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +10 -2
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +13 -4
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +6 -4
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +21 -17
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin.js +31 -28
- package/plugins/NetworkErrorLinkPlugin.js.map +1 -0
- package/plugins/OmitTypenameLinkPlugin.js +22 -22
- package/plugins/OmitTypenameLinkPlugin.js.map +1 -0
- package/plugins/RoutePlugin.d.ts +2 -2
- package/plugins/RoutePlugin.js +26 -24
- package/plugins/RoutePlugin.js.map +1 -0
- package/plugins/TenantHeaderLinkPlugin.d.ts +3 -7
- package/plugins/TenantHeaderLinkPlugin.js +28 -39
- package/plugins/TenantHeaderLinkPlugin.js.map +1 -0
- package/plugins/ViewPlugin.d.ts +4 -4
- package/plugins/ViewPlugin.js +26 -24
- package/plugins/ViewPlugin.js.map +1 -0
- package/plugins/image.js +41 -55
- package/plugins/image.js.map +1 -0
- package/plugins/index.js +49 -33
- package/plugins/index.js.map +1 -0
- package/types.d.ts +20 -16
- package/types.js +12 -2
- package/types.js.map +1 -0
- package/utils/getApiUrl.d.ts +1 -0
- package/utils/getApiUrl.js +11 -0
- package/utils/getApiUrl.js.map +1 -0
- package/utils/getGqlApiUrl.d.ts +1 -0
- package/utils/getGqlApiUrl.js +11 -0
- package/utils/getGqlApiUrl.js.map +1 -0
- package/utils/getHeadlessCmsGqlApiUrl.d.ts +5 -0
- package/utils/getHeadlessCmsGqlApiUrl.js +17 -0
- package/utils/getHeadlessCmsGqlApiUrl.js.map +1 -0
- package/utils/getLocaleCode.d.ts +6 -0
- package/utils/getLocaleCode.js +42 -0
- package/utils/getLocaleCode.js.map +1 -0
- package/utils/getPrerenderId.d.ts +6 -0
- package/utils/getPrerenderId.js +10 -0
- package/utils/getPrerenderId.js.map +1 -0
- package/utils/getTenantId.d.ts +6 -0
- package/utils/getTenantId.js +34 -0
- package/utils/getTenantId.js.map +1 -0
- package/utils/index.d.ts +8 -0
- package/utils/index.js +93 -0
- package/utils/index.js.map +1 -0
- package/utils/isLocalhost.d.ts +1 -0
- package/utils/isLocalhost.js +14 -0
- package/utils/isLocalhost.js.map +1 -0
- package/utils/isPrerendering.d.ts +1 -0
- package/utils/isPrerendering.js +10 -0
- package/utils/isPrerendering.js.map +1 -0
package/index.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
AddQuerySelectionPlugin: true,
|
|
8
|
+
ApolloLinkPlugin: true,
|
|
9
|
+
RoutePlugin: true,
|
|
10
|
+
ApolloCacheObjectIdPlugin: true
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "AddQuerySelectionPlugin", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _AddQuerySelectionPlugin.AddQuerySelectionPlugin;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "ApolloCacheObjectIdPlugin", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _ApolloCacheObjectIdPlugin.ApolloCacheObjectIdPlugin;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "ApolloLinkPlugin", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _ApolloLinkPlugin.ApolloLinkPlugin;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "RoutePlugin", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _RoutePlugin.RoutePlugin;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var _AddQuerySelectionPlugin = require("./plugins/AddQuerySelectionPlugin");
|
|
37
|
+
var _ApolloLinkPlugin = require("./plugins/ApolloLinkPlugin");
|
|
38
|
+
var _RoutePlugin = require("./plugins/RoutePlugin");
|
|
39
|
+
var _ApolloCacheObjectIdPlugin = require("./plugins/ApolloCacheObjectIdPlugin");
|
|
40
|
+
var _reactComposition = require("@webiny/react-composition");
|
|
41
|
+
Object.keys(_reactComposition).forEach(function (key) {
|
|
42
|
+
if (key === "default" || key === "__esModule") return;
|
|
43
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
44
|
+
if (key in exports && exports[key] === _reactComposition[key]) return;
|
|
45
|
+
Object.defineProperty(exports, key, {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function get() {
|
|
48
|
+
return _reactComposition[key];
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
var _App = require("./App");
|
|
53
|
+
Object.keys(_App).forEach(function (key) {
|
|
54
|
+
if (key === "default" || key === "__esModule") return;
|
|
55
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
56
|
+
if (key in exports && exports[key] === _App[key]) return;
|
|
57
|
+
Object.defineProperty(exports, key, {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function get() {
|
|
60
|
+
return _App[key];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
var _Plugins = require("./core/Plugins");
|
|
65
|
+
Object.keys(_Plugins).forEach(function (key) {
|
|
66
|
+
if (key === "default" || key === "__esModule") return;
|
|
67
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
68
|
+
if (key in exports && exports[key] === _Plugins[key]) return;
|
|
69
|
+
Object.defineProperty(exports, key, {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function get() {
|
|
72
|
+
return _Plugins[key];
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
var _Plugin = require("./core/Plugin");
|
|
77
|
+
Object.keys(_Plugin).forEach(function (key) {
|
|
78
|
+
if (key === "default" || key === "__esModule") return;
|
|
79
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
80
|
+
if (key in exports && exports[key] === _Plugin[key]) return;
|
|
81
|
+
Object.defineProperty(exports, key, {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function get() {
|
|
84
|
+
return _Plugin[key];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
var _Provider = require("./core/Provider");
|
|
89
|
+
Object.keys(_Provider).forEach(function (key) {
|
|
90
|
+
if (key === "default" || key === "__esModule") return;
|
|
91
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
92
|
+
if (key in exports && exports[key] === _Provider[key]) return;
|
|
93
|
+
Object.defineProperty(exports, key, {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
get: function get() {
|
|
96
|
+
return _Provider[key];
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
var _AddRoute = require("./core/AddRoute");
|
|
101
|
+
Object.keys(_AddRoute).forEach(function (key) {
|
|
102
|
+
if (key === "default" || key === "__esModule") return;
|
|
103
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
104
|
+
if (key in exports && exports[key] === _AddRoute[key]) return;
|
|
105
|
+
Object.defineProperty(exports, key, {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
get: function get() {
|
|
108
|
+
return _AddRoute[key];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
var _DebounceRender = require("./core/DebounceRender");
|
|
113
|
+
Object.keys(_DebounceRender).forEach(function (key) {
|
|
114
|
+
if (key === "default" || key === "__esModule") return;
|
|
115
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
116
|
+
if (key in exports && exports[key] === _DebounceRender[key]) return;
|
|
117
|
+
Object.defineProperty(exports, key, {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
get: function get() {
|
|
120
|
+
return _DebounceRender[key];
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
var _createProvider = require("./core/createProvider");
|
|
125
|
+
Object.keys(_createProvider).forEach(function (key) {
|
|
126
|
+
if (key === "default" || key === "__esModule") return;
|
|
127
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
128
|
+
if (key in exports && exports[key] === _createProvider[key]) return;
|
|
129
|
+
Object.defineProperty(exports, key, {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
get: function get() {
|
|
132
|
+
return _createProvider[key];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
var _createProviderPlugin = require("./core/createProviderPlugin");
|
|
137
|
+
Object.keys(_createProviderPlugin).forEach(function (key) {
|
|
138
|
+
if (key === "default" || key === "__esModule") return;
|
|
139
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
140
|
+
if (key in exports && exports[key] === _createProviderPlugin[key]) return;
|
|
141
|
+
Object.defineProperty(exports, key, {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
get: function get() {
|
|
144
|
+
return _createProviderPlugin[key];
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { AddQuerySelectionPlugin } from \"./plugins/AddQuerySelectionPlugin\";\nexport { ApolloLinkPlugin } from \"./plugins/ApolloLinkPlugin\";\nexport { RoutePlugin } from \"./plugins/RoutePlugin\";\nexport { ApolloCacheObjectIdPlugin } from \"./plugins/ApolloCacheObjectIdPlugin\";\n\n// Composition - we re-export this for ease of use\nexport * from \"@webiny/react-composition\";\nexport type { HigherOrderComponent, ComposeProps, ComposableFC } from \"@webiny/react-composition\";\n\n// App framework\nexport * from \"./App\";\nexport type { AppProps } from \"./App\";\nexport * from \"./core/Plugins\";\nexport * from \"./core/Plugin\";\nexport * from \"./core/Provider\";\nexport * from \"./core/AddRoute\";\nexport * from \"./core/DebounceRender\";\nexport * from \"./core/createProvider\";\nexport * from \"./core/createProviderPlugin\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAGA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAIA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AAEA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-unstable.085ff6572f",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,41 +15,48 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@apollo/react-hooks": "3.1.5",
|
|
18
|
-
"@babel/runtime": "7.
|
|
19
|
-
"@emotion/styled": "10.
|
|
20
|
-
"@types/react": "
|
|
21
|
-
"@
|
|
22
|
-
"@webiny/i18n
|
|
23
|
-
"@webiny/
|
|
24
|
-
"@webiny/
|
|
25
|
-
"@webiny/
|
|
18
|
+
"@babel/runtime": "7.20.13",
|
|
19
|
+
"@emotion/styled": "11.10.6",
|
|
20
|
+
"@types/react": "17.0.39",
|
|
21
|
+
"@types/web": "0.0.61",
|
|
22
|
+
"@webiny/i18n": "0.0.0-unstable.085ff6572f",
|
|
23
|
+
"@webiny/i18n-react": "0.0.0-unstable.085ff6572f",
|
|
24
|
+
"@webiny/plugins": "0.0.0-unstable.085ff6572f",
|
|
25
|
+
"@webiny/react-composition": "0.0.0-unstable.085ff6572f",
|
|
26
|
+
"@webiny/react-router": "0.0.0-unstable.085ff6572f",
|
|
27
|
+
"@webiny/ui": "0.0.0-unstable.085ff6572f",
|
|
26
28
|
"apollo-cache": "1.3.5",
|
|
27
29
|
"apollo-cache-inmemory": "1.6.6",
|
|
28
30
|
"apollo-client": "2.6.10",
|
|
29
31
|
"apollo-link": "1.2.14",
|
|
30
32
|
"apollo-link-context": "1.0.20",
|
|
31
33
|
"apollo-link-error": "1.1.13",
|
|
34
|
+
"apollo-link-http-common": "0.2.16",
|
|
32
35
|
"apollo-utilities": "1.3.4",
|
|
33
|
-
"boolean": "3.
|
|
34
|
-
"graphql": "
|
|
36
|
+
"boolean": "3.2.0",
|
|
37
|
+
"graphql": "15.8.0",
|
|
35
38
|
"invariant": "2.2.4",
|
|
36
39
|
"lodash": "4.17.21",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
40
|
+
"lodash.debounce": "4.0.8",
|
|
41
|
+
"nanoid": "3.3.4",
|
|
42
|
+
"react": "17.0.2",
|
|
43
|
+
"react-dom": "17.0.2",
|
|
39
44
|
"warning": "4.0.3"
|
|
40
45
|
},
|
|
41
46
|
"devDependencies": {
|
|
42
|
-
"@babel/cli": "
|
|
43
|
-
"@babel/core": "
|
|
44
|
-
"@babel/plugin-proposal-class-properties": "
|
|
45
|
-
"@babel/preset-env": "
|
|
46
|
-
"@babel/preset-react": "
|
|
47
|
-
"@babel/preset-typescript": "
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
47
|
+
"@babel/cli": "7.20.7",
|
|
48
|
+
"@babel/core": "7.20.12",
|
|
49
|
+
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
50
|
+
"@babel/preset-env": "7.20.2",
|
|
51
|
+
"@babel/preset-react": "7.18.6",
|
|
52
|
+
"@babel/preset-typescript": "7.18.6",
|
|
53
|
+
"@types/lodash.debounce": "4.0.7",
|
|
54
|
+
"@types/warning": "3.0.0",
|
|
55
|
+
"@webiny/cli": "0.0.0-unstable.085ff6572f",
|
|
56
|
+
"@webiny/project-utils": "0.0.0-unstable.085ff6572f",
|
|
57
|
+
"babel-plugin-lodash": "3.3.4",
|
|
58
|
+
"rimraf": "3.0.2",
|
|
59
|
+
"typescript": "4.7.4"
|
|
53
60
|
},
|
|
54
61
|
"publishConfig": {
|
|
55
62
|
"access": "public",
|
|
@@ -62,9 +69,10 @@
|
|
|
62
69
|
"adio": {
|
|
63
70
|
"ignore": {
|
|
64
71
|
"dependencies": [
|
|
72
|
+
"@types/web",
|
|
65
73
|
"react-dom"
|
|
66
74
|
]
|
|
67
75
|
}
|
|
68
76
|
},
|
|
69
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "085ff6572f6bb6a76d218088b06d9f4ef92bbea7"
|
|
70
78
|
}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { ApolloLink } from "apollo-link";
|
|
2
2
|
import { DocumentNode } from "graphql";
|
|
3
3
|
import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
|
|
4
|
+
declare module "graphql" {
|
|
5
|
+
interface DocumentNode {
|
|
6
|
+
__webiny__: Set<string>;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
4
9
|
interface Config {
|
|
5
10
|
operationName: string;
|
|
6
11
|
selectionPath: string;
|
|
7
12
|
addSelection: DocumentNode;
|
|
8
13
|
}
|
|
9
14
|
export declare class AddQuerySelectionPlugin extends ApolloLinkPlugin {
|
|
10
|
-
private config;
|
|
15
|
+
private readonly config;
|
|
11
16
|
constructor(config: Config);
|
|
12
17
|
createLink(): ApolloLink;
|
|
13
|
-
addSelectionToQuery(operationName: string,
|
|
18
|
+
addSelectionToQuery(operationName: string, document: DocumentNode): void;
|
|
19
|
+
private isProcessed;
|
|
20
|
+
private markProcessed;
|
|
14
21
|
}
|
|
15
22
|
export {};
|
|
@@ -1,101 +1,122 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.AddQuerySelectionPlugin = void 0;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
13
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _apolloLink = require("apollo-link");
|
|
17
|
+
var _graphql = require("graphql");
|
|
18
|
+
var _ApolloLinkPlugin2 = require("./ApolloLinkPlugin");
|
|
19
|
+
var AddQuerySelectionPlugin = /*#__PURE__*/function (_ApolloLinkPlugin) {
|
|
20
|
+
(0, _inherits2.default)(AddQuerySelectionPlugin, _ApolloLinkPlugin);
|
|
21
|
+
var _super = (0, _createSuper2.default)(AddQuerySelectionPlugin);
|
|
16
22
|
function AddQuerySelectionPlugin(config) {
|
|
17
23
|
var _this;
|
|
18
|
-
|
|
19
|
-
_classCallCheck(this, AddQuerySelectionPlugin);
|
|
20
|
-
|
|
24
|
+
(0, _classCallCheck2.default)(this, AddQuerySelectionPlugin);
|
|
21
25
|
_this = _super.call(this);
|
|
22
|
-
|
|
23
|
-
_defineProperty(_assertThisInitialized(_this), "config", void 0);
|
|
24
|
-
|
|
26
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "config", void 0);
|
|
25
27
|
_this.config = config;
|
|
26
28
|
return _this;
|
|
27
29
|
}
|
|
28
|
-
|
|
29
|
-
_createClass(AddQuerySelectionPlugin, [{
|
|
30
|
+
(0, _createClass2.default)(AddQuerySelectionPlugin, [{
|
|
30
31
|
key: "createLink",
|
|
31
32
|
value: function createLink() {
|
|
32
33
|
var _this2 = this;
|
|
33
|
-
|
|
34
|
-
return new ApolloLink(function (operation, forward) {
|
|
34
|
+
return new _apolloLink.ApolloLink(function (operation, forward) {
|
|
35
35
|
if (operation.operationName !== _this2.config.operationName) {
|
|
36
36
|
return forward(operation);
|
|
37
37
|
}
|
|
38
|
-
|
|
39
38
|
_this2.addSelectionToQuery(operation.operationName, operation.query);
|
|
40
|
-
|
|
41
39
|
return forward(operation);
|
|
42
40
|
});
|
|
43
41
|
}
|
|
44
42
|
}, {
|
|
45
43
|
key: "addSelectionToQuery",
|
|
46
|
-
value: function addSelectionToQuery(operationName,
|
|
44
|
+
value: function addSelectionToQuery(operationName, document) {
|
|
47
45
|
var _tree;
|
|
48
|
-
|
|
49
46
|
if (operationName !== this.config.operationName) {
|
|
50
47
|
return;
|
|
51
48
|
}
|
|
52
49
|
|
|
50
|
+
// If this plugin already processed the given document (documents are always passed by reference),
|
|
51
|
+
// then we don't want to apply the selection again, to avoid adding duplicate selections.
|
|
52
|
+
if (this.isProcessed(document)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.markProcessed(document);
|
|
53
56
|
var _this$config = this.config,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
addSelection = _this$config.addSelection,
|
|
58
|
+
selectionPath = _this$config.selectionPath;
|
|
59
|
+
var firstQueryDefinition = document.definitions[0];
|
|
60
|
+
if (!firstQueryDefinition) {
|
|
61
|
+
return;
|
|
62
|
+
} else if (!firstQueryDefinition.selectionSet) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
var tree = firstQueryDefinition.selectionSet.selections;
|
|
59
66
|
var fields = selectionPath.split(".");
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
_step;
|
|
63
|
-
|
|
67
|
+
var _iterator = (0, _createForOfIteratorHelper2.default)(fields),
|
|
68
|
+
_step;
|
|
64
69
|
try {
|
|
65
70
|
fieldLoop: for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
66
71
|
var field = _step.value;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
_step2;
|
|
70
|
-
|
|
72
|
+
var _iterator2 = (0, _createForOfIteratorHelper2.default)(tree),
|
|
73
|
+
_step2;
|
|
71
74
|
try {
|
|
72
75
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
73
76
|
var selection = _step2.value;
|
|
74
|
-
|
|
77
|
+
if (!selection.selectionSet) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
75
80
|
if (selection.name.value === field) {
|
|
76
81
|
tree = selection.selectionSet.selections;
|
|
77
82
|
continue fieldLoop;
|
|
78
83
|
}
|
|
79
|
-
}
|
|
80
|
-
|
|
84
|
+
}
|
|
85
|
+
// If we get here, it means we didn't find the necessary selection
|
|
81
86
|
} catch (err) {
|
|
82
87
|
_iterator2.e(err);
|
|
83
88
|
} finally {
|
|
84
89
|
_iterator2.f();
|
|
85
90
|
}
|
|
86
|
-
|
|
87
91
|
return;
|
|
88
92
|
}
|
|
89
93
|
} catch (err) {
|
|
90
94
|
_iterator.e(err);
|
|
91
95
|
} finally {
|
|
92
96
|
_iterator.f();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* We must cast because there are a lot of types that are not intertwined and TS is complaining
|
|
100
|
+
*/
|
|
101
|
+
(_tree = tree).push.apply(_tree, (0, _toConsumableArray2.default)(addSelection.definitions[0].selectionSet.selections));
|
|
102
|
+
}
|
|
103
|
+
}, {
|
|
104
|
+
key: "isProcessed",
|
|
105
|
+
value: function isProcessed(document) {
|
|
106
|
+
if (!document.hasOwnProperty("__webiny__")) {
|
|
107
|
+
document.__webiny__ = new Set();
|
|
108
|
+
}
|
|
109
|
+
return document.__webiny__.has(this.cacheKey);
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
key: "markProcessed",
|
|
113
|
+
value: function markProcessed(document) {
|
|
114
|
+
if (!document.hasOwnProperty("__webiny__")) {
|
|
115
|
+
document.__webiny__ = new Set();
|
|
116
|
+
}
|
|
117
|
+
document.__webiny__.add(this.cacheKey);
|
|
97
118
|
}
|
|
98
119
|
}]);
|
|
99
|
-
|
|
100
120
|
return AddQuerySelectionPlugin;
|
|
101
|
-
}(ApolloLinkPlugin);
|
|
121
|
+
}(_ApolloLinkPlugin2.ApolloLinkPlugin);
|
|
122
|
+
exports.AddQuerySelectionPlugin = AddQuerySelectionPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AddQuerySelectionPlugin","config","ApolloLink","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","ApolloLinkPlugin"],"sources":["AddQuerySelectionPlugin.ts"],"sourcesContent":["import { ApolloLink } from \"apollo-link\";\nimport { DocumentNode } from \"graphql\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin\";\nimport { ExecutableDefinitionNode, FieldNode } from \"graphql/language/ast\";\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;AACA;AACA;AAAsD,IAezCA,uBAAuB;EAAA;EAAA;EAGhC,iCAAYC,MAAc,EAAE;IAAA;IAAA;IACxB;IAAQ;IACR,MAAKA,MAAM,GAAGA,MAAM;IAAC;EACzB;EAAC;IAAA;IAAA,OAED,sBAAyC;MAAA;MACrC,OAAO,IAAIC,sBAAU,CAAC,UAACC,SAAS,EAAEC,OAAO,EAAK;QAC1C,IAAID,SAAS,CAACE,aAAa,KAAK,MAAI,CAACJ,MAAM,CAACI,aAAa,EAAE;UACvD,OAAOD,OAAO,CAACD,SAAS,CAAC;QAC7B;QAEA,MAAI,CAACG,mBAAmB,CAACH,SAAS,CAACE,aAAa,EAAEF,SAAS,CAACI,KAAK,CAAC;QAElE,OAAOH,OAAO,CAACD,SAAS,CAAC;MAC7B,CAAC,CAAC;IACN;EAAC;IAAA;IAAA,OAED,6BAA2BE,aAAqB,EAAEG,QAAsB,EAAQ;MAAA;MAC5E,IAAIH,aAAa,KAAK,IAAI,CAACJ,MAAM,CAACI,aAAa,EAAE;QAC7C;MACJ;;MAEA;MACA;MACA,IAAI,IAAI,CAACI,WAAW,CAACD,QAAQ,CAAC,EAAE;QAC5B;MACJ;MAEA,IAAI,CAACE,aAAa,CAACF,QAAQ,CAAC;MAE5B,mBAAwC,IAAI,CAACP,MAAM;QAA3CU,YAAY,gBAAZA,YAAY;QAAEC,aAAa,gBAAbA,aAAa;MAEnC,IAAMC,oBAAoB,GAAGL,QAAQ,CAACM,WAAW,CAAC,CAAC,CAA6B;MAChF,IAAI,CAACD,oBAAoB,EAAE;QACvB;MACJ,CAAC,MAAM,IAAI,CAACA,oBAAoB,CAACE,YAAY,EAAE;QAC3C;MACJ;MAEA,IAAIC,IAAI,GAAGH,oBAAoB,CAACE,YAAY,CAACE,UAAyB;MACtE,IAAMC,MAAM,GAAGN,aAAa,CAACO,KAAK,CAAC,GAAG,CAAC;MAAC,yDAETD,MAAM;QAAA;MAAA;QAArCE,SAAS,EAAE,oDAA4B;UAAA,IAAjBC,KAAK;UAAA,0DACCL,IAAI;YAAA;UAAA;YAA5B,uDAA8B;cAAA,IAAnBM,SAAS;cAChB,IAAI,CAACA,SAAS,CAACP,YAAY,EAAE;gBACzB;cACJ;cACA,IAAIO,SAAS,CAACC,IAAI,CAACC,KAAK,KAAKH,KAAK,EAAE;gBAChCL,IAAI,GAAGM,SAAS,CAACP,YAAY,CAACE,UAAyB;gBACvD,SAASG,SAAS;cACtB;YACJ;YACA;UAAA;YAAA;UAAA;YAAA;UAAA;UACA;QACJ;MAAC;QAAA;MAAA;QAAA;MAAA;MACD;AACR;AACA;MACQ,SAAAJ,IAAI,EAACS,IAAI,+CACAd,YAAY,CAACG,WAAW,CAAC,CAAC,CAAC,CAA8BC,YAAY,CACrEE,UAAU,EAClB;IACL;EAAC;IAAA;IAAA,OAED,qBAAoBT,QAAsB,EAAE;MACxC,IAAI,CAACA,QAAQ,CAACkB,cAAc,CAAC,YAAY,CAAC,EAAE;QACxClB,QAAQ,CAACmB,UAAU,GAAG,IAAIC,GAAG,EAAE;MACnC;MAEA,OAAOpB,QAAQ,CAACmB,UAAU,CAACE,GAAG,CAAC,IAAI,CAACC,QAAQ,CAAC;IACjD;EAAC;IAAA;IAAA,OAED,uBAAsBtB,QAAsB,EAAE;MAC1C,IAAI,CAACA,QAAQ,CAACkB,cAAc,CAAC,YAAY,CAAC,EAAE;QACxClB,QAAQ,CAACmB,UAAU,GAAG,IAAIC,GAAG,EAAE;MACnC;MAEApB,QAAQ,CAACmB,UAAU,CAACI,GAAG,CAAC,IAAI,CAACD,QAAQ,CAAC;IAC1C;EAAC;EAAA;AAAA,EAjFwCE,mCAAgB;AAAA"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
export interface
|
|
2
|
+
export interface ApolloCacheObject {
|
|
3
3
|
__typename?: string;
|
|
4
4
|
[key: string]: any;
|
|
5
5
|
}
|
|
6
|
-
interface
|
|
7
|
-
(data: T):
|
|
6
|
+
interface ApolloCacheObjectIdPluginCallable<T> {
|
|
7
|
+
(data: T): string | null | undefined;
|
|
8
8
|
}
|
|
9
|
-
export declare class ApolloCacheObjectIdPlugin<T extends
|
|
10
|
-
static readonly type
|
|
11
|
-
private _getObjectId
|
|
12
|
-
constructor(getObjectId?:
|
|
13
|
-
getObjectId(data: T):
|
|
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
14
|
}
|
|
15
15
|
export {};
|
|
@@ -1,40 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ApolloCacheObjectIdPlugin = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
+
var _plugins = require("@webiny/plugins");
|
|
15
|
+
var ApolloCacheObjectIdPlugin = /*#__PURE__*/function (_Plugin) {
|
|
16
|
+
(0, _inherits2.default)(ApolloCacheObjectIdPlugin, _Plugin);
|
|
17
|
+
var _super = (0, _createSuper2.default)(ApolloCacheObjectIdPlugin);
|
|
13
18
|
function ApolloCacheObjectIdPlugin(getObjectId) {
|
|
14
19
|
var _this;
|
|
15
|
-
|
|
16
|
-
_classCallCheck(this, ApolloCacheObjectIdPlugin);
|
|
17
|
-
|
|
20
|
+
(0, _classCallCheck2.default)(this, ApolloCacheObjectIdPlugin);
|
|
18
21
|
_this = _super.call(this);
|
|
19
|
-
|
|
20
|
-
_defineProperty(_assertThisInitialized(_this), "_getObjectId", void 0);
|
|
21
|
-
|
|
22
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "_getObjectId", void 0);
|
|
22
23
|
_this._getObjectId = getObjectId;
|
|
23
24
|
return _this;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
_createClass(ApolloCacheObjectIdPlugin, [{
|
|
26
|
+
(0, _createClass2.default)(ApolloCacheObjectIdPlugin, [{
|
|
27
27
|
key: "getObjectId",
|
|
28
28
|
value: function getObjectId(data) {
|
|
29
29
|
if (typeof this._getObjectId !== "function") {
|
|
30
30
|
throw Error("You must provide a \"getObjectId\" callable to the plugin constructor or extend the ApolloCacheObjectIdPlugin.");
|
|
31
31
|
}
|
|
32
|
-
|
|
33
32
|
return this._getObjectId(data);
|
|
34
33
|
}
|
|
35
34
|
}]);
|
|
36
|
-
|
|
37
35
|
return ApolloCacheObjectIdPlugin;
|
|
38
|
-
}(Plugin);
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
}(_plugins.Plugin);
|
|
37
|
+
exports.ApolloCacheObjectIdPlugin = ApolloCacheObjectIdPlugin;
|
|
38
|
+
(0, _defineProperty2.default)(ApolloCacheObjectIdPlugin, "type", "cache-get-object-id");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ApolloCacheObjectIdPlugin","getObjectId","_getObjectId","data","Error","Plugin"],"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;AAAyC,IAY5BA,yBAAyB;EAAA;EAAA;EAMlC,mCAAmBC,WAAkD,EAAE;IAAA;IAAA;IACnE;IAAQ;IACR,MAAKC,YAAY,GAAGD,WAAW;IAAC;EACpC;EAAC;IAAA;IAAA,OAED,qBAAmBE,IAAO,EAAE;MACxB,IAAI,OAAO,IAAI,CAACD,YAAY,KAAK,UAAU,EAAE;QACzC,MAAME,KAAK,kHAEV;MACL;MAEA,OAAO,IAAI,CAACF,YAAY,CAACC,IAAI,CAAC;IAClC;EAAC;EAAA;AAAA,EAjBKE,eAAM;AAAA;AAAA,8BAFHL,yBAAyB,UAGa,qBAAqB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ApolloLink } from "apollo-link";
|
|
1
|
+
import { ApolloLink, NextLink } from "apollo-link";
|
|
2
|
+
import { Operation } from "apollo-link/lib/types";
|
|
2
3
|
export declare class ApolloDynamicLink extends ApolloLink {
|
|
3
4
|
private cache;
|
|
4
|
-
request(operation:
|
|
5
|
+
request(operation: Operation, forward: NextLink): any;
|
|
5
6
|
}
|