@strapi/i18n 0.0.0-next.5f27c76d39a0c192701bdc9daabce3bb59389ce3 → 0.0.0-next.62638801ce303ba9d03355a9f041541cc6668ae0

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 (190) hide show
  1. package/dist/admin/components/BulkLocaleActionModal.js +2 -2
  2. package/dist/admin/components/BulkLocaleActionModal.js.map +1 -1
  3. package/dist/admin/components/BulkLocaleActionModal.mjs +2 -2
  4. package/dist/admin/components/BulkLocaleActionModal.mjs.map +1 -1
  5. package/dist/admin/components/CMHeaderActions.js +294 -20
  6. package/dist/admin/components/CMHeaderActions.js.map +1 -1
  7. package/dist/admin/components/CMHeaderActions.mjs +298 -25
  8. package/dist/admin/components/CMHeaderActions.mjs.map +1 -1
  9. package/dist/admin/components/CreateLocale.js +8 -4
  10. package/dist/admin/components/CreateLocale.js.map +1 -1
  11. package/dist/admin/components/CreateLocale.mjs +9 -5
  12. package/dist/admin/components/CreateLocale.mjs.map +1 -1
  13. package/dist/admin/components/EditLocale.js +1 -1
  14. package/dist/admin/components/EditLocale.js.map +1 -1
  15. package/dist/admin/components/EditLocale.mjs +1 -1
  16. package/dist/admin/components/EditLocale.mjs.map +1 -1
  17. package/dist/admin/components/LocaleListCell.js +65 -45
  18. package/dist/admin/components/LocaleListCell.js.map +1 -1
  19. package/dist/admin/components/LocaleListCell.mjs +66 -46
  20. package/dist/admin/components/LocaleListCell.mjs.map +1 -1
  21. package/dist/admin/components/LocalePicker.js +18 -11
  22. package/dist/admin/components/LocalePicker.js.map +1 -1
  23. package/dist/admin/components/LocalePicker.mjs +19 -12
  24. package/dist/admin/components/LocalePicker.mjs.map +1 -1
  25. package/dist/admin/contentManagerHooks/editView.js +6 -3
  26. package/dist/admin/contentManagerHooks/editView.js.map +1 -1
  27. package/dist/admin/contentManagerHooks/editView.mjs +7 -4
  28. package/dist/admin/contentManagerHooks/editView.mjs.map +1 -1
  29. package/dist/admin/contentManagerHooks/listView.js +2 -1
  30. package/dist/admin/contentManagerHooks/listView.js.map +1 -1
  31. package/dist/admin/contentManagerHooks/listView.mjs +2 -1
  32. package/dist/admin/contentManagerHooks/listView.mjs.map +1 -1
  33. package/dist/admin/hooks/useAILocalizationJobsPolling.js +110 -0
  34. package/dist/admin/hooks/useAILocalizationJobsPolling.js.map +1 -0
  35. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs +89 -0
  36. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs.map +1 -0
  37. package/dist/admin/hooks/useI18n.js +4 -4
  38. package/dist/admin/hooks/useI18n.js.map +1 -1
  39. package/dist/admin/hooks/useI18n.mjs +4 -4
  40. package/dist/admin/hooks/useI18n.mjs.map +1 -1
  41. package/dist/admin/index.js +1 -0
  42. package/dist/admin/index.js.map +1 -1
  43. package/dist/admin/index.mjs +2 -1
  44. package/dist/admin/index.mjs.map +1 -1
  45. package/dist/admin/pages/SettingsPage.js +121 -46
  46. package/dist/admin/pages/SettingsPage.js.map +1 -1
  47. package/dist/admin/pages/SettingsPage.mjs +124 -30
  48. package/dist/admin/pages/SettingsPage.mjs.map +1 -1
  49. package/dist/admin/services/aiLocalizationJobs.js +26 -0
  50. package/dist/admin/services/aiLocalizationJobs.js.map +1 -0
  51. package/dist/admin/services/aiLocalizationJobs.mjs +24 -0
  52. package/dist/admin/services/aiLocalizationJobs.mjs.map +1 -0
  53. package/dist/admin/services/api.js +4 -1
  54. package/dist/admin/services/api.js.map +1 -1
  55. package/dist/admin/services/api.mjs +4 -1
  56. package/dist/admin/services/api.mjs.map +1 -1
  57. package/dist/admin/services/locales.js +4 -2
  58. package/dist/admin/services/locales.js.map +1 -1
  59. package/dist/admin/services/locales.mjs +4 -2
  60. package/dist/admin/services/locales.mjs.map +1 -1
  61. package/dist/admin/services/settings.js +30 -0
  62. package/dist/admin/services/settings.js.map +1 -0
  63. package/dist/admin/services/settings.mjs +27 -0
  64. package/dist/admin/services/settings.mjs.map +1 -0
  65. package/dist/admin/src/components/CMHeaderActions.d.ts +17 -4
  66. package/dist/admin/src/components/LocaleListCell.d.ts +2 -1
  67. package/dist/admin/src/hooks/useAILocalizationJobsPolling.d.ts +9 -0
  68. package/dist/admin/src/services/aiLocalizationJobs.d.ts +6 -0
  69. package/dist/admin/src/services/api.d.ts +1 -1
  70. package/dist/admin/src/services/locales.d.ts +1 -1
  71. package/dist/admin/src/services/relations.d.ts +1 -1
  72. package/dist/admin/src/services/settings.d.ts +5 -0
  73. package/dist/admin/translations/en.json.js +10 -0
  74. package/dist/admin/translations/en.json.js.map +1 -1
  75. package/dist/admin/translations/en.json.mjs +10 -0
  76. package/dist/admin/translations/en.json.mjs.map +1 -1
  77. package/dist/admin/utils/clean.js +2 -2
  78. package/dist/admin/utils/clean.js.map +1 -1
  79. package/dist/admin/utils/clean.mjs +2 -2
  80. package/dist/admin/utils/clean.mjs.map +1 -1
  81. package/dist/admin/utils/getTranslation.js.map +1 -1
  82. package/dist/admin/utils/getTranslation.mjs.map +1 -1
  83. package/dist/admin/utils/prefixPluginTranslations.js.map +1 -1
  84. package/dist/admin/utils/prefixPluginTranslations.mjs.map +1 -1
  85. package/dist/server/bootstrap.js +24 -8
  86. package/dist/server/bootstrap.js.map +1 -1
  87. package/dist/server/bootstrap.mjs +24 -8
  88. package/dist/server/bootstrap.mjs.map +1 -1
  89. package/dist/server/constants/iso-locales.json.js +4 -0
  90. package/dist/server/constants/iso-locales.json.js.map +1 -1
  91. package/dist/server/constants/iso-locales.json.mjs +4 -0
  92. package/dist/server/constants/iso-locales.json.mjs.map +1 -1
  93. package/dist/server/controllers/ai-localization-jobs.js +47 -0
  94. package/dist/server/controllers/ai-localization-jobs.js.map +1 -0
  95. package/dist/server/controllers/ai-localization-jobs.mjs +45 -0
  96. package/dist/server/controllers/ai-localization-jobs.mjs.map +1 -0
  97. package/dist/server/controllers/index.js +5 -1
  98. package/dist/server/controllers/index.js.map +1 -1
  99. package/dist/server/controllers/index.mjs +5 -1
  100. package/dist/server/controllers/index.mjs.map +1 -1
  101. package/dist/server/controllers/settings.js +24 -0
  102. package/dist/server/controllers/settings.js.map +1 -0
  103. package/dist/server/controllers/settings.mjs +22 -0
  104. package/dist/server/controllers/settings.mjs.map +1 -0
  105. package/dist/server/models/ai-localization-job.js +60 -0
  106. package/dist/server/models/ai-localization-job.js.map +1 -0
  107. package/dist/server/models/ai-localization-job.mjs +57 -0
  108. package/dist/server/models/ai-localization-job.mjs.map +1 -0
  109. package/dist/server/register.js +3 -1
  110. package/dist/server/register.js.map +1 -1
  111. package/dist/server/register.mjs +3 -1
  112. package/dist/server/register.mjs.map +1 -1
  113. package/dist/server/routes/admin.js +40 -0
  114. package/dist/server/routes/admin.js.map +1 -1
  115. package/dist/server/routes/admin.mjs +40 -0
  116. package/dist/server/routes/admin.mjs.map +1 -1
  117. package/dist/server/routes/content-api.js +11 -7
  118. package/dist/server/routes/content-api.js.map +1 -1
  119. package/dist/server/routes/content-api.mjs +11 -7
  120. package/dist/server/routes/content-api.mjs.map +1 -1
  121. package/dist/server/routes/index.mjs +2 -2
  122. package/dist/server/routes/validation/locale.js +57 -0
  123. package/dist/server/routes/validation/locale.js.map +1 -0
  124. package/dist/server/routes/validation/locale.mjs +36 -0
  125. package/dist/server/routes/validation/locale.mjs.map +1 -0
  126. package/dist/server/services/ai-localization-jobs.js +64 -0
  127. package/dist/server/services/ai-localization-jobs.js.map +1 -0
  128. package/dist/server/services/ai-localization-jobs.mjs +62 -0
  129. package/dist/server/services/ai-localization-jobs.mjs.map +1 -0
  130. package/dist/server/services/ai-localizations.js +268 -0
  131. package/dist/server/services/ai-localizations.js.map +1 -0
  132. package/dist/server/services/ai-localizations.mjs +266 -0
  133. package/dist/server/services/ai-localizations.mjs.map +1 -0
  134. package/dist/server/services/content-types.js.map +1 -1
  135. package/dist/server/services/content-types.mjs.map +1 -1
  136. package/dist/server/services/index.js +7 -1
  137. package/dist/server/services/index.js.map +1 -1
  138. package/dist/server/services/index.mjs +7 -1
  139. package/dist/server/services/index.mjs.map +1 -1
  140. package/dist/server/services/settings.js +25 -0
  141. package/dist/server/services/settings.js.map +1 -0
  142. package/dist/server/services/settings.mjs +23 -0
  143. package/dist/server/services/settings.mjs.map +1 -0
  144. package/dist/server/src/bootstrap.d.ts.map +1 -1
  145. package/dist/server/src/controllers/ai-localization-jobs.d.ts +17 -0
  146. package/dist/server/src/controllers/ai-localization-jobs.d.ts.map +1 -0
  147. package/dist/server/src/controllers/index.d.ts +10 -0
  148. package/dist/server/src/controllers/index.d.ts.map +1 -1
  149. package/dist/server/src/controllers/settings.d.ts +7 -0
  150. package/dist/server/src/controllers/settings.d.ts.map +1 -0
  151. package/dist/server/src/index.d.ts +47 -8
  152. package/dist/server/src/index.d.ts.map +1 -1
  153. package/dist/server/src/models/ai-localization-job.d.ts +5 -0
  154. package/dist/server/src/models/ai-localization-job.d.ts.map +1 -0
  155. package/dist/server/src/models/index.d.ts +5 -0
  156. package/dist/server/src/models/index.d.ts.map +1 -0
  157. package/dist/server/src/register.d.ts +1 -1
  158. package/dist/server/src/register.d.ts.map +1 -1
  159. package/dist/server/src/routes/admin.d.ts.map +1 -1
  160. package/dist/server/src/routes/content-api.d.ts +5 -8
  161. package/dist/server/src/routes/content-api.d.ts.map +1 -1
  162. package/dist/server/src/routes/index.d.ts +3 -7
  163. package/dist/server/src/routes/index.d.ts.map +1 -1
  164. package/dist/server/src/routes/validation/index.d.ts +2 -0
  165. package/dist/server/src/routes/validation/index.d.ts.map +1 -0
  166. package/dist/server/src/routes/validation/locale.d.ts +41 -0
  167. package/dist/server/src/routes/validation/locale.d.ts.map +1 -0
  168. package/dist/server/src/services/ai-localization-jobs.d.ts +26 -0
  169. package/dist/server/src/services/ai-localization-jobs.d.ts.map +1 -0
  170. package/dist/server/src/services/ai-localizations.d.ts +18 -0
  171. package/dist/server/src/services/ai-localizations.d.ts.map +1 -0
  172. package/dist/server/src/services/index.d.ts +33 -0
  173. package/dist/server/src/services/index.d.ts.map +1 -1
  174. package/dist/server/src/services/settings.d.ts +13 -0
  175. package/dist/server/src/services/settings.d.ts.map +1 -0
  176. package/dist/server/src/utils/index.d.ts +7 -1
  177. package/dist/server/src/utils/index.d.ts.map +1 -1
  178. package/dist/server/src/validation/settings.d.ts +12 -0
  179. package/dist/server/src/validation/settings.d.ts.map +1 -0
  180. package/dist/server/utils/index.js.map +1 -1
  181. package/dist/server/utils/index.mjs.map +1 -1
  182. package/dist/server/validation/settings.js +11 -0
  183. package/dist/server/validation/settings.js.map +1 -0
  184. package/dist/server/validation/settings.mjs +9 -0
  185. package/dist/server/validation/settings.mjs.map +1 -0
  186. package/dist/shared/contracts/ai-localization-jobs.d.ts +27 -0
  187. package/dist/shared/contracts/ai-localization-jobs.d.ts.map +1 -0
  188. package/dist/shared/contracts/settings.d.ts +40 -0
  189. package/dist/shared/contracts/shared.d.ts.map +1 -0
  190. package/package.json +13 -10
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../server/src/controllers/index.ts"],"sourcesContent":["import locales from './locales';\nimport contentTypes from './content-types';\nimport isoLocales from './iso-locales';\n\nexport default {\n locales,\n 'iso-locales': isoLocales,\n 'content-types': contentTypes,\n};\n"],"names":["locales","isoLocales","contentTypes"],"mappings":";;;;AAIA,kBAAe;AACbA,aAAAA,UAAAA;IACA,aAAeC,EAAAA,YAAAA;IACf,eAAiBC,EAAAA;AACnB,CAAE;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../server/src/controllers/index.ts"],"sourcesContent":["import locales from './locales';\nimport contentTypes from './content-types';\nimport isoLocales from './iso-locales';\nimport settings from './settings';\nimport aiLocalizationJobs from './ai-localization-jobs';\n\nexport default {\n locales,\n 'iso-locales': isoLocales,\n 'content-types': contentTypes,\n settings,\n 'ai-localization-jobs': aiLocalizationJobs,\n};\n"],"names":["locales","isoLocales","contentTypes","settings","aiLocalizationJobs"],"mappings":";;;;;;AAMA,kBAAe;AACbA,aAAAA,UAAAA;IACA,aAAeC,EAAAA,YAAAA;IACf,eAAiBC,EAAAA,YAAAA;AACjBC,IAAAA,QAAAA;IACA,sBAAwBC,EAAAA;AAC1B,CAAE;;;;"}
@@ -0,0 +1,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,60 @@
1
+ 'use strict';
2
+
3
+ const AI_LOCALIZATION_JOB_UID = 'plugin::i18n.ai-localization-job';
4
+ const aiLocalizationJob = {
5
+ uid: AI_LOCALIZATION_JOB_UID,
6
+ tableName: 'strapi_ai_localization_jobs',
7
+ singularName: 'ai-localization-job',
8
+ attributes: {
9
+ id: {
10
+ type: 'increments'
11
+ },
12
+ contentType: {
13
+ type: 'string',
14
+ column: {
15
+ notNullable: true
16
+ }
17
+ },
18
+ relatedDocumentId: {
19
+ type: 'string',
20
+ column: {
21
+ notNullable: true
22
+ }
23
+ },
24
+ sourceLocale: {
25
+ type: 'string',
26
+ column: {
27
+ notNullable: true
28
+ }
29
+ },
30
+ targetLocales: {
31
+ type: 'json',
32
+ column: {
33
+ notNullable: true
34
+ }
35
+ },
36
+ status: {
37
+ type: 'enumeration',
38
+ enum: [
39
+ 'processing',
40
+ 'completed',
41
+ 'failed'
42
+ ],
43
+ column: {
44
+ notNullable: true
45
+ }
46
+ },
47
+ createdAt: {
48
+ type: 'datetime',
49
+ default: ()=>new Date()
50
+ },
51
+ updatedAt: {
52
+ type: 'datetime',
53
+ default: ()=>new Date()
54
+ }
55
+ }
56
+ };
57
+
58
+ exports.AI_LOCALIZATION_JOB_UID = AI_LOCALIZATION_JOB_UID;
59
+ exports.aiLocalizationJob = aiLocalizationJob;
60
+ //# sourceMappingURL=ai-localization-job.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-localization-job.js","sources":["../../../server/src/models/ai-localization-job.ts"],"sourcesContent":["import type { Model } from '@strapi/database';\n\nconst AI_LOCALIZATION_JOB_UID = 'plugin::i18n.ai-localization-job';\n\nconst aiLocalizationJob: Model = {\n uid: AI_LOCALIZATION_JOB_UID,\n tableName: 'strapi_ai_localization_jobs',\n singularName: 'ai-localization-job',\n attributes: {\n id: {\n type: 'increments',\n },\n contentType: {\n type: 'string',\n column: { notNullable: true },\n },\n relatedDocumentId: {\n type: 'string',\n column: { notNullable: true },\n },\n sourceLocale: {\n type: 'string',\n column: { notNullable: true },\n },\n targetLocales: {\n type: 'json',\n column: { notNullable: true },\n },\n status: {\n type: 'enumeration',\n enum: ['processing', 'completed', 'failed'],\n column: { notNullable: true },\n },\n createdAt: {\n type: 'datetime',\n default: () => new Date(),\n },\n updatedAt: {\n type: 'datetime',\n default: () => new Date(),\n },\n },\n};\n\nexport { aiLocalizationJob, AI_LOCALIZATION_JOB_UID };\n"],"names":["AI_LOCALIZATION_JOB_UID","aiLocalizationJob","uid","tableName","singularName","attributes","id","type","contentType","column","notNullable","relatedDocumentId","sourceLocale","targetLocales","status","enum","createdAt","default","Date","updatedAt"],"mappings":";;AAEA,MAAMA,uBAA0B,GAAA;AAEhC,MAAMC,iBAA2B,GAAA;IAC/BC,GAAKF,EAAAA,uBAAAA;IACLG,SAAW,EAAA,6BAAA;IACXC,YAAc,EAAA,qBAAA;IACdC,UAAY,EAAA;QACVC,EAAI,EAAA;YACFC,IAAM,EAAA;AACR,SAAA;QACAC,WAAa,EAAA;YACXD,IAAM,EAAA,QAAA;YACNE,MAAQ,EAAA;gBAAEC,WAAa,EAAA;AAAK;AAC9B,SAAA;QACAC,iBAAmB,EAAA;YACjBJ,IAAM,EAAA,QAAA;YACNE,MAAQ,EAAA;gBAAEC,WAAa,EAAA;AAAK;AAC9B,SAAA;QACAE,YAAc,EAAA;YACZL,IAAM,EAAA,QAAA;YACNE,MAAQ,EAAA;gBAAEC,WAAa,EAAA;AAAK;AAC9B,SAAA;QACAG,aAAe,EAAA;YACbN,IAAM,EAAA,MAAA;YACNE,MAAQ,EAAA;gBAAEC,WAAa,EAAA;AAAK;AAC9B,SAAA;QACAI,MAAQ,EAAA;YACNP,IAAM,EAAA,aAAA;YACNQ,IAAM,EAAA;AAAC,gBAAA,YAAA;AAAc,gBAAA,WAAA;AAAa,gBAAA;AAAS,aAAA;YAC3CN,MAAQ,EAAA;gBAAEC,WAAa,EAAA;AAAK;AAC9B,SAAA;QACAM,SAAW,EAAA;YACTT,IAAM,EAAA,UAAA;AACNU,YAAAA,OAAAA,EAAS,IAAM,IAAIC,IAAAA;AACrB,SAAA;QACAC,SAAW,EAAA;YACTZ,IAAM,EAAA,UAAA;AACNU,YAAAA,OAAAA,EAAS,IAAM,IAAIC,IAAAA;AACrB;AACF;AACF;;;;;"}
@@ -0,0 +1,57 @@
1
+ const AI_LOCALIZATION_JOB_UID = 'plugin::i18n.ai-localization-job';
2
+ const aiLocalizationJob = {
3
+ uid: AI_LOCALIZATION_JOB_UID,
4
+ tableName: 'strapi_ai_localization_jobs',
5
+ singularName: 'ai-localization-job',
6
+ attributes: {
7
+ id: {
8
+ type: 'increments'
9
+ },
10
+ contentType: {
11
+ type: 'string',
12
+ column: {
13
+ notNullable: true
14
+ }
15
+ },
16
+ relatedDocumentId: {
17
+ type: 'string',
18
+ column: {
19
+ notNullable: true
20
+ }
21
+ },
22
+ sourceLocale: {
23
+ type: 'string',
24
+ column: {
25
+ notNullable: true
26
+ }
27
+ },
28
+ targetLocales: {
29
+ type: 'json',
30
+ column: {
31
+ notNullable: true
32
+ }
33
+ },
34
+ status: {
35
+ type: 'enumeration',
36
+ enum: [
37
+ 'processing',
38
+ 'completed',
39
+ 'failed'
40
+ ],
41
+ column: {
42
+ notNullable: true
43
+ }
44
+ },
45
+ createdAt: {
46
+ type: 'datetime',
47
+ default: ()=>new Date()
48
+ },
49
+ updatedAt: {
50
+ type: 'datetime',
51
+ default: ()=>new Date()
52
+ }
53
+ }
54
+ };
55
+
56
+ export { AI_LOCALIZATION_JOB_UID, aiLocalizationJob };
57
+ //# sourceMappingURL=ai-localization-job.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-localization-job.mjs","sources":["../../../server/src/models/ai-localization-job.ts"],"sourcesContent":["import type { Model } from '@strapi/database';\n\nconst AI_LOCALIZATION_JOB_UID = 'plugin::i18n.ai-localization-job';\n\nconst aiLocalizationJob: Model = {\n uid: AI_LOCALIZATION_JOB_UID,\n tableName: 'strapi_ai_localization_jobs',\n singularName: 'ai-localization-job',\n attributes: {\n id: {\n type: 'increments',\n },\n contentType: {\n type: 'string',\n column: { notNullable: true },\n },\n relatedDocumentId: {\n type: 'string',\n column: { notNullable: true },\n },\n sourceLocale: {\n type: 'string',\n column: { notNullable: true },\n },\n targetLocales: {\n type: 'json',\n column: { notNullable: true },\n },\n status: {\n type: 'enumeration',\n enum: ['processing', 'completed', 'failed'],\n column: { notNullable: true },\n },\n createdAt: {\n type: 'datetime',\n default: () => new Date(),\n },\n updatedAt: {\n type: 'datetime',\n default: () => new Date(),\n },\n },\n};\n\nexport { aiLocalizationJob, AI_LOCALIZATION_JOB_UID };\n"],"names":["AI_LOCALIZATION_JOB_UID","aiLocalizationJob","uid","tableName","singularName","attributes","id","type","contentType","column","notNullable","relatedDocumentId","sourceLocale","targetLocales","status","enum","createdAt","default","Date","updatedAt"],"mappings":"AAEA,MAAMA,uBAA0B,GAAA;AAEhC,MAAMC,iBAA2B,GAAA;IAC/BC,GAAKF,EAAAA,uBAAAA;IACLG,SAAW,EAAA,6BAAA;IACXC,YAAc,EAAA,qBAAA;IACdC,UAAY,EAAA;QACVC,EAAI,EAAA;YACFC,IAAM,EAAA;AACR,SAAA;QACAC,WAAa,EAAA;YACXD,IAAM,EAAA,QAAA;YACNE,MAAQ,EAAA;gBAAEC,WAAa,EAAA;AAAK;AAC9B,SAAA;QACAC,iBAAmB,EAAA;YACjBJ,IAAM,EAAA,QAAA;YACNE,MAAQ,EAAA;gBAAEC,WAAa,EAAA;AAAK;AAC9B,SAAA;QACAE,YAAc,EAAA;YACZL,IAAM,EAAA,QAAA;YACNE,MAAQ,EAAA;gBAAEC,WAAa,EAAA;AAAK;AAC9B,SAAA;QACAG,aAAe,EAAA;YACbN,IAAM,EAAA,MAAA;YACNE,MAAQ,EAAA;gBAAEC,WAAa,EAAA;AAAK;AAC9B,SAAA;QACAI,MAAQ,EAAA;YACNP,IAAM,EAAA,aAAA;YACNQ,IAAM,EAAA;AAAC,gBAAA,YAAA;AAAc,gBAAA,WAAA;AAAa,gBAAA;AAAS,aAAA;YAC3CN,MAAQ,EAAA;gBAAEC,WAAa,EAAA;AAAK;AAC9B,SAAA;QACAM,SAAW,EAAA;YACTT,IAAM,EAAA,UAAA;AACNU,YAAAA,OAAAA,EAAS,IAAM,IAAIC,IAAAA;AACrB,SAAA;QACAC,SAAW,EAAA;YACTZ,IAAM,EAAA,UAAA;AACNU,YAAAA,OAAAA,EAAS,IAAM,IAAIC,IAAAA;AACrB;AACF;AACF;;;;"}
@@ -4,8 +4,10 @@ var _ = require('lodash');
4
4
  var validateLocaleCreation = require('./controllers/validate-locale-creation.js');
