@strapi/i18n 0.0.0-next.7ff82e00c12aa44d99b20c7b95fe781a4b8d7435 → 0.0.0-next.807d2d1373c0c4b2c9c8a23debef0bf1b6af5fc1
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/dist/admin/components/BulkLocaleActionModal.js +262 -0
- package/dist/admin/components/BulkLocaleActionModal.js.map +1 -0
- package/dist/admin/components/BulkLocaleActionModal.mjs +260 -0
- package/dist/admin/components/BulkLocaleActionModal.mjs.map +1 -0
- package/dist/admin/components/CMHeaderActions.js +968 -0
- package/dist/admin/components/CMHeaderActions.js.map +1 -0
- package/dist/admin/components/CMHeaderActions.mjs +942 -0
- package/dist/admin/components/CMHeaderActions.mjs.map +1 -0
- package/dist/admin/components/CMListViewModalsAdditionalInformation.js +69 -0
- package/dist/admin/components/CMListViewModalsAdditionalInformation.js.map +1 -0
- package/dist/admin/components/CMListViewModalsAdditionalInformation.mjs +65 -0
- package/dist/admin/components/CMListViewModalsAdditionalInformation.mjs.map +1 -0
- package/dist/admin/components/CheckboxConfirmation.js +155 -0
- package/dist/admin/components/CheckboxConfirmation.js.map +1 -0
- package/dist/admin/components/CheckboxConfirmation.mjs +134 -0
- package/dist/admin/components/CheckboxConfirmation.mjs.map +1 -0
- package/dist/admin/components/CreateLocale.js +394 -0
- package/dist/admin/components/CreateLocale.js.map +1 -0
- package/dist/admin/components/CreateLocale.mjs +368 -0
- package/dist/admin/components/CreateLocale.mjs.map +1 -0
- package/dist/admin/components/DeleteLocale.js +90 -0
- package/dist/admin/components/DeleteLocale.js.map +1 -0
- package/dist/admin/components/DeleteLocale.mjs +69 -0
- package/dist/admin/components/DeleteLocale.mjs.map +1 -0
- package/dist/admin/components/EditLocale.js +212 -0
- package/dist/admin/components/EditLocale.js.map +1 -0
- package/dist/admin/components/EditLocale.mjs +190 -0
- package/dist/admin/components/EditLocale.mjs.map +1 -0
- package/dist/admin/components/LocaleListCell.js +102 -0
- package/dist/admin/components/LocaleListCell.js.map +1 -0
- package/dist/admin/components/LocaleListCell.mjs +100 -0
- package/dist/admin/components/LocaleListCell.mjs.map +1 -0
- package/dist/admin/components/LocalePicker.js +105 -0
- package/dist/admin/components/LocalePicker.js.map +1 -0
- package/dist/admin/components/LocalePicker.mjs +84 -0
- package/dist/admin/components/LocalePicker.mjs.map +1 -0
- package/dist/admin/components/LocaleTable.js +143 -0
- package/dist/admin/components/LocaleTable.js.map +1 -0
- package/dist/admin/components/LocaleTable.mjs +122 -0
- package/dist/admin/components/LocaleTable.mjs.map +1 -0
- package/dist/admin/constants.js +37 -0
- package/dist/admin/constants.js.map +1 -0
- package/dist/admin/constants.mjs +35 -0
- package/dist/admin/constants.mjs.map +1 -0
- package/dist/admin/contentManagerHooks/editView.js +109 -0
- package/dist/admin/contentManagerHooks/editView.js.map +1 -0
- package/dist/admin/contentManagerHooks/editView.mjs +88 -0
- package/dist/admin/contentManagerHooks/editView.mjs.map +1 -0
- package/dist/admin/contentManagerHooks/listView.js +44 -0
- package/dist/admin/contentManagerHooks/listView.js.map +1 -0
- package/dist/admin/contentManagerHooks/listView.mjs +42 -0
- package/dist/admin/contentManagerHooks/listView.mjs.map +1 -0
- package/dist/admin/contentReleasesHooks/releaseDetailsView.js +20 -0
- package/dist/admin/contentReleasesHooks/releaseDetailsView.js.map +1 -0
- package/dist/admin/contentReleasesHooks/releaseDetailsView.mjs +18 -0
- package/dist/admin/contentReleasesHooks/releaseDetailsView.mjs.map +1 -0
- package/dist/admin/hooks/useAILocalizationJobsPolling.js +110 -0
- package/dist/admin/hooks/useAILocalizationJobsPolling.js.map +1 -0
- package/dist/admin/hooks/useAILocalizationJobsPolling.mjs +89 -0
- package/dist/admin/hooks/useAILocalizationJobsPolling.mjs.map +1 -0
- package/dist/admin/hooks/useI18n.js +78 -0
- package/dist/admin/hooks/useI18n.js.map +1 -0
- package/dist/admin/hooks/useI18n.mjs +57 -0
- package/dist/admin/hooks/useI18n.mjs.map +1 -0
- package/dist/admin/index.js +226 -5
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +202 -5
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/middlewares/extendCTBAttributeInitialData.js +71 -0
- package/dist/admin/middlewares/extendCTBAttributeInitialData.js.map +1 -0
- package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs +69 -0
- package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs.map +1 -0
- package/dist/admin/middlewares/extendCTBInitialData.js +40 -0
- package/dist/admin/middlewares/extendCTBInitialData.js.map +1 -0
- package/dist/admin/middlewares/extendCTBInitialData.mjs +38 -0
- package/dist/admin/middlewares/extendCTBInitialData.mjs.map +1 -0
- package/dist/admin/middlewares/rbac-middleware.js +49 -0
- package/dist/admin/middlewares/rbac-middleware.js.map +1 -0
- package/dist/admin/middlewares/rbac-middleware.mjs +28 -0
- package/dist/admin/middlewares/rbac-middleware.mjs.map +1 -0
- package/dist/admin/pages/SettingsPage.js +182 -0
- package/dist/admin/pages/SettingsPage.js.map +1 -0
- package/dist/admin/pages/SettingsPage.mjs +179 -0
- package/dist/admin/pages/SettingsPage.mjs.map +1 -0
- package/dist/admin/pluginId.js +6 -0
- package/dist/admin/pluginId.js.map +1 -0
- package/dist/admin/pluginId.mjs +4 -0
- package/dist/admin/pluginId.mjs.map +1 -0
- package/dist/admin/services/aiLocalizationJobs.js +26 -0
- package/dist/admin/services/aiLocalizationJobs.js.map +1 -0
- package/dist/admin/services/aiLocalizationJobs.mjs +24 -0
- package/dist/admin/services/aiLocalizationJobs.mjs.map +1 -0
- package/dist/admin/services/api.js +15 -0
- package/dist/admin/services/api.js.map +1 -0
- package/dist/admin/services/api.mjs +13 -0
- package/dist/admin/services/api.mjs.map +1 -0
- package/dist/admin/services/locales.js +72 -0
- package/dist/admin/services/locales.js.map +1 -0
- package/dist/admin/services/locales.mjs +66 -0
- package/dist/admin/services/locales.mjs.map +1 -0
- package/dist/admin/services/relations.js +23 -0
- package/dist/admin/services/relations.js.map +1 -0
- package/dist/admin/services/relations.mjs +21 -0
- package/dist/admin/services/relations.mjs.map +1 -0
- package/dist/admin/services/settings.js +30 -0
- package/dist/admin/services/settings.js.map +1 -0
- package/dist/admin/services/settings.mjs +27 -0
- package/dist/admin/services/settings.mjs.map +1 -0
- package/dist/admin/src/components/CMHeaderActions.d.ts +18 -5
- package/dist/admin/src/components/LocaleListCell.d.ts +2 -1
- package/dist/admin/src/components/tests/CreateLocale.test.d.ts +1 -0
- package/dist/admin/src/components/tests/DeleteLocale.test.d.ts +1 -0
- package/dist/admin/src/components/tests/EditLocale.test.d.ts +1 -0
- package/dist/admin/src/components/tests/LocaleListCell.test.d.ts +1 -0
- package/dist/admin/src/contentReleasesHooks/releaseDetailsView.d.ts +1 -1
- package/dist/admin/src/hooks/useAILocalizationJobsPolling.d.ts +9 -0
- package/dist/admin/src/pages/tests/SettingsPage.test.d.ts +1 -0
- package/dist/admin/src/services/aiLocalizationJobs.d.ts +6 -0
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/locales.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +1 -1
- package/dist/admin/src/services/settings.d.ts +5 -0
- package/dist/admin/src/utils/schemas.d.ts +642 -16
- package/dist/admin/tests/server.d.ts +1 -0
- package/dist/admin/tests/utils.d.ts +6 -0
- package/dist/admin/translations/de.json.js +66 -0
- package/dist/admin/translations/de.json.js.map +1 -0
- package/dist/admin/translations/de.json.mjs +64 -0
- package/dist/admin/translations/de.json.mjs.map +1 -0
- package/dist/admin/translations/dk.json.js +66 -0
- package/dist/admin/translations/dk.json.js.map +1 -0
- package/dist/admin/translations/dk.json.mjs +64 -0
- package/dist/admin/translations/dk.json.mjs.map +1 -0
- package/dist/admin/translations/en.json.js +91 -0
- package/dist/admin/translations/en.json.js.map +1 -0
- package/dist/admin/translations/en.json.mjs +89 -0
- package/dist/admin/translations/en.json.mjs.map +1 -0
- package/dist/admin/translations/es.json.js +66 -0
- package/dist/admin/translations/es.json.js.map +1 -0
- package/dist/admin/translations/es.json.mjs +64 -0
- package/dist/admin/translations/es.json.mjs.map +1 -0
- package/dist/admin/translations/fr.json.js +66 -0
- package/dist/admin/translations/fr.json.js.map +1 -0
- package/dist/admin/translations/fr.json.mjs +64 -0
- package/dist/admin/translations/fr.json.mjs.map +1 -0
- package/dist/admin/translations/ko.json.js +65 -0
- package/dist/admin/translations/ko.json.js.map +1 -0
- package/dist/admin/translations/ko.json.mjs +63 -0
- package/dist/admin/translations/ko.json.mjs.map +1 -0
- package/dist/admin/translations/pl.json.js +66 -0
- package/dist/admin/translations/pl.json.js.map +1 -0
- package/dist/admin/translations/pl.json.mjs +64 -0
- package/dist/admin/translations/pl.json.mjs.map +1 -0
- package/dist/admin/translations/ru.json.js +68 -0
- package/dist/admin/translations/ru.json.js.map +1 -0
- package/dist/admin/translations/ru.json.mjs +66 -0
- package/dist/admin/translations/ru.json.mjs.map +1 -0
- package/dist/admin/translations/tr.json.js +66 -0
- package/dist/admin/translations/tr.json.js.map +1 -0
- package/dist/admin/translations/tr.json.mjs +64 -0
- package/dist/admin/translations/tr.json.mjs.map +1 -0
- package/dist/admin/translations/uk.json.js +82 -0
- package/dist/admin/translations/uk.json.js.map +1 -0
- package/dist/admin/translations/uk.json.mjs +80 -0
- package/dist/admin/translations/uk.json.mjs.map +1 -0
- package/dist/admin/translations/zh-Hans.json.js +57 -0
- package/dist/admin/translations/zh-Hans.json.js.map +1 -0
- package/dist/admin/translations/zh-Hans.json.mjs +55 -0
- package/dist/admin/translations/zh-Hans.json.mjs.map +1 -0
- package/dist/admin/translations/zh.json.js +66 -0
- package/dist/admin/translations/zh.json.js.map +1 -0
- package/dist/admin/translations/zh.json.mjs +64 -0
- package/dist/admin/translations/zh.json.mjs.map +1 -0
- package/dist/admin/utils/baseQuery.js +8 -0
- package/dist/admin/utils/baseQuery.js.map +1 -0
- package/dist/admin/utils/baseQuery.mjs +6 -0
- package/dist/admin/utils/baseQuery.mjs.map +1 -0
- package/dist/admin/utils/clean.js +70 -0
- package/dist/admin/utils/clean.js.map +1 -0
- package/dist/admin/utils/clean.mjs +68 -0
- package/dist/admin/utils/clean.mjs.map +1 -0
- package/dist/admin/utils/fields.js +34 -0
- package/dist/admin/utils/fields.js.map +1 -0
- package/dist/admin/utils/fields.mjs +31 -0
- package/dist/admin/utils/fields.mjs.map +1 -0
- package/dist/admin/utils/getTranslation.js +8 -0
- package/dist/admin/utils/getTranslation.js.map +1 -0
- package/dist/admin/utils/getTranslation.mjs +6 -0
- package/dist/admin/utils/getTranslation.mjs.map +1 -0
- package/dist/admin/utils/prefixPluginTranslations.js +11 -0
- package/dist/admin/utils/prefixPluginTranslations.js.map +1 -0
- package/dist/admin/utils/prefixPluginTranslations.mjs +9 -0
- package/dist/admin/utils/prefixPluginTranslations.mjs.map +1 -0
- package/dist/admin/utils/schemas.js +74 -0
- package/dist/admin/utils/schemas.js.map +1 -0
- package/dist/admin/utils/schemas.mjs +72 -0
- package/dist/admin/utils/schemas.mjs.map +1 -0
- package/dist/admin/utils/strings.js +6 -0
- package/dist/admin/utils/strings.js.map +1 -0
- package/dist/admin/utils/strings.mjs +4 -0
- package/dist/admin/utils/strings.mjs.map +1 -0
- package/dist/server/bootstrap.js +81 -0
- package/dist/server/bootstrap.js.map +1 -0
- package/dist/server/bootstrap.mjs +79 -0
- package/dist/server/bootstrap.mjs.map +1 -0
- package/dist/server/constants/index.js +29 -0
- package/dist/server/constants/index.js.map +1 -0
- package/dist/server/constants/index.mjs +25 -0
- package/dist/server/constants/index.mjs.map +1 -0
- package/dist/server/constants/iso-locales.json.js +2427 -0
- package/dist/server/constants/iso-locales.json.js.map +1 -0
- package/dist/server/constants/iso-locales.json.mjs +2425 -0
- package/dist/server/constants/iso-locales.json.mjs.map +1 -0
- package/dist/server/content-types/index.js +10 -0
- package/dist/server/content-types/index.js.map +1 -0
- package/dist/server/content-types/index.mjs +8 -0
- package/dist/server/content-types/index.mjs.map +1 -0
- package/dist/server/content-types/locale/index.js +10 -0
- package/dist/server/content-types/locale/index.js.map +1 -0
- package/dist/server/content-types/locale/index.mjs +8 -0
- package/dist/server/content-types/locale/index.mjs.map +1 -0
- package/dist/server/content-types/locale/schema.json.js +46 -0
- package/dist/server/content-types/locale/schema.json.js.map +1 -0
- package/dist/server/content-types/locale/schema.json.mjs +38 -0
- package/dist/server/content-types/locale/schema.json.mjs.map +1 -0
- package/dist/server/controllers/ai-localization-jobs.js +47 -0
- package/dist/server/controllers/ai-localization-jobs.js.map +1 -0
- package/dist/server/controllers/ai-localization-jobs.mjs +45 -0
- package/dist/server/controllers/ai-localization-jobs.mjs.map +1 -0
- package/dist/server/controllers/content-types.js +76 -0
- package/dist/server/controllers/content-types.js.map +1 -0
- package/dist/server/controllers/content-types.mjs +74 -0
- package/dist/server/controllers/content-types.mjs.map +1 -0
- package/dist/server/controllers/index.js +18 -0
- package/dist/server/controllers/index.js.map +1 -0
- package/dist/server/controllers/index.mjs +16 -0
- package/dist/server/controllers/index.mjs.map +1 -0
- package/dist/server/controllers/iso-locales.js +13 -0
- package/dist/server/controllers/iso-locales.js.map +1 -0
- package/dist/server/controllers/iso-locales.mjs +11 -0
- package/dist/server/controllers/iso-locales.mjs.map +1 -0
- package/dist/server/controllers/locales.js +108 -0
- package/dist/server/controllers/locales.js.map +1 -0
- package/dist/server/controllers/locales.mjs +87 -0
- package/dist/server/controllers/locales.mjs.map +1 -0
- package/dist/server/controllers/settings.js +24 -0
- package/dist/server/controllers/settings.js.map +1 -0
- package/dist/server/controllers/settings.mjs +22 -0
- package/dist/server/controllers/settings.mjs.map +1 -0
- package/dist/server/controllers/validate-locale-creation.js +47 -0
- package/dist/server/controllers/validate-locale-creation.js.map +1 -0
- package/dist/server/controllers/validate-locale-creation.mjs +45 -0
- package/dist/server/controllers/validate-locale-creation.mjs.map +1 -0
- package/dist/server/domain/locale.js +11 -0
- package/dist/server/domain/locale.js.map +1 -0
- package/dist/server/domain/locale.mjs +9 -0
- package/dist/server/domain/locale.mjs.map +1 -0
- package/dist/server/graphql.js +115 -0
- package/dist/server/graphql.js.map +1 -0
- package/dist/server/graphql.mjs +113 -0
- package/dist/server/graphql.mjs.map +1 -0
- package/dist/server/index.js +18 -3460
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +17 -3443
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/models/ai-localization-job.js +60 -0
- package/dist/server/models/ai-localization-job.js.map +1 -0
- package/dist/server/models/ai-localization-job.mjs +57 -0
- package/dist/server/models/ai-localization-job.mjs.map +1 -0
- package/dist/server/register.js +81 -0
- package/dist/server/register.js.map +1 -0
- package/dist/server/register.mjs +79 -0
- package/dist/server/register.mjs.map +1 -0
- package/dist/server/routes/admin.js +142 -0
- package/dist/server/routes/admin.js.map +1 -0
- package/dist/server/routes/admin.mjs +140 -0
- package/dist/server/routes/admin.mjs.map +1 -0
- package/dist/server/routes/content-api.js +19 -0
- package/dist/server/routes/content-api.js.map +1 -0
- package/dist/server/routes/content-api.mjs +17 -0
- package/dist/server/routes/content-api.mjs.map +1 -0
- package/dist/server/routes/index.js +12 -0
- package/dist/server/routes/index.js.map +1 -0
- package/dist/server/routes/index.mjs +10 -0
- package/dist/server/routes/index.mjs.map +1 -0
- package/dist/server/routes/validation/locale.js +57 -0
- package/dist/server/routes/validation/locale.js.map +1 -0
- package/dist/server/routes/validation/locale.mjs +36 -0
- package/dist/server/routes/validation/locale.mjs.map +1 -0
- package/dist/server/services/ai-localization-jobs.js +64 -0
- package/dist/server/services/ai-localization-jobs.js.map +1 -0
- package/dist/server/services/ai-localization-jobs.mjs +62 -0
- package/dist/server/services/ai-localization-jobs.mjs.map +1 -0
- package/dist/server/services/ai-localizations.js +268 -0
- package/dist/server/services/ai-localizations.js.map +1 -0
- package/dist/server/services/ai-localizations.mjs +266 -0
- package/dist/server/services/ai-localizations.mjs.map +1 -0
- package/dist/server/services/content-types.js +157 -0
- package/dist/server/services/content-types.js.map +1 -0
- package/dist/server/services/content-types.mjs +155 -0
- package/dist/server/services/content-types.mjs.map +1 -0
- package/dist/server/services/index.js +28 -0
- package/dist/server/services/index.js.map +1 -0
- package/dist/server/services/index.mjs +26 -0
- package/dist/server/services/index.mjs.map +1 -0
- package/dist/server/services/iso-locales.js +12 -0
- package/dist/server/services/iso-locales.js.map +1 -0
- package/dist/server/services/iso-locales.mjs +10 -0
- package/dist/server/services/iso-locales.mjs.map +1 -0
- package/dist/server/services/locales.js +114 -0
- package/dist/server/services/locales.js.map +1 -0
- package/dist/server/services/locales.mjs +112 -0
- package/dist/server/services/locales.mjs.map +1 -0
- package/dist/server/services/localizations.js +68 -0
- package/dist/server/services/localizations.js.map +1 -0
- package/dist/server/services/localizations.mjs +66 -0
- package/dist/server/services/localizations.mjs.map +1 -0
- package/dist/server/services/metrics.js +30 -0
- package/dist/server/services/metrics.js.map +1 -0
- package/dist/server/services/metrics.mjs +28 -0
- package/dist/server/services/metrics.mjs.map +1 -0
- package/dist/server/services/permissions/actions.js +136 -0
- package/dist/server/services/permissions/actions.js.map +1 -0
- package/dist/server/services/permissions/actions.mjs +134 -0
- package/dist/server/services/permissions/actions.mjs.map +1 -0
- package/dist/server/services/permissions/engine.js +52 -0
- package/dist/server/services/permissions/engine.js.map +1 -0
- package/dist/server/services/permissions/engine.mjs +50 -0
- package/dist/server/services/permissions/engine.mjs.map +1 -0
- package/dist/server/services/permissions/sections-builder.js +45 -0
- package/dist/server/services/permissions/sections-builder.js.map +1 -0
- package/dist/server/services/permissions/sections-builder.mjs +43 -0
- package/dist/server/services/permissions/sections-builder.mjs.map +1 -0
- package/dist/server/services/permissions.js +14 -0
- package/dist/server/services/permissions.js.map +1 -0
- package/dist/server/services/permissions.mjs +12 -0
- package/dist/server/services/permissions.mjs.map +1 -0
- package/dist/server/services/sanitize/index.js +34 -0
- package/dist/server/services/sanitize/index.js.map +1 -0
- package/dist/server/services/sanitize/index.mjs +32 -0
- package/dist/server/services/sanitize/index.mjs.map +1 -0
- package/dist/server/services/settings.js +25 -0
- package/dist/server/services/settings.js.map +1 -0
- package/dist/server/services/settings.mjs +23 -0
- package/dist/server/services/settings.mjs.map +1 -0
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/ai-localization-jobs.d.ts +17 -0
- package/dist/server/src/controllers/ai-localization-jobs.d.ts.map +1 -0
- package/dist/server/src/controllers/index.d.ts +10 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/settings.d.ts +7 -0
- package/dist/server/src/controllers/settings.d.ts.map +1 -0
- package/dist/server/src/index.d.ts +47 -8
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/models/ai-localization-job.d.ts +5 -0
- package/dist/server/src/models/ai-localization-job.d.ts.map +1 -0
- package/dist/server/src/models/index.d.ts +5 -0
- package/dist/server/src/models/index.d.ts.map +1 -0
- package/dist/server/src/register.d.ts +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/admin.d.ts.map +1 -1
- package/dist/server/src/routes/content-api.d.ts +5 -8
- package/dist/server/src/routes/content-api.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts +3 -7
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/routes/validation/index.d.ts +2 -0
- package/dist/server/src/routes/validation/index.d.ts.map +1 -0
- package/dist/server/src/routes/validation/locale.d.ts +41 -0
- package/dist/server/src/routes/validation/locale.d.ts.map +1 -0
- package/dist/server/src/services/ai-localization-jobs.d.ts +26 -0
- package/dist/server/src/services/ai-localization-jobs.d.ts.map +1 -0
- package/dist/server/src/services/ai-localizations.d.ts +18 -0
- package/dist/server/src/services/ai-localizations.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +33 -0
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/localizations.d.ts +1 -1
- package/dist/server/src/services/localizations.d.ts.map +1 -1
- package/dist/server/src/services/settings.d.ts +13 -0
- package/dist/server/src/services/settings.d.ts.map +1 -0
- package/dist/server/src/utils/index.d.ts +7 -1
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/server/src/validation/settings.d.ts +12 -0
- package/dist/server/src/validation/settings.d.ts.map +1 -0
- package/dist/server/utils/index.js +16 -0
- package/dist/server/utils/index.js.map +1 -0
- package/dist/server/utils/index.mjs +13 -0
- package/dist/server/utils/index.mjs.map +1 -0
- package/dist/server/validation/content-types.js +18 -0
- package/dist/server/validation/content-types.js.map +1 -0
- package/dist/server/validation/content-types.mjs +16 -0
- package/dist/server/validation/content-types.mjs.map +1 -0
- package/dist/server/validation/locales.js +23 -0
- package/dist/server/validation/locales.js.map +1 -0
- package/dist/server/validation/locales.mjs +20 -0
- package/dist/server/validation/locales.mjs.map +1 -0
- package/dist/server/validation/settings.js +11 -0
- package/dist/server/validation/settings.js.map +1 -0
- package/dist/server/validation/settings.mjs +9 -0
- package/dist/server/validation/settings.mjs.map +1 -0
- package/dist/shared/contracts/ai-localization-jobs.d.ts +27 -0
- package/dist/shared/contracts/ai-localization-jobs.d.ts.map +1 -0
- package/dist/shared/contracts/content-manager.d.ts +1 -1
- package/dist/shared/contracts/settings.d.ts +40 -0
- package/dist/shared/contracts/shared.d.ts +1 -1
- package/dist/shared/contracts/shared.d.ts.map +1 -0
- package/package.json +18 -12
- package/dist/_chunks/SettingsPage-B-KzAqT3.mjs +0 -554
- package/dist/_chunks/SettingsPage-B-KzAqT3.mjs.map +0 -1
- package/dist/_chunks/SettingsPage-hyOi94O9.js +0 -573
- package/dist/_chunks/SettingsPage-hyOi94O9.js.map +0 -1
- package/dist/_chunks/de-BOhNX_-5.js +0 -65
- package/dist/_chunks/de-BOhNX_-5.js.map +0 -1
- package/dist/_chunks/de-D80IRBP9.mjs +0 -65
- package/dist/_chunks/de-D80IRBP9.mjs.map +0 -1
- package/dist/_chunks/dk-CJ6Zzz78.mjs +0 -65
- package/dist/_chunks/dk-CJ6Zzz78.mjs.map +0 -1
- package/dist/_chunks/dk-cjXm0p3m.js +0 -65
- package/dist/_chunks/dk-cjXm0p3m.js.map +0 -1
- package/dist/_chunks/en-BTyF7WVW.mjs +0 -80
- package/dist/_chunks/en-BTyF7WVW.mjs.map +0 -1
- package/dist/_chunks/en-UlC0jh2t.js +0 -80
- package/dist/_chunks/en-UlC0jh2t.js.map +0 -1
- package/dist/_chunks/es-V8WnPN7w.mjs +0 -65
- package/dist/_chunks/es-V8WnPN7w.mjs.map +0 -1
- package/dist/_chunks/es-hr9b_HLp.js +0 -65
- package/dist/_chunks/es-hr9b_HLp.js.map +0 -1
- package/dist/_chunks/fr-BFmBbE0H.js +0 -65
- package/dist/_chunks/fr-BFmBbE0H.js.map +0 -1
- package/dist/_chunks/fr-F94noFiV.mjs +0 -65
- package/dist/_chunks/fr-F94noFiV.mjs.map +0 -1
- package/dist/_chunks/index-BcYj5jo9.mjs +0 -1589
- package/dist/_chunks/index-BcYj5jo9.mjs.map +0 -1
- package/dist/_chunks/index-C8NzsAKp.js +0 -1610
- package/dist/_chunks/index-C8NzsAKp.js.map +0 -1
- package/dist/_chunks/ko-C40pNQ9b.js +0 -64
- package/dist/_chunks/ko-C40pNQ9b.js.map +0 -1
- package/dist/_chunks/ko-CF-P3Car.mjs +0 -64
- package/dist/_chunks/ko-CF-P3Car.mjs.map +0 -1
- package/dist/_chunks/pl-Dxr9RUmD.mjs +0 -65
- package/dist/_chunks/pl-Dxr9RUmD.mjs.map +0 -1
- package/dist/_chunks/pl-JtWBy-JQ.js +0 -65
- package/dist/_chunks/pl-JtWBy-JQ.js.map +0 -1
- package/dist/_chunks/ru-B-4sVwXN.mjs +0 -67
- package/dist/_chunks/ru-B-4sVwXN.mjs.map +0 -1
- package/dist/_chunks/ru-COSWt3Nu.js +0 -67
- package/dist/_chunks/ru-COSWt3Nu.js.map +0 -1
- package/dist/_chunks/tr-BVj1O5ch.js +0 -65
- package/dist/_chunks/tr-BVj1O5ch.js.map +0 -1
- package/dist/_chunks/tr-Ccu6Yj11.mjs +0 -65
- package/dist/_chunks/tr-Ccu6Yj11.mjs.map +0 -1
- package/dist/_chunks/zh-BIz395Ms.mjs +0 -65
- package/dist/_chunks/zh-BIz395Ms.mjs.map +0 -1
- package/dist/_chunks/zh-Hans-Bfo6_TCM.mjs +0 -56
- package/dist/_chunks/zh-Hans-Bfo6_TCM.mjs.map +0 -1
- package/dist/_chunks/zh-Hans-DIEm_EMC.js +0 -56
- package/dist/_chunks/zh-Hans-DIEm_EMC.js.map +0 -1
- package/dist/_chunks/zh-wkBPBkhc.js +0 -65
- package/dist/_chunks/zh-wkBPBkhc.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iso-locales.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../server/src/content-types/index.ts"],"sourcesContent":["import locale from './locale';\n\nexport default {\n locale,\n};\n"],"names":["locale"],"mappings":";;;;AAEA,mBAAe;AACbA,YAAAA;AACF,CAAE;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../server/src/content-types/index.ts"],"sourcesContent":["import locale from './locale';\n\nexport default {\n locale,\n};\n"],"names":["locale"],"mappings":";;AAEA,mBAAe;AACbA,IAAAA;AACF,CAAE;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../server/src/content-types/locale/index.ts"],"sourcesContent":["import schema from './schema.json';\n\nexport default {\n schema,\n};\n"],"names":["schema"],"mappings":";;;;AAEA,aAAe;AACbA,YAAAA;AACF,CAAE;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../server/src/content-types/locale/index.ts"],"sourcesContent":["import schema from './schema.json';\n\nexport default {\n schema,\n};\n"],"names":["schema"],"mappings":";;AAEA,aAAe;AACbA,IAAAA;AACF,CAAE;;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var info = {
|
|
6
|
+
singularName: "locale",
|
|
7
|
+
pluralName: "locales",
|
|
8
|
+
collectionName: "locales",
|
|
9
|
+
displayName: "Locale",
|
|
10
|
+
description: ""
|
|
11
|
+
};
|
|
12
|
+
var options = {};
|
|
13
|
+
var pluginOptions = {
|
|
14
|
+
"content-manager": {
|
|
15
|
+
visible: false
|
|
16
|
+
},
|
|
17
|
+
"content-type-builder": {
|
|
18
|
+
visible: false
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var attributes = {
|
|
22
|
+
name: {
|
|
23
|
+
type: "string",
|
|
24
|
+
min: 1,
|
|
25
|
+
max: 50,
|
|
26
|
+
configurable: false
|
|
27
|
+
},
|
|
28
|
+
code: {
|
|
29
|
+
type: "string",
|
|
30
|
+
unique: true,
|
|
31
|
+
configurable: false
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var schema = {
|
|
35
|
+
info: info,
|
|
36
|
+
options: options,
|
|
37
|
+
pluginOptions: pluginOptions,
|
|
38
|
+
attributes: attributes
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.attributes = attributes;
|
|
42
|
+
exports.default = schema;
|
|
43
|
+
exports.info = info;
|
|
44
|
+
exports.options = options;
|
|
45
|
+
exports.pluginOptions = pluginOptions;
|
|
46
|
+
//# sourceMappingURL=schema.json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var info = {
|
|
2
|
+
singularName: "locale",
|
|
3
|
+
pluralName: "locales",
|
|
4
|
+
collectionName: "locales",
|
|
5
|
+
displayName: "Locale",
|
|
6
|
+
description: ""
|
|
7
|
+
};
|
|
8
|
+
var options = {};
|
|
9
|
+
var pluginOptions = {
|
|
10
|
+
"content-manager": {
|
|
11
|
+
visible: false
|
|
12
|
+
},
|
|
13
|
+
"content-type-builder": {
|
|
14
|
+
visible: false
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var attributes = {
|
|
18
|
+
name: {
|
|
19
|
+
type: "string",
|
|
20
|
+
min: 1,
|
|
21
|
+
max: 50,
|
|
22
|
+
configurable: false
|
|
23
|
+
},
|
|
24
|
+
code: {
|
|
25
|
+
type: "string",
|
|
26
|
+
unique: true,
|
|
27
|
+
configurable: false
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var schema = {
|
|
31
|
+
info: info,
|
|
32
|
+
options: options,
|
|
33
|
+
pluginOptions: pluginOptions,
|
|
34
|
+
attributes: attributes
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { attributes, schema as default, info, options, pluginOptions };
|
|
38
|
+
//# sourceMappingURL=schema.json.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const createAILocalizationJobsController = ({ strapi })=>{
|
|
4
|
+
const getService = (name)=>strapi.plugin('i18n').service(name);
|
|
5
|
+
const aiLocalizationJobsService = getService('ai-localization-jobs');
|
|
6
|
+
return {
|
|
7
|
+
/**
|
|
8
|
+
* Get a job for a singleType using the contentType
|
|
9
|
+
* There is only 1 job per contentType
|
|
10
|
+
*/ async getJobForSingleType (ctx) {
|
|
11
|
+
const { contentType } = ctx.params;
|
|
12
|
+
if (!contentType) {
|
|
13
|
+
return ctx.badRequest('contentType is required');
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const job = await aiLocalizationJobsService.getJobByContentType(contentType);
|
|
17
|
+
ctx.body = {
|
|
18
|
+
data: job
|
|
19
|
+
};
|
|
20
|
+
} catch (error) {
|
|
21
|
+
strapi.log.error('[AI Localizations Jobs] Error fetching job:', error);
|
|
22
|
+
ctx.internalServerError('Failed to fetch AI localizations job');
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* Get a job for a collectionType using the documentId
|
|
27
|
+
* There is only 1 job per documentId
|
|
28
|
+
*/ async getJobForCollectionType (ctx) {
|
|
29
|
+
const { documentId, contentType } = ctx.params;
|
|
30
|
+
if (!documentId || !contentType) {
|
|
31
|
+
return ctx.badRequest('Document ID and contentType are required');
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const job = await aiLocalizationJobsService.getJobByDocument(contentType, documentId);
|
|
35
|
+
ctx.body = {
|
|
36
|
+
data: job
|
|
37
|
+
};
|
|
38
|
+
} catch (error) {
|
|
39
|
+
strapi.log.error('[AI Localizations Jobs] Error fetching job:', error);
|
|
40
|
+
ctx.internalServerError('Failed to fetch AI localizations job');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
module.exports = createAILocalizationJobsController;
|
|
47
|
+
//# sourceMappingURL=ai-localization-jobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-localization-jobs.js","sources":["../../../server/src/controllers/ai-localization-jobs.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nconst createAILocalizationJobsController = ({ strapi }: { strapi: Core.Strapi }) => {\n const getService = (name: string) => strapi.plugin('i18n').service(name);\n const aiLocalizationJobsService = getService('ai-localization-jobs');\n\n return {\n /**\n * Get a job for a singleType using the contentType\n * There is only 1 job per contentType\n */\n async getJobForSingleType(ctx: any) {\n const { contentType } = ctx.params;\n\n if (!contentType) {\n return ctx.badRequest('contentType is required');\n }\n\n try {\n const job = await aiLocalizationJobsService.getJobByContentType(contentType);\n\n ctx.body = {\n data: job,\n };\n } catch (error) {\n strapi.log.error('[AI Localizations Jobs] Error fetching job:', error);\n ctx.internalServerError('Failed to fetch AI localizations job');\n }\n },\n /**\n * Get a job for a collectionType using the documentId\n * There is only 1 job per documentId\n */\n async getJobForCollectionType(ctx: any) {\n const { documentId, contentType } = ctx.params;\n\n if (!documentId || !contentType) {\n return ctx.badRequest('Document ID and contentType are required');\n }\n\n try {\n const job = await aiLocalizationJobsService.getJobByDocument(contentType, documentId);\n\n ctx.body = {\n data: job,\n };\n } catch (error) {\n strapi.log.error('[AI Localizations Jobs] Error fetching job:', error);\n ctx.internalServerError('Failed to fetch AI localizations job');\n }\n },\n };\n};\n\nexport default createAILocalizationJobsController;\n"],"names":["createAILocalizationJobsController","strapi","getService","name","plugin","service","aiLocalizationJobsService","getJobForSingleType","ctx","contentType","params","badRequest","job","getJobByContentType","body","data","error","log","internalServerError","getJobForCollectionType","documentId","getJobByDocument"],"mappings":";;AAEA,MAAMA,kCAAqC,GAAA,CAAC,EAAEC,MAAM,EAA2B,GAAA;IAC7E,MAAMC,UAAAA,GAAa,CAACC,IAAiBF,GAAAA,MAAAA,CAAOG,MAAM,CAAC,MAAA,CAAA,CAAQC,OAAO,CAACF,IAAAA,CAAAA;AACnE,IAAA,MAA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AA;AACF;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const createAILocalizationJobsController = ({ strapi })=>{
|
|
2
|
+
const getService = (name)=>strapi.plugin('i18n').service(name);
|
|
3
|
+
const aiLocalizationJobsService = getService('ai-localization-jobs');
|
|
4
|
+
return {
|
|
5
|
+
/**
|
|
6
|
+
* Get a job for a singleType using the contentType
|
|
7
|
+
* There is only 1 job per contentType
|
|
8
|
+
*/ async getJobForSingleType (ctx) {
|
|
9
|
+
const { contentType } = ctx.params;
|
|
10
|
+
if (!contentType) {
|
|
11
|
+
return ctx.badRequest('contentType is required');
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
const job = await aiLocalizationJobsService.getJobByContentType(contentType);
|
|
15
|
+
ctx.body = {
|
|
16
|
+
data: job
|
|
17
|
+
};
|
|
18
|
+
} catch (error) {
|
|
19
|
+
strapi.log.error('[AI Localizations Jobs] Error fetching job:', error);
|
|
20
|
+
ctx.internalServerError('Failed to fetch AI localizations job');
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* Get a job for a collectionType using the documentId
|
|
25
|
+
* There is only 1 job per documentId
|
|
26
|
+
*/ async getJobForCollectionType (ctx) {
|
|
27
|
+
const { documentId, contentType } = ctx.params;
|
|
28
|
+
if (!documentId || !contentType) {
|
|
29
|
+
return ctx.badRequest('Document ID and contentType are required');
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const job = await aiLocalizationJobsService.getJobByDocument(contentType, documentId);
|
|
33
|
+
ctx.body = {
|
|
34
|
+
data: job
|
|
35
|
+
};
|
|
36
|
+
} catch (error) {
|
|
37
|
+
strapi.log.error('[AI Localizations Jobs] Error fetching job:', error);
|
|
38
|
+
ctx.internalServerError('Failed to fetch AI localizations job');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { createAILocalizationJobsController as default };
|
|
45
|
+
//# sourceMappingURL=ai-localization-jobs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-localization-jobs.mjs","sources":["../../../server/src/controllers/ai-localization-jobs.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nconst createAILocalizationJobsController = ({ strapi }: { strapi: Core.Strapi }) => {\n const getService = (name: string) => strapi.plugin('i18n').service(name);\n const aiLocalizationJobsService = getService('ai-localization-jobs');\n\n return {\n /**\n * Get a job for a singleType using the contentType\n * There is only 1 job per contentType\n */\n async getJobForSingleType(ctx: any) {\n const { contentType } = ctx.params;\n\n if (!contentType) {\n return ctx.badRequest('contentType is required');\n }\n\n try {\n const job = await aiLocalizationJobsService.getJobByContentType(contentType);\n\n ctx.body = {\n data: job,\n };\n } catch (error) {\n strapi.log.error('[AI Localizations Jobs] Error fetching job:', error);\n ctx.internalServerError('Failed to fetch AI localizations job');\n }\n },\n /**\n * Get a job for a collectionType using the documentId\n * There is only 1 job per documentId\n */\n async getJobForCollectionType(ctx: any) {\n const { documentId, contentType } = ctx.params;\n\n if (!documentId || !contentType) {\n return ctx.badRequest('Document ID and contentType are required');\n }\n\n try {\n const job = await aiLocalizationJobsService.getJobByDocument(contentType, documentId);\n\n ctx.body = {\n data: job,\n };\n } catch (error) {\n strapi.log.error('[AI Localizations Jobs] Error fetching job:', error);\n ctx.internalServerError('Failed to fetch AI localizations job');\n }\n },\n };\n};\n\nexport default createAILocalizationJobsController;\n"],"names":["createAILocalizationJobsController","strapi","getService","name","plugin","service","aiLocalizationJobsService","getJobForSingleType","ctx","contentType","params","badRequest","job","getJobByContentType","body","data","error","log","internalServerError","getJobForCollectionType","documentId","getJobByDocument"],"mappings":"AAEA,MAAMA,kCAAqC,GAAA,CAAC,EAAEC,MAAM,EAA2B,GAAA;IAC7E,MAAMC,UAAAA,GAAa,CAACC,IAAiBF,GAAAA,MAAAA,CAAOG,MAAM,CAAC,MAAA,CAAA,CAAQC,OAAO,CAACF,IAAAA,CAAAA;AAC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;AACF;AACF,KAAA;AACF;;;;"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fp = require('lodash/fp');
|
|
4
|
+
var utils = require('@strapi/utils');
|
|
5
|
+
var index = require('../utils/index.js');
|
|
6
|
+
var contentTypes = require('../validation/content-types.js');
|
|
7
|
+
|
|
8
|
+
const { ApplicationError } = utils.errors;
|
|
9
|
+
const { PUBLISHED_AT_ATTRIBUTE } = utils.contentTypes.constants;
|
|
10
|
+
const getLocalesProperty = fp.getOr([], 'properties.locales');
|
|
11
|
+
const getFieldsProperty = fp.prop('properties.fields');
|
|
12
|
+
const getFirstLevelPath = fp.map((path)=>path.split('.')[0]);
|
|
13
|
+
const controller = {
|
|
14
|
+
async getNonLocalizedAttributes (ctx) {
|
|
15
|
+
const { user } = ctx.state;
|
|
16
|
+
const body = ctx.request.body;
|
|
17
|
+
const { model, id, locale } = body;
|
|
18
|
+
await contentTypes.validateGetNonLocalizedAttributesInput({
|
|
19
|
+
model,
|
|
20
|
+
id,
|
|
21
|
+
locale
|
|
22
|
+
});
|
|
23
|
+
const { copyNonLocalizedAttributes, isLocalizedContentType, getNestedPopulateOfNonLocalizedAttributes } = index.getService('content-types');
|
|
24
|
+
const { default: { READ_ACTION, CREATE_ACTION } } = strapi.service('admin::constants');
|
|
25
|
+
const modelDef = strapi.contentType(model);
|
|
26
|
+
const attributesToPopulate = getNestedPopulateOfNonLocalizedAttributes(model);
|
|
27
|
+
if (!isLocalizedContentType(modelDef)) {
|
|
28
|
+
throw new ApplicationError(`Model ${model} is not localized`);
|
|
29
|
+
}
|
|
30
|
+
const params = modelDef.kind === 'singleType' ? {} : {
|
|
31
|
+
id
|
|
32
|
+
};
|
|
33
|
+
const entity = await strapi.db.query(model).findOne({
|
|
34
|
+
where: params,
|
|
35
|
+
populate: attributesToPopulate
|
|
36
|
+
});
|
|
37
|
+
if (!entity) {
|
|
38
|
+
return ctx.notFound();
|
|
39
|
+
}
|
|
40
|
+
const permissions = await strapi.admin.services.permission.findMany({
|
|
41
|
+
where: {
|
|
42
|
+
action: [
|
|
43
|
+
READ_ACTION,
|
|
44
|
+
CREATE_ACTION
|
|
45
|
+
],
|
|
46
|
+
subject: model,
|
|
47
|
+
role: {
|
|
48
|
+
id: user.roles.map(fp.prop('id'))
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const localePermissions = permissions.filter((perm)=>getLocalesProperty(perm).includes(locale)).map(getFieldsProperty);
|
|
53
|
+
const permittedFields = fp.pipe(fp.flatten, getFirstLevelPath, fp.uniq)(localePermissions);
|
|
54
|
+
const nonLocalizedFields = copyNonLocalizedAttributes(modelDef, entity);
|
|
55
|
+
const sanitizedNonLocalizedFields = fp.pick(permittedFields, nonLocalizedFields);
|
|
56
|
+
const availableLocalesResult = await strapi.plugins['content-manager'].service('document-metadata').getMetadata(model, entity, {
|
|
57
|
+
availableLocales: true
|
|
58
|
+
});
|
|
59
|
+
const availableLocales = availableLocalesResult.availableLocales.map((localeResult)=>fp.pick([
|
|
60
|
+
'id',
|
|
61
|
+
'locale',
|
|
62
|
+
PUBLISHED_AT_ATTRIBUTE
|
|
63
|
+
], localeResult));
|
|
64
|
+
ctx.body = {
|
|
65
|
+
nonLocalizedFields: sanitizedNonLocalizedFields,
|
|
66
|
+
localizations: availableLocales.concat(fp.pick([
|
|
67
|
+
'id',
|
|
68
|
+
'locale',
|
|
69
|
+
PUBLISHED_AT_ATTRIBUTE
|
|
70
|
+
], entity))
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
module.exports = controller;
|
|
76
|
+
//# sourceMappingURL=content-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-types.js","sources":["../../../server/src/controllers/content-types.ts"],"sourcesContent":["import { pick, uniq, prop, getOr, flatten, pipe, map } from 'lodash/fp';\nimport { contentTypes as contentTypesUtils, errors } from '@strapi/utils';\nimport type { Core } from '@strapi/types';\nimport { getService } from '../utils';\nimport { validateGetNonLocalizedAttributesInput } from '../validation/content-types';\n\nconst { ApplicationError } = errors;\n\nconst { PUBLISHED_AT_ATTRIBUTE } = contentTypesUtils.constants;\n\nconst getLocalesProperty = getOr<string[]>([], 'properties.locales');\nconst getFieldsProperty = prop('properties.fields');\n\nconst getFirstLevelPath = map((path: string) => path.split('.')[0]);\n\nconst controller = {\n async getNonLocalizedAttributes(ctx) {\n const { user } = ctx.state;\n const body = ctx.request.body as any;\n const { model, id, locale } = body;\n\n await validateGetNonLocalizedAttributesInput({ model, id, locale });\n\n const {\n copyNonLocalizedAttributes,\n isLocalizedContentType,\n getNestedPopulateOfNonLocalizedAttributes,\n } = getService('content-types');\n\n const {\n default: { READ_ACTION, CREATE_ACTION },\n } = strapi.service('admin::constants');\n\n const modelDef = strapi.contentType(model);\n const attributesToPopulate = getNestedPopulateOfNonLocalizedAttributes(model);\n\n if (!isLocalizedContentType(modelDef)) {\n throw new ApplicationError(`Model ${model} is not localized`);\n }\n\n const params = modelDef.kind === 'singleType' ? {} : { id };\n\n const entity = await strapi.db\n .query(model)\n .findOne({ where: params, populate: attributesToPopulate });\n\n if (!entity) {\n return ctx.notFound();\n }\n\n const permissions = await strapi.admin.services.permission.findMany({\n where: {\n action: [READ_ACTION, CREATE_ACTION],\n subject: model,\n role: {\n id: user.roles.map(prop('id')),\n },\n },\n });\n\n const localePermissions = permissions\n .filter((perm: any) => getLocalesProperty(perm).includes(locale))\n .map(getFieldsProperty);\n\n const permittedFields = pipe(flatten, getFirstLevelPath, uniq)(localePermissions);\n\n const nonLocalizedFields = copyNonLocalizedAttributes(modelDef, entity);\n const sanitizedNonLocalizedFields = pick(permittedFields, nonLocalizedFields);\n\n const availableLocalesResult = await strapi.plugins['content-manager']\n .service('document-metadata')\n .getMetadata(model, entity, {\n availableLocales: true,\n });\n\n const availableLocales = availableLocalesResult.availableLocales.map((localeResult: any) =>\n pick(['id', 'locale', PUBLISHED_AT_ATTRIBUTE], localeResult)\n );\n\n ctx.body = {\n nonLocalizedFields: sanitizedNonLocalizedFields,\n localizations: availableLocales.concat(\n pick(['id', 'locale', PUBLISHED_AT_ATTRIBUTE], entity)\n ),\n };\n },\n} satisfies Core.Controller;\n\nexport default controller;\n"],"names":["ApplicationError","errors","PUBLISHED_AT_ATTRIBUTE","contentTypesUtils","constants","getLocalesProperty","getOr","getFieldsProperty","prop","getFirstLevelPath","map","path","split","controller","getNonLocalizedAttributes","ctx","user","state","body","request","model","id","locale","validateGetNonLocalizedAttributesInput","copyNonLocalizedAttributes","isLocalizedContentType","getNestedPopulateOfNonLocalizedAttributes","getService","default","READ_ACTION","CREATE_ACTION","strapi","service","modelDef","contentType","attributesToPopulate","params","kind","entity","db","query","findOne","where","populate","notFound","permissions","admin","services","permission","findMany","action","subject","role","roles","localePermissions","filter","perm","includes","permittedFields","pipe","flatten","uniq","nonLocalizedFields","sanitizedNonLocalizedFields","pick","availableLocalesResult","plugins","getMetadata","availableLocales","localeResult","localizations","concat"],"mappings":";;;;;;;AAMA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,YAAAA;AAE7B,MAAM,EAAEC,sBAAsB,EAAE,GAAGC,mBAAkBC,SAAS;AAE9D,MAAMC,kBAAAA,GAAqBC,QAAgB,CAAA,EAAE,EAAE,oBAAA,CAAA;AAC/C,MAAMC,oBAAoBC,OAAK,CAAA,mBAAA,CAAA;AAE/B,MAAMC,iBAAAA,GAAoBC,OAAI,CAACC,IAAAA,GAAiBA,KAAKC,KAAK,CAAC,GAAI,CAAA,CAAC,CAAE,CAAA,CAAA;AAElE,MAAMC,UAAa,GAAA;AACjB,IAAA,MAAMC,2BAA0BC,GAAG,EAAA;AACjC,QAAA,MAAM,EAAEC,IAAI,EAAE,GAAGD,IAAIE,KAAK;AAC1B,QAAA,MAAMC,IAAOH,GAAAA,GAAAA,CAAII,OAAO,CAACD,IAAI;AAC7B,QAAA,MAAM,EAAEE,KAAK,EAAEC,EA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AEnD,SAAA;AACF;AACF;;;;"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { getOr, prop, map, pipe, flatten, uniq, pick } from 'lodash/fp';
|
|
2
|
+
import { contentTypes, errors } from '@strapi/utils';
|
|
3
|
+
import { getService } from '../utils/index.mjs';
|
|
4
|
+
import { validateGetNonLocalizedAttributesInput } from '../validation/content-types.mjs';
|
|
5
|
+
|
|
6
|
+
const { ApplicationError } = errors;
|
|
7
|
+
const { PUBLISHED_AT_ATTRIBUTE } = contentTypes.constants;
|
|
8
|
+
const getLocalesProperty = getOr([], 'properties.locales');
|
|
9
|
+
const getFieldsProperty = prop('properties.fields');
|
|
10
|
+
const getFirstLevelPath = map((path)=>path.split('.')[0]);
|
|
11
|
+
const controller = {
|
|
12
|
+
async getNonLocalizedAttributes (ctx) {
|
|
13
|
+
const { user } = ctx.state;
|
|
14
|
+
const body = ctx.request.body;
|
|
15
|
+
const { model, id, locale } = body;
|
|
16
|
+
await validateGetNonLocalizedAttributesInput({
|
|
17
|
+
model,
|
|
18
|
+
id,
|
|
19
|
+
locale
|
|
20
|
+
});
|
|
21
|
+
const { copyNonLocalizedAttributes, isLocalizedContentType, getNestedPopulateOfNonLocalizedAttributes } = getService('content-types');
|
|
22
|
+
const { default: { READ_ACTION, CREATE_ACTION } } = strapi.service('admin::constants');
|
|
23
|
+
const modelDef = strapi.contentType(model);
|
|
24
|
+
const attributesToPopulate = getNestedPopulateOfNonLocalizedAttributes(model);
|
|
25
|
+
if (!isLocalizedContentType(modelDef)) {
|
|
26
|
+
throw new ApplicationError(`Model ${model} is not localized`);
|
|
27
|
+
}
|
|
28
|
+
const params = modelDef.kind === 'singleType' ? {} : {
|
|
29
|
+
id
|
|
30
|
+
};
|
|
31
|
+
const entity = await strapi.db.query(model).findOne({
|
|
32
|
+
where: params,
|
|
33
|
+
populate: attributesToPopulate
|
|
34
|
+
});
|
|
35
|
+
if (!entity) {
|
|
36
|
+
return ctx.notFound();
|
|
37
|
+
}
|
|
38
|
+
const permissions = await strapi.admin.services.permission.findMany({
|
|
39
|
+
where: {
|
|
40
|
+
action: [
|
|
41
|
+
READ_ACTION,
|
|
42
|
+
CREATE_ACTION
|
|
43
|
+
],
|
|
44
|
+
subject: model,
|
|
45
|
+
role: {
|
|
46
|
+
id: user.roles.map(prop('id'))
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const localePermissions = permissions.filter((perm)=>getLocalesProperty(perm).includes(locale)).map(getFieldsProperty);
|
|
51
|
+
const permittedFields = pipe(flatten, getFirstLevelPath, uniq)(localePermissions);
|
|
52
|
+
const nonLocalizedFields = copyNonLocalizedAttributes(modelDef, entity);
|
|
53
|
+
const sanitizedNonLocalizedFields = pick(permittedFields, nonLocalizedFields);
|
|
54
|
+
const availableLocalesResult = await strapi.plugins['content-manager'].service('document-metadata').getMetadata(model, entity, {
|
|
55
|
+
availableLocales: true
|
|
56
|
+
});
|
|
57
|
+
const availableLocales = availableLocalesResult.availableLocales.map((localeResult)=>pick([
|
|
58
|
+
'id',
|
|
59
|
+
'locale',
|
|
60
|
+
PUBLISHED_AT_ATTRIBUTE
|
|
61
|
+
], localeResult));
|
|
62
|
+
ctx.body = {
|
|
63
|
+
nonLocalizedFields: sanitizedNonLocalizedFields,
|
|
64
|
+
localizations: availableLocales.concat(pick([
|
|
65
|
+
'id',
|
|
66
|
+
'locale',
|
|
67
|
+
PUBLISHED_AT_ATTRIBUTE
|
|
68
|
+
], entity))
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export { controller as default };
|
|
74
|
+
//# sourceMappingURL=content-types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-types.mjs","sources":["../../../server/src/controllers/content-types.ts"],"sourcesContent":["import { pick, uniq, prop, getOr, flatten, pipe, map } from 'lodash/fp';\nimport { contentTypes as contentTypesUtils, errors } from '@strapi/utils';\nimport type { Core } from '@strapi/types';\nimport { getService } from '../utils';\nimport { validateGetNonLocalizedAttributesInput } from '../validation/content-types';\n\nconst { ApplicationError } = errors;\n\nconst { PUBLISHED_AT_ATTRIBUTE } = contentTypesUtils.constants;\n\nconst getLocalesProperty = getOr<string[]>([], 'properties.locales');\nconst getFieldsProperty = prop('properties.fields');\n\nconst getFirstLevelPath = map((path: string) => path.split('.')[0]);\n\nconst controller = {\n async getNonLocalizedAttributes(ctx) {\n const { user } = ctx.state;\n const body = ctx.request.body as any;\n const { model, id, locale } = body;\n\n await validateGetNonLocalizedAttributesInput({ model, id, locale });\n\n const {\n copyNonLocalizedAttributes,\n isLocalizedContentType,\n getNestedPopulateOfNonLocalizedAttributes,\n } = getService('content-types');\n\n const {\n default: { READ_ACTION, CREATE_ACTION },\n } = strapi.service('admin::constants');\n\n const modelDef = strapi.contentType(model);\n const attributesToPopulate = getNestedPopulateOfNonLocalizedAttributes(model);\n\n if (!isLocalizedContentType(modelDef)) {\n throw new ApplicationError(`Model ${model} is not localized`);\n }\n\n const params = modelDef.kind === 'singleType' ? {} : { id };\n\n const entity = await strapi.db\n .query(model)\n .findOne({ where: params, populate: attributesToPopulate });\n\n if (!entity) {\n return ctx.notFound();\n }\n\n const permissions = await strapi.admin.services.permission.findMany({\n where: {\n action: [READ_ACTION, CREATE_ACTION],\n subject: model,\n role: {\n id: user.roles.map(prop('id')),\n },\n },\n });\n\n const localePermissions = permissions\n .filter((perm: any) => getLocalesProperty(perm).includes(locale))\n .map(getFieldsProperty);\n\n const permittedFields = pipe(flatten, getFirstLevelPath, uniq)(localePermissions);\n\n const nonLocalizedFields = copyNonLocalizedAttributes(modelDef, entity);\n const sanitizedNonLocalizedFields = pick(permittedFields, nonLocalizedFields);\n\n const availableLocalesResult = await strapi.plugins['content-manager']\n .service('document-metadata')\n .getMetadata(model, entity, {\n availableLocales: true,\n });\n\n const availableLocales = availableLocalesResult.availableLocales.map((localeResult: any) =>\n pick(['id', 'locale', PUBLISHED_AT_ATTRIBUTE], localeResult)\n );\n\n ctx.body = {\n nonLocalizedFields: sanitizedNonLocalizedFields,\n localizations: availableLocales.concat(\n pick(['id', 'locale', PUBLISHED_AT_ATTRIBUTE], entity)\n ),\n };\n },\n} satisfies Core.Controller;\n\nexport default controller;\n"],"names":["ApplicationError","errors","PUBLISHED_AT_ATTRIBUTE","contentTypesUtils","constants","getLocalesProperty","getOr","getFieldsProperty","prop","getFirstLevelPath","map","path","split","controller","getNonLocalizedAttributes","ctx","user","state","body","request","model","id","locale","validateGetNonLocalizedAttributesInput","copyNonLocalizedAttributes","isLocalizedContentType","getNestedPopulateOfNonLocalizedAttributes","getService","default","READ_ACTION","CREATE_ACTION","strapi","service","modelDef","contentType","attributesToPopulate","params","kind","entity","db","query","findOne","where","populate","notFound","permissions","admin","services","permission","findMany","action","subject","role","roles","localePermissions","filter","perm","includes","permittedFields","pipe","flatten","uniq","nonLocalizedFields","sanitizedNonLocalizedFields","pick","availableLocalesResult","plugins","getMetadata","availableLocales","localeResult","localizations","concat"],"mappings":";;;;;AAMA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,MAAAA;AAE7B,MAAM,EAAEC,sBAAsB,EAAE,GAAGC,aAAkBC,SAAS;AAE9D,MAAMC,kBAAAA,GAAqBC,KAAgB,CAAA,EAAE,EAAE,oBAAA,CAAA;AAC/C,MAAMC,oBAAoBC,IAAK,CAAA,mBAAA,CAAA;AAE/B,MAAMC,iBAAAA,GAAoBC,IAAI,CAACC,IAAAA,GAAiBA,KAAKC,KAAK,CAAC,GAAI,CAAA,CAAC,CAAE,CAAA,CAAA;AAElE,MAAMC,UAAa,GAAA;AACjB,IAAA,MAAMC,2BAA0BC,GAAG,EAAA;AACjC,QAAA,MAAM,EAAEC,IAAI,EAAE,GAAGD,IAAIE,KAAK;AAC1B,QAAA,MAAMC,IAAOH,GAAAA,GAAAA,CAAII,OAAO,CAACD,IAAI;AAC7B,QAAA,MAAM,EAAEE,KAAK,EAAEC,EAAE,EAAEC,MAAM,EAAE,GA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}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var locales = require('./locales.js');
|
|
4
|
+
var contentTypes = require('./content-types.js');
|
|
5
|
+
var isoLocales = require('./iso-locales.js');
|
|
6
|
+
var settings = require('./settings.js');
|
|
7
|
+
var aiLocalizationJobs = require('./ai-localization-jobs.js');
|
|
8
|
+
|
|
9
|
+
var controllers = {
|
|
10
|
+
locales,
|
|
11
|
+
'iso-locales': isoLocales,
|
|
12
|
+
'content-types': contentTypes,
|
|
13
|
+
settings,
|
|
14
|
+
'ai-localization-jobs': aiLocalizationJobs
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
module.exports = controllers;
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../server/src/controllers/index.ts"],"sourcesContent":["import locales from './locales';\nimport contentTypes from './content-types';\nimport isoLocales from './iso-locales';\nimport settings from './settings';\nimport aiLocalizationJobs from './ai-localization-jobs';\n\nexport default {\n locales,\n 'iso-locales': isoLocales,\n 'content-types': contentTypes,\n settings,\n 'ai-localization-jobs': aiLocalizationJobs,\n};\n"],"names":["locales","isoLocales","contentTypes","settings","aiLocalizationJobs"],"mappings":";;;;;;;;AAMA,kBAAe;AACbA,IAAAA,OAAAA;IACA,aAAeC,EAAAA,UAAAA;IACf,eAAiBC,EAAAA,YAAAA;AACjBC,IAAAA,QAAAA;IACA,sBAAwBC,EAAAA;AAC1B,CAAE;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import controller from './locales.mjs';
|
|
2
|
+
import controller$2 from './content-types.mjs';
|
|
3
|
+
import controller$1 from './iso-locales.mjs';
|
|
4
|
+
import settings from './settings.mjs';
|
|
5
|
+
import createAILocalizationJobsController from './ai-localization-jobs.mjs';
|
|
6
|
+
|
|
7
|
+
var controllers = {
|
|
8
|
+
locales: controller,
|
|
9
|
+
'iso-locales': controller$1,
|
|
10
|
+
'content-types': controller$2,
|
|
11
|
+
settings,
|
|
12
|
+
'ai-localization-jobs': createAILocalizationJobsController
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { controllers as default };
|
|
16
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../server/src/controllers/index.ts"],"sourcesContent":["import locales from './locales';\nimport contentTypes from './content-types';\nimport isoLocales from './iso-locales';\nimport settings from './settings';\nimport aiLocalizationJobs from './ai-localization-jobs';\n\nexport default {\n locales,\n 'iso-locales': isoLocales,\n 'content-types': contentTypes,\n settings,\n 'ai-localization-jobs': aiLocalizationJobs,\n};\n"],"names":["locales","isoLocales","contentTypes","settings","aiLocalizationJobs"],"mappings":";;;;;;AAMA,kBAAe;AACbA,aAAAA,UAAAA;IACA,aAAeC,EAAAA,YAAAA;IACf,eAAiBC,EAAAA,YAAAA;AACjBC,IAAAA,QAAAA;IACA,sBAAwBC,EAAAA;AAC1B,CAAE;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('../utils/index.js');
|
|
4
|
+
|
|
5
|
+
const controller = {
|
|
6
|
+
listIsoLocales (ctx) {
|
|
7
|
+
const isoLocalesService = index.getService('iso-locales');
|
|
8
|
+
ctx.body = isoLocalesService.getIsoLocales();
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
module.exports = controller;
|
|
13
|
+
//# sourceMappingURL=iso-locales.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iso-locales.js","sources":["../../../server/src/controllers/iso-locales.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { getService } from '../utils';\n\nconst controller: Core.Controller = {\n listIsoLocales(ctx) {\n const isoLocalesService = getService('iso-locales');\n\n ctx.body = isoLocalesService.getIsoLocales();\n },\n};\n\nexport default controller;\n"],"names":["controller","listIsoLocales","ctx","isoLocalesService","getService","body","getIsoLocales"],"mappings":";;;;AAGA,MAAMA,UAA8B,GAAA;AAClCC,IAAAA,cAAAA,CAAAA,CAAeC,GAAG,EAAA;AAChB,QAAA,MAAMC,oBAAoBC,gBAAW,CAAA,aAAA,CAAA;QAErCF,GAAIG,CAAAA,IAAI,GAAGF,iBAAAA,CAAkBG,aAAa,EAAA;AAC5C;AACF;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getService } from '../utils/index.mjs';
|
|
2
|
+
|
|
3
|
+
const controller = {
|
|
4
|
+
listIsoLocales (ctx) {
|
|
5
|
+
const isoLocalesService = getService('iso-locales');
|
|
6
|
+
ctx.body = isoLocalesService.getIsoLocales();
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { controller as default };
|
|
11
|
+
//# sourceMappingURL=iso-locales.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iso-locales.mjs","sources":["../../../server/src/controllers/iso-locales.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { getService } from '../utils';\n\nconst controller: Core.Controller = {\n listIsoLocales(ctx) {\n const isoLocalesService = getService('iso-locales');\n\n ctx.body = isoLocalesService.getIsoLocales();\n },\n};\n\nexport default controller;\n"],"names":["controller","listIsoLocales","ctx","isoLocalesService","getService","body","getIsoLocales"],"mappings":";;AAGA,MAAMA,UAA8B,GAAA;AAClCC,IAAAA,cAAAA,CAAAA,CAAeC,GAAG,EAAA;AAChB,QAAA,MAAMC,oBAAoBC,UAAW,CAAA,aAAA,CAAA;QAErCF,GAAIG,CAAAA,IAAI,GAAGF,iBAAAA,CAAkBG,aAAa,EAAA;AAC5C;AACF;;;;"}
|