@webiny/app 0.0.0-mt-3 → 0.0.0-unstable.06b2ede40f
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 +26 -0
- package/App.js +95 -0
- package/App.js.map +1 -0
- package/AppContainer.d.ts +23 -0
- package/AppContainer.js +9 -0
- package/AppContainer.js.map +1 -0
- package/apollo-client/InMemoryCache.d.ts +4 -3
- package/apollo-client/InMemoryCache.js +13 -52
- package/apollo-client/InMemoryCache.js.map +1 -0
- package/apollo-client/IntrospectionFragmentMatcher.d.ts +11 -0
- package/apollo-client/IntrospectionFragmentMatcher.js +45 -0
- package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -0
- package/components/Image.d.ts +3 -3
- package/components/Image.js +12 -17
- package/components/Image.js.map +1 -0
- package/components/Routes.d.ts +2 -2
- package/components/Routes.js +20 -19
- package/components/Routes.js.map +1 -0
- package/components/View.d.ts +1 -1
- package/components/View.js +13 -17
- package/components/View.js.map +1 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +4 -1
- package/components/index.js.map +1 -0
- package/config/RouterConfig/Route.d.ts +30 -0
- package/config/RouterConfig/Route.js +42 -0
- package/config/RouterConfig/Route.js.map +1 -0
- package/config/RouterConfig.d.ts +32 -0
- package/config/RouterConfig.js +18 -0
- package/config/RouterConfig.js.map +1 -0
- package/config.d.ts +8 -0
- package/config.js +25 -0
- package/config.js.map +1 -0
- package/contexts/Ui/index.d.ts +5 -8
- package/contexts/Ui/index.js +27 -64
- package/contexts/Ui/index.js.map +1 -0
- package/core/DebounceRender.d.ts +12 -0
- package/core/DebounceRender.js +31 -0
- package/core/DebounceRender.js.map +1 -0
- package/core/Plugin.d.ts +8 -0
- package/core/Plugin.js +14 -0
- package/core/Plugin.js.map +1 -0
- package/core/Plugins.d.ts +15 -0
- package/core/Plugins.js +39 -0
- package/core/Plugins.js.map +1 -0
- package/core/Provider.d.ts +8 -0
- package/core/Provider.js +18 -0
- package/core/Provider.js.map +1 -0
- package/core/Routes.d.ts +6 -0
- package/core/Routes.js +34 -0
- package/core/Routes.js.map +1 -0
- package/core/createProvider.d.ts +10 -0
- package/core/createProvider.js +9 -0
- package/core/createProvider.js.map +1 -0
- package/core/createProviderPlugin.d.ts +8 -0
- package/core/createProviderPlugin.js +17 -0
- package/core/createProviderPlugin.js.map +1 -0
- package/hooks/useAutocomplete/index.js +3 -1
- package/hooks/useAutocomplete/index.js.map +1 -0
- package/hooks/useAutocomplete/useAutocomplete.d.ts +6 -1
- package/hooks/useAutocomplete/useAutocomplete.js +11 -15
- package/hooks/useAutocomplete/useAutocomplete.js.map +1 -0
- package/hooks/useDataList/functions/getData.d.ts +1 -1
- package/hooks/useDataList/functions/getData.js +3 -3
- package/hooks/useDataList/functions/getData.js.map +1 -0
- package/hooks/useDataList/functions/getError.d.ts +1 -1
- package/hooks/useDataList/functions/getError.js +3 -3
- package/hooks/useDataList/functions/getError.js.map +1 -0
- package/hooks/useDataList/functions/getMeta.d.ts +1 -1
- package/hooks/useDataList/functions/getMeta.js +3 -3
- package/hooks/useDataList/functions/getMeta.js.map +1 -0
- package/hooks/useDataList/functions/index.js +3 -1
- package/hooks/useDataList/functions/index.js.map +1 -0
- package/hooks/useDataList/functions/searchDataByKey.d.ts +1 -1
- package/hooks/useDataList/functions/searchDataByKey.js +5 -8
- package/hooks/useDataList/functions/searchDataByKey.js.map +1 -0
- package/hooks/useDataList/index.js +3 -1
- package/hooks/useDataList/index.js.map +1 -0
- package/hooks/useDataList/useDataList.d.ts +6 -6
- package/hooks/useDataList/useDataList.js +80 -90
- package/hooks/useDataList/useDataList.js.map +1 -0
- package/hooks/useDataList/utils/index.js +3 -1
- package/hooks/useDataList/utils/index.js.map +1 -0
- package/hooks/useDataList/utils/prepareLoadListParams.d.ts +9 -3
- package/hooks/useDataList/utils/prepareLoadListParams.js +35 -31
- package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -0
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +13 -4
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +13 -9
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +1 -0
- package/hooks/useDataList/utils/types.d.ts +21 -15
- package/hooks/useDataList/utils/types.js +3 -1
- package/hooks/useDataList/utils/types.js.map +1 -0
- package/hooks/useHandler.d.ts +11 -1
- package/hooks/useHandler.js +13 -6
- package/hooks/useHandler.js.map +1 -0
- package/hooks/useHandlers.d.ts +4 -4
- package/hooks/useHandlers.js +15 -11
- package/hooks/useHandlers.js.map +1 -0
- package/hooks/useRegisterLegacyPlugin.d.ts +2 -0
- package/hooks/useRegisterLegacyPlugin.js +11 -0
- package/hooks/useRegisterLegacyPlugin.js.map +1 -0
- package/hooks/useUi.d.ts +1 -1
- package/hooks/useUi.js +5 -3
- package/hooks/useUi.js.map +1 -0
- package/i18n/i18n.js +3 -1
- package/i18n/i18n.js.map +1 -0
- package/i18n/index.js +3 -1
- package/i18n/index.js.map +1 -0
- package/index.d.ts +17 -0
- package/index.js +20 -0
- package/index.js.map +1 -0
- package/package.json +27 -27
- package/plugins/AddQuerySelectionPlugin.d.ts +10 -3
- package/plugins/AddQuerySelectionPlugin.js +63 -92
- package/plugins/AddQuerySelectionPlugin.js.map +1 -0
- package/plugins/ApolloCacheObjectIdPlugin.d.ts +8 -8
- package/plugins/ApolloCacheObjectIdPlugin.js +12 -36
- package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -0
- package/plugins/ApolloDynamicLink.d.ts +3 -1
- package/plugins/ApolloDynamicLink.js +19 -50
- package/plugins/ApolloDynamicLink.js.map +1 -0
- package/plugins/ApolloLinkPlugin.d.ts +6 -6
- package/plugins/ApolloLinkPlugin.js +18 -39
- package/plugins/ApolloLinkPlugin.js.map +1 -0
- package/plugins/ConsoleLinkPlugin.js +19 -40
- package/plugins/ConsoleLinkPlugin.js.map +1 -0
- package/plugins/LocaleHeaderLinkPlugin.d.ts +3 -7
- package/plugins/LocaleHeaderLinkPlugin.js +22 -51
- package/plugins/LocaleHeaderLinkPlugin.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +13 -5
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +21 -31
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +8 -2
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +76 -7
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +6 -4
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +20 -16
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin.js +20 -35
- package/plugins/NetworkErrorLinkPlugin.js.map +1 -0
- package/plugins/OmitTypenameLinkPlugin.js +11 -31
- package/plugins/OmitTypenameLinkPlugin.js.map +1 -0
- package/plugins/RoutePlugin.d.ts +3 -3
- package/plugins/RoutePlugin.js +12 -32
- package/plugins/RoutePlugin.js.map +1 -0
- package/plugins/TenantHeaderLinkPlugin.d.ts +3 -7
- package/plugins/TenantHeaderLinkPlugin.js +29 -61
- package/plugins/TenantHeaderLinkPlugin.js.map +1 -0
- package/plugins/ViewPlugin.d.ts +5 -5
- package/plugins/ViewPlugin.js +15 -37
- package/plugins/ViewPlugin.js.map +1 -0
- package/plugins/image.d.ts +1 -1
- package/plugins/image.js +65 -85
- package/plugins/image.js.map +1 -0
- package/plugins/index.d.ts +3 -3
- package/plugins/index.js +35 -42
- package/plugins/index.js.map +1 -0
- package/react-butterfiles/Files.d.ts +69 -0
- package/react-butterfiles/Files.js +227 -0
- package/react-butterfiles/Files.js.map +1 -0
- package/react-butterfiles/index.d.ts +2 -0
- package/react-butterfiles/index.js +4 -0
- package/react-butterfiles/index.js.map +1 -0
- package/react-butterfiles/utils/generateId.d.ts +1 -0
- package/react-butterfiles/utils/generateId.js +5 -0
- package/react-butterfiles/utils/generateId.js.map +1 -0
- package/react-butterfiles/utils/readFileContent.d.ts +1 -0
- package/react-butterfiles/utils/readFileContent.js +15 -0
- package/react-butterfiles/utils/readFileContent.js.map +1 -0
- package/renderApp.d.ts +2 -0
- package/renderApp.js +9 -0
- package/renderApp.js.map +1 -0
- package/types.d.ts +29 -24
- package/types.js +13 -1
- package/types.js.map +1 -0
- package/utils/createGenericContext.d.ts +13 -0
- package/utils/createGenericContext.js +25 -0
- package/utils/createGenericContext.js.map +1 -0
- package/utils/createHashing.d.ts +2 -0
- package/utils/createHashing.js +18 -0
- package/utils/createHashing.js.map +1 -0
- package/utils/getApiUrl.d.ts +1 -0
- package/utils/getApiUrl.js +5 -0
- package/utils/getApiUrl.js.map +1 -0
- package/utils/getGqlApiUrl.d.ts +1 -0
- package/utils/getGqlApiUrl.js +6 -0
- package/utils/getGqlApiUrl.js.map +1 -0
- package/utils/getHeadlessCmsGqlApiUrl.d.ts +5 -0
- package/utils/getHeadlessCmsGqlApiUrl.js +12 -0
- package/utils/getHeadlessCmsGqlApiUrl.js.map +1 -0
- package/utils/getLocaleCode.d.ts +6 -0
- package/utils/getLocaleCode.js +33 -0
- package/utils/getLocaleCode.js.map +1 -0
- package/utils/getPrerenderId.d.ts +6 -0
- package/utils/getPrerenderId.js +5 -0
- package/utils/getPrerenderId.js.map +1 -0
- package/utils/getTenantId.d.ts +6 -0
- package/utils/getTenantId.js +45 -0
- package/utils/getTenantId.js.map +1 -0
- package/utils/index.d.ts +10 -0
- package/utils/index.js +12 -0
- package/utils/index.js.map +1 -0
- package/utils/isLocalhost.d.ts +1 -0
- package/utils/isLocalhost.js +7 -0
- package/utils/isLocalhost.js.map +1 -0
- package/utils/isPrerendering.d.ts +1 -0
- package/utils/isPrerendering.js +5 -0
- package/utils/isPrerendering.js.map +1 -0
- package/utils/legacyPluginToReactComponent.d.ts +7 -0
- package/utils/legacyPluginToReactComponent.js +14 -0
- package/utils/legacyPluginToReactComponent.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export type UseDataListParams = {\n load?: boolean;\n name: string;\n type: string;\n fields: string;\n limit?: number;\n sort?: {\n [key: string]: string;\n };\n where?: {\n [key: string]: any;\n };\n search?: {\n [key: string]: any;\n };\n};\n\nexport type SearchParams = {\n query: string;\n operator?: \"and\" | \"or\";\n fields?: Array<string>;\n};\n\nexport type UseDataListProps = {\n data: Record<string, any>[];\n meta: Record<string, any>;\n init: () => void;\n refresh: (params?: Record<string, any>) => void;\n delete: (id: string, options: Record<string, any>) => void;\n setPerPage: (perPage: number) => void;\n setPage: (page: number) => void;\n setSearch: (search: SearchParams | any) => void;\n setWhere: (where: Record<string, any>) => void;\n setSorters: (sort: Record<string, any>) => void;\n multiSelect: (item: Record<string, any>, value: boolean) => void;\n multiSelectAll: (value: boolean) => void;\n\n isMultiSelected: (item: Record<string, any>) => boolean;\n isAllMultiSelected: () => boolean;\n isNoneMultiSelected: () => boolean;\n getMultiSelected: () => Record<string, any>[];\n __loadParams: UseDataListParams;\n};\n"],"mappings":"","ignoreList":[]}
|
package/hooks/useHandler.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* TODO: figure out any types.
|
|
3
|
+
*/
|
|
4
|
+
interface Props {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
interface Factory {
|
|
8
|
+
(...args: any): any;
|
|
9
|
+
}
|
|
10
|
+
export declare function useHandler(props: Props, factory: Factory): (...args: any) => any;
|
|
11
|
+
export {};
|
package/hooks/useHandler.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { useRef, useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TODO: figure out any types.
|
|
5
|
+
*/
|
|
6
|
+
|
|
2
7
|
export function useHandler(props, factory) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return handler
|
|
8
|
+
const propsRef = useRef(props);
|
|
9
|
+
const handlerRef = useRef((...args) => {
|
|
10
|
+
const handler = factory(propsRef.current);
|
|
11
|
+
return handler(...args);
|
|
7
12
|
});
|
|
8
|
-
useEffect(
|
|
13
|
+
useEffect(() => {
|
|
9
14
|
propsRef.current = props;
|
|
10
15
|
});
|
|
11
16
|
return handlerRef.current;
|
|
12
|
-
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=useHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRef","useEffect","useHandler","props","factory","propsRef","handlerRef","args","handler","current"],"sources":["useHandler.ts"],"sourcesContent":["import { useRef, useEffect } from \"react\";\n\n/**\n * TODO: figure out any types.\n */\ninterface Props {\n [key: string]: any;\n}\ninterface Factory {\n (...args: any): any;\n}\nexport function useHandler(props: Props, factory: Factory) {\n const propsRef = useRef(props);\n\n const handlerRef = useRef((...args: any) => {\n const handler = factory(propsRef.current);\n return handler(...args);\n });\n\n useEffect(() => {\n propsRef.current = props;\n });\n\n return handlerRef.current;\n}\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,SAAS,QAAQ,OAAO;;AAEzC;AACA;AACA;;AAOA,OAAO,SAASC,UAAUA,CAACC,KAAY,EAAEC,OAAgB,EAAE;EACvD,MAAMC,QAAQ,GAAGL,MAAM,CAACG,KAAK,CAAC;EAE9B,MAAMG,UAAU,GAAGN,MAAM,CAAC,CAAC,GAAGO,IAAS,KAAK;IACxC,MAAMC,OAAO,GAAGJ,OAAO,CAACC,QAAQ,CAACI,OAAO,CAAC;IACzC,OAAOD,OAAO,CAAC,GAAGD,IAAI,CAAC;EAC3B,CAAC,CAAC;EAEFN,SAAS,CAAC,MAAM;IACZI,QAAQ,CAACI,OAAO,GAAGN,KAAK;EAC5B,CAAC,CAAC;EAEF,OAAOG,UAAU,CAACG,OAAO;AAC7B","ignoreList":[]}
|
package/hooks/useHandlers.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
type HandlerProps = {
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
};
|
|
4
|
-
|
|
4
|
+
type HandlerFactories = {
|
|
5
5
|
[key: string]: (props: HandlerProps) => (...params: any[]) => any;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type Handlers = {
|
|
8
8
|
[K in keyof HandlerFactories]: (...params: any[]) => any;
|
|
9
9
|
};
|
|
10
|
-
export declare function useHandlers(props: HandlerProps, factories: HandlerFactories):
|
|
10
|
+
export declare function useHandlers<H = Handlers>(props: HandlerProps, factories: HandlerFactories): H;
|
|
11
11
|
export {};
|
package/hooks/useHandlers.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { useRef, useEffect } from "react";
|
|
2
2
|
export function useHandlers(props, factories) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return names.reduce(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
const propsRef = useRef(props);
|
|
4
|
+
const handlersRef = useRef((() => {
|
|
5
|
+
const names = Object.keys(factories);
|
|
6
|
+
return names.reduce((handlers, name) => {
|
|
7
|
+
/**
|
|
8
|
+
* TODO: figure out args types
|
|
9
|
+
*/
|
|
10
|
+
handlers[name] = (...args) => {
|
|
11
|
+
const handler = factories[name](propsRef.current);
|
|
12
|
+
return handler(...args);
|
|
10
13
|
};
|
|
11
|
-
|
|
12
14
|
return handlers;
|
|
13
15
|
}, {});
|
|
14
|
-
}());
|
|
15
|
-
useEffect(
|
|
16
|
+
})());
|
|
17
|
+
useEffect(() => {
|
|
16
18
|
propsRef.current = props;
|
|
17
19
|
});
|
|
18
20
|
return handlersRef.current;
|
|
19
|
-
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=useHandlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRef","useEffect","useHandlers","props","factories","propsRef","handlersRef","names","Object","keys","reduce","handlers","name","args","handler","current"],"sources":["useHandlers.ts"],"sourcesContent":["import { useRef, useEffect } from \"react\";\n\ntype HandlerProps = { [key: string]: any };\ntype HandlerFactories = { [key: string]: (props: HandlerProps) => (...params: any[]) => any };\ntype Handlers = {\n [K in keyof HandlerFactories]: (...params: any[]) => any;\n};\n\nexport function useHandlers<H = Handlers>(props: HandlerProps, factories: HandlerFactories) {\n const propsRef = useRef(props);\n\n const handlersRef = useRef(\n (() => {\n const names = Object.keys(factories);\n return names.reduce((handlers, name) => {\n /**\n * TODO: figure out args types\n */\n handlers[name] = (...args: any) => {\n const handler = factories[name](propsRef.current);\n return handler(...args);\n };\n return handlers;\n }, {} as Record<string, any>);\n })()\n );\n\n useEffect(() => {\n propsRef.current = props;\n });\n\n return handlersRef.current as H;\n}\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,SAAS,QAAQ,OAAO;AAQzC,OAAO,SAASC,WAAWA,CAAeC,KAAmB,EAAEC,SAA2B,EAAE;EACxF,MAAMC,QAAQ,GAAGL,MAAM,CAACG,KAAK,CAAC;EAE9B,MAAMG,WAAW,GAAGN,MAAM,CACtB,CAAC,MAAM;IACH,MAAMO,KAAK,GAAGC,MAAM,CAACC,IAAI,CAACL,SAAS,CAAC;IACpC,OAAOG,KAAK,CAACG,MAAM,CAAC,CAACC,QAAQ,EAAEC,IAAI,KAAK;MACpC;AAChB;AACA;MACgBD,QAAQ,CAACC,IAAI,CAAC,GAAG,CAAC,GAAGC,IAAS,KAAK;QAC/B,MAAMC,OAAO,GAAGV,SAAS,CAACQ,IAAI,CAAC,CAACP,QAAQ,CAACU,OAAO,CAAC;QACjD,OAAOD,OAAO,CAAC,GAAGD,IAAI,CAAC;MAC3B,CAAC;MACD,OAAOF,QAAQ;IACnB,CAAC,EAAE,CAAC,CAAwB,CAAC;EACjC,CAAC,EAAE,CACP,CAAC;EAEDV,SAAS,CAAC,MAAM;IACZI,QAAQ,CAACU,OAAO,GAAGZ,KAAK;EAC5B,CAAC,CAAC;EAEF,OAAOG,WAAW,CAACS,OAAO;AAC9B","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useRef } from "react";
|
|
2
|
+
import { plugins } from "@webiny/plugins";
|
|
3
|
+
export function useRegisterLegacyPlugin(plugin) {
|
|
4
|
+
const pluginRegistered = useRef(false);
|
|
5
|
+
if (!pluginRegistered.current) {
|
|
6
|
+
pluginRegistered.current = true;
|
|
7
|
+
plugins.register(plugin);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=useRegisterLegacyPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRef","plugins","useRegisterLegacyPlugin","plugin","pluginRegistered","current","register"],"sources":["useRegisterLegacyPlugin.tsx"],"sourcesContent":["import { useRef } from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { type Plugin } from \"@webiny/plugins/types\";\n\nexport function useRegisterLegacyPlugin<TPlugin extends Plugin>(plugin: TPlugin) {\n const pluginRegistered = useRef<boolean>(false);\n if (!pluginRegistered.current) {\n pluginRegistered.current = true;\n plugins.register(plugin);\n }\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,OAAO,QAAQ,iBAAiB;AAGzC,OAAO,SAASC,uBAAuBA,CAAyBC,MAAe,EAAE;EAC7E,MAAMC,gBAAgB,GAAGJ,MAAM,CAAU,KAAK,CAAC;EAC/C,IAAI,CAACI,gBAAgB,CAACC,OAAO,EAAE;IAC3BD,gBAAgB,CAACC,OAAO,GAAG,IAAI;IAC/BJ,OAAO,CAACK,QAAQ,CAACH,MAAM,CAAC;EAC5B;AACJ","ignoreList":[]}
|
package/hooks/useUi.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { UiContextValue } from "../contexts/Ui";
|
|
1
|
+
import type { UiContextValue } from "../contexts/Ui";
|
|
2
2
|
export declare const useUi: () => UiContextValue;
|
package/hooks/useUi.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import { UiContext } from "
|
|
3
|
-
export
|
|
2
|
+
import { UiContext } from "../contexts/Ui";
|
|
3
|
+
export const useUi = () => {
|
|
4
4
|
return useContext(UiContext);
|
|
5
|
-
};
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=useUi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useContext","UiContext","useUi"],"sources":["useUi.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport type { UiContextValue } from \"~/contexts/Ui\";\nimport { UiContext } from \"~/contexts/Ui\";\n\nexport const useUi = () => {\n return useContext(UiContext) as UiContextValue;\n};\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAElC,SAASC,SAAS;AAElB,OAAO,MAAMC,KAAK,GAAGA,CAAA,KAAM;EACvB,OAAOF,UAAU,CAACC,SAAS,CAAC;AAChC,CAAC","ignoreList":[]}
|
package/i18n/i18n.js
CHANGED
|
@@ -2,4 +2,6 @@ import i18n, { defaultProcessor, defaultModifiers } from "@webiny/i18n";
|
|
|
2
2
|
import reactProcessor from "@webiny/i18n-react";
|
|
3
3
|
i18n.registerProcessors([defaultProcessor, reactProcessor]);
|
|
4
4
|
i18n.registerModifiers(defaultModifiers);
|
|
5
|
-
export default i18n;
|
|
5
|
+
export default i18n;
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=i18n.js.map
|
package/i18n/i18n.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["i18n","defaultProcessor","defaultModifiers","reactProcessor","registerProcessors","registerModifiers"],"sources":["i18n.ts"],"sourcesContent":["import i18n, { defaultProcessor, defaultModifiers } from \"@webiny/i18n\";\nimport reactProcessor from \"@webiny/i18n-react\";\n\ni18n.registerProcessors([defaultProcessor, reactProcessor]);\ni18n.registerModifiers(defaultModifiers);\n\nexport default i18n;\n"],"mappings":"AAAA,OAAOA,IAAI,IAAIC,gBAAgB,EAAEC,gBAAgB,QAAQ,cAAc;AACvE,OAAOC,cAAc,MAAM,oBAAoB;AAE/CH,IAAI,CAACI,kBAAkB,CAAC,CAACH,gBAAgB,EAAEE,cAAc,CAAC,CAAC;AAC3DH,IAAI,CAACK,iBAAiB,CAACH,gBAAgB,CAAC;AAExC,eAAeF,IAAI","ignoreList":[]}
|
package/i18n/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","i18n"],"sources":["index.ts"],"sourcesContent":["export { default as i18n } from \"./i18n\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,IAAI","ignoreList":[]}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { AddQuerySelectionPlugin } from "./plugins/AddQuerySelectionPlugin";
|
|
2
|
+
export { ApolloLinkPlugin } from "./plugins/ApolloLinkPlugin";
|
|
3
|
+
export { RoutePlugin } from "./plugins/RoutePlugin";
|
|
4
|
+
export { ApolloCacheObjectIdPlugin, type ApolloCacheObject } from "./plugins/ApolloCacheObjectIdPlugin";
|
|
5
|
+
export * from "@webiny/react-composition";
|
|
6
|
+
export type { HigherOrderComponent, ComposeProps, ComposableFC } from "@webiny/react-composition";
|
|
7
|
+
export * from "./App";
|
|
8
|
+
export * from "./AppContainer";
|
|
9
|
+
export type { AppProps } from "./App";
|
|
10
|
+
export * from "./core/Plugins";
|
|
11
|
+
export * from "./core/Plugin";
|
|
12
|
+
export * from "./core/Provider";
|
|
13
|
+
export * from "./core/DebounceRender";
|
|
14
|
+
export * from "./core/createProvider";
|
|
15
|
+
export * from "./core/createProviderPlugin";
|
|
16
|
+
export * from "./renderApp";
|
|
17
|
+
export * from "./utils/createGenericContext";
|
package/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { AddQuerySelectionPlugin } from "./plugins/AddQuerySelectionPlugin";
|
|
2
|
+
export { ApolloLinkPlugin } from "./plugins/ApolloLinkPlugin";
|
|
3
|
+
export { RoutePlugin } from "./plugins/RoutePlugin";
|
|
4
|
+
export { ApolloCacheObjectIdPlugin } from "./plugins/ApolloCacheObjectIdPlugin";
|
|
5
|
+
|
|
6
|
+
// Composition - we re-export this for ease of use
|
|
7
|
+
export * from "@webiny/react-composition";
|
|
8
|
+
// App framework
|
|
9
|
+
export * from "./App";
|
|
10
|
+
export * from "./AppContainer";
|
|
11
|
+
export * from "./core/Plugins";
|
|
12
|
+
export * from "./core/Plugin";
|
|
13
|
+
export * from "./core/Provider";
|
|
14
|
+
export * from "./core/DebounceRender";
|
|
15
|
+
export * from "./core/createProvider";
|
|
16
|
+
export * from "./core/createProviderPlugin";
|
|
17
|
+
export * from "./renderApp";
|
|
18
|
+
export * from "./utils/createGenericContext";
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AddQuerySelectionPlugin","ApolloLinkPlugin","RoutePlugin","ApolloCacheObjectIdPlugin"],"sources":["index.ts"],"sourcesContent":["export { AddQuerySelectionPlugin } from \"./plugins/AddQuerySelectionPlugin\";\nexport { ApolloLinkPlugin } from \"./plugins/ApolloLinkPlugin\";\nexport { RoutePlugin } from \"./plugins/RoutePlugin\";\nexport {\n ApolloCacheObjectIdPlugin,\n type ApolloCacheObject\n} 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 * from \"./AppContainer\";\nexport type { AppProps } from \"./App\";\nexport * from \"./core/Plugins\";\nexport * from \"./core/Plugin\";\nexport * from \"./core/Provider\";\nexport * from \"./core/DebounceRender\";\nexport * from \"./core/createProvider\";\nexport * from \"./core/createProviderPlugin\";\nexport * from \"./renderApp\";\nexport * from \"./utils/createGenericContext\";\n"],"mappings":"AAAA,SAASA,uBAAuB;AAChC,SAASC,gBAAgB;AACzB,SAASC,WAAW;AACpB,SACIC,yBAAyB;;AAI7B;AACA,cAAc,2BAA2B;AAGzC;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
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.06b2ede40f",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,49 +15,49 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@apollo/react-hooks": "3.1.5",
|
|
18
|
-
"@
|
|
19
|
-
"@
|
|
20
|
-
"@
|
|
21
|
-
"@webiny/i18n": "0.0.0-
|
|
22
|
-
"@webiny/
|
|
23
|
-
"@webiny/
|
|
24
|
-
"@webiny/react-
|
|
25
|
-
"@webiny/
|
|
18
|
+
"@emotion/styled": "11.10.6",
|
|
19
|
+
"@types/react": "18.2.79",
|
|
20
|
+
"@webiny/i18n": "0.0.0-unstable.06b2ede40f",
|
|
21
|
+
"@webiny/i18n-react": "0.0.0-unstable.06b2ede40f",
|
|
22
|
+
"@webiny/plugins": "0.0.0-unstable.06b2ede40f",
|
|
23
|
+
"@webiny/react-composition": "0.0.0-unstable.06b2ede40f",
|
|
24
|
+
"@webiny/react-properties": "0.0.0-unstable.06b2ede40f",
|
|
25
|
+
"@webiny/react-router": "0.0.0-unstable.06b2ede40f",
|
|
26
|
+
"@webiny/ui": "0.0.0-unstable.06b2ede40f",
|
|
26
27
|
"apollo-cache": "1.3.5",
|
|
27
28
|
"apollo-cache-inmemory": "1.6.6",
|
|
28
29
|
"apollo-client": "2.6.10",
|
|
29
30
|
"apollo-link": "1.2.14",
|
|
30
31
|
"apollo-link-context": "1.0.20",
|
|
31
32
|
"apollo-link-error": "1.1.13",
|
|
33
|
+
"apollo-link-http-common": "0.2.16",
|
|
32
34
|
"apollo-utilities": "1.3.4",
|
|
33
|
-
"boolean": "3.
|
|
34
|
-
"
|
|
35
|
+
"boolean": "3.2.0",
|
|
36
|
+
"bytes": "3.1.2",
|
|
37
|
+
"graphql": "15.9.0",
|
|
35
38
|
"invariant": "2.2.4",
|
|
36
39
|
"lodash": "4.17.21",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
40
|
+
"minimatch": "5.1.6",
|
|
41
|
+
"nanoid": "3.3.8",
|
|
42
|
+
"react": "18.2.0",
|
|
43
|
+
"react-dom": "18.2.0",
|
|
44
|
+
"ts-invariant": "0.10.3",
|
|
39
45
|
"warning": "4.0.3"
|
|
40
46
|
},
|
|
41
47
|
"devDependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"@babel/preset-typescript": "^7.8.3",
|
|
48
|
-
"@webiny/cli": "^0.0.0-mt-3",
|
|
49
|
-
"@webiny/project-utils": "^0.0.0-mt-3",
|
|
50
|
-
"babel-plugin-lodash": "^3.3.4",
|
|
51
|
-
"rimraf": "^3.0.2",
|
|
52
|
-
"typescript": "^4.1.3"
|
|
48
|
+
"@types/lodash": "4.17.13",
|
|
49
|
+
"@types/warning": "3.0.0",
|
|
50
|
+
"@webiny/project-utils": "0.0.0-unstable.06b2ede40f",
|
|
51
|
+
"rimraf": "6.0.1",
|
|
52
|
+
"typescript": "5.3.3"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public",
|
|
56
56
|
"directory": "dist"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
|
-
"build": "
|
|
60
|
-
"watch": "
|
|
59
|
+
"build": "node ../cli/bin.js run build",
|
|
60
|
+
"watch": "node ../cli/bin.js run watch"
|
|
61
61
|
},
|
|
62
62
|
"adio": {
|
|
63
63
|
"ignore": {
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
]
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "06b2ede40fc2212a70eeafd74afd50b56fb0ce82"
|
|
70
70
|
}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { ApolloLink } from "apollo-link";
|
|
2
|
-
import { DocumentNode } from "graphql";
|
|
2
|
+
import type { 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,72 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import _createForOfIteratorHelper from "@babel/runtime/helpers/createForOfIteratorHelper";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
1
|
import { ApolloLink } from "apollo-link";
|
|
10
2
|
import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function AddQuerySelectionPlugin(config) {
|
|
17
|
-
var _this;
|
|
18
|
-
|
|
19
|
-
_classCallCheck(this, AddQuerySelectionPlugin);
|
|
20
|
-
|
|
21
|
-
_this = _super.call(this);
|
|
22
|
-
|
|
23
|
-
_defineProperty(_assertThisInitialized(_this), "config", void 0);
|
|
24
|
-
|
|
25
|
-
_this.config = config;
|
|
26
|
-
return _this;
|
|
3
|
+
export class AddQuerySelectionPlugin extends ApolloLinkPlugin {
|
|
4
|
+
constructor(config) {
|
|
5
|
+
super();
|
|
6
|
+
this.config = config;
|
|
27
7
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
value: function createLink() {
|
|
32
|
-
var _this2 = this;
|
|
33
|
-
|
|
34
|
-
return new ApolloLink(function (operation, forward) {
|
|
35
|
-
if (operation.operationName !== _this2.config.operationName) {
|
|
36
|
-
return forward(operation);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
_this2.addSelectionToQuery(operation.operationName, operation.query);
|
|
40
|
-
|
|
8
|
+
createLink() {
|
|
9
|
+
return new ApolloLink((operation, forward) => {
|
|
10
|
+
if (operation.operationName !== this.config.operationName) {
|
|
41
11
|
return forward(operation);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}, {
|
|
45
|
-
key: "addSelectionToQuery",
|
|
46
|
-
value: function addSelectionToQuery(operationName, query) {
|
|
47
|
-
var _tree;
|
|
48
|
-
|
|
49
|
-
if (operationName !== this.config.operationName) {
|
|
50
|
-
return;
|
|
51
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;
|
|
20
|
+
}
|
|
52
21
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (selection.name.value === field) {
|
|
76
|
-
tree = selection.selectionSet.selections;
|
|
77
|
-
continue fieldLoop;
|
|
78
|
-
}
|
|
79
|
-
} // If we get here, it means we didn't find the necessary selection
|
|
80
|
-
|
|
81
|
-
} catch (err) {
|
|
82
|
-
_iterator2.e(err);
|
|
83
|
-
} finally {
|
|
84
|
-
_iterator2.f();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return;
|
|
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;
|
|
37
|
+
}
|
|
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;
|
|
88
44
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
45
|
+
if (selection.name.value === field) {
|
|
46
|
+
tree = selection.selectionSet.selections;
|
|
47
|
+
continue fieldLoop;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// If we get here, it means we didn't find the necessary selection
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
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();
|
|
61
|
+
}
|
|
62
|
+
return document.__webiny__.has(this.cacheKey);
|
|
63
|
+
}
|
|
64
|
+
markProcessed(document) {
|
|
65
|
+
if (!document.hasOwnProperty("__webiny__")) {
|
|
66
|
+
document.__webiny__ = new Set();
|
|
97
67
|
}
|
|
98
|
-
|
|
68
|
+
document.__webiny__.add(this.cacheKey);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
99
71
|
|
|
100
|
-
|
|
101
|
-
}(ApolloLinkPlugin);
|
|
72
|
+
//# sourceMappingURL=AddQuerySelectionPlugin.js.map
|
|
@@ -0,0 +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\";\nimport type { 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,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,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,16 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
1
|
import { Plugin } from "@webiny/plugins";
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function ApolloCacheObjectIdPlugin(getObjectId) {
|
|
14
|
-
var _this;
|
|
15
|
-
|
|
16
|
-
_classCallCheck(this, ApolloCacheObjectIdPlugin);
|
|
17
|
-
|
|
18
|
-
_this = _super.call(this);
|
|
19
|
-
|
|
20
|
-
_defineProperty(_assertThisInitialized(_this), "_getObjectId", void 0);
|
|
21
|
-
|
|
22
|
-
_this._getObjectId = getObjectId;
|
|
23
|
-
return _this;
|
|
2
|
+
export class ApolloCacheObjectIdPlugin extends Plugin {
|
|
3
|
+
static type = "cache-get-object-id";
|
|
4
|
+
constructor(getObjectId) {
|
|
5
|
+
super();
|
|
6
|
+
this._getObjectId = getObjectId;
|
|
24
7
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
value: function getObjectId(data) {
|
|
29
|
-
if (typeof this._getObjectId !== "function") {
|
|
30
|
-
throw Error("You must provide a \"getObjectId\" callable to the plugin constructor or extend the ApolloCacheObjectIdPlugin.");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return this._getObjectId(data);
|
|
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.`);
|
|
34
11
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}(Plugin);
|
|
12
|
+
return this._getObjectId(data);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
39
15
|
|
|
40
|
-
|
|
16
|
+
//# sourceMappingURL=ApolloCacheObjectIdPlugin.js.map
|
|
@@ -0,0 +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,5 +1,7 @@
|
|
|
1
|
+
import type { NextLink } from "apollo-link";
|
|
1
2
|
import { ApolloLink } from "apollo-link";
|
|
3
|
+
import type { Operation } from "apollo-link/lib/types";
|
|
2
4
|
export declare class ApolloDynamicLink extends ApolloLink {
|
|
3
5
|
private cache;
|
|
4
|
-
request(operation:
|
|
6
|
+
request(operation: Operation, forward: NextLink): any;
|
|
5
7
|
}
|