@cwa/nuxt-edge 1.0.0-29138192.e49c1a0
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/README.md +38 -0
- package/README.template.md +32 -0
- package/dist/layer/error.vue +13 -0
- package/dist/layer/layouts/CwaRootLayout.vue +140 -0
- package/dist/layer/nuxt.config.spec.ts +10 -0
- package/dist/layer/nuxt.config.ts +3 -0
- package/dist/layer/pages/_cwa/composables/useDataList.ts +50 -0
- package/dist/layer/pages/_cwa/composables/useDataType.ts +30 -0
- package/dist/layer/pages/_cwa/composables/useDynamicPageLoader.ts +28 -0
- package/dist/layer/pages/_cwa/composables/useItemPage.ts +172 -0
- package/dist/layer/pages/_cwa/composables/useListPage.ts +43 -0
- package/dist/layer/pages/_cwa/data/[type]/[iri].vue +17 -0
- package/dist/layer/pages/_cwa/data/[type].vue +131 -0
- package/dist/layer/pages/_cwa/data/index.vue +84 -0
- package/dist/layer/pages/_cwa/layouts/[iri].vue +174 -0
- package/dist/layer/pages/_cwa/layouts.vue +77 -0
- package/dist/layer/pages/_cwa/pages/[iri].vue +11 -0
- package/dist/layer/pages/_cwa/pages.vue +129 -0
- package/dist/layer/pages/_cwa/routes.vue +72 -0
- package/dist/layer/pages/_cwa/users/[iri].vue +248 -0
- package/dist/layer/pages/_cwa/users.vue +86 -0
- package/dist/layer/pages/_cwa.vue +43 -0
- package/dist/layer/pages/forgot-password.vue +32 -0
- package/dist/layer/pages/login.vue +33 -0
- package/dist/layer/pages/reset-password/[username]/[token].vue +39 -0
- package/dist/module.d.mts +53 -0
- package/dist/module.json +13 -0
- package/dist/module.mjs +235 -0
- package/dist/runtime/admin/admin.d.ts +36 -0
- package/dist/runtime/admin/admin.js +65 -0
- package/dist/runtime/admin/manageable-resource.d.ts +41 -0
- package/dist/runtime/admin/manageable-resource.js +206 -0
- package/dist/runtime/admin/manager-tabs-resolver.d.ts +17 -0
- package/dist/runtime/admin/manager-tabs-resolver.js +51 -0
- package/dist/runtime/admin/navigation-guard.d.ts +18 -0
- package/dist/runtime/admin/navigation-guard.js +55 -0
- package/dist/runtime/admin/resource-stack-manager.d.ts +92 -0
- package/dist/runtime/admin/resource-stack-manager.js +355 -0
- package/dist/runtime/api/api-documentation.d.ts +28 -0
- package/dist/runtime/api/api-documentation.js +131 -0
- package/dist/runtime/api/auth.d.ts +85 -0
- package/dist/runtime/api/auth.js +183 -0
- package/dist/runtime/api/fetcher/cwa-fetch.d.ts +5 -0
- package/dist/runtime/api/fetcher/cwa-fetch.js +20 -0
- package/dist/runtime/api/fetcher/fetch-status-manager.d.ts +51 -0
- package/dist/runtime/api/fetcher/fetch-status-manager.js +185 -0
- package/dist/runtime/api/fetcher/fetcher.d.ts +57 -0
- package/dist/runtime/api/fetcher/fetcher.js +222 -0
- package/dist/runtime/api/fetcher/preload-headers.d.ts +6 -0
- package/dist/runtime/api/fetcher/preload-headers.js +31 -0
- package/dist/runtime/api/forms.d.ts +40 -0
- package/dist/runtime/api/forms.js +40 -0
- package/dist/runtime/api/mercure.d.ts +33 -0
- package/dist/runtime/api/mercure.js +191 -0
- package/dist/runtime/composables/component/html-content.d.ts +2 -0
- package/dist/runtime/composables/component/html-content.js +82 -0
- package/dist/runtime/composables/cwa-collection-pagination.d.ts +13 -0
- package/dist/runtime/composables/cwa-collection-pagination.js +34 -0
- package/dist/runtime/composables/cwa-collection-resource.d.ts +16 -0
- package/dist/runtime/composables/cwa-collection-resource.js +92 -0
- package/dist/runtime/composables/cwa-image.d.ts +19 -0
- package/dist/runtime/composables/cwa-image.js +43 -0
- package/dist/runtime/composables/cwa-query-bound-model.d.ts +9 -0
- package/dist/runtime/composables/cwa-query-bound-model.js +108 -0
- package/dist/runtime/composables/cwa-resource-endpoint.d.ts +5 -0
- package/dist/runtime/composables/cwa-resource-endpoint.js +36 -0
- package/dist/runtime/composables/cwa-resource-manageable.d.ts +10 -0
- package/dist/runtime/composables/cwa-resource-manageable.js +32 -0
- package/dist/runtime/composables/cwa-resource-manager-tab.d.ts +17 -0
- package/dist/runtime/composables/cwa-resource-manager-tab.js +30 -0
- package/dist/runtime/composables/cwa-resource-model.d.ts +21 -0
- package/dist/runtime/composables/cwa-resource-model.js +149 -0
- package/dist/runtime/composables/cwa-resource-upload.d.ts +8 -0
- package/dist/runtime/composables/cwa-resource-upload.js +70 -0
- package/dist/runtime/composables/cwa-resource.d.ts +24 -0
- package/dist/runtime/composables/cwa-resource.js +22 -0
- package/dist/runtime/composables/cwa-select-input.d.ts +21 -0
- package/dist/runtime/composables/cwa-select-input.js +37 -0
- package/dist/runtime/composables/cwa-select.d.ts +15 -0
- package/dist/runtime/composables/cwa-select.js +24 -0
- package/dist/runtime/composables/cwa.d.ts +2 -0
- package/dist/runtime/composables/cwa.js +2 -0
- package/dist/runtime/composables/forgot-password.d.ts +9 -0
- package/dist/runtime/composables/forgot-password.js +45 -0
- package/dist/runtime/composables/login.d.ts +9 -0
- package/dist/runtime/composables/login.js +30 -0
- package/dist/runtime/composables/popper.d.ts +529 -0
- package/dist/runtime/composables/popper.js +104 -0
- package/dist/runtime/composables/process.d.ts +4 -0
- package/dist/runtime/composables/process.js +6 -0
- package/dist/runtime/composables/reset-password.d.ts +14 -0
- package/dist/runtime/composables/reset-password.js +75 -0
- package/dist/runtime/composables/transitions.d.ts +12 -0
- package/dist/runtime/composables/transitions.js +12 -0
- package/dist/runtime/cwa.d.ts +61 -0
- package/dist/runtime/cwa.js +123 -0
- package/dist/runtime/errors/cwa-resource-error.d.ts +18 -0
- package/dist/runtime/errors/cwa-resource-error.js +54 -0
- package/dist/runtime/plugin.d.ts +7 -0
- package/dist/runtime/plugin.js +18 -0
- package/dist/runtime/resources/resource-utils.d.ts +44 -0
- package/dist/runtime/resources/resource-utils.js +73 -0
- package/dist/runtime/resources/resources-manager.d.ts +70 -0
- package/dist/runtime/resources/resources-manager.js +463 -0
- package/dist/runtime/resources/resources.d.ts +53 -0
- package/dist/runtime/resources/resources.js +300 -0
- package/dist/runtime/route-middleware.d.ts +2 -0
- package/dist/runtime/route-middleware.js +86 -0
- package/dist/runtime/storage/storage.d.ts +20 -0
- package/dist/runtime/storage/storage.js +25 -0
- package/dist/runtime/storage/stores/admin/actions.d.ts +5 -0
- package/dist/runtime/storage/stores/admin/actions.js +10 -0
- package/dist/runtime/storage/stores/admin/admin-store.d.ts +18 -0
- package/dist/runtime/storage/stores/admin/admin-store.js +20 -0
- package/dist/runtime/storage/stores/admin/state.d.ts +7 -0
- package/dist/runtime/storage/stores/admin/state.js +9 -0
- package/dist/runtime/storage/stores/api-documentation/api-documentation-store.d.ts +16 -0
- package/dist/runtime/storage/stores/api-documentation/api-documentation-store.js +18 -0
- package/dist/runtime/storage/stores/api-documentation/state.d.ts +74 -0
- package/dist/runtime/storage/stores/api-documentation/state.js +6 -0
- package/dist/runtime/storage/stores/auth/auth-store.d.ts +16 -0
- package/dist/runtime/storage/stores/auth/auth-store.js +18 -0
- package/dist/runtime/storage/stores/auth/state.d.ts +20 -0
- package/dist/runtime/storage/stores/auth/state.js +15 -0
- package/dist/runtime/storage/stores/cwa-store-types.d.ts +14 -0
- package/dist/runtime/storage/stores/error/actions.d.ts +11 -0
- package/dist/runtime/storage/stores/error/actions.js +69 -0
- package/dist/runtime/storage/stores/error/error-store.d.ts +13 -0
- package/dist/runtime/storage/stores/error/error-store.js +21 -0
- package/dist/runtime/storage/stores/error/getters.d.ts +7 -0
- package/dist/runtime/storage/stores/error/getters.js +11 -0
- package/dist/runtime/storage/stores/error/state.d.ts +35 -0
- package/dist/runtime/storage/stores/error/state.js +15 -0
- package/dist/runtime/storage/stores/fetcher/actions.d.ts +49 -0
- package/dist/runtime/storage/stores/fetcher/actions.js +125 -0
- package/dist/runtime/storage/stores/fetcher/fetcher-store.d.ts +19 -0
- package/dist/runtime/storage/stores/fetcher/fetcher-store.js +23 -0
- package/dist/runtime/storage/stores/fetcher/getter-utils.d.ts +7 -0
- package/dist/runtime/storage/stores/fetcher/getter-utils.js +27 -0
- package/dist/runtime/storage/stores/fetcher/getters.d.ts +13 -0
- package/dist/runtime/storage/stores/fetcher/getters.js +52 -0
- package/dist/runtime/storage/stores/fetcher/state.d.ts +25 -0
- package/dist/runtime/storage/stores/fetcher/state.js +7 -0
- package/dist/runtime/storage/stores/mercure/mercure-store.d.ts +16 -0
- package/dist/runtime/storage/stores/mercure/mercure-store.js +18 -0
- package/dist/runtime/storage/stores/mercure/state.d.ts +5 -0
- package/dist/runtime/storage/stores/mercure/state.js +6 -0
- package/dist/runtime/storage/stores/resources/actions.d.ts +54 -0
- package/dist/runtime/storage/stores/resources/actions.js +390 -0
- package/dist/runtime/storage/stores/resources/getter-utils.d.ts +7 -0
- package/dist/runtime/storage/stores/resources/getter-utils.js +27 -0
- package/dist/runtime/storage/stores/resources/getters.d.ts +38 -0
- package/dist/runtime/storage/stores/resources/getters.js +251 -0
- package/dist/runtime/storage/stores/resources/resources-store.d.ts +19 -0
- package/dist/runtime/storage/stores/resources/resources-store.js +23 -0
- package/dist/runtime/storage/stores/resources/state.d.ts +64 -0
- package/dist/runtime/storage/stores/resources/state.js +24 -0
- package/dist/runtime/templates/assets/base.css +1 -0
- package/dist/runtime/templates/assets/cwa.css +1 -0
- package/dist/runtime/templates/components/core/ComponentPlaceholder.vue +18 -0
- package/dist/runtime/templates/components/core/ComponentPlaceholder.vue.d.ts +3 -0
- package/dist/runtime/templates/components/core/ComponentPosition.spec.ts.snap +16 -0
- package/dist/runtime/templates/components/core/ComponentPosition.vue +63 -0
- package/dist/runtime/templates/components/core/ComponentPosition.vue.d.ts +3 -0
- package/dist/runtime/templates/components/core/ConfirmDialog.vue +41 -0
- package/dist/runtime/templates/components/core/ConfirmDialog.vue.d.ts +9 -0
- package/dist/runtime/templates/components/core/DialogBox.vue +95 -0
- package/dist/runtime/templates/components/core/DialogBox.vue.d.ts +38 -0
- package/dist/runtime/templates/components/core/README.md +1 -0
- package/dist/runtime/templates/components/core/ResourceLoader.spec.ts.snap +39 -0
- package/dist/runtime/templates/components/core/ResourceLoader.vue +151 -0
- package/dist/runtime/templates/components/core/ResourceLoader.vue.d.ts +13 -0
- package/dist/runtime/templates/components/core/admin/ListContainer.vue +7 -0
- package/dist/runtime/templates/components/core/admin/ListContainer.vue.d.ts +12 -0
- package/dist/runtime/templates/components/core/admin/ListContent.vue +136 -0
- package/dist/runtime/templates/components/core/admin/ListContent.vue.d.ts +21 -0
- package/dist/runtime/templates/components/core/admin/ListFilter.vue +49 -0
- package/dist/runtime/templates/components/core/admin/ListFilter.vue.d.ts +9 -0
- package/dist/runtime/templates/components/core/admin/ListFilterButton.vue +53 -0
- package/dist/runtime/templates/components/core/admin/ListFilterButton.vue.d.ts +9 -0
- package/dist/runtime/templates/components/core/admin/ListHeading.vue +32 -0
- package/dist/runtime/templates/components/core/admin/ListHeading.vue.d.ts +20 -0
- package/dist/runtime/templates/components/core/admin/ListPagination.vue +87 -0
- package/dist/runtime/templates/components/core/admin/ListPagination.vue.d.ts +15 -0
- package/dist/runtime/templates/components/core/admin/ListPaginationButton.vue +18 -0
- package/dist/runtime/templates/components/core/admin/ListPaginationButton.vue.d.ts +16 -0
- package/dist/runtime/templates/components/core/admin/PageAdminModal.vue +260 -0
- package/dist/runtime/templates/components/core/admin/PageAdminModal.vue.d.ts +12 -0
- package/dist/runtime/templates/components/core/admin/PageDataAdminModal.vue +187 -0
- package/dist/runtime/templates/components/core/admin/PageDataAdminModal.vue.d.ts +13 -0
- package/dist/runtime/templates/components/core/admin/ResourceModal.vue +99 -0
- package/dist/runtime/templates/components/core/admin/ResourceModal.vue.d.ts +27 -0
- package/dist/runtime/templates/components/core/admin/ResourceModalOverlay.vue +27 -0
- package/dist/runtime/templates/components/core/admin/ResourceModalOverlay.vue.d.ts +6 -0
- package/dist/runtime/templates/components/core/admin/ResourceModalOverlayTemplate.vue +23 -0
- package/dist/runtime/templates/components/core/admin/ResourceModalOverlayTemplate.vue.d.ts +15 -0
- package/dist/runtime/templates/components/core/admin/ResourceModalTabs.vue +77 -0
- package/dist/runtime/templates/components/core/admin/ResourceModalTabs.vue.d.ts +19 -0
- package/dist/runtime/templates/components/core/admin/RouteListRow.vue +102 -0
- package/dist/runtime/templates/components/core/admin/RouteListRow.vue.d.ts +20 -0
- package/dist/runtime/templates/components/core/admin/RouteRedirectsTree.vue +52 -0
- package/dist/runtime/templates/components/core/admin/RouteRedirectsTree.vue.d.ts +10 -0
- package/dist/runtime/templates/components/core/admin/RoutesTab.vue +273 -0
- package/dist/runtime/templates/components/core/admin/RoutesTab.vue.d.ts +12 -0
- package/dist/runtime/templates/components/core/admin/form/FilterFormWrapper.vue +18 -0
- package/dist/runtime/templates/components/core/admin/form/FilterFormWrapper.vue.d.ts +16 -0
- package/dist/runtime/templates/components/core/admin/form/FilterSelect.vue +86 -0
- package/dist/runtime/templates/components/core/admin/form/FilterSelect.vue.d.ts +3 -0
- package/dist/runtime/templates/components/core/admin/form/ModalInfo.vue +23 -0
- package/dist/runtime/templates/components/core/admin/form/ModalInfo.vue.d.ts +16 -0
- package/dist/runtime/templates/components/core/admin/form/ModalInput.vue +30 -0
- package/dist/runtime/templates/components/core/admin/form/ModalInput.vue.d.ts +15 -0
- package/dist/runtime/templates/components/core/admin/form/ModalSelect.vue +99 -0
- package/dist/runtime/templates/components/core/admin/form/ModalSelect.vue.d.ts +6 -0
- package/dist/runtime/templates/components/core/admin/form/PageTypeSelect.vue +112 -0
- package/dist/runtime/templates/components/core/admin/form/PageTypeSelect.vue.d.ts +4 -0
- package/dist/runtime/templates/components/core/assets/CwaLogo.vue +21 -0
- package/dist/runtime/templates/components/core/assets/CwaLogo.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/assets/IconComponents.vue +15 -0
- package/dist/runtime/templates/components/core/assets/IconComponents.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/assets/IconData.vue +24 -0
- package/dist/runtime/templates/components/core/assets/IconData.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/assets/IconLayouts.vue +20 -0
- package/dist/runtime/templates/components/core/assets/IconLayouts.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/assets/IconPages.vue +21 -0
- package/dist/runtime/templates/components/core/assets/IconPages.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/assets/IconRoutes.vue +23 -0
- package/dist/runtime/templates/components/core/assets/IconRoutes.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/assets/IconUsers.vue +13 -0
- package/dist/runtime/templates/components/core/assets/IconUsers.vue.d.ts +2 -0
- package/dist/runtime/templates/components/core/useDataResolver.d.ts +12 -0
- package/dist/runtime/templates/components/core/useDataResolver.js +109 -0
- package/dist/runtime/templates/components/main/ComponentGroup.Util.Positions.d.ts +6 -0
- package/dist/runtime/templates/components/main/ComponentGroup.Util.Positions.js +164 -0
- package/dist/runtime/templates/components/main/ComponentGroup.Util.Synchronizer.d.ts +20 -0
- package/dist/runtime/templates/components/main/ComponentGroup.Util.Synchronizer.js +69 -0
- package/dist/runtime/templates/components/main/ComponentGroup.spec.ts.snap +59 -0
- package/dist/runtime/templates/components/main/ComponentGroup.vue +107 -0
- package/dist/runtime/templates/components/main/ComponentGroup.vue.d.ts +9 -0
- package/dist/runtime/templates/components/main/CwaLink.vue +51 -0
- package/dist/runtime/templates/components/main/CwaLink.vue.d.ts +14 -0
- package/dist/runtime/templates/components/main/DefaultLayout.vue +8 -0
- package/dist/runtime/templates/components/main/DefaultLayout.vue.d.ts +12 -0
- package/dist/runtime/templates/components/main/ErrorPage.vue +98 -0
- package/dist/runtime/templates/components/main/ErrorPage.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/Logo.vue +18 -0
- package/dist/runtime/templates/components/main/Logo.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/README.md +7 -0
- package/dist/runtime/templates/components/main/admin/_common/ResourceContextItem.vue +41 -0
- package/dist/runtime/templates/components/main/admin/_common/ResourceContextItem.vue.d.ts +7 -0
- package/dist/runtime/templates/components/main/admin/_common/ResourceLoadingIndicator.vue +48 -0
- package/dist/runtime/templates/components/main/admin/_common/ResourceLoadingIndicator.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/_common/useDynamicPositionSelectOptions.d.ts +5 -0
- package/dist/runtime/templates/components/main/admin/_common/useDynamicPositionSelectOptions.js +19 -0
- package/dist/runtime/templates/components/main/admin/header/Header.vue +207 -0
- package/dist/runtime/templates/components/main/admin/header/Header.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/Menu.vue +189 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/Menu.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/MenuLink.vue +14 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/MenuLink.vue.d.ts +16 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/MenuPrimaryLink.vue +19 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/MenuPrimaryLink.vue.d.ts +15 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/Notification.vue +69 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/Notification.vue.d.ts +12 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/OutdatedContentNotice.vue +19 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/OutdatedContentNotice.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/PathSelector.vue +79 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/PathSelector.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/RequestErrors.vue +52 -0
- package/dist/runtime/templates/components/main/admin/header/_parts/RequestErrors.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/ComponentFocus.vue +151 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/ComponentFocus.vue.d.ts +10 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/LayoutPageOverlay.vue +192 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/LayoutPageOverlay.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/ResourceManager.vue +186 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/ResourceManager.vue.d.ts +9 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/AddComponentDialog.vue +205 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/AddComponentDialog.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/CwaResourceManagerContextMenu.vue +38 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/CwaResourceManagerContextMenu.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/ManagerTab.vue +15 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/ManagerTab.vue.d.ts +7 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/ManagerTabs.vue +44 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_parts/ManagerTabs.vue.d.ts +13 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/ResourceInfoTab.vue +59 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/ResourceInfoTab.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Order.vue +75 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Order.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Publish.vue +41 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Publish.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Ui.vue +101 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/component/Ui.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/group/Group.vue +34 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/group/Group.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/position/DataPage.vue +121 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/position/DataPage.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/position/DynamicPage.vue +52 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/_tabs/position/DynamicPage.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/cta/CurrentResourceCta.vue +99 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/cta/CurrentResourceCta.vue.d.ts +7 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/cta/NewResourceCta.vue +59 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/cta/NewResourceCta.vue.d.ts +7 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/cta/ResourceManagerCtaButton.vue +28 -0
- package/dist/runtime/templates/components/main/admin/resource-manager/cta/ResourceManagerCtaButton.vue.d.ts +2 -0
- package/dist/runtime/templates/components/main/auth/ForgotPasswordPage.vue +55 -0
- package/dist/runtime/templates/components/main/auth/ForgotPasswordPage.vue.d.ts +20 -0
- package/dist/runtime/templates/components/main/auth/LoginPage.vue +60 -0
- package/dist/runtime/templates/components/main/auth/LoginPage.vue.d.ts +23 -0
- package/dist/runtime/templates/components/main/auth/ResetPasswordPage.vue +59 -0
- package/dist/runtime/templates/components/main/auth/ResetPasswordPage.vue.d.ts +27 -0
- package/dist/runtime/templates/components/main/auth/_parts/AuthPageLink.spec.ts.snap +14 -0
- package/dist/runtime/templates/components/main/auth/_parts/AuthPageLink.vue +17 -0
- package/dist/runtime/templates/components/main/auth/_parts/AuthPageLink.vue.d.ts +6 -0
- package/dist/runtime/templates/components/main/auth/_parts/AuthTemplate.spec.ts.snap +90 -0
- package/dist/runtime/templates/components/main/auth/_parts/AuthTemplate.vue +45 -0
- package/dist/runtime/templates/components/main/auth/_parts/AuthTemplate.vue.d.ts +17 -0
- package/dist/runtime/templates/components/main/auth/_parts/InputField.spec.ts.snap +111 -0
- package/dist/runtime/templates/components/main/auth/_parts/InputField.vue +50 -0
- package/dist/runtime/templates/components/main/auth/_parts/InputField.vue.d.ts +17 -0
- package/dist/runtime/templates/components/ui/BackgroundParticles.vue +960 -0
- package/dist/runtime/templates/components/ui/BackgroundParticles.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/Hamburger.vue +75 -0
- package/dist/runtime/templates/components/ui/Hamburger.vue.d.ts +9 -0
- package/dist/runtime/templates/components/ui/ProgressBar.spec.ts.snap +71 -0
- package/dist/runtime/templates/components/ui/ProgressBar.vue +29 -0
- package/dist/runtime/templates/components/ui/ProgressBar.vue.d.ts +9 -0
- package/dist/runtime/templates/components/ui/README.md +6 -0
- package/dist/runtime/templates/components/ui/alert/Info.spec.ts.snap +23 -0
- package/dist/runtime/templates/components/ui/alert/Info.vue +13 -0
- package/dist/runtime/templates/components/ui/alert/Info.vue.d.ts +12 -0
- package/dist/runtime/templates/components/ui/alert/Warning.spec.ts.snap +14 -0
- package/dist/runtime/templates/components/ui/alert/Warning.vue +8 -0
- package/dist/runtime/templates/components/ui/alert/Warning.vue.d.ts +12 -0
- package/dist/runtime/templates/components/ui/form/Button.vue +139 -0
- package/dist/runtime/templates/components/ui/form/Button.vue.d.ts +52 -0
- package/dist/runtime/templates/components/ui/form/ButtonPopoverGroup.vue +18 -0
- package/dist/runtime/templates/components/ui/form/ButtonPopoverGroup.vue.d.ts +10 -0
- package/dist/runtime/templates/components/ui/form/ButtonPopoverItem.vue +15 -0
- package/dist/runtime/templates/components/ui/form/ButtonPopoverItem.vue.d.ts +10 -0
- package/dist/runtime/templates/components/ui/form/File.vue +72 -0
- package/dist/runtime/templates/components/ui/form/File.vue.d.ts +9 -0
- package/dist/runtime/templates/components/ui/form/Input.vue +22 -0
- package/dist/runtime/templates/components/ui/form/Input.vue.d.ts +5 -0
- package/dist/runtime/templates/components/ui/form/LabelWrapper.vue +16 -0
- package/dist/runtime/templates/components/ui/form/LabelWrapper.vue.d.ts +15 -0
- package/dist/runtime/templates/components/ui/form/SearchResource.vue +212 -0
- package/dist/runtime/templates/components/ui/form/SearchResource.vue.d.ts +14 -0
- package/dist/runtime/templates/components/ui/form/Select.vue +60 -0
- package/dist/runtime/templates/components/ui/form/Select.vue.d.ts +3 -0
- package/dist/runtime/templates/components/ui/form/Toggle.vue +39 -0
- package/dist/runtime/templates/components/ui/form/Toggle.vue.d.ts +6 -0
- package/dist/runtime/templates/components/ui/icon/ArrowIcon.vue +30 -0
- package/dist/runtime/templates/components/ui/icon/ArrowIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/BinIcon.vue +24 -0
- package/dist/runtime/templates/components/ui/icon/BinIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/CogIcon.vue +9 -0
- package/dist/runtime/templates/components/ui/icon/CogIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/EyeIcon.vue +24 -0
- package/dist/runtime/templates/components/ui/icon/EyeIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/PenIcon.vue +12 -0
- package/dist/runtime/templates/components/ui/icon/PenIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/PlusIcon.vue +9 -0
- package/dist/runtime/templates/components/ui/icon/PlusIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/SearchIcon.vue +10 -0
- package/dist/runtime/templates/components/ui/icon/SearchIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/TickIcon.vue +23 -0
- package/dist/runtime/templates/components/ui/icon/TickIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/WarningIcon.vue +11 -0
- package/dist/runtime/templates/components/ui/icon/WarningIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/ui/icon/XMarkIcon.vue +15 -0
- package/dist/runtime/templates/components/ui/icon/XMarkIcon.vue.d.ts +2 -0
- package/dist/runtime/templates/components/utils/ContextMenu.vue +59 -0
- package/dist/runtime/templates/components/utils/ContextMenu.vue.d.ts +21 -0
- package/dist/runtime/templates/components/utils/HotSpot.vue +24 -0
- package/dist/runtime/templates/components/utils/HotSpot.vue.d.ts +9 -0
- package/dist/runtime/templates/components/utils/README.md +1 -0
- package/dist/runtime/templates/components/utils/Spinner.spec.ts.snap +56 -0
- package/dist/runtime/templates/components/utils/Spinner.vue +42 -0
- package/dist/runtime/templates/components/utils/Spinner.vue.d.ts +5 -0
- package/dist/runtime/templates/components/utils/SpinnerTick.vue +43 -0
- package/dist/runtime/templates/components/utils/SpinnerTick.vue.d.ts +6 -0
- package/dist/runtime/templates/cwa-page.spec.ts.snap +20 -0
- package/dist/runtime/templates/cwa-page.vue +32 -0
- package/dist/runtime/templates/cwa-page.vue.d.ts +2 -0
- package/dist/runtime/types/popper.d.ts +14 -0
- package/dist/types.d.mts +9 -0
- package/package.json +108 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ComputedRef } from 'vue';
|
|
2
|
+
import type { AuthStore } from '../storage/stores/auth/auth-store.js';
|
|
3
|
+
import { CwaUserRoles } from '../storage/stores/auth/state.js';
|
|
4
|
+
import type { ResourcesStore } from '../storage/stores/resources/resources-store.js';
|
|
5
|
+
import type { FetcherStore } from '../storage/stores/fetcher/fetcher-store.js';
|
|
6
|
+
import type CwaFetch from './fetcher/cwa-fetch.js';
|
|
7
|
+
import type Mercure from './mercure.js';
|
|
8
|
+
import type Fetcher from './fetcher/fetcher.js';
|
|
9
|
+
import type { CookieRef } from '#app';
|
|
10
|
+
import type Admin from '#cwa/runtime/admin/admin';
|
|
11
|
+
interface Credentials {
|
|
12
|
+
username: string;
|
|
13
|
+
password: string;
|
|
14
|
+
}
|
|
15
|
+
export declare enum CwaAuthStatus {
|
|
16
|
+
SIGNED_OUT = 0,
|
|
17
|
+
LOADING = 1,
|
|
18
|
+
SIGNED_IN = 2
|
|
19
|
+
}
|
|
20
|
+
interface ResetPasswordEvent {
|
|
21
|
+
username: string;
|
|
22
|
+
token: string;
|
|
23
|
+
passwords: {
|
|
24
|
+
first: string;
|
|
25
|
+
second: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export default class Auth {
|
|
29
|
+
private readonly cwaFetch;
|
|
30
|
+
private readonly mercure;
|
|
31
|
+
private readonly fetcher;
|
|
32
|
+
private readonly admin;
|
|
33
|
+
private readonly authStoreDefinition;
|
|
34
|
+
private readonly resourcesStoreDefinition;
|
|
35
|
+
private readonly fetcherStoreDefinition;
|
|
36
|
+
private readonly authCookie;
|
|
37
|
+
private loading;
|
|
38
|
+
private hasCheckedMeEndpointForInit;
|
|
39
|
+
constructor(cwaFetch: CwaFetch, mercure: Mercure, fetcher: Fetcher, admin: Admin, authStoreDefinition: AuthStore, resourcesStoreDefinition: ResourcesStore, fetcherStoreDefinition: FetcherStore, authCookie: CookieRef<string | null>);
|
|
40
|
+
signIn(credentials: Credentials): Promise<any>;
|
|
41
|
+
forgotPassword(username: string): Promise<any>;
|
|
42
|
+
resetPassword(event: ResetPasswordEvent): Promise<any>;
|
|
43
|
+
signOut(): Promise<any>;
|
|
44
|
+
refreshUser(): Promise<any>;
|
|
45
|
+
init(): Promise<void>;
|
|
46
|
+
get user(): {
|
|
47
|
+
[x: string]: any;
|
|
48
|
+
emailAddress: string;
|
|
49
|
+
enabled: boolean;
|
|
50
|
+
roles: (string | CwaUserRoles)[];
|
|
51
|
+
username: string;
|
|
52
|
+
'@id': string;
|
|
53
|
+
'@type': string;
|
|
54
|
+
publishedResource?: string | undefined;
|
|
55
|
+
draftResource?: string | undefined;
|
|
56
|
+
uiComponent?: string | undefined;
|
|
57
|
+
sortValue?: number | undefined;
|
|
58
|
+
componentGroup?: string | undefined;
|
|
59
|
+
_metadata: {
|
|
60
|
+
[x: string]: any;
|
|
61
|
+
adding?: {
|
|
62
|
+
instantAdd: boolean;
|
|
63
|
+
endpoint: string;
|
|
64
|
+
isPublishable: boolean;
|
|
65
|
+
} | undefined;
|
|
66
|
+
persisted: boolean;
|
|
67
|
+
publishable?: {
|
|
68
|
+
published: boolean;
|
|
69
|
+
publishedAt: string;
|
|
70
|
+
} | undefined;
|
|
71
|
+
sortDisplayNumber?: number | undefined;
|
|
72
|
+
};
|
|
73
|
+
} | undefined;
|
|
74
|
+
get roles(): string[] | undefined;
|
|
75
|
+
get signedIn(): ComputedRef<boolean>;
|
|
76
|
+
hasRole(role: CwaUserRoles | string): boolean;
|
|
77
|
+
get isAdmin(): ComputedRef<boolean>;
|
|
78
|
+
private loginRequest;
|
|
79
|
+
get status(): ComputedRef<CwaAuthStatus>;
|
|
80
|
+
private clearSession;
|
|
81
|
+
private get authStore();
|
|
82
|
+
private get resourcesStore();
|
|
83
|
+
private get fetcherStore();
|
|
84
|
+
}
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { FetchError } from "ofetch";
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
|
+
import { CwaUserRoles } from "../storage/stores/auth/state.js";
|
|
4
|
+
import { useNuxtApp, useRoute, useRouter } from "#app";
|
|
5
|
+
export var CwaAuthStatus = /* @__PURE__ */ ((CwaAuthStatus2) => {
|
|
6
|
+
CwaAuthStatus2[CwaAuthStatus2["SIGNED_OUT"] = 0] = "SIGNED_OUT";
|
|
7
|
+
CwaAuthStatus2[CwaAuthStatus2["LOADING"] = 1] = "LOADING";
|
|
8
|
+
CwaAuthStatus2[CwaAuthStatus2["SIGNED_IN"] = 2] = "SIGNED_IN";
|
|
9
|
+
return CwaAuthStatus2;
|
|
10
|
+
})(CwaAuthStatus || {});
|
|
11
|
+
export default class Auth {
|
|
12
|
+
constructor(cwaFetch, mercure, fetcher, admin, authStoreDefinition, resourcesStoreDefinition, fetcherStoreDefinition, authCookie) {
|
|
13
|
+
this.cwaFetch = cwaFetch;
|
|
14
|
+
this.mercure = mercure;
|
|
15
|
+
this.fetcher = fetcher;
|
|
16
|
+
this.admin = admin;
|
|
17
|
+
this.authStoreDefinition = authStoreDefinition;
|
|
18
|
+
this.resourcesStoreDefinition = resourcesStoreDefinition;
|
|
19
|
+
this.fetcherStoreDefinition = fetcherStoreDefinition;
|
|
20
|
+
this.authCookie = authCookie;
|
|
21
|
+
this.loading = ref(false);
|
|
22
|
+
}
|
|
23
|
+
loading;
|
|
24
|
+
hasCheckedMeEndpointForInit = false;
|
|
25
|
+
async signIn(credentials) {
|
|
26
|
+
const result = await this.loginRequest(credentials);
|
|
27
|
+
if (result instanceof FetchError) {
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
this.mercure.init(true);
|
|
31
|
+
return this.refreshUser();
|
|
32
|
+
}
|
|
33
|
+
async forgotPassword(username) {
|
|
34
|
+
try {
|
|
35
|
+
return await this.cwaFetch.fetch(`/password/reset/request/${encodeURIComponent(
|
|
36
|
+
username
|
|
37
|
+
)}`);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
if (!(error instanceof FetchError)) {
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
return error;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async resetPassword(event) {
|
|
46
|
+
try {
|
|
47
|
+
return await this.cwaFetch.fetch("/component/forms/password_reset/submit", {
|
|
48
|
+
method: "PATCH",
|
|
49
|
+
body: {
|
|
50
|
+
password_update: {
|
|
51
|
+
username: event.username,
|
|
52
|
+
plainNewPasswordConfirmationToken: event.token,
|
|
53
|
+
plainPassword: event.passwords
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
} catch (error) {
|
|
58
|
+
if (!(error instanceof FetchError)) {
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
return error;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async signOut() {
|
|
65
|
+
this.loading.value = true;
|
|
66
|
+
try {
|
|
67
|
+
const result = await this.cwaFetch.fetch("/logout");
|
|
68
|
+
await this.clearSession();
|
|
69
|
+
return result;
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (!(error instanceof FetchError)) {
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
return error;
|
|
75
|
+
} finally {
|
|
76
|
+
this.loading.value = false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async refreshUser() {
|
|
80
|
+
this.loading.value = true;
|
|
81
|
+
try {
|
|
82
|
+
const user = await this.cwaFetch.fetch("/me");
|
|
83
|
+
this.authCookie.value = "1";
|
|
84
|
+
this.authStore.data.user = user;
|
|
85
|
+
return user;
|
|
86
|
+
} catch (error) {
|
|
87
|
+
if (!(error instanceof FetchError)) {
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
await this.clearSession();
|
|
91
|
+
return error;
|
|
92
|
+
} finally {
|
|
93
|
+
this.loading.value = false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
async init() {
|
|
97
|
+
if (!this.hasCheckedMeEndpointForInit || this.signedIn.value && !this.user) {
|
|
98
|
+
this.hasCheckedMeEndpointForInit = true;
|
|
99
|
+
await this.refreshUser();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
get user() {
|
|
103
|
+
return this.authStore.data.user;
|
|
104
|
+
}
|
|
105
|
+
get roles() {
|
|
106
|
+
if (!this.user) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
return this.user.roles;
|
|
110
|
+
}
|
|
111
|
+
get signedIn() {
|
|
112
|
+
return computed(() => this.status.value === 2 /* SIGNED_IN */);
|
|
113
|
+
}
|
|
114
|
+
hasRole(role) {
|
|
115
|
+
if (!this.roles) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return this.roles.includes(role);
|
|
119
|
+
}
|
|
120
|
+
get isAdmin() {
|
|
121
|
+
return computed(() => this.hasRole(CwaUserRoles.ADMIN));
|
|
122
|
+
}
|
|
123
|
+
async loginRequest(credentials) {
|
|
124
|
+
this.loading.value = true;
|
|
125
|
+
try {
|
|
126
|
+
return await this.cwaFetch.fetch("/login", {
|
|
127
|
+
method: "POST",
|
|
128
|
+
body: credentials
|
|
129
|
+
});
|
|
130
|
+
} catch (error) {
|
|
131
|
+
this.loading.value = false;
|
|
132
|
+
if (!(error instanceof FetchError)) {
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
return error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
get status() {
|
|
139
|
+
return computed(() => {
|
|
140
|
+
if (this.loading.value) {
|
|
141
|
+
return 1 /* LOADING */;
|
|
142
|
+
}
|
|
143
|
+
return `${this.authCookie.value}` === "1" ? 2 /* SIGNED_IN */ : 0 /* SIGNED_OUT */;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
async clearSession() {
|
|
147
|
+
this.authStore.data.user = void 0;
|
|
148
|
+
this.authCookie.value = "0";
|
|
149
|
+
this.admin.toggleEdit(false);
|
|
150
|
+
const isProcessingMiddleware = () => {
|
|
151
|
+
try {
|
|
152
|
+
if (useNuxtApp()._processingMiddleware) {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
} catch {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
return false;
|
|
159
|
+
};
|
|
160
|
+
if (isProcessingMiddleware()) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
this.mercure.init(true);
|
|
164
|
+
this.resourcesStore.clearResources();
|
|
165
|
+
this.fetcherStore.clearFetches();
|
|
166
|
+
const route = useRoute();
|
|
167
|
+
if (route.meta.cwa?.admin) {
|
|
168
|
+
const router = useRouter();
|
|
169
|
+
router.replace("/");
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
await this.fetcher.fetchRoute(route);
|
|
173
|
+
}
|
|
174
|
+
get authStore() {
|
|
175
|
+
return this.authStoreDefinition.useStore();
|
|
176
|
+
}
|
|
177
|
+
get resourcesStore() {
|
|
178
|
+
return this.resourcesStoreDefinition.useStore();
|
|
179
|
+
}
|
|
180
|
+
get fetcherStore() {
|
|
181
|
+
return this.fetcherStoreDefinition.useStore();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { $fetch } from "ofetch";
|
|
2
|
+
import { useRequestHeaders } from "#imports";
|
|
3
|
+
export default class CwaFetch {
|
|
4
|
+
fetch;
|
|
5
|
+
constructor(baseURL) {
|
|
6
|
+
this.fetch = $fetch.create({
|
|
7
|
+
baseURL,
|
|
8
|
+
headers: {
|
|
9
|
+
accept: "application/ld+json,application/json"
|
|
10
|
+
},
|
|
11
|
+
credentials: "include",
|
|
12
|
+
onRequest(ctx) {
|
|
13
|
+
if (import.meta.server) {
|
|
14
|
+
const { cookie } = useRequestHeaders(["cookie"]);
|
|
15
|
+
cookie && ctx.options.headers.append("cookie", cookie);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type Mercure from '../mercure.js';
|
|
2
|
+
import type ApiDocumentation from '../api-documentation.js';
|
|
3
|
+
import type { FetcherStore } from '../../storage/stores/fetcher/fetcher-store.js';
|
|
4
|
+
import type { AddFetchResourceEvent, FinishFetchEvent, ManifestErrorFetchEvent, ManifestSuccessFetchEvent, StartFetchEvent, StartFetchResponse } from '../../storage/stores/fetcher/actions.js';
|
|
5
|
+
import type { ResourcesStore } from '../../storage/stores/resources/resources-store.js';
|
|
6
|
+
import type { CwaResourceError } from '../../errors/cwa-resource-error.js';
|
|
7
|
+
import type { CwaResource } from '../../resources/resource-utils.js';
|
|
8
|
+
import type { CwaFetchRequestHeaders, CwaFetchResponse } from './fetcher.js';
|
|
9
|
+
export interface FinishFetchResourceEvent {
|
|
10
|
+
resource: string;
|
|
11
|
+
success: boolean;
|
|
12
|
+
token: string;
|
|
13
|
+
}
|
|
14
|
+
export interface FinishFetchResourceSuccessEvent extends FinishFetchResourceEvent {
|
|
15
|
+
success: true;
|
|
16
|
+
fetchResponse: CwaFetchResponse | any;
|
|
17
|
+
headers: CwaFetchRequestHeaders;
|
|
18
|
+
noSave?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface FinishFetchResourceErrorEvent extends FinishFetchResourceEvent {
|
|
21
|
+
success: false;
|
|
22
|
+
error?: CwaResourceError;
|
|
23
|
+
}
|
|
24
|
+
type _StartFetchEvent = Omit<StartFetchEvent, 'isCurrentSuccessResourcesResolved'>;
|
|
25
|
+
/**
|
|
26
|
+
* This class manages the state across the fetcher store, resources store and additional services for API Documentation and Mercure
|
|
27
|
+
*/
|
|
28
|
+
export default class FetchStatusManager {
|
|
29
|
+
private fetcherStoreDefinition;
|
|
30
|
+
private readonly mercure;
|
|
31
|
+
private readonly apiDocumentation;
|
|
32
|
+
private resourcesStoreDefinition;
|
|
33
|
+
constructor(fetcherStoreDefinition: FetcherStore, mercure: Mercure, apiDocumentation: ApiDocumentation, resourcesStoreDefinition: ResourcesStore);
|
|
34
|
+
getFetchedCurrentResource(iri: string, timeout?: number): Promise<CwaResource | undefined>;
|
|
35
|
+
startFetch(event: _StartFetchEvent): StartFetchResponse;
|
|
36
|
+
startFetchResource(event: AddFetchResourceEvent): boolean;
|
|
37
|
+
finishFetchResource(event: FinishFetchResourceSuccessEvent | FinishFetchResourceErrorEvent): CwaResource | undefined;
|
|
38
|
+
finishFetch(event: FinishFetchEvent): Promise<void>;
|
|
39
|
+
private finishFetchShowError;
|
|
40
|
+
private computedFetchChainComplete;
|
|
41
|
+
private waitForFetchChainToComplete;
|
|
42
|
+
finishManifestFetch(event: ManifestSuccessFetchEvent | ManifestErrorFetchEvent): void;
|
|
43
|
+
isCurrentFetchingToken(token: string): boolean | undefined;
|
|
44
|
+
abortFetch(token: string): void;
|
|
45
|
+
clearPrimaryFetch(): void;
|
|
46
|
+
get primaryFetchPath(): string | undefined;
|
|
47
|
+
get isCurrentSuccessResourcesResolved(): boolean;
|
|
48
|
+
private get fetcherStore();
|
|
49
|
+
private get resourcesStore();
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { computed, watch, watchEffect } from "vue";
|
|
2
|
+
import { consola as logger } from "consola";
|
|
3
|
+
import { storeToRefs } from "pinia";
|
|
4
|
+
import { createCwaResourceError } from "../../errors/cwa-resource-error.js";
|
|
5
|
+
import { isCwaResource } from "../../resources/resource-utils.js";
|
|
6
|
+
import { CwaResourceApiStatuses } from "../../storage/stores/resources/state.js";
|
|
7
|
+
import { clearError, useError } from "#app";
|
|
8
|
+
export default class FetchStatusManager {
|
|
9
|
+
fetcherStoreDefinition;
|
|
10
|
+
mercure;
|
|
11
|
+
apiDocumentation;
|
|
12
|
+
resourcesStoreDefinition;
|
|
13
|
+
constructor(fetcherStoreDefinition, mercure, apiDocumentation, resourcesStoreDefinition) {
|
|
14
|
+
this.fetcherStoreDefinition = fetcherStoreDefinition;
|
|
15
|
+
this.mercure = mercure;
|
|
16
|
+
this.apiDocumentation = apiDocumentation;
|
|
17
|
+
this.resourcesStoreDefinition = resourcesStoreDefinition;
|
|
18
|
+
}
|
|
19
|
+
async getFetchedCurrentResource(iri, timeout) {
|
|
20
|
+
const { current: { value: { byId: currentById } } } = storeToRefs(this.resourcesStore);
|
|
21
|
+
const currentResource = currentById[iri];
|
|
22
|
+
if (!currentResource) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
timeout = timeout || 1e4;
|
|
26
|
+
let stopWatch;
|
|
27
|
+
const getResolvedResource = new Promise((resolve) => {
|
|
28
|
+
const tooLongTimeout = setTimeout(() => {
|
|
29
|
+
logger.warn(`Timed out ${timeout}ms waiting to fetch current resource '${iri}' in pending API state.`);
|
|
30
|
+
resolve(void 0);
|
|
31
|
+
}, timeout);
|
|
32
|
+
stopWatch = watchEffect(() => {
|
|
33
|
+
if (currentResource.apiState.status !== CwaResourceApiStatuses.IN_PROGRESS) {
|
|
34
|
+
clearTimeout(tooLongTimeout);
|
|
35
|
+
resolve(currentResource.data);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
const resolvedResource = await getResolvedResource;
|
|
40
|
+
stopWatch();
|
|
41
|
+
return resolvedResource || currentResource.data;
|
|
42
|
+
}
|
|
43
|
+
startFetch(event) {
|
|
44
|
+
const startFetchStatus = this.fetcherStore.startFetch({ ...event, isCurrentSuccessResourcesResolved: this.isCurrentSuccessResourcesResolved });
|
|
45
|
+
if (event.isPrimary) {
|
|
46
|
+
this.resourcesStore.resetCurrentResources(startFetchStatus.resources);
|
|
47
|
+
}
|
|
48
|
+
return startFetchStatus;
|
|
49
|
+
}
|
|
50
|
+
startFetchResource(event) {
|
|
51
|
+
const addedToFetcherResources = this.fetcherStore.addFetchResource(event);
|
|
52
|
+
if (addedToFetcherResources) {
|
|
53
|
+
this.resourcesStore.setResourceFetchStatus({ iri: event.resource, isComplete: false });
|
|
54
|
+
}
|
|
55
|
+
return addedToFetcherResources;
|
|
56
|
+
}
|
|
57
|
+
finishFetchResource(event) {
|
|
58
|
+
if (this.resourcesStore.current.byId?.[event.resource]?.apiState.status === CwaResourceApiStatuses.SUCCESS) {
|
|
59
|
+
return this.resourcesStore.current.byId?.[event.resource].data;
|
|
60
|
+
}
|
|
61
|
+
const isCurrent = this.fetcherStore.isCurrentFetchingToken(event.token);
|
|
62
|
+
const fetchStatus = this.fetcherStore.fetches[event.token];
|
|
63
|
+
if (fetchStatus?.abort) {
|
|
64
|
+
this.resourcesStore.setResourceFetchError({
|
|
65
|
+
iri: event.resource,
|
|
66
|
+
error: createCwaResourceError(new Error(`Not Saved. Fetching token '${event.token}' has been aborted.`)),
|
|
67
|
+
isCurrent
|
|
68
|
+
});
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (!isCurrent) {
|
|
72
|
+
this.resourcesStore.setResourceFetchError({
|
|
73
|
+
iri: event.resource,
|
|
74
|
+
error: createCwaResourceError(new Error(`Not Saved. Fetching token '${event.token}' is no longer current.`)),
|
|
75
|
+
isCurrent
|
|
76
|
+
});
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const showErrorPage = this.finishFetchShowError(fetchStatus, event.resource);
|
|
80
|
+
const setFinalResourceFetchError = (error) => {
|
|
81
|
+
this.resourcesStore.setResourceFetchError({
|
|
82
|
+
iri: event.resource,
|
|
83
|
+
error,
|
|
84
|
+
isCurrent,
|
|
85
|
+
showErrorPage
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
if (!event.success) {
|
|
89
|
+
setFinalResourceFetchError(event.error);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const cwaResource = event.fetchResponse._data;
|
|
93
|
+
if (!isCwaResource(cwaResource)) {
|
|
94
|
+
const error = createCwaResourceError(new Error(`Not Saved. The response was not a valid CWA Resource. (${event.resource})`));
|
|
95
|
+
setFinalResourceFetchError(error);
|
|
96
|
+
logger.error("[CWA FETCH ERROR]", event.resource, cwaResource);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (this.finishFetchShowError(fetchStatus, event.resource)) {
|
|
100
|
+
const currentError = useError();
|
|
101
|
+
if (currentError.value?.error) clearError();
|
|
102
|
+
}
|
|
103
|
+
const linkHeader = event.fetchResponse.headers.get("link");
|
|
104
|
+
if (linkHeader) {
|
|
105
|
+
this.mercure.setMercureHubFromLinkHeader(linkHeader);
|
|
106
|
+
this.apiDocumentation.setDocsPathFromLinkHeader(linkHeader);
|
|
107
|
+
}
|
|
108
|
+
if (!event.noSave) {
|
|
109
|
+
this.resourcesStore.saveResource({
|
|
110
|
+
resource: cwaResource
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
this.resourcesStore.setResourceFetchStatus({ iri: event.resource, isComplete: true, headers: event.headers });
|
|
114
|
+
return cwaResource;
|
|
115
|
+
}
|
|
116
|
+
async finishFetch(event) {
|
|
117
|
+
await this.waitForFetchChainToComplete(event.token);
|
|
118
|
+
this.fetcherStore.finishFetch(event);
|
|
119
|
+
}
|
|
120
|
+
finishFetchShowError(fetchStatus, eventResource) {
|
|
121
|
+
return !!fetchStatus?.isPrimary && fetchStatus?.path === eventResource;
|
|
122
|
+
}
|
|
123
|
+
computedFetchChainComplete(token) {
|
|
124
|
+
return computed(() => {
|
|
125
|
+
const resolvingResponse = this.fetcherStore.isFetchResolving(token);
|
|
126
|
+
if (resolvingResponse.resolving) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
if (resolvingResponse.fetchStatus?.abort) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
const resources = resolvingResponse.fetchStatus?.resources;
|
|
133
|
+
if (!resources) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
return !this.resourcesStore.resourcesApiStateIsPending(resources);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async waitForFetchChainToComplete(token) {
|
|
140
|
+
let fetchChainCompletePromiseResolver;
|
|
141
|
+
const fetchChainCompletePromise = new Promise((resolve) => {
|
|
142
|
+
fetchChainCompletePromiseResolver = resolve;
|
|
143
|
+
});
|
|
144
|
+
const computedFetchChainComplete = this.computedFetchChainComplete(token);
|
|
145
|
+
const callback = (isFetchChainComplete) => {
|
|
146
|
+
if (isFetchChainComplete === true) {
|
|
147
|
+
fetchChainCompletePromiseResolver();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const stopWatch = watch(computedFetchChainComplete, callback, {
|
|
151
|
+
immediate: true
|
|
152
|
+
});
|
|
153
|
+
await fetchChainCompletePromise;
|
|
154
|
+
stopWatch();
|
|
155
|
+
}
|
|
156
|
+
finishManifestFetch(event) {
|
|
157
|
+
this.fetcherStore.finishManifestFetch(event);
|
|
158
|
+
}
|
|
159
|
+
isCurrentFetchingToken(token) {
|
|
160
|
+
return this.fetcherStore.isCurrentFetchingToken(token);
|
|
161
|
+
}
|
|
162
|
+
abortFetch(token) {
|
|
163
|
+
return this.fetcherStore.abortFetch({ token });
|
|
164
|
+
}
|
|
165
|
+
// todo: test
|
|
166
|
+
clearPrimaryFetch() {
|
|
167
|
+
this.fetcherStore.primaryFetch.successToken = void 0;
|
|
168
|
+
}
|
|
169
|
+
get primaryFetchPath() {
|
|
170
|
+
return this.fetcherStore.primaryFetchPath;
|
|
171
|
+
}
|
|
172
|
+
get isCurrentSuccessResourcesResolved() {
|
|
173
|
+
const successFetchStatus = this.fetcherStore.resolvedSuccessFetchStatus;
|
|
174
|
+
if (!successFetchStatus) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
return this.resourcesStore.isFetchStatusResourcesResolved(successFetchStatus);
|
|
178
|
+
}
|
|
179
|
+
get fetcherStore() {
|
|
180
|
+
return this.fetcherStoreDefinition.useStore();
|
|
181
|
+
}
|
|
182
|
+
get resourcesStore() {
|
|
183
|
+
return this.resourcesStoreDefinition.useStore();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { RouteLocationNormalizedLoaded } from 'vue-router';
|
|
2
|
+
import type { FetchResponse } from 'ofetch';
|
|
3
|
+
import type { CwaResource } from '../../resources/resource-utils.js';
|
|
4
|
+
import type { ResourcesStore } from '../../storage/stores/resources/resources-store.js';
|
|
5
|
+
import type CwaFetch from './cwa-fetch.js';
|
|
6
|
+
import type FetchStatusManager from './fetch-status-manager.js';
|
|
7
|
+
export interface FetchResourceEvent {
|
|
8
|
+
path: string;
|
|
9
|
+
token?: string;
|
|
10
|
+
manifestPath?: string;
|
|
11
|
+
preload?: string[];
|
|
12
|
+
shallowFetch?: boolean | 'noexist';
|
|
13
|
+
noSave?: boolean;
|
|
14
|
+
isPrimary?: boolean;
|
|
15
|
+
iri?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface FetchManifestEvent {
|
|
18
|
+
manifestPath: string;
|
|
19
|
+
token: string;
|
|
20
|
+
}
|
|
21
|
+
export interface FetchEvent {
|
|
22
|
+
path: string;
|
|
23
|
+
noQuery?: boolean;
|
|
24
|
+
preload?: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface CwaFetchRequestHeaders {
|
|
27
|
+
path?: string;
|
|
28
|
+
preload?: string;
|
|
29
|
+
}
|
|
30
|
+
export type CwaFetchResponse = FetchResponse<CwaResource | undefined>;
|
|
31
|
+
export interface CwaFetchResponseRaw {
|
|
32
|
+
response: Promise<CwaFetchResponse>;
|
|
33
|
+
headers: CwaFetchRequestHeaders;
|
|
34
|
+
}
|
|
35
|
+
interface FetchBatchEvent {
|
|
36
|
+
paths: string[];
|
|
37
|
+
token?: string;
|
|
38
|
+
noSave?: boolean;
|
|
39
|
+
shallowFetch?: boolean | 'noexist';
|
|
40
|
+
}
|
|
41
|
+
export default class Fetcher {
|
|
42
|
+
private readonly cwaFetch;
|
|
43
|
+
private fetchStatusManager;
|
|
44
|
+
private currentRoute;
|
|
45
|
+
private resourcesStoreDefinition;
|
|
46
|
+
constructor(cwaFetch: CwaFetch, fetchStatusManager: FetchStatusManager, currentRoute: RouteLocationNormalizedLoaded, resourcesStoreDefinition: ResourcesStore);
|
|
47
|
+
fetchRoute(route: RouteLocationNormalizedLoaded): Promise<CwaResource | undefined>;
|
|
48
|
+
fetchResource({ path, token, manifestPath, preload, shallowFetch, noSave, isPrimary, iri: userProvidedIri }: FetchResourceEvent): Promise<CwaResource | undefined>;
|
|
49
|
+
private fetchManifest;
|
|
50
|
+
private fetchNestedResources;
|
|
51
|
+
fetchBatch({ paths, token, noSave, shallowFetch }: FetchBatchEvent): Promise<(CwaResource | undefined)[]>;
|
|
52
|
+
fetch(event: FetchEvent): CwaFetchResponseRaw;
|
|
53
|
+
private appendQueryToPath;
|
|
54
|
+
private createRequestHeaders;
|
|
55
|
+
private get resourcesStore();
|
|
56
|
+
}
|
|
57
|
+
export {};
|