@strapi/i18n 0.0.0-next.883f4fcabd28de02b78b7b00a70e33cd2d151d05 → 0.0.0-next.88e2effa81cb9544dd09eb0536e39c3fed6ef4c9

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 (189) hide show
  1. package/dist/admin/components/CMHeaderActions.js +132 -1
  2. package/dist/admin/components/CMHeaderActions.js.map +1 -1
  3. package/dist/admin/components/CMHeaderActions.mjs +135 -5
  4. package/dist/admin/components/CMHeaderActions.mjs.map +1 -1
  5. package/dist/admin/components/CreateLocale.js +1 -1
  6. package/dist/admin/components/CreateLocale.js.map +1 -1
  7. package/dist/admin/components/CreateLocale.mjs +1 -1
  8. package/dist/admin/components/CreateLocale.mjs.map +1 -1
  9. package/dist/admin/components/EditLocale.js +1 -1
  10. package/dist/admin/components/EditLocale.js.map +1 -1
  11. package/dist/admin/components/EditLocale.mjs +1 -1
  12. package/dist/admin/components/EditLocale.mjs.map +1 -1
  13. package/dist/admin/components/LocaleListCell.js +65 -45
  14. package/dist/admin/components/LocaleListCell.js.map +1 -1
  15. package/dist/admin/components/LocaleListCell.mjs +66 -46
  16. package/dist/admin/components/LocaleListCell.mjs.map +1 -1
  17. package/dist/admin/components/LocalePicker.js +18 -11
  18. package/dist/admin/components/LocalePicker.js.map +1 -1
  19. package/dist/admin/components/LocalePicker.mjs +19 -12
  20. package/dist/admin/components/LocalePicker.mjs.map +1 -1
  21. package/dist/admin/contentManagerHooks/editView.js +6 -3
  22. package/dist/admin/contentManagerHooks/editView.js.map +1 -1
  23. package/dist/admin/contentManagerHooks/editView.mjs +7 -4
  24. package/dist/admin/contentManagerHooks/editView.mjs.map +1 -1
  25. package/dist/admin/contentManagerHooks/listView.js +2 -1
  26. package/dist/admin/contentManagerHooks/listView.js.map +1 -1
  27. package/dist/admin/contentManagerHooks/listView.mjs +2 -1
  28. package/dist/admin/contentManagerHooks/listView.mjs.map +1 -1
  29. package/dist/admin/hooks/useAILocalizationJobsPolling.js +110 -0
  30. package/dist/admin/hooks/useAILocalizationJobsPolling.js.map +1 -0
  31. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs +89 -0
  32. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs.map +1 -0
  33. package/dist/admin/index.js +1 -1
  34. package/dist/admin/index.js.map +1 -1
  35. package/dist/admin/index.mjs +2 -2
  36. package/dist/admin/index.mjs.map +1 -1
  37. package/dist/admin/middlewares/extendCTBAttributeInitialData.js +34 -24
  38. package/dist/admin/middlewares/extendCTBAttributeInitialData.js.map +1 -1
  39. package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs +34 -24
  40. package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs.map +1 -1
  41. package/dist/admin/pages/SettingsPage.js +121 -46
  42. package/dist/admin/pages/SettingsPage.js.map +1 -1
  43. package/dist/admin/pages/SettingsPage.mjs +124 -30
  44. package/dist/admin/pages/SettingsPage.mjs.map +1 -1
  45. package/dist/admin/services/aiLocalizationJobs.js +26 -0
  46. package/dist/admin/services/aiLocalizationJobs.js.map +1 -0
  47. package/dist/admin/services/aiLocalizationJobs.mjs +24 -0
  48. package/dist/admin/services/aiLocalizationJobs.mjs.map +1 -0
  49. package/dist/admin/services/api.js +4 -1
  50. package/dist/admin/services/api.js.map +1 -1
  51. package/dist/admin/services/api.mjs +4 -1
  52. package/dist/admin/services/api.mjs.map +1 -1
  53. package/dist/admin/services/locales.js +4 -2
  54. package/dist/admin/services/locales.js.map +1 -1
  55. package/dist/admin/services/locales.mjs +4 -2
  56. package/dist/admin/services/locales.mjs.map +1 -1
  57. package/dist/admin/services/settings.js +29 -0
  58. package/dist/admin/services/settings.js.map +1 -0
  59. package/dist/admin/services/settings.mjs +26 -0
  60. package/dist/admin/services/settings.mjs.map +1 -0
  61. package/dist/admin/src/components/CMHeaderActions.d.ts +7 -1
  62. package/dist/admin/src/components/LocaleListCell.d.ts +2 -1
  63. package/dist/admin/src/hooks/useAILocalizationJobsPolling.d.ts +9 -0
  64. package/dist/admin/src/services/aiLocalizationJobs.d.ts +6 -0
  65. package/dist/admin/src/services/api.d.ts +1 -1
  66. package/dist/admin/src/services/locales.d.ts +1 -1
  67. package/dist/admin/src/services/relations.d.ts +1 -1
  68. package/dist/admin/src/services/settings.d.ts +5 -0
  69. package/dist/admin/src/utils/schemas.d.ts +642 -16
  70. package/dist/admin/translations/en.json.js +9 -0
  71. package/dist/admin/translations/en.json.js.map +1 -1
  72. package/dist/admin/translations/en.json.mjs +9 -0
  73. package/dist/admin/translations/en.json.mjs.map +1 -1
  74. package/dist/admin/utils/clean.js +2 -2
  75. package/dist/admin/utils/clean.js.map +1 -1
  76. package/dist/admin/utils/clean.mjs +2 -2
  77. package/dist/admin/utils/clean.mjs.map +1 -1
  78. package/dist/admin/utils/fields.js +6 -1
  79. package/dist/admin/utils/fields.js.map +1 -1
  80. package/dist/admin/utils/fields.mjs +6 -1
  81. package/dist/admin/utils/fields.mjs.map +1 -1
  82. package/dist/admin/utils/schemas.js +19 -13
  83. package/dist/admin/utils/schemas.js.map +1 -1
  84. package/dist/admin/utils/schemas.mjs +19 -13
  85. package/dist/admin/utils/schemas.mjs.map +1 -1
  86. package/dist/server/bootstrap.js +2 -0
  87. package/dist/server/bootstrap.js.map +1 -1
  88. package/dist/server/bootstrap.mjs +2 -0
  89. package/dist/server/bootstrap.mjs.map +1 -1
  90. package/dist/server/constants/iso-locales.json.js +4 -0
  91. package/dist/server/constants/iso-locales.json.js.map +1 -1
  92. package/dist/server/constants/iso-locales.json.mjs +4 -0
  93. package/dist/server/constants/iso-locales.json.mjs.map +1 -1
  94. package/dist/server/controllers/ai-localization-jobs.js +47 -0
  95. package/dist/server/controllers/ai-localization-jobs.js.map +1 -0
  96. package/dist/server/controllers/ai-localization-jobs.mjs +45 -0
  97. package/dist/server/controllers/ai-localization-jobs.mjs.map +1 -0
  98. package/dist/server/controllers/index.js +5 -1
  99. package/dist/server/controllers/index.js.map +1 -1
  100. package/dist/server/controllers/index.mjs +5 -1
  101. package/dist/server/controllers/index.mjs.map +1 -1
  102. package/dist/server/controllers/settings.js +24 -0
  103. package/dist/server/controllers/settings.js.map +1 -0
  104. package/dist/server/controllers/settings.mjs +22 -0
  105. package/dist/server/controllers/settings.mjs.map +1 -0
  106. package/dist/server/models/ai-localization-job.js +60 -0
  107. package/dist/server/models/ai-localization-job.js.map +1 -0
  108. package/dist/server/models/ai-localization-job.mjs +57 -0
  109. package/dist/server/models/ai-localization-job.mjs.map +1 -0
  110. package/dist/server/register.js +3 -1
  111. package/dist/server/register.js.map +1 -1
  112. package/dist/server/register.mjs +3 -1
  113. package/dist/server/register.mjs.map +1 -1
  114. package/dist/server/routes/admin.js +40 -0
  115. package/dist/server/routes/admin.js.map +1 -1
  116. package/dist/server/routes/admin.mjs +40 -0
  117. package/dist/server/routes/admin.mjs.map +1 -1
  118. package/dist/server/routes/content-api.js +11 -7
  119. package/dist/server/routes/content-api.js.map +1 -1
  120. package/dist/server/routes/content-api.mjs +11 -7
  121. package/dist/server/routes/content-api.mjs.map +1 -1
  122. package/dist/server/routes/index.mjs +2 -2
  123. package/dist/server/routes/validation/locale.js +57 -0
  124. package/dist/server/routes/validation/locale.js.map +1 -0
  125. package/dist/server/routes/validation/locale.mjs +36 -0
  126. package/dist/server/routes/validation/locale.mjs.map +1 -0
  127. package/dist/server/services/ai-localization-jobs.js +64 -0
  128. package/dist/server/services/ai-localization-jobs.js.map +1 -0
  129. package/dist/server/services/ai-localization-jobs.mjs +62 -0
  130. package/dist/server/services/ai-localization-jobs.mjs.map +1 -0
  131. package/dist/server/services/ai-localizations.js +237 -0
  132. package/dist/server/services/ai-localizations.js.map +1 -0
  133. package/dist/server/services/ai-localizations.mjs +235 -0
  134. package/dist/server/services/ai-localizations.mjs.map +1 -0
  135. package/dist/server/services/index.js +7 -1
  136. package/dist/server/services/index.js.map +1 -1
  137. package/dist/server/services/index.mjs +7 -1
  138. package/dist/server/services/index.mjs.map +1 -1
  139. package/dist/server/services/settings.js +25 -0
  140. package/dist/server/services/settings.js.map +1 -0
  141. package/dist/server/services/settings.mjs +23 -0
  142. package/dist/server/services/settings.mjs.map +1 -0
  143. package/dist/server/src/bootstrap.d.ts.map +1 -1
  144. package/dist/server/src/controllers/ai-localization-jobs.d.ts +17 -0
  145. package/dist/server/src/controllers/ai-localization-jobs.d.ts.map +1 -0
  146. package/dist/server/src/controllers/index.d.ts +10 -0
  147. package/dist/server/src/controllers/index.d.ts.map +1 -1
  148. package/dist/server/src/controllers/settings.d.ts +7 -0
  149. package/dist/server/src/controllers/settings.d.ts.map +1 -0
  150. package/dist/server/src/index.d.ts +47 -8
  151. package/dist/server/src/index.d.ts.map +1 -1
  152. package/dist/server/src/models/ai-localization-job.d.ts +5 -0
  153. package/dist/server/src/models/ai-localization-job.d.ts.map +1 -0
  154. package/dist/server/src/models/index.d.ts +5 -0
  155. package/dist/server/src/models/index.d.ts.map +1 -0
  156. package/dist/server/src/register.d.ts +1 -1
  157. package/dist/server/src/register.d.ts.map +1 -1
  158. package/dist/server/src/routes/admin.d.ts.map +1 -1
  159. package/dist/server/src/routes/content-api.d.ts +5 -8
  160. package/dist/server/src/routes/content-api.d.ts.map +1 -1
  161. package/dist/server/src/routes/index.d.ts +3 -7
  162. package/dist/server/src/routes/index.d.ts.map +1 -1
  163. package/dist/server/src/routes/validation/index.d.ts +2 -0
  164. package/dist/server/src/routes/validation/index.d.ts.map +1 -0
  165. package/dist/server/src/routes/validation/locale.d.ts +41 -0
  166. package/dist/server/src/routes/validation/locale.d.ts.map +1 -0
  167. package/dist/server/src/services/ai-localization-jobs.d.ts +26 -0
  168. package/dist/server/src/services/ai-localization-jobs.d.ts.map +1 -0
  169. package/dist/server/src/services/ai-localizations.d.ts +18 -0
  170. package/dist/server/src/services/ai-localizations.d.ts.map +1 -0
  171. package/dist/server/src/services/index.d.ts +33 -0
  172. package/dist/server/src/services/index.d.ts.map +1 -1
  173. package/dist/server/src/services/settings.d.ts +13 -0
  174. package/dist/server/src/services/settings.d.ts.map +1 -0
  175. package/dist/server/src/utils/index.d.ts +7 -1
  176. package/dist/server/src/utils/index.d.ts.map +1 -1
  177. package/dist/server/src/validation/settings.d.ts +12 -0
  178. package/dist/server/src/validation/settings.d.ts.map +1 -0
  179. package/dist/server/utils/index.js.map +1 -1
  180. package/dist/server/utils/index.mjs.map +1 -1
  181. package/dist/server/validation/settings.js +11 -0
  182. package/dist/server/validation/settings.js.map +1 -0
  183. package/dist/server/validation/settings.mjs +9 -0
  184. package/dist/server/validation/settings.mjs.map +1 -0
  185. package/dist/shared/contracts/ai-localization-jobs.d.ts +27 -0
  186. package/dist/shared/contracts/ai-localization-jobs.d.ts.map +1 -0
  187. package/dist/shared/contracts/settings.d.ts +40 -0
  188. package/dist/shared/contracts/shared.d.ts.map +1 -0
  189. package/package.json +12 -9