5
5
  var graphql = require('./graphql.js');
6
6
  var index = require('./utils/index.js');
7
+ var aiLocalizationJob = require('./models/ai-localization-job.js');
7
8
 
8
- var register = (({ strapi })=>{
9
+ var register = (async ({ strapi })=>{
10
+ strapi.get('models').add(aiLocalizationJob.aiLocalizationJob);
9
11
  extendContentTypes(strapi);
10
12
  addContentManagerLocaleMiddleware(strapi);
11
13
  });
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sources":["../../server/src/register.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\n\nimport validateLocaleCreation from './controllers/validate-locale-creation';\nimport graphqlProvider from './graphql';\nimport { getService } from './utils';\n\nexport default ({ strapi }: { strapi: Core.Strapi }) => {\n extendContentTypes(strapi);\n addContentManagerLocaleMiddleware(strapi);\n};\n\n// TODO: v5 if implemented in the CM => delete this middleware\n/**\n * Adds middleware on CM creation routes to use i18n locale passed in a specific param\n * @param {Strapi} strapi\n */\nconst addContentManagerLocaleMiddleware = (strapi: Core.Strapi) => {\n strapi.server.router.use('/content-manager/collection-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n\n strapi.server.router.use('/content-manager/single-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n};\n\n/**\n * Adds locale and localization fields to all content types\n * Even if content type is not localized, it will have these fields\n * @param {Strapi} strapi\n */\nconst extendContentTypes = (strapi: Core.Strapi) => {\n const { isLocalizedContentType } = getService('content-types');\n\n Object.values(strapi.contentTypes).forEach((contentType) => {\n const { attributes } = contentType;\n\n const isLocalized = isLocalizedContentType(contentType);\n\n _.set(attributes, 'locale', {\n writable: true,\n private: !isLocalized,\n configurable: false,\n visible: false,\n type: 'string',\n });\n\n _.set(attributes, 'localizations', {\n type: 'relation',\n relation: 'oneToMany',\n target: contentType.uid,\n writable: false,\n private: !isLocalized,\n configurable: false,\n visible: false,\n unstable_virtual: true,\n joinColumn: {\n name: 'document_id',\n referencedColumn: 'document_id',\n referencedTable: strapi.db.metadata.identifiers.getTableName(contentType.collectionName!),\n // ensure the population will not include the results we already loaded\n on({ results }: { results: any[] }) {\n return {\n id: {\n $notIn: results.map((r) => r.id),\n },\n };\n },\n },\n });\n });\n\n if (strapi.plugin('graphql')) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n graphqlProvider({ strapi }).register();\n }\n};\n"],"names":["strapi","extendContentTypes","addContentManagerLocaleMiddleware","server","router","use","ctx","next","method","validateLocaleCreation","isLocalizedContentType","getService","Object","values","contentTypes","forEach","contentType","attributes","isLocalized","_","set","writable","private","configurable","visible","type","relation","target","uid","unstable_virtual","joinColumn","name","referencedColumn","referencedTable","db","metadata","identifiers","getTableName","collectionName","on","results","id","$notIn","map","r","plugin","graphqlProvider","register"],"mappings":";;;;;;;AAOA,eAAe,CAAA,CAAC,EAAEA,MAAM,EAA2B,G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c,EAAA,KAAA;YACdC,OAAS,EAAA,KAAA;YACTC,IAAM,EAAA;AACR,SAAA,CAAA;QAEAN,CAAEC,CAAAA,GAAG,CAACH,UAAAA,EAAY,eAAiB,EAAA;YACjCQ,IAAM,EAAA,UAAA;YACNC,QAAU,EAAA,WAAA;AACVC,YAAAA,MAAAA,EAAQX,YAAYY,GAAG;YACvBP,QAAU,EAAA,KAAA;AACVC,YAAAA,OAAAA,EAAS,CAACJ,WAAAA;YACVK,YAAc,EAAA,KAAA;YACdC,OAAS,EAAA,KAAA;YACTK,gBAAkB,EAAA,IAAA;YAClBC,UAAY,EAAA;gBACVC,IAAM,EAAA,aAAA;gBACNC,gBAAkB,EAAA,aAAA;gBAClBC,eAAiBjC,EAAAA,MAAAA,CAAOkC,EAAE,CAACC,QAAQ,CAACC,WAAW,CAACC,YAAY,CAACrB,WAAAA,CAAYsB,cAAc,CAAA;;gBAEvFC,EAAG,CAAA,CAAA,EAAEC,OAAO,EAAsB,EAAA;oBAChC,OAAO;wBACLC,EAAI,EAAA;AACFC,4BAAAA,MAAAA,EAAQF,QAAQG,GAAG,CAAC,CAACC,CAAAA,GAAMA,EAAEH,EAAE;AACjC;AACF,qBAAA;AACF;AACF;AACF,SAAA,CAAA;AACF,KAAA,CAAA;IAEA,IAAIzC,MAAAA,CAAO6C,MAAM,CAAC,SAAY,CAAA,EAAA;;QAE5BC,OAAgB,CAAA;AAAE9C,YAAAA;AAAO,SAAA,CAAA,CAAG+C,QAAQ,EAAA;AACtC;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"register.js","sources":["../../server/src/register.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\n\nimport validateLocaleCreation from './controllers/validate-locale-creation';\nimport graphqlProvider from './graphql';\nimport { getService } from './utils';\nimport { aiLocalizationJob } from './models/ai-localization-job';\n\nexport default async ({ strapi }: { strapi: Core.Strapi }) => {\n strapi.get('models').add(aiLocalizationJob);\n\n extendContentTypes(strapi);\n addContentManagerLocaleMiddleware(strapi);\n};\n\n// TODO: v5 if implemented in the CM => delete this middleware\n/**\n * Adds middleware on CM creation routes to use i18n locale passed in a specific param\n * @param {Strapi} strapi\n */\nconst addContentManagerLocaleMiddleware = (strapi: Core.Strapi) => {\n strapi.server.router.use('/content-manager/collection-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n\n strapi.server.router.use('/content-manager/single-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n};\n\n/**\n * Adds locale and localization fields to all content types\n * Even if content type is not localized, it will have these fields\n * @param {Strapi} strapi\n */\nconst extendContentTypes = (strapi: Core.Strapi) => {\n const { isLocalizedContentType } = getService('content-types');\n\n Object.values(strapi.contentTypes).forEach((contentType) => {\n const { attributes } = contentType;\n\n const isLocalized = isLocalizedContentType(contentType);\n\n _.set(attributes, 'locale', {\n writable: true,\n private: !isLocalized,\n configurable: false,\n visible: false,\n type: 'string',\n });\n\n _.set(attributes, 'localizations', {\n type: 'relation',\n relation: 'oneToMany',\n target: contentType.uid,\n writable: false,\n private: !isLocalized,\n configurable: false,\n visible: false,\n unstable_virtual: true,\n joinColumn: {\n name: 'document_id',\n referencedColumn: 'document_id',\n referencedTable: strapi.db.metadata.identifiers.getTableName(contentType.collectionName!),\n // ensure the population will not include the results we already loaded\n on({ results }: { results: any[] }) {\n return {\n id: {\n $notIn: results.map((r) => r.id),\n },\n };\n },\n },\n });\n });\n\n if (strapi.plugin('graphql')) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n graphqlProvider({ strapi }).register();\n }\n};\n"],"names":["strapi","get","add","aiLocalizationJob","extendContentTypes","addContentManagerLocaleMiddleware","server","router","use","ctx","next","method","validateLocaleCreation","isLocalizedContentType","getService","Object","values","contentTypes","forEach","contentType","attributes","isLocalized","_","set","writable","private","configurable","visible","type","relation","target","uid","unstable_virtual","joinColumn","name","referencedColumn","referencedTable","db","metadata","identifiers","getTableName","collectionName","on","results","id","$notIn","map","r","plugin","graphqlProvider","register"],"mappings":";;;;;;;;AAQA,eAAe,CAAA,OAAO,EAAEA,MAAM,EAA2B,GAAA;AACvDA,IAAAA,MAAAA,CAAOC,GAAG,CAAC,QAAUC,CAAAA,CAAAA,GAAG,CAACC,mCAAAA,CAAAA;IAEzBC,kBAAmBJ,CAAAA,MAAAA,CAAAA;IACnBK,iCAAkCL,CAAAA,MAAAA,CAAAA;AACpC,CAAA;AAEA;AACA;;;IAIA,MAAMK,oCAAoC,CAACL,MAAAA,GAAAA;IACzCA,MAAOM,CAAAA,MAAM,CAACC,MAAM,CAACC,GAAG,CAAC,0CAAA,EAA4C,CAACC,GAAKC,EAAAA,IAAAA,GAAAA;AACzE,QAAA,IAAID,IAAIE,MAAM,KAAK,UAAUF,GAAIE,CAAAA,MAAM,KAAK,KAAO,EAAA;AACjD,YAAA,OAAOC,uBAAuBH,GAAKC,EAAAA,IAAAA,CAAAA;AACrC;QAEA,OAAOA,IAAAA,EAAAA;AACT,KAAA,CAAA;IAEAV,MAAOM,CAAAA,MAAM,CAACC,MAAM,CAACC,GAAG,CAAC,sCAAA,EAAwC,CAACC,GAAKC,EAAAA,IAAAA,GAAAA;AACrE,QAAA,IAAID,IAAIE,MAAM,KAAK,UAAUF,GAAIE,CAAAA,MAAM,KAAK,KAAO,EAAA;AACjD,YAAA,OAAOC,uBAAuBH,GAAKC,EAAAA,IAAAA,CAAAA;AACrC;QAEA,OAAOA,IAAAA,EAAAA;AACT,KAAA,CAAA;AACF,CAAA;AAEA;;;;IAKA,MAAMN,qBAAqB,CAACJ,MAAAA,GAAAA;AAC1B,IAAA,MAAM,EAAEa,sBAAsB,EAAE,GAAGC,gBAAW,CAAA,eAAA,CAAA;AAE9CC,IAAAA,MAAAA,CAAOC,MAAM,CAAChB,MAAAA,CAAOiB,YAAY,CAAEC,CAAAA,OAAO,CAAC,CA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 from 'lodash';
2
2
  import validateLocaleCreation from './controllers/validate-locale-creation.mjs';
3
3
  import graphqlProvider from './graphql.mjs';
4
4
  import { getService } from './utils/index.mjs';
5
+ import { aiLocalizationJob } from './models/ai-localization-job.mjs';
5
6
 
6
- var register = (({ strapi })=>{
7
+ var register = (async ({ strapi })=>{
8
+ strapi.get('models').add(aiLocalizationJob);
7
9
  extendContentTypes(strapi);
8
10
  addContentManagerLocaleMiddleware(strapi);
9
11
  });
@@ -1 +1 @@
1
- {"version":3,"file":"register.mjs","sources":["../../server/src/register.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\n\nimport validateLocaleCreation from './controllers/validate-locale-creation';\nimport graphqlProvider from './graphql';\nimport { getService } from './utils';\n\nexport default ({ strapi }: { strapi: Core.Strapi }) => {\n extendContentTypes(strapi);\n addContentManagerLocaleMiddleware(strapi);\n};\n\n// TODO: v5 if implemented in the CM => delete this middleware\n/**\n * Adds middleware on CM creation routes to use i18n locale passed in a specific param\n * @param {Strapi} strapi\n */\nconst addContentManagerLocaleMiddleware = (strapi: Core.Strapi) => {\n strapi.server.router.use('/content-manager/collection-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n\n strapi.server.router.use('/content-manager/single-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n};\n\n/**\n * Adds locale and localization fields to all content types\n * Even if content type is not localized, it will have these fields\n * @param {Strapi} strapi\n */\nconst extendContentTypes = (strapi: Core.Strapi) => {\n const { isLocalizedContentType } = getService('content-types');\n\n Object.values(strapi.contentTypes).forEach((contentType) => {\n const { attributes } = contentType;\n\n const isLocalized = isLocalizedContentType(contentType);\n\n _.set(attributes, 'locale', {\n writable: true,\n private: !isLocalized,\n configurable: false,\n visible: false,\n type: 'string',\n });\n\n _.set(attributes, 'localizations', {\n type: 'relation',\n relation: 'oneToMany',\n target: contentType.uid,\n writable: false,\n private: !isLocalized,\n configurable: false,\n visible: false,\n unstable_virtual: true,\n joinColumn: {\n name: 'document_id',\n referencedColumn: 'document_id',\n referencedTable: strapi.db.metadata.identifiers.getTableName(contentType.collectionName!),\n // ensure the population will not include the results we already loaded\n on({ results }: { results: any[] }) {\n return {\n id: {\n $notIn: results.map((r) => r.id),\n },\n };\n },\n },\n });\n });\n\n if (strapi.plugin('graphql')) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n graphqlProvider({ strapi }).register();\n }\n};\n"],"names":["strapi","extendContentTypes","addContentManagerLocaleMiddleware","server","router","use","ctx","next","method","validateLocaleCreation","isLocalizedContentType","getService","Object","values","contentTypes","forEach","contentType","attributes","isLocalized","_","set","writable","private","configurable","visible","type","relation","target","uid","unstable_virtual","joinColumn","name","referencedColumn","referencedTable","db","metadata","identifiers","getTableName","collectionName","on","results","id","$notIn","map","r","plugin","graphqlProvider","register"],"mappings":";;;;;AAOA,eAAe,CAAA,CAAC,EAAEA,MAAM,EAA2B,GAAA;IACjDC,kBAAmBD,CAAAA,MAAAA,CAAAA;IACnBE,iCAAkCF,CAAAA,MAAAA,CAAAA;AACpC,CAAA;AAEA;AACA;;;IAIA,MAAME,oCAAoC,CAACF,MAAAA,GAAAA;IACzCA,MAAOG,CAAAA,MAAM,CAACC,MAAM,CAACC,GAAG,CAAC,0CAAA,EAA4C,CAACC,GAAKC,EAAAA,IAAAA,GAAAA;AACzE,QAAA,IAAID,IAAIE,MAAM,KAAK,UAAUF,GAAIE,CAAAA,MAAM,KAAK,KAAO,EAAA;AACjD,YAAA,OAAOC,uBAAuBH,GAAKC,EAAAA,IAAAA,CAAAA;AACrC;QAEA,OAAOA,IAAAA,EAAAA;AACT,KAAA,CAAA;IAEAP,MAAOG,CAAAA,MAAM,CAACC,MAAM,CAACC,GAAG,CAAC,sCAAA,EAAwC,CAACC,GAAKC,EAAAA,IAAAA,GAAAA;AACrE,QAAA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C,EAAG,CAAA,CAAA,EAAEC,OAAO,EAAsB,EAAA;oBAChC,OAAO;wBACLC,EAAI,EAAA;AACFC,4BAAAA,MAAAA,EAAQF,QAAQG,GAAG,CAAC,CAACC,CAAAA,GAAMA,EAAEH,EAAE;AACjC;AACF,qBAAA;AACF;AACF;AACF,SAAA,CAAA;AACF,KAAA,CAAA;IAEA,IAAIzC,MAAAA,CAAO6C,MAAM,CAAC,SAAY,CAAA,EAAA;;QAE5BC,eAAgB,CAAA;AAAE9C,YAAAA;AAAO,SAAA,CAAA,CAAG+C,QAAQ,EAAA;AACtC;AACF,CAAA;;;;"}
1
+ {"version":3,"file":"register.mjs","sources":["../../server/src/register.ts"],"sourcesContent":["import _ from 'lodash';\nimport type { Core } from '@strapi/types';\n\nimport validateLocaleCreation from './controllers/validate-locale-creation';\nimport graphqlProvider from './graphql';\nimport { getService } from './utils';\nimport { aiLocalizationJob } from './models/ai-localization-job';\n\nexport default async ({ strapi }: { strapi: Core.Strapi }) => {\n strapi.get('models').add(aiLocalizationJob);\n\n extendContentTypes(strapi);\n addContentManagerLocaleMiddleware(strapi);\n};\n\n// TODO: v5 if implemented in the CM => delete this middleware\n/**\n * Adds middleware on CM creation routes to use i18n locale passed in a specific param\n * @param {Strapi} strapi\n */\nconst addContentManagerLocaleMiddleware = (strapi: Core.Strapi) => {\n strapi.server.router.use('/content-manager/collection-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n\n strapi.server.router.use('/content-manager/single-types/:model', (ctx, next) => {\n if (ctx.method === 'POST' || ctx.method === 'PUT') {\n return validateLocaleCreation(ctx, next);\n }\n\n return next();\n });\n};\n\n/**\n * Adds locale and localization fields to all content types\n * Even if content type is not localized, it will have these fields\n * @param {Strapi} strapi\n */\nconst extendContentTypes = (strapi: Core.Strapi) => {\n const { isLocalizedContentType } = getService('content-types');\n\n Object.values(strapi.contentTypes).forEach((contentType) => {\n const { attributes } = contentType;\n\n const isLocalized = isLocalizedContentType(contentType);\n\n _.set(attributes, 'locale', {\n writable: true,\n private: !isLocalized,\n configurable: false,\n visible: false,\n type: 'string',\n });\n\n _.set(attributes, 'localizations', {\n type: 'relation',\n relation: 'oneToMany',\n target: contentType.uid,\n writable: false,\n private: !isLocalized,\n configurable: false,\n visible: false,\n unstable_virtual: true,\n joinColumn: {\n name: 'document_id',\n referencedColumn: 'document_id',\n referencedTable: strapi.db.metadata.identifiers.getTableName(contentType.collectionName!),\n // ensure the population will not include the results we already loaded\n on({ results }: { results: any[] }) {\n return {\n id: {\n $notIn: results.map((r) => r.id),\n },\n };\n },\n },\n });\n });\n\n if (strapi.plugin('graphql')) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n graphqlProvider({ strapi }).register();\n }\n};\n"],"names":["strapi","get","add","aiLocalizationJob","extendContentTypes","addContentManagerLocaleMiddleware","server","router","use","ctx","next","method","validateLocaleCreation","isLocalizedContentType","getService","Object","values","contentTypes","forEach","contentType","attributes","isLocalized","_","set","writable","private","configurable","visible","type","relation","target","uid","unstable_virtual","joinColumn","name","referencedColumn","referencedTable","db","metadata","identifiers","getTableName","collectionName","on","results","id","$notIn","map","r","plugin","graphqlProvider","register"],"mappings":";;;;;;AAQA,eAAe,CAAA,OAAO,EAAEA,MAAM,EAA2B,GAAA;AACvDA,IAAAA,MAAAA,CAAOC,GAAG,CAAC,QAAUC,CAAAA,CAAAA,GAAG,CAACC,iBAAAA,CAAAA;IAEzBC,kBAAmBJ,CAAAA,MAAAA,CAAAA;IACnBK,iCAAkCL,CAAAA,MAAAA,CAAAA;AACpC,CAAA;AAEA;AACA;;;IAIA,MAAMK,oCAAoC,CAACL,MAAAA,GAAAA;IACzCA,MAAOM,CAAAA,MAAM,CAACC,MAAM,CAACC,GAAG,CAAC,0CAAA,EAA4C,CAACC,GAAKC,EAAAA,IAAAA,GAAAA;AACzE,QAAA,IAAID,IAAIE,MAAM,KAAK,UAAUF,GAAIE,CA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A,KAAA;YACdC,OAAS,EAAA,KAAA;YACTK,gBAAkB,EAAA,IAAA;YAClBC,UAAY,EAAA;gBACVC,IAAM,EAAA,aAAA;gBACNC,gBAAkB,EAAA,aAAA;gBAClBC,eAAiBpC,EAAAA,MAAAA,CAAOqC,EAAE,CAACC,QAAQ,CAACC,WAAW,CAACC,YAAY,CAACrB,WAAAA,CAAYsB,cAAc,CAAA;;gBAEvFC,EAAG,CAAA,CAAA,EAAEC,OAAO,EAAsB,EAAA;oBAChC,OAAO;wBACLC,EAAI,EAAA;AACFC,4BAAAA,MAAAA,EAAQF,QAAQG,GAAG,CAAC,CAACC,CAAAA,GAAMA,EAAEH,EAAE;AACjC;AACF,qBAAA;AACF;AACF;AACF,SAAA,CAAA;AACF,KAAA,CAAA;IAEA,IAAI5C,MAAAA,CAAOgD,MAAM,CAAC,SAAY,CAAA,EAAA;;QAE5BC,eAAgB,CAAA;AAAEjD,YAAAA;AAAO,SAAA,CAAA,CAAGkD,QAAQ,EAAA;AACtC;AACF,CAAA;;;;"}
@@ -94,6 +94,46 @@ var admin = {
94
94
  'admin::isAuthenticatedAdmin'
95
95
  ]
96
96
  }
97
+ },
98
+ {
99
+ method: 'GET',
100
+ path: '/settings',
101
+ handler: 'settings.getSettings',
102
+ config: {
103
+ policies: [
104
+ 'admin::isAuthenticatedAdmin'
105
+ ]
106
+ }
107
+ },
108
+ {
109
+ method: 'PUT',
110
+ path: '/settings',
111
+ handler: 'settings.updateSettings',
112
+ config: {
113
+ policies: [
114
+ 'admin::isAuthenticatedAdmin'
115
+ ]
116
+ }
117
+ },
118
+ {
119
+ method: 'GET',
120
+ path: '/ai-localization-jobs/collection-types/:contentType/:documentId',
121
+ handler: 'ai-localization-jobs.getJobForCollectionType',
122
+ config: {
123
+ policies: [
124
+ 'admin::isAuthenticatedAdmin'
125
+ ]
126
+ }
127
+ },
128
+ {
129
+ method: 'GET',
130
+ path: '/ai-localization-jobs/single-types/:contentType',
131
+ handler: 'ai-localization-jobs.getJobForSingleType',
132
+ config: {
133
+ policies: [
134
+ 'admin::isAuthenticatedAdmin'
135
+ ]
136
+ }
97
137
  }
98
138
  ]
99
139
  };
