@webiny/app 6.3.0 → 6.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.js +70 -77
- package/App.js.map +1 -1
- package/AppContainer.js +3 -6
- package/AppContainer.js.map +1 -1
- package/apollo-client/InMemoryCache.js +11 -13
- package/apollo-client/InMemoryCache.js.map +1 -1
- package/apollo-client/IntrospectionFragmentMatcher.js +26 -38
- package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -1
- package/components/Image.js +11 -17
- package/components/Image.js.map +1 -1
- package/components/index.js +0 -2
- package/config/RouterConfig/Route.js +23 -28
- package/config/RouterConfig/Route.js.map +1 -1
- package/config/RouterConfig.js +11 -10
- package/config/RouterConfig.js.map +1 -1
- package/config.js +19 -20
- package/config.js.map +1 -1
- package/contexts/Ui/index.js +26 -28
- package/contexts/Ui/index.js.map +1 -1
- package/core/Plugin.js +7 -9
- package/core/Plugin.js.map +1 -1
- package/core/Plugins.js +15 -34
- package/core/Plugins.js.map +1 -1
- package/core/Provider.js +5 -13
- package/core/Provider.js.map +1 -1
- package/core/createProvider.js +3 -6
- package/core/createProvider.js.map +1 -1
- package/core/createProviderPlugin.js +8 -13
- package/core/createProviderPlugin.js.map +1 -1
- package/errors/AuthenticationErrorEvent.js +8 -5
- package/errors/AuthenticationErrorEvent.js.map +1 -1
- package/errors/NetworkErrorEvent.js +8 -5
- package/errors/NetworkErrorEvent.js.map +1 -1
- package/errors/abstractions.js +3 -2
- package/errors/abstractions.js.map +1 -1
- package/errors/index.js +1 -4
- package/exports/admin/env-config.js +0 -2
- package/exports/admin/graphql-client.js +0 -2
- package/exports/admin/local-storage.js +0 -2
- package/exports/admin/router.js +0 -2
- package/exports/admin/security.js +0 -2
- package/exports/admin.js +0 -2
- package/features/envConfig/EnvConfig.js +12 -13
- package/features/envConfig/EnvConfig.js.map +1 -1
- package/features/envConfig/abstractions.js +2 -1
- package/features/envConfig/abstractions.js.map +1 -1
- package/features/envConfig/feature.js +9 -8
- package/features/envConfig/feature.js.map +1 -1
- package/features/envConfig/index.js +0 -2
- package/features/eventPublisher/EventPublisher.js +13 -21
- package/features/eventPublisher/EventPublisher.js.map +1 -1
- package/features/eventPublisher/abstractions.js +7 -9
- package/features/eventPublisher/abstractions.js.map +1 -1
- package/features/eventPublisher/feature.js +13 -12
- package/features/eventPublisher/feature.js.map +1 -1
- package/features/eventPublisher/index.js +1 -3
- package/features/graphqlClient/AuthenticationErrorPublishing.js +26 -26
- package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -1
- package/features/graphqlClient/BatchingGraphQLClient.js +104 -149
- package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -1
- package/features/graphqlClient/FetchGraphQLClient.js +41 -48
- package/features/graphqlClient/FetchGraphQLClient.js.map +1 -1
- package/features/graphqlClient/NetworkErrorPublishing.js +35 -42
- package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -1
- package/features/graphqlClient/RequestValue.js +42 -41
- package/features/graphqlClient/RequestValue.js.map +1 -1
- package/features/graphqlClient/RetryGraphQLClient.js +36 -45
- package/features/graphqlClient/RetryGraphQLClient.js.map +1 -1
- package/features/graphqlClient/__tests__/GraphQLClient.test.js +383 -356
- package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -1
- package/features/graphqlClient/abstractions.js +2 -1
- package/features/graphqlClient/abstractions.js.map +1 -1
- package/features/graphqlClient/feature.js +14 -20
- package/features/graphqlClient/feature.js.map +1 -1
- package/features/graphqlClient/index.js +0 -2
- package/features/graphqlClient/types.js +0 -3
- package/features/localStorage/BrowserLocalStorageGateway.js +56 -63
- package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -1
- package/features/localStorage/LocalStorage.js +27 -24
- package/features/localStorage/LocalStorage.js.map +1 -1
- package/features/localStorage/LocalStorageRepository.js +75 -88
- package/features/localStorage/LocalStorageRepository.js.map +1 -1
- package/features/localStorage/abstractions.js +5 -16
- package/features/localStorage/abstractions.js.map +1 -1
- package/features/localStorage/feature.js +17 -28
- package/features/localStorage/feature.js.map +1 -1
- package/features/localStorage/index.js +1 -3
- package/features/mainGraphQLClient/MainGraphQLClient.js +18 -14
- package/features/mainGraphQLClient/MainGraphQLClient.js.map +1 -1
- package/features/mainGraphQLClient/abstractions.js +2 -1
- package/features/mainGraphQLClient/abstractions.js.map +1 -1
- package/features/mainGraphQLClient/feature.js +11 -10
- package/features/mainGraphQLClient/feature.js.map +1 -1
- package/features/mainGraphQLClient/index.js +0 -2
- package/features/router/HistoryRouterGateway.js +75 -105
- package/features/router/HistoryRouterGateway.js.map +1 -1
- package/features/router/HistoryRouterGateway.test.js +184 -193
- package/features/router/HistoryRouterGateway.test.js.map +1 -1
- package/features/router/Route.js +38 -54
- package/features/router/Route.js.map +1 -1
- package/features/router/RouteUrl.js +84 -217
- package/features/router/RouteUrl.js.map +1 -1
- package/features/router/Router.js +67 -124
- package/features/router/Router.js.map +1 -1
- package/features/router/RouterPresenter.js +44 -49
- package/features/router/RouterPresenter.js.map +1 -1
- package/features/router/RouterRepository.js +103 -111
- package/features/router/RouterRepository.js.map +1 -1
- package/features/router/RouterRepository.test.js +119 -150
- package/features/router/RouterRepository.test.js.map +1 -1
- package/features/router/abstractions.js +4 -14
- package/features/router/abstractions.js.map +1 -1
- package/features/router/feature.js +13 -12
- package/features/router/feature.js.map +1 -1
- package/features/router/index.js +1 -3
- package/helpers/InterfaceGenerator/date.js +0 -3
- package/helpers/InterfaceGenerator/id.js +0 -3
- package/helpers/InterfaceGenerator/identity.js +0 -3
- package/helpers/InterfaceGenerator/index.js +0 -3
- package/helpers/InterfaceGenerator/numeric.js +0 -3
- package/helpers/InterfaceGenerator/truthful.js +0 -3
- package/hooks/useAutocomplete/index.js +0 -2
- package/hooks/useAutocomplete/useAutocomplete.js +12 -15
- package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
- package/hooks/useDataList/functions/getData.js +2 -1
- package/hooks/useDataList/functions/getData.js.map +1 -1
- package/hooks/useDataList/functions/getError.js +2 -1
- package/hooks/useDataList/functions/getError.js.map +1 -1
- package/hooks/useDataList/functions/getMeta.js +2 -1
- package/hooks/useDataList/functions/getMeta.js.map +1 -1
- package/hooks/useDataList/functions/index.js +0 -2
- package/hooks/useDataList/functions/searchDataByKey.js +9 -14
- package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
- package/hooks/useDataList/index.js +0 -2
- package/hooks/useDataList/useDataList.js +131 -152
- package/hooks/useDataList/useDataList.js.map +1 -1
- package/hooks/useDataList/utils/index.js +0 -2
- package/hooks/useDataList/utils/prepareLoadListParams.js +25 -34
- package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
- package/hooks/useHandler.js +12 -16
- package/hooks/useHandler.js.map +1 -1
- package/hooks/useHandlers.js +18 -20
- package/hooks/useHandlers.js.map +1 -1
- package/hooks/useRegisterLegacyPlugin.js +7 -6
- package/hooks/useRegisterLegacyPlugin.js.map +1 -1
- package/hooks/useUi.js +2 -3
- package/hooks/useUi.js.map +1 -1
- package/i18n/i18n.js +8 -4
- package/i18n/i18n.js.map +1 -1
- package/i18n/index.js +0 -2
- package/index.js +6 -11
- package/package.json +13 -13
- package/plugins/AddQuerySelectionPlugin.js +36 -61
- package/plugins/AddQuerySelectionPlugin.js.map +1 -1
- package/plugins/ApolloCacheObjectIdPlugin.js +12 -11
- package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
- package/plugins/ApolloDynamicLink.js +20 -22
- package/plugins/ApolloDynamicLink.js.map +1 -1
- package/plugins/ApolloLinkPlugin.js +16 -15
- package/plugins/ApolloLinkPlugin.js.map +1 -1
- package/plugins/ConsoleLinkPlugin.js +19 -21
- package/plugins/ConsoleLinkPlugin.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +39 -45
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +18 -22
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +21 -29
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +6 -15
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/Typography.js +9 -14
- package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js +19 -0
- package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +11 -18
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin.js +41 -58
- package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
- package/plugins/OmitTypenameLinkPlugin.js +9 -14
- package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
- package/plugins/TenantHeaderLinkPlugin.js +23 -32
- package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
- package/plugins/components/Image.js +8 -15
- package/plugins/components/Image.js.map +1 -1
- package/plugins/image.js +94 -133
- package/plugins/image.js.map +1 -1
- package/plugins/index.js +35 -59
- package/plugins/index.js.map +1 -1
- package/presentation/envConfig/useEnvConfig.js +4 -8
- package/presentation/envConfig/useEnvConfig.js.map +1 -1
- package/presentation/localStorage/index.js +0 -2
- package/presentation/localStorage/useLocalStorage.js +10 -16
- package/presentation/localStorage/useLocalStorage.js.map +1 -1
- package/presentation/localStorage/useLocalStorageValue.js +15 -13
- package/presentation/localStorage/useLocalStorageValue.js.map +1 -1
- package/presentation/localStorage/useLocalStorageValues.js +23 -30
- package/presentation/localStorage/useLocalStorageValues.js.map +1 -1
- package/presentation/router/RouteElementRegistry.js +22 -25
- package/presentation/router/RouteElementRegistry.js.map +1 -1
- package/presentation/router/abstractions.js +2 -1
- package/presentation/router/abstractions.js.map +1 -1
- package/presentation/router/components/Redirect.js +8 -10
- package/presentation/router/components/Redirect.js.map +1 -1
- package/presentation/router/components/RouteContent.js +14 -17
- package/presentation/router/components/RouteContent.js.map +1 -1
- package/presentation/router/components/RouteLink.js +11 -16
- package/presentation/router/components/RouteLink.js.map +1 -1
- package/presentation/router/components/SimpleLink.js +18 -24
- package/presentation/router/components/SimpleLink.js.map +1 -1
- package/presentation/router/hooks/useRoute.js +15 -23
- package/presentation/router/hooks/useRoute.js.map +1 -1
- package/presentation/router/hooks/useRouter.js +22 -23
- package/presentation/router/hooks/useRouter.js.map +1 -1
- package/presentation/router/index.js +0 -2
- package/presentation/router/types.js +0 -3
- package/react-butterfiles/Files.js +148 -217
- package/react-butterfiles/Files.js.map +1 -1
- package/react-butterfiles/index.js +2 -1
- package/react-butterfiles/index.js.map +1 -1
- package/react-butterfiles/utils/generateId.js +2 -3
- package/react-butterfiles/utils/generateId.js.map +1 -1
- package/react-butterfiles/utils/readFileContent.js +9 -13
- package/react-butterfiles/utils/readFileContent.js.map +1 -1
- package/renderApp.js +7 -6
- package/renderApp.js.map +1 -1
- package/router.js +0 -3
- package/rslib-runtime.js +14 -0
- package/rslib-runtime.js.map +1 -0
- package/shared/di/DiContainerProvider.js +8 -12
- package/shared/di/DiContainerProvider.js.map +1 -1
- package/shared/di/createFeature.js +7 -8
- package/shared/di/createFeature.js.map +1 -1
- package/shared/di/useFeature.js +7 -3
- package/shared/di/useFeature.js.map +1 -1
- package/static/svg/close_24px.33adaadc.svg +1 -0
- package/types.js +0 -3
- package/utils/createGenericContext.js +17 -21
- package/utils/createGenericContext.js.map +1 -1
- package/utils/createHashing.js +13 -16
- package/utils/createHashing.js.map +1 -1
- package/utils/index.js +0 -2
- package/utils/legacyPluginToReactComponent.js +11 -10
- package/utils/legacyPluginToReactComponent.js.map +1 -1
- package/components/index.js.map +0 -1
- package/errors/index.js.map +0 -1
- package/exports/admin/env-config.js.map +0 -1
- package/exports/admin/graphql-client.js.map +0 -1
- package/exports/admin/local-storage.js.map +0 -1
- package/exports/admin/router.js.map +0 -1
- package/exports/admin/security.js.map +0 -1
- package/exports/admin.js.map +0 -1
- package/features/envConfig/index.js.map +0 -1
- package/features/eventPublisher/index.js.map +0 -1
- package/features/graphqlClient/index.js.map +0 -1
- package/features/graphqlClient/types.js.map +0 -1
- package/features/localStorage/index.js.map +0 -1
- package/features/mainGraphQLClient/index.js.map +0 -1
- package/features/router/index.js.map +0 -1
- package/helpers/InterfaceGenerator/date.js.map +0 -1
- package/helpers/InterfaceGenerator/id.js.map +0 -1
- package/helpers/InterfaceGenerator/identity.js.map +0 -1
- package/helpers/InterfaceGenerator/index.js.map +0 -1
- package/helpers/InterfaceGenerator/numeric.js.map +0 -1
- package/helpers/InterfaceGenerator/truthful.js.map +0 -1
- package/hooks/useAutocomplete/index.js.map +0 -1
- package/hooks/useDataList/functions/index.js.map +0 -1
- package/hooks/useDataList/index.js.map +0 -1
- package/hooks/useDataList/utils/index.js.map +0 -1
- package/i18n/index.js.map +0 -1
- package/index.js.map +0 -1
- package/presentation/localStorage/index.js.map +0 -1
- package/presentation/router/index.js.map +0 -1
- package/presentation/router/types.js.map +0 -1
- package/router.js.map +0 -1
- package/types.js.map +0 -1
- package/utils/index.js.map +0 -1
package/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../src/config.ts"],"sourcesContent":["export type Config = Record<string, any>;\n\ninterface AppConfig {\n set(config: Config): void;\n get(): Config;\n getKey<T = string>(key: string, defaultValue: T): T;\n}\n\nconst deepFreeze = (obj: Record<string, any>): Record<string, any> => {\n Object.keys(obj).forEach(prop => {\n if (typeof obj[prop] === \"object\" && !Object.isFrozen(obj[prop])) {\n deepFreeze(obj[prop]);\n }\n });\n return Object.freeze(obj);\n};\n\nfunction createConfig(): AppConfig {\n let _config: Record<string, any> = {};\n\n return {\n set(config: Config) {\n _config = deepFreeze(config);\n },\n get() {\n return _config;\n },\n getKey(key, defaultValue) {\n return key in _config ? _config[key] : defaultValue;\n }\n };\n}\n\nexport const config = createConfig();\n"],"names":["deepFreeze","obj","Object","prop","createConfig","_config","config","key","defaultValue"],"mappings":"AAQA,MAAMA,aAAa,CAACC;IAChBC,OAAO,IAAI,CAACD,KAAK,OAAO,CAACE,CAAAA;QACrB,IAAI,AAAqB,YAArB,OAAOF,GAAG,CAACE,KAAK,IAAiB,CAACD,OAAO,QAAQ,CAACD,GAAG,CAACE,KAAK,GAC3DH,WAAWC,GAAG,CAACE,KAAK;IAE5B;IACA,OAAOD,OAAO,MAAM,CAACD;AACzB;AAEA,SAASG;IACL,IAAIC,UAA+B,CAAC;IAEpC,OAAO;QACH,KAAIC,MAAc;YACdD,UAAUL,WAAWM;QACzB;QACA;YACI,OAAOD;QACX;QACA,QAAOE,GAAG,EAAEC,YAAY;YACpB,OAAOD,OAAOF,UAAUA,OAAO,CAACE,IAAI,GAAGC;QAC3C;IACJ;AACJ;AAEO,MAAMF,gBAASF"}
|
package/contexts/Ui/index.js
CHANGED
|
@@ -1,32 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { plugins } from "@webiny/plugins";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
key: pl.name
|
|
28
|
-
})), this.props.children);
|
|
29
|
-
}
|
|
3
|
+
const UiContext = /*#__PURE__*/ react.createContext({});
|
|
4
|
+
class UiProvider extends react.Component {
|
|
5
|
+
render() {
|
|
6
|
+
const value = {
|
|
7
|
+
...this.state.ui,
|
|
8
|
+
setState: this.setData
|
|
9
|
+
};
|
|
10
|
+
const uiStatePlugins = plugins.byType("ui-state");
|
|
11
|
+
return /*#__PURE__*/ react.createElement(UiContext.Provider, {
|
|
12
|
+
value: value
|
|
13
|
+
}, uiStatePlugins.map((pl)=>/*#__PURE__*/ react.cloneElement(pl.render(), {
|
|
14
|
+
key: pl.name
|
|
15
|
+
})), this.props.children);
|
|
16
|
+
}
|
|
17
|
+
constructor(...args){
|
|
18
|
+
super(...args), this.state = {
|
|
19
|
+
ui: {}
|
|
20
|
+
}, this.setData = (setter)=>this.setState((state)=>({
|
|
21
|
+
ui: {
|
|
22
|
+
...state.ui,
|
|
23
|
+
...setter(state.ui)
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
30
27
|
}
|
|
28
|
+
export { UiContext, UiProvider };
|
|
31
29
|
|
|
32
30
|
//# sourceMappingURL=index.js.map
|
package/contexts/Ui/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"contexts/Ui/index.js","sources":["../../../src/contexts/Ui/index.tsx"],"sourcesContent":["import React from \"react\";\nimport type { UiStatePlugin } from \"~/types.js\";\nimport { plugins } from \"@webiny/plugins\";\n\nexport const UiContext = React.createContext<Record<string, any>>({});\n\ntype Props = Record<string, any>;\n\ntype State = {\n ui: { [key: string]: any };\n};\n\ninterface UiData {\n [key: string]: any;\n}\n\ninterface UiDataSetter {\n (ui: UiData): UiData;\n}\n\nexport interface UiContextValue {\n setState: (setter: UiDataSetter) => void;\n [key: string]: any;\n}\n\nexport class UiProvider extends React.Component<Props, State> {\n public override state: State = {\n ui: {}\n };\n\n private readonly setData = (setter: UiDataSetter): void => {\n return this.setState((state: State) => {\n return { ui: { ...state.ui, ...setter(state.ui) } };\n });\n };\n\n public override render() {\n const value: UiContextValue = { ...this.state.ui, setState: this.setData };\n const uiStatePlugins = plugins.byType<UiStatePlugin>(\"ui-state\");\n return (\n <UiContext.Provider value={value}>\n {uiStatePlugins.map(pl => React.cloneElement(pl.render(), { key: pl.name }))}\n {this.props.children}\n </UiContext.Provider>\n );\n }\n}\n"],"names":["UiContext","React","UiProvider","value","uiStatePlugins","plugins","pl","setter","state"],"mappings":";;AAIO,MAAMA,YAAY,WAAHA,GAAGC,MAAAA,aAAmB,CAAsB,CAAC;AAqB5D,MAAMC,mBAAmBD,MAAAA,SAAe;IAW3B,SAAS;QACrB,MAAME,QAAwB;YAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE;YAAE,UAAU,IAAI,CAAC,OAAO;QAAC;QACzE,MAAMC,iBAAiBC,QAAQ,MAAM,CAAgB;QACrD,OAAO,WAAP,GACI,oBAACL,UAAU,QAAQ;YAAC,OAAOG;WACtBC,eAAe,GAAG,CAACE,CAAAA,KAAAA,WAAAA,GAAML,MAAAA,YAAkB,CAACK,GAAG,MAAM,IAAI;gBAAE,KAAKA,GAAG,IAAI;YAAC,KACxE,IAAI,CAAC,KAAK,CAAC,QAAQ;IAGhC;;QApBG,qBACa,KAAK,GAAU;YAC3B,IAAI,CAAC;QACT,QAEiB,OAAO,GAAG,CAACC,SACjB,IAAI,CAAC,QAAQ,CAAC,CAACC,QACX;oBAAE,IAAI;wBAAE,GAAGA,MAAM,EAAE;wBAAE,GAAGD,OAAOC,MAAM,EAAE,CAAC;oBAAC;gBAAE;;AAc9D"}
|
package/core/Plugin.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { Provider } from "./Provider.js";
|
|
3
3
|
import { Plugins } from "./Plugins.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
key: index,
|
|
10
|
-
hoc: provider
|
|
11
|
-
})), children ? /*#__PURE__*/React.createElement(Plugins, null, children) : null);
|
|
4
|
+
const Plugin_Plugin = /*#__PURE__*/ react.memo(function({ providers, children }) {
|
|
5
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, (providers || []).map((provider, index)=>/*#__PURE__*/ react.createElement(Provider, {
|
|
6
|
+
key: index,
|
|
7
|
+
hoc: provider
|
|
8
|
+
})), children ? /*#__PURE__*/ react.createElement(Plugins, null, children) : null);
|
|
12
9
|
});
|
|
10
|
+
export { Plugin_Plugin as Plugin };
|
|
13
11
|
|
|
14
12
|
//# sourceMappingURL=Plugin.js.map
|
package/core/Plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"core/Plugin.js","sources":["../../src/core/Plugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { Provider } from \"./Provider.js\";\nimport { Plugins } from \"./Plugins.js\";\nimport type { GenericComponent, Decorator } from \"@webiny/react-composition\";\n\ninterface PluginProps {\n providers?: Decorator<GenericComponent>[];\n children?: React.ReactNode;\n}\n\nexport const Plugin = React.memo(function Plugin({ providers, children }: PluginProps) {\n return (\n <>\n {(providers || []).map((provider, index) => (\n <Provider key={index} hoc={provider} />\n ))}\n {children ? <Plugins>{children}</Plugins> : null}\n </>\n );\n});\n"],"names":["Plugin","React","providers","children","provider","index","Provider","Plugins"],"mappings":";;;AAUO,MAAMA,gBAAS,WAAHA,GAAGC,MAAAA,IAAU,CAAC,SAAgB,EAAEC,SAAS,EAAEC,QAAQ,EAAe;IACjF,OAAO,WAAP,GACI,0CACMD,AAAAA,CAAAA,aAAa,EAAC,EAAG,GAAG,CAAC,CAACE,UAAUC,QAAAA,WAAAA,GAC9B,oBAACC,UAAQA;YAAC,KAAKD;YAAO,KAAKD;aAE9BD,WAAW,WAAXA,GAAW,oBAACI,SAAOA,MAAEJ,YAAsB;AAGxD"}
|
package/core/Plugins.js
CHANGED
|
@@ -1,40 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react, { Children, Fragment, createContext, memo, useContext, useEffect } from "react";
|
|
2
2
|
import { useApp } from "../App.js";
|
|
3
|
-
|
|
3
|
+
const PluginsContext = /*#__PURE__*/ createContext(false);
|
|
4
4
|
PluginsContext.displayName = "PluginsContext";
|
|
5
|
-
const PluginsProviderComponent = ({
|
|
6
|
-
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @param children
|
|
20
|
-
* @deprecated This component should not be used directly. Use the <Plugin> component to create plugins.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
export const Plugins = /*#__PURE__*/React.memo(({
|
|
24
|
-
children
|
|
25
|
-
}) => {
|
|
26
|
-
const {
|
|
27
|
-
addPlugin
|
|
28
|
-
} = useApp();
|
|
29
|
-
const hasParentPlugin = useContext(PluginsContext);
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (hasParentPlugin) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
Children.forEach(children, child => addPlugin(child));
|
|
35
|
-
}, []);
|
|
36
|
-
return hasParentPlugin ? /*#__PURE__*/React.createElement(Fragment, null, children) : null;
|
|
5
|
+
const PluginsProviderComponent = ({ children })=>/*#__PURE__*/ react.createElement(PluginsContext.Provider, {
|
|
6
|
+
value: true
|
|
7
|
+
}, children);
|
|
8
|
+
const PluginsProvider = /*#__PURE__*/ memo(PluginsProviderComponent);
|
|
9
|
+
const Plugins = /*#__PURE__*/ react.memo(({ children })=>{
|
|
10
|
+
const { addPlugin } = useApp();
|
|
11
|
+
const hasParentPlugin = useContext(PluginsContext);
|
|
12
|
+
useEffect(()=>{
|
|
13
|
+
if (hasParentPlugin) return;
|
|
14
|
+
Children.forEach(children, (child)=>addPlugin(child));
|
|
15
|
+
}, []);
|
|
16
|
+
return hasParentPlugin ? /*#__PURE__*/ react.createElement(Fragment, null, children) : null;
|
|
37
17
|
});
|
|
38
18
|
Plugins.displayName = "Plugins";
|
|
19
|
+
export { Plugins, PluginsContext, PluginsProvider };
|
|
39
20
|
|
|
40
21
|
//# sourceMappingURL=Plugins.js.map
|
package/core/Plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"core/Plugins.js","sources":["../../src/core/Plugins.tsx"],"sourcesContent":["import React, { Children, createContext, Fragment, memo, useContext, useEffect } from \"react\";\nimport { useApp } from \"~/App.js\";\n\nexport const PluginsContext = createContext<boolean>(false);\nPluginsContext.displayName = \"PluginsContext\";\n\ninterface PluginsProviderComponentProps {\n children: React.JSX.Element[];\n}\nconst PluginsProviderComponent = ({ children }: PluginsProviderComponentProps) => {\n /**\n * This context only serves as a safeguard. We need to warn users when they mount a plugin without using\n * the <Plugins> component. In that case, the context will not be available, and we can log warnings.\n */\n return <PluginsContext.Provider value={true}>{children}</PluginsContext.Provider>;\n};\n\nexport const PluginsProvider = memo(PluginsProviderComponent);\n\n/**\n * @param children\n * @deprecated This component should not be used directly. Use the <Plugin> component to create plugins.\n */\ninterface PluginsComponentsProps {\n children: React.ReactNode;\n}\nexport const Plugins = React.memo(({ children }: PluginsComponentsProps) => {\n const { addPlugin } = useApp();\n const hasParentPlugin = useContext(PluginsContext);\n\n useEffect(() => {\n if (hasParentPlugin) {\n return;\n }\n\n Children.forEach(children, child => addPlugin(child));\n }, []);\n\n return hasParentPlugin ? <Fragment>{children}</Fragment> : null;\n});\n\nPlugins.displayName = \"Plugins\";\n"],"names":["PluginsContext","createContext","PluginsProviderComponent","children","PluginsProvider","memo","Plugins","React","addPlugin","useApp","hasParentPlugin","useContext","useEffect","Children","child","Fragment"],"mappings":";;AAGO,MAAMA,iBAAiB,WAAHA,GAAGC,cAAuB;AACrDD,eAAe,WAAW,GAAG;AAK7B,MAAME,2BAA2B,CAAC,EAAEC,QAAQ,EAAiC,GAKlE,WAAP,GAAO,oBAACH,eAAe,QAAQ;QAAC,OAAO;OAAOG;AAG3C,MAAMC,kBAAkB,WAAHA,GAAGC,KAAKH;AAS7B,MAAMI,UAAU,WAAHA,GAAGC,MAAAA,IAAU,CAAC,CAAC,EAAEJ,QAAQ,EAA0B;IACnE,MAAM,EAAEK,SAAS,EAAE,GAAGC;IACtB,MAAMC,kBAAkBC,WAAWX;IAEnCY,UAAU;QACN,IAAIF,iBACA;QAGJG,SAAS,OAAO,CAACV,UAAUW,CAAAA,QAASN,UAAUM;IAClD,GAAG,EAAE;IAEL,OAAOJ,kBAAkB,WAAlBA,GAAkB,oBAACK,UAAQA,MAAEZ,YAAuB;AAC/D;AAEAG,QAAQ,WAAW,GAAG"}
|
package/core/Provider.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
2
|
import { useApp } from "../index.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
hoc
|
|
8
|
-
}) => {
|
|
9
|
-
const {
|
|
10
|
-
addProvider
|
|
11
|
-
} = useApp();
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
return addProvider(hoc);
|
|
14
|
-
}, []);
|
|
15
|
-
return null;
|
|
3
|
+
const Provider = ({ hoc })=>{
|
|
4
|
+
const { addProvider } = useApp();
|
|
5
|
+
useEffect(()=>addProvider(hoc), []);
|
|
6
|
+
return null;
|
|
16
7
|
};
|
|
8
|
+
export { Provider };
|
|
17
9
|
|
|
18
10
|
//# sourceMappingURL=Provider.js.map
|
package/core/Provider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"core/Provider.js","sources":["../../src/core/Provider.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport type { GenericComponent, Decorator } from \"~/index.js\";\nimport { useApp } from \"~/index.js\";\n\nexport interface ProviderProps {\n hoc: Decorator<GenericComponent>;\n}\n\n/**\n * Register a new React context provider.\n */\nexport const Provider = ({ hoc }: ProviderProps) => {\n const { addProvider } = useApp();\n\n useEffect(() => {\n return addProvider(hoc);\n }, []);\n\n return null;\n};\n"],"names":["Provider","hoc","addProvider","useApp","useEffect"],"mappings":";;AAWO,MAAMA,WAAW,CAAC,EAAEC,GAAG,EAAiB;IAC3C,MAAM,EAAEC,WAAW,EAAE,GAAGC;IAExBC,UAAU,IACCF,YAAYD,MACpB,EAAE;IAEL,OAAO;AACX"}
|
package/core/createProvider.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* This is mostly useful for adding React Context providers.
|
|
4
|
-
*/
|
|
5
|
-
export function createProvider(decorator) {
|
|
6
|
-
return decorator;
|
|
1
|
+
function createProvider(decorator) {
|
|
2
|
+
return decorator;
|
|
7
3
|
}
|
|
4
|
+
export { createProvider };
|
|
8
5
|
|
|
9
6
|
//# sourceMappingURL=createProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"core/createProvider.js","sources":["../../src/core/createProvider.tsx"],"sourcesContent":["import type React from \"react\";\nimport type { Decorator, GenericComponent } from \"@webiny/react-composition\";\n\nexport interface ChildrenProps {\n children: React.ReactNode;\n}\n\n/**\n * Creates a Higher Order Component which wraps the entire app content.\n * This is mostly useful for adding React Context providers.\n */\nexport function createProvider(\n decorator: Decorator<GenericComponent<ChildrenProps>>\n): Decorator<GenericComponent<ChildrenProps>> {\n return decorator;\n}\n"],"names":["createProvider","decorator"],"mappings":"AAWO,SAASA,eACZC,SAAqD;IAErD,OAAOA;AACX"}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { Provider } from "./Provider.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export function createProviderPlugin(decorator) {
|
|
10
|
-
return function ProviderPlugin() {
|
|
11
|
-
return /*#__PURE__*/React.createElement(Provider, {
|
|
12
|
-
hoc: decorator
|
|
13
|
-
});
|
|
14
|
-
};
|
|
3
|
+
function createProviderPlugin(decorator) {
|
|
4
|
+
return function() {
|
|
5
|
+
return /*#__PURE__*/ react.createElement(Provider, {
|
|
6
|
+
hoc: decorator
|
|
7
|
+
});
|
|
8
|
+
};
|
|
15
9
|
}
|
|
10
|
+
export { createProviderPlugin };
|
|
16
11
|
|
|
17
12
|
//# sourceMappingURL=createProviderPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"core/createProviderPlugin.js","sources":["../../src/core/createProviderPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport type { GenericComponent, Decorator } from \"@webiny/react-composition\";\nimport { Provider } from \"./Provider.js\";\n\n/**\n * Creates a component, which, when mounted, will register an app provider.\n * This is particularly useful for wrapping the entire app with custom React Context providers.\n * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.\n */\nexport function createProviderPlugin(decorator: Decorator<GenericComponent>) {\n return function ProviderPlugin() {\n return <Provider hoc={decorator} />;\n };\n}\n"],"names":["createProviderPlugin","decorator","Provider"],"mappings":";;AASO,SAASA,qBAAqBC,SAAsC;IACvE,OAAO;QACH,OAAO,WAAP,GAAO,oBAACC,UAAQA;YAAC,KAAKD;;IAC1B;AACJ"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { AuthenticationErrorEventHandler } from "./abstractions.js";
|
|
2
2
|
import { BaseEvent } from "../features/eventPublisher/index.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
class AuthenticationErrorEvent extends BaseEvent {
|
|
4
|
+
getHandlerAbstraction() {
|
|
5
|
+
return AuthenticationErrorEventHandler;
|
|
6
|
+
}
|
|
7
|
+
constructor(...args){
|
|
8
|
+
super(...args), this.eventType = "Authentication/Error";
|
|
9
|
+
}
|
|
8
10
|
}
|
|
11
|
+
export { AuthenticationErrorEvent };
|
|
9
12
|
|
|
10
13
|
//# sourceMappingURL=AuthenticationErrorEvent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"errors/AuthenticationErrorEvent.js","sources":["../../src/errors/AuthenticationErrorEvent.ts"],"sourcesContent":["import { AuthenticationErrorEventHandler } from \"./abstractions.js\";\nimport { BaseEvent } from \"~/features/eventPublisher/index.js\";\n\nexport interface AuthenticationErrorPayload {\n message: string;\n code: string;\n}\n\nexport class AuthenticationErrorEvent extends BaseEvent<AuthenticationErrorPayload> {\n eventType = \"Authentication/Error\" as const;\n\n getHandlerAbstraction() {\n return AuthenticationErrorEventHandler;\n }\n}\n"],"names":["AuthenticationErrorEvent","BaseEvent","AuthenticationErrorEventHandler"],"mappings":";;AAQO,MAAMA,iCAAiCC;IAG1C,wBAAwB;QACpB,OAAOC;IACX;;QALG,qBACH,SAAS,GAAG;;AAKhB"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { NetworkErrorEventHandler } from "./abstractions.js";
|
|
2
2
|
import { BaseEvent } from "../features/eventPublisher/index.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
class NetworkErrorEvent extends BaseEvent {
|
|
4
|
+
getHandlerAbstraction() {
|
|
5
|
+
return NetworkErrorEventHandler;
|
|
6
|
+
}
|
|
7
|
+
constructor(...args){
|
|
8
|
+
super(...args), this.eventType = "network.error";
|
|
9
|
+
}
|
|
8
10
|
}
|
|
11
|
+
export { NetworkErrorEvent };
|
|
9
12
|
|
|
10
13
|
//# sourceMappingURL=NetworkErrorEvent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"errors/NetworkErrorEvent.js","sources":["../../src/errors/NetworkErrorEvent.ts"],"sourcesContent":["import { NetworkErrorEventHandler } from \"./abstractions.js\";\nimport { BaseEvent } from \"~/features/eventPublisher/index.js\";\n\nexport interface NetworkErrorPayload {\n message: string;\n code?: string;\n operationName?: string;\n query?: string;\n variables?: Record<string, any>;\n errorType: \"network\" | \"timeout\" | \"fetch\" | \"unknown\";\n statusCode?: number;\n result?: any;\n}\n\nexport class NetworkErrorEvent extends BaseEvent<NetworkErrorPayload> {\n eventType = \"network.error\" as const;\n\n getHandlerAbstraction() {\n return NetworkErrorEventHandler;\n }\n}\n"],"names":["NetworkErrorEvent","BaseEvent","NetworkErrorEventHandler"],"mappings":";;AAcO,MAAMA,0BAA0BC;IAGnC,wBAAwB;QACpB,OAAOC;IACX;;QALG,qBACH,SAAS,GAAG;;AAKhB"}
|
package/errors/abstractions.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createAbstraction } from "@webiny/feature/admin";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const NetworkErrorEventHandler = createAbstraction("NetworkErrorEventHandler");
|
|
3
|
+
const AuthenticationErrorEventHandler = createAbstraction("AuthenticationErrorEventHandler");
|
|
4
|
+
export { AuthenticationErrorEventHandler, NetworkErrorEventHandler };
|
|
4
5
|
|
|
5
6
|
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"errors/abstractions.js","sources":["../../src/errors/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { NetworkErrorEvent } from \"./NetworkErrorEvent.js\";\nimport type { AuthenticationErrorEvent } from \"./AuthenticationErrorEvent.js\";\nimport type { IEventHandler } from \"~/features/eventPublisher/index.js\";\n\nexport const NetworkErrorEventHandler = createAbstraction<IEventHandler<NetworkErrorEvent>>(\n \"NetworkErrorEventHandler\"\n);\n\nexport namespace NetworkErrorEventHandler {\n export type Interface = IEventHandler<NetworkErrorEvent>;\n}\n\nexport const AuthenticationErrorEventHandler = createAbstraction<\n IEventHandler<AuthenticationErrorEvent>\n>(\"AuthenticationErrorEventHandler\");\n\nexport namespace AuthenticationErrorEventHandler {\n export type Interface = IEventHandler<AuthenticationErrorEvent>;\n export type Event = AuthenticationErrorEvent;\n}\n"],"names":["NetworkErrorEventHandler","createAbstraction","AuthenticationErrorEventHandler"],"mappings":";AAKO,MAAMA,2BAA2BC,kBACpC;AAOG,MAAMC,kCAAkCD,kBAE7C"}
|
package/errors/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
export { NetworkErrorEvent } from "./NetworkErrorEvent.js";
|
|
2
|
-
export { NetworkErrorEventHandler } from "./abstractions.js";
|
|
2
|
+
export { AuthenticationErrorEventHandler, NetworkErrorEventHandler } from "./abstractions.js";
|
|
3
3
|
export { AuthenticationErrorEvent } from "./AuthenticationErrorEvent.js";
|
|
4
|
-
export { AuthenticationErrorEventHandler } from "./abstractions.js";
|
|
5
|
-
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
package/exports/admin/router.js
CHANGED
|
@@ -3,5 +3,3 @@ export { RouteLinkComponent } from "../../presentation/router/components/RouteLi
|
|
|
3
3
|
export { LinkComponent } from "../../presentation/router/components/SimpleLink.js";
|
|
4
4
|
export { RedirectComponent } from "../../presentation/router/components/Redirect.js";
|
|
5
5
|
export { useRoute, useRouter } from "../../presentation/router/index.js";
|
|
6
|
-
|
|
7
|
-
//# sourceMappingURL=router.js.map
|
package/exports/admin.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
class DefaultEnvConfig {
|
|
2
|
+
constructor(env){
|
|
3
|
+
this.env = env;
|
|
4
|
+
}
|
|
5
|
+
get(key, defaultValue) {
|
|
6
|
+
const rawValue = this.env[key];
|
|
7
|
+
if (null == rawValue && void 0 !== defaultValue) return defaultValue;
|
|
8
|
+
return rawValue;
|
|
9
|
+
}
|
|
10
|
+
getAll() {
|
|
11
|
+
return this.env;
|
|
9
12
|
}
|
|
10
|
-
return rawValue;
|
|
11
|
-
}
|
|
12
|
-
getAll() {
|
|
13
|
-
return this.env;
|
|
14
|
-
}
|
|
15
13
|
}
|
|
14
|
+
export { DefaultEnvConfig };
|
|
16
15
|
|
|
17
16
|
//# sourceMappingURL=EnvConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/envConfig/EnvConfig.js","sources":["../../../src/features/envConfig/EnvConfig.ts"],"sourcesContent":["import { EnvConfig as Abstraction } from \"./abstractions.js\";\n\nexport class DefaultEnvConfig implements Abstraction.Interface {\n private readonly env: Abstraction.Config;\n\n constructor(env: Abstraction.Config) {\n this.env = env;\n }\n\n public get<K extends keyof Abstraction.Config>(\n key: K,\n defaultValue?: Abstraction.Config[K]\n ): Abstraction.Config[K] {\n const rawValue = this.env[key];\n\n if ((rawValue === undefined || rawValue === null) && defaultValue !== undefined) {\n return defaultValue;\n }\n\n return rawValue;\n }\n\n getAll(): Abstraction.Config {\n return this.env;\n }\n}\n"],"names":["DefaultEnvConfig","env","key","defaultValue","rawValue","undefined"],"mappings":"AAEO,MAAMA;IAGT,YAAYC,GAAuB,CAAE;QACjC,IAAI,CAAC,GAAG,GAAGA;IACf;IAEO,IACHC,GAAM,EACNC,YAAoC,EACf;QACrB,MAAMC,WAAW,IAAI,CAAC,GAAG,CAACF,IAAI;QAE9B,IAAKE,QAAAA,YAAgDD,AAAiBE,WAAjBF,cACjD,OAAOA;QAGX,OAAOC;IACX;IAEA,SAA6B;QACzB,OAAO,IAAI,CAAC,GAAG;IACnB;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/envConfig/abstractions.js","sources":["../../../src/features/envConfig/abstractions.ts"],"sourcesContent":["import { Abstraction } from \"@webiny/di\";\n\ntype Env = {\n apiUrl: string;\n debug: boolean;\n deploymentId: string;\n graphqlApiUrl: string;\n telemetryEnabled: boolean;\n telemetryUserId: string | undefined;\n trashBinRetentionPeriodDays: number;\n wcpProjectId: string | undefined;\n websocketUrl: string;\n graphqlClient?: {\n retries: {\n maxRetries: number;\n delayInMillis: number;\n };\n };\n};\n\nexport interface IEnvConfig {\n get<K extends keyof Env>(key: K, defaultValue?: Env[K]): Env[K];\n getAll(): Env;\n}\n\nexport const EnvConfig = new Abstraction<IEnvConfig>(\"EnvConfig\");\n\nexport namespace EnvConfig {\n export type Interface = IEnvConfig;\n export type Config = Env;\n}\n"],"names":["EnvConfig","Abstraction"],"mappings":";AAyBO,MAAMA,YAAY,IAAIC,YAAwB"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { EnvConfig } from "./abstractions.js";
|
|
2
2
|
import { DefaultEnvConfig } from "./EnvConfig.js";
|
|
3
3
|
import { createFeature } from "../../shared/di/createFeature.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
const EnvConfigFeature = createFeature({
|
|
5
|
+
name: "EnvConfig",
|
|
6
|
+
register (container, params) {
|
|
7
|
+
container.registerInstance(EnvConfig, new DefaultEnvConfig(params));
|
|
8
|
+
},
|
|
9
|
+
resolve (container) {
|
|
10
|
+
return container.resolve(EnvConfig);
|
|
11
|
+
}
|
|
12
12
|
});
|
|
13
|
+
export { EnvConfigFeature };
|
|
13
14
|
|
|
14
15
|
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/envConfig/feature.js","sources":["../../../src/features/envConfig/feature.ts"],"sourcesContent":["import { EnvConfig } from \"./abstractions.js\";\nimport { DefaultEnvConfig } from \"./EnvConfig.js\";\nimport { createFeature } from \"~/shared/di/createFeature.js\";\n\nexport const EnvConfigFeature = createFeature({\n name: \"EnvConfig\",\n register(container, params: EnvConfig.Config) {\n container.registerInstance(EnvConfig, new DefaultEnvConfig(params));\n },\n resolve(container) {\n return container.resolve(EnvConfig);\n }\n});\n"],"names":["EnvConfigFeature","createFeature","container","params","EnvConfig","DefaultEnvConfig"],"mappings":";;;AAIO,MAAMA,mBAAmBC,cAAc;IAC1C,MAAM;IACN,UAASC,SAAS,EAAEC,MAAwB;QACxCD,UAAU,gBAAgB,CAACE,WAAW,IAAIC,iBAAiBF;IAC/D;IACA,SAAQD,SAAS;QACb,OAAOA,UAAU,OAAO,CAACE;IAC7B;AACJ"}
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
import { EnvConfig } from "../envConfig/index.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
// Resolve ALL implementations of that abstraction
|
|
12
|
-
const handlers = this.container.resolveAll(handlerAbstraction);
|
|
13
|
-
|
|
14
|
-
// Execute all handlers
|
|
15
|
-
for (const handler of handlers) {
|
|
16
|
-
await handler.handle(event);
|
|
2
|
+
class EventPublisher {
|
|
3
|
+
constructor(container){
|
|
4
|
+
this.container = container;
|
|
5
|
+
}
|
|
6
|
+
async publish(event) {
|
|
7
|
+
this.logEvent(event);
|
|
8
|
+
const handlerAbstraction = event.getHandlerAbstraction();
|
|
9
|
+
const handlers = this.container.resolveAll(handlerAbstraction);
|
|
10
|
+
for (const handler of handlers)await handler.handle(event);
|
|
17
11
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (envConfig.get("debug")) {
|
|
22
|
-
console.log(`[EventPublisher] Publishing event "${event.eventType}".`, event.payload);
|
|
12
|
+
logEvent(event) {
|
|
13
|
+
const envConfig = this.container.resolve(EnvConfig);
|
|
14
|
+
if (envConfig.get("debug")) console.log(`[EventPublisher] Publishing event "${event.eventType}".`, event.payload);
|
|
23
15
|
}
|
|
24
|
-
}
|
|
25
16
|
}
|
|
17
|
+
export { EventPublisher };
|
|
26
18
|
|
|
27
19
|
//# sourceMappingURL=EventPublisher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/eventPublisher/EventPublisher.js","sources":["../../../src/features/eventPublisher/EventPublisher.ts"],"sourcesContent":["import type { Container } from \"@webiny/di\";\nimport { EventPublisher as Abstraction, BaseEvent } from \"./abstractions.js\";\nimport { EnvConfig } from \"~/features/envConfig/index.js\";\n\nexport class EventPublisher implements Abstraction.Interface {\n constructor(private container: Container) {}\n\n async publish<TEvent extends BaseEvent>(event: TEvent): Promise<void> {\n this.logEvent(event);\n // Get handler abstraction from the event itself\n const handlerAbstraction = event.getHandlerAbstraction();\n\n // Resolve ALL implementations of that abstraction\n const handlers = this.container.resolveAll(handlerAbstraction);\n\n // Execute all handlers\n for (const handler of handlers) {\n await handler.handle(event);\n }\n }\n\n private logEvent(event: BaseEvent) {\n const envConfig = this.container.resolve(EnvConfig);\n if (envConfig.get(\"debug\")) {\n console.log(`[EventPublisher] Publishing event \"${event.eventType}\".`, event.payload);\n }\n }\n}\n"],"names":["EventPublisher","container","event","handlerAbstraction","handlers","handler","envConfig","EnvConfig","console"],"mappings":";AAIO,MAAMA;IACT,YAAoBC,SAAoB,CAAE;aAAtBA,SAAS,GAATA;IAAuB;IAE3C,MAAM,QAAkCC,KAAa,EAAiB;QAClE,IAAI,CAAC,QAAQ,CAACA;QAEd,MAAMC,qBAAqBD,MAAM,qBAAqB;QAGtD,MAAME,WAAW,IAAI,CAAC,SAAS,CAAC,UAAU,CAACD;QAG3C,KAAK,MAAME,WAAWD,SAClB,MAAMC,QAAQ,MAAM,CAACH;IAE7B;IAEQ,SAASA,KAAgB,EAAE;QAC/B,MAAMI,YAAY,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC;QACzC,IAAID,UAAU,GAAG,CAAC,UACdE,QAAQ,GAAG,CAAC,CAAC,mCAAmC,EAAEN,MAAM,SAAS,CAAC,EAAE,CAAC,EAAEA,MAAM,OAAO;IAE5F;AACJ"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { createAbstraction } from "@webiny/feature/admin";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} else {
|
|
8
|
-
this.payload = payload;
|
|
2
|
+
class BaseEvent {
|
|
3
|
+
constructor(payload){
|
|
4
|
+
this.occurredAt = new Date();
|
|
5
|
+
if (void 0 === payload) this.payload = void 0;
|
|
6
|
+
else this.payload = payload;
|
|
9
7
|
}
|
|
10
|
-
}
|
|
11
8
|
}
|
|
12
|
-
|
|
9
|
+
const EventPublisher = createAbstraction("EventPublisher");
|
|
10
|
+
export { BaseEvent, EventPublisher };
|
|
13
11
|
|
|
14
12
|
//# sourceMappingURL=abstractions.js.map
|