@strapi/i18n 0.0.0-next.926e9af9369b89a571145e3c8fa1ce6bfd6cc0ab → 0.0.0-next.92e60e369ae0e382a5d486de347f6d286ab22987

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 +995 -0
  6. package/dist/admin/components/CMHeaderActions.js.map +1 -0
  7. package/dist/admin/components/CMHeaderActions.mjs +969 -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 +399 -0
  18. package/dist/admin/components/CreateLocale.js.map +1 -0
  19. package/dist/admin/components/CreateLocale.mjs +373 -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 +30 -0
  106. package/dist/admin/services/settings.js.map +1 -0
  107. package/dist/admin/services/settings.mjs +27 -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 +2 -1
  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 +95 -0
  203. package/dist/server/bootstrap.js.map +1 -0
  204. package/dist/server/bootstrap.mjs +93 -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 -3460
  263. package/dist/server/index.js.map +1 -1
  264. package/dist/server/index.mjs +17 -3443
  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 +268 -0
  295. package/dist/server/services/ai-localizations.js.map +1 -0
  296. package/dist/server/services/ai-localizations.mjs +266 -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 +19 -13
  407. package/dist/_chunks/SettingsPage-B-KzAqT3.mjs +0 -554
  408. package/dist/_chunks/SettingsPage-B-KzAqT3.mjs.map +0 -1
  409. package/dist/_chunks/SettingsPage-hyOi94O9.js +0 -573
  410. package/dist/_chunks/SettingsPage-hyOi94O9.js.map +0 -1
  411. package/dist/_chunks/de-BOhNX_-5.js +0 -65
  412. package/dist/_chunks/de-BOhNX_-5.js.map +0 -1
  413. package/dist/_chunks/de-D80IRBP9.mjs +0 -65
  414. package/dist/_chunks/de-D80IRBP9.mjs.map +0 -1
  415. package/dist/_chunks/dk-CJ6Zzz78.mjs +0 -65
  416. package/dist/_chunks/dk-CJ6Zzz78.mjs.map +0 -1
  417. package/dist/_chunks/dk-cjXm0p3m.js +0 -65
  418. package/dist/_chunks/dk-cjXm0p3m.js.map +0 -1
  419. package/dist/_chunks/en-BTyF7WVW.mjs +0 -80
  420. package/dist/_chunks/en-BTyF7WVW.mjs.map +0 -1
  421. package/dist/_chunks/en-UlC0jh2t.js +0 -80
  422. package/dist/_chunks/en-UlC0jh2t.js.map +0 -1
  423. package/dist/_chunks/es-V8WnPN7w.mjs +0 -65
  424. package/dist/_chunks/es-V8WnPN7w.mjs.map +0 -1
  425. package/dist/_chunks/es-hr9b_HLp.js +0 -65
  426. package/dist/_chunks/es-hr9b_HLp.js.map +0 -1
  427. package/dist/_chunks/fr-BFmBbE0H.js +0 -65
  428. package/dist/_chunks/fr-BFmBbE0H.js.map +0 -1
  429. package/dist/_chunks/fr-F94noFiV.mjs +0 -65
  430. package/dist/_chunks/fr-F94noFiV.mjs.map +0 -1
  431. package/dist/_chunks/index-BcYj5jo9.mjs +0 -1589
  432. package/dist/_chunks/index-BcYj5jo9.mjs.map +0 -1
  433. package/dist/_chunks/index-C8NzsAKp.js +0 -1610
  434. package/dist/_chunks/index-C8NzsAKp.js.map +0 -1
  435. package/dist/_chunks/ko-C40pNQ9b.js +0 -64
  436. package/dist/_chunks/ko-C40pNQ9b.js.map +0 -1
  437. package/dist/_chunks/ko-CF-P3Car.mjs +0 -64
  438. package/dist/_chunks/ko-CF-P3Car.mjs.map +0 -1
  439. package/dist/_chunks/pl-Dxr9RUmD.mjs +0 -65
  440. package/dist/_chunks/pl-Dxr9RUmD.mjs.map +0 -1
  441. package/dist/_chunks/pl-JtWBy-JQ.js +0 -65
  442. package/dist/_chunks/pl-JtWBy-JQ.js.map +0 -1
  443. package/dist/_chunks/ru-B-4sVwXN.mjs +0 -67
  444. package/dist/_chunks/ru-B-4sVwXN.mjs.map +0 -1
  445. package/dist/_chunks/ru-COSWt3Nu.js +0 -67
  446. package/dist/_chunks/ru-COSWt3Nu.js.map +0 -1
  447. package/dist/_chunks/tr-BVj1O5ch.js +0 -65
  448. package/dist/_chunks/tr-BVj1O5ch.js.map +0 -1
  449. package/dist/_chunks/tr-Ccu6Yj11.mjs +0 -65
  450. package/dist/_chunks/tr-Ccu6Yj11.mjs.map +0 -1
  451. package/dist/_chunks/zh-BIz395Ms.mjs +0 -65
  452. package/dist/_chunks/zh-BIz395Ms.mjs.map +0 -1
  453. package/dist/_chunks/zh-Hans-Bfo6_TCM.mjs +0 -56
  454. package/dist/_chunks/zh-Hans-Bfo6_TCM.mjs.map +0 -1
  455. package/dist/_chunks/zh-Hans-DIEm_EMC.js +0 -56
  456. package/dist/_chunks/zh-Hans-DIEm_EMC.js.map +0 -1
  457. package/dist/_chunks/zh-wkBPBkhc.js +0 -65
  458. package/dist/_chunks/zh-wkBPBkhc.js.map +0 -1