@@ -1 +1 @@
1
- {"version":3,"file":"admin.js","sources":["../../../server/src/routes/admin.ts"],"sourcesContent":["export default {\n type: 'admin',\n routes: [\n {\n method: 'GET',\n path: '/iso-locales',\n handler: 'iso-locales.listIsoLocales',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.read'] },\n },\n ],\n },\n },\n {\n method: 'GET',\n path: '/locales',\n handler: 'locales.listLocales',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n {\n method: 'POST',\n path: '/locales',\n handler: 'locales.createLocale',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.create'] },\n },\n ],\n },\n },\n {\n method: 'PUT',\n path: '/locales/:id',\n handler: 'locales.updateLocale',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.update'] },\n },\n ],\n },\n },\n {\n method: 'DELETE',\n path: '/locales/:id',\n handler: 'locales.deleteLocale',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.delete'] },\n },\n ],\n },\n },\n {\n method: 'POST',\n path: '/content-manager/actions/get-non-localized-fields',\n handler: 'content-types.getNonLocalizedAttributes',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n ],\n};\n"],"names":["type","routes","method","path","handler","config","policies","name","actions"],"mappings":";;AAAA,YAAe;IACbA,IAAM,EAAA,OAAA;IACNC,MAAQ,EAAA;AACN,QAAA;YACEC,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,cAAA;YACNC,OAAS,EAA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IAAM,EAAA,mDAAA;YACNC,OAAS,EAAA,yCAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AAAC,oBAAA;AAA8B;AAC3C;AACF;AACD;AACH,CAAE;;;;"}
1
+ {"version":3,"file":"admin.js","sources":["../../../server/src/routes/admin.ts"],"sourcesContent":["export default {\n type: 'admin',\n routes: [\n {\n method: 'GET',\n path: '/iso-locales',\n handler: 'iso-locales.listIsoLocales',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.read'] },\n },\n ],\n },\n },\n {\n method: 'GET',\n path: '/locales',\n handler: 'locales.listLocales',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n {\n method: 'POST',\n path: '/locales',\n handler: 'locales.createLocale',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.create'] },\n },\n ],\n },\n },\n {\n method: 'PUT',\n path: '/locales/:id',\n handler: 'locales.updateLocale',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.update'] },\n },\n ],\n },\n },\n {\n method: 'DELETE',\n path: '/locales/:id',\n handler: 'locales.deleteLocale',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.delete'] },\n },\n ],\n },\n },\n {\n method: 'POST',\n path: '/content-manager/actions/get-non-localized-fields',\n handler: 'content-types.getNonLocalizedAttributes',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n {\n method: 'GET',\n path: '/settings',\n handler: 'settings.getSettings',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n {\n method: 'PUT',\n path: '/settings',\n handler: 'settings.updateSettings',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n {\n method: 'GET',\n path: '/ai-localization-jobs/collection-types/:contentType/:documentId',\n handler: 'ai-localization-jobs.getJobForCollectionType',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n {\n method: 'GET',\n path: '/ai-localization-jobs/single-types/:contentType',\n handler: 'ai-localization-jobs.getJobForSingleType',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n ],\n};\n"],"names":["type","routes","method","path","handler","config","policies","name","actions"],"mappings":";;AAAA,YAAe;IACbA,IAAM,EAAA,OAAA;IACNC,MAAQ,EAAA;AACN,QAAA;YACEC,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,cAAA;YACNC,OAAS,EAAA,4BAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AACR,oBAAA,6BAAA;AACA,oBAAA;wBACEC,IAAM,EAAA,wCAAA;wBACNF,MAAQ,EAAA;4BAAEG,OAAS,EAAA;AAAC,gCAAA;AAA2B;AAAC;AAClD;AACD;AACH;AACF,SAAA;AACA,QAAA;YACEN,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,UAAA;YACNC,OAAS,EAAA,qBAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AAAC,oBAAA;AAA8B;AAC3C;AACF,SAAA;AACA,QAAA;YACEJ,MAAQ,EAAA,MAAA;YACRC,IAAM,EAAA,UAAA;YACNC,OAAS,EAAA,sBAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AACR,oBAAA,6BAAA;AACA,oBAAA;wBACEC,IAAM,EAAA,wCAAA;wBACNF,MAAQ,EAAA;4BAAEG,OAAS,EAAA;AAAC,gCAAA;AAA6B;AAAC;AACpD;AACD;AACH;AACF,SAAA;AACA,QAAA;YACEN,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,cAAA;YACNC,OAAS,EAAA,sBAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AACR,oBAAA,6BAAA;AACA,oBA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;"}
@@ -92,6 +92,46 @@ var admin = {
92
92
  'admin::isAuthenticatedAdmin'
93
93
  ]
