@strapi/i18n 0.0.0-next.88599e70ce0e4e804e2bad578aba4718c5a5304d → 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 (91) hide show
  1. package/dist/admin/components/CMHeaderActions.js +18 -2
  2. package/dist/admin/components/CMHeaderActions.js.map +1 -1
  3. package/dist/admin/components/CMHeaderActions.mjs +18 -2
  4. package/dist/admin/components/CMHeaderActions.mjs.map +1 -1
  5. package/dist/admin/hooks/useAILocalizationJobsPolling.js +110 -0
  6. package/dist/admin/hooks/useAILocalizationJobsPolling.js.map +1 -0
  7. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs +89 -0
  8. package/dist/admin/hooks/useAILocalizationJobsPolling.mjs.map +1 -0
  9. package/dist/admin/services/aiLocalizationJobs.js +26 -0
  10. package/dist/admin/services/aiLocalizationJobs.js.map +1 -0
  11. package/dist/admin/services/aiLocalizationJobs.mjs +24 -0
  12. package/dist/admin/services/aiLocalizationJobs.mjs.map +1 -0
  13. package/dist/admin/services/api.js +2 -1
  14. package/dist/admin/services/api.js.map +1 -1
  15. package/dist/admin/services/api.mjs +2 -1
  16. package/dist/admin/services/api.mjs.map +1 -1
  17. package/dist/admin/src/components/CMHeaderActions.d.ts +1 -1
  18. package/dist/admin/src/hooks/useAILocalizationJobsPolling.d.ts +9 -0
  19. package/dist/admin/src/services/aiLocalizationJobs.d.ts +6 -0
  20. package/dist/admin/src/services/api.d.ts +1 -1
  21. package/dist/admin/src/services/locales.d.ts +1 -1
  22. package/dist/admin/src/services/relations.d.ts +1 -1
  23. package/dist/admin/src/services/settings.d.ts +2 -2
  24. package/dist/admin/translations/en.json.js +2 -0
  25. package/dist/admin/translations/en.json.js.map +1 -1
  26. package/dist/admin/translations/en.json.mjs +2 -0
  27. package/dist/admin/translations/en.json.mjs.map +1 -1
  28. package/dist/server/bootstrap.js +2 -0
  29. package/dist/server/bootstrap.js.map +1 -1
  30. package/dist/server/bootstrap.mjs +2 -0
  31. package/dist/server/bootstrap.mjs.map +1 -1
  32. package/dist/server/controllers/ai-localization-jobs.js +47 -0
  33. package/dist/server/controllers/ai-localization-jobs.js.map +1 -0
  34. package/dist/server/controllers/ai-localization-jobs.mjs +45 -0
  35. package/dist/server/controllers/ai-localization-jobs.mjs.map +1 -0
  36. package/dist/server/controllers/index.js +3 -1
  37. package/dist/server/controllers/index.js.map +1 -1
  38. package/dist/server/controllers/index.mjs +3 -1
  39. package/dist/server/controllers/index.mjs.map +1 -1
  40. package/dist/server/models/ai-localization-job.js +60 -0
  41. package/dist/server/models/ai-localization-job.js.map +1 -0
  42. package/dist/server/models/ai-localization-job.mjs +57 -0
  43. package/dist/server/models/ai-localization-job.mjs.map +1 -0
  44. package/dist/server/register.js +3 -1
  45. package/dist/server/register.js.map +1 -1
  46. package/dist/server/register.mjs +3 -1
  47. package/dist/server/register.mjs.map +1 -1
  48. package/dist/server/routes/admin.js +20 -0
  49. package/dist/server/routes/admin.js.map +1 -1
  50. package/dist/server/routes/admin.mjs +20 -0
  51. package/dist/server/routes/admin.mjs.map +1 -1
  52. package/dist/server/services/ai-localization-jobs.js +64 -0
  53. package/dist/server/services/ai-localization-jobs.js.map +1 -0
  54. package/dist/server/services/ai-localization-jobs.mjs +62 -0
  55. package/dist/server/services/ai-localization-jobs.mjs.map +1 -0
  56. package/dist/server/services/ai-localizations.js +209 -0
  57. package/dist/server/services/ai-localizations.js.map +1 -1
  58. package/dist/server/services/ai-localizations.mjs +209 -0
  59. package/dist/server/services/ai-localizations.mjs.map +1 -1
  60. package/dist/server/services/index.js +3 -1
  61. package/dist/server/services/index.js.map +1 -1
  62. package/dist/server/services/index.mjs +3 -1
  63. package/dist/server/services/index.mjs.map +1 -1
  64. package/dist/server/src/bootstrap.d.ts.map +1 -1
  65. package/dist/server/src/controllers/ai-localization-jobs.d.ts +17 -0
  66. package/dist/server/src/controllers/ai-localization-jobs.d.ts.map +1 -0
  67. package/dist/server/src/controllers/index.d.ts +6 -0
  68. package/dist/server/src/controllers/index.d.ts.map +1 -1
  69. package/dist/server/src/index.d.ts +26 -2
  70. package/dist/server/src/index.d.ts.map +1 -1
  71. package/dist/server/src/models/ai-localization-job.d.ts +5 -0
  72. package/dist/server/src/models/ai-localization-job.d.ts.map +1 -0
  73. package/dist/server/src/models/index.d.ts +5 -0
  74. package/dist/server/src/models/index.d.ts.map +1 -0
  75. package/dist/server/src/register.d.ts +1 -1
  76. package/dist/server/src/register.d.ts.map +1 -1
  77. package/dist/server/src/routes/admin.d.ts.map +1 -1
  78. package/dist/server/src/services/ai-localization-jobs.d.ts +26 -0
  79. package/dist/server/src/services/ai-localization-jobs.d.ts.map +1 -0
  80. package/dist/server/src/services/ai-localizations.d.ts +11 -1
  81. package/dist/server/src/services/ai-localizations.d.ts.map +1 -1
  82. package/dist/server/src/services/index.d.ts +19 -1
  83. package/dist/server/src/services/index.d.ts.map +1 -1
  84. package/dist/server/src/utils/index.d.ts +4 -0
  85. package/dist/server/src/utils/index.d.ts.map +1 -1
  86. package/dist/server/utils/index.js.map +1 -1
  87. package/dist/server/utils/index.mjs.map +1 -1
  88. package/dist/shared/contracts/ai-localization-jobs.d.ts +27 -0
  89. package/dist/shared/contracts/ai-localization-jobs.d.ts.map +1 -0
  90. package/dist/shared/contracts/shared.d.ts.map +1 -0
  91. package/package.json +7 -6