@@ -0,0 +1,235 @@
1
+ import { traverseEntity } from '@strapi/utils';
2
+ import { getService } from '../utils/index.mjs';
3
+
4
+ const isLocalizedAttribute = (attribute)=>{
5
+ return attribute?.pluginOptions?.i18n?.localized === true;
6
+ };
7
+ const createAILocalizationsService = ({ strapi })=>{
8
+ // TODO: add a helper function to get the AI server URL
9
+ const aiServerUrl = process.env.STRAPI_AI_URL || 'https://strapi-ai.apps.strapi.io';
10
+ const aiLocalizationJobsService = getService('ai-localization-jobs');
11
+ const UNSUPPORTED_ATTRIBUTE_TYPES = [
12
+ 'media',
13
+ 'relation'
14
+ ];
15
+ return {
16
+ // Async to avoid changing the signature later (there will be a db check in the future)
17
+ async isEnabled () {
18
+ // Check if future flag is enabled
19
+ const isFutureFlagEnabled = strapi.features.future.isEnabled('unstableAILocalizations');
20
+ if (!isFutureFlagEnabled) {
21
+ return false;
22
+ }
23
+ // Check if user disabled AI features globally
24
+ const isAIEnabled = strapi.config.get('admin.ai.enabled', true);
25
+ if (!isAIEnabled) {
26
+ return false;
27
+ }
28
+ // Check if the user's license grants access to AI features
29
+ const hasAccess = strapi.ee.features.isEnabled('cms-ai');
30
+ if (!hasAccess) {
31
+ return false;
32
+ }
33
+ const settings = getService('settings');
34
+ const aiSettings = await settings.getSettings();
35
+ if (!aiSettings?.aiLocalizations) {
36
+ return false;
37
+ }
38
+ return true;
39
+ },
40
+ /**
41
+ * Checks if there are localizations that need to be generated for the given document,
42
+ * and if so, calls the AI service and saves the results to the database.
43
+ * Works for both single and collection types, on create and update.
44
+ */ async generateDocumentLocalizations ({ model, document }) {
45
+ const isFeatureEnabled = await this.isEnabled();
46
+ if (!isFeatureEnabled) {
47
+ return;
48
+ }
49
+ const schema = strapi.getModel(model);
50
+ const localeService = getService('locales');
51
+ // No localizations needed for content types with i18n disabled
52
+ const isLocalizedContentType = getService('content-types').isLocalizedContentType(schema);
53
+ if (!isLocalizedContentType) {
54
+ return;
55
+ }
56
+ // Don't trigger localizations if the update is on a derived locale, only do it on the default
57
+ const defaultLocale = await localeService.getDefaultLocale();
58
+ if (document?.locale !== defaultLocale) {
59
+ return;
60
+ }
61
+ const documentId = document.documentId;
62
+ if (!documentId) {
63
+ strapi.log.warn(`AI Localizations: missing documentId for ${schema.uid}`);
64
+ return;
65
+ }
66
+ // Extract only the localized content from the document
67
+ const translateableContent = await traverseEntity(({ key, attribute }, { remove })=>{
68
+ const hasLocalizedOption = attribute && isLocalizedAttribute(attribute);
69
+ // Only keep fields that actually need to be localized
70
+ // TODO: remove blocks from this list once the AI server can handle it reliably
71
+ if (!hasLocalizedOption || UNSUPPORTED_ATTRIBUTE_TYPES.includes(attribute.type)) {
72
+ remove(key);
73
+ }
74
+ }, {
75
+ schema,
76
+ getModel: strapi.getModel.bind(strapi)
77
+ }, document);
78
+ // Call the AI server to get the localized content
79
+ const localesList = await localeService.find();
80
+ const targetLocales = localesList.filter((l)=>l.code !== document.locale).map((l)=>l.code);
81
+ if (targetLocales.length === 0) {
82
+ strapi.log.info(`AI Localizations: no target locales for ${schema.uid} document ${documentId}`);
83
+ return;
84
+ }
85
+ await aiLocalizationJobsService.upsertJobForDocument({
86
+ contentType: model,
87
+ documentId,
88
+ sourceLocale: document.locale,
89
+ targetLocales,
90
+ status: 'processing'
91
+ });
92
+ let token;
93
+ try {
94
+ const tokenData = await strapi.service('admin::user').getAiToken();
95
+ token = tokenData.token;
96
+ } catch (error) {
97
+ await aiLocalizationJobsService.upsertJobForDocument({
98
+ documentId,
99
+ contentType: model,
100
+ sourceLocale: document.locale,
101
+ targetLocales,
102
+ status: 'failed'
103
+ });
104
+ throw new Error('Failed to retrieve AI token', {
105
+ cause: error instanceof Error ? error : undefined
106
+ });
107
+ }
108
+ /**
109
+ * Provide a schema to the LLM so that we can give it instructions about how to handle each
110
+ * type of attribute. Only keep essential schema data to avoid cluttering the context.
111
+ * Ignore fields that don't need to be localized.
112
+ * TODO: also provide a schema of all the referenced components
113
+ */ const minimalContentTypeSchema = Object.fromEntries(Object.entries(schema.attributes)// eslint-disable-next-line @typescript-eslint/no-unused-vars
114
+ .filter(([_, attr])=>{
115
+ const isLocalized = isLocalizedAttribute(attr);
116
+ const isSupportedType = !UNSUPPORTED_ATTRIBUTE_TYPES.includes(attr.type);
117
+ return isLocalized && isSupportedType;
118
+ }).map(([key, attr])=>{
119
+ const minimalAttribute = {
120
+ type: attr.type
121
+ };
122
+ if (attr.type === 'component') {
123
+ minimalAttribute.repeatable = attr.repeatable ?? false;
124
+ }
125
+ return [
126
+ key,
127
+ minimalAttribute
128
+ ];
129
+ }));
130
+ strapi.log.http('Contacting AI Server for localizations generation');
131
+ const response = await fetch(`${aiServerUrl}/i18n/generate-localizations`, {
132
+ method: 'POST',
133
+ headers: {
134
+ 'Content-Type': 'application/json',
135
+ Authorization: `Bearer ${token}`
136
+ },
137
+ body: JSON.stringify({
138
+ content: translateableContent,
139
+ sourceLocale: document.locale,
140
+ targetLocales,
141
+ contentTypeSchema: minimalContentTypeSchema
142
+ })
143
+ });
144
+ if (!response.ok) {
145
+ strapi.log.error(`AI Localizations request failed: ${response.status} ${response.statusText}`);
146
+ await aiLocalizationJobsService.upsertJobForDocument({
147
+ documentId,
148
+ contentType: model,
149
+ sourceLocale: document.locale,
150
+ targetLocales,
151
+ status: 'failed'
152
+ });
153
+ throw new Error(`AI Localizations request failed: ${response.statusText}`);
154
+ } else {
155
+ await aiLocalizationJobsService.upsertJobForDocument({
156
+ documentId,
157
+ contentType: model,
158
+ sourceLocale: document.locale,
159
+ targetLocales,
160
+ status: 'completed'
161
+ });
162
+ }
163
+ const aiResult = await response.json();
164
+ // Get all media field names dynamically from the schema
165
+ const mediaFields = Object.entries(schema.attributes)// eslint-disable-next-line @typescript-eslint/no-unused-vars
166
+ .filter(([_, attr])=>attr.type === 'media').map(([key])=>key);
167
+ try {
168
+ await Promise.allSettled(aiResult.localizations.map(async (localization)=>{
169
+ const { content, locale } = localization;
170
+ // Fetch the derived locale document
171
+ const derivedDoc = await strapi.documents(model).findOne({
172
+ documentId,
173
+ locale,
174
+ populate: mediaFields
175
+ });
176
+ // Merge AI content and media fields
177
+ const mergedData = {
178
+ ...content
179
+ };
180
+ for (const field of mediaFields){
181
+ // Only copy media if not already set in derived locale
182
+ if (!derivedDoc || !derivedDoc[field]) {
183
+ mergedData[field] = document[field];
184
+ } else {
185
+ mergedData[field] = derivedDoc[field];
186
+ }
187
+ }
188
+ return strapi.documents(model).update({
189
+ documentId,
190
+ locale,
191
+ fields: [],
192
+ data: mergedData
193
+ });
194
+ }));
195
+ } catch (error) {
196
+ await aiLocalizationJobsService.upsertJobForDocument({
197
+ documentId,
198
+ contentType: model,
199
+ sourceLocale: document.locale,
200
+ targetLocales,
201
+ status: 'failed'
202
+ });
203
+ strapi.log.error('AI Localizations generation failed', error);
204
+ }
205
+ },
206
+ setupMiddleware () {
207
+ strapi.documents.use(async (context, next)=>{
208
+ const result = await next();
209
+ // Only trigger on create/update actions
210
+ if (![
211
+ 'create',
212
+ 'update'
213
+ ].includes(context.action)) {
214
+ return result;
215
+ }
216
+ // Check if AI localizations are enabled before triggering
217
+ const isEnabled = await this.isEnabled();
218
+ if (!isEnabled) {
219
+ return result;
220
+ }
221
+ // Don't await since localizations should be done in the background without blocking the request
222
+ strapi.plugin('i18n').service('ai-localizations').generateDocumentLocalizations({
223
+ model: context.contentType.uid,
224
+ document: result
225
+ }).catch((error)=>{
226
+ strapi.log.error('AI Localizations generation failed', error);
227
+ });
228
+ return result;
229
+ });
230
+ }
231
+ };
232
+ };
233
+
234
+ export { createAILocalizationsService };
235
+ //# sourceMappingURL=ai-localizations.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-localizations.mjs","sources":["../../../server/src/services/ai-localizations.ts"],"sourcesContent":["import type { Core, Modules, Schema, UID } from '@strapi/types';\nimport { traverseEntity } from '@strapi/utils';\nimport { getService } from '../utils';\n\nconst isLocalizedAttribute = (attribute: Schema.Attribute.Attribute | undefined): boolean => {\n return (attribute?.pluginOptions as any)?.i18n?.localized === true;\n};\n\nconst createAILocalizationsService = ({ strapi }: { strapi: Core.Strapi }) => {\n // TODO: add a helper function to get the AI server URL\n const aiServerUrl = process.env.STRAPI_AI_URL || 'https://strapi-ai.apps.strapi.io';\n const aiLocalizationJobsService = getService('ai-localization-jobs');\n\n const UNSUPPORTED_ATTRIBUTE_TYPES: Schema.Attribute.Kind[] = ['media', 'relation'];\n\n return {\n // Async to avoid changing the signature later (there will be a db check in the future)\n async isEnabled() {\n // Check if future flag is enabled\n const isFutureFlagEnabled = strapi.features.future.isEnabled('unstableAILocalizations');\n if (!isFutureFlagEnabled) {\n return false;\n }\n\n // Check if user disabled AI features globally\n const isAIEnabled = strapi.config.get('admin.ai.enabled', true);\n if (!isAIEnabled) {\n return false;\n }\n\n // Check if the user's license grants access to AI features\n const hasAccess = strapi.ee.features.isEnabled('cms-ai');\n if (!hasAccess) {\n return false;\n }\n\n const settings = getService('settings');\n const aiSettings = await settings.getSettings();\n if (!aiSettings?.aiLocalizations) {\n return false;\n }\n\n return true;\n },\n\n /**\n * Checks if there are localizations that need to be generated for the given document,\n * and if so, calls the AI service and saves the results to the database.\n * Works for both single and collection types, on create and update.\n */\n async generateDocumentLocalizations({\n model,\n document,\n }: {\n model: UID.ContentType;\n document: Modules.Documents.AnyDocument;\n }) {\n const isFeatureEnabled = await this.isEnabled();\n if (!isFeatureEnabled) {\n return;\n }\n\n const schema = strapi.getModel(model);\n const localeService = getService('locales');\n\n // No localizations needed for content types with i18n disabled\n const isLocalizedContentType = getService('content-types').isLocalizedContentType(schema);\n if (!isLocalizedContentType) {\n return;\n }\n\n // Don't trigger localizations if the update is on a derived locale, only do it on the default\n const defaultLocale = await localeService.getDefaultLocale();\n if (document?.locale !== defaultLocale) {\n return;\n }\n\n const documentId = document.documentId;\n\n if (!documentId) {\n strapi.log.warn(`AI Localizations: missing documentId for ${schema.uid}`);\n return;\n }\n\n // Extract only the localized content from the document\n const translateableContent = await traverseEntity(\n ({ key, attribute }, { remove }) => {\n const hasLocalizedOption = attribute && isLocalizedAttribute(attribute);\n // Only keep fields that actually need to be localized\n // TODO: remove blocks from this list once the AI server can handle it reliably\n if (!hasLocalizedOption || UNSUPPORTED_ATTRIBUTE_TYPES.includes(attribute.type)) {\n remove(key);\n }\n },\n { schema, getModel: strapi.getModel.bind(strapi) },\n document\n );\n\n // Call the AI server to get the localized content\n const localesList = await localeService.find();\n const targetLocales = localesList\n .filter((l) => l.code !== document.locale)\n .map((l) => l.code);\n\n if (targetLocales.length === 0) {\n strapi.log.info(\n `AI Localizations: no target locales for ${schema.uid} document ${documentId}`\n );\n return;\n }\n\n await aiLocalizationJobsService.upsertJobForDocument({\n contentType: model,\n documentId,\n sourceLocale: document.locale,\n targetLocales,\n status: 'processing',\n });\n\n let token: string;\n try {\n const tokenData = await strapi.service('admin::user').getAiToken();\n token = tokenData.token;\n } catch (error) {\n await aiLocalizationJobsService.upsertJobForDocument({\n documentId,\n contentType: model,\n sourceLocale: document.locale,\n targetLocales,\n status: 'failed',\n });\n\n throw new Error('Failed to retrieve AI token', {\n cause: error instanceof Error ? error : undefined,\n });\n }\n\n /**\n * Provide a schema to the LLM so that we can give it instructions about how to handle each\n * type of attribute. Only keep essential schema data to avoid cluttering the context.\n * Ignore fields that don't need to be localized.\n * TODO: also provide a schema of all the referenced components\n */\n const minimalContentTypeSchema = Object.fromEntries(\n Object.entries(schema.attributes)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n .filter(([_, attr]) => {\n const isLocalized = isLocalizedAttribute(attr);\n const isSupportedType = !UNSUPPORTED_ATTRIBUTE_TYPES.includes(attr.type);\n return isLocalized && isSupportedType;\n })\n .map(([key, attr]) => {\n const minimalAttribute = { type: attr.type };\n if (attr.type === 'component') {\n (\n minimalAttribute as Schema.Attribute.Component<`${string}.${string}`, boolean>\n ).repeatable = attr.repeatable ?? false;\n }\n return [key, minimalAttribute];\n })\n );\n\n strapi.log.http('Contacting AI Server for localizations generation');\n const response = await fetch(`${aiServerUrl}/i18n/generate-localizations`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n body: JSON.stringify({\n content: translateableContent,\n sourceLocale: document.locale,\n targetLocales,\n contentTypeSchema: minimalContentTypeSchema,\n }),\n });\n\n if (!response.ok) {\n strapi.log.error(\n `AI Localizations request failed: ${response.status} ${response.statusText}`\n );\n\n await aiLocalizationJobsService.upsertJobForDocument({\n documentId,\n contentType: model,\n sourceLocale: document.locale,\n targetLocales,\n status: 'failed',\n });\n\n throw new Error(`AI Localizations request failed: ${response.statusText}`);\n } else {\n await aiLocalizationJobsService.upsertJobForDocument({\n documentId,\n contentType: model,\n sourceLocale: document.locale,\n targetLocales,\n status: 'completed',\n });\n }\n\n const aiResult = await response.json();\n\n // Get all media field names dynamically from the schema\n const mediaFields = Object.entries(schema.attributes)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n .filter(([_, attr]) => attr.type === 'media')\n .map(([key]) => key);\n\n try {\n await Promise.allSettled(\n aiResult.localizations.map(async (localization: any) => {\n const { content, locale } = localization;\n\n // Fetch the derived locale document\n const derivedDoc = await strapi.documents(model).findOne({\n documentId,\n locale,\n populate: mediaFields,\n });\n\n // Merge AI content and media fields\n const mergedData = { ...content };\n for (const field of mediaFields) {\n // Only copy media if not already set in derived locale\n if (!derivedDoc || !derivedDoc[field]) {\n mergedData[field] = document[field];\n } else {\n mergedData[field] = derivedDoc[field];\n }\n }\n\n return strapi.documents(model).update({\n documentId,\n locale,\n fields: [],\n data: mergedData,\n });\n })\n );\n } catch (error) {\n await aiLocalizationJobsService.upsertJobForDocument({\n documentId,\n contentType: model,\n sourceLocale: document.locale,\n targetLocales,\n status: 'failed',\n });\n strapi.log.error('AI Localizations generation failed', error);\n }\n },\n setupMiddleware() {\n strapi.documents.use(async (context, next) => {\n const result = await next();\n\n // Only trigger on create/update actions\n if (!['create', 'update'].includes(context.action)) {\n return result;\n }\n\n // Check if AI localizations are enabled before triggering\n const isEnabled = await this.isEnabled();\n if (!isEnabled) {\n return result;\n }\n\n // Don't await since localizations should be done in the background without blocking the request\n strapi\n .plugin('i18n')\n .service('ai-localizations')\n .generateDocumentLocalizations({\n model: context.contentType.uid,\n document: result,\n })\n .catch((error: any) => {\n strapi.log.error('AI Localizations generation failed', error);\n });\n\n return result;\n });\n },\n };\n};\n\nexport { createAILocalizationsService };\n"],"names":["isLocalizedAttribute","attribute","pluginOptions","i18n","localized","createAILocalizationsService","strapi","aiServerUrl","process","env","STRAPI_AI_URL","aiLocalizationJobsService","getService","UNSUPPORTED_ATTRIBUTE_TYPES","isEnabled","isFutureFlagEnabled","features","future","isAIEnabled","config","get","hasAccess","ee","settings","aiSettings","getSettings","aiLocalizations","generateDocumentLocalizations","model","document","isFeatureEnabled","schema","getModel","localeService","isLocalizedContentType","defaultLocale","getDefaultLocale","locale","documentId","log","warn","uid","translateableContent","traverseEntity","key","remove","hasLocalizedOption","includes","type","bind","localesList","find","targetLocales","filter","l","code","map","length","info","upsertJobForDocument","contentType","sourceLocale","status","token","tokenData","service","getAiToken","error","Error","cause","undefined","minimalContentTypeSchema","Object","fromEntries","entries","attributes","_","attr","isLocalized","isSupportedType","minimalAttribute","repeatable","http","response","fetch","method","headers","Authorization","body","JSON","stringify","content","contentTypeSchema","ok","statusText","aiResult","json","mediaFields","Promise","allSettled","localizations","localization","derivedDoc","documents","findOne","populate","mergedData","field","update","fields","data","setupMiddleware","use","context","next","result","action","plugin","catch"],"mappings":";;;AAIA,MAAMA,uBAAuB,CAACC,SAAAA,GAAAA;AAC5B,IAAA,OAAO,SAACA,EAAWC,aAAuBC,EAAAA,IAAAA,EAAMC,SAAc,KAAA,IAAA;AAChE,CAAA;AAEA,MAAMC,4BAA+B,GAAA,CAAC,EAAEC,MAAM,EAA2B,GAAA;;AAEvE,IAAA,MAAMC,WAAcC,GAAAA,OAAAA,CAAQC,GAAG,CAACC,aAAa,IAAI,kCAAA;AACjD,IAAA,MAAMC,4BAA4BC,UAAW,CAAA,sBAAA,CAAA;AAE7C,IAAA,MAAMC,2BAAuD,GAAA;AAAC,QAAA,OAAA;AAAS,QAAA;AAAW,KAAA;IAElF,OAAO;;QAEL,MAAMC,SAAAA,CAAAA,GAAAA;;AAEJ,YAAA,MAAMC,sBAAsBT,MAAOU,CAAAA,QAAQ,CAACC,MAAM,CAACH,SAAS,CAAC,yBAAA,CAAA;AAC7D,YAAA,IAAI,CAACC,mBAAqB,EAAA;gBACxB,OAAO,KAAA;AACT;;AAGA,YAAA,MAAMG,cAAcZ,MAAOa,CAAAA,MAAM,CAACC,GAAG,CAAC,kBAAoB,EAAA,IAAA,CAAA;AAC1D,YAAA,IAAI,CAACF,WAAa,EAAA;gBAChB,OAAO,KAAA;AACT;;AAGA,YAAA,MAAMG,YAAYf,MAAOgB,CAAAA,EAAE,CAACN,QAAQ,CAACF,SAAS,CAAC,QAAA,CAAA;AAC/C,YAAA,IAAI,CAACO,SAAW,EAAA;gBACd,OAAO,KAAA;AACT;AAEA,YAAA,MAAME,WAAWX,UAAW,CAAA,UAAA,CAAA;YAC5B,MAAMY,UAAAA,GAAa,MAAMD,QAAAA,CAASE,WAAW,EAAA;YAC7C,IAAI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AA,MAAAA,CAAOiC,GAAG,CAAC4B,KAAK,CAAC,oCAAsCA,EAAAA,KAAAA,CAAAA;AACzD;AACF,SAAA;AACA4C,QAAAA,eAAAA,CAAAA,GAAAA;AACEzG,YAAAA,MAAAA,CAAOiG,SAAS,CAACS,GAAG,CAAC,OAAOC,OAASC,EAAAA,IAAAA,GAAAA;AACnC,gBAAA,MAAMC,SAAS,MAAMD,IAAAA,EAAAA;;AAGrB,gBAAA,IAAI,CAAC;AAAC,oBAAA,QAAA;AAAU,oBAAA;AAAS,iBAAA,CAACnE,QAAQ,CAACkE,OAAQG,CAAAA,MAAM,CAAG,EAAA;oBAClD,OAAOD,MAAAA;AACT;;AAGA,gBAAA,MAAMrG,SAAY,GAAA,MAAM,IAAI,CAACA,SAAS,EAAA;AACtC,gBAAA,IAAI,CAACA,SAAW,EAAA;oBACd,OAAOqG,MAAAA;AACT;;AAGA7G,gBAAAA,MAAAA,CACG+G,MAAM,CAAC,MAAA,CAAA,CACPpD,OAAO,CAAC,kBAAA,CAAA,CACRtC,6BAA6B,CAAC;oBAC7BC,KAAOqF,EAAAA,OAAAA,CAAQrD,WAAW,CAACnB,GAAG;oBAC9BZ,QAAUsF,EAAAA;iBAEXG,CAAAA,CAAAA,KAAK,CAAC,CAACnD,KAAAA,GAAAA;AACN7D,oBAAAA,MAAAA,CAAOiC,GAAG,CAAC4B,KAAK,CAAC,oCAAsCA,EAAAA,KAAAA,CAAAA;AACzD,iBAAA,CAAA;gBAEF,OAAOgD,MAAAA;AACT,aAAA,CAAA;AACF;AACF,KAAA;AACF;;;;"}
@@ -7,6 +7,9 @@ var locales = require('./locales.js');
7
7
  var isoLocales = require('./iso-locales.js');