94
94
  }
95
+ },
96
+ {
97
+ method: 'GET',
98
+ path: '/settings',
99
+ handler: 'settings.getSettings',
100
+ config: {
101
+ policies: [
102
+ 'admin::isAuthenticatedAdmin'
103
+ ]
104
+ }
105
+ },
106
+ {
107
+ method: 'PUT',
108
+ path: '/settings',
109
+ handler: 'settings.updateSettings',
110
+ config: {
111
+ policies: [
112
+ 'admin::isAuthenticatedAdmin'
113
+ ]
114
+ }
115
+ },
116
+ {
117
+ method: 'GET',
118
+ path: '/ai-localization-jobs/collection-types/:contentType/:documentId',
119
+ handler: 'ai-localization-jobs.getJobForCollectionType',
120
+ config: {
121
+ policies: [
122
+ 'admin::isAuthenticatedAdmin'
123
+ ]
124
+ }
125
+ },
126
+ {
127
+ method: 'GET',
128
+ path: '/ai-localization-jobs/single-types/:contentType',
129
+ handler: 'ai-localization-jobs.getJobForSingleType',
130
+ config: {
131
+ policies: [
132
+ 'admin::isAuthenticatedAdmin'
133
+ ]
134
+ }
95
135
  }
96
136
  ]
