@localazy/strapi-plugin 0.2.13 → 1.0.0-beta.0

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 (392) hide show
  1. package/README.md +3 -1
  2. package/dist/_chunks/App-BSFfgZKU.mjs +5278 -0
  3. package/dist/_chunks/App-D1QaIMHX.js +5278 -0
  4. package/dist/_chunks/ContentTransferSetup-DHXJIxAp.js +1552 -0
  5. package/dist/_chunks/ContentTransferSetup-DtjcF_jM.mjs +1550 -0
  6. package/dist/_chunks/GlobalSettings-BON3kjHK.js +228 -0
  7. package/dist/_chunks/GlobalSettings-BcdibqNS.mjs +228 -0
  8. package/dist/_chunks/LanguagesSelector-BeijBEjg.js +47 -0
  9. package/dist/_chunks/LanguagesSelector-fyAIUp7M.mjs +48 -0
  10. package/dist/_chunks/en-BTf8goGM.mjs +8 -0
  11. package/dist/_chunks/en-CRtsEFtl.js +8 -0
  12. package/dist/_chunks/fr-C8Qw4iPZ.js +4 -0
  13. package/dist/_chunks/fr-hkSxFuzl.mjs +4 -0
  14. package/dist/_chunks/has-model-changed-BMCQX2Dd.js +316 -0
  15. package/dist/_chunks/has-model-changed-Dvtzpc9v.mjs +317 -0
  16. package/dist/_chunks/index-BQw2qi2G.js +2679 -0
  17. package/dist/_chunks/index-CN3Gyh5F.mjs +2678 -0
  18. package/dist/_chunks/isEqual-B-YVnzrp.js +205 -0
  19. package/dist/_chunks/isEqual-CEyT97-3.mjs +206 -0
  20. package/dist/_chunks/set-DUdH3vE5.js +54557 -0
  21. package/dist/_chunks/set-DulHAQhq.mjs +54542 -0
  22. package/dist/admin/index.js +4 -0
  23. package/dist/admin/index.mjs +5 -0
  24. package/dist/admin/src/components/Initializer.d.ts +5 -0
  25. package/dist/admin/src/config/development/index.d.ts +15 -0
  26. package/dist/admin/src/config/example/index.example.d.ts +15 -0
  27. package/dist/admin/src/config/index.d.ts +15 -0
  28. package/dist/admin/src/config/local/index.d.ts +15 -0
  29. package/dist/admin/src/config/production/index.d.ts +15 -0
  30. package/dist/admin/src/i18n.d.ts +2 -0
  31. package/dist/admin/src/index.d.ts +10 -0
  32. package/dist/admin/src/modules/@common/api/strapi-api-base.d.ts +6 -0
  33. package/dist/admin/src/modules/@common/components/Icons/House.d.ts +2 -0
  34. package/dist/admin/src/modules/@common/components/Icons/Localazy.d.ts +2 -0
  35. package/dist/admin/src/modules/@common/components/LanguagesSelector.d.ts +11 -0
  36. package/dist/admin/src/modules/@common/components/PluginPageLoader.d.ts +2 -0
  37. package/dist/admin/src/modules/@common/components/SideNav.d.ts +2 -0
  38. package/dist/admin/src/modules/@common/components/TransferReport.d.ts +5 -0
  39. package/dist/admin/src/modules/@common/functions/flatten-deep.d.ts +2 -0
  40. package/dist/admin/src/modules/@common/locale/en.d.ts +14 -0
  41. package/dist/admin/src/modules/@common/models/supported-content-type-fields.d.ts +2 -0
  42. package/dist/admin/src/modules/@common/models/supported-custom-field-plugins.d.ts +2 -0
  43. package/dist/admin/src/modules/@common/services/i18n-service.d.ts +3 -0
  44. package/dist/admin/src/modules/@common/services/plugin.service.d.ts +3 -0
  45. package/dist/admin/src/modules/@common/services/product-analytics-service.d.ts +14 -0
  46. package/dist/admin/src/modules/@common/services/project-service.d.ts +4 -0
  47. package/dist/admin/src/modules/@common/services/user-service.d.ts +5 -0
  48. package/dist/admin/src/modules/@common/utils/are-locales-compatible.d.ts +2 -0
  49. package/dist/admin/src/modules/@common/utils/format-number.d.ts +2 -0
  50. package/dist/admin/src/modules/@common/utils/get-default-locale.d.ts +2 -0
  51. package/dist/admin/src/modules/@common/utils/history.d.ts +2 -0
  52. package/dist/admin/src/modules/@common/utils/is-plugin-route.d.ts +2 -0
  53. package/dist/admin/src/modules/@common/utils/iso-locales-utils.d.ts +3 -0
  54. package/dist/admin/src/modules/@common/utils/redirect-to-plugin-route.d.ts +13 -0
  55. package/dist/admin/src/modules/@common/utils/sort-by-model-name.d.ts +2 -0
  56. package/dist/admin/src/modules/@common/utils/use-header-subtitle.d.ts +2 -0
  57. package/dist/admin/src/modules/@common/utils/use-header-title.d.ts +2 -0
  58. package/dist/admin/src/modules/@common/utils/use-nav.d.ts +11 -0
  59. package/dist/admin/src/modules/alerts/constants/channels.d.ts +1 -0
  60. package/dist/admin/src/modules/alerts/constants/events.d.ts +4 -0
  61. package/dist/admin/src/modules/alerts/services/alerts-service.d.ts +8 -0
  62. package/dist/admin/src/modules/localazy-download/locale/en.d.ts +24 -0
  63. package/dist/admin/src/modules/localazy-download/services/download-alerts-service.d.ts +5 -0
  64. package/dist/admin/src/modules/localazy-download/services/localazy-download-service.d.ts +3 -0
  65. package/dist/admin/src/modules/localazy-upload/components/ReadDocsButton.d.ts +3 -0
  66. package/dist/admin/src/modules/localazy-upload/locale/en.d.ts +19 -0
  67. package/dist/admin/src/modules/localazy-upload/services/localazy-upload-service.d.ts +3 -0
  68. package/dist/admin/src/modules/localazy-upload/services/upload-alerts-service.d.ts +5 -0
  69. package/dist/admin/src/modules/login/components/FetchIdentity.d.ts +3 -0
  70. package/dist/admin/src/modules/login/components/LoginButton.d.ts +12 -0
  71. package/dist/admin/src/modules/login/components/LogoutButton.d.ts +6 -0
  72. package/dist/admin/src/modules/login/locale/en.d.ts +8 -0
  73. package/dist/admin/src/modules/login/services/localazy-login-service.d.ts +4 -0
  74. package/dist/admin/src/modules/overview/components/OverviewItem.d.ts +7 -0
  75. package/dist/admin/src/modules/overview/components/OverviewItemLink.d.ts +7 -0
  76. package/dist/admin/src/modules/overview/components/PrerequisitiesInfo.d.ts +3 -0
  77. package/dist/admin/src/modules/overview/locale/en.d.ts +14 -0
  78. package/dist/admin/src/modules/plugin-settings/components/ContentTransferSetupEmpty.d.ts +2 -0
  79. package/dist/admin/src/modules/plugin-settings/components/Tree.d.ts +8 -0
  80. package/dist/admin/src/modules/plugin-settings/components/TreeItem.d.ts +10 -0
  81. package/dist/admin/src/modules/plugin-settings/functions/build-content-transfer-setup-schema.d.ts +2 -0
  82. package/dist/admin/src/modules/plugin-settings/functions/get-content-transfer-setup-keys-sets.d.ts +8 -0
  83. package/dist/admin/src/modules/plugin-settings/functions/has-model-changed.d.ts +6 -0
  84. package/dist/admin/src/modules/plugin-settings/locale/en.d.ts +49 -0
  85. package/dist/admin/src/modules/plugin-settings/services/plugin-settings-service.d.ts +6 -0
  86. package/dist/admin/src/modules/plugin-settings/services/strapi-model-service.d.ts +4 -0
  87. package/dist/admin/src/modules/plugin-settings/services/strapi-users-service.d.ts +3 -0
  88. package/dist/admin/src/modules/plugin-settings/utils/array-of-models-to-object.d.ts +2 -0
  89. package/dist/admin/src/modules/plugin-settings/utils/find-model-value-by-key.d.ts +2 -0
  90. package/dist/admin/src/modules/plugin-settings/utils/get-filtered-models-schemas.d.ts +7 -0
  91. package/dist/admin/src/modules/plugin-settings/utils/get-models-tree.d.ts +5 -0
  92. package/dist/admin/src/modules/strapi/utils/get-default-theme.d.ts +3 -0
  93. package/dist/admin/src/modules/user/model/localazy-identity.d.ts +15 -0
  94. package/dist/admin/src/modules/user/services/localazy-user-service.d.ts +6 -0
  95. package/dist/admin/src/pages/App.d.ts +3 -0
  96. package/dist/admin/src/pages/ContentTransferSetup.d.ts +4 -0
  97. package/dist/admin/src/pages/Download.d.ts +7 -0
  98. package/dist/admin/src/pages/GlobalSettings.d.ts +4 -0
  99. package/dist/admin/src/pages/HomePage.d.ts +2 -0
  100. package/dist/admin/src/pages/Login.d.ts +8 -0
  101. package/dist/admin/src/pages/Overview.d.ts +8 -0
  102. package/dist/admin/src/pages/Upload.d.ts +7 -0
  103. package/dist/admin/src/pluginId.d.ts +2 -0
  104. package/dist/admin/src/plugins/generic-connector-client.d.ts +3 -0
  105. package/dist/admin/src/state/localazy-identity.d.ts +13 -0
  106. package/dist/admin/src/utils/getTranslation.d.ts +2 -0
  107. package/dist/server/index.js +26000 -0
  108. package/dist/server/index.mjs +25989 -0
  109. package/dist/server/src/bootstrap.d.ts +5 -0
  110. package/dist/server/src/config/core/config.d.ts +1 -0
  111. package/dist/server/src/config/development/index.d.ts +15 -0
  112. package/dist/server/src/config/example/index.example.d.ts +15 -0
  113. package/dist/server/src/config/index.d.ts +18 -0
  114. package/dist/server/src/config/local/index.d.ts +15 -0
  115. package/dist/server/src/config/production/index.d.ts +15 -0
  116. package/dist/server/src/constants/channels.d.ts +3 -0
  117. package/dist/server/src/constants/events.d.ts +6 -0
  118. package/dist/server/src/content-types/index.d.ts +2 -0
  119. package/dist/server/src/controllers/index.d.ts +43 -0
  120. package/dist/server/src/controllers/localazy-auth-controller.d.ts +8 -0
  121. package/dist/server/src/controllers/localazy-project-controller.d.ts +7 -0
  122. package/dist/server/src/controllers/localazy-transfer-controller.d.ts +8 -0
  123. package/dist/server/src/controllers/localazy-user-controller.d.ts +9 -0
  124. package/dist/server/src/controllers/plugin-settings-controller.d.ts +10 -0
  125. package/dist/server/src/controllers/strapi-controller.d.ts +10 -0
  126. package/dist/server/src/core/index.d.ts +71 -0
  127. package/dist/server/src/db/model/content-transfer-setup.d.ts +4 -0
  128. package/dist/server/src/db/model/localazy-user.d.ts +17 -0
  129. package/dist/server/src/db/model/plugin-settings.d.ts +5 -0
  130. package/dist/server/src/db/model/utils/get-strapi-store.d.ts +26 -0
  131. package/dist/server/src/destroy.d.ts +5 -0
  132. package/dist/server/src/functions/should-set-downloaded-property.d.ts +12 -0
  133. package/dist/server/src/index.d.ts +189 -0
  134. package/dist/server/src/lifecycles/deep-populate-hook.d.ts +20 -0
  135. package/dist/server/src/lifecycles/deprecate-event-entry-in-localazy-hook.d.ts +4 -0
  136. package/dist/server/src/lifecycles/upload-event-entry-to-localazy-hook.d.ts +12 -0
  137. package/dist/server/src/middlewares/index.d.ts +2 -0
  138. package/dist/server/src/models/plugin/content-transfer-setup.d.ts +13 -0
  139. package/dist/server/src/models/strapi/locale.d.ts +8 -0
  140. package/dist/server/src/policies/index.d.ts +2 -0
  141. package/dist/server/src/register.d.ts +5 -0
  142. package/dist/server/src/routes/index.d.ts +25 -0
  143. package/dist/server/src/routes/localazy-auth-routes.d.ts +9 -0
  144. package/dist/server/src/routes/localazy-project-routes.d.ts +9 -0
  145. package/dist/server/src/routes/localazy-transfer-routes.d.ts +9 -0
  146. package/dist/server/src/routes/localazy-user-routes.d.ts +9 -0
  147. package/dist/server/src/routes/plugin-settings-routes.d.ts +9 -0
  148. package/dist/server/src/routes/strapi-routes.d.ts +9 -0
  149. package/dist/server/src/services/helpers/job-notification-service.d.ts +14 -0
  150. package/dist/server/src/services/helpers/plugin-settings-service-helper.d.ts +16 -0
  151. package/dist/server/src/services/index.d.ts +92 -0
  152. package/dist/server/src/services/localazy-pubapi-service.d.ts +12 -0
  153. package/dist/server/src/services/localazy-transfer-download-service.d.ts +11 -0
  154. package/dist/server/src/services/localazy-transfer-upload-service.d.ts +11 -0
  155. package/dist/server/src/services/localazy-upload-service.d.ts +28 -0
  156. package/dist/server/src/services/localazy-user-service.d.ts +11 -0
  157. package/dist/server/src/services/plugin-settings-service.d.ts +16 -0
  158. package/dist/server/src/services/strapi-i18n-service.d.ts +19 -0
  159. package/dist/server/src/services/strapi-localazy-i18n-service.d.ts +9 -0
  160. package/dist/server/src/services/strapi-service.d.ts +10 -0
  161. package/dist/server/src/utils/delay.d.ts +1 -0
  162. package/dist/server/src/utils/drop-property-deep.d.ts +1 -0
  163. package/dist/server/src/utils/flatten-object.d.ts +2 -0
  164. package/dist/server/src/utils/generate-random-id.d.ts +2 -0
  165. package/dist/server/src/utils/get-full-populate-localazy-download-object.d.ts +17 -0
  166. package/dist/server/src/utils/get-full-populate-localazy-upload-object.d.ts +9 -0
  167. package/dist/server/src/utils/get-full-populate-object.d.ts +17 -0
  168. package/dist/server/src/utils/get-main-keys-of-nested-array-objects.d.ts +2 -0
  169. package/dist/server/src/utils/get-picked-flatten-keys-for-hook-entry.d.ts +5 -0
  170. package/dist/server/src/utils/intl-display-name.d.ts +1 -0
  171. package/dist/server/src/utils/is-generally-applicable-content-type.d.ts +2 -0
  172. package/dist/server/src/utils/is-localazy-applicable-content-type.d.ts +2 -0
  173. package/dist/server/src/utils/iso-locales-utils.d.ts +3 -0
  174. package/dist/server/src/utils/localazy-api-client-factory.d.ts +3 -0
  175. package/dist/server/src/utils/localazy-generic-connector-client-factory.d.ts +3 -0
  176. package/dist/server/src/utils/model-utils.d.ts +7 -0
  177. package/dist/server/src/utils/omit-deep.d.ts +2 -0
  178. package/dist/server/src/utils/parsed-localazy-entry-to-create-entry.d.ts +7 -0
  179. package/dist/server/src/utils/parsed-localazy-entry-to-update-entry.d.ts +1 -0
  180. package/dist/server/src/utils/pick-entries.d.ts +2 -0
  181. package/dist/server/src/utils/populate-create-update-entry-with-base-entry.d.ts +1 -0
  182. package/dist/server/src/utils/request-initiator-helper.d.ts +9 -0
  183. package/dist/server/src/utils/reset-array-keys-deep.d.ts +1 -0
  184. package/dist/server/src/utils/transfer-setup-utils.d.ts +7 -0
  185. package/install/index.mjs +88 -34
  186. package/install/vite.config.example.js +40 -0
  187. package/install/vite.config.example.ts +41 -0
  188. package/install/{webpack.example.js → webpack.config.example.js} +2 -2
  189. package/install/webpack.config.example.ts +30 -0
  190. package/package.json +93 -55
  191. package/.babelrc +0 -7
  192. package/.eslintrc +0 -13
  193. package/.github/workflows/qa.yml +0 -25
  194. package/.github/workflows/release.yml +0 -46
  195. package/.nvmrc +0 -1
  196. package/.strapi-updater.json +0 -4
  197. package/CHANGELOG.md +0 -68
  198. package/LICENSE +0 -21
  199. package/admin/src/components/Initializer/index.js +0 -26
  200. package/admin/src/components/PluginIcon/index.js +0 -14
  201. package/admin/src/config/development/index.js +0 -14
  202. package/admin/src/config/example/index.js +0 -14
  203. package/admin/src/config/index.js +0 -19
  204. package/admin/src/config/local/index.js +0 -14
  205. package/admin/src/config/production/index.js +0 -15
  206. package/admin/src/i18n.js +0 -41
  207. package/admin/src/index.js +0 -138
  208. package/admin/src/modules/@common/components/Icons/Localazy/index.js +0 -12
  209. package/admin/src/modules/@common/components/LanguagesSelector/index.js +0 -67
  210. package/admin/src/modules/@common/components/PluginPageLoader/index.js +0 -20
  211. package/admin/src/modules/@common/components/SideNav/index.js +0 -46
  212. package/admin/src/modules/@common/components/TransferReport/index.js +0 -53
  213. package/admin/src/modules/@common/locale/en.js +0 -14
  214. package/admin/src/modules/@common/models/supported-content-type-fields.js +0 -9
  215. package/admin/src/modules/@common/models/supported-custom-field-plugins.js +0 -6
  216. package/admin/src/modules/@common/services/i18n-service.js +0 -15
  217. package/admin/src/modules/@common/services/plugin.service.js +0 -16
  218. package/admin/src/modules/@common/services/product-analytics-service.js +0 -86
  219. package/admin/src/modules/@common/services/project-service.js +0 -15
  220. package/admin/src/modules/@common/services/user-service.js +0 -38
  221. package/admin/src/modules/@common/utils/__tests__/iso-locales-utils.test.js +0 -102
  222. package/admin/src/modules/@common/utils/are-locales-compatible.js +0 -42
  223. package/admin/src/modules/@common/utils/format-number.js +0 -1
  224. package/admin/src/modules/@common/utils/functions/flatten-deep.js +0 -23
  225. package/admin/src/modules/@common/utils/get-default-locale.js +0 -32
  226. package/admin/src/modules/@common/utils/get-header-subtitle.js +0 -21
  227. package/admin/src/modules/@common/utils/get-header-title.js +0 -24
  228. package/admin/src/modules/@common/utils/get-nav.js +0 -35
  229. package/admin/src/modules/@common/utils/history.js +0 -6
  230. package/admin/src/modules/@common/utils/is-plugin-route.js +0 -15
  231. package/admin/src/modules/@common/utils/iso-locales-utils.js +0 -58
  232. package/admin/src/modules/@common/utils/redirect-to-plugin-route.js +0 -22
  233. package/admin/src/modules/@common/utils/sort-by-model-name.js +0 -10
  234. package/admin/src/modules/alerts/constants/channels.js +0 -1
  235. package/admin/src/modules/alerts/constants/events.js +0 -4
  236. package/admin/src/modules/alerts/services/alerts-service.js +0 -41
  237. package/admin/src/modules/localazy-download/locale/en.js +0 -25
  238. package/admin/src/modules/localazy-download/services/download-alerts-service.js +0 -12
  239. package/admin/src/modules/localazy-download/services/localazy-download-service.js +0 -16
  240. package/admin/src/modules/localazy-upload/components/ReadDocsButton.js +0 -20
  241. package/admin/src/modules/localazy-upload/locale/en.js +0 -20
  242. package/admin/src/modules/localazy-upload/services/localazy-upload-service.js +0 -16
  243. package/admin/src/modules/localazy-upload/services/upload-alerts-service.js +0 -12
  244. package/admin/src/modules/login/components/LoginButton/index.js +0 -55
  245. package/admin/src/modules/login/components/LogoutButton/index.js +0 -49
  246. package/admin/src/modules/login/locale/en.js +0 -7
  247. package/admin/src/modules/login/services/localazy-login-service.js +0 -29
  248. package/admin/src/modules/plugin-settings/components/ContentTransferSetup/index.js +0 -308
  249. package/admin/src/modules/plugin-settings/components/ContentTransferSetupEmpty/index.js +0 -86
  250. package/admin/src/modules/plugin-settings/components/GlobalSettings/index.js +0 -269
  251. package/admin/src/modules/plugin-settings/components/Tree/index.js +0 -145
  252. package/admin/src/modules/plugin-settings/components/TreeItem/index.js +0 -48
  253. package/admin/src/modules/plugin-settings/functions/build-content-transfer-setup-schema.js +0 -57
  254. package/admin/src/modules/plugin-settings/functions/get-content-transfer-setup-keys-sets.js +0 -85
  255. package/admin/src/modules/plugin-settings/functions/has-model-changed.js +0 -75
  256. package/admin/src/modules/plugin-settings/locale/en.js +0 -61
  257. package/admin/src/modules/plugin-settings/services/plugin-settings-service.js +0 -55
  258. package/admin/src/modules/plugin-settings/services/strapi-model-service.js +0 -26
  259. package/admin/src/modules/plugin-settings/services/strapi-users-service.js +0 -26
  260. package/admin/src/modules/plugin-settings/utils/__tests__/get-models-tree.test.js +0 -135
  261. package/admin/src/modules/plugin-settings/utils/array-of-models-to-object.js +0 -6
  262. package/admin/src/modules/plugin-settings/utils/find-model-value-by-key.js +0 -8
  263. package/admin/src/modules/plugin-settings/utils/get-filtered-models-schemas.js +0 -31
  264. package/admin/src/modules/plugin-settings/utils/get-models-tree.js +0 -94
  265. package/admin/src/modules/settings/components/OverviewItem/index.js +0 -44
  266. package/admin/src/modules/settings/components/OverviewItemLink/index.js +0 -34
  267. package/admin/src/modules/settings/components/PrerequisitiesInfo/index.js +0 -28
  268. package/admin/src/modules/settings/locale/en.js +0 -13
  269. package/admin/src/modules/user/model/localazy-identity.js +0 -14
  270. package/admin/src/modules/user/services/localazy-user-service.js +0 -38
  271. package/admin/src/pages/App/index.js +0 -154
  272. package/admin/src/pages/Download/index.js +0 -280
  273. package/admin/src/pages/Index/index.js +0 -8
  274. package/admin/src/pages/Login/index.js +0 -109
  275. package/admin/src/pages/PluginSettings/index.js +0 -56
  276. package/admin/src/pages/Settings/index.js +0 -132
  277. package/admin/src/pages/Upload/index.js +0 -241
  278. package/admin/src/pluginId.js +0 -5
  279. package/admin/src/plugins/generic-connector-client.js +0 -9
  280. package/admin/src/state/localazy-identity.js +0 -29
  281. package/admin/src/tests/fixtures/all-models.js +0 -877
  282. package/admin/src/tests/fixtures/restaurant-model.js +0 -230
  283. package/admin/src/translations/en.json +0 -4
  284. package/admin/src/translations/fr.json +0 -1
  285. package/admin/src/utils/createAxiosInstance.js +0 -54
  286. package/admin/src/utils/getTrad.js +0 -5
  287. package/jest.config.js +0 -0
  288. package/server/bootstrap.js +0 -63
  289. package/server/config/development/index.js +0 -16
  290. package/server/config/example/index.js +0 -16
  291. package/server/config/index.js +0 -20
  292. package/server/config/local/index.js +0 -16
  293. package/server/config/production/index.js +0 -17
  294. package/server/config/schema.graphql.js +0 -21
  295. package/server/constants/channels.js +0 -3
  296. package/server/constants/events.js +0 -6
  297. package/server/content-types/index.js +0 -3
  298. package/server/controllers/index.js +0 -17
  299. package/server/controllers/localazy-auth-controller.js +0 -22
  300. package/server/controllers/localazy-project-controller.js +0 -21
  301. package/server/controllers/localazy-transfer-controller.js +0 -62
  302. package/server/controllers/localazy-user-controller.js +0 -24
  303. package/server/controllers/plugin-settings-controller.js +0 -31
  304. package/server/controllers/strapi-controller.js +0 -27
  305. package/server/db/model/content-transfer-setup.js +0 -13
  306. package/server/db/model/localazy-user.js +0 -23
  307. package/server/db/model/plugin-settings.js +0 -13
  308. package/server/db/model/utils/get-strapi-store.js +0 -9
  309. package/server/destroy.js +0 -5
  310. package/server/functions/should-set-downloaded-property.js +0 -94
  311. package/server/index.js +0 -25
  312. package/server/lifecycles/deep-populate-hook.js +0 -12
  313. package/server/lifecycles/deprecate-event-entry-in-localazy-hook.js +0 -73
  314. package/server/lifecycles/upload-event-entry-to-localazy-hook.js +0 -36
  315. package/server/middlewares/index.js +0 -7
  316. package/server/middlewares/verify-webhook.js +0 -76
  317. package/server/models/supported-content-type-fields.js +0 -9
  318. package/server/models/supported-custom-field-plugins.js +0 -6
  319. package/server/policies/index.js +0 -3
  320. package/server/register.js +0 -5
  321. package/server/routes/index.js +0 -28
  322. package/server/routes/localazy-auth.js +0 -22
  323. package/server/routes/localazy-project.js +0 -14
  324. package/server/routes/localazy-public-transfer.js +0 -20
  325. package/server/routes/localazy-transfer.js +0 -22
  326. package/server/routes/localazy-user.js +0 -30
  327. package/server/routes/plugin-settings.js +0 -38
  328. package/server/routes/strapi.js +0 -38
  329. package/server/services/helpers/job-notification-service.js +0 -30
  330. package/server/services/helpers/plugin-settings-service-helper.js +0 -52
  331. package/server/services/index.js +0 -23
  332. package/server/services/localazy-pubapi-service.js +0 -53
  333. package/server/services/localazy-transfer-download-service.js +0 -445
  334. package/server/services/localazy-transfer-upload-service.js +0 -178
  335. package/server/services/localazy-upload-service.js +0 -52
  336. package/server/services/localazy-user-service.js +0 -29
  337. package/server/services/plugin-settings-service.js +0 -53
  338. package/server/services/strapi-i18n-service.js +0 -151
  339. package/server/services/strapi-localazy-i18n-service.js +0 -130
  340. package/server/services/strapi-service.js +0 -26
  341. package/server/tests/fixtures/all-models.js +0 -869
  342. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-cookbook.js +0 -5761
  343. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-lesson-dz.js +0 -402
  344. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-page-dz.js +0 -658
  345. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-restaurant-simple-menu.js +0 -536
  346. package/server/tests/fixtures/parsed-localazy-entry-to-update-entry.js +0 -35157
  347. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-cookbook-empty-recipes.js +0 -202
  348. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-cookbook.js +0 -2700
  349. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-lesson-dz.js +0 -309
  350. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-simple.js +0 -47
  351. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-with-media.js +0 -169
  352. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-empty.js +0 -3003
  353. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-with-media.js +0 -2057
  354. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-sample-json-dz.js +0 -884
  355. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-sample-json.js +0 -46
  356. package/server/tests/fixtures/strapi-plugin-all-models.js +0 -7000
  357. package/server/utils/__tests__/build-populate.test.js +0 -85
  358. package/server/utils/__tests__/flatten-object.test.js +0 -171
  359. package/server/utils/__tests__/get-models-tree.test.js +0 -170
  360. package/server/utils/__tests__/iso-locales-utils.test.js +0 -104
  361. package/server/utils/__tests__/parsed-localazy-entry-to-create-entry.test.js +0 -258
  362. package/server/utils/__tests__/parsed-localazy-entry-to-update-entry.test.js +0 -456
  363. package/server/utils/__tests__/pick-entries.test.js +0 -963
  364. package/server/utils/__tests__/populate-create-update-entry-with-base-entry.test.js +0 -1176
  365. package/server/utils/build-populate.js +0 -48
  366. package/server/utils/delay.js +0 -6
  367. package/server/utils/flatten-object.js +0 -61
  368. package/server/utils/generate-random-id.js +0 -3
  369. package/server/utils/get-full-populate-object.js +0 -66
  370. package/server/utils/get-main-keys-of-nested-array-objects.js +0 -5
  371. package/server/utils/get-models-tree.js +0 -47
  372. package/server/utils/get-picked-flatten-keys-for-hook-entry.js +0 -270
  373. package/server/utils/intl-display-name.js +0 -4
  374. package/server/utils/is-generally-applicable-content-type.js +0 -33
  375. package/server/utils/is-localazy-applicable-content-type.js +0 -36
  376. package/server/utils/iso-locales-utils.js +0 -60
  377. package/server/utils/localazy-api-client-factory.js +0 -22
  378. package/server/utils/localazy-generic-connector-client-factory.js +0 -15
  379. package/server/utils/model-utils.js +0 -43
  380. package/server/utils/objectivise-entry.js +0 -41
  381. package/server/utils/omit-deep.js +0 -24
  382. package/server/utils/parsed-localazy-entry-to-create-entry.js +0 -194
  383. package/server/utils/parsed-localazy-entry-to-update-entry.js +0 -83
  384. package/server/utils/pick-deep.js +0 -22
  385. package/server/utils/pick-entries.js +0 -37
  386. package/server/utils/populate-create-update-entry-with-base-entry.js +0 -264
  387. package/server/utils/request-initiator-helper.js +0 -36
  388. package/server/utils/reset-array-keys-deep.js +0 -19
  389. package/server/utils/transfer-setup-utils.js +0 -93
  390. package/strapi-admin.js +0 -14
  391. package/strapi-server.js +0 -5
  392. package/test/helpers/mocks.js +0 -9
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- const set = require("lodash/set");
4
-
5
- const getPopulateObject = (keys) => {
6
- const populate = {};
7
- for (const key of keys) {
8
- set(populate, key, "*");
9
- }
10
-
11
- return populate;
12
- };
13
-
14
- const buildPopulate = (models, modelUid) => {
15
- const buildPopulateStep = (models, modelUid, prefix = "") => {
16
- const model = models.find((model) => model.uid === modelUid);
17
-
18
- if (!model || !model.attributes) {
19
- return getPopulateObject(keys);
20
- }
21
-
22
- for (const [attributeName, attribute] of Object.entries(model.attributes)) {
23
- if (attribute.type === "component") {
24
- const key = prefix
25
- ? `${prefix}.${attributeName}.populate`
26
- : `${attributeName}.populate`;
27
- keys.push(key);
28
- const newPrefix = prefix
29
- ? `${prefix}.${attributeName}`
30
- : `${attributeName}`;
31
- const innerModelUid = attribute.component;
32
- buildPopulateStep(models, innerModelUid, newPrefix);
33
- } else if (attribute.type === "dynamiczone") {
34
- const key = prefix
35
- ? `${prefix}.${attributeName}.populate`
36
- : `${attributeName}.populate`;
37
- keys.push(key);
38
- }
39
- }
40
-
41
- return getPopulateObject(keys);
42
- };
43
- const keys = ["populate"];
44
-
45
- return buildPopulateStep(models, modelUid);
46
- };
47
-
48
- module.exports = buildPopulate;
@@ -1,6 +0,0 @@
1
- "use strict";
2
-
3
- // eslint-disable-next-line no-promise-executor-return
4
- const delay = (ms = 150) => new Promise((resolve) => setTimeout(resolve, ms));
5
-
6
- module.exports = delay;
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- const flattenObject = (object, prefix = "") => {
4
- const result = {};
5
-
6
- if (typeof object === "string" || typeof object === "number" || typeof object === "boolean") {
7
- return object;
8
- }
9
-
10
- for (const objectKey in object) {
11
- if (objectKey === "id") {
12
- continue;
13
- }
14
-
15
- if (typeof object[objectKey] !== "object") {
16
- const key = prefix ? `${prefix}.${objectKey}` : objectKey;
17
- // Simple leaf (e.g. string or number)
18
- result[key] = object[objectKey];
19
- } else {
20
- // Recursive call down to flattened object
21
- let flatObject;
22
-
23
- // If it is an array then turn it into an object with the correct keys
24
- if (Array.isArray(object[objectKey])) {
25
- // Reduce each item into the right key
26
- const flattenedArray = object[objectKey].reduce(
27
- (accumulator, item, index) => {
28
- // No id should use the index of the array item
29
- let key = `${objectKey}[${item?.id || index}]`;
30
- // is Dynamic Zone
31
- if (item?.id && item?.__component) {
32
- key = `${objectKey}[${item.id};${item.__component}]`;
33
- }
34
-
35
- accumulator[key] = flattenObject(item);
36
- return accumulator;
37
- },
38
- {}
39
- );
40
-
41
- // Then flatten it
42
- flatObject = flattenObject(flattenedArray);
43
- } else {
44
- // Otherwise it is a complex object so you want to flatten that
45
- // but with the prefix of this current object key
46
- const suffix = object[objectKey]?.id
47
- ? `${objectKey}[${object[objectKey].id}]`
48
- : objectKey;
49
- flatObject = flattenObject(object[objectKey], suffix);
50
- }
51
-
52
- for (const flatObjectKey in flatObject) {
53
- const key = prefix ? `${prefix}.${flatObjectKey}` : flatObjectKey;
54
- result[`${key}`] = flatObject[flatObjectKey];
55
- }
56
- }
57
- }
58
- return result;
59
- };
60
-
61
- module.exports = flattenObject;
@@ -1,3 +0,0 @@
1
- const generateRandomId = (length = 16) => `_${Math.random().toString(36).substr(2, length)}`;
2
-
3
- module.exports = generateRandomId;
@@ -1,66 +0,0 @@
1
- // is taken from
2
- // https://github.com/Barelydead/strapi-plugin-populate-deep
3
- // based on the issue
4
- // https://github.com/strapi/strapi/issues/11836
5
-
6
- const isEmpty = require("lodash/isEmpty");
7
- const merge = require("lodash/merge");
8
- const DEFAULT_MAX_POPULATE_DEPTH = 10;
9
- const DEFAULT_POPULATE_DEPTH = 5;
10
-
11
- const getModelPopulationAttributes = (model) => {
12
- if (model.uid === "plugin::upload.file") {
13
- const { related, ...attributes } = model.attributes;
14
- return attributes;
15
- }
16
-
17
- return model.attributes;
18
- };
19
-
20
- const getFullPopulateObject = (modelUid, depth = DEFAULT_POPULATE_DEPTH) => {
21
- let localDepth = depth;
22
- if (localDepth <= 1) {
23
- return true;
24
- }
25
- if (modelUid === "admin::user") {
26
- return undefined;
27
- }
28
- const populateMaxDepth = strapi.plugin("localazy")?.config("populateMaxDepth") ?? DEFAULT_MAX_POPULATE_DEPTH;
29
- if (Number.isInteger(populateMaxDepth) && localDepth > populateMaxDepth) {
30
- localDepth = populateMaxDepth;
31
- }
32
-
33
- const populate = {};
34
- const model = strapi.getModel(modelUid);
35
- for (const [key, value] of Object.entries(
36
- getModelPopulationAttributes(model)
37
- )) {
38
- if (value) {
39
- if (value.type === "component") {
40
- populate[key] = getFullPopulateObject(value.component, localDepth - 1);
41
- } else if (value.type === "dynamiczone") {
42
- const dynamicPopulate = value.components.reduce((prev, cur) => {
43
- const curPopulate = getFullPopulateObject(cur, localDepth - 1);
44
- return curPopulate === true ? prev : merge(prev, curPopulate);
45
- }, {});
46
- populate[key] = isEmpty(dynamicPopulate) ? true : dynamicPopulate;
47
- } else if (value.type === "relation") {
48
- const relationPopulate = getFullPopulateObject(
49
- value.target,
50
- localDepth - 1
51
- );
52
- if (relationPopulate) {
53
- populate[key] = relationPopulate;
54
- }
55
- } else if (value.type === "media") {
56
- populate[key] = true;
57
- }
58
- }
59
- }
60
- return isEmpty(populate) ? true : { populate };
61
- };
62
-
63
- module.exports = {
64
- getFullPopulateObject,
65
- DEFAULT_POPULATE_DEPTH
66
- };
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = (array) => {
4
- return array.map((item) => Object.keys(item)[0]);
5
- };
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- const SUPPORTED_CONTENT_TYPE_FIELDS = require("../models/supported-content-type-fields");
4
- const SUPPORTED_CUSTOM_FIELD_PLUGINS = require("../models/supported-custom-field-plugins");
5
-
6
- const getModelTree = (attributes, models) => {
7
- const currentModelTree = {};
8
- for (const attribute in attributes) {
9
- if (attributes[attribute].type === "component") {
10
- const nestedModel = models.find(
11
- (model) => model.uid === attributes[attribute].component
12
- );
13
-
14
- currentModelTree[attribute] = {
15
- ...getModelTree(nestedModel.__schema__.attributes, models),
16
- };
17
- } else if (
18
- SUPPORTED_CONTENT_TYPE_FIELDS.includes(attributes[attribute].type)
19
- || (attributes[attribute].type === "customField" && SUPPORTED_CUSTOM_FIELD_PLUGINS.includes(attributes[attribute].customField))
20
- ) {
21
- currentModelTree[attribute] = false;
22
- } else {
23
- currentModelTree[attribute] = null;
24
- }
25
- }
26
-
27
- return currentModelTree;
28
- };
29
-
30
- /**
31
- * Kinds of models ["collectionType", "singleType"] are expected by the function.
32
- */
33
- const getModelsTree = (models) => {
34
- const modelsTree = [];
35
- for (const model of models) {
36
- const modelTree = {
37
- [model.__schema__.collectionName]: {
38
- __model__: true,
39
- ...getModelTree(model.__schema__.attributes, models),
40
- },
41
- };
42
- modelsTree.push(modelTree);
43
- }
44
- return modelsTree;
45
- };
46
-
47
- module.exports = getModelsTree;
@@ -1,270 +0,0 @@
1
- "use strict";
2
-
3
- const { isoStrapiToLocalazy } = require("./iso-locales-utils");
4
- const config = require("../config").default;
5
- const omitDeep = require("./omit-deep");
6
- const flattenObject = require("./flatten-object");
7
- const pickEntries = require("./pick-entries");
8
- const {
9
- findSetupModelByCollectionName,
10
- getPickPaths
11
- } = require("./transfer-setup-utils");
12
- const PluginSettingsServiceHelper = require('../services/helpers/plugin-settings-service-helper');
13
-
14
- /**
15
- *
16
- * @param {*} contentTransferSetup
17
- * @param {*} eventModel
18
- * @returns `undefined` if such model is not model eligible for transfer or `boolean` setup
19
- */
20
- const shouldProcessEntry = (contentTransferSetup, eventModel) => {
21
- let key;
22
- const modelContentTransferSetup = contentTransferSetup.setup
23
- .find((model) => {
24
- key = Object.keys(model)[0];
25
- return key === eventModel;
26
- });
27
-
28
- // might be undefined as it's called on any Content-Type
29
- if (!modelContentTransferSetup) {
30
- return undefined;
31
- }
32
- return !!modelContentTransferSetup[key].__model__;
33
- }
34
-
35
- const getEventEntries = async (event) => {
36
- switch (event.action) {
37
- case 'afterCreate':
38
- case 'afterUpdate': {
39
- const entry = [await strapi.entityService.findOne(
40
- event.model.uid,
41
- event.result.id,
42
- {
43
- populate: "deep",
44
- })];
45
- return entry;
46
- }
47
- case "beforeDelete": {
48
- const entry = [await strapi.entityService.findOne(
49
- event.model.uid,
50
- event.params.where.id,
51
- {
52
- populate: "deep",
53
- })];
54
- return entry;
55
- }
56
- case "beforeDeleteMany": {
57
- /**
58
- * Strapi sets the locale to the default one, so passing the ids won't help (won't fetch the entries in the correct locale)
59
- * And therefore because of Strapi being Strapi, we need to get one id from the filter and fetch it's language
60
- * And then pass the locale parameter to the findMany method
61
- */
62
- // const entry = await strapi.entityService.findOne(
63
- // event.model.uid,
64
- // event.params.where.$and[0].id.$in[0],
65
- // {
66
- // populate: "deep",
67
- // });
68
- // const locale = entry.locale;
69
- // const entries = await strapi.entityService.findMany(
70
- // event.model.uid,
71
- // {
72
- // filters: {
73
- // id: event.params.where.$and[0].id.$in,
74
- // },
75
- // locale,
76
- // populate: "deep",
77
- // });
78
-
79
- /**
80
- * If deletion of other than default locale is requested, `entries` will be an empty array
81
- * If deletion of default locale is requested, `entries` will contain requested entries, and we can proceed with the deprecation process
82
- */
83
- const entries = await strapi.entityService.findMany(
84
- event.model.uid,
85
- {
86
- filters: event.params.where,
87
- populate: "deep",
88
- });
89
-
90
- if (entries.length === 0) {
91
- strapi.log.info(`Localazy Plugin: No entries in source language for ${event.action} found; the operation won't proceed`);
92
- }
93
- return entries;
94
- }
95
- default: {
96
- throw new Error("Unhandled event action");
97
- }
98
- }
99
- }
100
-
101
- const shouldSkipAction = async (event) => {
102
- const pluginSettingsServiceHelper = new PluginSettingsServiceHelper(strapi);
103
- await pluginSettingsServiceHelper.setup();
104
-
105
- switch (event.action) {
106
- case 'afterCreate': {
107
- if (!pluginSettingsServiceHelper.shouldAllowAutomatedCreatedTrigger()) {
108
- strapi.log.info(`Localazy Plugin: Skipping ${event.action} hook because automated created trigger is disabled.`)
109
- return true;
110
- }
111
- return false;
112
- }
113
- case 'afterUpdate': {
114
- if (!pluginSettingsServiceHelper.shouldAllowAutomatedUpdatedTrigger()) {
115
- strapi.log.info(`Localazy Plugin: Skipping ${event.action} hook because automated update trigger is disabled.`)
116
- return true;
117
- }
118
- return false;
119
- }
120
- case "beforeDelete":
121
- case "beforeDeleteMany": {
122
- if (!pluginSettingsServiceHelper.shouldAllowDeprecateOnDeletion()) {
123
- strapi.log.info(`Localazy Plugin: Skipping ${event.action} hook because deprecate on deletion is disabled.`)
124
- return true;
125
- }
126
- return false;
127
- }
128
- default: {
129
- throw new Error("Unhandled event action");
130
- }
131
- }
132
- }
133
-
134
- module.exports = async (event) => {
135
- // Docs: https://docs.strapi.io/developer-docs/latest/development/backend-customization/models.html#hook-event-object
136
- // this should respect the content transfer setup
137
- // there read it and compare with the model property
138
- const LocalazyUserService = strapi
139
- .plugin("localazy")
140
- .service("localazyUserService");
141
- const LocalazyPubApiService = strapi
142
- .plugin("localazy")
143
- .service("localazyPubApiService");
144
- const StrapiI18nService = strapi
145
- .plugin("localazy")
146
- .service("strapiI18nService");
147
- const contentTransferSetup = await strapi
148
- .plugin("localazy")
149
- .service("pluginSettingsService")
150
- .getContentTransferSetup();
151
-
152
- const eventAction = event.action;
153
- strapi.log.info(`${eventAction} triggered`);
154
-
155
- // Content Transfer Setup not available yet; break execution
156
- if (!contentTransferSetup.has_setup) {
157
- strapi.log.warn("Localazy Plugin: Content Transfer Setup is not set up; the operation won't proceed");
158
- return;
159
- }
160
-
161
- // entry model not supposed to be processed; break execution
162
- const eventModel = event.model.tableName;
163
- const shouldProcess = shouldProcessEntry(contentTransferSetup, eventModel);
164
- if (typeof shouldProcess === 'undefined') {
165
- return;
166
- }
167
- if (!shouldProcess) {
168
- strapi.log.info("Localazy Plugin: The entry collection transfer is disabled");
169
- return;
170
- }
171
-
172
- // if project not connected; break execution
173
- const user = await LocalazyUserService.getUser();
174
- const { accessToken } = user;
175
- if (!accessToken) {
176
- strapi.log.error("Localazy Plugin: Localazy user is not logged in; the operation won't proceed");
177
- return;
178
- }
179
-
180
- if (await shouldSkipAction(event)) {
181
- strapi.log.info("Localazy Plugin: Automated action skipped");
182
- return;
183
- }
184
-
185
- const project = await LocalazyPubApiService.getProject(
186
- user.project.id,
187
- false,
188
- true
189
- );
190
- const projectLanguages = project.languages;
191
- const projectSourceLanguageId = project.sourceLanguage;
192
- const sourceLanguage = projectLanguages.find(
193
- (language) => language.id === projectSourceLanguageId
194
- );
195
- const projectSourceLanguageCode = sourceLanguage.code;
196
-
197
- // Strapi default locale not compatible with project source language
198
- const strapiLocales = await StrapiI18nService.getLocales();
199
- const defaultLocale = strapiLocales.find((locale) => locale.isDefault);
200
-
201
- const strapiDefaultLocale = defaultLocale
202
- ? isoStrapiToLocalazy(defaultLocale.code)
203
- : config.LOCALAZY_DEFAULT_LOCALE;
204
- if (strapiDefaultLocale !== projectSourceLanguageCode) {
205
- strapi.log.warn("Localazy Plugin: Source locales do not match; the operation won't proceed");
206
- return;
207
- }
208
-
209
- /**
210
- * Prepare the data structure and upload it to Localazy
211
- */
212
- const modelUid = event.model.uid;
213
- const entries = await getEventEntries(event);
214
-
215
- if (entries.length === 0) {
216
- return;
217
- }
218
-
219
- // ? TODO: will always be valid?
220
- const eventEntryLocale = entries[0].locale;
221
-
222
- // event entry not in source language; break execution
223
- if (isoStrapiToLocalazy(eventEntryLocale) !== projectSourceLanguageCode) {
224
- strapi.log.info("Localazy Plugin: Entry language is not in Localazy source language; the operation won't proceed");
225
- return;
226
- }
227
-
228
- const reducedEntries = omitDeep(entries, [
229
- // "__component",
230
- "locale",
231
- "localizations",
232
- "createdAt",
233
- "createdBy",
234
- "updatedAt",
235
- "updatedBy",
236
- "publishedAt",
237
- ]);
238
-
239
- const transferSetupModel = findSetupModelByCollectionName(
240
- contentTransferSetup.setup,
241
- eventModel
242
- );
243
- const currentTransferSetupModel = transferSetupModel[eventModel];
244
- const pickPaths = getPickPaths(currentTransferSetupModel);
245
- if (!pickPaths.length) {
246
- strapi.log.warn(`No fields for collection ${eventModel} transfer are enabled.`);
247
- return;
248
- }
249
- const pickPathsWithUid = pickPaths.map(
250
- (pickPath) => `${modelUid}.${pickPath}`
251
- );
252
-
253
- // flatten Strapi content
254
- let flatten = {};
255
- for (const reducedEntry of reducedEntries) {
256
- flatten = {
257
- ...flatten,
258
- ...flattenObject({
259
- [modelUid]: reducedEntry,
260
- }),
261
- };
262
- }
263
- // get only enabled fields; "__component" will be filtered out inside of the function
264
- const pickedFlatten = pickEntries(flatten, pickPathsWithUid, currentTransferSetupModel);
265
-
266
- return {
267
- pickedFlatten,
268
- eventEntryLocale,
269
- };
270
- }
@@ -1,4 +0,0 @@
1
- module.exports = (isoStrapi) => {
2
- let languageNames = new Intl.DisplayNames(["en"], { type: "language" });
3
- return languageNames.of(isoStrapi);
4
- };
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- const SUPPORTED_MODEL_TYPES = ["contentType", "component"];
4
- const UNSUPPORTED_UID_PREFIXES = [
5
- "strapi::core",
6
- "plugin::users-permissions.user",
7
- ];
8
-
9
- module.exports = (model) => {
10
- for (const prefix of UNSUPPORTED_UID_PREFIXES) {
11
- if (model.uid.includes(prefix)) {
12
- return false;
13
- }
14
- }
15
-
16
- if (!SUPPORTED_MODEL_TYPES.includes(model.modelType)) {
17
- return false;
18
- }
19
-
20
- // is not applicable
21
- // eslint-disable-next-line no-underscore-dangle
22
- if (!model.__schema__) {
23
- return false;
24
- }
25
-
26
- if (model.pluginOptions) {
27
- if (model.pluginOptions["content-type-builder"]) {
28
- return model.pluginOptions["content-type-builder"].visible;
29
- }
30
- }
31
-
32
- return true;
33
- };
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- const isGenerallyApplicableContentType = require("./is-generally-applicable-content-type");
4
-
5
- module.exports = (model) => {
6
- const isGenerallyApplicable = isGenerallyApplicableContentType(model);
7
- if (!isGenerallyApplicable) {
8
- return false;
9
- }
10
-
11
- // cannot be translatable
12
- if (!model.pluginOptions) {
13
- return false;
14
- }
15
-
16
- // cannot be translatable
17
- if (!model.pluginOptions) {
18
- return false;
19
- }
20
-
21
- if (model.pluginOptions) {
22
- // cannot be translatable
23
- if (!model.pluginOptions["i18n"]) {
24
- return false;
25
- }
26
-
27
- // decide whether it is translatable
28
- if (model.pluginOptions["i18n"]) {
29
- return model.pluginOptions["i18n"].localized
30
- ? model.pluginOptions["i18n"].localized
31
- : false;
32
- }
33
- }
34
-
35
- return true;
36
- };
@@ -1,60 +0,0 @@
1
- "use strict";
2
-
3
- const isoStrapiToLocalazy = (isoStrapi) => {
4
- if (!isoStrapi) {
5
- return null;
6
- }
7
-
8
- const split = isoStrapi.split("-");
9
- const language = split[0];
10
-
11
- const hasRegionAndScript = split.length === 3;
12
- if (hasRegionAndScript) {
13
- const script = split[1];
14
- const region = split[2];
15
- return `${language}_${region}#${script}`;
16
- }
17
-
18
- const hasPossiblyRegion = split.length === 2;
19
- if (hasPossiblyRegion) {
20
- const regionOrScript = split[1];
21
-
22
- // is it script - the way Strapi resolves that
23
- const isItRegion = regionOrScript.toUpperCase() === regionOrScript;
24
-
25
- // it is region; otherwise it is script
26
- return isItRegion ? `${language}_${regionOrScript}` : `${language}#${regionOrScript}`;
27
- }
28
-
29
- return isoStrapi.replace("-", "_");
30
- };
31
-
32
- const isoLocalazyToStrapi = (isoLocalazy) => {
33
- if (!isoLocalazy) {
34
- return null;
35
- }
36
-
37
- const scriptIndex = isoLocalazy.indexOf("#");
38
- const hasScript = scriptIndex > -1;
39
- if (hasScript) {
40
- const script = isoLocalazy.substring(scriptIndex + 1);
41
- const isoLocalazyWithoutScript = isoLocalazy.substring(0, scriptIndex);
42
- const split = isoLocalazyWithoutScript.split("_");
43
- const language = split[0];
44
- const region = split[1];
45
-
46
- if (!region) {
47
- return `${language}-${script}`;
48
- }
49
-
50
- const isoStrapi = `${language}-${script}-${region.toUpperCase()}`;
51
- return isoStrapi;
52
- }
53
-
54
- return isoLocalazy.replace("_", "-");
55
- };
56
-
57
- module.exports = {
58
- isoStrapiToLocalazy,
59
- isoLocalazyToStrapi,
60
- };
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- const ApiClient = require("@localazy/api-client").ApiClient;
4
- const { LOCALAZY_PUBLIC_API_URL } = require("../config").default;
5
-
6
- module.exports = async () => {
7
- const user = await strapi
8
- .plugin("localazy")
9
- .service("localazyUserService")
10
- .getUser();
11
-
12
- const { accessToken } = user;
13
- if (!accessToken) {
14
- throw new Error("Localazy user is not logged in.");
15
- }
16
-
17
- const api = new ApiClient({
18
- authToken: accessToken,
19
- apiUrl: LOCALAZY_PUBLIC_API_URL,
20
- });
21
- return api;
22
- };
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- const GenericConnectorClient = require("@localazy/generic-connector-client").GenericConnectorClient;
4
- const config = require("../config");
5
-
6
- const ROOT_URL = config.default.LOCALAZY_PLUGIN_CONNECTOR_API_URL;
7
- const PLUGIN_ID = config.default.LOCALAZY_PLUGIN_ID;
8
-
9
- module.exports = async () => {
10
- const api = new GenericConnectorClient({
11
- pluginId: PLUGIN_ID,
12
- genericConnectorUrl: ROOT_URL,
13
- });
14
- return api;
15
- };