@@ -114,6 +114,26 @@ var admin = {
114
114
  'admin::isAuthenticatedAdmin'
115
115
  ]
116
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
+ }
117
137
  }
118
138
  ]
119
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 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};\n"],"names":["type","routes","method","path","handler","config","polic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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,SAAA;AACA,QAAA;YACEJ,MAAQ,EAAA,KAAA;YACRC,IAAM,EAAA,WAAA;YACNC,OAAS,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;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,QA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A,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;;;;"}
@@ -112,6 +112,26 @@ var admin = {
112
112
  'admin::isAuthenticatedAdmin'
113
113
  ]
114
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
+ }
115
135
  }
116
136
  ]
117
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 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};\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,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AAC,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;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,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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AQ,EAAA;gBACNC,QAAU,EAAA;AAAC,oBAAA;AAA8B;AAC3C;AACF;AACD;AACH,CAAE;;;;"}
@@ -0,0 +1,64 @@
1
+ 'use strict';
2
+
3
+ var aiLocalizationJob = require('../models/ai-localization-job.js');
4
+
5
+ const createAILocalizationJobsService = ({ strapi })=>({
6
+ /**
7
+ * Create a new AI localizations job or update an existing one for a document
8
+ * Ensures only one job exists per document
9
+ */ async upsertJobForDocument ({ documentId, contentType, sourceLocale, targetLocales, status = 'processing' }) {
10
+ // Check if job already exists for this document
11
+ const existingJob = await this.getJobByDocument(contentType, documentId);
12
+ if (existingJob) {
13
+ strapi.log.info(`[AI Localizations Job] Updated existing job for document ${documentId} with status: ${status}`);
14
+ // Update existing job with new data and status
15
+ return strapi.db.query(aiLocalizationJob.AI_LOCALIZATION_JOB_UID).update({
16
+ where: {
17
+ id: existingJob.id
18
+ },
19
+ data: {
20
+ contentType,
21
+ sourceLocale,
22
+ targetLocales,
23
+ status,
24
+ updatedAt: new Date()
25
+ }
26
+ });
27
+ }
28
+ strapi.log.info(`[AI Localizations Job] Created new job for document ${documentId} with status: ${status}`);
29
+ // Create new AI localizations job
30
+ return strapi.db.query(aiLocalizationJob.AI_LOCALIZATION_JOB_UID).create({
31
+ data: {
32
+ contentType,
33
+ relatedDocumentId: documentId,
34
+ sourceLocale,
35
+ targetLocales,
36
+ status,
37
+ createdAt: new Date(),
38
+ updatedAt: new Date()
39
+ }
40
+ });
41
+ },
42
+ /**
43
+ * Get job by document ID
44
+ */ async getJobByDocument (contentType, documentId) {
45
+ return strapi.db.query(aiLocalizationJob.AI_LOCALIZATION_JOB_UID).findOne({
46
+ where: {
47
+ relatedDocumentId: documentId,
48
+ contentType
49
+ }
50
+ });
51
+ },
52
+ /**
53
+ * Get job by content type
54
+ */ async getJobByContentType (contentType) {
55
+ return strapi.db.query(aiLocalizationJob.AI_LOCALIZATION_JOB_UID).findOne({
56
+ where: {
57
+ contentType
58
+ }
59
+ });
60
+ }
61
+ });
62
+
63
+ exports.createAILocalizationJobsService = createAILocalizationJobsService;
64
+ //# sourceMappingURL=ai-localization-jobs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-localization-jobs.js","sources":["../../../server/src/services/ai-localization-jobs.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { AI_LOCALIZATION_JOB_UID } from '../models/ai-localization-job';\nimport type { AILocalizationJobs } from '../../../shared/contracts/ai-localization-jobs';\n\nexport const createAILocalizationJobsService = ({ strapi }: { strapi: Core.Strapi }) => ({\n /**\n * Create a new AI localizations job or update an existing one for a document\n * Ensures only one job exists per document\n */\n async upsertJobForDocument({\n documentId,\n contentType,\n sourceLocale,\n targetLocales,\n status = 'processing',\n }: {\n documentId: string;\n contentType: string;\n sourceLocale: string;\n targetLocales: string[];\n status?: AILocalizationJobs['status'];\n }) {\n // Check if job already exists for this document\n const existingJob = await this.getJobByDocument(contentType, documentId);\n\n if (existingJob) {\n strapi.log.info(\n `[AI Localizations Job] Updated existing job for document ${documentId} with status: ${status}`\n );\n // Update existing job with new data and status\n return strapi.db.query(AI_LOCALIZATION_JOB_UID).update({\n where: { id: existingJob.id },\n data: {\n contentType,\n sourceLocale,\n targetLocales,\n status,\n updatedAt: new Date(),\n },\n });\n }\n\n strapi.log.info(\n `[AI Localizations Job] Created new job for document ${documentId} with status: ${status}`\n );\n // Create new AI localizations job\n return strapi.db.query(AI_LOCALIZATION_JOB_UID).create({\n data: {\n contentType,\n relatedDocumentId: documentId,\n sourceLocale,\n targetLocales,\n status,\n createdAt: new Date(),\n updatedAt: new Date(),\n },\n });\n },\n\n /**\n * Get job by document ID\n */\n async getJobByDocument(contentType: string, documentId: string) {\n return strapi.db.query(AI_LOCALIZATION_JOB_UID).findOne({\n where: {\n relatedDocumentId: documentId,\n contentType,\n },\n });\n },\n\n /**\n * Get job by content type\n */\n async getJobByContentType(contentType: string) {\n return strapi.db.query(AI_LOCALIZATION_JOB_UID).findOne({\n where: {\n contentType,\n },\n });\n },\n});\n"],"names":["createAILocalizationJobsService","strapi","upsertJobForDocument","documentId","contentType","sourceLocale","targetLocales","status","existingJob","getJobByDocument","log","info","db","query","AI_LOCALIZATION_JOB_UID","update","where","id","data","updatedAt","Date","create","relatedDocumentId","createdAt","findOne","getJobByContentType"],"mappings":";;;;MAIaA,+BAAkC,GAAA,CAAC,EAAEC,MAAM,EAA2B,IAAM;AACvF;;;AAGC,MACD,MAAMC,oBAAAA,CAAAA,CAAqB,EACzBC,UAAU,EACVC,WAAW,EACXC,YAAY,EACZC,aAAa,EACbC,MAAAA,GAAS,YAAY,EAOtB,EAAA;;AAEC,YAAA,MAAMC,cAAc,MAAM,IAAI,CAACC,gBAAgB,CAACL,WAAaD,EAAAA,UAAAA,CAAAA;AAE7D,YAAA,IAAIK,WAAa,EAAA;gBACfP,MAAOS,CAAAA,GAAG,CAACC,IAAI,CACb,CAAC,yDAAyD,EAAER,UAAW,CAAA,cAAc,EAAEI,MAAAA,CAAO,CAAC,CAAA;;AAGjG,gBAAA,OAAON,OAAOW,EAAE,CAACC,KAAK,CAACC,yCAAAA,CAAAA,CAAyBC,MAAM,CAAC;oBACrDC,KAAO,EAAA;AAAEC,wBAAAA,EAAAA,EAAIT,YAAYS;AAAG,qBAAA;oBAC5BC,IAAM,EAAA;AACJd,wBAAAA,WAAAA;AACAC,wBAAAA,YAAAA;AACAC,wBAAAA,aAAAA;AACAC,wBAAAA,MAAAA;AACAY,wBAAAA,SAAAA,EAAW,IAAIC,IAAAA;AACjB;AACF,iBAAA,CAAA;AACF;YAEAnB,MAAOS,CAAAA,GAAG,CAACC,IAAI,CACb,CAAC,oDAAoD,EAAER,UAAW,CAAA,cAAc,EAAEI,MAAAA,CAAO,CAAC,CAAA;;AAG5F,YAAA,OAAON,OAAOW,EAAE,CAACC,KAAK,CAACC,yCAAAA,CAAAA,CAAyBO,MAAM,CAAC;gBACrDH,IAAM,EAAA;AACJd,oBAAAA,WAAAA;oBACAkB,iBAAmBnB,EAAAA,UAAAA;AACnBE,oBAAAA,YAAAA;AACAC,oBAAAA,aAAAA;AACAC,oBAAAA,MAAAA;AACAgB,oBAAAA,SAAAA,EAAW,IAAIH,IAAAA,EAAAA;AACfD,oBAAAA,SAAAA,EAAW,IAAIC,IAAAA;AACjB;AACF,aAAA,CAAA;AACF,SAAA;AAEA;;AAEC,MACD,MAAMX,gBAAAA,CAAAA,CAAiBL,WAAmB,EAAED,UAAkB,EAAA;AAC5D,YAAA,OAAOF,OAAOW,EAAE,CAACC,KAAK,CAACC,yCAAAA,CAAAA,CAAyBU,OAAO,CAAC;gBACtDR,KAAO,EAAA;oBACLM,iBAAmBnB,EAAAA,UAAAA;AACnBC,oBAAAA;AACF;AACF,aAAA,CAAA;AACF,SAAA;AAEA;;MAGA,MAAMqB,qBAAoBrB,WAAmB,EAAA;AAC3C,YAAA,OAAOH,OAAOW,EAAE,CAACC,KAAK,CAACC,yCAAAA,CAAAA,CAAyBU,OAAO,CAAC;gBACtDR,KAAO,EAAA;AACLZ,oBAAAA;AACF;AACF,aAAA,CAAA;AACF;AACF,KAAA;;;;"}
@@ -0,0 +1,62 @@
1
+ import { AI_LOCALIZATION_JOB_UID } from '../models/ai-localization-job.mjs';
2
+
3
+ const createAILocalizationJobsService = ({ strapi })=>({
4
+ /**
5
+ * Create a new AI localizations job or update an existing one for a document
6
+ * Ensures only one job exists per document
7
+ */ async upsertJobForDocument ({ documentId, contentType, sourceLocale, targetLocales, status = 'processing' }) {
8
+ // Check if job already exists for this document
9
+ const existingJob = await this.getJobByDocument(contentType, documentId);
10
+ if (existingJob) {
11
+ strapi.log.info(`[AI Localizations Job] Updated existing job for document ${documentId} with status: ${status}`);
12
+ // Update existing job with new data and status
13
+ return strapi.db.query(AI_LOCALIZATION_JOB_UID).update({
14
+ where: {
15
+ id: existingJob.id
16
+ },
17
+ data: {
18
+ contentType,
19
+ sourceLocale,
20
+ targetLocales,
21
+ status,
22
+ updatedAt: new Date()
23
+ }
24
+ });
25
+ }
26
+ strapi.log.info(`[AI Localizations Job] Created new job for document ${documentId} with status: ${status}`);
27
+ // Create new AI localizations job
28
+ return strapi.db.query(AI_LOCALIZATION_JOB_UID).create({
29
+ data: {
30
+ contentType,
31
+ relatedDocumentId: documentId,
32
+ sourceLocale,
33
+ targetLocales,
34
+ status,
35
+ createdAt: new Date(),
36
+ updatedAt: new Date()
37
+ }
38
+ });
39
+ },
40
+ /**
41
+ * Get job by document ID
42
+ */ async getJobByDocument (contentType, documentId) {
43
+ return strapi.db.query(AI_LOCALIZATION_JOB_UID).findOne({
44
+ where: {
45
+ relatedDocumentId: documentId,
46
+ contentType
47
+ }
48
+ });
49
+ },
50
+ /**
51
+ * Get job by content type
52
+ */ async getJobByContentType (contentType) {
53
+ return strapi.db.query(AI_LOCALIZATION_JOB_UID).findOne({
54
+ where: {
55
+ contentType
56
+ }
57
+ });
58
+ }
59
+ });
60
+
61
+ export { createAILocalizationJobsService };
62
+ //# sourceMappingURL=ai-localization-jobs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-localization-jobs.mjs","sources":["../../../server/src/services/ai-localization-jobs.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\nimport { AI_LOCALIZATION_JOB_UID } from '../models/ai-localization-job';\nimport type { AILocalizationJobs } from '../../../shared/contracts/ai-localization-jobs';\n\nexport const createAILocalizationJobsService = ({ strapi }: { strapi: Core.Strapi }) => ({\n /**\n * Create a new AI localizations job or update an existing one for a document\n * Ensures only one job exists per document\n */\n async upsertJobForDocument({\n documentId,\n contentType,\n sourceLocale,\n targetLocales,\n status = 'processing',\n }: {\n documentId: string;\n contentType: string;\n sourceLocale: string;\n targetLocales: string[];\n status?: AILocalizationJobs['status'];\n }) {\n // Check if job already exists for this document\n const existingJob = await this.getJobByDocument(contentType, documentId);\n\n if (existingJob) {\n strapi.log.info(\n `[AI Localizations Job] Updated existing job for document ${documentId} with status: ${status}`\n );\n // Update existing job with new data and status\n return strapi.db.query(AI_LOCALIZATION_JOB_UID).update({\n where: { id: existingJob.id },\n data: {\n contentType,\n sourceLocale,\n targetLocales,\n status,\n updatedAt: new Date(),\n },\n });\n }\n\n strapi.log.info(\n `[AI Localizations Job] Created new job for document ${documentId} with status: ${status}`\n );\n // Create new AI localizations job\n return strapi.db.query(AI_LOCALIZATION_JOB_UID).create({\n data: {\n contentType,\n relatedDocumentId: documentId,\n sourceLocale,\n targetLocales,\n status,\n createdAt: new Date(),\n updatedAt: new Date(),\n },\n });\n },\n\n /**\n * Get job by document ID\n */\n async getJobByDocument(contentType: string, documentId: string) {\n return strapi.db.query(AI_LOCALIZATION_JOB_UID).findOne({\n where: {\n relatedDocumentId: documentId,\n contentType,\n },\n });\n },\n\n /**\n * Get job by content type\n */\n async getJobByContentType(contentType: string) {\n return strapi.db.query(AI_LOCALIZATION_JOB_UID).findOne({\n where: {\n contentType,\n },\n });\n },\n});\n"],"names":["createAILocalizationJobsService","strapi","upsertJobForDocument","documentId","contentType","sourceLocale","targetLocales","status","existingJob","getJobByDocument","log","info","db","query","AI_LOCALIZATION_JOB_UID","update","where","id","data","updatedAt","Date","create","relatedDocumentId","createdAt","findOne","getJobByContentType"],"mappings":";;MAIaA,+BAAkC,GAAA,CAAC,EAAEC,MAAM,EAA2B,IAAM;AACvF;;;AAGC,MACD,MAAMC,oBAAAA,CAAAA,CAAqB,EACzBC,UAAU,EACVC,WAAW,EACXC,YAAY,EACZC,aAAa,EACbC,MAAAA,GAAS,YAAY,EAOtB,EAAA;;AAEC,YAAA,MAAMC,cAAc,MAAM,IAAI,CAACC,gBAAgB,CAACL,WAAaD,EAAAA,UAAAA,CAAAA;AAE7D,YAAA,IAAIK,WAAa,EAAA;gBACfP,MAAOS,CAAAA,GAAG,CAACC,IAAI,CACb,CAAC,yDAAyD,EAAER,UAAW,CAAA,cAAc,EAAEI,MAAAA,CAAO,CAAC,CAAA;;AAGjG,gBAAA,OAAON,OAAOW,EAAE,CAACC,KAAK,CAACC,uBAAAA,CAAAA,CAAyBC,MAAM,CAAC;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';
2
2
 