97
137
  };
@@ -1 +1 @@
1
- {"version":3,"file":"admin.mjs","sources":["../../../server/src/routes/admin.ts"],"sourcesContent":["export default {\n type: 'admin',\n routes: [\n {\n method: 'GET',\n path: '/iso-locales',\n handler: 'iso-locales.listIsoLocales',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.read'] },\n },\n ],\n },\n },\n {\n method: 'GET',\n path: '/locales',\n handler: 'locales.listLocales',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n {\n method: 'POST',\n path: '/locales',\n handler: 'locales.createLocale',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.create'] },\n },\n ],\n },\n },\n {\n method: 'PUT',\n path: '/locales/:id',\n handler: 'locales.updateLocale',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.update'] },\n },\n ],\n },\n },\n {\n method: 'DELETE',\n path: '/locales/:id',\n handler: 'locales.deleteLocale',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.delete'] },\n },\n ],\n },\n },\n {\n method: 'POST',\n path: '/content-manager/actions/get-non-localized-fields',\n handler: 'content-types.getNonLocalizedAttributes',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n ],\n};\n"],"names":["type","routes","method","path","handler","config","policies","name","actions"],"mappings":"AAAA,YAAe;IACbA,IAAM,EAAA,OAAA;IACNC,MAAQ,EAAA;AACN,QAAA;YACEC,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,cAAA;YACNC,OAAS,EAAA,4BAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AACR,oBAAA,6BAAA;AACA,oBAAA;wBACEC,IAAM,EAAA,wCAAA;wBACNF,MAAQ,EAAA;4BAAEG,OAAS,EAAA;AAAC,gCAAA;AAA2B;AAAC;AAClD;AACD;AACH;AACF,SAAA;AACA,QAAA;YACEN,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,UAAA;YACNC,OAAS,EAAA,qBAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AAAC,oBAAA;AAA8B;AAC3C;AACF,SAAA;AACA,QAAA;YACEJ,MAAQ,EAAA,MAAA;YACRC,IAAM,EAAA,UAAA;YACNC,OAAS,EAAA,sBAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AACR,oBAAA,6BAAA;AACA,oBAAA;wBACEC,IAAM,EAAA,wCAAA;wBACNF,MAAQ,EAAA;4BAAEG,OAAS,EAAA;AAAC,gCAAA;AAA6B;AAAC;AACpD;AACD;AACH;AACF,SAAA;AACA,QAAA;YACEN,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,cAAA;YACNC,OAAS,EAAA,sBAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AACR,oBAAA,6BAAA;AACA,oBAAA;wBACEC,IAAM,EAAA,wCAAA;wBACNF,MAAQ,EAAA;4BAAEG,OAAS,EAAA;AAAC,gCAAA;AAA6B;AAAC;AACpD;AACD;AACH;AACF,SAAA;AACA,QAAA;YACEN,MAAQ,EAAA,QAAA;YACRC,IAAM,EAAA,cAAA;YACNC,OAAS,EAAA,sBAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AACR,oBAAA,6BAAA;AACA,oBAAA;wBACEC,IAAM,EAAA,wCAAA;wBACNF,MAAQ,EAAA;4BAAEG,OAAS,EAAA;AAAC,gCAAA;AAA6B;AAAC;AACpD;AACD;AACH;AACF,SAAA;AACA,QAAA;YACEN,MAAQ,EAAA,MAAA;YACRC,IAAM,EAAA,mDAAA;YACNC,OAAS,EAAA,yCAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AAAC,oBAAA;AAA8B;AAC3C;AACF;AACD;AACH,CAAE;;;;"}
1
+ {"version":3,"file":"admin.mjs","sources":["../../../server/src/routes/admin.ts"],"sourcesContent":["export default {\n type: 'admin',\n routes: [\n {\n method: 'GET',\n path: '/iso-locales',\n handler: 'iso-locales.listIsoLocales',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.read'] },\n },\n ],\n },\n },\n {\n method: 'GET',\n path: '/locales',\n handler: 'locales.listLocales',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n {\n method: 'POST',\n path: '/locales',\n handler: 'locales.createLocale',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.create'] },\n },\n ],\n },\n },\n {\n method: 'PUT',\n path: '/locales/:id',\n handler: 'locales.updateLocale',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.update'] },\n },\n ],\n },\n },\n {\n method: 'DELETE',\n path: '/locales/:id',\n handler: 'locales.deleteLocale',\n config: {\n policies: [\n 'admin::isAuthenticatedAdmin',\n {\n name: 'plugin::content-manager.hasPermissions',\n config: { actions: ['plugin::i18n.locale.delete'] },\n },\n ],\n },\n },\n {\n method: 'POST',\n path: '/content-manager/actions/get-non-localized-fields',\n handler: 'content-types.getNonLocalizedAttributes',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n {\n method: 'GET',\n path: '/settings',\n handler: 'settings.getSettings',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n {\n method: 'PUT',\n path: '/settings',\n handler: 'settings.updateSettings',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n {\n method: 'GET',\n path: '/ai-localization-jobs/collection-types/:contentType/:documentId',\n handler: 'ai-localization-jobs.getJobForCollectionType',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n {\n method: 'GET',\n path: '/ai-localization-jobs/single-types/:contentType',\n handler: 'ai-localization-jobs.getJobForSingleType',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n ],\n};\n"],"names":["type","routes","method","path","handler","config","policies","name","actions"],"mappings":"AAAA,YAAe;IACbA,IAAM,EAAA,OAAA;IACNC,MAAQ,EAAA;AACN,QAAA;YACEC,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,cAAA;YACNC,OAAS,EAAA,4BAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AACR,oBAAA,6BAAA;AACA,oBAAA;wBACEC,IAAM,EAAA,wCAAA;wBACNF,MAAQ,EAAA;4BAAEG,OAAS,EAAA;AAAC,gCAAA;AAA2B;AAAC;AAClD;AACD;AACH;AACF,S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EAAA,sBAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AAAC,oBAAA;AAA8B;AAC3C;AACF,SAAA;AACA,QAAA;YACEJ,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,WAAA;YACNC,OAAS,EAAA,yBAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AAAC,oBAAA;AAA8B;AAC3C;AACF,SAAA;AACA,QAAA;YACEJ,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,iEAAA;YACNC,OAAS,EAAA,8CAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AAAC,oBAAA;AAA8B;AAC3C;AACF,SAAA;AACA,QAAA;YACEJ,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,iDAAA;YACNC,OAAS,EAAA,0CAAA;YACTC,MAAQ,EAAA;gBACNC,QAAU,EAAA;AAAC,oBAAA;AAA8B;AAC3C;AACF;AACD;AACH,CAAE;;;;"}
@@ -1,15 +1,19 @@
1
1
  'use strict';
