@strapi/i18n 0.0.0-next.973df62640087231761ffaeb1c2b5d0d706346d8 → 0.0.0-next.9c630ba4333dffc2c1c8150d9226dfbb67b02e09

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.
Files changed (458) hide show
  1. package/dist/admin/components/BulkLocaleActionModal.js +262 -0
  2. package/dist/admin/components/BulkLocaleActionModal.js.map +1 -0
  3. package/dist/admin/components/BulkLocaleActionModal.mjs +260 -0
  4. package/dist/admin/components/BulkLocaleActionModal.mjs.map +1 -0
  5. package/dist/admin/components/CMHeaderActions.js +957 -0
  6. package/dist/admin/components/CMHeaderActions.js.map +1 -0
  7. package/dist/admin/components/CMHeaderActions.mjs +931 -0
  8. package/dist/admin/components/CMHeaderActions.mjs.map +1 -0
  9. package/dist/admin/components/CMListViewModalsAdditionalInformation.js +69 -0
  10. package/dist/admin/components/CMListViewModalsAdditionalInformation.js.map +1 -0
  11. package/dist/admin/components/CMListViewModalsAdditionalInformation.mjs +65 -0
  12. package/dist/admin/components/CMListViewModalsAdditionalInformation.mjs.map +1 -0
  13. package/dist/admin/components/CheckboxConfirmation.js +155 -0
  14. package/dist/admin/components/CheckboxConfirmation.js.map +1 -0
  15. package/dist/admin/components/CheckboxConfirmation.mjs +134 -0
  16. package/dist/admin/components/CheckboxConfirmation.mjs.map +1 -0
  17. package/dist/admin/components/CreateLocale.js +395 -0
  18. package/dist/admin/components/CreateLocale.js.map +1 -0
  19. package/dist/admin/components/CreateLocale.mjs +369 -0
  20. package/dist/admin/components/CreateLocale.mjs.map +1 -0
  21. package/dist/admin/components/DeleteLocale.js +90 -0
  22. package/dist/admin/components/DeleteLocale.js.map +1 -0
  23. package/dist/admin/components/DeleteLocale.mjs +69 -0
  24. package/dist/admin/components/DeleteLocale.mjs.map +1 -0
  25. package/dist/admin/components/EditLocale.js +212 -0
  26. package/dist/admin/components/EditLocale.js.map +1 -0
  27. package/dist/admin/components/EditLocale.mjs +190 -0
  28. package/dist/admin/components/EditLocale.mjs.map +1 -0
  29. package/dist/admin/components/LocaleListCell.js +102 -0
  30. package/dist/admin/components/LocaleListCell.js.map +1 -0
  31. package/dist/admin/components/LocaleListCell.mjs +100 -0
  32. package/dist/admin/components/LocaleListCell.mjs.map +1 -0
  33. package/dist/admin/components/LocalePicker.js +105 -0
  34. package/dist/admin/components/LocalePicker.js.map +1 -0
  35. package/dist/admin/components/LocalePicker.mjs +84 -0
  36. package/dist/admin/components/LocalePicker.mjs.map +1 -0
  37. package/dist/admin/components/LocaleTable.js +143 -0
  38. package/dist/admin/components/LocaleTable.js.map +1 -0
  39. package/dist/admin/components/LocaleTable.mjs +122 -0
  40. package/dist/admin/components/LocaleTable.mjs.map +1 -0
  41. package/dist/admin/constants.js +37 -0
  42. package/dist/admin/constants.js.map +1 -0
  43. package/dist/admin/constants.mjs +35 -0
  44. package/dist/admin/constants.mjs.map +1 -0
  45. package/dist/admin/contentManagerHooks/editView.js +109 -0
  46. package/dist/admin/contentManagerHooks/editView.js.map +1 -0
  47. package/dist/admin/contentManagerHooks/editView.mjs +88 -0
  48. package/dist/admin/contentManagerHooks/editView.mjs.map +1 -0
  49. package/dist/admin/contentManagerHooks/listView.js +44 -0
  50. package/dist/admin/contentManagerHooks/listView.js.map +1 -0
  51. package/dist/admin/contentManagerHooks/listView.mjs +42 -0
  52. package/dist/admin/contentManagerHooks/listView.mjs.map +1 -0
  53. package/dist/admin/contentReleasesHooks/releaseDetailsView.js +20 -0
  54. package/dist/admin/contentReleasesHooks/releaseDetailsView.js.map +1 -0
  55. package/dist/admin/contentReleasesHooks/releaseDetailsView.mjs +18 -0
  56. package/dist/admin/contentReleasesHooks/releaseDetailsView.mjs.map +1 -0
  57. package/dist/admin/hooks/useAILocalizationJobsPolling.js +110 -0
  58. package/dist/admin/hooks/useAILocalizationJobsPolling.js.map +1 -0
  59. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs +89 -0
  60. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs.map +1 -0
  61. package/dist/admin/hooks/useI18n.js +78 -0
  62. package/dist/admin/hooks/useI18n.js.map +1 -0
  63. package/dist/admin/hooks/useI18n.mjs +57 -0
  64. package/dist/admin/hooks/useI18n.mjs.map +1 -0
  65. package/dist/admin/index.js +226 -5
  66. package/dist/admin/index.js.map +1 -1
  67. package/dist/admin/index.mjs +202 -5
  68. package/dist/admin/index.mjs.map +1 -1
  69. package/dist/admin/middlewares/extendCTBAttributeInitialData.js +71 -0
  70. package/dist/admin/middlewares/extendCTBAttributeInitialData.js.map +1 -0
  71. package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs +69 -0
  72. package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs.map +1 -0
  73. package/dist/admin/middlewares/extendCTBInitialData.js +40 -0
  74. package/dist/admin/middlewares/extendCTBInitialData.js.map +1 -0
  75. package/dist/admin/middlewares/extendCTBInitialData.mjs +38 -0
  76. package/dist/admin/middlewares/extendCTBInitialData.mjs.map +1 -0
  77. package/dist/admin/middlewares/rbac-middleware.js +49 -0
  78. package/dist/admin/middlewares/rbac-middleware.js.map +1 -0
  79. package/dist/admin/middlewares/rbac-middleware.mjs +28 -0
  80. package/dist/admin/middlewares/rbac-middleware.mjs.map +1 -0
  81. package/dist/admin/pages/SettingsPage.js +182 -0
  82. package/dist/admin/pages/SettingsPage.js.map +1 -0
  83. package/dist/admin/pages/SettingsPage.mjs +179 -0
  84. package/dist/admin/pages/SettingsPage.mjs.map +1 -0
  85. package/dist/admin/pluginId.js +6 -0
  86. package/dist/admin/pluginId.js.map +1 -0
  87. package/dist/admin/pluginId.mjs +4 -0
  88. package/dist/admin/pluginId.mjs.map +1 -0
  89. package/dist/admin/services/aiLocalizationJobs.js +26 -0
  90. package/dist/admin/services/aiLocalizationJobs.js.map +1 -0
  91. package/dist/admin/services/aiLocalizationJobs.mjs +24 -0
  92. package/dist/admin/services/aiLocalizationJobs.mjs.map +1 -0
  93. package/dist/admin/services/api.js +15 -0
  94. package/dist/admin/services/api.js.map +1 -0
  95. package/dist/admin/services/api.mjs +13 -0
  96. package/dist/admin/services/api.mjs.map +1 -0
  97. package/dist/admin/services/locales.js +72 -0
  98. package/dist/admin/services/locales.js.map +1 -0
  99. package/dist/admin/services/locales.mjs +66 -0
  100. package/dist/admin/services/locales.mjs.map +1 -0
  101. package/dist/admin/services/relations.js +23 -0
  102. package/dist/admin/services/relations.js.map +1 -0
  103. package/dist/admin/services/relations.mjs +21 -0
  104. package/dist/admin/services/relations.mjs.map +1 -0
  105. package/dist/admin/services/settings.js +29 -0
  106. package/dist/admin/services/settings.js.map +1 -0
  107. package/dist/admin/services/settings.mjs +26 -0
  108. package/dist/admin/services/settings.mjs.map +1 -0
  109. package/dist/admin/src/components/CMHeaderActions.d.ts +18 -5
  110. package/dist/admin/src/components/LocaleListCell.d.ts +5 -4
  111. package/dist/admin/src/components/tests/CreateLocale.test.d.ts +1 -0
  112. package/dist/admin/src/components/tests/DeleteLocale.test.d.ts +1 -0
  113. package/dist/admin/src/components/tests/EditLocale.test.d.ts +1 -0
  114. package/dist/admin/src/components/tests/LocaleListCell.test.d.ts +1 -0
  115. package/dist/admin/src/contentReleasesHooks/releaseDetailsView.d.ts +1 -1
  116. package/dist/admin/src/hooks/useAILocalizationJobsPolling.d.ts +9 -0
  117. package/dist/admin/src/pages/tests/SettingsPage.test.d.ts +1 -0
  118. package/dist/admin/src/services/aiLocalizationJobs.d.ts +6 -0
  119. package/dist/admin/src/services/api.d.ts +1 -1
  120. package/dist/admin/src/services/locales.d.ts +1 -1
  121. package/dist/admin/src/services/relations.d.ts +1 -1
  122. package/dist/admin/src/services/settings.d.ts +5 -0
  123. package/dist/admin/src/utils/schemas.d.ts +642 -16
  124. package/dist/admin/tests/server.d.ts +1 -0
  125. package/dist/admin/tests/utils.d.ts +6 -0
  126. package/dist/admin/translations/de.json.js +66 -0
  127. package/dist/admin/translations/de.json.js.map +1 -0
  128. package/dist/admin/translations/de.json.mjs +64 -0
  129. package/dist/admin/translations/de.json.mjs.map +1 -0
  130. package/dist/admin/translations/dk.json.js +66 -0
  131. package/dist/admin/translations/dk.json.js.map +1 -0
  132. package/dist/admin/translations/dk.json.mjs +64 -0
  133. package/dist/admin/translations/dk.json.mjs.map +1 -0
  134. package/dist/admin/translations/en.json.js +91 -0
  135. package/dist/admin/translations/en.json.js.map +1 -0
  136. package/dist/admin/translations/en.json.mjs +89 -0
  137. package/dist/admin/translations/en.json.mjs.map +1 -0
  138. package/dist/admin/translations/es.json.js +66 -0
  139. package/dist/admin/translations/es.json.js.map +1 -0
  140. package/dist/admin/translations/es.json.mjs +64 -0
  141. package/dist/admin/translations/es.json.mjs.map +1 -0
  142. package/dist/admin/translations/fr.json.js +66 -0
  143. package/dist/admin/translations/fr.json.js.map +1 -0
  144. package/dist/admin/translations/fr.json.mjs +64 -0
  145. package/dist/admin/translations/fr.json.mjs.map +1 -0
  146. package/dist/admin/translations/ko.json.js +65 -0
  147. package/dist/admin/translations/ko.json.js.map +1 -0
  148. package/dist/admin/translations/ko.json.mjs +63 -0
  149. package/dist/admin/translations/ko.json.mjs.map +1 -0
  150. package/dist/admin/translations/pl.json.js +66 -0
  151. package/dist/admin/translations/pl.json.js.map +1 -0
  152. package/dist/admin/translations/pl.json.mjs +64 -0
  153. package/dist/admin/translations/pl.json.mjs.map +1 -0
  154. package/dist/admin/translations/ru.json.js +68 -0
  155. package/dist/admin/translations/ru.json.js.map +1 -0
  156. package/dist/admin/translations/ru.json.mjs +66 -0
  157. package/dist/admin/translations/ru.json.mjs.map +1 -0
  158. package/dist/admin/translations/tr.json.js +66 -0
  159. package/dist/admin/translations/tr.json.js.map +1 -0
  160. package/dist/admin/translations/tr.json.mjs +64 -0
  161. package/dist/admin/translations/tr.json.mjs.map +1 -0
  162. package/dist/admin/translations/uk.json.js +82 -0
  163. package/dist/admin/translations/uk.json.js.map +1 -0
  164. package/dist/admin/translations/uk.json.mjs +80 -0
  165. package/dist/admin/translations/uk.json.mjs.map +1 -0
  166. package/dist/admin/translations/zh-Hans.json.js +57 -0
  167. package/dist/admin/translations/zh-Hans.json.js.map +1 -0
  168. package/dist/admin/translations/zh-Hans.json.mjs +55 -0
  169. package/dist/admin/translations/zh-Hans.json.mjs.map +1 -0
  170. package/dist/admin/translations/zh.json.js +66 -0
  171. package/dist/admin/translations/zh.json.js.map +1 -0
  172. package/dist/admin/translations/zh.json.mjs +64 -0
  173. package/dist/admin/translations/zh.json.mjs.map +1 -0
  174. package/dist/admin/utils/baseQuery.js +8 -0
  175. package/dist/admin/utils/baseQuery.js.map +1 -0
  176. package/dist/admin/utils/baseQuery.mjs +6 -0
  177. package/dist/admin/utils/baseQuery.mjs.map +1 -0
  178. package/dist/admin/utils/clean.js +70 -0
  179. package/dist/admin/utils/clean.js.map +1 -0
  180. package/dist/admin/utils/clean.mjs +68 -0
  181. package/dist/admin/utils/clean.mjs.map +1 -0
  182. package/dist/admin/utils/fields.js +34 -0
  183. package/dist/admin/utils/fields.js.map +1 -0
  184. package/dist/admin/utils/fields.mjs +31 -0
  185. package/dist/admin/utils/fields.mjs.map +1 -0
  186. package/dist/admin/utils/getTranslation.js +8 -0
  187. package/dist/admin/utils/getTranslation.js.map +1 -0
  188. package/dist/admin/utils/getTranslation.mjs +6 -0
  189. package/dist/admin/utils/getTranslation.mjs.map +1 -0
  190. package/dist/admin/utils/prefixPluginTranslations.js +11 -0
  191. package/dist/admin/utils/prefixPluginTranslations.js.map +1 -0
  192. package/dist/admin/utils/prefixPluginTranslations.mjs +9 -0
  193. package/dist/admin/utils/prefixPluginTranslations.mjs.map +1 -0
  194. package/dist/admin/utils/schemas.js +74 -0
  195. package/dist/admin/utils/schemas.js.map +1 -0
  196. package/dist/admin/utils/schemas.mjs +72 -0
  197. package/dist/admin/utils/schemas.mjs.map +1 -0
  198. package/dist/admin/utils/strings.js +6 -0
  199. package/dist/admin/utils/strings.js.map +1 -0
  200. package/dist/admin/utils/strings.mjs +4 -0
  201. package/dist/admin/utils/strings.mjs.map +1 -0
  202. package/dist/server/bootstrap.js +81 -0
  203. package/dist/server/bootstrap.js.map +1 -0
  204. package/dist/server/bootstrap.mjs +79 -0
  205. package/dist/server/bootstrap.mjs.map +1 -0
  206. package/dist/server/constants/index.js +29 -0
  207. package/dist/server/constants/index.js.map +1 -0
  208. package/dist/server/constants/index.mjs +25 -0
  209. package/dist/server/constants/index.mjs.map +1 -0
  210. package/dist/server/constants/iso-locales.json.js +2427 -0
  211. package/dist/server/constants/iso-locales.json.js.map +1 -0
  212. package/dist/server/constants/iso-locales.json.mjs +2425 -0
  213. package/dist/server/constants/iso-locales.json.mjs.map +1 -0
  214. package/dist/server/content-types/index.js +10 -0
  215. package/dist/server/content-types/index.js.map +1 -0
  216. package/dist/server/content-types/index.mjs +8 -0
  217. package/dist/server/content-types/index.mjs.map +1 -0
  218. package/dist/server/content-types/locale/index.js +10 -0
  219. package/dist/server/content-types/locale/index.js.map +1 -0
  220. package/dist/server/content-types/locale/index.mjs +8 -0
  221. package/dist/server/content-types/locale/index.mjs.map +1 -0
  222. package/dist/server/content-types/locale/schema.json.js +46 -0
  223. package/dist/server/content-types/locale/schema.json.js.map +1 -0
  224. package/dist/server/content-types/locale/schema.json.mjs +38 -0
  225. package/dist/server/content-types/locale/schema.json.mjs.map +1 -0
  226. package/dist/server/controllers/ai-localization-jobs.js +47 -0
  227. package/dist/server/controllers/ai-localization-jobs.js.map +1 -0
  228. package/dist/server/controllers/ai-localization-jobs.mjs +45 -0
  229. package/dist/server/controllers/ai-localization-jobs.mjs.map +1 -0
  230. package/dist/server/controllers/content-types.js +76 -0
  231. package/dist/server/controllers/content-types.js.map +1 -0
  232. package/dist/server/controllers/content-types.mjs +74 -0
  233. package/dist/server/controllers/content-types.mjs.map +1 -0
  234. package/dist/server/controllers/index.js +18 -0
  235. package/dist/server/controllers/index.js.map +1 -0
  236. package/dist/server/controllers/index.mjs +16 -0
  237. package/dist/server/controllers/index.mjs.map +1 -0
  238. package/dist/server/controllers/iso-locales.js +13 -0
  239. package/dist/server/controllers/iso-locales.js.map +1 -0
  240. package/dist/server/controllers/iso-locales.mjs +11 -0
  241. package/dist/server/controllers/iso-locales.mjs.map +1 -0
  242. package/dist/server/controllers/locales.js +108 -0
  243. package/dist/server/controllers/locales.js.map +1 -0
  244. package/dist/server/controllers/locales.mjs +87 -0
  245. package/dist/server/controllers/locales.mjs.map +1 -0
  246. package/dist/server/controllers/settings.js +24 -0
  247. package/dist/server/controllers/settings.js.map +1 -0
  248. package/dist/server/controllers/settings.mjs +22 -0
  249. package/dist/server/controllers/settings.mjs.map +1 -0
  250. package/dist/server/controllers/validate-locale-creation.js +47 -0
  251. package/dist/server/controllers/validate-locale-creation.js.map +1 -0
  252. package/dist/server/controllers/validate-locale-creation.mjs +45 -0
  253. package/dist/server/controllers/validate-locale-creation.mjs.map +1 -0
  254. package/dist/server/domain/locale.js +11 -0
  255. package/dist/server/domain/locale.js.map +1 -0
  256. package/dist/server/domain/locale.mjs +9 -0
  257. package/dist/server/domain/locale.mjs.map +1 -0
  258. package/dist/server/graphql.js +115 -0
  259. package/dist/server/graphql.js.map +1 -0
  260. package/dist/server/graphql.mjs +113 -0
  261. package/dist/server/graphql.mjs.map +1 -0
  262. package/dist/server/index.js +18 -3453
  263. package/dist/server/index.js.map +1 -1
  264. package/dist/server/index.mjs +17 -3435
  265. package/dist/server/index.mjs.map +1 -1
  266. package/dist/server/models/ai-localization-job.js +60 -0
  267. package/dist/server/models/ai-localization-job.js.map +1 -0
  268. package/dist/server/models/ai-localization-job.mjs +57 -0
  269. package/dist/server/models/ai-localization-job.mjs.map +1 -0
  270. package/dist/server/register.js +81 -0
  271. package/dist/server/register.js.map +1 -0
  272. package/dist/server/register.mjs +79 -0
  273. package/dist/server/register.mjs.map +1 -0
  274. package/dist/server/routes/admin.js +142 -0
  275. package/dist/server/routes/admin.js.map +1 -0
  276. package/dist/server/routes/admin.mjs +140 -0
  277. package/dist/server/routes/admin.mjs.map +1 -0
  278. package/dist/server/routes/content-api.js +19 -0
  279. package/dist/server/routes/content-api.js.map +1 -0
  280. package/dist/server/routes/content-api.mjs +17 -0
  281. package/dist/server/routes/content-api.mjs.map +1 -0
  282. package/dist/server/routes/index.js +12 -0
  283. package/dist/server/routes/index.js.map +1 -0
  284. package/dist/server/routes/index.mjs +10 -0
  285. package/dist/server/routes/index.mjs.map +1 -0
  286. package/dist/server/routes/validation/locale.js +57 -0
  287. package/dist/server/routes/validation/locale.js.map +1 -0
  288. package/dist/server/routes/validation/locale.mjs +36 -0
  289. package/dist/server/routes/validation/locale.mjs.map +1 -0
  290. package/dist/server/services/ai-localization-jobs.js +64 -0
  291. package/dist/server/services/ai-localization-jobs.js.map +1 -0
  292. package/dist/server/services/ai-localization-jobs.mjs +62 -0
  293. package/dist/server/services/ai-localization-jobs.mjs.map +1 -0
  294. package/dist/server/services/ai-localizations.js +272 -0
  295. package/dist/server/services/ai-localizations.js.map +1 -0
  296. package/dist/server/services/ai-localizations.mjs +270 -0
  297. package/dist/server/services/ai-localizations.mjs.map +1 -0
  298. package/dist/server/services/content-types.js +157 -0
  299. package/dist/server/services/content-types.js.map +1 -0
  300. package/dist/server/services/content-types.mjs +155 -0
  301. package/dist/server/services/content-types.mjs.map +1 -0
  302. package/dist/server/services/index.js +28 -0
  303. package/dist/server/services/index.js.map +1 -0
  304. package/dist/server/services/index.mjs +26 -0
  305. package/dist/server/services/index.mjs.map +1 -0
  306. package/dist/server/services/iso-locales.js +12 -0
  307. package/dist/server/services/iso-locales.js.map +1 -0
  308. package/dist/server/services/iso-locales.mjs +10 -0
  309. package/dist/server/services/iso-locales.mjs.map +1 -0
  310. package/dist/server/services/locales.js +114 -0
  311. package/dist/server/services/locales.js.map +1 -0
  312. package/dist/server/services/locales.mjs +112 -0
  313. package/dist/server/services/locales.mjs.map +1 -0
  314. package/dist/server/services/localizations.js +68 -0
  315. package/dist/server/services/localizations.js.map +1 -0
  316. package/dist/server/services/localizations.mjs +66 -0
  317. package/dist/server/services/localizations.mjs.map +1 -0
  318. package/dist/server/services/metrics.js +30 -0
  319. package/dist/server/services/metrics.js.map +1 -0
  320. package/dist/server/services/metrics.mjs +28 -0
  321. package/dist/server/services/metrics.mjs.map +1 -0
  322. package/dist/server/services/permissions/actions.js +136 -0
  323. package/dist/server/services/permissions/actions.js.map +1 -0
  324. package/dist/server/services/permissions/actions.mjs +134 -0
  325. package/dist/server/services/permissions/actions.mjs.map +1 -0
  326. package/dist/server/services/permissions/engine.js +52 -0
  327. package/dist/server/services/permissions/engine.js.map +1 -0
  328. package/dist/server/services/permissions/engine.mjs +50 -0
  329. package/dist/server/services/permissions/engine.mjs.map +1 -0
  330. package/dist/server/services/permissions/sections-builder.js +45 -0
  331. package/dist/server/services/permissions/sections-builder.js.map +1 -0
  332. package/dist/server/services/permissions/sections-builder.mjs +43 -0
  333. package/dist/server/services/permissions/sections-builder.mjs.map +1 -0
  334. package/dist/server/services/permissions.js +14 -0
  335. package/dist/server/services/permissions.js.map +1 -0
  336. package/dist/server/services/permissions.mjs +12 -0
  337. package/dist/server/services/permissions.mjs.map +1 -0
  338. package/dist/server/services/sanitize/index.js +34 -0
  339. package/dist/server/services/sanitize/index.js.map +1 -0
  340. package/dist/server/services/sanitize/index.mjs +32 -0
  341. package/dist/server/services/sanitize/index.mjs.map +1 -0
  342. package/dist/server/services/settings.js +25 -0
  343. package/dist/server/services/settings.js.map +1 -0
  344. package/dist/server/services/settings.mjs +23 -0
  345. package/dist/server/services/settings.mjs.map +1 -0
  346. package/dist/server/src/bootstrap.d.ts.map +1 -1
  347. package/dist/server/src/controllers/ai-localization-jobs.d.ts +17 -0
  348. package/dist/server/src/controllers/ai-localization-jobs.d.ts.map +1 -0
  349. package/dist/server/src/controllers/index.d.ts +10 -0
  350. package/dist/server/src/controllers/index.d.ts.map +1 -1
  351. package/dist/server/src/controllers/settings.d.ts +7 -0
  352. package/dist/server/src/controllers/settings.d.ts.map +1 -0
  353. package/dist/server/src/index.d.ts +47 -8
  354. package/dist/server/src/index.d.ts.map +1 -1
  355. package/dist/server/src/models/ai-localization-job.d.ts +5 -0
  356. package/dist/server/src/models/ai-localization-job.d.ts.map +1 -0
  357. package/dist/server/src/models/index.d.ts +5 -0
  358. package/dist/server/src/models/index.d.ts.map +1 -0
  359. package/dist/server/src/register.d.ts +1 -1
  360. package/dist/server/src/register.d.ts.map +1 -1
  361. package/dist/server/src/routes/admin.d.ts.map +1 -1
  362. package/dist/server/src/routes/content-api.d.ts +5 -8
  363. package/dist/server/src/routes/content-api.d.ts.map +1 -1
  364. package/dist/server/src/routes/index.d.ts +3 -7
  365. package/dist/server/src/routes/index.d.ts.map +1 -1
  366. package/dist/server/src/routes/validation/index.d.ts +2 -0
  367. package/dist/server/src/routes/validation/index.d.ts.map +1 -0
  368. package/dist/server/src/routes/validation/locale.d.ts +41 -0
  369. package/dist/server/src/routes/validation/locale.d.ts.map +1 -0
  370. package/dist/server/src/services/ai-localization-jobs.d.ts +26 -0
  371. package/dist/server/src/services/ai-localization-jobs.d.ts.map +1 -0
  372. package/dist/server/src/services/ai-localizations.d.ts +18 -0
  373. package/dist/server/src/services/ai-localizations.d.ts.map +1 -0
  374. package/dist/server/src/services/index.d.ts +33 -0
  375. package/dist/server/src/services/index.d.ts.map +1 -1
  376. package/dist/server/src/services/localizations.d.ts +1 -1
  377. package/dist/server/src/services/localizations.d.ts.map +1 -1
  378. package/dist/server/src/services/settings.d.ts +13 -0
  379. package/dist/server/src/services/settings.d.ts.map +1 -0
  380. package/dist/server/src/utils/index.d.ts +7 -1
  381. package/dist/server/src/utils/index.d.ts.map +1 -1
  382. package/dist/server/src/validation/settings.d.ts +12 -0
  383. package/dist/server/src/validation/settings.d.ts.map +1 -0
  384. package/dist/server/utils/index.js +16 -0
  385. package/dist/server/utils/index.js.map +1 -0
  386. package/dist/server/utils/index.mjs +13 -0
  387. package/dist/server/utils/index.mjs.map +1 -0
  388. package/dist/server/validation/content-types.js +18 -0
  389. package/dist/server/validation/content-types.js.map +1 -0
  390. package/dist/server/validation/content-types.mjs +16 -0
  391. package/dist/server/validation/content-types.mjs.map +1 -0
  392. package/dist/server/validation/locales.js +23 -0
  393. package/dist/server/validation/locales.js.map +1 -0
  394. package/dist/server/validation/locales.mjs +20 -0
  395. package/dist/server/validation/locales.mjs.map +1 -0
  396. package/dist/server/validation/settings.js +11 -0
  397. package/dist/server/validation/settings.js.map +1 -0
  398. package/dist/server/validation/settings.mjs +9 -0
  399. package/dist/server/validation/settings.mjs.map +1 -0
  400. package/dist/shared/contracts/ai-localization-jobs.d.ts +27 -0
  401. package/dist/shared/contracts/ai-localization-jobs.d.ts.map +1 -0
  402. package/dist/shared/contracts/content-manager.d.ts +1 -1
  403. package/dist/shared/contracts/settings.d.ts +40 -0
  404. package/dist/shared/contracts/shared.d.ts +1 -1
  405. package/dist/shared/contracts/shared.d.ts.map +1 -0
  406. package/package.json +21 -16
  407. package/dist/_chunks/SettingsPage-D0hqaut-.js +0 -574
  408. package/dist/_chunks/SettingsPage-D0hqaut-.js.map +0 -1
  409. package/dist/_chunks/SettingsPage-D67CaQAB.mjs +0 -554
  410. package/dist/_chunks/SettingsPage-D67CaQAB.mjs.map +0 -1
  411. package/dist/_chunks/de-9eCAqqrB.mjs +0 -66
  412. package/dist/_chunks/de-9eCAqqrB.mjs.map +0 -1
  413. package/dist/_chunks/de-DtWiGdHl.js +0 -66
  414. package/dist/_chunks/de-DtWiGdHl.js.map +0 -1
  415. package/dist/_chunks/dk-2qBjxt-P.mjs +0 -66
  416. package/dist/_chunks/dk-2qBjxt-P.mjs.map +0 -1
  417. package/dist/_chunks/dk-D8C-casx.js +0 -66
  418. package/dist/_chunks/dk-D8C-casx.js.map +0 -1
  419. package/dist/_chunks/en-BKBz3tro.js +0 -81
  420. package/dist/_chunks/en-BKBz3tro.js.map +0 -1
  421. package/dist/_chunks/en-DlXfy6Gy.mjs +0 -81
  422. package/dist/_chunks/en-DlXfy6Gy.mjs.map +0 -1
  423. package/dist/_chunks/es-DS-XFGSw.js +0 -66
  424. package/dist/_chunks/es-DS-XFGSw.js.map +0 -1
  425. package/dist/_chunks/es-DlmMVaBG.mjs +0 -66
  426. package/dist/_chunks/es-DlmMVaBG.mjs.map +0 -1
  427. package/dist/_chunks/fr-3S6ke71d.mjs +0 -66
  428. package/dist/_chunks/fr-3S6ke71d.mjs.map +0 -1
  429. package/dist/_chunks/fr-BTjekDpq.js +0 -66
  430. package/dist/_chunks/fr-BTjekDpq.js.map +0 -1
  431. package/dist/_chunks/index-46DNtLCn.js +0 -1635
  432. package/dist/_chunks/index-46DNtLCn.js.map +0 -1
  433. package/dist/_chunks/index-CNR8i3KM.mjs +0 -1613
  434. package/dist/_chunks/index-CNR8i3KM.mjs.map +0 -1
  435. package/dist/_chunks/ko-DmcGUBQ3.js +0 -65
  436. package/dist/_chunks/ko-DmcGUBQ3.js.map +0 -1
  437. package/dist/_chunks/ko-qTjQ8IMw.mjs +0 -65
  438. package/dist/_chunks/ko-qTjQ8IMw.mjs.map +0 -1
  439. package/dist/_chunks/pl-B67TSHqT.mjs +0 -66
  440. package/dist/_chunks/pl-B67TSHqT.mjs.map +0 -1
  441. package/dist/_chunks/pl-Cn5RYonZ.js +0 -66
  442. package/dist/_chunks/pl-Cn5RYonZ.js.map +0 -1
  443. package/dist/_chunks/ru-BMBgVL3s.js +0 -68
  444. package/dist/_chunks/ru-BMBgVL3s.js.map +0 -1
  445. package/dist/_chunks/ru-hagMa57T.mjs +0 -68
  446. package/dist/_chunks/ru-hagMa57T.mjs.map +0 -1
  447. package/dist/_chunks/tr-CarUU76c.js +0 -66
  448. package/dist/_chunks/tr-CarUU76c.js.map +0 -1
  449. package/dist/_chunks/tr-Dw_jmkG-.mjs +0 -66
  450. package/dist/_chunks/tr-Dw_jmkG-.mjs.map +0 -1
  451. package/dist/_chunks/zh-57YM4amO.mjs +0 -66
  452. package/dist/_chunks/zh-57YM4amO.mjs.map +0 -1
  453. package/dist/_chunks/zh-CukOviB0.js +0 -66
  454. package/dist/_chunks/zh-CukOviB0.js.map +0 -1
  455. package/dist/_chunks/zh-Hans-DSHIXAa3.js +0 -57
  456. package/dist/_chunks/zh-Hans-DSHIXAa3.js.map +0 -1
  457. package/dist/_chunks/zh-Hans-Dyc-aR-h.mjs +0 -57
  458. package/dist/_chunks/zh-Hans-Dyc-aR-h.mjs.map +0 -1