3
+ var utils = require('@strapi/utils');
4
+ var index = require('../utils/index.js');
5
+
6
+ const isLocalizedAttribute = (attribute)=>{
7
+ return attribute?.pluginOptions?.i18n?.localized === true;
8
+ };
3
9
  const createAILocalizationsService = ({ strapi })=>{
10
+ // TODO: add a helper function to get the AI server URL
11
+ const aiServerUrl = process.env.STRAPI_AI_URL || 'https://strapi-ai.apps.strapi.io';
12
+ const aiLocalizationJobsService = index.getService('ai-localization-jobs');
13
+ const UNSUPPORTED_ATTRIBUTE_TYPES = [
14
+ 'media',
15
+ 'relation'
16
+ ];
4
17
  return {
5
18
  // Async to avoid changing the signature later (there will be a db check in the future)
6
19
  async isEnabled () {
@@ -19,7 +32,203 @@ const createAILocalizationsService = ({ strapi })=>{
19
32
  if (!hasAccess) {
20
33
  return false;
21
34
  }
35
+ const settings = index.getService('settings');
36
+ const aiSettings = await settings.getSettings();
37
+ if (!aiSettings?.aiLocalizations) {
38
+ return false;
39
+ }
22
40
  return true;
41
+ },
42
+ /**
43
+ * Checks if there are localizations that need to be generated for the given document,
44
+ * and if so, calls the AI service and saves the results to the database.
45
+ * Works for both single and collection types, on create and update.
46
+ */ async generateDocumentLocalizations ({ model, document }) {
47
+ const isFeatureEnabled = await this.isEnabled();
48
+ if (!isFeatureEnabled) {
49
+ return;
50
+ }
51
+ const schema = strapi.getModel(model);
52
+ const localeService = index.getService('locales');
53
+ // No localizations needed for content types with i18n disabled
54
+ const isLocalizedContentType = index.getService('content-types').isLocalizedContentType(schema);
55
+ if (!isLocalizedContentType) {
56
+ return;
57
+ }
58
+ // Don't trigger localizations if the update is on a derived locale, only do it on the default
59
+ const defaultLocale = await localeService.getDefaultLocale();
60
+ if (document?.locale !== defaultLocale) {
61
+ return;
62
+ }
63
+ const documentId = document.documentId;
64
+ if (!documentId) {
65
+ strapi.log.warn(`AI Localizations: missing documentId for ${schema.uid}`);
66
+ return;
67
+ }
68
+ // Extract only the localized content from the document
69
+ const translateableContent = await utils.traverseEntity(({ key, attribute }, { remove })=>{
70
+ const hasLocalizedOption = attribute && isLocalizedAttribute(attribute);
71
+ // Only keep fields that actually need to be localized
72
+ // TODO: remove blocks from this list once the AI server can handle it reliably
73
+ if (!hasLocalizedOption || UNSUPPORTED_ATTRIBUTE_TYPES.includes(attribute.type)) {
74
+ remove(key);
75
+ }
76
+ }, {
77
+ schema,
78
+ getModel: strapi.getModel.bind(strapi)
79
+ }, document);
80
+ // Call the AI server to get the localized content
81
+ const localesList = await localeService.find();
82
+ const targetLocales = localesList.filter((l)=>l.code !== document.locale).map((l)=>l.code);
83
+ if (targetLocales.length === 0) {
84
+ strapi.log.info(`AI Localizations: no target locales for ${schema.uid} document ${documentId}`);
85
+ return;
86
+ }
87
+ await aiLocalizationJobsService.upsertJobForDocument({
88
+ contentType: model,
89
+ documentId,
90
+ sourceLocale: document.locale,
91
+ targetLocales,
92
+ status: 'processing'
93
+ });
94
+ let token;
95
+ try {
96
+ const tokenData = await strapi.service('admin::user').getAiToken();
97
+ token = tokenData.token;
98
+ } catch (error) {
99
+ await aiLocalizationJobsService.upsertJobForDocument({
100
+ documentId,
101
+ contentType: model,
102
+ sourceLocale: document.locale,
103
+ targetLocales,
104
+ status: 'failed'
105
+ });
106
+ throw new Error('Failed to retrieve AI token', {
107
+ cause: error instanceof Error ? error : undefined
108
+ });
109
+ }
110
+ /**
111
+ * Provide a schema to the LLM so that we can give it instructions about how to handle each
112
+ * type of attribute. Only keep essential schema data to avoid cluttering the context.
113
+ * Ignore fields that don't need to be localized.
114
+ * TODO: also provide a schema of all the referenced components
115
+ */ const minimalContentTypeSchema = Object.fromEntries(Object.entries(schema.attributes)// eslint-disable-next-line @typescript-eslint/no-unused-vars
116
+ .filter(([_, attr])=>{
117
+ const isLocalized = isLocalizedAttribute(attr);
118
+ const isSupportedType = !UNSUPPORTED_ATTRIBUTE_TYPES.includes(attr.type);
119
+ return isLocalized && isSupportedType;
120
+ }).map(([key, attr])=>{
121
+ const minimalAttribute = {
122
+ type: attr.type
123
+ };
124
+ if (attr.type === 'component') {
125
+ minimalAttribute.repeatable = attr.repeatable ?? false;
126
+ }
127
+ return [
128
+ key,
129
+ minimalAttribute
130
+ ];
131
+ }));
132
+ strapi.log.http('Contacting AI Server for localizations generation');
133
+ const response = await fetch(`${aiServerUrl}/i18n/generate-localizations`, {
134
+ method: 'POST',
135
+ headers: {
136
+ 'Content-Type': 'application/json',
137
+ Authorization: `Bearer ${token}`
138
+ },
139
+ body: JSON.stringify({
140
+ content: translateableContent,
141
+ sourceLocale: document.locale,
142
+ targetLocales,
143
+ contentTypeSchema: minimalContentTypeSchema
144
+ })
145
+ });
146
+ if (!response.ok) {
147
+ strapi.log.error(`AI Localizations request failed: ${response.status} ${response.statusText}`);
148
+ await aiLocalizationJobsService.upsertJobForDocument({
149
+ documentId,
150
+ contentType: model,
151
+ sourceLocale: document.locale,
152
+ targetLocales,
153
+ status: 'failed'
154
+ });
155
+ throw new Error(`AI Localizations request failed: ${response.statusText}`);
156
+ } else {
157
+ await aiLocalizationJobsService.upsertJobForDocument({
158
+ documentId,
159
+ contentType: model,
160
+ sourceLocale: document.locale,
161
+ targetLocales,
162
+ status: 'completed'
163
+ });
164
+ }
165
+ const aiResult = await response.json();
166
+ // Get all media field names dynamically from the schema
167
+ const mediaFields = Object.entries(schema.attributes)// eslint-disable-next-line @typescript-eslint/no-unused-vars
168
+ .filter(([_, attr])=>attr.type === 'media').map(([key])=>key);
169
+ try {
170
+ await Promise.allSettled(aiResult.localizations.map(async (localization)=>{
171
+ const { content, locale } = localization;
172
+ // Fetch the derived locale document
173
+ const derivedDoc = await strapi.documents(model).findOne({
174
+ documentId,
175
+ locale,
176
+ populate: mediaFields
177
+ });
178
+ // Merge AI content and media fields
179
+ const mergedData = {
180
+ ...content
181
+ };
182
+ for (const field of mediaFields){
183
+ // Only copy media if not already set in derived locale
184
+ if (!derivedDoc || !derivedDoc[field]) {
185
+ mergedData[field] = document[field];
186
+ } else {
187
+ mergedData[field] = derivedDoc[field];
188
+ }
189
+ }
190
+ return strapi.documents(model).update({
191
+ documentId,
192
+ locale,
193
+ fields: [],
194
+ data: mergedData
195
+ });
196
+ }));
197
+ } catch (error) {
198
+ await aiLocalizationJobsService.upsertJobForDocument({
199
+ documentId,
200
+ contentType: model,
201
+ sourceLocale: document.locale,
202
+ targetLocales,
203
+ status: 'failed'
204
+ });
205
+ strapi.log.error('AI Localizations generation failed', error);
206
+ }
207
+ },
208
+ setupMiddleware () {
209
+ strapi.documents.use(async (context, next)=>{
210
+ const result = await next();
211
+ // Only trigger on create/update actions
212
+ if (![
213
+ 'create',
214
+ 'update'
215
+ ].includes(context.action)) {
216
+ return result;
217
+ }
218
+ // Check if AI localizations are enabled before triggering
219
+ const isEnabled = await this.isEnabled();
220
+ if (!isEnabled) {
221
+ return result;
222
+ }
223
+ // Don't await since localizations should be done in the background without blocking the request
224
+ strapi.plugin('i18n').service('ai-localizations').generateDocumentLocalizations({
225
+ model: context.contentType.uid,
226
+ document: result
227
+ }).catch((error)=>{
228
+ strapi.log.error('AI Localizations generation failed', error);
229
+ });
230
+ return result;
231
+ });
23
232
  }
24
233
  };
25
234
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ai-localizations.js","sources":["../../../server/src/services/ai-localizations.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nconst createAILocalizationsService = ({ strapi }: { strapi: Core.Strapi }) => {\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 return true;\n },\n };\n};\n\nexport { createAILocalizationsService };\n"],"names":["createAILocalizationsService","strapi","isEnabled","isFutureFlagEnabled","features","future","isAIEnabled","config","get","hasAccess","ee"],"mappings":";;AAEA,MAAMA,4BAA+B,GAAA,CAAC,EAAEC,MAAM,EAA2B,GAAA;IACvE,OAAO;;QAEL,MAAMC,SAAAA,CAAAA,GAAAA;;AAEJ,YAAA,MAAMC,sBAAsBF,MAAOG,CAAAA,QAAQ,CAACC,MAAM,CAACH,SAAS,CAAC,yBAAA,CAAA;AAC7D,YAAA,IAAI,CAACC,mBAAqB,EAAA;gBACxB,OAAO,KAAA;AACT;;AAGA,YAAA,MAAMG,cAAcL,MAAOM,CAAAA,MAAM,CAACC,GAAG,CAAC,kBAAoB,EAAA,IAAA,CAAA;AAC1D,YAAA,IAAI,CAACF,WAAa,EAAA;gBAChB,OAAO,KAAA;AACT;;AAGA,YAAA,MAAMG,YAAYR,MAAOS,CAAAA,EAAE,CAACN,QAAQ,CAACF,SAAS,CAAC,QAAA,CAAA;AAC/C,YAAA,IAAI,CAACO,SAAW,EAAA;gBACd,OAAO,KAAA;AACT;YAEA,OAAO,IAAA;AACT;AACF,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"ai-localizations.js","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,gBAAW,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,CAA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