2
2
 
3
- var contentApi = {
4
- type: 'content-api',
5
- routes: [
3
+ var utils = require('@strapi/utils');
4
+ var locale = require('./validation/locale.js');
5
+
6
+ const createContentApiRoutes = utils.createContentApiRoutesFactory(()=>{
7
+ const validator = new locale.I18nLocaleRouteValidator(strapi);
8
+ return [
6
9
  {
7
10
  method: 'GET',
8
11
  path: '/locales',
9
- handler: 'locales.listLocales'
12
+ handler: 'locales.listLocales',
13
+ response: validator.locales
10
14
  }
11
- ]
12
- };
15
+ ];
16
+ });
13
17
 
14
- module.exports = contentApi;
18
+ module.exports = createContentApiRoutes;
15
19
  //# sourceMappingURL=content-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"content-api.js","sources":["../../../server/src/routes/content-api.ts"],"sourcesContent":["export default {\n type: 'content-api',\n routes: [\n {\n method: 'GET',\n path: '/locales',\n handler: 'locales.listLocales',\n },\n ],\n};\n"],"names":["type","routes","method","path","handler"],"mappings":";;AAAA,iBAAe;IACbA,IAAM,EAAA,aAAA;IACNC,MAAQ,EAAA;AACN,QAAA;YACEC,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,UAAA;YACNC,OAAS,EAAA;AACX;AACD;AACH,CAAE;;;;"}