@@ -0,0 +1,108 @@
1
+ 'use strict';
2
+
3
+ var utils = require('@strapi/utils');
4
+ var fp = require('lodash/fp');
5
+ var index = require('../utils/index.js');
6
+ var locales = require('../validation/locales.js');
7
+ var locale = require('../domain/locale.js');
8
+
9
+ function _interopNamespaceDefault(e) {
10
+ var n = Object.create(null);
11
+ if (e) {
12
+ Object.keys(e).forEach(function (k) {
13
+ if (k !== 'default') {
14
+ var d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function () { return e[k]; }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ var utils__namespace = /*#__PURE__*/_interopNamespaceDefault(utils);
27
+
28
+ const { setCreatorFields } = utils__namespace;
29
+ const { ApplicationError } = utils__namespace.errors;
30
+ const sanitizeLocale = (locale)=>{
31
+ const model = strapi.getModel('plugin::i18n.locale');
32
+ return strapi.contentAPI.sanitize.output(locale, model);
33
+ };
34
+ const controller = {
35
+ async listLocales (ctx) {
36
+ const localesService = index.getService('locales');
37
+ const locales = await localesService.find();
38
+ const sanitizedLocales = await sanitizeLocale(locales);
39
+ ctx.body = await localesService.setIsDefault(sanitizedLocales);
40
+ },
41
+ async createLocale (ctx) {
42
+ const { user } = ctx.state;
43
+ const body = ctx.request.body;
44
+ const { isDefault, ...localeToCreate } = body;
45
+ await locales.validateCreateLocaleInput(body);
46
+ const localesService = index.getService('locales');
47
+ const existingLocale = await localesService.findByCode(body.code);
48
+ if (existingLocale) {
49
+ throw new ApplicationError('This locale already exists');
50
+ }
51
+ const localeToPersist = setCreatorFields({
52
+ user
53
+ })(locale.formatLocale(localeToCreate));
54
+ const locale$1 = await localesService.create(localeToPersist);
55
+ if (isDefault) {
56
+ await localesService.setDefaultLocale(locale$1);
57
+ }
58
+ const sanitizedLocale = await sanitizeLocale(locale$1);
59
+ ctx.body = await localesService.setIsDefault(sanitizedLocale);
60
+ },
61
+ async updateLocale (ctx) {
62
+ const { user } = ctx.state;
63
+ const { id } = ctx.params;
64
+ const body = ctx.request.body;
65
+ const { isDefault, ...updates } = body;
66
+ await locales.validateUpdateLocaleInput(body);
67
+ const localesService = index.getService('locales');
68
+ const existingLocale = await localesService.findById(id);
69
+ if (!existingLocale) {
70
+ return ctx.notFound('locale.notFound');
71
+ }
72
+ const allowedParams = [
73
+ 'name'
74
+ ];
75
+ const cleanUpdates = setCreatorFields({
76
+ user,
77
+ isEdition: true
78
+ })(fp.pick(allowedParams, updates));
79
+ const updatedLocale = await localesService.update({
80
+ id
81
+ }, cleanUpdates);
82
+ if (isDefault) {
83
+ await localesService.setDefaultLocale(updatedLocale);
84
+ }
85
+ const sanitizedLocale = await sanitizeLocale(updatedLocale);
86
+ ctx.body = await localesService.setIsDefault(sanitizedLocale);
87
+ },
88
+ async deleteLocale (ctx) {
89
+ const { id } = ctx.params;
90
+ const localesService = index.getService('locales');
91
+ const existingLocale = await localesService.findById(id);
92
+ if (!existingLocale) {
93
+ return ctx.notFound('locale.notFound');
94
+ }
95
+ const defaultLocaleCode = await localesService.getDefaultLocale();
96
+ if (existingLocale.code === defaultLocaleCode) {
97
+ throw new ApplicationError('Cannot delete the default locale');
98
+ }
99
+ await localesService.delete({
100
+ id
101
+ });
102
+ const sanitizedLocale = await sanitizeLocale(existingLocale);
103
+ ctx.body = await localesService.setIsDefault(sanitizedLocale);
104
+ }
105
+ };
106
+
107
+ module.exports = controller;
108
+ //# sourceMappingURL=locales.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locales.js","sources":["../../../server/src/controllers/locales.ts"],"sourcesContent":["import * as utils from '@strapi/utils';\nimport { pick } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\nimport { getService } from '../utils';\nimport { validateCreateLocaleInput, validateUpdateLocaleInput } from '../validation/locales';\nimport { formatLocale } from '../domain/locale';\n\nconst { setCreatorFields } = utils;\nconst { ApplicationError } = utils.errors;\n\nconst sanitizeLocale = (locale: any) => {\n const model = strapi.getModel('plugin::i18n.locale');\n\n return strapi.contentAPI.sanitize.output(locale, model);\n};\n\nconst controller: Core.Controller = {\n async listLocales(ctx) {\n const localesService = getService('locales');\n\n const locales = await localesService.find();\n const sanitizedLocales = await sanitizeLocale(locales);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocales);\n },\n\n async createLocale(ctx) {\n const { user } = ctx.state;\n const body = ctx.request.body as any;\n const { isDefault, ...localeToCreate } = body;\n\n await validateCreateLocaleInput(body);\n\n const localesService = getService('locales');\n\n const existingLocale = await localesService.findByCode(body.code);\n if (existingLocale) {\n throw new ApplicationError('This locale already exists');\n }\n\n const localeToPersist = setCreatorFields({ user })(formatLocale(localeToCreate));\n\n const locale = await localesService.create(localeToPersist);\n\n if (isDefault) {\n await localesService.setDefaultLocale(locale);\n }\n\n const sanitizedLocale = await sanitizeLocale(locale);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocale);\n },\n\n async updateLocale(ctx) {\n const { user } = ctx.state;\n const { id } = ctx.params;\n const body = ctx.request.body as any;\n const { isDefault, ...updates } = body;\n\n await validateUpdateLocaleInput(body);\n\n const localesService = getService('locales');\n\n const existingLocale = await localesService.findById(id);\n if (!existingLocale) {\n return ctx.notFound('locale.notFound');\n }\n\n const allowedParams = ['name'];\n const cleanUpdates = setCreatorFields({ user, isEdition: true })(pick(allowedParams, updates));\n\n const updatedLocale = await localesService.update({ id }, cleanUpdates);\n\n if (isDefault) {\n await localesService.setDefaultLocale(updatedLocale);\n }\n\n const sanitizedLocale = await sanitizeLocale(updatedLocale);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocale);\n },\n\n async deleteLocale(ctx) {\n const { id } = ctx.params;\n\n const localesService = getService('locales');\n\n const existingLocale = await localesService.findById(id);\n if (!existingLocale) {\n return ctx.notFound('locale.notFound');\n }\n\n const defaultLocaleCode = await localesService.getDefaultLocale();\n if (existingLocale.code === defaultLocaleCode) {\n throw new ApplicationError('Cannot delete the default locale');\n }\n\n await localesService.delete({ id });\n\n const sanitizedLocale = await sanitizeLocale(existingLocale);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocale);\n },\n};\n\nexport default controller;\n"],"names":["setCreatorFields","utils","ApplicationError","errors","sanitizeLocale","locale","model","strapi","getModel","contentAPI","sanitize","output","controller","listLocales","ctx","localesService","getService","locales","find","sanitizedLocales","body","setIsDefault","createLocale","user","state","request","isDefault","localeToCreate","validateCreateLocaleInput","existingLocale","findByCode","code","localeToPersist","formatLocale","create","setDefaultLocale","sanitizedLocale","updateLocale","id","params","updates","validateUpdateLocaleInput","findById","notFound","allowedParams","cleanUpdates","isEdition","pick","updatedLocale","update","deleteLocale","defaultLocaleCode","getDefaultLocale","delete"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,gBAAAA;AAC7B,MAAM,EAAEC,gBAAgB,EAAE,GAAGD,iBAAME,MAAM;AAEzC,MAAMC,iBAAiB,CAACC,MAAAA,GAAAA;IACtB,MAAMC,KAAAA,GAAQC,MAAOC,CAAAA,QAAQ,CAAC,qBAAA,CAAA;AAE9B,IAAA,OAAOD,OAAOE,UAAU,CAACC,QAAQ,CAACC,MAAM,CAACN,MAAQC,EAAAA,KAAAA,CAAAA;AACnD,CAAA;AAEA,MAAMM,UAA8B,GAAA;AAClC,IAAA,MAAMC,aAAYC,GAAG,EAAA;AACnB,QAAA,MAAMC,iBAAiBC,gBAAW,CAAA,SAAA,CAAA;QAElC,MAAMC,OAAAA,GAAU,MAAMF,cAAAA,CAAeG,IAAI,EAAA;QACzC,MAAMC,gBAAAA,GAAmB,MAAMf,cAAea,CAAAA,OAAAA,CAAA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CAAAA,QAAQ,CAACJ,EAAAA,CAAAA;AACrD,QAAA,IAAI,CAACT,cAAgB,EAAA;YACnB,OAAOf,GAAAA,CAAI6B,QAAQ,CAAC,iBAAA,CAAA;AACtB;QAEA,MAAMQ,iBAAAA,GAAoB,MAAMpC,cAAAA,CAAeqC,gBAAgB,EAAA;QAC/D,IAAIvB,cAAAA,CAAeE,IAAI,KAAKoB,iBAAmB,EAAA;AAC7C,YAAA,MAAM,IAAIjD,gBAAiB,CAAA,kCAAA,CAAA;AAC7B;QAEA,MAAMa,cAAAA,CAAesC,MAAM,CAAC;AAAEf,YAAAA;AAAG,SAAA,CAAA;QAEjC,MAAMF,eAAAA,GAAkB,MAAMhC,cAAeyB,CAAAA,cAAAA,CAAAA;AAE7Cf,QAAAA,GAAAA,CAAIM,IAAI,GAAG,MAAML,cAAAA,CAAeM,YAAY,CAACe,eAAAA,CAAAA;AAC/C;AACF;;;;"}
@@ -0,0 +1,87 @@
1
+ import * as utils from '@strapi/utils';
2
+ import { pick } from 'lodash/fp';
3
+ import { getService } from '../utils/index.mjs';
4
+ import { validateCreateLocaleInput, validateUpdateLocaleInput } from '../validation/locales.mjs';
5
+ import { formatLocale } from '../domain/locale.mjs';
6
+
7
+ const { setCreatorFields } = utils;
8
+ const { ApplicationError } = utils.errors;
9
+ const sanitizeLocale = (locale)=>{
10
+ const model = strapi.getModel('plugin::i18n.locale');
11
+ return strapi.contentAPI.sanitize.output(locale, model);
12
+ };
13
+ const controller = {
14
+ async listLocales (ctx) {
15
+ const localesService = getService('locales');
16
+ const locales = await localesService.find();
17
+ const sanitizedLocales = await sanitizeLocale(locales);
18
+ ctx.body = await localesService.setIsDefault(sanitizedLocales);
19
+ },
20
+ async createLocale (ctx) {
21
+ const { user } = ctx.state;
22
+ const body = ctx.request.body;
23
+ const { isDefault, ...localeToCreate } = body;
24
+ await validateCreateLocaleInput(body);
25
+ const localesService = getService('locales');
26
+ const existingLocale = await localesService.findByCode(body.code);
27
+ if (existingLocale) {
28
+ throw new ApplicationError('This locale already exists');
29
+ }
30
+ const localeToPersist = setCreatorFields({
31
+ user
32
+ })(formatLocale(localeToCreate));
33
+ const locale = await localesService.create(localeToPersist);
34
+ if (isDefault) {
35
+ await localesService.setDefaultLocale(locale);
36
+ }
37
+ const sanitizedLocale = await sanitizeLocale(locale);
38
+ ctx.body = await localesService.setIsDefault(sanitizedLocale);
39
+ },
40
+ async updateLocale (ctx) {
41
+ const { user } = ctx.state;
42
+ const { id } = ctx.params;
43
+ const body = ctx.request.body;
44
+ const { isDefault, ...updates } = body;
45
+ await validateUpdateLocaleInput(body);
46
+ const localesService = getService('locales');
47
+ const existingLocale = await localesService.findById(id);
48
+ if (!existingLocale) {
49
+ return ctx.notFound('locale.notFound');
50
+ }
51
+ const allowedParams = [
52
+ 'name'
53
+ ];
54
+ const cleanUpdates = setCreatorFields({
55
+ user,
56
+ isEdition: true
57
+ })(pick(allowedParams, updates));
58
+ const updatedLocale = await localesService.update({
59
+ id
60
+ }, cleanUpdates);
61
+ if (isDefault) {
62
+ await localesService.setDefaultLocale(updatedLocale);
63
+ }
64
+ const sanitizedLocale = await sanitizeLocale(updatedLocale);
65
+ ctx.body = await localesService.setIsDefault(sanitizedLocale);
66
+ },
67
+ async deleteLocale (ctx) {
68
+ const { id } = ctx.params;
69
+ const localesService = getService('locales');
70
+ const existingLocale = await localesService.findById(id);
71
+ if (!existingLocale) {
72
+ return ctx.notFound('locale.notFound');
73
+ }
74
+ const defaultLocaleCode = await localesService.getDefaultLocale();
75
+ if (existingLocale.code === defaultLocaleCode) {
76
+ throw new ApplicationError('Cannot delete the default locale');
77
+ }
78
+ await localesService.delete({
79
+ id
80
+ });
81
+ const sanitizedLocale = await sanitizeLocale(existingLocale);
82
+ ctx.body = await localesService.setIsDefault(sanitizedLocale);
83
+ }
84
+ };
85
+
86
+ export { controller as default };
87
+ //# sourceMappingURL=locales.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locales.mjs","sources":["../../../server/src/controllers/locales.ts"],"sourcesContent":["import * as utils from '@strapi/utils';\nimport { pick } from 'lodash/fp';\nimport type { Core } from '@strapi/types';\nimport { getService } from '../utils';\nimport { validateCreateLocaleInput, validateUpdateLocaleInput } from '../validation/locales';\nimport { formatLocale } from '../domain/locale';\n\nconst { setCreatorFields } = utils;\nconst { ApplicationError } = utils.errors;\n\nconst sanitizeLocale = (locale: any) => {\n const model = strapi.getModel('plugin::i18n.locale');\n\n return strapi.contentAPI.sanitize.output(locale, model);\n};\n\nconst controller: Core.Controller = {\n async listLocales(ctx) {\n const localesService = getService('locales');\n\n const locales = await localesService.find();\n const sanitizedLocales = await sanitizeLocale(locales);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocales);\n },\n\n async createLocale(ctx) {\n const { user } = ctx.state;\n const body = ctx.request.body as any;\n const { isDefault, ...localeToCreate } = body;\n\n await validateCreateLocaleInput(body);\n\n const localesService = getService('locales');\n\n const existingLocale = await localesService.findByCode(body.code);\n if (existingLocale) {\n throw new ApplicationError('This locale already exists');\n }\n\n const localeToPersist = setCreatorFields({ user })(formatLocale(localeToCreate));\n\n const locale = await localesService.create(localeToPersist);\n\n if (isDefault) {\n await localesService.setDefaultLocale(locale);\n }\n\n const sanitizedLocale = await sanitizeLocale(locale);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocale);\n },\n\n async updateLocale(ctx) {\n const { user } = ctx.state;\n const { id } = ctx.params;\n const body = ctx.request.body as any;\n const { isDefault, ...updates } = body;\n\n await validateUpdateLocaleInput(body);\n\n const localesService = getService('locales');\n\n const existingLocale = await localesService.findById(id);\n if (!existingLocale) {\n return ctx.notFound('locale.notFound');\n }\n\n const allowedParams = ['name'];\n const cleanUpdates = setCreatorFields({ user, isEdition: true })(pick(allowedParams, updates));\n\n const updatedLocale = await localesService.update({ id }, cleanUpdates);\n\n if (isDefault) {\n await localesService.setDefaultLocale(updatedLocale);\n }\n\n const sanitizedLocale = await sanitizeLocale(updatedLocale);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocale);\n },\n\n async deleteLocale(ctx) {\n const { id } = ctx.params;\n\n const localesService = getService('locales');\n\n const existingLocale = await localesService.findById(id);\n if (!existingLocale) {\n return ctx.notFound('locale.notFound');\n }\n\n const defaultLocaleCode = await localesService.getDefaultLocale();\n if (existingLocale.code === defaultLocaleCode) {\n throw new ApplicationError('Cannot delete the default locale');\n }\n\n await localesService.delete({ id });\n\n const sanitizedLocale = await sanitizeLocale(existingLocale);\n\n ctx.body = await localesService.setIsDefault(sanitizedLocale);\n },\n};\n\nexport default controller;\n"],"names":["setCreatorFields","utils","ApplicationError","errors","sanitizeLocale","locale","model","strapi","getModel","contentAPI","sanitize","output","controller","listLocales","ctx","localesService","getService","locales","find","sanitizedLocales","body","setIsDefault","createLocale","user","state","request","isDefault","localeToCreate","validateCreateLocaleInput","existingLocale","findByCode","code","localeToPersist","formatLocale","create","setDefaultLocale","sanitizedLocale","updateLocale","id","params","updates","validateUpdateLocaleInput","findById","notFound","allowedParams","cleanUpdates","isEdition","pick","updatedLocale","update","deleteLocale","defaultLocaleCode","getDefaultLocale","delete"],"mappings":";;;;;;AAOA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,KAAAA;AAC7B,MAAM,EAAEC,gBAAgB,EAAE,GAAGD,MAAME,MAAM;AAEzC,MAAMC,iBAAiB,CAACC,MAAAA,GAAAA;IACtB,MAAMC,KAAAA,GAAQC,MAAOC,CAAAA,QAAQ,CAAC,qBAAA,CAAA;AAE9B,IAAA,OAAOD,OAAOE,UAAU,CAACC,QAAQ,CAACC,MAAM,CAACN,MAAQC,EAAAA,KAAAA,CAAAA;AACnD,CAAA;AAEA,MAAMM,UAA8B,GAAA;AAClC,IAAA,MAAMC,aAAYC,GAAG,EAAA;AACnB,QAAA,MAAMC,iBAAiBC,UAAW,CAAA,SAAA,CAAA;QAElC,MAAMC,OAAAA,GAAU,MAAMF,cAAAA,CAAeG,IAAI,EAAA;QACzC,MAAMC,gBAAAA,GAAmB,MAAMf,cA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A,MAAMd,cAAe2B,CAAAA,QAAQ,CAACJ,EAAAA,CAAAA;AACrD,QAAA,IAAI,CAACT,cAAgB,EAAA;YACnB,OAAOf,GAAAA,CAAI6B,QAAQ,CAAC,iBAAA,CAAA;AACtB;QAEA,MAAMQ,iBAAAA,GAAoB,MAAMpC,cAAAA,CAAeqC,gBAAgB,EAAA;QAC/D,IAAIvB,cAAAA,CAAeE,IAAI,KAAKoB,iBAAmB,EAAA;AAC7C,YAAA,MAAM,IAAIjD,gBAAiB,CAAA,kCAAA,CAAA;AAC7B;QAEA,MAAMa,cAAAA,CAAesC,MAAM,CAAC;AAAEf,YAAAA;AAAG,SAAA,CAAA;QAEjC,MAAMF,eAAAA,GAAkB,MAAMhC,cAAeyB,CAAAA,cAAAA,CAAAA;AAE7Cf,QAAAA,GAAAA,CAAIM,IAAI,GAAG,MAAML,cAAAA,CAAeM,YAAY,CAACe,eAAAA,CAAAA;AAC/C;AACF;;;;"}
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ var index = require('../utils/index.js');
4
+ var settings$1 = require('../validation/settings.js');
5
+
6
+ var settings = {
7
+ async updateSettings (ctx) {
8
+ const { request: { body } } = ctx;
9
+ const data = await settings$1(body);
10
+ await index.getService('settings').setSettings(data);
11
+ ctx.body = {
12
+ data
13
+ };
14
+ },
15
+ async getSettings (ctx) {
16
+ const data = await index.getService('settings').getSettings();
17
+ ctx.body = {
18
+ data
19
+ };
20
+ }
21
+ };
22
+
23
+ module.exports = settings;
24
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sources":["../../../server/src/controllers/settings.ts"],"sourcesContent":["import type { Context } from 'koa';\n\nimport { getService } from '../utils';\nimport validateSettings from '../validation/settings';\n\nexport default {\n async updateSettings(ctx: Context) {\n const {\n request: { body },\n } = ctx;\n\n const data = await validateSettings(body);\n\n await getService('settings').setSettings(data);\n\n ctx.body = { data };\n },\n\n async getSettings(ctx: Context) {\n const data = await getService('settings').getSettings();\n\n ctx.body = { data };\n },\n};\n"],"names":["updateSettings","ctx","request","body","data","validateSettings","getService","setSettings","getSettings"],"mappings":";;;;;AAKA,eAAe;AACb,IAAA,MAAMA,gBAAeC,GAAY,EAAA;AAC/B,QAAA,MAAM,EACJC,OAAS,EAAA,EAAEC,IAAI,EAAE,EAClB,GAAGF,GAAAA;QAEJ,MAAMG,IAAAA,GAAO,MAAMC,UAAiBF,CAAAA,IAAAA,CAAAA;QAEpC,MAAMG,gBAAAA,CAAW,UAAYC,CAAAA,CAAAA,WAAW,CAACH,IAAAA,CAAAA;AAEzCH,QAAAA,GAAAA,CAAIE,IAAI,GAAG;AAAEC,YAAAA;AAAK,SAAA;AACpB,KAAA;AAEA,IAAA,MAAMI,aAAYP,GAAY,EAAA;AAC5B,QAAA,MAAMG,IAAO,GAAA,MAAME,gBAAW,CAAA,UAAA,CAAA,CAAYE,WAAW,EAAA;AAErDP,QAAAA,GAAAA,CAAIE,IAAI,GAAG;AAAEC,YAAAA;AAAK,SAAA;AACpB;AACF,CAAE;;;;"}
@@ -0,0 +1,22 @@
1
+ import { getService } from '../utils/index.mjs';
2
+ import validateSettings from '../validation/settings.mjs';
3
+
4
+ var settings = {
5
+ async updateSettings (ctx) {
6
+ const { request: { body } } = ctx;
7
+ const data = await validateSettings(body);
8
+ await getService('settings').setSettings(data);
9
+ ctx.body = {
10
+ data
11
+ };
12
+ },
13
+ async getSettings (ctx) {
14
+ const data = await getService('settings').getSettings();
15
+ ctx.body = {
16
+ data
17
+ };
18
+ }
19
+ };
20
+
21
+ export { settings as default };
22
+ //# sourceMappingURL=settings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.mjs","sources":["../../../server/src/controllers/settings.ts"],"sourcesContent":["import type { Context } from 'koa';\n\nimport { getService } from '../utils';\nimport validateSettings from '../validation/settings';\n\nexport default {\n async updateSettings(ctx: Context) {\n const {\n request: { body },\n } = ctx;\n\n const data = await validateSettings(body);\n\n await getService('settings').setSettings(data);\n\n ctx.body = { data };\n },\n\n async getSettings(ctx: Context) {\n const data = await getService('settings').getSettings();\n\n ctx.body = { data };\n },\n};\n"],"names":["updateSettings","ctx","request","body","data","validateSettings","getService","setSettings","getSettings"],"mappings":";;;AAKA,eAAe;AACb,IAAA,MAAMA,gBAAeC,GAAY,EAAA;AAC/B,QAAA,MAAM,EACJC,OAAS,EAAA,EAAEC,IAAI,EAAE,EAClB,GAAGF,GAAAA;QAEJ,MAAMG,IAAAA,GAAO,MAAMC,gBAAiBF,CAAAA,IAAAA,CAAAA;QAEpC,MAAMG,UAAAA,CAAW,UAAYC,CAAAA,CAAAA,WAAW,CAACH,IAAAA,CAAAA;AAEzCH,QAAAA,GAAAA,CAAIE,IAAI,GAAG;AAAEC,YAAAA;AAAK,SAAA;AACpB,KAAA;AAEA,IAAA,MAAMI,aAAYP,GAAY,EAAA;AAC5B,QAAA,MAAMG,IAAO,GAAA,MAAME,UAAW,CAAA,UAAA,CAAA,CAAYE,WAAW,EAAA;AAErDP,QAAAA,GAAAA,CAAIE,IAAI,GAAG;AAAEC,YAAAA;AAAK,SAAA;AACpB;AACF,CAAE;;;;"}
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ var fp = require('lodash/fp');
4
+ var utils = require('@strapi/utils');
5
+ var index = require('../utils/index.js');
6
+
7
+ const { ApplicationError } = utils.errors;
8
+ // TODO: v5 if implemented in the CM => delete this middleware
9
+ const validateLocaleCreation = async (ctx, next)=>{
10
+ const { model } = ctx.params;
11
+ const { query } = ctx.request;
12
+ // Prevent empty body
13
+ if (!ctx.request.body) {
14
+ ctx.request.body = {};
15
+ }
16
+ const body = ctx.request.body;
17
+ const { getValidLocale, isLocalizedContentType } = index.getService('content-types');
18
+ const modelDef = strapi.getModel(model);
19
+ if (!isLocalizedContentType(modelDef)) {
20
+ return next();
21
+ }
22
+ // Prevent empty string locale
23
+ const locale = fp.get('locale', query) || fp.get('locale', body) || undefined;
24
+ // cleanup to avoid creating duplicates in single types
25
+ ctx.request.query = {};
26
+ let entityLocale;
27
+ try {
28
+ entityLocale = await getValidLocale(locale);
29
+ } catch (e) {
30
+ throw new ApplicationError("This locale doesn't exist");
31
+ }
32
+ body.locale = entityLocale;
33
+ if (modelDef.kind === 'singleType') {
34
+ const entity = await strapi.entityService.findMany(modelDef.uid, {
35
+ locale: entityLocale
36
+ }); // TODO: add this type to entityService
37
+ ctx.request.query.locale = body.locale;
38
+ // updating
39
+ if (entity) {
40
+ return next();
41
+ }
42
+ }
43
+ return next();
44
+ };
45
+
46
+ module.exports = validateLocaleCreation;
47
+ //# sourceMappingURL=validate-locale-creation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-locale-creation.js","sources":["../../../server/src/controllers/validate-locale-creation.ts"],"sourcesContent":["import { get } from 'lodash/fp';\nimport { errors } from '@strapi/utils';\nimport type { Core, Struct } from '@strapi/types';\nimport { getService } from '../utils';\n\nconst { ApplicationError } = errors;\n\n// TODO: v5 if implemented in the CM => delete this middleware\nconst validateLocaleCreation: Core.MiddlewareHandler = async (ctx, next) => {\n const { model } = ctx.params;\n const { query } = ctx.request;\n\n // Prevent empty body\n if (!ctx.request.body) {\n ctx.request.body = {};\n }\n\n const body = ctx.request.body as any;\n\n const { getValidLocale, isLocalizedContentType } = getService('content-types');\n\n const modelDef = strapi.getModel(model) as Struct.ContentTypeSchema;\n\n if (!isLocalizedContentType(modelDef)) {\n return next();\n }\n\n // Prevent empty string locale\n const locale = get('locale', query) || get('locale', body) || undefined;\n\n // cleanup to avoid creating duplicates in single types\n ctx.request.query = {};\n\n let entityLocale;\n try {\n entityLocale = await getValidLocale(locale);\n } catch (e) {\n throw new ApplicationError(\"This locale doesn't exist\");\n }\n\n body.locale = entityLocale;\n\n if (modelDef.kind === 'singleType') {\n const entity = await strapi.entityService.findMany(modelDef.uid, {\n locale: entityLocale,\n } as any); // TODO: add this type to entityService\n\n ctx.request.query.locale = body.locale;\n\n // updating\n if (entity) {\n return next();\n }\n }\n\n return next();\n};\n\nexport default validateLocaleCreation;\n"],"names":["ApplicationError","errors","validateLocaleCreation","ctx","next","model","params","query","request","body","getValidLocale","isLocalizedContentType","getService","modelDef","strapi","getModel","locale","get","undefined","entityLocale","e","kind","entity","entityService","findMany","uid"],"mappings":";;;;;;AAKA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,YAAAA;AAE7B;AACMC,MAAAA,sBAAAA,GAAiD,OAAOC,GAAKC,EAAAA,IAAAA,GAAAA;AACjE,IAAA,MAAM,EAAEC,KAAK,EAAE,GAAGF,IAAIG,MAAM;AAC5B,IAAA,MAAM,EAAEC,KAAK,EAAE,GAAGJ,IAAIK,OAAO;;AAG7B,IAAA,IAAI,CAACL,GAAAA,CAAIK,OAAO,CAACC,IAAI,EAAE;AACrBN,QAAAA,GAAAA,CAAIK,OAAO,CAACC,IAAI,GAAG,EAAC;AACtB;AAEA,IAAA,MAAMA,IAAON,GAAAA,GAAAA,CAAIK,OAAO,CAACC,IAAI;AAE7B,IAAA,MAAM,EAAEC,cAAc,EAAEC,sBAAsB,EAAE,GAAGC,gBAAW,CAAA,eAAA,CAAA;IAE9D,MAAMC,QAAAA,GAAWC,MAAOC,CAAAA,QAAQ,CAACV,KAAAA,CAAAA;IAEjC,IAAI,CAACM,uBAAuBE,QAAW,CAAA,EAAA;QACrC,OAAOT,IAAAA,EAAAA;AACT;;AAGA,IAAA,MAAMY,SAASC,MAAI,CAAA,QAAA,EAAUV,KAAUU,CAAAA,IAAAA,MAAAA,CAAI,UAAUR,IAASS,CAAAA,IAAAA,SAAAA;;AAG9Df,IAAAA,GAAAA,CAAIK,OAAO,CAACD,KAAK,GAAG,EAAC;IAErB,IAAIY,YAAAA;IACJ,IAAI;AACFA,QAAAA,YAAAA,GAAe,MAAMT,cAAeM,CAAAA,MAAAA,CAAAA;AACtC,KAAA,CAAE,OAAOI,CAAG,EAAA;AACV,QAAA,MAAM,IAAIpB,gBAAiB,CAAA,2BAAA,CAAA;AAC7B;AAEAS,IAAAA,IAAAA,CAAKO,MAAM,GAAGG,YAAAA;IAEd,IAAIN,QAAAA,CAASQ,IAAI,KAAK,YAAc,EAAA;QAClC,MAAMC,MAAAA,GAAS,MAAMR,MAAOS,CAAAA,aAAa,CAACC,QAAQ,CAACX,QAASY,CAAAA,GAAG,EAAE;YAC/DT,MAAQG,EAAAA;AACV,SAAA,CAAA,CAAA;AAEAhB,QAAAA,GAAAA,CAAIK,OAAO,CAACD,KAAK,CAACS,MAAM,GAAGP,KAAKO,MAAM;;AAGtC,QAAA,IAAIM,MAAQ,EAAA;YACV,OAAOlB,IAAAA,EAAAA;AACT;AACF;IAEA,OAAOA,IAAAA,EAAAA;AACT;;;;"}
@@ -0,0 +1,45 @@
1
+ import { get } from 'lodash/fp';
2
+ import { errors } from '@strapi/utils';
3
+ import { getService } from '../utils/index.mjs';
4
+
5
+ const { ApplicationError } = errors;
6
+ // TODO: v5 if implemented in the CM => delete this middleware
7
+ const validateLocaleCreation = async (ctx, next)=>{
8
+ const { model } = ctx.params;
9
+ const { query } = ctx.request;
10
+ // Prevent empty body
11
+ if (!ctx.request.body) {
12
+ ctx.request.body = {};
13
+ }
14
+ const body = ctx.request.body;
15
+ const { getValidLocale, isLocalizedContentType } = getService('content-types');
16
+ const modelDef = strapi.getModel(model);
17
+ if (!isLocalizedContentType(modelDef)) {
18
+ return next();
19
+ }
20
+ // Prevent empty string locale
21
+ const locale = get('locale', query) || get('locale', body) || undefined;
22
+ // cleanup to avoid creating duplicates in single types
23
+ ctx.request.query = {};
24
+ let entityLocale;
25
+ try {
26
+ entityLocale = await getValidLocale(locale);
27
+ } catch (e) {
28
+ throw new ApplicationError("This locale doesn't exist");
29
+ }
30
+ body.locale = entityLocale;
31
+ if (modelDef.kind === 'singleType') {
32
+ const entity = await strapi.entityService.findMany(modelDef.uid, {
33
+ locale: entityLocale
34
+ }); // TODO: add this type to entityService
35
+ ctx.request.query.locale = body.locale;
36
+ // updating
37
+ if (entity) {
38
+ return next();
39
+ }
40
+ }
41
+ return next();
42
+ };
43
+
44
+ export { validateLocaleCreation as default };
45
+ //# sourceMappingURL=validate-locale-creation.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-locale-creation.mjs","sources":["../../../server/src/controllers/validate-locale-creation.ts"],"sourcesContent":["import { get } from 'lodash/fp';\nimport { errors } from '@strapi/utils';\nimport type { Core, Struct } from '@strapi/types';\nimport { getService } from '../utils';\n\nconst { ApplicationError } = errors;\n\n// TODO: v5 if implemented in the CM => delete this middleware\nconst validateLocaleCreation: Core.MiddlewareHandler = async (ctx, next) => {\n const { model } = ctx.params;\n const { query } = ctx.request;\n\n // Prevent empty body\n if (!ctx.request.body) {\n ctx.request.body = {};\n }\n\n const body = ctx.request.body as any;\n\n const { getValidLocale, isLocalizedContentType } = getService('content-types');\n\n const modelDef = strapi.getModel(model) as Struct.ContentTypeSchema;\n\n if (!isLocalizedContentType(modelDef)) {\n return next();\n }\n\n // Prevent empty string locale\n const locale = get('locale', query) || get('locale', body) || undefined;\n\n // cleanup to avoid creating duplicates in single types\n ctx.request.query = {};\n\n let entityLocale;\n try {\n entityLocale = await getValidLocale(locale);\n } catch (e) {\n throw new ApplicationError(\"This locale doesn't exist\");\n }\n\n body.locale = entityLocale;\n\n if (modelDef.kind === 'singleType') {\n const entity = await strapi.entityService.findMany(modelDef.uid, {\n locale: entityLocale,\n } as any); // TODO: add this type to entityService\n\n ctx.request.query.locale = body.locale;\n\n // updating\n if (entity) {\n return next();\n }\n }\n\n return next();\n};\n\nexport default validateLocaleCreation;\n"],"names":["ApplicationError","errors","validateLocaleCreation","ctx","next","model","params","query","request","body","getValidLocale","isLocalizedContentType","getService","modelDef","strapi","getModel","locale","get","undefined","entityLocale","e","kind","entity","entityService","findMany","uid"],"mappings":";;;;AAKA,MAAM,EAAEA,gBAAgB,EAAE,GAAGC,MAAAA;AAE7B;AACMC,MAAAA,sBAAAA,GAAiD,OAAOC,GAAKC,EAAAA,IAAAA,GAAAA;AACjE,IAAA,MAA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M;;AAGtC,QAAA,IAAIM,MAAQ,EAAA;YACV,OAAOlB,IAAAA,EAAAA;AACT;AACF;IAEA,OAAOA,IAAAA,EAAAA;AACT;;;;"}
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const formatLocale = (locale)=>{
4
+ return {
5
+ ...locale,
6
+ name: locale.name || null
7
+ };
8
+ };
9
+
10
+ exports.formatLocale = formatLocale;
11
+ //# sourceMappingURL=locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.js","sources":["../../../server/src/domain/locale.ts"],"sourcesContent":["const formatLocale = (locale: { name: string; code: string; isDefault: boolean }) => {\n return {\n ...locale,\n name: locale.name || null,\n };\n};\n\nexport { formatLocale };\n"],"names":["formatLocale","locale","name"],"mappings":";;AAAA,MAAMA,eAAe,CAACC,MAAAA,GAAAA;IACpB,OAAO;AACL,QAAA,GAAGA,MAAM;QACTC,IAAMD,EAAAA,MAAAA,CAAOC,IAAI,IAAI;AACvB,KAAA;AACF;;;;"}
@@ -0,0 +1,9 @@
1
+ const formatLocale = (locale)=>{
2
+ return {
3
+ ...locale,
4
+ name: locale.name || null
5
+ };
6
+ };
7
+
8
+ export { formatLocale };
9
+ //# sourceMappingURL=locale.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.mjs","sources":["../../../server/src/domain/locale.ts"],"sourcesContent":["const formatLocale = (locale: { name: string; code: string; isDefault: boolean }) => {\n return {\n ...locale,\n name: locale.name || null,\n };\n};\n\nexport { formatLocale };\n"],"names":["formatLocale","locale","name"],"mappings":"AAAA,MAAMA,eAAe,CAACC,MAAAA,GAAAA;IACpB,OAAO;AACL,QAAA,GAAGA,MAAM;QACTC,IAAMD,EAAAA,MAAAA,CAAOC,IAAI,IAAI;AACvB,KAAA;AACF;;;;"}
@@ -0,0 +1,115 @@
1
+ 'use strict';
2
+
3
+ var fp = require('lodash/fp');
4
+ var utils = require('@strapi/utils');
5
+
6
+ const { ValidationError } = utils.errors;
7
+ const LOCALE_SCALAR_TYPENAME = 'I18NLocaleCode';
8
+ const LOCALE_ARG_PLUGIN_NAME = 'I18NLocaleArg';
9
+ var graphqlProvider = (({ strapi: strapi1 })=>({
10
+ register () {
11
+ const { service: getGraphQLService } = strapi1.plugin('graphql');
12
+ const { service: getI18NService } = strapi1.plugin('i18n');
13
+ const { isLocalizedContentType } = getI18NService('content-types');
14
+ const extensionService = getGraphQLService('extension');
15
+ extensionService.shadowCRUD('plugin::i18n.locale').disableMutations();
16
+ // Disable unwanted fields for localized content types
17
+ Object.entries(strapi1.contentTypes).forEach(([uid, ct])=>{
18
+ if (isLocalizedContentType(ct)) {
19
+ // Disable locale field in localized inputs
20
+ extensionService.shadowCRUD(uid).field('locale').disableInput();
21
+ // Disable localizations field in localized inputs
22
+ extensionService.shadowCRUD(uid).field('localizations').disableInput();
23
+ }
24
+ });
25
+ extensionService.use(({ nexus, typeRegistry })=>{
26
+ const i18nLocaleArgPlugin = getI18nLocaleArgPlugin({
27
+ nexus,
28
+ typeRegistry
29
+ });
30
+ const i18nLocaleScalar = getLocaleScalar({
31
+ nexus
32
+ });
33
+ return {
34
+ plugins: [
35
+ i18nLocaleArgPlugin
36
+ ],
37
+ types: [
38
+ i18nLocaleScalar
39
+ ],
40
+ resolversConfig: {
41
+ // Modify the default scope associated to find and findOne locale queries to match the actual action name
42
+ 'Query.i18NLocale': {
43
+ auth: {
44
+ scope: 'plugin::i18n.locales.listLocales'
45
+ }
46
+ },
47
+ 'Query.i18NLocales': {
48
+ auth: {
49
+ scope: 'plugin::i18n.locales.listLocales'
50
+ }
51
+ }
52
+ }
53
+ };
54
+ });
55
+ }
56
+ }));
57
+ const getLocaleScalar = ({ nexus })=>{
58
+ const { service: getI18NService } = strapi.plugin('i18n');
59
+ const locales = getI18NService('iso-locales').getIsoLocales();
60
+ return nexus.scalarType({
61
+ name: LOCALE_SCALAR_TYPENAME,
62
+ description: 'A string used to identify an i18n locale',
63
+ serialize: fp.identity,
64
+ parseValue: fp.identity,
65
+ parseLiteral (ast) {
66
+ if (ast.kind !== 'StringValue') {
67
+ throw new ValidationError('Locale cannot represent non string type');
68
+ }
69
+ const isValidLocale = ast.value === '*' || locales.find(fp.propEq('code', ast.value));
70
+ if (!isValidLocale) {
71
+ throw new ValidationError('Unknown locale supplied');
72
+ }
73
+ return ast.value;
74
+ }
75
+ });
76
+ };
77
+ const getI18nLocaleArgPlugin = ({ nexus, typeRegistry })=>{
78
+ const { service: getI18NService } = strapi.plugin('i18n');
79
+ const { isLocalizedContentType } = getI18NService('content-types');
80
+ return nexus.plugin({
81
+ name: LOCALE_ARG_PLUGIN_NAME,
82
+ onAddOutputField (config) {
83
+ // Add the locale arg to the queries on localized CTs
84
+ const { parentType } = config;
85
+ // Only target queries or mutations
86
+ if (parentType !== 'Query' && parentType !== 'Mutation') {
87
+ return;
88
+ }
89
+ let contentType;
90
+ if (config?.extensions?.strapi?.contentType) {
91
+ contentType = config.extensions.strapi.contentType;
92
+ } else {
93
+ const registryType = typeRegistry.get(config.type);
94
+ if (!registryType) {
95
+ return;
96
+ }
97
+ contentType = registryType.config.contentType;
98
+ }
99
+ // Ignore non-localized content types
100
+ if (!isLocalizedContentType(contentType)) {
101
+ return;
102
+ }
103
+ if (!config.args) {
104
+ config.args = {};
105
+ }
106
+ config.args.locale = nexus.arg({
107
+ type: LOCALE_SCALAR_TYPENAME,
108
+ description: 'The locale to use for the query'
109
+ });
110
+ }
111
+ });
112
+ };
113
+
114
+ module.exports = graphqlProvider;
115
+ //# sourceMappingURL=graphql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql.js","sources":["../../server/src/graphql.ts"],"sourcesContent":["import { propEq, identity } from 'lodash/fp';\nimport { errors } from '@strapi/utils';\nimport type { Core } from '@strapi/types';\n\nconst { ValidationError } = errors;\n\nconst LOCALE_SCALAR_TYPENAME = 'I18NLocaleCode';\nconst LOCALE_ARG_PLUGIN_NAME = 'I18NLocaleArg';\n\nexport default ({ strapi }: { strapi: Core.Strapi }) => ({\n register() {\n const { service: getGraphQLService } = strapi.plugin('graphql');\n const { service: getI18NService } = strapi.plugin('i18n');\n\n const { isLocalizedContentType } = getI18NService('content-types');\n\n const extensionService = getGraphQLService('extension');\n\n extensionService.shadowCRUD('plugin::i18n.locale').disableMutations();\n\n // Disable unwanted fields for localized content types\n Object.entries(strapi.contentTypes).forEach(([uid, ct]) => {\n if (isLocalizedContentType(ct)) {\n // Disable locale field in localized inputs\n extensionService.shadowCRUD(uid).field('locale').disableInput();\n\n // Disable localizations field in localized inputs\n extensionService.shadowCRUD(uid).field('localizations').disableInput();\n }\n });\n\n extensionService.use(({ nexus, typeRegistry }: any) => {\n const i18nLocaleArgPlugin = getI18nLocaleArgPlugin({ nexus, typeRegistry });\n const i18nLocaleScalar = getLocaleScalar({ nexus });\n return {\n plugins: [i18nLocaleArgPlugin],\n types: [i18nLocaleScalar],\n\n resolversConfig: {\n // Modify the default scope associated to find and findOne locale queries to match the actual action name\n 'Query.i18NLocale': { auth: { scope: 'plugin::i18n.locales.listLocales' } },\n 'Query.i18NLocales': { auth: { scope: 'plugin::i18n.locales.listLocales' } },\n },\n };\n });\n },\n});\n\nconst getLocaleScalar = ({ nexus }: any) => {\n const { service: getI18NService } = strapi.plugin('i18n');\n\n const locales = getI18NService('iso-locales').getIsoLocales();\n\n return nexus.scalarType({\n name: LOCALE_SCALAR_TYPENAME,\n\n description: 'A string used to identify an i18n locale',\n\n serialize: identity,\n parseValue: identity,\n\n parseLiteral(ast: any) {\n if (ast.kind !== 'StringValue') {\n throw new ValidationError('Locale cannot represent non string type');\n }\n\n const isValidLocale = ast.value === '*' || locales.find(propEq('code', ast.value));\n\n if (!isValidLocale) {\n throw new ValidationError('Unknown locale supplied');\n }\n\n return ast.value;\n },\n });\n};\n\nconst getI18nLocaleArgPlugin = ({ nexus, typeRegistry }: any) => {\n const { service: getI18NService } = strapi.plugin('i18n');\n\n const { isLocalizedContentType } = getI18NService('content-types');\n\n return nexus.plugin({\n name: LOCALE_ARG_PLUGIN_NAME,\n\n onAddOutputField(config: any) {\n // Add the locale arg to the queries on localized CTs\n\n const { parentType } = config;\n\n // Only target queries or mutations\n if (parentType !== 'Query' && parentType !== 'Mutation') {\n return;\n }\n\n let contentType;\n\n if (config?.extensions?.strapi?.contentType) {\n contentType = config.extensions.strapi.contentType;\n } else {\n const registryType = typeRegistry.get(config.type);\n\n if (!registryType) {\n return;\n }\n\n contentType = registryType.config.contentType;\n }\n\n // Ignore non-localized content types\n if (!isLocalizedContentType(contentType)) {\n return;\n }\n\n if (!config.args) {\n config.args = {};\n }\n\n config.args.locale = nexus.arg({\n type: LOCALE_SCALAR_TYPENAME,\n description: 'The locale to use for the query',\n });\n },\n });\n};\n"],"names":["ValidationError","errors","LOCALE_SCALAR_TYPENAME","LOCALE_ARG_PLUGIN_NAME","strapi","register","service","getGraphQLService","plugin","getI18NService","isLocalizedContentType","extensionService","shadowCRUD","disableMutations","Object","entries","contentTypes","forEach","uid","ct","field","disableInput","use","nexus","typeRegistry","i18nLocaleArgPlugin","getI18nLocaleArgPlugin","i18nLocaleScalar","getLocaleScalar","plugins","types","resolversConfig","auth","scope","locales","getIsoLocales","scalarType","name","description","serialize","identity","parseValue","parseLiteral","ast","kind","isValidLocale","value","find","propEq","onAddOutputField","config","parentType","contentType","extensions","registryType","get","type","args","locale","arg"],"mappings":";;;;;AAIA,MAAM,EAAEA,eAAe,EAAE,GAAGC,YAAAA;AAE5B,MAAMC,sBAAyB,GAAA,gBAAA;AAC/B,MAAMC,sBAAyB,GAAA,eAAA;AAE/B,sBAAe,CAAA,CAAC,EAAEC,QAAAA,OAAM,EAA2B,IAAM;AACvDC,QAAAA,QAAAA,CAAAA,GAAAA;AACE,YAAA,MAAM,EAAEC,OAASC,EAAAA,iBAAiB,EAAE,GAAGH,OAAAA,CAAOI,MAAM,CAAC,SAAA,CAAA;AACrD,YAAA,MAAM,EAAEF,OAASG,EAAAA,cAAc,EAAE,GAAGL,OAAAA,CAAOI,MAAM,CAAC,MAA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