strapi-plugin-navigation 2.5.4 → 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -43
- package/admin/api/client.js +107 -0
- package/admin/api/index.js +1 -0
- package/admin/api/validators.js +248 -0
- package/admin/components/ConfirmationDialog/index.js +21 -0
- package/admin/components/Initializer.js +10 -0
- package/admin/components/RestartAlert/index.js +7 -0
- package/admin/components/TextArrayInput/index.js +18 -0
- package/admin/components/icons/index.js +1 -0
- package/admin/components/icons/navigation.js +9 -0
- package/admin/components/icons/pluginIcon.js +9 -0
- package/admin/index.js +48 -0
- package/admin/pages/App.js +10 -0
- package/admin/pages/HomePage/components/AdditionalFieldInput/index.js +58 -0
- package/admin/pages/HomePage/components/CollapseButton/index.js +15 -0
- package/admin/{src → pages/HomePage}/components/DragButton/index.js +9 -16
- package/admin/pages/HomePage/components/I18nCopyNavigationItems/index.js +9 -0
- package/admin/pages/HomePage/components/NavigationContentHeader/index.js +5 -0
- package/admin/pages/HomePage/components/NavigationHeader/hooks.js +14 -0
- package/admin/pages/HomePage/components/NavigationHeader/index.js +29 -0
- package/admin/pages/HomePage/components/NavigationHeader/styles.js +11 -0
- package/admin/pages/HomePage/components/NavigationItemForm/index.js +277 -0
- package/admin/pages/HomePage/components/NavigationItemForm/types.js +1 -0
- package/admin/pages/HomePage/components/NavigationItemForm/utils/form.js +105 -0
- package/admin/pages/HomePage/components/NavigationItemForm/utils/hooks.js +12 -0
- package/admin/pages/HomePage/components/NavigationItemForm/utils/properties.js +51 -0
- package/admin/pages/HomePage/components/NavigationItemList/Wrapper.js +21 -0
- package/admin/pages/HomePage/components/NavigationItemList/index.js +6 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/ItemCardBadge/index.js +20 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/ItemCardHeader/Wrapper.js +14 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/ItemCardHeader/icons.js +6 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/ItemCardHeader/index.js +19 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/ItemCardRemovedOverlay/index.js +11 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/Wrapper.js +38 -0
- package/admin/pages/HomePage/components/NavigationItemListItem/index.js +165 -0
- package/admin/pages/HomePage/components/NavigationItemPopup/NavigationItemPopupFooter.js +11 -0
- package/admin/pages/HomePage/components/NavigationItemPopup/NavigationItemPopupHeader.js +12 -0
- package/admin/pages/HomePage/components/NavigationItemPopup/index.js +34 -0
- package/admin/pages/HomePage/components/NavigationManager/AllNavigations/icons.js +5 -0
- package/admin/pages/HomePage/components/NavigationManager/AllNavigations/index.js +79 -0
- package/admin/pages/HomePage/components/NavigationManager/DeletionConfirm/index.js +25 -0
- package/admin/pages/HomePage/components/NavigationManager/ErrorDetails/index.js +29 -0
- package/admin/pages/HomePage/components/NavigationManager/Footer/index.js +6 -0
- package/admin/pages/HomePage/components/NavigationManager/Form/hooks.js +19 -0
- package/admin/pages/HomePage/components/NavigationManager/Form/index.js +26 -0
- package/admin/pages/HomePage/components/NavigationManager/NavigationUpdate/index.js +32 -0
- package/admin/pages/HomePage/components/NavigationManager/NewNavigation/index.js +35 -0
- package/admin/pages/HomePage/components/NavigationManager/PurgeCacheConfirm/index.js +25 -0
- package/admin/pages/HomePage/components/NavigationManager/index.js +236 -0
- package/admin/pages/HomePage/components/NavigationManager/types.js +1 -0
- package/admin/pages/HomePage/components/Search/index.js +58 -0
- package/admin/pages/HomePage/components/index.js +1 -0
- package/admin/pages/HomePage/hooks/index.js +165 -0
- package/admin/pages/HomePage/index.js +231 -0
- package/admin/pages/HomePage/utils/index.js +16 -0
- package/admin/pages/HomePage/utils/parsers.js +187 -0
- package/admin/pages/SettingsPage/common/const.js +1 -0
- package/admin/pages/SettingsPage/common/index.js +1 -0
- package/admin/pages/SettingsPage/components/CustomFieldForm/hooks/index.js +10 -0
- package/admin/pages/SettingsPage/components/CustomFieldForm/index.js +36 -0
- package/admin/pages/SettingsPage/components/CustomFieldModal/index.js +16 -0
- package/admin/pages/SettingsPage/components/CustomFieldTable/index.js +45 -0
- package/admin/pages/SettingsPage/hooks/index.js +111 -0
- package/admin/pages/SettingsPage/index.js +189 -0
- package/admin/pages/SettingsPage/types.js +1 -0
- package/admin/pages/SettingsPage/utils/index.js +25 -0
- package/admin/pluginId.js +1 -0
- package/admin/schemas/config.js +53 -0
- package/admin/schemas/content-type.js +14 -0
- package/admin/schemas/index.js +2 -0
- package/admin/{src/translations → translations}/en.json +7 -9
- package/admin/translations/index.js +15 -0
- package/admin/types.js +1 -0
- package/admin/utils/constants.js +1 -0
- package/admin/utils/getTranslation.js +4 -0
- package/admin/utils/permissions.js +16 -0
- package/admin/utils/prefixPluginTranslations.js +3 -0
- package/package.json +13 -11
- package/server/app-errors.js +20 -0
- package/server/bootstrap.js +13 -0
- package/server/cache/index.js +34 -15
- package/server/config/index.js +7 -5
- package/server/config/{setupStrategy.js → setup.js} +30 -26
- package/server/content-types/audience/index.js +0 -1
- package/server/content-types/audience/schema.js +0 -1
- package/server/content-types/index.js +4 -7
- package/server/content-types/navigation/index.js +0 -1
- package/server/content-types/navigation/lifecycles.js +1 -2
- package/server/content-types/navigation/schema.js +29 -32
- package/server/content-types/navigation-item/index.js +0 -1
- package/server/content-types/navigation-item/lifecycles.js +1 -2
- package/server/content-types/navigation-item/schema.js +51 -58
- package/server/controllers/admin.js +119 -158
- package/server/controllers/client.js +71 -60
- package/server/controllers/index.js +1 -3
- package/server/controllers/utils.js +22 -0
- package/{admin/src/hooks/useNavigationManager.js → server/controllers/validators.js} +23 -16
- package/server/destroy.js +3 -2
- package/{types/i18n.js → server/dtos/config.js} +0 -1
- package/server/{navigation → dtos}/index.js +3 -2
- package/server/dtos/navigation-item.js +2 -0
- package/{admin/src/pages/SettingsPage/types.js → server/dtos/navigation.js} +0 -1
- package/server/graphql/config.js +14 -16
- package/server/graphql/index.js +1 -2
- package/server/graphql/queries/index.js +8 -4
- package/server/graphql/queries/render-navigation-child.js +19 -8
- package/server/graphql/queries/render-navigation.js +30 -14
- package/server/graphql/resolvers-config.js +4 -2
- package/server/graphql/{setupStrategy.js → setup.js} +4 -5
- package/server/graphql/types/content-types-name-fields.js +10 -9
- package/server/graphql/types/content-types.js +15 -15
- package/server/graphql/types/create-navigation-item.js +16 -16
- package/server/graphql/types/create-navigation-related.js +7 -7
- package/server/graphql/types/create-navigation.js +6 -6
- package/server/graphql/types/index.js +35 -15
- package/server/graphql/types/navigation-config.js +8 -8
- package/server/graphql/types/navigation-details.js +2 -2
- package/server/graphql/types/navigation-item-additional-field-media.js +10 -10
- package/server/graphql/types/navigation-item-related-data.js +6 -6
- package/server/graphql/types/navigation-item-related.js +3 -3
- package/server/graphql/types/navigation-item.js +30 -27
- package/server/graphql/types/navigation-render-type.js +4 -5
- package/server/graphql/types/navigation.js +8 -8
- package/server/i18n/index.js +29 -20
- package/server/index.js +15 -8
- package/server/middlewares/index.js +3 -0
- package/server/permissions/index.js +10 -0
- package/{permissions.js → server/permissions/permissions.js} +0 -1
- package/server/permissions/setup.js +32 -0
- package/server/permissions.js +39 -0
- package/server/policies/index.js +3 -0
- package/server/register.js +6 -0
- package/server/repositories/audience.js +12 -0
- package/server/repositories/generic.js +20 -0
- package/server/repositories/index.js +11 -0
- package/server/repositories/navigation-item.js +51 -0
- package/server/repositories/navigation.js +65 -0
- package/server/routes/admin.js +86 -79
- package/server/routes/client.js +0 -1
- package/server/routes/index.js +0 -1
- package/server/schemas/config.js +68 -0
- package/server/schemas/content-type.js +140 -0
- package/{admin/src/pages/SettingsPage/common → server/schemas}/index.js +3 -2
- package/server/schemas/navigation.js +107 -0
- package/server/services/admin/admin.js +483 -0
- package/server/{content-types/navigations-items-related → services/admin}/index.js +2 -5
- package/{admin/src/pages/View/components/NavigationItemForm → server/services/admin}/types.js +0 -1
- package/server/services/admin/utils.js +84 -0
- package/server/services/client/client.js +397 -0
- package/server/services/client/index.js +7 -0
- package/{admin/src/pages/View/components/NavigationManager → server/services/client}/types.js +0 -1
- package/server/services/client/utils.js +88 -0
- package/server/services/common/common.js +307 -0
- package/server/services/common/index.js +7 -0
- package/{admin/src/components/AdditionalFieldInput → server/services/common}/types.js +0 -1
- package/server/services/common/utils.js +24 -0
- package/server/services/index.js +4 -6
- package/server/types.js +2 -0
- package/server/utils/constants.js +35 -0
- package/server/utils/functions.js +71 -299
- package/server/utils/index.js +1 -2
- package/strapi-admin.js +5 -8
- package/strapi-server.js +3 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/admin/src/components/AdditionalFieldInput/index.d.ts +0 -5
- package/admin/src/components/AdditionalFieldInput/index.js +0 -99
- package/admin/src/components/AdditionalFieldInput/types.d.ts +0 -15
- package/admin/src/components/Alert/styles.d.ts +0 -2
- package/admin/src/components/Alert/styles.js +0 -14
- package/admin/src/components/CollapseButton/index.d.ts +0 -7
- package/admin/src/components/CollapseButton/index.js +0 -30
- package/admin/src/components/ConfirmationDialog/index.d.ts +0 -28
- package/admin/src/components/ConfirmationDialog/index.js +0 -34
- package/admin/src/components/DragButton/index.d.ts +0 -6
- package/admin/src/components/EmptyView/index.d.ts +0 -3
- package/admin/src/components/EmptyView/index.js +0 -30
- package/admin/src/components/Item/ItemCardBadge/index.d.ts +0 -3
- package/admin/src/components/Item/ItemCardBadge/index.js +0 -26
- package/admin/src/components/Item/ItemCardHeader/Wrapper.d.ts +0 -3
- package/admin/src/components/Item/ItemCardHeader/Wrapper.js +0 -21
- package/admin/src/components/Item/ItemCardHeader/icons.d.ts +0 -5
- package/admin/src/components/Item/ItemCardHeader/icons.js +0 -13
- package/admin/src/components/Item/ItemCardHeader/index.d.ts +0 -17
- package/admin/src/components/Item/ItemCardHeader/index.js +0 -38
- package/admin/src/components/Item/ItemCardRemovedOverlay/index.d.ts +0 -2
- package/admin/src/components/Item/ItemCardRemovedOverlay/index.js +0 -18
- package/admin/src/components/Item/Wrapper.d.ts +0 -3
- package/admin/src/components/Item/Wrapper.js +0 -43
- package/admin/src/components/Item/index.d.ts +0 -31
- package/admin/src/components/Item/index.js +0 -188
- package/admin/src/components/NavigationItemList/Wrapper.d.ts +0 -3
- package/admin/src/components/NavigationItemList/Wrapper.js +0 -26
- package/admin/src/components/NavigationItemList/index.d.ts +0 -36
- package/admin/src/components/NavigationItemList/index.js +0 -32
- package/admin/src/components/RestartAlert/index.d.ts +0 -3
- package/admin/src/components/RestartAlert/index.js +0 -13
- package/admin/src/components/Search/index.d.ts +0 -12
- package/admin/src/components/Search/index.js +0 -97
- package/admin/src/components/TextArrayInput/index.d.ts +0 -15
- package/admin/src/components/TextArrayInput/index.js +0 -45
- package/admin/src/components/icons/navigation.d.ts +0 -6
- package/admin/src/components/icons/navigation.js +0 -12
- package/admin/src/contexts/DataManagerContext.d.ts +0 -3
- package/admin/src/contexts/DataManagerContext.js +0 -6
- package/admin/src/hooks/useAllContentTypes.d.ts +0 -3
- package/admin/src/hooks/useAllContentTypes.js +0 -8
- package/admin/src/hooks/useDataManager.d.ts +0 -3
- package/admin/src/hooks/useDataManager.js +0 -10
- package/admin/src/hooks/useI18nCopyNavigationItemsModal.d.ts +0 -9
- package/admin/src/hooks/useI18nCopyNavigationItemsModal.js +0 -51
- package/admin/src/hooks/useNavigationConfig.d.ts +0 -10
- package/admin/src/hooks/useNavigationConfig.js +0 -54
- package/admin/src/hooks/useNavigationManager.d.ts +0 -6
- package/admin/src/index.d.ts +0 -14
- package/admin/src/index.js +0 -87
- package/admin/src/pages/App/index.d.ts +0 -3
- package/admin/src/pages/App/index.js +0 -43
- package/admin/src/pages/DataManagerProvider/actions.d.ts +0 -21
- package/admin/src/pages/DataManagerProvider/actions.js +0 -24
- package/admin/src/pages/DataManagerProvider/index.d.ts +0 -12
- package/admin/src/pages/DataManagerProvider/index.js +0 -382
- package/admin/src/pages/DataManagerProvider/init.d.ts +0 -3
- package/admin/src/pages/DataManagerProvider/init.js +0 -7
- package/admin/src/pages/DataManagerProvider/reducer.d.ts +0 -20
- package/admin/src/pages/DataManagerProvider/reducer.js +0 -132
- package/admin/src/pages/NoAccessPage/index.d.ts +0 -3
- package/admin/src/pages/NoAccessPage/index.js +0 -31
- package/admin/src/pages/SettingsPage/common/const.d.ts +0 -2
- package/admin/src/pages/SettingsPage/common/const.js +0 -5
- package/admin/src/pages/SettingsPage/common/index.d.ts +0 -2
- package/admin/src/pages/SettingsPage/components/CustomFieldForm/index.d.ts +0 -12
- package/admin/src/pages/SettingsPage/components/CustomFieldForm/index.js +0 -129
- package/admin/src/pages/SettingsPage/components/CustomFieldModal/index.d.ts +0 -12
- package/admin/src/pages/SettingsPage/components/CustomFieldModal/index.js +0 -20
- package/admin/src/pages/SettingsPage/components/CustomFieldTable/index.d.ts +0 -11
- package/admin/src/pages/SettingsPage/components/CustomFieldTable/index.js +0 -105
- package/admin/src/pages/SettingsPage/components/DisableI18nModal/index.d.ts +0 -23
- package/admin/src/pages/SettingsPage/components/DisableI18nModal/index.js +0 -86
- package/admin/src/pages/SettingsPage/index.d.ts +0 -3
- package/admin/src/pages/SettingsPage/index.js +0 -321
- package/admin/src/pages/SettingsPage/types.d.ts +0 -35
- package/admin/src/pages/SettingsPage/utils/form.d.ts +0 -20
- package/admin/src/pages/SettingsPage/utils/form.js +0 -37
- package/admin/src/pages/SettingsPage/utils/functions.d.ts +0 -3
- package/admin/src/pages/SettingsPage/utils/functions.js +0 -26
- package/admin/src/pages/View/components/I18nCopyNavigationItems/index.d.ts +0 -14
- package/admin/src/pages/View/components/I18nCopyNavigationItems/index.js +0 -15
- package/admin/src/pages/View/components/NavigationContentHeader/index.d.ts +0 -6
- package/admin/src/pages/View/components/NavigationContentHeader/index.js +0 -14
- package/admin/src/pages/View/components/NavigationHeader/index.d.ts +0 -14
- package/admin/src/pages/View/components/NavigationHeader/index.js +0 -92
- package/admin/src/pages/View/components/NavigationHeader/styles.d.ts +0 -2
- package/admin/src/pages/View/components/NavigationHeader/styles.js +0 -18
- package/admin/src/pages/View/components/NavigationItemForm/index.d.ts +0 -5
- package/admin/src/pages/View/components/NavigationItemForm/index.js +0 -470
- package/admin/src/pages/View/components/NavigationItemForm/types.d.ts +0 -99
- package/admin/src/pages/View/components/NavigationItemForm/utils/form.d.ts +0 -28
- package/admin/src/pages/View/components/NavigationItemForm/utils/form.js +0 -123
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupFooter.d.ts +0 -25
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupFooter.js +0 -31
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupHeader.d.ts +0 -5
- package/admin/src/pages/View/components/NavigationItemPopup/NavigationItemPopupHeader.js +0 -20
- package/admin/src/pages/View/components/NavigationItemPopup/index.d.ts +0 -33
- package/admin/src/pages/View/components/NavigationItemPopup/index.js +0 -90
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/icons.d.ts +0 -4
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/icons.js +0 -12
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/index.d.ts +0 -8
- package/admin/src/pages/View/components/NavigationManager/AllNavigations/index.js +0 -151
- package/admin/src/pages/View/components/NavigationManager/DeletionConfirm/index.d.ts +0 -8
- package/admin/src/pages/View/components/NavigationManager/DeletionConfirm/index.js +0 -34
- package/admin/src/pages/View/components/NavigationManager/ErrorDetails/index.d.ts +0 -8
- package/admin/src/pages/View/components/NavigationManager/ErrorDetails/index.js +0 -53
- package/admin/src/pages/View/components/NavigationManager/Footer/index.d.ts +0 -24
- package/admin/src/pages/View/components/NavigationManager/Footer/index.js +0 -13
- package/admin/src/pages/View/components/NavigationManager/Form/index.d.ts +0 -19
- package/admin/src/pages/View/components/NavigationManager/Form/index.js +0 -103
- package/admin/src/pages/View/components/NavigationManager/NavigationUpdate/index.d.ts +0 -8
- package/admin/src/pages/View/components/NavigationManager/NavigationUpdate/index.js +0 -59
- package/admin/src/pages/View/components/NavigationManager/NewNavigation/index.d.ts +0 -9
- package/admin/src/pages/View/components/NavigationManager/NewNavigation/index.js +0 -62
- package/admin/src/pages/View/components/NavigationManager/PurgeCacheConfirm/index.d.ts +0 -8
- package/admin/src/pages/View/components/NavigationManager/PurgeCacheConfirm/index.js +0 -34
- package/admin/src/pages/View/components/NavigationManager/index.d.ts +0 -10
- package/admin/src/pages/View/components/NavigationManager/index.js +0 -203
- package/admin/src/pages/View/components/NavigationManager/types.d.ts +0 -44
- package/admin/src/pages/View/index.d.ts +0 -4
- package/admin/src/pages/View/index.js +0 -269
- package/admin/src/pages/View/utils/form.d.ts +0 -2
- package/admin/src/pages/View/utils/form.js +0 -16
- package/admin/src/pages/View/utils/index.d.ts +0 -2
- package/admin/src/pages/View/utils/index.js +0 -11
- package/admin/src/pages/View/utils/parsers.d.ts +0 -51
- package/admin/src/pages/View/utils/parsers.js +0 -272
- package/admin/src/pages/View/utils/types.d.ts +0 -3
- package/admin/src/pages/View/utils/types.js +0 -3
- package/admin/src/permissions.d.ts +0 -16
- package/admin/src/permissions.js +0 -13
- package/admin/src/pluginId.d.ts +0 -3
- package/admin/src/pluginId.js +0 -5
- package/admin/src/translations/index.d.ts +0 -15
- package/admin/src/translations/index.js +0 -21
- package/admin/src/utils/api.d.ts +0 -9
- package/admin/src/utils/api.js +0 -20
- package/admin/src/utils/enums.d.ts +0 -25
- package/admin/src/utils/enums.js +0 -30
- package/admin/src/utils/functions.d.ts +0 -16
- package/admin/src/utils/functions.js +0 -46
- package/admin/src/utils/index.d.ts +0 -4
- package/admin/src/utils/index.js +0 -20
- package/permissions.d.ts +0 -10
- package/server/bootstrap/index.d.ts +0 -4
- package/server/bootstrap/index.js +0 -50
- package/server/cache/index.d.ts +0 -2
- package/server/cache/serviceEnhancers.d.ts +0 -3
- package/server/cache/serviceEnhancers.js +0 -16
- package/server/cache/setupStrategy.d.ts +0 -3
- package/server/cache/setupStrategy.js +0 -38
- package/server/cache/types.d.ts +0 -11
- package/server/cache/types.js +0 -3
- package/server/cache/utils.d.ts +0 -11
- package/server/cache/utils.js +0 -19
- package/server/config/index.d.ts +0 -5
- package/server/config/setupStrategy.d.ts +0 -3
- package/server/content-types/audience/index.d.ts +0 -27
- package/server/content-types/audience/schema.d.ts +0 -25
- package/server/content-types/index.d.ts +0 -244
- package/server/content-types/navigation/index.d.ts +0 -59
- package/server/content-types/navigation/lifecycles.d.ts +0 -3
- package/server/content-types/navigation/schema.d.ts +0 -56
- package/server/content-types/navigation-item/index.d.ts +0 -111
- package/server/content-types/navigation-item/lifecycles.d.ts +0 -3
- package/server/content-types/navigation-item/schema.d.ts +0 -108
- package/server/content-types/navigations-items-related/index.d.ts +0 -51
- package/server/content-types/navigations-items-related/schema.d.ts +0 -49
- package/server/content-types/navigations-items-related/schema.js +0 -50
- package/server/controllers/admin.d.ts +0 -4
- package/server/controllers/client.d.ts +0 -4
- package/server/controllers/index.d.ts +0 -4
- package/server/destroy.d.ts +0 -3
- package/server/graphql/config.d.ts +0 -4
- package/server/graphql/index.d.ts +0 -2
- package/server/graphql/queries/index.d.ts +0 -3
- package/server/graphql/queries/render-navigation-child.d.ts +0 -15
- package/server/graphql/queries/render-navigation.d.ts +0 -21
- package/server/graphql/resolvers-config.d.ts +0 -10
- package/server/graphql/setupStrategy.d.ts +0 -3
- package/server/graphql/types/content-types-name-fields.d.ts +0 -6
- package/server/graphql/types/content-types.d.ts +0 -5
- package/server/graphql/types/create-navigation-item.d.ts +0 -5
- package/server/graphql/types/create-navigation-related.d.ts +0 -5
- package/server/graphql/types/create-navigation.d.ts +0 -5
- package/server/graphql/types/index.d.ts +0 -3
- package/server/graphql/types/navigation-config.d.ts +0 -5
- package/server/graphql/types/navigation-details.d.ts +0 -5
- package/server/graphql/types/navigation-item-additional-field-media.d.ts +0 -5
- package/server/graphql/types/navigation-item-related-data.d.ts +0 -5
- package/server/graphql/types/navigation-item-related.d.ts +0 -7
- package/server/graphql/types/navigation-item.d.ts +0 -6
- package/server/graphql/types/navigation-render-type.d.ts +0 -5
- package/server/graphql/types/navigation.d.ts +0 -5
- package/server/i18n/constant.d.ts +0 -2
- package/server/i18n/constant.js +0 -5
- package/server/i18n/errors.d.ts +0 -7
- package/server/i18n/errors.js +0 -14
- package/server/i18n/graphQLEnhancers.d.ts +0 -10
- package/server/i18n/graphQLEnhancers.js +0 -10
- package/server/i18n/index.d.ts +0 -8
- package/server/i18n/navigationSetupStrategy.d.ts +0 -3
- package/server/i18n/navigationSetupStrategy.js +0 -147
- package/server/i18n/serviceEnhancers.d.ts +0 -13
- package/server/i18n/serviceEnhancers.js +0 -156
- package/server/i18n/types.d.ts +0 -60
- package/server/i18n/types.js +0 -3
- package/server/i18n/utils.d.ts +0 -13
- package/server/i18n/utils.js +0 -33
- package/server/index.d.ts +0 -262
- package/server/navigation/index.d.ts +0 -2
- package/server/navigation/setupStrategy.d.ts +0 -3
- package/server/navigation/setupStrategy.js +0 -39
- package/server/register/index.d.ts +0 -3
- package/server/register/index.js +0 -4
- package/server/routes/admin.d.ts +0 -4
- package/server/routes/client.d.ts +0 -4
- package/server/routes/index.d.ts +0 -6
- package/server/services/admin.d.ts +0 -5
- package/server/services/admin.js +0 -347
- package/server/services/client.d.ts +0 -5
- package/server/services/client.js +0 -335
- package/server/services/common.d.ts +0 -5
- package/server/services/common.js +0 -385
- package/server/services/index.d.ts +0 -7
- package/server/utils/constant.d.ts +0 -27
- package/server/utils/constant.js +0 -43
- package/server/utils/functions.d.ts +0 -157
- package/server/utils/index.d.ts +0 -3
- package/strapi-admin.d.ts +0 -3
- package/strapi-server.d.ts +0 -262
- package/types/bootstrap.d.ts +0 -16
- package/types/bootstrap.js +0 -3
- package/types/config.d.ts +0 -27
- package/types/config.js +0 -3
- package/types/contentTypes.d.ts +0 -112
- package/types/contentTypes.js +0 -3
- package/types/controllers.d.ts +0 -65
- package/types/controllers.js +0 -5
- package/types/graphQL.d.ts +0 -3
- package/types/graphQL.js +0 -3
- package/types/i18n.d.ts +0 -9
- package/types/index.d.ts +0 -10
- package/types/index.js +0 -26
- package/types/lifecycle.d.ts +0 -22
- package/types/lifecycle.js +0 -3
- package/types/services.d.ts +0 -106
- package/types/services.js +0 -3
- package/types/utils.d.ts +0 -72
- package/types/utils.js +0 -41
- package/utils/InvalidParamNavigationError.d.ts +0 -4
- package/utils/InvalidParamNavigationError.js +0 -8
- package/utils/NavigationError.d.ts +0 -5
- package/utils/NavigationError.js +0 -11
- /package/admin/{src/translations → translations}/ca.json +0 -0
- /package/admin/{src/translations → translations}/fr.json +0 -0
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = {
|
|
4
|
-
collectionName: "navigations_items_related",
|
|
5
|
-
info: {
|
|
6
|
-
singularName: "navigations-items-related",
|
|
7
|
-
pluralName: "navigations-items-relateds",
|
|
8
|
-
displayName: "Navigations Items Related",
|
|
9
|
-
name: "navigations_items_related"
|
|
10
|
-
},
|
|
11
|
-
options: {
|
|
12
|
-
increments: true,
|
|
13
|
-
timestamps: false,
|
|
14
|
-
populateCreatorFields: false
|
|
15
|
-
},
|
|
16
|
-
pluginOptions: {
|
|
17
|
-
"content-manager": {
|
|
18
|
-
visible: false
|
|
19
|
-
},
|
|
20
|
-
"content-type-builder": {
|
|
21
|
-
visible: false
|
|
22
|
-
},
|
|
23
|
-
i18n: {
|
|
24
|
-
localized: false
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
attributes: {
|
|
28
|
-
related_id: {
|
|
29
|
-
type: "string",
|
|
30
|
-
required: true
|
|
31
|
-
},
|
|
32
|
-
related_type: {
|
|
33
|
-
type: "string",
|
|
34
|
-
required: true
|
|
35
|
-
},
|
|
36
|
-
field: {
|
|
37
|
-
type: "string",
|
|
38
|
-
required: true
|
|
39
|
-
},
|
|
40
|
-
order: {
|
|
41
|
-
type: "integer",
|
|
42
|
-
required: true
|
|
43
|
-
},
|
|
44
|
-
master: {
|
|
45
|
-
type: "string",
|
|
46
|
-
required: true
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=schema.js.map
|
package/server/destroy.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
declare function _exports({ strapi, nexus }: {
|
|
2
|
-
strapi: any;
|
|
3
|
-
nexus: any;
|
|
4
|
-
}): {
|
|
5
|
-
type: any;
|
|
6
|
-
args: {
|
|
7
|
-
id: any;
|
|
8
|
-
childUiKey: any;
|
|
9
|
-
type: string;
|
|
10
|
-
menuOnly: any;
|
|
11
|
-
};
|
|
12
|
-
resolve(obj: any, args: any): Promise<any>;
|
|
13
|
-
};
|
|
14
|
-
export = _exports;
|
|
15
|
-
//# sourceMappingURL=render-navigation-child.d.ts.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
declare function _exports({ strapi, nexus }: {
|
|
2
|
-
strapi: any;
|
|
3
|
-
nexus: any;
|
|
4
|
-
}): {
|
|
5
|
-
args: {
|
|
6
|
-
navigationIdOrSlug: any;
|
|
7
|
-
type: string;
|
|
8
|
-
menuOnly: any;
|
|
9
|
-
path: any;
|
|
10
|
-
};
|
|
11
|
-
type: any;
|
|
12
|
-
resolve(obj: any, { navigationIdOrSlug: idOrSlug, type, menuOnly, path: rootPath, locale }: {
|
|
13
|
-
navigationIdOrSlug: any;
|
|
14
|
-
type: any;
|
|
15
|
-
menuOnly: any;
|
|
16
|
-
path: any;
|
|
17
|
-
locale: any;
|
|
18
|
-
}): Promise<any>;
|
|
19
|
-
};
|
|
20
|
-
export = _exports;
|
|
21
|
-
//# sourceMappingURL=render-navigation.d.ts.map
|
package/server/i18n/constant.js
DELETED
package/server/i18n/errors.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { NavigationError } from "../../utils/NavigationError";
|
|
2
|
-
export declare class DefaultLocaleMissingError extends NavigationError {
|
|
3
|
-
constructor(message?: string);
|
|
4
|
-
}
|
|
5
|
-
export declare class FillNavigationError extends NavigationError {
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/server/i18n/errors.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FillNavigationError = exports.DefaultLocaleMissingError = void 0;
|
|
4
|
-
const NavigationError_1 = require("../../utils/NavigationError");
|
|
5
|
-
class DefaultLocaleMissingError extends NavigationError_1.NavigationError {
|
|
6
|
-
constructor(message = "Default locale is required.") {
|
|
7
|
-
super(message);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.DefaultLocaleMissingError = DefaultLocaleMissingError;
|
|
11
|
-
class FillNavigationError extends NavigationError_1.NavigationError {
|
|
12
|
-
}
|
|
13
|
-
exports.FillNavigationError = FillNavigationError;
|
|
14
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Nexus } from "../../types";
|
|
2
|
-
type RenderNavigationArgsEnhancer<T> = {
|
|
3
|
-
previousArgs: T;
|
|
4
|
-
nexus: Nexus;
|
|
5
|
-
};
|
|
6
|
-
export declare const addI18NRenderNavigationArgs: <T>({ previousArgs, nexus, }: RenderNavigationArgsEnhancer<T>) => T & {
|
|
7
|
-
locale: any;
|
|
8
|
-
};
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=graphQLEnhancers.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addI18NRenderNavigationArgs = void 0;
|
|
4
|
-
const LOCALE_SCALAR_TYPENAME = 'I18NLocaleCode';
|
|
5
|
-
const addI18NRenderNavigationArgs = ({ previousArgs, nexus, }) => ({
|
|
6
|
-
...previousArgs,
|
|
7
|
-
locale: nexus.arg({ type: LOCALE_SCALAR_TYPENAME }),
|
|
8
|
-
});
|
|
9
|
-
exports.addI18NRenderNavigationArgs = addI18NRenderNavigationArgs;
|
|
10
|
-
//# sourceMappingURL=graphQLEnhancers.js.map
|
package/server/i18n/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from "./constant";
|
|
2
|
-
export * from "./graphQLEnhancers";
|
|
3
|
-
export * from "./navigationSetupStrategy";
|
|
4
|
-
export * from "./serviceEnhancers";
|
|
5
|
-
export * from "./utils";
|
|
6
|
-
export * from "./errors";
|
|
7
|
-
export { I18NConfigFields } from "./types";
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.i18nNavigationSetupStrategy = void 0;
|
|
4
|
-
const types_1 = require("../../types");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const errors_1 = require("./errors");
|
|
7
|
-
const fp_1 = require("lodash/fp");
|
|
8
|
-
const i18nNavigationSetupStrategy = async ({ strapi, }) => {
|
|
9
|
-
const pluginStore = strapi.store({
|
|
10
|
-
type: "plugin",
|
|
11
|
-
name: "navigation",
|
|
12
|
-
});
|
|
13
|
-
const config = await pluginStore.get({
|
|
14
|
-
key: "config",
|
|
15
|
-
});
|
|
16
|
-
let currentNavigations = await getCurrentNavigations(strapi);
|
|
17
|
-
const localeService = strapi.plugin("i18n").service("locales");
|
|
18
|
-
const defaultLocale = await localeService.getDefaultLocale();
|
|
19
|
-
const allLocale = (await localeService.find({})).map(({ code }) => code);
|
|
20
|
-
(0, types_1.assertNotEmpty)(defaultLocale, new errors_1.DefaultLocaleMissingError());
|
|
21
|
-
if (config.i18nEnabled) {
|
|
22
|
-
const hasNotAnyLocale = ({ localeCode }) => !localeCode;
|
|
23
|
-
if (currentNavigations.length === 0) {
|
|
24
|
-
currentNavigations = [
|
|
25
|
-
await createDefaultI18nNavigation({ strapi, defaultLocale }),
|
|
26
|
-
];
|
|
27
|
-
}
|
|
28
|
-
const noLocaleNavigations = currentNavigations.filter(hasNotAnyLocale);
|
|
29
|
-
if (noLocaleNavigations.length) {
|
|
30
|
-
await updateNavigations({
|
|
31
|
-
strapi,
|
|
32
|
-
ids: noLocaleNavigations.map((0, fp_1.prop)("id")).reduce((acc, id) => {
|
|
33
|
-
if (id && Number(id)) {
|
|
34
|
-
acc.push(Number(id));
|
|
35
|
-
}
|
|
36
|
-
return acc;
|
|
37
|
-
}, []),
|
|
38
|
-
payload: {
|
|
39
|
-
localeCode: defaultLocale,
|
|
40
|
-
},
|
|
41
|
-
populate: utils_1.DEFAULT_POPULATE,
|
|
42
|
-
});
|
|
43
|
-
currentNavigations = await getCurrentNavigations(strapi);
|
|
44
|
-
}
|
|
45
|
-
const navigationsToProcess = currentNavigations.filter(({ localeCode }) => defaultLocale === localeCode);
|
|
46
|
-
for (const rootNavigation of navigationsToProcess) {
|
|
47
|
-
let localizations = [
|
|
48
|
-
...(rootNavigation.localizations ?? []).map((localization) => (0, types_1.assertEntity)(localization, "Navigation")),
|
|
49
|
-
];
|
|
50
|
-
const connectOrphans = currentNavigations.filter((navigation) => {
|
|
51
|
-
return (navigation.slug.startsWith(rootNavigation.slug) &&
|
|
52
|
-
navigation.id !== rootNavigation.id &&
|
|
53
|
-
!localizations.find(({ id }) => navigation.id === id));
|
|
54
|
-
});
|
|
55
|
-
localizations = localizations
|
|
56
|
-
.concat([rootNavigation])
|
|
57
|
-
.concat(connectOrphans)
|
|
58
|
-
.filter(({ localeCode }) => !!localeCode && allLocale.includes(localeCode));
|
|
59
|
-
const missingLocale = allLocale.filter((locale) => !localizations.some(({ localeCode }) => localeCode === locale));
|
|
60
|
-
if (missingLocale.length) {
|
|
61
|
-
const { ids } = await createNavigations({
|
|
62
|
-
strapi,
|
|
63
|
-
payloads: missingLocale.map((locale) => ({
|
|
64
|
-
localeCode: locale,
|
|
65
|
-
slug: `${rootNavigation.slug}-${locale}`,
|
|
66
|
-
name: rootNavigation.name,
|
|
67
|
-
visible: true,
|
|
68
|
-
})),
|
|
69
|
-
});
|
|
70
|
-
localizations = [...(await getCurrentNavigations(strapi, ids))].concat([
|
|
71
|
-
rootNavigation,
|
|
72
|
-
]);
|
|
73
|
-
}
|
|
74
|
-
for (const current of localizations) {
|
|
75
|
-
await updateNavigation({
|
|
76
|
-
strapi,
|
|
77
|
-
current,
|
|
78
|
-
payload: {
|
|
79
|
-
localizations: localizations.filter((localization) => localization.id !== current.id),
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
if (config.pruneObsoleteI18nNavigations) {
|
|
87
|
-
await deleteNavigations({
|
|
88
|
-
strapi,
|
|
89
|
-
where: { localeCode: { $not: defaultLocale } },
|
|
90
|
-
});
|
|
91
|
-
await pluginStore.set({
|
|
92
|
-
key: "config",
|
|
93
|
-
value: {
|
|
94
|
-
...config,
|
|
95
|
-
pruneObsoleteI18nNavigations: false,
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
const remainingNavigations = await getCurrentNavigations(strapi);
|
|
100
|
-
if (!remainingNavigations.length) {
|
|
101
|
-
await createDefaultI18nNavigation({ strapi, defaultLocale });
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return getCurrentNavigations(strapi);
|
|
105
|
-
};
|
|
106
|
-
exports.i18nNavigationSetupStrategy = i18nNavigationSetupStrategy;
|
|
107
|
-
const getCurrentNavigations = (strapi, ids) => strapi.plugin("navigation").service("admin").get(ids, true);
|
|
108
|
-
const createNavigation = ({ strapi, payload, populate, }) => strapi.query("plugin::navigation.navigation").create({
|
|
109
|
-
data: {
|
|
110
|
-
...payload,
|
|
111
|
-
},
|
|
112
|
-
populate,
|
|
113
|
-
});
|
|
114
|
-
const createNavigations = ({ strapi, payloads, populate, }) => strapi.query("plugin::navigation.navigation").createMany({
|
|
115
|
-
data: payloads,
|
|
116
|
-
populate,
|
|
117
|
-
});
|
|
118
|
-
const updateNavigation = ({ strapi, current, payload, populate, }) => strapi.query("plugin::navigation.navigation").update({
|
|
119
|
-
data: {
|
|
120
|
-
...payload,
|
|
121
|
-
},
|
|
122
|
-
populate,
|
|
123
|
-
where: {
|
|
124
|
-
id: current.id,
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
const updateNavigations = ({ strapi, ids, payload, populate, }) => strapi.query("plugin::navigation.navigation").updateMany({
|
|
128
|
-
data: payload,
|
|
129
|
-
populate,
|
|
130
|
-
where: {
|
|
131
|
-
id: {
|
|
132
|
-
$in: ids,
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
});
|
|
136
|
-
const deleteNavigations = ({ strapi, where, }) => strapi.query("plugin::navigation.navigation").deleteMany({
|
|
137
|
-
where,
|
|
138
|
-
});
|
|
139
|
-
const createDefaultI18nNavigation = ({ strapi, defaultLocale, }) => createNavigation({
|
|
140
|
-
strapi,
|
|
141
|
-
payload: {
|
|
142
|
-
...utils_1.DEFAULT_NAVIGATION_ITEM,
|
|
143
|
-
localeCode: defaultLocale,
|
|
144
|
-
},
|
|
145
|
-
populate: utils_1.DEFAULT_POPULATE,
|
|
146
|
-
});
|
|
147
|
-
//# sourceMappingURL=navigationSetupStrategy.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AddI18NConfigFieldsInput, AddI18nWhereClause, HandleLocaleParamInput, I18nAwareEntityReadHandlerInput, I18NConfigFields, I18nNavigationContentsCopyInput, I18nNavigationItemReadInput } from "./types";
|
|
2
|
-
export declare const addI18NConfigFields: <T>({ previousConfig, strapi, viaSettingsPage, }: AddI18NConfigFieldsInput<T>) => Promise<T & I18NConfigFields>;
|
|
3
|
-
export declare const handleLocaleQueryParam: ({ locale, strapi, }: HandleLocaleParamInput) => Promise<string | undefined>;
|
|
4
|
-
export declare const i18nAwareEntityReadHandler: <T extends {
|
|
5
|
-
localeCode?: string | null | undefined;
|
|
6
|
-
localizations?: T[] | null | undefined;
|
|
7
|
-
}>({ entity, entityUid, localeCode, populate, strapi, whereClause, }: I18nAwareEntityReadHandlerInput<T>) => Promise<T | null | undefined>;
|
|
8
|
-
export declare const addI18nWhereClause: <T>({ modelUid, previousWhere, query, strapi, }: AddI18nWhereClause<T>) => Promise<T & {
|
|
9
|
-
locale?: string | undefined;
|
|
10
|
-
}>;
|
|
11
|
-
export declare const i18nNavigationContentsCopy: ({ target, source, strapi, service, }: I18nNavigationContentsCopyInput) => Promise<void>;
|
|
12
|
-
export declare const i18nNavigationItemRead: ({ target, source, path, strapi }: I18nNavigationItemReadInput) => Promise<Partial<any>>;
|
|
13
|
-
//# sourceMappingURL=serviceEnhancers.d.ts.map
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.i18nNavigationItemRead = exports.i18nNavigationContentsCopy = exports.addI18nWhereClause = exports.i18nAwareEntityReadHandler = exports.handleLocaleQueryParam = exports.addI18NConfigFields = void 0;
|
|
4
|
-
const utils_1 = require("@strapi/utils");
|
|
5
|
-
const lodash_1 = require("lodash");
|
|
6
|
-
const fp_1 = require("lodash/fp");
|
|
7
|
-
const types_1 = require("../../types");
|
|
8
|
-
const InvalidParamNavigationError_1 = require("../../utils/InvalidParamNavigationError");
|
|
9
|
-
const utils_2 = require("../utils");
|
|
10
|
-
const constant_1 = require("./constant");
|
|
11
|
-
const errors_1 = require("./errors");
|
|
12
|
-
const utils_3 = require("./utils");
|
|
13
|
-
const addI18NConfigFields = async ({ previousConfig, strapi, viaSettingsPage = false, }) => {
|
|
14
|
-
const { enabled, hasI18NPlugin, defaultLocale } = await (0, utils_3.getI18nStatus)({
|
|
15
|
-
strapi,
|
|
16
|
-
});
|
|
17
|
-
return {
|
|
18
|
-
...previousConfig,
|
|
19
|
-
defaultLocale,
|
|
20
|
-
i18nEnabled: enabled,
|
|
21
|
-
isI18NPluginEnabled: viaSettingsPage ? hasI18NPlugin : undefined,
|
|
22
|
-
pruneObsoleteI18nNavigations: false,
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
exports.addI18NConfigFields = addI18NConfigFields;
|
|
26
|
-
const handleLocaleQueryParam = async ({ locale, strapi, }) => {
|
|
27
|
-
const { enabled } = await (0, utils_3.getI18nStatus)({ strapi });
|
|
28
|
-
if (locale) {
|
|
29
|
-
return locale;
|
|
30
|
-
}
|
|
31
|
-
const localeService = strapi.plugin("i18n").service("locales");
|
|
32
|
-
const defaultLocale = await localeService.getDefaultLocale();
|
|
33
|
-
(0, types_1.assertNotEmpty)(defaultLocale, new errors_1.DefaultLocaleMissingError());
|
|
34
|
-
return enabled ? defaultLocale : undefined;
|
|
35
|
-
};
|
|
36
|
-
exports.handleLocaleQueryParam = handleLocaleQueryParam;
|
|
37
|
-
const i18nAwareEntityReadHandler = async ({ entity, entityUid, localeCode, populate = [], strapi, whereClause, }) => {
|
|
38
|
-
const { defaultLocale, enabled } = await (0, utils_3.getI18nStatus)({ strapi });
|
|
39
|
-
if (!enabled) {
|
|
40
|
-
return entity;
|
|
41
|
-
}
|
|
42
|
-
if (entity && (!localeCode || entity.localeCode === localeCode)) {
|
|
43
|
-
return entity;
|
|
44
|
-
}
|
|
45
|
-
const locale = localeCode || defaultLocale;
|
|
46
|
-
const rerun = await strapi.query(entityUid).findOne({
|
|
47
|
-
where: whereClause,
|
|
48
|
-
populate: [...populate, ...constant_1.I18N_DEFAULT_POPULATE],
|
|
49
|
-
});
|
|
50
|
-
if (rerun) {
|
|
51
|
-
if (rerun.localeCode === locale) {
|
|
52
|
-
return rerun;
|
|
53
|
-
}
|
|
54
|
-
return rerun.localizations?.find((localization) => localization.localeCode === locale);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
exports.i18nAwareEntityReadHandler = i18nAwareEntityReadHandler;
|
|
58
|
-
const addI18nWhereClause = async ({ modelUid, previousWhere, query, strapi, }) => {
|
|
59
|
-
const { enabled } = await (0, utils_3.getI18nStatus)({ strapi });
|
|
60
|
-
const modelSchema = strapi.getModel(modelUid);
|
|
61
|
-
if (enabled && query.localeCode && modelSchema.attributes.locale) {
|
|
62
|
-
return {
|
|
63
|
-
...previousWhere,
|
|
64
|
-
locale: query.localeCode,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
return previousWhere;
|
|
68
|
-
};
|
|
69
|
-
exports.addI18nWhereClause = addI18nWhereClause;
|
|
70
|
-
const i18nNavigationContentsCopy = async ({ target, source, strapi, service, }) => {
|
|
71
|
-
const sourceItems = source.items ?? [];
|
|
72
|
-
if (target.items?.length) {
|
|
73
|
-
throw new errors_1.FillNavigationError("Current navigation is non-empty");
|
|
74
|
-
}
|
|
75
|
-
if (!target.localeCode) {
|
|
76
|
-
throw new errors_1.FillNavigationError("Current navigation does not have specified locale");
|
|
77
|
-
}
|
|
78
|
-
if (!sourceItems.length) {
|
|
79
|
-
throw new errors_1.FillNavigationError("Source navigation is empty");
|
|
80
|
-
}
|
|
81
|
-
const newItems = await Promise.all(sourceItems.map(processItems({
|
|
82
|
-
master: target,
|
|
83
|
-
localeCode: target.localeCode,
|
|
84
|
-
strapi,
|
|
85
|
-
})));
|
|
86
|
-
await service.createBranch(newItems, target, null, { create: true });
|
|
87
|
-
};
|
|
88
|
-
exports.i18nNavigationContentsCopy = i18nNavigationContentsCopy;
|
|
89
|
-
const i18nNavigationItemRead = async ({ target, source, path, strapi }) => {
|
|
90
|
-
const pickFields = (0, fp_1.pick)(['path', 'related', 'type', 'uiRouterKey', 'title', 'externalPath']);
|
|
91
|
-
const structurePath = path.split('.').map(p => parseInt(p, 10));
|
|
92
|
-
if (!structurePath.some(Number.isNaN) || !structurePath.length) {
|
|
93
|
-
new InvalidParamNavigationError_1.InvalidParamNavigationError("Path is invalid");
|
|
94
|
-
}
|
|
95
|
-
let result = (0, lodash_1.get)(source.items, (0, utils_2.intercalate)("items", structurePath.map(lodash_1.toString)));
|
|
96
|
-
if (!result) {
|
|
97
|
-
throw new utils_1.errors.NotFoundError("Unable to find navigation item");
|
|
98
|
-
}
|
|
99
|
-
let { related } = result;
|
|
100
|
-
if (related) {
|
|
101
|
-
const fullRelated = await strapi.query(related.__contentType).findOne({
|
|
102
|
-
where: {
|
|
103
|
-
id: related.id,
|
|
104
|
-
},
|
|
105
|
-
populate: constant_1.I18N_DEFAULT_POPULATE,
|
|
106
|
-
});
|
|
107
|
-
if (fullRelated.localizations?.length) {
|
|
108
|
-
const localeVersion = fullRelated.localizations.find(({ locale }) => locale === target.localeCode);
|
|
109
|
-
if (localeVersion) {
|
|
110
|
-
related = {
|
|
111
|
-
...localeVersion,
|
|
112
|
-
__contentType: related.__contentType
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return pickFields({
|
|
118
|
-
...result,
|
|
119
|
-
related
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
exports.i18nNavigationItemRead = i18nNavigationItemRead;
|
|
123
|
-
const processItems = (context) => async (item) => ({
|
|
124
|
-
title: item.title,
|
|
125
|
-
path: item.path,
|
|
126
|
-
audience: item.audience,
|
|
127
|
-
type: item.type,
|
|
128
|
-
uiRouterKey: item.uiRouterKey,
|
|
129
|
-
order: item.order,
|
|
130
|
-
collapsed: item.collapsed,
|
|
131
|
-
menuAttached: item.menuAttached,
|
|
132
|
-
removed: false,
|
|
133
|
-
updated: true,
|
|
134
|
-
externalPath: item.externalPath ?? undefined,
|
|
135
|
-
items: item.items
|
|
136
|
-
? await Promise.all(item.items.map(processItems(context)))
|
|
137
|
-
: [],
|
|
138
|
-
master: parseInt(context.master.id.toString(), 10),
|
|
139
|
-
parent: null,
|
|
140
|
-
related: item.related ? [await processRelated(item.related, context)] : [],
|
|
141
|
-
});
|
|
142
|
-
const processRelated = async (related, { localeCode, strapi }) => {
|
|
143
|
-
const { __contentType, id } = related;
|
|
144
|
-
(0, types_1.assertNotEmpty)(__contentType, new errors_1.FillNavigationError("Related item's content type is missing"));
|
|
145
|
-
(0, types_1.assertIsNumber)(id, new errors_1.FillNavigationError("Related item's id is not a number"));
|
|
146
|
-
const relatedItemWithLocalizations = await strapi
|
|
147
|
-
.query(__contentType)
|
|
148
|
-
.findOne({ where: { id }, populate: constant_1.I18N_DEFAULT_POPULATE });
|
|
149
|
-
const localization = relatedItemWithLocalizations.localizations?.find(({ locale }) => locale === localeCode);
|
|
150
|
-
return {
|
|
151
|
-
refId: localization?.id ?? id,
|
|
152
|
-
ref: __contentType,
|
|
153
|
-
field: related.field,
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
//# sourceMappingURL=serviceEnhancers.js.map
|