1
+ {"version":3,"file":"content-api.js","sources":["../../../server/src/routes/content-api.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { createContentApiRoutesFactory } from '@strapi/utils';\nimport { I18nLocaleRouteValidator } from './validation';\n\nconst createContentApiRoutes = createContentApiRoutesFactory((): Core.RouterInput['routes'] => {\n const validator = new I18nLocaleRouteValidator(strapi);\n return [\n {\n method: 'GET',\n path: '/locales',\n handler: 'locales.listLocales',\n response: validator.locales,\n },\n ];\n});\n\nexport default createContentApiRoutes;\n"],"names":["createContentApiRoutes","createContentApiRoutesFactory","validator","I18nLocaleRouteValidator","strapi","method","path","handler","response","locales"],"mappings":";;;;;AAIA,MAAMA,yBAAyBC,mCAA8B,CAAA,IAAA;IAC3D,MAAMC,SAAAA,GAAY,IAAIC,+BAAyBC,CAAAA,MAAAA,CAAAA;IAC/C,OAAO;AACL,QAAA;YACEC,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,UAAA;YACNC,OAAS,EAAA,qBAAA;AACTC,YAAAA,QAAAA,EAAUN,UAAUO;AACtB;AACD,KAAA;AACH,CAAA;;;;"}
@@ -1,13 +1,17 @@
1
- var contentApi = {
2
- type: 'content-api',
3
- routes: [
1
+ import { createContentApiRoutesFactory } from '@strapi/utils';
2
+ import { I18nLocaleRouteValidator } from './validation/locale.mjs';
3
+
4
+ const createContentApiRoutes = createContentApiRoutesFactory(()=>{
5
+ const validator = new I18nLocaleRouteValidator(strapi);
6
+ return [
4
7
  {
5
8
  method: 'GET',
6
9
  path: '/locales',
7
- handler: 'locales.listLocales'
10
+ handler: 'locales.listLocales',
11
+ response: validator.locales
8
12
  }
9
- ]
10
- };
13
+ ];
14
+ });
11
15
 
12
- export { contentApi as default };
16
+ export { createContentApiRoutes as default };
13
17
  //# sourceMappingURL=content-api.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"content-api.mjs","sources":["../../../server/src/routes/content-api.ts"],"sourcesContent":["export default {\n type: 'content-api',\n routes: [\n {\n method: 'GET',\n path: '/locales',\n handler: 'locales.listLocales',\n },\n ],\n};\n"],"names":["type","routes","method","path","handler"],"mappings":"AAAA,iBAAe;IACbA,IAAM,EAAA,aAAA;IACNC,MAAQ,EAAA;AACN,QAAA;YACEC,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,UAAA;YACNC,OAAS,EAAA;AACX;AACD;AACH,CAAE;;;;"}
1
+ {"version":3,"file":"content-api.mjs","sources":["../../../server/src/routes/content-api.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { createContentApiRoutesFactory } from '@strapi/utils';\nimport { I18nLocaleRouteValidator } from './validation';\n\nconst createContentApiRoutes = createContentApiRoutesFactory((): Core.RouterInput['routes'] => {\n const validator = new I18nLocaleRouteValidator(strapi);\n return [\n {\n method: 'GET',\n path: '/locales',\n handler: 'locales.listLocales',\n response: validator.locales,\n },\n ];\n});\n\nexport default createContentApiRoutes;\n"],"names":["createContentApiRoutes","createContentApiRoutesFactory","validator","I18nLocaleRouteValidator","strapi","method","path","handler","response","locales"],"mappings":";;;AAIA,MAAMA,yBAAyBC,6BAA8B,CAAA,IAAA;IAC3D,MAAMC,SAAAA,GAAY,IAAIC,wBAAyBC,CAAAA,MAAAA,CAAAA;IAC/C,OAAO;AACL,QAAA;YACEC,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,UAAA;YACNC,OAAS,EAAA,qBAAA;AACTC,YAAAA,QAAAA,EAAUN,UAAUO;AACtB;AACD,KAAA;AACH,CAAA;;;;"}
@@ -1,9 +1,9 @@
1
1
  import admin from './admin.mjs';
2
- import contentApi from './content-api.mjs';
2
+ import createContentApiRoutes from './content-api.mjs';
3
3
 