@@ -0,0 +1,95 @@
1
+ 'use strict';
2
+
3
+ var fp = require('lodash/fp');
4
+ var index = require('./utils/index.js');
5
+
6
+ const registerModelsHooks = ()=>{
7
+ strapi.db.lifecycles.subscribe({
8
+ models: [
9
+ 'plugin::i18n.locale'
10
+ ],
11
+ async afterCreate () {
12
+ await index.getService('permissions').actions.syncSuperAdminPermissionsWithLocales();
13
+ },
14
+ async afterDelete () {
15
+ await index.getService('permissions').actions.syncSuperAdminPermissionsWithLocales();
16
+ }
17
+ });
18
+ strapi.documents.use(async (context, next)=>{
19
+ const schema = context.contentType;
20
+ if (![
21
+ 'create',
22
+ 'update',
23
+ 'discardDraft',
24
+ 'publish'
25
+ ].includes(context.action)) {
26
+ return next();
27
+ }
28
+ if (!index.getService('content-types').isLocalizedContentType(schema)) {
29
+ return next();
30
+ }
31
+ // Build a populate array for all non localized fields within the schema
32
+ const { getNestedPopulateOfNonLocalizedAttributes, copyNonLocalizedAttributes } = index.getService('content-types');
33
+ const attributesToPopulate = getNestedPopulateOfNonLocalizedAttributes(schema.uid);
34
+ // Get original data before the update to compare what actually changed
35
+ const originalData = 'documentId' in context.params && context.params.documentId ? await strapi.db.query(schema.uid).findOne({
36
+ where: {
37
+ documentId: context.params.documentId
38
+ },
39
+ populate: attributesToPopulate
40
+ }) : null;
41
+ // Get the result of the document service action
42
+ const result = await next();
43
+ // We may not have received a result with everything populated that we need
44
+ // Use the id and populate built from non localized fields to get the full
45
+ // result
46
+ let resultID;
47
+ // TODO: fix bug where an empty array can be returned
48
+ if (Array.isArray(result?.entries) && result.entries[0]?.id) {
49
+ resultID = result.entries[0].id;
50
+ } else if (result?.id) {
51
+ resultID = result.id;
52
+ } else {
53
+ return result;
54
+ }
55
+ const populatedResult = await strapi.db.query(schema.uid).findOne({
56
+ where: {
57
+ id: resultID
58
+ },
59
+ populate: attributesToPopulate
60
+ });
61
+ const originalFields = copyNonLocalizedAttributes(schema, originalData);
62
+ const currentFields = copyNonLocalizedAttributes(schema, populatedResult);
63
+ // Only sync if there are actual changes to non-localized fields
64
+ const shouldSync = !originalData || Object.keys(currentFields).some((key)=>{
65
+ return !fp.isEqual(currentFields[key], originalFields[key]);
66
+ });
67
+ if (shouldSync) {
68
+ await index.getService('localizations').syncNonLocalizedAttributes(populatedResult, schema);
69
+ }
70
+ return result;
71
+ });
72
+ };
73
+ var bootstrap = (async ()=>{
74
+ const { sendDidInitializeEvent } = index.getService('metrics');
75
+ const { initDefaultLocale } = index.getService('locales');
76
+ const { sectionsBuilder, actions, engine } = index.getService('permissions');
77
+ // Data
78
+ await initDefaultLocale();
79
+ // Sections Builder
80
+ sectionsBuilder.registerLocalesPropertyHandler();
81
+ // Actions
82
+ await actions.registerI18nActions();
83
+ actions.registerI18nActionsHooks();
84
+ actions.updateActionsProperties();
85
+ // Engine/Permissions
86
+ engine.registerI18nPermissionsHandlers();
87
+ // Hooks & Models
88
+ registerModelsHooks();
89
+ // AI Localizations
90
+ index.getService('ai-localizations').setupMiddleware();
91
+ sendDidInitializeEvent();
92
+ });
93
+
94
+ module.exports = bootstrap;
95
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sources":["../../server/src/bootstrap.ts"],"sourcesContent":["import type { Schema } from '@strapi/types';\nimport { isEqual } from 'lodash/fp';\nimport { getService } from './utils';\n\nconst registerModelsHooks = () => {\n strapi.db.lifecycles.subscribe({\n models: ['plugin::i18n.locale'],\n\n async afterCreate() {\n await getService('permissions').actions.syncSuperAdminPermissionsWithLocales();\n },\n\n async afterDelete() {\n await getService('permissions').actions.syncSuperAdminPermissionsWithLocales();\n },\n });\n\n strapi.documents.use(async (context, next) => {\n const schema: Schema.ContentType = context.contentType;\n\n if (!['create', 'update', 'discardDraft', 'publish'].includes(context.action)) {\n return next();\n }\n\n if (!getService('content-types').isLocalizedContentType(schema)) {\n return next();\n }\n\n // Build a populate array for all non localized fields within the schema\n const { getNestedPopulateOfNonLocalizedAttributes, copyNonLocalizedAttributes } =\n getService('content-types');\n const attributesToPopulate = getNestedPopulateOfNonLocalizedAttributes(schema.uid);\n\n // Get original data before the update to compare what actually changed\n const originalData =\n 'documentId' in context.params && context.params.documentId\n ? await strapi.db.query(schema.uid).findOne({\n where: { documentId: context.params.documentId },\n populate: attributesToPopulate,\n })\n : null;\n\n // Get the result of the document service action\n const result = (await next()) as any;\n\n // We may not have received a result with everything populated that we need\n // Use the id and populate built from non localized fields to get the full\n // result\n let resultID;\n // TODO: fix bug where an empty array can be returned\n if (Array.isArray(result?.entries) && result.entries[0]?.id) {\n resultID = result.entries[0].id;\n } else if (result?.id) {\n resultID = result.id;\n } else {\n return result;\n }\n\n const populatedResult = await strapi.db.query(schema.uid).findOne({\n where: { id: resultID },\n populate: attributesToPopulate,\n });\n\n const originalFields = copyNonLocalizedAttributes(schema, originalData);\n const currentFields = copyNonLocalizedAttributes(schema, populatedResult);\n\n // Only sync if there are actual changes to non-localized fields\n const shouldSync =\n !originalData ||\n Object.keys(currentFields).some((key) => {\n return !isEqual(currentFields[key], originalFields[key]);\n });\n\n if (shouldSync) {\n await getService('localizations').syncNonLocalizedAttributes(populatedResult, schema);\n }\n\n return result;\n });\n};\n\nexport default async () => {\n const { sendDidInitializeEvent } = getService('metrics');\n const { initDefaultLocale } = getService('locales');\n const { sectionsBuilder, actions, engine } = getService('permissions');\n\n // Data\n await initDefaultLocale();\n\n // Sections Builder\n sectionsBuilder.registerLocalesPropertyHandler();\n\n // Actions\n await actions.registerI18nActions();\n actions.registerI18nActionsHooks();\n actions.updateActionsProperties();\n\n // Engine/Permissions\n engine.registerI18nPermissionsHandlers();\n\n // Hooks & Models\n registerModelsHooks();\n\n // AI Localizations\n getService('ai-localizations').setupMiddleware();\n\n sendDidInitializeEvent();\n};\n"],"names":["registerModelsHooks","strapi","db","lifecycles","subscribe","models","afterCreate","getService","actions","syncSuperAdminPermissionsWithLocales","afterDelete","documents","use","context","next","schema","contentType","includes","action","isLocalizedContentType","getNestedPopulateOfNonLocalizedAttributes","copyNonLocalizedAttributes","attributesToPopulate","uid","originalData","params","documentId","query","findOne","where","populate","result","resultID","Array","isArray","entries","id","populatedResult","originalFields","currentFields","shouldSync","Object","keys","some","key","isEqual","syncNonLocalizedAttributes","sendDidInitializeEvent","initDefaultLocale","sectionsBuilder","engine","registerLocalesPropertyHandler","registerI18nActions","registerI18nActionsHooks","updateActionsProperties","registerI18nPermissionsHandlers","setupMiddleware"],"mappings":";;;;;AAIA,MAAMA,mBAAsB,GAAA,IAAA;AAC1BC,IAAAA,MAAAA,CAAOC,EAAE,CAACC,UAAU,CAACC,SAAS,CAAC;QAC7BC,MAAQ,EAAA;AAAC,YAAA;AAAsB,SAAA;QAE/B,MAAMC,WAAAA,CAAAA,GAAAA;AACJ,YAAA,MAAMC,gBAAW,CAAA,aAAA,CAAA,CAAeC,OAAO,CAACC,oCAAoC,EAAA;AAC9E,SAAA;QAEA,MAAMC,WAAAA,CAAAA,GAAAA;AACJ,YAAA,MAAMH,gBAAW,CAAA,aAAA,CAAA,CAAeC,OAAO,CAACC,oCAAoC,EAAA;AAC9E;AACF,KAAA,CAAA;AAEAR,IAAAA,MAAAA,CAAOU,SAAS,CAACC,GAAG,CAAC,OAAOC,OAASC,EAAAA,IAAAA,GAAAA;QACnC,MAAMC,MAAAA,GAA6BF,QAAQG,WAAW;AAEtD,QAAA,IAAI,CAAC;AAAC,YAAA,QAAA;AAAU,YAAA,QAAA;AAAU,YAAA,cAAA;AAAgB,YAAA;AAAU,SAAA,CAACC,QAAQ,CAACJ,OAAQK,CAAAA,MAAM,CAAG,EAAA;YAC7E,OAAOJ,IAAAA,EAAAA;AACT;AAE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;;"}
@@ -0,0 +1,93 @@
1
+ import { isEqual } from 'lodash/fp';
2
+ import { getService } from './utils/index.mjs';
3
+
4
+ const registerModelsHooks = ()=>{
5
+ strapi.db.lifecycles.subscribe({
6
+ models: [
7
+ 'plugin::i18n.locale'
8
+ ],
9
+ async afterCreate () {
10
+ await getService('permissions').actions.syncSuperAdminPermissionsWithLocales();
11
+ },
12
+ async afterDelete () {
13
+ await getService('permissions').actions.syncSuperAdminPermissionsWithLocales();
14
+ }
15
+ });
16
+ strapi.documents.use(async (context, next)=>{
17
+ const schema = context.contentType;
18
+ if (![
19
+ 'create',
20
+ 'update',
21
+ 'discardDraft',
22
+ 'publish'
23
+ ].includes(context.action)) {
24
+ return next();
25
+ }
26
+ if (!getService('content-types').isLocalizedContentType(schema)) {
27
+ return next();
28
+ }
29
+ // Build a populate array for all non localized fields within the schema
30
+ const { getNestedPopulateOfNonLocalizedAttributes, copyNonLocalizedAttributes } = getService('content-types');
31
+ const attributesToPopulate = getNestedPopulateOfNonLocalizedAttributes(schema.uid);
32
+ // Get original data before the update to compare what actually changed
33
+ const originalData = 'documentId' in context.params && context.params.documentId ? await strapi.db.query(schema.uid).findOne({
34
+ where: {
35
+ documentId: context.params.documentId
36
+ },
37
+ populate: attributesToPopulate
38
+ }) : null;
39
+ // Get the result of the document service action
40
+ const result = await next();
41
+ // We may not have received a result with everything populated that we need
42
+ // Use the id and populate built from non localized fields to get the full
43
+ // result
44
+ let resultID;
45
+ // TODO: fix bug where an empty array can be returned
46
+ if (Array.isArray(result?.entries) && result.entries[0]?.id) {
47
+ resultID = result.entries[0].id;
48
+ } else if (result?.id) {
49
+ resultID = result.id;
50
+ } else {
51
+ return result;
52
+ }
53
+ const populatedResult = await strapi.db.query(schema.uid).findOne({
54
+ where: {
55
+ id: resultID
56
+ },
57
+ populate: attributesToPopulate
58
+ });
59
+ const originalFields = copyNonLocalizedAttributes(schema, originalData);
60
+ const currentFields = copyNonLocalizedAttributes(schema, populatedResult);
61
+ // Only sync if there are actual changes to non-localized fields
62
+ const shouldSync = !originalData || Object.keys(currentFields).some((key)=>{
63
+ return !isEqual(currentFields[key], originalFields[key]);
64
+ });
65
+ if (shouldSync) {
66
+ await getService('localizations').syncNonLocalizedAttributes(populatedResult, schema);
67
+ }
68
+ return result;
69
+ });
70
+ };
71
+ var bootstrap = (async ()=>{
72
+ const { sendDidInitializeEvent } = getService('metrics');
73
+ const { initDefaultLocale } = getService('locales');
74
+ const { sectionsBuilder, actions, engine } = getService('permissions');
75
+ // Data
76
+ await initDefaultLocale();
77
+ // Sections Builder
78
+ sectionsBuilder.registerLocalesPropertyHandler();
79
+ // Actions
80
+ await actions.registerI18nActions();
81
+ actions.registerI18nActionsHooks();
82
+ actions.updateActionsProperties();
83
+ // Engine/Permissions
84
+ engine.registerI18nPermissionsHandlers();
85
+ // Hooks & Models
86
+ registerModelsHooks();
87
+ // AI Localizations
88
+ getService('ai-localizations').setupMiddleware();
89
+ sendDidInitializeEvent();
90
+ });
91
+
92
+ export { bootstrap as default };
93
+ //# sourceMappingURL=bootstrap.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.mjs","sources":["../../server/src/bootstrap.ts"],"sourcesContent":["import type { Schema } from '@strapi/types';\nimport { isEqual } from 'lodash/fp';\nimport { getService } from './utils';\n\nconst registerModelsHooks = () => {\n strapi.db.lifecycles.subscribe({\n models: ['plugin::i18n.locale'],\n\n async afterCreate() {\n await getService('permissions').actions.syncSuperAdminPermissionsWithLocales();\n },\n\n async afterDelete() {\n await getService('permissions').actions.syncSuperAdminPermissionsWithLocales();\n },\n });\n\n strapi.documents.use(async (context, next) => {\n const schema: Schema.ContentType = context.contentType;\n\n if (!['create', 'update', 'discardDraft', 'publish'].includes(context.action)) {\n return next();\n }\n\n if (!getService('content-types').isLocalizedContentType(schema)) {\n return next();\n }\n\n // Build a populate array for all non localized fields within the schema\n const { getNestedPopulateOfNonLocalizedAttributes, copyNonLocalizedAttributes } =\n getService('content-types');\n const attributesToPopulate = getNestedPopulateOfNonLocalizedAttributes(schema.uid);\n\n // Get original data before the update to compare what actually changed\n const originalData =\n 'documentId' in context.params && context.params.documentId\n ? await strapi.db.query(schema.uid).findOne({\n where: { documentId: context.params.documentId },\n populate: attributesToPopulate,\n })\n : null;\n\n // Get the result of the document service action\n const result = (await next()) as any;\n\n // We may not have received a result with everything populated that we need\n // Use the id and populate built from non localized fields to get the full\n // result\n let resultID;\n // TODO: fix bug where an empty array can be returned\n if (Array.isArray(result?.entries) && result.entries[0]?.id) {\n resultID = result.entries[0].id;\n } else if (result?.id) {\n resultID = result.id;\n } else {\n return result;\n }\n\n const populatedResult = await strapi.db.query(schema.uid).findOne({\n where: { id: resultID },\n populate: attributesToPopulate,\n });\n\n const originalFields = copyNonLocalizedAttributes(schema, originalData);\n const currentFields = copyNonLocalizedAttributes(schema, populatedResult);\n\n // Only sync if there are actual changes to non-localized fields\n const shouldSync =\n !originalData ||\n Object.keys(currentFields).some((key) => {\n return !isEqual(currentFields[key], originalFields[key]);\n });\n\n if (shouldSync) {\n await getService('localizations').syncNonLocalizedAttributes(populatedResult, schema);\n }\n\n return result;\n });\n};\n\nexport default async () => {\n const { sendDidInitializeEvent } = getService('metrics');\n const { initDefaultLocale } = getService('locales');\n const { sectionsBuilder, actions, engine } = getService('permissions');\n\n // Data\n await initDefaultLocale();\n\n // Sections Builder\n sectionsBuilder.registerLocalesPropertyHandler();\n\n // Actions\n await actions.registerI18nActions();\n actions.registerI18nActionsHooks();\n actions.updateActionsProperties();\n\n // Engine/Permissions\n engine.registerI18nPermissionsHandlers();\n\n // Hooks & Models\n registerModelsHooks();\n\n // AI Localizations\n getService('ai-localizations').setupMiddleware();\n\n sendDidInitializeEvent();\n};\n"],"names":["registerModelsHooks","strapi","db","lifecycles","subscribe","models","afterCreate","getService","actions","syncSuperAdminPermissionsWithLocales","afterDelete","documents","use","context","next","schema","contentType","includes","action","isLocalizedContentType","getNestedPopulateOfNonLocalizedAttributes","copyNonLocalizedAttributes","attributesToPopulate","uid","originalData","params","documentId","query","findOne","where","populate","result","resultID","Array","isArray","entries","id","populatedResult","originalFields","currentFields","shouldSync","Object","keys","some","key","isEqual","syncNonLocalizedAttributes","sendDidInitializeEvent","initDefaultLocale","sectionsBuilder","engine","registerLocalesPropertyHandler","registerI18nActions","registerI18nActionsHooks","updateActionsProperties","registerI18nPermissionsHandlers","setupMiddleware"],"mappings":";;;AAIA,MAAMA,mBAAsB,GAAA,IAAA;AAC1BC,IAAAA,MAAAA,CAAOC,EAAE,CAACC,UAAU,CAACC,SAAS,CAAC;QAC7BC,MAAQ,EAAA;AAAC,YAAA;AAAsB,SAAA;QAE/B,MAAMC,WAAAA,CAAAA,GAAAA;AACJ,YAAA,MAAMC,UAAW,CAAA,aAAA,CAAA,CAAeC,OAAO,CAACC,oCAAoC,EAAA;AAC9E,SAAA;QAEA,MAAMC,WAAAA,CAAAA,GAAAA;AACJ,YAAA,MAAMH,UAAW,CAAA,aAAA,CAAA,CAAeC,OAAO,CAACC,oCAAoC,EAAA;AAC9E;AACF,KAAA,CAAA;AAEAR,IAAAA,MAAAA,CAAOU,SAAS,CAACC,GAAG,CAAC,OAAOC,OAASC,EAAAA,IAAAA,GAAAA;QACnC,MAAMC,MAAAA,GAA6BF,QAAQG,WAAW;AAEtD,QAAA,IAAI,CAAC;AAAC,YAAA,QAAA;AAAU,YAAA,QAAA;AAAU,YAAA,cAAA;AAAgB,YAAA;AAAU,SAAA,CAACC,QAAQ,CAACJ,OAAQK,CAAAA,MAAM,CAAG,EAAA;YAC7E,OAAOJ,IAAAA,EAAAA;AACT;AAEA,QAAA,IAAI,CAACP,UAAAA,CAAW,eAAiBY,CAAAA,CAAAA,sBAAsB,CAACJ,MAAS,CAAA,EAAA;YAC/D,OAAOD,IAAAA,EAAAA;AACT;;AAGA,QAAA,MAAM,EAAEM,yCAAyC,EAAEC,0BAA0B,EAAE,GAC7Ed,UAAW,CAAA,eAAA,CAAA;QACb,MAAMe,oBAAAA,GAAuBF,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,IAAI,CAAC,CAACC,GAAAA,GAAAA;YAC/B,OAAO,CAACC,QAAQN,aAAa,CAACK,IAAI,EAAEN,cAAc,CAACM,GAAI,CAAA,CAAA;AACzD,SAAA,CAAA;AAEF,QAAA,IAAIJ,UAAY,EAAA;AACd,YAAA,MAAMjC,UAAW,CAAA,eAAA,CAAA,CAAiBuC,0BAA0B,CAACT,eAAiBtB,EAAAA,MAAAA,CAAAA;AAChF;QAEA,OAAOgB,MAAAA;AACT,KAAA,CAAA;AACF,CAAA;AAEA,gBAAe,CAAA,UAAA;AACb,IAAA,MAAM,EAAEgB,sBAAsB,EAAE,GAAGxC,UAAW,CAAA,SAAA,CAAA;AAC9C,IAAA,MAAM,EAAEyC,iBAAiB,EAAE,GAAGzC,UAAW,CAAA,SAAA,CAAA;IACzC,MAAM,EAAE0C,eAAe,EAAEzC,OAAO,EAAE0C,MAAM,EAAE,GAAG3C,UAAW,CAAA,aAAA,CAAA;;IAGxD,MAAMyC,iBAAAA,EAAAA;;AAGNC,IAAAA,eAAAA,CAAgBE,8BAA8B,EAAA;;AAG9C,IAAA,MAAM3C,QAAQ4C,mBAAmB,EAAA;AACjC5C,IAAAA,OAAAA,CAAQ6C,wBAAwB,EAAA;AAChC7C,IAAAA,OAAAA,CAAQ8C,uBAAuB,EAAA;;AAG/BJ,IAAAA,MAAAA,CAAOK,+BAA+B,EAAA;;AAGtCvD,IAAAA,mBAAAA,EAAAA;;AAGAO,IAAAA,UAAAA,CAAW,oBAAoBiD,eAAe,EAAA;AAE9CT,IAAAA,sBAAAA,EAAAA;AACF,CAAA;;;;"}
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ var isoLocales = require('./iso-locales.json.js');
4
+
5
+ /**
6
+ * Returns the default locale based either on env var or english
7
+ * @returns {string}
8
+ */ const getInitLocale = ()=>{
9
+ const envLocaleCode = process.env.STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE;
10
+ if (envLocaleCode) {
11
+ const matchingLocale = isoLocales.find(({ code })=>code === envLocaleCode);
12
+ if (!matchingLocale) {
13
+ throw new Error('Unknown locale code provided in the environment variable STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE');
14
+ }
15
+ return {
16
+ ...matchingLocale
17
+ };
18
+ }
19
+ return {
20
+ code: 'en',
21
+ name: 'English (en)'
22
+ };
23
+ };
24
+ const DEFAULT_LOCALE = getInitLocale();
25
+
26
+ exports.isoLocales = isoLocales;
27
+ exports.DEFAULT_LOCALE = DEFAULT_LOCALE;
28
+ exports.getInitLocale = getInitLocale;
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../server/src/constants/index.ts"],"sourcesContent":["import isoLocales from './iso-locales.json';\n\n/**\n * Returns the default locale based either on env var or english\n * @returns {string}\n */\nconst getInitLocale = () => {\n const envLocaleCode = process.env.STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE;\n\n if (envLocaleCode) {\n const matchingLocale = isoLocales.find(({ code }) => code === envLocaleCode);\n\n if (!matchingLocale) {\n throw new Error(\n 'Unknown locale code provided in the environment variable STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE'\n );\n }\n\n return { ...matchingLocale };\n }\n\n return {\n code: 'en',\n name: 'English (en)',\n };\n};\n\nconst DEFAULT_LOCALE = getInitLocale();\n\nexport { isoLocales, DEFAULT_LOCALE, getInitLocale };\n"],"names":["getInitLocale","envLocaleCode","process","env","STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE","matchingLocale","isoLocales","find","code","Error","name","DEFAULT_LOCALE"],"mappings":";;;;AAEA;;;AAGC,UACKA,aAAgB,GAAA,IAAA;AACpB,IAAA,MAAMC,aAAgBC,GAAAA,OAAAA,CAAQC,GAAG,CAACC,mCAAmC;AAErE,IAAA,IAAIH,aAAe,EAAA;QACjB,MAAMI,cAAAA,GAAiBC,WAAWC,IAAI,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA,IAASP,KAAAA,aAAAA,CAAAA;AAE9D,QAAA,IAAI,CAACI,cAAgB,EAAA;AACnB,YAAA,MAAM,IAAII,KACR,CAAA,8FAAA,CAAA;AAEJ;QAEA,OAAO;AAAE,YAAA,GAAGJ;AAAe,SAAA;AAC7B;IAEA,OAAO;QACLG,IAAM,EAAA,IAAA;QACNE,IAAM,EAAA;AACR,KAAA;AACF;AAEA,MAAMC,cAAiBX,GAAAA,aAAAA;;;;;;"}
@@ -0,0 +1,25 @@
1
+ import isoLocales from './iso-locales.json.mjs';
2
+
3
+ /**
4
+ * Returns the default locale based either on env var or english
5
+ * @returns {string}
6
+ */ const getInitLocale = ()=>{
7
+ const envLocaleCode = process.env.STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE;
8
+ if (envLocaleCode) {
9
+ const matchingLocale = isoLocales.find(({ code })=>code === envLocaleCode);
10
+ if (!matchingLocale) {
11
+ throw new Error('Unknown locale code provided in the environment variable STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE');
12
+ }
13
+ return {
14
+ ...matchingLocale
15
+ };
16
+ }
17
+ return {
18
+ code: 'en',
19
+ name: 'English (en)'
20
+ };
21
+ };
22
+ const DEFAULT_LOCALE = getInitLocale();
23
+
24
+ export { DEFAULT_LOCALE, getInitLocale, isoLocales };
25
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../../server/src/constants/index.ts"],"sourcesContent":["import isoLocales from './iso-locales.json';\n\n/**\n * Returns the default locale based either on env var or english\n * @returns {string}\n */\nconst getInitLocale = () => {\n const envLocaleCode = process.env.STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE;\n\n if (envLocaleCode) {\n const matchingLocale = isoLocales.find(({ code }) => code === envLocaleCode);\n\n if (!matchingLocale) {\n throw new Error(\n 'Unknown locale code provided in the environment variable STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE'\n );\n }\n\n return { ...matchingLocale };\n }\n\n return {\n code: 'en',\n name: 'English (en)',\n };\n};\n\nconst DEFAULT_LOCALE = getInitLocale();\n\nexport { isoLocales, DEFAULT_LOCALE, getInitLocale };\n"],"names":["getInitLocale","envLocaleCode","process","env","STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE","matchingLocale","isoLocales","find","code","Error","name","DEFAULT_LOCALE"],"mappings":";;AAEA;;;AAGC,UACKA,aAAgB,GAAA,IAAA;AACpB,IAAA,MAAMC,aAAgBC,GAAAA,OAAAA,CAAQC,GAAG,CAACC,mCAAmC;AAErE,IAAA,IAAIH,aAAe,EAAA;QACjB,MAAMI,cAAAA,GAAiBC,WAAWC,IAAI,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKA,IAASP,KAAAA,aAAAA,CAAAA;AAE9D,QAAA,IAAI,CAACI,cAAgB,EAAA;AACnB,YAAA,MAAM,IAAII,KACR,CAAA,8FAAA,CAAA;AAEJ;QAEA,OAAO;AAAE,YAAA,GAAGJ;AAAe,SAAA;AAC7B;IAEA,OAAO;QACLG,IAAM,EAAA,IAAA;QACNE,IAAM,EAAA;AACR,KAAA;AACF;AAEA,MAAMC,cAAiBX,GAAAA,aAAAA;;;;"}