@webiny/app 0.0.0-unstable.79032b23a5 → 0.0.0-unstable.7be00a75a9
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 +14 -18
- package/App.js +79 -102
- package/App.js.map +1 -1
- package/AppContainer.d.ts +23 -0
- package/AppContainer.js +6 -0
- package/AppContainer.js.map +1 -0
- package/README.md +7 -15
- package/apollo-client/InMemoryCache.d.ts +3 -2
- package/apollo-client/InMemoryCache.js +17 -55
- package/apollo-client/InMemoryCache.js.map +1 -1
- package/apollo-client/IntrospectionFragmentMatcher.d.ts +11 -0
- package/apollo-client/IntrospectionFragmentMatcher.js +33 -0
- package/apollo-client/IntrospectionFragmentMatcher.js.map +1 -0
- package/components/Image.d.ts +2 -3
- package/components/Image.js +16 -29
- package/components/Image.js.map +1 -1
- package/components/index.d.ts +1 -2
- package/components/index.js +1 -19
- package/config/RouterConfig/Route.d.ts +29 -0
- package/config/RouterConfig/Route.js +28 -0
- package/config/RouterConfig/Route.js.map +1 -0
- package/config/RouterConfig.d.ts +31 -0
- package/config/RouterConfig.js +19 -0
- package/config/RouterConfig.js.map +1 -0
- package/config.d.ts +1 -1
- package/config.js +21 -27
- package/config.js.map +1 -1
- package/contexts/Ui/index.d.ts +4 -4
- package/contexts/Ui/index.js +28 -57
- package/contexts/Ui/index.js.map +1 -1
- package/core/Plugin.d.ts +3 -3
- package/core/Plugin.js +11 -20
- package/core/Plugin.js.map +1 -1
- package/core/Plugins.d.ts +6 -3
- package/core/Plugins.js +19 -43
- package/core/Plugins.js.map +1 -1
- package/core/Provider.d.ts +3 -4
- package/core/Provider.js +9 -20
- package/core/Provider.js.map +1 -1
- package/core/createProvider.d.ts +7 -3
- package/core/createProvider.js +5 -12
- package/core/createProvider.js.map +1 -1
- package/core/createProviderPlugin.d.ts +2 -2
- package/core/createProviderPlugin.js +11 -20
- package/core/createProviderPlugin.js.map +1 -1
- package/errors/AuthenticationErrorEvent.d.ts +9 -0
- package/errors/AuthenticationErrorEvent.js +13 -0
- package/errors/AuthenticationErrorEvent.js.map +1 -0
- package/errors/NetworkErrorEvent.d.ts +15 -0
- package/errors/NetworkErrorEvent.js +13 -0
- package/errors/NetworkErrorEvent.js.map +1 -0
- package/errors/abstractions.d.ts +12 -0
- package/errors/abstractions.js +6 -0
- package/errors/abstractions.js.map +1 -0
- package/errors/index.d.ts +6 -0
- package/errors/index.js +3 -0
- package/exports/admin/env-config.d.ts +2 -0
- package/exports/admin/env-config.js +2 -0
- package/exports/admin/graphql-client.d.ts +1 -0
- package/exports/admin/graphql-client.js +1 -0
- package/exports/admin/local-storage.d.ts +2 -0
- package/exports/admin/local-storage.js +2 -0
- package/exports/admin/router.d.ts +5 -0
- package/exports/admin/router.js +5 -0
- package/exports/admin/security.d.ts +1 -0
- package/exports/admin/security.js +1 -0
- package/exports/admin.d.ts +7 -0
- package/exports/admin.js +7 -0
- package/features/envConfig/EnvConfig.d.ts +7 -0
- package/features/envConfig/EnvConfig.js +16 -0
- package/features/envConfig/EnvConfig.js.map +1 -0
- package/features/envConfig/abstractions.d.ts +28 -0
- package/features/envConfig/abstractions.js +5 -0
- package/features/envConfig/abstractions.js.map +1 -0
- package/features/envConfig/feature.d.ts +17 -0
- package/features/envConfig/feature.js +15 -0
- package/features/envConfig/feature.js.map +1 -0
- package/features/envConfig/index.d.ts +1 -0
- package/features/envConfig/index.js +1 -0
- package/features/eventPublisher/EventPublisher.d.ts +8 -0
- package/features/eventPublisher/EventPublisher.js +19 -0
- package/features/eventPublisher/EventPublisher.js.map +1 -0
- package/features/eventPublisher/abstractions.d.ts +18 -0
- package/features/eventPublisher/abstractions.js +12 -0
- package/features/eventPublisher/abstractions.js.map +1 -0
- package/features/eventPublisher/feature.d.ts +3 -0
- package/features/eventPublisher/feature.js +17 -0
- package/features/eventPublisher/feature.js.map +1 -0
- package/features/eventPublisher/index.d.ts +3 -0
- package/features/eventPublisher/index.js +2 -0
- package/features/graphqlClient/AuthenticationErrorPublishing.d.ts +13 -0
- package/features/graphqlClient/AuthenticationErrorPublishing.js +35 -0
- package/features/graphqlClient/AuthenticationErrorPublishing.js.map +1 -0
- package/features/graphqlClient/BatchingGraphQLClient.d.ts +16 -0
- package/features/graphqlClient/BatchingGraphQLClient.js +118 -0
- package/features/graphqlClient/BatchingGraphQLClient.js.map +1 -0
- package/features/graphqlClient/FetchGraphQLClient.d.ts +7 -0
- package/features/graphqlClient/FetchGraphQLClient.js +51 -0
- package/features/graphqlClient/FetchGraphQLClient.js.map +1 -0
- package/features/graphqlClient/NetworkErrorPublishing.d.ts +14 -0
- package/features/graphqlClient/NetworkErrorPublishing.js +48 -0
- package/features/graphqlClient/NetworkErrorPublishing.js.map +1 -0
- package/features/graphqlClient/RequestValue.d.ts +21 -0
- package/features/graphqlClient/RequestValue.js +46 -0
- package/features/graphqlClient/RequestValue.js.map +1 -0
- package/features/graphqlClient/RetryGraphQLClient.d.ts +18 -0
- package/features/graphqlClient/RetryGraphQLClient.js +45 -0
- package/features/graphqlClient/RetryGraphQLClient.js.map +1 -0
- package/features/graphqlClient/__tests__/GraphQLClient.test.d.ts +1 -0
- package/features/graphqlClient/__tests__/GraphQLClient.test.js +397 -0
- package/features/graphqlClient/__tests__/GraphQLClient.test.js.map +1 -0
- package/features/graphqlClient/abstractions.d.ts +18 -0
- package/features/graphqlClient/abstractions.js +5 -0
- package/features/graphqlClient/abstractions.js.map +1 -0
- package/features/graphqlClient/feature.d.ts +6 -0
- package/features/graphqlClient/feature.js +25 -0
- package/features/graphqlClient/feature.js.map +1 -0
- package/features/graphqlClient/index.d.ts +1 -0
- package/features/graphqlClient/index.js +1 -0
- package/features/graphqlClient/types.d.ts +5 -0
- package/features/graphqlClient/types.js +0 -0
- package/features/localStorage/BrowserLocalStorageGateway.d.ts +9 -0
- package/features/localStorage/BrowserLocalStorageGateway.js +61 -0
- package/features/localStorage/BrowserLocalStorageGateway.js.map +1 -0
- package/features/localStorage/LocalStorage.d.ts +12 -0
- package/features/localStorage/LocalStorage.js +34 -0
- package/features/localStorage/LocalStorage.js.map +1 -0
- package/features/localStorage/LocalStorageRepository.d.ts +20 -0
- package/features/localStorage/LocalStorageRepository.js +82 -0
- package/features/localStorage/LocalStorageRepository.js.map +1 -0
- package/features/localStorage/abstractions.d.ts +48 -0
- package/features/localStorage/abstractions.js +8 -0
- package/features/localStorage/abstractions.js.map +1 -0
- package/features/localStorage/feature.d.ts +12 -0
- package/features/localStorage/feature.js +23 -0
- package/features/localStorage/feature.js.map +1 -0
- package/features/localStorage/index.d.ts +1 -0
- package/features/localStorage/index.js +1 -0
- package/features/mainGraphQLClient/MainGraphQLClient.d.ts +11 -0
- package/features/mainGraphQLClient/MainGraphQLClient.js +27 -0
- package/features/mainGraphQLClient/MainGraphQLClient.js.map +1 -0
- package/features/mainGraphQLClient/abstractions.d.ts +17 -0
- package/features/mainGraphQLClient/abstractions.js +5 -0
- package/features/mainGraphQLClient/abstractions.js.map +1 -0
- package/features/mainGraphQLClient/feature.d.ts +3 -0
- package/features/mainGraphQLClient/feature.js +17 -0
- package/features/mainGraphQLClient/feature.js.map +1 -0
- package/features/mainGraphQLClient/index.d.ts +1 -0
- package/features/mainGraphQLClient/index.js +1 -0
- package/features/router/HistoryRouterGateway.d.ts +22 -0
- package/features/router/HistoryRouterGateway.js +88 -0
- package/features/router/HistoryRouterGateway.js.map +1 -0
- package/features/router/HistoryRouterGateway.test.d.ts +1 -0
- package/features/router/HistoryRouterGateway.test.js +195 -0
- package/features/router/HistoryRouterGateway.test.js.map +1 -0
- package/features/router/Route.d.ts +19 -0
- package/features/router/Route.js +43 -0
- package/features/router/Route.js.map +1 -0
- package/features/router/RouteUrl.d.ts +85 -0
- package/features/router/RouteUrl.js +99 -0
- package/features/router/RouteUrl.js.map +1 -0
- package/features/router/Router.d.ts +45 -0
- package/features/router/Router.js +72 -0
- package/features/router/Router.js.map +1 -0
- package/features/router/RouterPresenter.d.ts +21 -0
- package/features/router/RouterPresenter.js +52 -0
- package/features/router/RouterPresenter.js.map +1 -0
- package/features/router/RouterRepository.d.ts +30 -0
- package/features/router/RouterRepository.js +117 -0
- package/features/router/RouterRepository.js.map +1 -0
- package/features/router/RouterRepository.test.d.ts +1 -0
- package/features/router/RouterRepository.test.js +138 -0
- package/features/router/RouterRepository.test.js.map +1 -0
- package/features/router/abstractions.d.ts +81 -0
- package/features/router/abstractions.js +7 -0
- package/features/router/abstractions.js.map +1 -0
- package/features/router/feature.d.ts +4 -0
- package/features/router/feature.js +19 -0
- package/features/router/feature.js.map +1 -0
- package/features/router/index.d.ts +2 -0
- package/features/router/index.js +1 -0
- package/helpers/InterfaceGenerator/date.d.ts +15 -0
- package/helpers/InterfaceGenerator/date.js +0 -0
- package/helpers/InterfaceGenerator/id.d.ts +23 -0
- package/helpers/InterfaceGenerator/id.js +0 -0
- package/helpers/InterfaceGenerator/identity.d.ts +10 -0
- package/helpers/InterfaceGenerator/identity.js +0 -0
- package/helpers/InterfaceGenerator/index.d.ts +5 -0
- package/helpers/InterfaceGenerator/index.js +0 -0
- package/helpers/InterfaceGenerator/numeric.d.ts +12 -0
- package/helpers/InterfaceGenerator/numeric.js +0 -0
- package/helpers/InterfaceGenerator/truthful.d.ts +7 -0
- package/helpers/InterfaceGenerator/truthful.js +0 -0
- package/hooks/useAutocomplete/index.d.ts +1 -1
- package/hooks/useAutocomplete/index.js +1 -12
- package/hooks/useAutocomplete/useAutocomplete.d.ts +1 -1
- package/hooks/useAutocomplete/useAutocomplete.js +16 -28
- package/hooks/useAutocomplete/useAutocomplete.js.map +1 -1
- package/hooks/useDataList/functions/getData.js +4 -11
- package/hooks/useDataList/functions/getData.js.map +1 -1
- package/hooks/useDataList/functions/getError.js +4 -11
- package/hooks/useDataList/functions/getError.js.map +1 -1
- package/hooks/useDataList/functions/getMeta.js +4 -11
- package/hooks/useDataList/functions/getMeta.js.map +1 -1
- package/hooks/useDataList/functions/index.d.ts +3 -3
- package/hooks/useDataList/functions/index.js +3 -27
- package/hooks/useDataList/functions/searchDataByKey.js +11 -21
- package/hooks/useDataList/functions/searchDataByKey.js.map +1 -1
- package/hooks/useDataList/index.d.ts +1 -1
- package/hooks/useDataList/index.js +1 -12
- package/hooks/useDataList/useDataList.d.ts +2 -3
- package/hooks/useDataList/useDataList.js +140 -180
- package/hooks/useDataList/useDataList.js.map +1 -1
- package/hooks/useDataList/utils/index.d.ts +1 -2
- package/hooks/useDataList/utils/index.js +1 -20
- package/hooks/useDataList/utils/prepareLoadListParams.d.ts +1 -2
- package/hooks/useDataList/utils/prepareLoadListParams.js +27 -36
- package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -1
- package/hooks/useHandler.js +14 -17
- package/hooks/useHandler.js.map +1 -1
- package/hooks/useHandlers.d.ts +3 -3
- package/hooks/useHandlers.js +20 -26
- package/hooks/useHandlers.js.map +1 -1
- package/hooks/useRegisterLegacyPlugin.d.ts +2 -0
- package/hooks/useRegisterLegacyPlugin.js +12 -0
- package/hooks/useRegisterLegacyPlugin.js.map +1 -0
- package/hooks/useUi.d.ts +1 -1
- package/hooks/useUi.js +5 -11
- package/hooks/useUi.js.map +1 -1
- package/i18n/i18n.js +10 -13
- package/i18n/i18n.js.map +1 -1
- package/i18n/index.d.ts +1 -1
- package/i18n/index.js +1 -13
- package/index.d.ts +23 -13
- package/index.js +23 -147
- package/package.json +38 -41
- package/plugins/AddQuerySelectionPlugin.d.ts +2 -2
- package/plugins/AddQuerySelectionPlugin.js +41 -116
- package/plugins/AddQuerySelectionPlugin.js.map +1 -1
- package/plugins/ApolloCacheObjectIdPlugin.js +16 -37
- package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -1
- package/plugins/ApolloDynamicLink.d.ts +3 -2
- package/plugins/ApolloDynamicLink.js +25 -56
- package/plugins/ApolloDynamicLink.js.map +1 -1
- package/plugins/ApolloLinkPlugin.d.ts +1 -1
- package/plugins/ApolloLinkPlugin.js +22 -45
- package/plugins/ApolloLinkPlugin.js.map +1 -1
- package/plugins/ConsoleLinkPlugin.d.ts +1 -1
- package/plugins/ConsoleLinkPlugin.js +21 -45
- package/plugins/ConsoleLinkPlugin.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +8 -13
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +48 -76
- package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.d.ts +14 -0
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js +27 -0
- package/plugins/NetworkErrorLinkPlugin/GqlErrorOverlay.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.d.ts +2 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js +23 -0
- package/plugins/NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +4 -7
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +68 -17
- package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin/Typography.d.ts +8 -0
- package/plugins/NetworkErrorLinkPlugin/Typography.js +13 -0
- package/plugins/NetworkErrorLinkPlugin/Typography.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js +19 -0
- package/plugins/NetworkErrorLinkPlugin/assets/close_24px.js.map +1 -0
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +3 -3
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +14 -30
- package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -1
- package/plugins/NetworkErrorLinkPlugin.d.ts +4 -1
- package/plugins/NetworkErrorLinkPlugin.js +52 -47
- package/plugins/NetworkErrorLinkPlugin.js.map +1 -1
- package/plugins/OmitTypenameLinkPlugin.d.ts +1 -1
- package/plugins/OmitTypenameLinkPlugin.js +13 -38
- package/plugins/OmitTypenameLinkPlugin.js.map +1 -1
- package/plugins/TenantHeaderLinkPlugin.d.ts +3 -3
- package/plugins/TenantHeaderLinkPlugin.js +27 -59
- package/plugins/TenantHeaderLinkPlugin.js.map +1 -1
- package/plugins/components/Image.d.ts +6 -0
- package/plugins/components/Image.js +12 -0
- package/plugins/components/Image.js.map +1 -0
- package/plugins/image.d.ts +1 -1
- package/plugins/image.js +97 -142
- package/plugins/image.js.map +1 -1
- package/plugins/index.d.ts +5 -5
- package/plugins/index.js +39 -86
- package/plugins/index.js.map +1 -1
- package/presentation/envConfig/useEnvConfig.d.ts +6 -0
- package/presentation/envConfig/useEnvConfig.js +9 -0
- package/presentation/envConfig/useEnvConfig.js.map +1 -0
- package/presentation/localStorage/index.d.ts +3 -0
- package/presentation/localStorage/index.js +3 -0
- package/presentation/localStorage/useLocalStorage.d.ts +6 -0
- package/presentation/localStorage/useLocalStorage.js +15 -0
- package/presentation/localStorage/useLocalStorage.js.map +1 -0
- package/presentation/localStorage/useLocalStorageValue.d.ts +1 -0
- package/presentation/localStorage/useLocalStorageValue.js +22 -0
- package/presentation/localStorage/useLocalStorageValue.js.map +1 -0
- package/presentation/localStorage/useLocalStorageValues.d.ts +5 -0
- package/presentation/localStorage/useLocalStorageValues.js +32 -0
- package/presentation/localStorage/useLocalStorageValues.js.map +1 -0
- package/presentation/router/RouteElementRegistry.d.ts +14 -0
- package/presentation/router/RouteElementRegistry.js +29 -0
- package/presentation/router/RouteElementRegistry.js.map +1 -0
- package/presentation/router/abstractions.d.ts +13 -0
- package/presentation/router/abstractions.js +5 -0
- package/presentation/router/abstractions.js.map +1 -0
- package/presentation/router/components/Redirect.d.ts +14 -0
- package/presentation/router/components/Redirect.js +13 -0
- package/presentation/router/components/Redirect.js.map +1 -0
- package/presentation/router/components/RouteContent.d.ts +2 -0
- package/presentation/router/components/RouteContent.js +20 -0
- package/presentation/router/components/RouteContent.js.map +1 -0
- package/presentation/router/components/RouteLink.d.ts +50 -0
- package/presentation/router/components/RouteLink.js +17 -0
- package/presentation/router/components/RouteLink.js.map +1 -0
- package/presentation/router/components/SimpleLink.d.ts +44 -0
- package/presentation/router/components/SimpleLink.js +24 -0
- package/presentation/router/components/SimpleLink.js.map +1 -0
- package/presentation/router/hooks/useRoute.d.ts +6 -0
- package/presentation/router/hooks/useRoute.js +22 -0
- package/presentation/router/hooks/useRoute.js.map +1 -0
- package/presentation/router/hooks/useRouter.d.ts +11 -0
- package/presentation/router/hooks/useRouter.js +29 -0
- package/presentation/router/hooks/useRouter.js.map +1 -0
- package/presentation/router/index.d.ts +4 -0
- package/presentation/router/index.js +3 -0
- package/presentation/router/types.d.ts +5 -0
- package/presentation/router/types.js +0 -0
- package/renderApp.d.ts +2 -0
- package/renderApp.js +10 -0
- package/renderApp.js.map +1 -0
- package/router.d.ts +5 -0
- package/router.js +5 -0
- package/rslib-runtime.js +14 -0
- package/rslib-runtime.js.map +1 -0
- package/shared/di/DiContainerProvider.d.ts +8 -0
- package/shared/di/DiContainerProvider.js +13 -0
- package/shared/di/DiContainerProvider.js.map +1 -0
- package/shared/di/createFeature.d.ts +11 -0
- package/shared/di/createFeature.js +10 -0
- package/shared/di/createFeature.js.map +1 -0
- package/shared/di/useFeature.d.ts +2 -0
- package/shared/di/useFeature.js +12 -0
- package/shared/di/useFeature.js.map +1 -0
- package/static/svg/close_24px.33adaadc.svg +1 -0
- package/types.d.ts +16 -28
- package/types.js +0 -12
- package/utils/createGenericContext.d.ts +13 -0
- package/utils/createGenericContext.js +21 -0
- package/utils/createGenericContext.js.map +1 -0
- package/utils/createHashing.d.ts +2 -0
- package/utils/createHashing.js +15 -0
- package/utils/createHashing.js.map +1 -0
- package/utils/index.d.ts +2 -8
- package/utils/index.js +2 -93
- package/utils/legacyPluginToReactComponent.d.ts +7 -0
- package/utils/legacyPluginToReactComponent.js +15 -0
- package/utils/legacyPluginToReactComponent.js.map +1 -0
- package/components/Routes.d.ts +0 -2
- package/components/Routes.js +0 -45
- package/components/Routes.js.map +0 -1
- package/components/View.d.ts +0 -8
- package/components/View.js +0 -30
- package/components/View.js.map +0 -1
- package/components/index.js.map +0 -1
- package/core/AddRoute.d.ts +0 -3
- package/core/AddRoute.js +0 -19
- package/core/AddRoute.js.map +0 -1
- package/core/DebounceRender.d.ts +0 -11
- package/core/DebounceRender.js +0 -41
- package/core/DebounceRender.js.map +0 -1
- package/core/Routes.d.ts +0 -6
- package/core/Routes.js +0 -42
- package/core/Routes.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/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +0 -14
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +0 -29
- package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +0 -1
- package/hooks/useDataList/utils/types.d.ts +0 -34
- package/hooks/useDataList/utils/types.js +0 -5
- package/hooks/useDataList/utils/types.js.map +0 -1
- package/i18n/index.js.map +0 -1
- package/index.js.map +0 -1
- package/plugins/LocaleHeaderLinkPlugin.d.ts +0 -10
- package/plugins/LocaleHeaderLinkPlugin.js +0 -53
- package/plugins/LocaleHeaderLinkPlugin.js.map +0 -1
- package/plugins/RoutePlugin.d.ts +0 -12
- package/plugins/RoutePlugin.js +0 -38
- package/plugins/RoutePlugin.js.map +0 -1
- package/plugins/ViewPlugin.d.ts +0 -14
- package/plugins/ViewPlugin.js +0 -43
- package/plugins/ViewPlugin.js.map +0 -1
- package/types.js.map +0 -1
- package/utils/getApiUrl.d.ts +0 -1
- package/utils/getApiUrl.js +0 -11
- package/utils/getApiUrl.js.map +0 -1
- package/utils/getGqlApiUrl.d.ts +0 -1
- package/utils/getGqlApiUrl.js +0 -11
- package/utils/getGqlApiUrl.js.map +0 -1
- package/utils/getHeadlessCmsGqlApiUrl.d.ts +0 -5
- package/utils/getHeadlessCmsGqlApiUrl.js +0 -17
- package/utils/getHeadlessCmsGqlApiUrl.js.map +0 -1
- package/utils/getLocaleCode.d.ts +0 -6
- package/utils/getLocaleCode.js +0 -42
- package/utils/getLocaleCode.js.map +0 -1
- package/utils/getPrerenderId.d.ts +0 -6
- package/utils/getPrerenderId.js +0 -10
- package/utils/getPrerenderId.js.map +0 -1
- package/utils/getTenantId.d.ts +0 -6
- package/utils/getTenantId.js +0 -34
- package/utils/getTenantId.js.map +0 -1
- package/utils/index.js.map +0 -1
- package/utils/isLocalhost.d.ts +0 -1
- package/utils/isLocalhost.js +0 -14
- package/utils/isLocalhost.js.map +0 -1
- package/utils/isPrerendering.d.ts +0 -1
- package/utils/isPrerendering.js +0 -10
- package/utils/isPrerendering.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/NetworkErrorLinkPlugin/createErrorOverlay.js","sources":["../../../src/plugins/NetworkErrorLinkPlugin/createErrorOverlay.tsx"],"sourcesContent":["import type React from \"react\";\nimport { createRoot } from \"react-dom/client\";\n\ninterface CreateErrorOverlayParams {\n element: React.ReactElement;\n closeable?: boolean;\n}\n\nconst createErrorOverlay = (params: CreateErrorOverlayParams): void => {\n const { element } = params;\n // If the element already present in DOM, return immediately.\n if (document.getElementById(\"overlay-root\")) {\n return;\n }\n // Create root element to hold React tree.\n const container: HTMLDivElement = document.createElement(\"div\");\n container.id = \"overlay-root\";\n // Insert root element into body.\n const body: HTMLBodyElement = document.getElementsByTagName(\"body\")[0];\n body.appendChild(container);\n // Mount the ErrorOverlay component into root element.\n const root = createRoot(container);\n root.render(element);\n};\n\nexport default createErrorOverlay;\n"],"names":["createErrorOverlay","params","element","document","container","body","root","createRoot"],"mappings":";AAQA,MAAMA,qBAAqB,CAACC;IACxB,MAAM,EAAEC,OAAO,EAAE,GAAGD;IAEpB,IAAIE,SAAS,cAAc,CAAC,iBACxB;IAGJ,MAAMC,YAA4BD,SAAS,aAAa,CAAC;IACzDC,UAAU,EAAE,GAAG;IAEf,MAAMC,OAAwBF,SAAS,oBAAoB,CAAC,OAAO,CAAC,EAAE;IACtEE,KAAK,WAAW,CAACD;IAEjB,MAAME,OAAOC,WAAWH;IACxBE,KAAK,MAAM,CAACJ;AAChB;AAEA,kDAAeF"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
|
|
1
|
+
import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
|
|
2
|
+
import type { EventPublisher } from "../features/eventPublisher/index.js";
|
|
2
3
|
/**
|
|
3
4
|
* This plugin creates an ApolloLink that checks for `NetworkError` and shows an ErrorOverlay in the browser.
|
|
4
5
|
*/
|
|
5
6
|
export declare class NetworkErrorLinkPlugin extends ApolloLinkPlugin {
|
|
7
|
+
private getEventPublisher;
|
|
8
|
+
constructor(getEventPublisher: () => EventPublisher.Interface);
|
|
6
9
|
createLink(): import("apollo-link").ApolloLink;
|
|
7
10
|
}
|
|
@@ -1,48 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _boolean = require("boolean");
|
|
17
|
-
var _config = require("../config");
|
|
18
|
-
/**
|
|
19
|
-
* This plugin creates an ApolloLink that checks for `NetworkError` and shows an ErrorOverlay in the browser.
|
|
20
|
-
*/
|
|
21
|
-
var NetworkErrorLinkPlugin = /*#__PURE__*/function (_ApolloLinkPlugin) {
|
|
22
|
-
(0, _inherits2.default)(NetworkErrorLinkPlugin, _ApolloLinkPlugin);
|
|
23
|
-
var _super = (0, _createSuper2.default)(NetworkErrorLinkPlugin);
|
|
24
|
-
function NetworkErrorLinkPlugin() {
|
|
25
|
-
(0, _classCallCheck2.default)(this, NetworkErrorLinkPlugin);
|
|
26
|
-
return _super.apply(this, arguments);
|
|
27
|
-
}
|
|
28
|
-
(0, _createClass2.default)(NetworkErrorLinkPlugin, [{
|
|
29
|
-
key: "createLink",
|
|
30
|
-
value: function createLink() {
|
|
31
|
-
return (0, _apolloLinkError.onError)(function (_ref) {
|
|
32
|
-
var networkError = _ref.networkError,
|
|
33
|
-
operation = _ref.operation;
|
|
34
|
-
var debug = _config.config.getKey("DEBUG", (0, _boolean.boolean)(process.env.REACT_APP_DEBUG));
|
|
35
|
-
if (networkError && debug) {
|
|
36
|
-
(0, _createErrorOverlay.default)({
|
|
37
|
-
query: (0, _language.print)(operation.query),
|
|
38
|
-
networkError: networkError
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// TODO: also print graphQLErrors
|
|
43
|
-
});
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { onError } from "apollo-link-error";
|
|
3
|
+
import { print } from "graphql/language/index.js";
|
|
4
|
+
import { toBoolean } from "@webiny/stdlib";
|
|
5
|
+
import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
|
|
6
|
+
import createErrorOverlay from "./NetworkErrorLinkPlugin/createErrorOverlay.js";
|
|
7
|
+
import { LocalAwsLambdaTimeoutMessage } from "./NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js";
|
|
8
|
+
import { config } from "../config.js";
|
|
9
|
+
import { ErrorOverlay } from "./NetworkErrorLinkPlugin/ErrorOverlay.js";
|
|
10
|
+
import { GqlErrorOverlay } from "./NetworkErrorLinkPlugin/GqlErrorOverlay.js";
|
|
11
|
+
import { NetworkErrorEvent } from "../errors/index.js";
|
|
12
|
+
const isLocalAwsLambdaFnInvocationTimeoutError = (error)=>error.result && "LOCAL_AWS_LAMBDA_TIMEOUT" === error.result.code;
|
|
13
|
+
class NetworkErrorLinkPlugin extends ApolloLinkPlugin {
|
|
14
|
+
constructor(getEventPublisher){
|
|
15
|
+
super(), this.getEventPublisher = getEventPublisher;
|
|
44
16
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
17
|
+
createLink() {
|
|
18
|
+
return onError(({ networkError, operation })=>{
|
|
19
|
+
const debug = config.getKey("DEBUG", toBoolean(process.env.REACT_APP_DEBUG));
|
|
20
|
+
if (networkError) {
|
|
21
|
+
const errorType = isLocalAwsLambdaFnInvocationTimeoutError(networkError) ? "timeout" : "network";
|
|
22
|
+
const event = new NetworkErrorEvent({
|
|
23
|
+
message: networkError.message,
|
|
24
|
+
operationName: operation.operationName,
|
|
25
|
+
query: print(operation.query),
|
|
26
|
+
variables: operation.variables,
|
|
27
|
+
errorType,
|
|
28
|
+
statusCode: networkError.statusCode,
|
|
29
|
+
result: networkError.result
|
|
30
|
+
});
|
|
31
|
+
this.getEventPublisher().publish(event);
|
|
32
|
+
if (debug) {
|
|
33
|
+
if (isLocalAwsLambdaFnInvocationTimeoutError(networkError)) return void createErrorOverlay({
|
|
34
|
+
element: /*#__PURE__*/ react.createElement(ErrorOverlay, {
|
|
35
|
+
message: /*#__PURE__*/ react.createElement(LocalAwsLambdaTimeoutMessage, null),
|
|
36
|
+
closeable: false
|
|
37
|
+
}),
|
|
38
|
+
closeable: false
|
|
39
|
+
});
|
|
40
|
+
createErrorOverlay({
|
|
41
|
+
element: /*#__PURE__*/ react.createElement(GqlErrorOverlay, {
|
|
42
|
+
query: print(operation.query),
|
|
43
|
+
networkError: networkError
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export { NetworkErrorLinkPlugin };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=NetworkErrorLinkPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/NetworkErrorLinkPlugin.js","sources":["../../src/plugins/NetworkErrorLinkPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { onError } from \"apollo-link-error\";\nimport { type ServerError } from \"apollo-link-http-common\";\nimport { print } from \"graphql/language/index.js\";\nimport { toBoolean } from \"@webiny/stdlib\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport createErrorOverlay from \"./NetworkErrorLinkPlugin/createErrorOverlay.js\";\nimport { LocalAwsLambdaTimeoutMessage } from \"./NetworkErrorLinkPlugin/LocalAwsLambdaTimeoutMessage.js\";\nimport { config as appConfig } from \"~/config.js\";\nimport { ErrorOverlay } from \"~/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js\";\nimport { GqlErrorOverlay } from \"./NetworkErrorLinkPlugin/GqlErrorOverlay.js\";\nimport type { EventPublisher } from \"~/features/eventPublisher/index.js\";\nimport { NetworkErrorEvent } from \"~/errors/index.js\";\n\nconst isLocalAwsLambdaFnInvocationTimeoutError = (error: any): error is ServerError => {\n return error.result && error.result.code === \"LOCAL_AWS_LAMBDA_TIMEOUT\";\n};\n\n/**\n * This plugin creates an ApolloLink that checks for `NetworkError` and shows an ErrorOverlay in the browser.\n */\nexport class NetworkErrorLinkPlugin extends ApolloLinkPlugin {\n constructor(private getEventPublisher: () => EventPublisher.Interface) {\n super();\n }\n\n public override createLink() {\n return onError(({ networkError, operation }) => {\n const debug = appConfig.getKey(\"DEBUG\", toBoolean(process.env.REACT_APP_DEBUG));\n\n if (networkError) {\n // Publish network error event\n const errorType = isLocalAwsLambdaFnInvocationTimeoutError(networkError)\n ? \"timeout\"\n : \"network\";\n\n const event = new NetworkErrorEvent({\n message: networkError.message,\n operationName: operation.operationName,\n query: print(operation.query),\n variables: operation.variables,\n errorType,\n statusCode: (networkError as any).statusCode,\n result: (networkError as any).result\n });\n\n this.getEventPublisher().publish(event);\n\n // Keep existing overlay logic for now\n if (debug) {\n if (isLocalAwsLambdaFnInvocationTimeoutError(networkError)) {\n createErrorOverlay({\n element: (\n <ErrorOverlay\n message={<LocalAwsLambdaTimeoutMessage />}\n closeable={false}\n />\n ),\n closeable: false\n });\n return;\n }\n\n createErrorOverlay({\n element: (\n <GqlErrorOverlay\n query={print(operation.query)}\n networkError={networkError}\n />\n )\n });\n }\n }\n\n // TODO: also print graphQLErrors\n });\n }\n}\n"],"names":["isLocalAwsLambdaFnInvocationTimeoutError","error","NetworkErrorLinkPlugin","ApolloLinkPlugin","getEventPublisher","onError","networkError","operation","debug","appConfig","toBoolean","process","errorType","event","NetworkErrorEvent","print","createErrorOverlay","ErrorOverlay","LocalAwsLambdaTimeoutMessage","GqlErrorOverlay"],"mappings":";;;;;;;;;;;AAcA,MAAMA,2CAA2C,CAACC,QACvCA,MAAM,MAAM,IAAIA,AAAsB,+BAAtBA,MAAM,MAAM,CAAC,IAAI;AAMrC,MAAMC,+BAA+BC;IACxC,YAAoBC,iBAAiD,CAAE;QACnE,KAAK,SADWA,iBAAiB,GAAjBA;IAEpB;IAEgB,aAAa;QACzB,OAAOC,QAAQ,CAAC,EAAEC,YAAY,EAAEC,SAAS,EAAE;YACvC,MAAMC,QAAQC,OAAAA,MAAgB,CAAC,SAASC,UAAUC,QAAQ,GAAG,CAAC,eAAe;YAE7E,IAAIL,cAAc;gBAEd,MAAMM,YAAYZ,yCAAyCM,gBACrD,YACA;gBAEN,MAAMO,QAAQ,IAAIC,kBAAkB;oBAChC,SAASR,aAAa,OAAO;oBAC7B,eAAeC,UAAU,aAAa;oBACtC,OAAOQ,MAAMR,UAAU,KAAK;oBAC5B,WAAWA,UAAU,SAAS;oBAC9BK;oBACA,YAAaN,aAAqB,UAAU;oBAC5C,QAASA,aAAqB,MAAM;gBACxC;gBAEA,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAACO;gBAGjC,IAAIL,OAAO;oBACP,IAAIR,yCAAyCM,eAAe,YACxDU,mBAAmB;wBACf,SAAS,WAAT,GACI,oBAACC,cAAYA;4BACT,uBAAS,oBAACC,8BAA4BA;4BACtC,WAAW;;wBAGnB,WAAW;oBACf;oBAIJF,mBAAmB;wBACf,SAAS,WAAT,GACI,oBAACG,iBAAeA;4BACZ,OAAOJ,MAAMR,UAAU,KAAK;4BAC5B,cAAcD;;oBAG1B;gBACJ;YACJ;QAGJ;IACJ;AACJ"}
|
|
@@ -1,41 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.OmitTypenameLinkPlugin = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
|
-
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
12
|
-
var _apolloLink = require("apollo-link");
|
|
13
|
-
var _ApolloLinkPlugin2 = require("./ApolloLinkPlugin");
|
|
1
|
+
import { ApolloLink } from "apollo-link";
|
|
2
|
+
import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
|
|
14
3
|
function omitTypename(key, value) {
|
|
15
|
-
|
|
4
|
+
return "__typename" === key ? void 0 : value;
|
|
16
5
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _super = (0, _createSuper2.default)(OmitTypenameLinkPlugin);
|
|
24
|
-
function OmitTypenameLinkPlugin() {
|
|
25
|
-
(0, _classCallCheck2.default)(this, OmitTypenameLinkPlugin);
|
|
26
|
-
return _super.apply(this, arguments);
|
|
27
|
-
}
|
|
28
|
-
(0, _createClass2.default)(OmitTypenameLinkPlugin, [{
|
|
29
|
-
key: "createLink",
|
|
30
|
-
value: function createLink() {
|
|
31
|
-
return new _apolloLink.ApolloLink(function (operation, forward) {
|
|
32
|
-
if (operation.variables) {
|
|
33
|
-
operation.variables = JSON.parse(JSON.stringify(operation.variables), omitTypename);
|
|
34
|
-
}
|
|
35
|
-
return forward(operation);
|
|
36
|
-
});
|
|
6
|
+
class OmitTypenameLinkPlugin extends ApolloLinkPlugin {
|
|
7
|
+
createLink() {
|
|
8
|
+
return new ApolloLink((operation, forward)=>{
|
|
9
|
+
if (operation.variables) operation.variables = JSON.parse(JSON.stringify(operation.variables), omitTypename);
|
|
10
|
+
return forward(operation);
|
|
11
|
+
});
|
|
37
12
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
13
|
+
}
|
|
14
|
+
export { OmitTypenameLinkPlugin };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=OmitTypenameLinkPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/OmitTypenameLinkPlugin.js","sources":["../../src/plugins/OmitTypenameLinkPlugin.ts"],"sourcesContent":["import { ApolloLink } from \"apollo-link\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\n\nfunction omitTypename(key: string, value: string): string | undefined {\n return key === \"__typename\" ? undefined : value;\n}\n\n/**\n * This link removes `__typename` from the variables being sent to the API.\n */\nexport class OmitTypenameLinkPlugin extends ApolloLinkPlugin {\n public override createLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n if (operation.variables) {\n operation.variables = JSON.parse(JSON.stringify(operation.variables), omitTypename);\n }\n return forward(operation);\n });\n }\n}\n"],"names":["omitTypename","key","value","undefined","OmitTypenameLinkPlugin","ApolloLinkPlugin","ApolloLink","operation","forward","JSON"],"mappings":";;AAGA,SAASA,aAAaC,GAAW,EAAEC,KAAa;IAC5C,OAAOD,AAAQ,iBAARA,MAAuBE,SAAYD;AAC9C;AAKO,MAAME,+BAA+BC;IACxB,aAAyB;QACrC,OAAO,IAAIC,WAAW,CAACC,WAAWC;YAC9B,IAAID,UAAU,SAAS,EACnBA,UAAU,SAAS,GAAGE,KAAK,KAAK,CAACA,KAAK,SAAS,CAACF,UAAU,SAAS,GAAGP;YAE1E,OAAOQ,QAAQD;QACnB;IACJ;AACJ"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ApolloLinkPlugin } from "./ApolloLinkPlugin";
|
|
2
|
-
import { ApolloLink } from "apollo-link";
|
|
1
|
+
import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
|
|
2
|
+
import type { ApolloLink } from "apollo-link";
|
|
3
3
|
/**
|
|
4
4
|
* Append `x-tenant` header from URL query (necessary for prerendering service).
|
|
5
5
|
*/
|
|
6
6
|
export declare class TenantHeaderLinkPlugin extends ApolloLinkPlugin {
|
|
7
7
|
private readonly tenant;
|
|
8
|
-
constructor(tenant
|
|
8
|
+
constructor(tenant: string);
|
|
9
9
|
createLink(): ApolloLink;
|
|
10
10
|
}
|
|
@@ -1,60 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function TenantHeaderLinkPlugin(tenant) {
|
|
25
|
-
var _this;
|
|
26
|
-
(0, _classCallCheck2.default)(this, TenantHeaderLinkPlugin);
|
|
27
|
-
_this = _super.call(this);
|
|
28
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "tenant", void 0);
|
|
29
|
-
_this.name = "tenant-header-link";
|
|
30
|
-
_this.tenant = tenant || (0, _utils.getTenantId)();
|
|
31
|
-
return _this;
|
|
32
|
-
}
|
|
33
|
-
(0, _createClass2.default)(TenantHeaderLinkPlugin, [{
|
|
34
|
-
key: "createLink",
|
|
35
|
-
value: function createLink() {
|
|
36
|
-
var _this2 = this;
|
|
37
|
-
return (0, _apolloLinkContext.setContext)(function (_, _ref) {
|
|
38
|
-
var headers = _ref.headers;
|
|
39
|
-
// If tenant header is already set, do not overwrite it.
|
|
40
|
-
if (headers && "x-tenant" in headers) {
|
|
41
|
-
return {
|
|
42
|
-
headers: headers
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
if (_this2.tenant) {
|
|
46
|
-
return {
|
|
47
|
-
headers: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, headers), {}, {
|
|
48
|
-
"x-tenant": _this2.tenant
|
|
49
|
-
})
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
headers: headers
|
|
54
|
-
};
|
|
55
|
-
});
|
|
1
|
+
import { setContext } from "apollo-link-context";
|
|
2
|
+
import { ApolloLinkPlugin } from "./ApolloLinkPlugin.js";
|
|
3
|
+
class TenantHeaderLinkPlugin extends ApolloLinkPlugin {
|
|
4
|
+
constructor(tenant){
|
|
5
|
+
super();
|
|
6
|
+
this.name = "tenant-header-link";
|
|
7
|
+
this.tenant = tenant;
|
|
8
|
+
}
|
|
9
|
+
createLink() {
|
|
10
|
+
return setContext((_, { headers })=>{
|
|
11
|
+
if (headers && "x-tenant" in headers) return {
|
|
12
|
+
headers
|
|
13
|
+
};
|
|
14
|
+
if (this.tenant) return {
|
|
15
|
+
headers: {
|
|
16
|
+
...headers,
|
|
17
|
+
"x-tenant": this.tenant
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
headers
|
|
22
|
+
};
|
|
23
|
+
});
|
|
56
24
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
25
|
+
}
|
|
26
|
+
export { TenantHeaderLinkPlugin };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=TenantHeaderLinkPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/TenantHeaderLinkPlugin.js","sources":["../../src/plugins/TenantHeaderLinkPlugin.ts"],"sourcesContent":["import { setContext } from \"apollo-link-context\";\nimport { ApolloLinkPlugin } from \"./ApolloLinkPlugin.js\";\nimport type { ApolloLink } from \"apollo-link\";\n\n/**\n * Append `x-tenant` header from URL query (necessary for prerendering service).\n */\nexport class TenantHeaderLinkPlugin extends ApolloLinkPlugin {\n private readonly tenant: string;\n\n public constructor(tenant: string) {\n super();\n this.name = \"tenant-header-link\";\n\n this.tenant = tenant;\n }\n\n public override createLink(): ApolloLink {\n return setContext((_, { headers }) => {\n // If tenant header is already set, do not overwrite it.\n if (headers && \"x-tenant\" in headers) {\n return { headers };\n }\n\n if (this.tenant) {\n return {\n headers: {\n ...headers,\n \"x-tenant\": this.tenant\n }\n };\n }\n\n return { headers };\n });\n }\n}\n"],"names":["TenantHeaderLinkPlugin","ApolloLinkPlugin","tenant","setContext","_","headers"],"mappings":";;AAOO,MAAMA,+BAA+BC;IAGxC,YAAmBC,MAAc,CAAE;QAC/B,KAAK;QACL,IAAI,CAAC,IAAI,GAAG;QAEZ,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEgB,aAAyB;QACrC,OAAOC,WAAW,CAACC,GAAG,EAAEC,OAAO,EAAE;YAE7B,IAAIA,WAAW,cAAcA,SACzB,OAAO;gBAAEA;YAAQ;YAGrB,IAAI,IAAI,CAAC,MAAM,EACX,OAAO;gBACH,SAAS;oBACL,GAAGA,OAAO;oBACV,YAAY,IAAI,CAAC,MAAM;gBAC3B;YACJ;YAGJ,OAAO;gBAAEA;YAAQ;QACrB;IACJ;AACJ"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ImageProps extends React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
declare const Image: ({ ...rest }: ImageProps) => React.JSX.Element;
|
|
6
|
+
export { Image, type ImageProps };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
const Image = ({ ...rest })=>{
|
|
3
|
+
const finalProps = {
|
|
4
|
+
...rest
|
|
5
|
+
};
|
|
6
|
+
const srcSet = finalProps.srcSet;
|
|
7
|
+
if (srcSet && "object" == typeof srcSet) finalProps.srcSet = Object.keys(srcSet).map((key)=>`${srcSet[key]} ${key}`).join(", ");
|
|
8
|
+
return /*#__PURE__*/ react.createElement("img", finalProps);
|
|
9
|
+
};
|
|
10
|
+
export { Image };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=Image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugins/components/Image.js","sources":["../../../src/plugins/components/Image.tsx"],"sourcesContent":["import React from \"react\";\n\n// Accepts all props that a normal <img> element would accept.\ninterface ImageProps extends React.DetailedHTMLProps<\n React.ImgHTMLAttributes<HTMLImageElement>,\n HTMLImageElement\n> {\n [key: string]: any;\n}\n\nconst Image = ({ ...rest }: ImageProps) => {\n const finalProps = { ...rest };\n const srcSet = finalProps.srcSet;\n if (srcSet && typeof srcSet === \"object\") {\n finalProps.srcSet = Object.keys(srcSet)\n .map(key => `${srcSet[key]} ${key}`)\n .join(\", \");\n }\n\n return <img {...finalProps} />;\n};\n\nexport { Image, type ImageProps };\n"],"names":["Image","rest","finalProps","srcSet","Object","key"],"mappings":";AAUA,MAAMA,QAAQ,CAAC,EAAE,GAAGC,MAAkB;IAClC,MAAMC,aAAa;QAAE,GAAGD,IAAI;IAAC;IAC7B,MAAME,SAASD,WAAW,MAAM;IAChC,IAAIC,UAAU,AAAkB,YAAlB,OAAOA,QACjBD,WAAW,MAAM,GAAGE,OAAO,IAAI,CAACD,QAC3B,GAAG,CAACE,CAAAA,MAAO,GAAGF,MAAM,CAACE,IAAI,CAAC,CAAC,EAAEA,KAAK,EAClC,IAAI,CAAC;IAGd,OAAO,WAAP,GAAO,oBAAC,OAAQH;AACpB"}
|
package/plugins/image.d.ts
CHANGED
package/plugins/image.js
CHANGED
|
@@ -1,151 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { Image } from "./components/Image.js";
|
|
3
|
+
const SUPPORTED_IMAGE_RESIZE_WIDTHS = [
|
|
4
|
+
128,
|
|
5
|
+
384,
|
|
6
|
+
640,
|
|
7
|
+
750,
|
|
8
|
+
828,
|
|
9
|
+
1080,
|
|
10
|
+
1200,
|
|
11
|
+
1920,
|
|
12
|
+
2048,
|
|
13
|
+
3840
|
|
14
|
+
];
|
|
15
|
+
const getSupportedImageResizeWidth = (width)=>{
|
|
16
|
+
let output = SUPPORTED_IMAGE_RESIZE_WIDTHS[0];
|
|
17
|
+
let i = SUPPORTED_IMAGE_RESIZE_WIDTHS.length;
|
|
18
|
+
while(i >= 0){
|
|
19
|
+
if (width === SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {
|
|
20
|
+
output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
if (width > SUPPORTED_IMAGE_RESIZE_WIDTHS[i]) {
|
|
24
|
+
output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i + 1];
|
|
25
|
+
if (!output) output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
i--;
|
|
26
29
|
}
|
|
27
|
-
|
|
28
|
-
// Use next larger width. If there isn't any, use current.
|
|
29
|
-
output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i + 1];
|
|
30
|
-
if (!output) {
|
|
31
|
-
output = SUPPORTED_IMAGE_RESIZE_WIDTHS[i];
|
|
32
|
-
}
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
i--;
|
|
36
|
-
}
|
|
37
|
-
return output;
|
|
30
|
+
return output;
|
|
38
31
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var output = {};
|
|
45
|
-
if (!args || args.width === undefined || args.width === null) {
|
|
32
|
+
const sanitizeTransformArgs = (args)=>{
|
|
33
|
+
const output = {};
|
|
34
|
+
if (!args || void 0 === args.width || null === args.width) return output;
|
|
35
|
+
const width = parseInt(args.width);
|
|
36
|
+
if (width > 0) output.width = getSupportedImageResizeWidth(width);
|
|
46
37
|
return output;
|
|
47
|
-
}
|
|
48
|
-
var width = parseInt(args.width);
|
|
49
|
-
if (width > 0) {
|
|
50
|
-
output.width = getSupportedImageResizeWidth(width);
|
|
51
|
-
}
|
|
52
|
-
return output;
|
|
53
38
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (width.endsWith("%")) {
|
|
60
|
-
return "".concat(parseInt(width), "vw");
|
|
61
|
-
}
|
|
62
|
-
// Check if width was set as viewport width, with "vw" in the value.
|
|
63
|
-
if (width.endsWith("vw")) {
|
|
64
|
-
return "".concat(parseInt(width), "vw");
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Check if width was set as relative, with "em" in the value.
|
|
68
|
-
if (width.endsWith("em")) {
|
|
69
|
-
return "".concat(parseInt(width), "em");
|
|
70
|
-
}
|
|
71
|
-
return undefined;
|
|
39
|
+
const getSizes = (width)=>{
|
|
40
|
+
if ("string" != typeof width) return;
|
|
41
|
+
if (width.endsWith("%")) return `${parseInt(width)}vw`;
|
|
42
|
+
if (width.endsWith("vw")) return `${parseInt(width)}vw`;
|
|
43
|
+
if (width.endsWith("em")) return `${parseInt(width)}em`;
|
|
72
44
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return true;
|
|
76
|
-
|
|
77
|
-
if (typeof width === "string" && width.endsWith("px")) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
return false;
|
|
45
|
+
const isFixedImageWidth = (width)=>{
|
|
46
|
+
if (Number.isFinite(width)) return true;
|
|
47
|
+
if ("string" == typeof width && width.endsWith("px")) return true;
|
|
48
|
+
return false;
|
|
81
49
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return supportedWidth <= maxWidth;
|
|
87
|
-
});
|
|
50
|
+
const getSrcSetAutoSizes = (max)=>{
|
|
51
|
+
max = isFixedImageWidth(max) ? parseInt("" + max) : 2500;
|
|
52
|
+
const maxWidth = getSupportedImageResizeWidth(max);
|
|
53
|
+
return SUPPORTED_IMAGE_RESIZE_WIDTHS.filter((supportedWidth)=>supportedWidth <= maxWidth);
|
|
88
54
|
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
55
|
+
const convertTransformToQueryParams = (transform)=>Object.keys(transform).map((key)=>`${key}=${transform[key]}`).join("&");
|
|
56
|
+
const plugins_image = ()=>{
|
|
57
|
+
const imagePlugin = {
|
|
58
|
+
name: "image-component",
|
|
59
|
+
type: "image-component",
|
|
60
|
+
presets: {
|
|
61
|
+
avatar: {
|
|
62
|
+
width: 300
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
getImageSrc: (props)=>{
|
|
66
|
+
if (!props) return "";
|
|
67
|
+
const { src, transform } = props;
|
|
68
|
+
if (!transform) return src;
|
|
69
|
+
if (!src || src.startsWith("data:") || src.endsWith("svg")) return src;
|
|
70
|
+
const sanitizedParams = sanitizeTransformArgs(transform);
|
|
71
|
+
const params = convertTransformToQueryParams(sanitizedParams);
|
|
72
|
+
return src + "?" + params;
|
|
73
|
+
},
|
|
74
|
+
render (props) {
|
|
75
|
+
const { transform, srcSet: srcSetInitial, ...imageProps } = props;
|
|
76
|
+
let srcSet = srcSetInitial;
|
|
77
|
+
let sizes;
|
|
78
|
+
const src = imageProps.src;
|
|
79
|
+
if (srcSet && "auto" === srcSet) {
|
|
80
|
+
srcSet = {};
|
|
81
|
+
const forcedWidth = props.width || props.style && props.style.width;
|
|
82
|
+
const srcSetAutoWidths = getSrcSetAutoSizes(forcedWidth);
|
|
83
|
+
srcSetAutoWidths.forEach((width)=>{
|
|
84
|
+
srcSet[width + "w"] = imagePlugin.getImageSrc({
|
|
85
|
+
src,
|
|
86
|
+
transform: {
|
|
87
|
+
...transform,
|
|
88
|
+
width
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
sizes = getSizes(forcedWidth);
|
|
93
|
+
}
|
|
94
|
+
return /*#__PURE__*/ react.createElement(Image, {
|
|
95
|
+
...imageProps,
|
|
96
|
+
srcSet: srcSet,
|
|
97
|
+
src: src,
|
|
98
|
+
sizes: sizes
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return imagePlugin;
|
|
93
103
|
};
|
|
94
|
-
|
|
95
|
-
var imagePlugin = {
|
|
96
|
-
name: "image-component",
|
|
97
|
-
type: "image-component",
|
|
98
|
-
presets: {
|
|
99
|
-
avatar: {
|
|
100
|
-
width: 300
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
getImageSrc: function getImageSrc(props) {
|
|
104
|
-
if (!props) {
|
|
105
|
-
return "";
|
|
106
|
-
}
|
|
107
|
-
var src = props.src,
|
|
108
|
-
transform = props.transform;
|
|
109
|
-
if (!transform) {
|
|
110
|
-
return src;
|
|
111
|
-
}
|
|
112
|
-
if (!src || src.startsWith("data:") || src.endsWith("svg")) {
|
|
113
|
-
return src;
|
|
114
|
-
}
|
|
115
|
-
var sanitizedParams = sanitizeTransformArgs(transform);
|
|
116
|
-
var params = convertTransformToQueryParams(sanitizedParams);
|
|
117
|
-
return src + "?" + params;
|
|
118
|
-
},
|
|
119
|
-
render: function render(props) {
|
|
120
|
-
var transform = props.transform,
|
|
121
|
-
srcSetInitial = props.srcSet,
|
|
122
|
-
imageProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
123
|
-
var srcSet = srcSetInitial;
|
|
124
|
-
var sizes;
|
|
125
|
-
var src = imageProps.src;
|
|
126
|
-
if (srcSet && srcSet === "auto") {
|
|
127
|
-
srcSet = {};
|
|
104
|
+
export default plugins_image;
|
|
128
105
|
|
|
129
|
-
|
|
130
|
-
var forcedWidth = props.width || props.style && props.style.width;
|
|
131
|
-
var srcSetAutoWidths = getSrcSetAutoSizes(forcedWidth);
|
|
132
|
-
srcSetAutoWidths.forEach(function (width) {
|
|
133
|
-
srcSet[width + "w"] = imagePlugin.getImageSrc({
|
|
134
|
-
src: src,
|
|
135
|
-
transform: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, transform), {}, {
|
|
136
|
-
width: width
|
|
137
|
-
})
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
sizes = getSizes(forcedWidth);
|
|
141
|
-
}
|
|
142
|
-
return /*#__PURE__*/_react.default.createElement(_Image.Image, Object.assign({}, imageProps, {
|
|
143
|
-
srcSet: srcSet,
|
|
144
|
-
src: src,
|
|
145
|
-
sizes: sizes
|
|
146
|
-
}));
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
return imagePlugin;
|
|
150
|
-
};
|
|
151
|
-
exports.default = _default;
|
|
106
|
+
//# sourceMappingURL=image.js.map
|