4
4
  var routes = {
5
5
  admin,
6
- 'content-api': contentApi
6
+ 'content-api': createContentApiRoutes
7
7
  };
8
8
 
9
9
  export { routes as default };
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ var z = require('zod/v4');
4
+
5
+ function _interopNamespaceDefault(e) {
6
+ var n = Object.create(null);
7
+ if (e) {
8
+ Object.keys(e).forEach(function (k) {
9
+ if (k !== 'default') {
10
+ var d = Object.getOwnPropertyDescriptor(e, k);
11
+ Object.defineProperty(n, k, d.get ? d : {
12
+ enumerable: true,
13
+ get: function () { return e[k]; }
14
+ });
15
+ }
16
+ });
17
+ }
18
+ n.default = e;
19
+ return Object.freeze(n);
20
+ }
21
+
22
+ var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
23
+
24
+ /**
25
+ * A validator for i18n locale routes.
26
+ *
27
+ */ class I18nLocaleRouteValidator {
28
+ /**
29
+ * Generates a validation schema for a single locale.
30
+ *
31
+ * @returns A schema for validating locale objects
32
+ */ get locale() {
33
+ return z__namespace.object({
34
+ id: z__namespace.number().int().positive(),
35
+ documentId: z__namespace.string().uuid(),
36
+ name: z__namespace.string(),
37
+ code: z__namespace.string().length(2, 'Locale code must be exactly 2 characters'),
38
+ createdAt: z__namespace.string(),
39
+ updatedAt: z__namespace.string(),
40
+ publishedAt: z__namespace.string().nullable(),
41
+ isDefault: z__namespace.boolean()
42
+ });
43
+ }
44
+ /**
45
+ * Generates a validation schema for an array of locales
46
+ *
47
+ * @returns A schema for validating arrays of locales
48
+ */ get locales() {
49
+ return z__namespace.array(this.locale);
50
+ }
51
+ constructor(strapi){
52
+ this._strapi = strapi;
53
+ }
54
+ }
55
+
56
+ exports.I18nLocaleRouteValidator = I18nLocaleRouteValidator;
57
+ //# sourceMappingURL=locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.js","sources":["../../../../server/src/routes/validation/locale.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport * as z from 'zod/v4';\n\n/**\n * A validator for i18n locale routes.\n *\n */\nexport class I18nLocaleRouteValidator {\n protected readonly _strapi: Core.Strapi;\n\n public constructor(strapi: Core.Strapi) {\n this._strapi = strapi;\n }\n\n /**\n * Generates a validation schema for a single locale.\n *\n * @returns A schema for validating locale objects\n */\n get locale() {\n return z.object({\n id: z.number().int().positive(),\n documentId: z.string().uuid(),\n name: z.string(),\n code: z.string().length(2, 'Locale code must be exactly 2 characters'),\n createdAt: z.string(),\n updatedAt: z.string(),\n publishedAt: z.string().nullable(),\n isDefault: z.boolean(),\n });\n }\n\n /**\n * Generates a validation schema for an array of locales\n *\n * @returns A schema for validating arrays of locales\n */\n get locales() {\n return z.array(this.locale);\n }\n}\n"],"names":["I18nLocaleRouteValidator","locale","z","object","id","number","int","positive","documentId","string","uuid","name","code","length","createdAt","updatedAt","publishedAt","nullable","isDefault","boolean","locales","array","strapi","_strapi"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA;;;AAGC,IACM,MAAMA,wBAAAA,CAAAA;AAOX;;;;AAIC,MACD,IAAIC,MAAS,GAAA;QACX,OAAOC,YAAAA,CAAEC,MAAM,CAAC;AACdC,YAAAA,EAAAA,EAAIF,YAAEG,CAAAA,MAAM,EAAGC,CAAAA,GAAG,GAAGC,QAAQ,EAAA;YAC7BC,UAAYN,EAAAA,YAAAA,CAAEO,MAAM,EAAA,CAAGC,IAAI,EAAA;AAC3BC,YAAAA,IAAAA,EAAMT,aAAEO,MAAM,EAAA;AACdG,YAAAA,IAAAA,EAAMV,YAAEO,CAAAA,MAAM,EAAGI,CAAAA,MAAM,CAAC,CAAG,EAAA,0CAAA,CAAA;AAC3BC,YAAAA,SAAAA,EAAWZ,aAAEO,MAAM,EAAA;AACnBM,YAAAA,SAAAA,EAAWb,aAAEO,MAAM,EAAA;YACnBO,WAAad,EAAAA,YAAAA,CAAEO,MAAM,EAAA,CAAGQ,QAAQ,EAAA;AAChCC,YAAAA,SAAAA,EAAWhB,aAAEiB,OAAO;AACtB,SAAA,CAAA;AACF;AAEA;;;;AAIC,MACD,IAAIC,OAAU,GAAA;AACZ,QAAA,OAAOlB,YAAEmB,CAAAA,KAAK,CAAC,IAAI,CAACpB,MAAM,CAAA;AAC5B;AA7BA,IAAA,WAAA,CAAmBqB,MAAmB,CAAE;QACtC,IAAI,CAACC,OAAO,GAAGD,MAAAA;AACjB;AA4BF;;;;"}
@@ -0,0 +1,36 @@
1
+ import * as z from 'zod/v4';
2
+
3
+ /**
4
+ * A validator for i18n locale routes.
5
+ *
6
+ */ class I18nLocaleRouteValidator {
7
+ /**
8
+ * Generates a validation schema for a single locale.
9
+ *
10
+ * @returns A schema for validating locale objects
11
+ */ get locale() {
12
+ return z.object({
13
+ id: z.number().int().positive(),
14
+ documentId: z.string().uuid(),
15
+ name: z.string(),
16
+ code: z.string().length(2, 'Locale code must be exactly 2 characters'),
17
+ createdAt: z.string(),
18
+ updatedAt: z.string(),
19
+ publishedAt: z.string().nullable(),
20
+ isDefault: z.boolean()
21
+ });
22
+ }
23
+ /**
24
+ * Generates a validation schema for an array of locales
25
+ *
26
+ * @returns A schema for validating arrays of locales
27
+ */ get locales() {
28
+ return z.array(this.locale);
29
+ }
30
+ constructor(strapi){
31
+ this._strapi = strapi;
32
+ }
33
+ }
34
+
35
+ export { I18nLocaleRouteValidator };
36
+ //# sourceMappingURL=locale.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.mjs","sources":["../../../../server/src/routes/validation/locale.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport * as z from 'zod/v4';\n\n/**\n * A validator for i18n locale routes.\n *\n */\nexport class I18nLocaleRouteValidator {\n protected readonly _strapi: Core.Strapi;\n\n public constructor(strapi: Core.Strapi) {\n this._strapi = strapi;\n }\n\n /**\n * Generates a validation schema for a single locale.\n *\n * @returns A schema for validating locale objects\n */\n get locale() {\n return z.object({\n id: z.number().int().positive(),\n documentId: z.string().uuid(),\n name: z.string(),\n code: z.string().length(2, 'Locale code must be exactly 2 characters'),\n createdAt: z.string(),\n updatedAt: z.string(),\n publishedAt: z.string().nullable(),\n isDefault: z.boolean(),\n });\n }\n\n /**\n * Generates a validation schema for an array of locales\n *\n * @returns A schema for validating arrays of locales\n */\n get locales() {\n return z.array(this.locale);\n }\n}\n"],"names":["I18nLocaleRouteValidator","locale","z","object","id","number","int","positive","documentId","string","uuid","name","code","length","createdAt","updatedAt","publishedAt","nullable","isDefault","boolean","locales","array","strapi","_strapi"],"mappings":";;AAGA;;;AAGC,IACM,MAAMA,wBAAAA,CAAAA;AAOX;;;;AAIC,MACD,IAAIC,MAAS,GAAA;QACX,OAAOC,CAAAA,CAAEC,MAAM,CAAC;AACdC,YAAAA,EAAAA,EAAIF,CAAEG,CAAAA,MAAM,EAAGC,CAAAA,GAAG,GAAGC,QAAQ,EAAA;YAC7BC,UAAYN,EAAAA,CAAAA,CAAEO,MAAM,EAAA,CAAGC,IAAI,EAAA;AAC3BC,YAAAA,IAAAA,EAAMT,EAAEO,MAAM,EAAA;AACdG,YAAAA,IAAAA,EAAMV,CAAEO,CAAAA,MAAM,EAAGI,CAAAA,MAAM,CAAC,CAAG,EAAA,0CAAA,CAAA;AAC3BC,YAAAA,SAAAA,EAAWZ,EAAEO,MAAM,EAAA;AACnBM,YAAAA,SAAAA,EAAWb,EAAEO,MAAM,EAAA;YACnBO,WAAad,EAAAA,CAAAA,CAAEO,MAAM,EAAA,CAAGQ,QAAQ,EAAA;AAChCC,YAAAA,SAAAA,EAAWhB,EAAEiB,OAAO;AACtB,SAAA,CAAA;AACF;AAEA;;;;AAIC,MACD,IAAIC,OAAU,GAAA;AACZ,QAAA,OAAOlB,CAAEmB,CAAAA,KAAK,CAAC,IAAI,CAACpB,MAAM,CAAA;AAC5B;AA7BA,IAAA,WAAA,CAAmBqB,MAAmB,CAAE;QACtC,IAAI,CAACC,OAAO,GAAGD,MAAAA;AACjB;AA4BF;;;;"}