8
8
  var contentTypes = require('./content-types.js');
9
9
  var index = require('./sanitize/index.js');
10
+ var settings = require('./settings.js');
11
+ var aiLocalizations = require('./ai-localizations.js');
12
+ var aiLocalizationJobs = require('./ai-localization-jobs.js');
10
13
 
11
14
  var services = {
12
15
  permissions,
@@ -15,7 +18,10 @@ var services = {
15
18
  locales,
16
19
  sanitize: index,
17
20
  'iso-locales': isoLocales,
18
- 'content-types': contentTypes
21
+ 'content-types': contentTypes,
22
+ 'ai-localizations': aiLocalizations.createAILocalizationsService,
23
+ 'ai-localization-jobs': aiLocalizationJobs.createAILocalizationJobsService,
24
+ settings: settings.createSettingsService
19
25
  };
20
26
 
21
27
  module.exports = services;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../server/src/services/index.ts"],"sourcesContent":["import permissions from './permissions';\nimport metrics from './metrics';\nimport localizations from './localizations';\nimport locales from './locales';\nimport isoLocales from './iso-locales';\nimport contentTypes from './content-types';\nimport sanitize from './sanitize';\n\nexport default {\n permissions,\n metrics,\n localizations,\n locales,\n sanitize,\n 'iso-locales': isoLocales,\n 'content-types': contentTypes,\n};\n"],"names":["permissions","metrics","localizations","locales","sanitize","isoLocales","contentTypes"],"mappings":";;;;;;;;;;AAQA,eAAe;AACbA,IAAAA,WAAAA;AACAC,IAAAA,OAAAA;AACAC,IAAAA,aAAAA;AACAC,IAAAA,OAAAA;AACAC,cAAAA,KAAAA;IACA,aAAeC,EAAAA,UAAAA;IACf,eAAiBC,EAAAA;AACnB,CAAE;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../server/src/services/index.ts"],"sourcesContent":["import permissions from './permissions';\nimport metrics from './metrics';\nimport localizations from './localizations';\nimport locales from './locales';\nimport isoLocales from './iso-locales';\nimport contentTypes from './content-types';\nimport sanitize from './sanitize';\nimport { createSettingsService } from './settings';\nimport { createAILocalizationsService } from './ai-localizations';\nimport { createAILocalizationJobsService } from './ai-localization-jobs';\n\nexport default {\n permissions,\n metrics,\n localizations,\n locales,\n sanitize,\n 'iso-locales': isoLocales,\n 'content-types': contentTypes,\n 'ai-localizations': createAILocalizationsService,\n 'ai-localization-jobs': createAILocalizationJobsService,\n settings: createSettingsService,\n};\n"],"names":["permissions","metrics","localizations","locales","sanitize","isoLocales","contentTypes","createAILocalizationsService","createAILocalizationJobsService","settings","createSettingsService"],"mappings":";;;;;;;;;;;;;AAWA,eAAe;AACbA,IAAAA,WAAAA;AACAC,IAAAA,OAAAA;AACAC,IAAAA,aAAAA;AACAC,IAAAA,OAAAA;AACAC,cAAAA,KAAAA;IACA,aAAeC,EAAAA,UAAAA;IACf,eAAiBC,EAAAA,YAAAA;IACjB,kBAAoBC,EAAAA,4CAAAA;IACpB,sBAAwBC,EAAAA,kDAAAA;IACxBC,QAAUC,EAAAA;AACZ,CAAE;;;;"}
@@ -5,6 +5,9 @@ import locales from './locales.mjs';
5
5
  import isoLocalesService from './iso-locales.mjs';
6
6
  import contentTypes from './content-types.mjs';
7
7
  import sanitize from './sanitize/index.mjs';
8
+ import { createSettingsService } from './settings.mjs';
9
+ import { createAILocalizationsService } from './ai-localizations.mjs';
10
+ import { createAILocalizationJobsService } from './ai-localization-jobs.mjs';
8
11
 
9
12
  var services = {
10
13
  permissions,
@@ -13,7 +16,10 @@ var services = {
13
16
  locales,
14
17
  sanitize,
15
18
  'iso-locales': isoLocalesService,
16
- 'content-types': contentTypes
19
+ 'content-types': contentTypes,
20
+ 'ai-localizations': createAILocalizationsService,
21
+ 'ai-localization-jobs': createAILocalizationJobsService,
22
+ settings: createSettingsService
17
23
  };
18
24
 
19
25
  export { services as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../server/src/services/index.ts"],"sourcesContent":["import permissions from './permissions';\nimport metrics from './metrics';\nimport localizations from './localizations';\nimport locales from './locales';\nimport isoLocales from './iso-locales';\nimport contentTypes from './content-types';\nimport sanitize from './sanitize';\n\nexport default {\n permissions,\n metrics,\n localizations,\n locales,\n sanitize,\n 'iso-locales': isoLocales,\n 'content-types': contentTypes,\n};\n"],"names":["permissions","metrics","localizations","locales","sanitize","isoLocales","contentTypes"],"mappings":";;;;;;;;AAQA,eAAe;AACbA,IAAAA,WAAAA;AACAC,IAAAA,OAAAA;AACAC,IAAAA,aAAAA;AACAC,IAAAA,OAAAA;AACAC,IAAAA,QAAAA;IACA,aAAeC,EAAAA,iBAAAA;IACf,eAAiBC,EAAAA;AACnB,CAAE;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../server/src/services/index.ts"],"sourcesContent":["import permissions from './permissions';\nimport metrics from './metrics';\nimport localizations from './localizations';\nimport locales from './locales';\nimport isoLocales from './iso-locales';\nimport contentTypes from './content-types';\nimport sanitize from './sanitize';\nimport { createSettingsService } from './settings';\nimport { createAILocalizationsService } from './ai-localizations';\nimport { createAILocalizationJobsService } from './ai-localization-jobs';\n\nexport default {\n permissions,\n metrics,\n localizations,\n locales,\n sanitize,\n 'iso-locales': isoLocales,\n 'content-types': contentTypes,\n 'ai-localizations': createAILocalizationsService,\n 'ai-localization-jobs': createAILocalizationJobsService,\n settings: createSettingsService,\n};\n"],"names":["permissions","metrics","localizations","locales","sanitize","isoLocales","contentTypes","createAILocalizationsService","createAILocalizationJobsService","settings","createSettingsService"],"mappings":";;;;;;;;;;;AAWA,eAAe;AACbA,IAAAA,WAAAA;AACAC,IAAAA,OAAAA;AACAC,IAAAA,aAAAA;AACAC,IAAAA,OAAAA;AACAC,IAAAA,QAAAA;IACA,aAAeC,EAAAA,iBAAAA;IACf,eAAiBC,EAAAA,YAAAA;IACjB,kBAAoBC,EAAAA,4BAAAA;IACpB,sBAAwBC,EAAAA,+BAAAA;IACxBC,QAAUC,EAAAA;AACZ,CAAE;;;;"}
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ const createSettingsService = ({ strapi })=>{
4
+ const settings = strapi.store({
5
+ type: 'plugin',
6
+ name: 'i18n',
7
+ key: 'settings'
8
+ });
9
+ async function getSettings() {
10
+ const res = await settings.get({});
11
+ return res;
12
+ }
13
+ function setSettings(value) {
14
+ return settings.set({
15
+ value
16
+ });
17
+ }
18
+ return {
19
+ getSettings,
20
+ setSettings
21
+ };
22
+ };
23
+
24
+ exports.createSettingsService = createSettingsService;
25
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sources":["../../../server/src/services/settings.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport type { Settings } from '../validation/settings';\n\nconst createSettingsService = ({ strapi }: { strapi: Core.Strapi }) => {\n const settings = strapi.store!({ type: 'plugin', name: 'i18n', key: 'settings' });\n\n async function getSettings() {\n const res = (await settings.get({})) as Settings | null;\n\n return res;\n }\n\n function setSettings(value: Settings) {\n return settings.set({ value });\n }\n\n return {\n getSettings,\n setSettings,\n };\n};\n\nexport { createSettingsService };\nexport type SettingsService = ReturnType<typeof createSettingsService>;\n"],"names":["createSettingsService","strapi","settings","store","type","name","key","getSettings","res","get","setSettings","value","set"],"mappings":";;AAGA,MAAMA,qBAAwB,GAAA,CAAC,EAAEC,MAAM,EAA2B,GAAA;IAChE,MAAMC,QAAAA,GAAWD,MAAOE,CAAAA,KAAK,CAAE;QAAEC,IAAM,EAAA,QAAA;QAAUC,IAAM,EAAA,MAAA;QAAQC,GAAK,EAAA;AAAW,KAAA,CAAA;IAE/E,eAAeC,WAAAA,GAAAA;AACb,QAAA,MAAMC,GAAO,GAAA,MAAMN,QAASO,CAAAA,GAAG,CAAC,EAAC,CAAA;QAEjC,OAAOD,GAAAA;AACT;AAEA,IAAA,SAASE,YAAYC,KAAe,EAAA;QAClC,OAAOT,QAAAA,CAASU,GAAG,CAAC;AAAED,YAAAA;AAAM,SAAA,CAAA;AAC9B;IAEA,OAAO;AACLJ,QAAAA,WAAAA;AACAG,QAAAA;AACF,KAAA;AACF;;;;"}
@@ -0,0 +1,23 @@
1
+ const createSettingsService = ({ strapi })=>{
2
+ const settings = strapi.store({
3
+ type: 'plugin',
4
+ name: 'i18n',
5
+ key: 'settings'
6
+ });
7
+ async function getSettings() {
8
+ const res = await settings.get({});
9
+ return res;
10
+ }
11
+ function setSettings(value) {
12
+ return settings.set({
13
+ value
14
+ });
15
+ }
16
+ return {
17
+ getSettings,
18
+ setSettings
19
+ };
20
+ };
21
+
22
+ export { createSettingsService };
23
+ //# sourceMappingURL=settings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.mjs","sources":["../../../server/src/services/settings.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport type { Settings } from '../validation/settings';\n\nconst createSettingsService = ({ strapi }: { strapi: Core.Strapi }) => {\n const settings = strapi.store!({ type: 'plugin', name: 'i18n', key: 'settings' });\n\n async function getSettings() {\n const res = (await settings.get({})) as Settings | null;\n\n return res;\n }\n\n function setSettings(value: Settings) {\n return settings.set({ value });\n }\n\n return {\n getSettings,\n setSettings,\n };\n};\n\nexport { createSettingsService };\nexport type SettingsService = ReturnType<typeof createSettingsService>;\n"],"names":["createSettingsService","strapi","settings","store","type","name","key","getSettings","res","get","setSettings","value","set"],"mappings":"AAGA,MAAMA,qBAAwB,GAAA,CAAC,EAAEC,MAAM,EAA2B,GAAA;IAChE,MAAMC,QAAAA,GAAWD,MAAOE,CAAAA,KAAK,CAAE;QAAEC,IAAM,EAAA,QAAA;QAAUC,IAAM,EAAA,MAAA;QAAQC,GAAK,EAAA;AAAW,KAAA,CAAA;IAE/E,eAAeC,WAAAA,GAAAA;AACb,QAAA,MAAMC,GAAO,GAAA,MAAMN,QAASO,CAAAA,GAAG,CAAC,EAAC,CAAA;QAEjC,OAAOD,GAAAA;AACT;AAEA,IAAA,SAASE,YAAYC,KAAe,EAAA;QAClC,OAAOT,QAAAA,CAASU,GAAG,CAAC;AAAED,YAAAA;AAAM,SAAA,CAAA;AAC9B;IAEA,OAAO;AACLJ,QAAAA,WAAAA;AACAG,QAAAA;AACF,KAAA;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../server/src/bootstrap.ts"],"names":[],"mappings":";AA4DA,wBAuBE"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../server/src/bootstrap.ts"],"names":[],"mappings":";AA4DA,wBA0BE"}
@@ -0,0 +1,17 @@
1
+ import type { Core } from '@strapi/types';
2
+ declare const createAILocalizationJobsController: ({ strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => {
5
+ /**
6
+ * Get a job for a singleType using the contentType
7
+ * There is only 1 job per contentType
8
+ */
9
+ getJobForSingleType(ctx: any): Promise<any>;
10
+ /**
11
+ * Get a job for a collectionType using the documentId
12
+ * There is only 1 job per documentId
13
+ */
14
+ getJobForCollectionType(ctx: any): Promise<any>;
15
+ };
16
+ export default createAILocalizationJobsController;
17
+ //# sourceMappingURL=ai-localization-jobs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-localization-jobs.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/ai-localization-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,QAAA,MAAM,kCAAkC,eAAgB;IAAE,MAAM,EAAE,KAAK,MAAM,CAAA;CAAE;IAK3E;;;OAGG;6BAC4B,GAAG;IAkBlC;;;OAGG;iCACgC,GAAG;CAmBzC,CAAC;AAEF,eAAe,kCAAkC,CAAC"}
@@ -5,6 +5,16 @@ declare const _default: {
5
5
  'content-types': {
6
6
  getNonLocalizedAttributes(ctx: import("koa").Context): Promise<import("koa").Context | undefined>;
7
7
  };
8
+ settings: {
9
+ updateSettings(ctx: import("koa").Context): Promise<void>;
10
+ getSettings(ctx: import("koa").Context): Promise<void>;
11
+ };
12
+ 'ai-localization-jobs': ({ strapi }: {
13
+ strapi: import("@strapi/types/dist/core").Strapi;
14
+ }) => {
15
+ getJobForSingleType(ctx: any): Promise<any>;
16
+ getJobForCollectionType(ctx: any): Promise<any>;
17
+ };
8
18
  };
9
19
  export default _default;
10
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/index.ts"],"names":[],"mappings":";;;;;;;;AAIA,wBAIE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAMA,wBAME"}
@@ -0,0 +1,7 @@
1
+ import type { Context } from 'koa';
2
+ declare const _default: {
3
+ updateSettings(ctx: Context): Promise<void>;
4
+ getSettings(ctx: Context): Promise<void>;
5
+ };
6
+ export default _default;
7
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;;wBAMP,OAAO;qBAYV,OAAO;;AAbhC,wBAkBE"}
@@ -3,7 +3,7 @@
3
3
  declare const _default: () => {
4
4
  register: ({ strapi }: {
5
5
  strapi: import("@strapi/types/dist/core").Strapi;
6
- }) => void;
6
+ }) => Promise<void>;
7
7
  bootstrap: () => Promise<void>;
8
8
  routes: {
9
9
  admin: {
@@ -22,13 +22,9 @@ declare const _default: () => {
22
22
  };
23
23
  }[];
24
24
  };
25
- 'content-api': {
26
- type: string;
27
- routes: {
28
- method: string;
29
- path: string;
30
- handler: string;
31
- }[];
25
+ 'content-api': () => {
26
+ type: "content-api";
27
+ routes: import("@strapi/types/dist/core").RouteInput[];
32
28
  };
33
29
  };
34
30
  controllers: {
@@ -37,6 +33,16 @@ declare const _default: () => {
37
33
  'content-types': {
38
34
  getNonLocalizedAttributes(ctx: import("koa").Context): Promise<import("koa").Context | undefined>;
39
35
  };
36
+ settings: {
37
+ updateSettings(ctx: import("koa").Context): Promise<void>;
38
+ getSettings(ctx: import("koa").Context): Promise<void>;
39
+ };
40
+ 'ai-localization-jobs': ({ strapi }: {
41
+ strapi: import("@strapi/types/dist/core").Strapi;
42
+ }) => {
43
+ getJobForSingleType(ctx: any): Promise<any>;
44
+ getJobForCollectionType(ctx: any): Promise<any>;
45
+ };
40
46
  };
41
47
  contentTypes: {
42
48
  locale: {
@@ -150,6 +156,39 @@ declare const _default: () => {
150
156
  fillNonLocalizedAttributes: (entry: any, relatedEntry: any, { model }: any) => void;
151
157
  getNestedPopulateOfNonLocalizedAttributes: (modelUID: any) => string[];
152
158
  };
159
+ 'ai-localizations': ({ strapi }: {
160
+ strapi: import("@strapi/types/dist/core").Strapi;
161
+ }) => {
162
+ isEnabled(): Promise<boolean>;
163
+ generateDocumentLocalizations({ model, document, }: {
164
+ model: import("@strapi/types/dist/uid").ContentType;
165
+ document: import("@strapi/types/dist/modules/documents").AnyDocument;
166
+ }): Promise<void>;
167
+ setupMiddleware(): void;
168
+ };
169
+ 'ai-localization-jobs': ({ strapi }: {
170
+ strapi: import("@strapi/types/dist/core").Strapi;
171
+ }) => {
172
+ upsertJobForDocument({ documentId, contentType, sourceLocale, targetLocales, status, }: {
173
+ documentId: string;
174
+ contentType: string;
175
+ sourceLocale: string;
176
+ targetLocales: string[];
177
+ status?: "processing" | "completed" | "failed" | undefined;
178
+ }): Promise<any>;
179
+ getJobByDocument(contentType: string, documentId: string): Promise<any>;
180
+ getJobByContentType(contentType: string): Promise<any>;
181
+ };
182
+ settings: ({ strapi }: {
183
+ strapi: import("@strapi/types/dist/core").Strapi;
184
+ }) => {
185
+ getSettings: () => Promise<import("yup/lib/object").AssertsShape<{
186
+ aiLocalizations: import("yup").BooleanSchema<boolean, Record<string, any>, boolean>;
187
+ }> | null>;
188
+ setSettings: (value: import("yup/lib/object").AssertsShape<{
189
+ aiLocalizations: import("yup").BooleanSchema<boolean, Record<string, any>, boolean>;
190
+ }>) => Promise<void>;
191
+ };
153
192
  };
154
193
  };
155
194
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,wBAOG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,wBAOG"}
@@ -0,0 +1,5 @@
1
+ import type { Model } from '@strapi/database';
2
+ declare const AI_LOCALIZATION_JOB_UID = "plugin::i18n.ai-localization-job";
3
+ declare const aiLocalizationJob: Model;
4
+ export { aiLocalizationJob, AI_LOCALIZATION_JOB_UID };
5
+ //# sourceMappingURL=ai-localization-job.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-localization-job.d.ts","sourceRoot":"","sources":["../../../../server/src/models/ai-localization-job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,QAAA,MAAM,uBAAuB,qCAAqC,CAAC;AAEnE,QAAA,MAAM,iBAAiB,EAAE,KAsCxB,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ aiLocalizationJob: import("@strapi/database").Model;
3
+ };
4
+ export default _default;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/models/index.ts"],"names":[],"mappings":";;;AAEA,wBAEE"}
@@ -1,6 +1,6 @@
1
1
  import type { Core } from '@strapi/types';
2
2
  declare const _default: ({ strapi }: {
3
3
  strapi: Core.Strapi;
4
- }) => void;
4
+ }) => Promise<void>;
5
5
  export default _default;
6
6
  //# sourceMappingURL=register.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../server/src/register.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;qCAMd;IAAE,MAAM,EAAE,KAAK,MAAM,CAAA;CAAE;AAAnD,wBAGE"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../server/src/register.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;qCAOR;IAAE,MAAM,EAAE,KAAK,MAAM,CAAA;CAAE;AAAzD,wBAKE"}
@@ -1 +1 @@
1
- {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../../server/src/routes/admin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wBA4EE"}
1
+ {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../../server/src/routes/admin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wBA4GE"}
@@ -1,10 +1,7 @@
1
- declare const _default: {
2
- type: string;
3
- routes: {
4
- method: string;
5
- path: string;
6
- handler: string;
7
- }[];
1
+ import type { Core } from '@strapi/types';
2
+ declare const createContentApiRoutes: () => {
3
+ type: "content-api";
4
+ routes: Core.RouteInput[];
8
5
  };
9
- export default _default;
6
+ export default createContentApiRoutes;
10
7
  //# sourceMappingURL=content-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"content-api.d.ts","sourceRoot":"","sources":["../../../../server/src/routes/content-api.ts"],"names":[],"mappings":";;;;;;;;AAAA,wBASE"}
1
+ {"version":3,"file":"content-api.d.ts","sourceRoot":"","sources":["../../../../server/src/routes/content-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAI1C,QAAA,MAAM,sBAAsB;;;CAU1B,CAAC;AAEH,eAAe,sBAAsB,CAAC"}
@@ -15,13 +15,9 @@ declare const _default: {
15
15
  };
16
16
  }[];
17
17
  };
18
- 'content-api': {
19
- type: string;
20
- routes: {
21
- method: string;
22
- path: string;
23
- handler: string;
24
- }[];
18
+ 'content-api': () => {
19
+ type: "content-api";
20
+ routes: import("@strapi/types/dist/core").RouteInput[];
25
21
  };
26
22
  };
27
23
  export default _default;