@hcl-software/dxclient 221.0.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 (486) hide show
  1. package/LICENSE +62 -0
  2. package/README.txt +3143 -0
  3. package/bin/dxclient +3 -0
  4. package/dist/LICENSE +62 -0
  5. package/dist/configuration/config.json +52 -0
  6. package/dist/configuration/versionConfigMap.json +34 -0
  7. package/dist/package.json +149 -0
  8. package/dist/packages/admintasks/package-lock.json +21843 -0
  9. package/dist/packages/admintasks/package.json +56 -0
  10. package/dist/packages/admintasks/src/commands/createCredentialVault.d.ts +5 -0
  11. package/dist/packages/admintasks/src/commands/createCredentialVault.js +100 -0
  12. package/dist/packages/admintasks/src/commands/createCredentialVault.js.map +1 -0
  13. package/dist/packages/admintasks/src/commands/createSyndicationRelation.d.ts +4 -0
  14. package/dist/packages/admintasks/src/commands/createSyndicationRelation.js +70 -0
  15. package/dist/packages/admintasks/src/commands/createSyndicationRelation.js.map +1 -0
  16. package/dist/packages/admintasks/src/commands/createVirtualPortal.d.ts +4 -0
  17. package/dist/packages/admintasks/src/commands/createVirtualPortal.js +63 -0
  18. package/dist/packages/admintasks/src/commands/createVirtualPortal.js.map +1 -0
  19. package/dist/packages/admintasks/src/commands/differentialReport.d.ts +6 -0
  20. package/dist/packages/admintasks/src/commands/differentialReport.js +149 -0
  21. package/dist/packages/admintasks/src/commands/differentialReport.js.map +1 -0
  22. package/dist/packages/admintasks/src/commands/exportVirtualPortal.d.ts +4 -0
  23. package/dist/packages/admintasks/src/commands/exportVirtualPortal.js +66 -0
  24. package/dist/packages/admintasks/src/commands/exportVirtualPortal.js.map +1 -0
  25. package/dist/packages/admintasks/src/commands/exportWCMLibrary.d.ts +4 -0
  26. package/dist/packages/admintasks/src/commands/exportWCMLibrary.js +141 -0
  27. package/dist/packages/admintasks/src/commands/exportWCMLibrary.js.map +1 -0
  28. package/dist/packages/admintasks/src/commands/importVirtualPortal.d.ts +4 -0
  29. package/dist/packages/admintasks/src/commands/importVirtualPortal.js +67 -0
  30. package/dist/packages/admintasks/src/commands/importVirtualPortal.js.map +1 -0
  31. package/dist/packages/admintasks/src/commands/importWCMLibrary.d.ts +4 -0
  32. package/dist/packages/admintasks/src/commands/importWCMLibrary.js +112 -0
  33. package/dist/packages/admintasks/src/commands/importWCMLibrary.js.map +1 -0
  34. package/dist/packages/admintasks/src/commands/listVirtualPortals.d.ts +4 -0
  35. package/dist/packages/admintasks/src/commands/listVirtualPortals.js +57 -0
  36. package/dist/packages/admintasks/src/commands/listVirtualPortals.js.map +1 -0
  37. package/dist/packages/admintasks/src/commands/pznRulesExport.d.ts +4 -0
  38. package/dist/packages/admintasks/src/commands/pznRulesExport.js +85 -0
  39. package/dist/packages/admintasks/src/commands/pznRulesExport.js.map +1 -0
  40. package/dist/packages/admintasks/src/commands/pznRulesImport.d.ts +4 -0
  41. package/dist/packages/admintasks/src/commands/pznRulesImport.js +130 -0
  42. package/dist/packages/admintasks/src/commands/pznRulesImport.js.map +1 -0
  43. package/dist/packages/admintasks/src/commands/resEnvProviderActions.d.ts +4 -0
  44. package/dist/packages/admintasks/src/commands/resEnvProviderActions.js +179 -0
  45. package/dist/packages/admintasks/src/commands/resEnvProviderActions.js.map +1 -0
  46. package/dist/packages/admintasks/src/commands/restartCorePods.d.ts +4 -0
  47. package/dist/packages/admintasks/src/commands/restartCorePods.js +45 -0
  48. package/dist/packages/admintasks/src/commands/restartCorePods.js.map +1 -0
  49. package/dist/packages/admintasks/src/commands/restartDXCore.d.ts +4 -0
  50. package/dist/packages/admintasks/src/commands/restartDXCore.js +68 -0
  51. package/dist/packages/admintasks/src/commands/restartDXCore.js.map +1 -0
  52. package/dist/packages/admintasks/src/errors/CommandLineMessages_en.json +62 -0
  53. package/dist/packages/admintasks/src/messages/messages_en.json +34 -0
  54. package/dist/packages/admintasks/src/services/createSyndicationRelationServices.d.ts +4 -0
  55. package/dist/packages/admintasks/src/services/createSyndicationRelationServices.js +53 -0
  56. package/dist/packages/admintasks/src/services/createSyndicationRelationServices.js.map +1 -0
  57. package/dist/packages/admintasks/src/services/differentialReportService.d.ts +5 -0
  58. package/dist/packages/admintasks/src/services/differentialReportService.js +59 -0
  59. package/dist/packages/admintasks/src/services/differentialReportService.js.map +1 -0
  60. package/dist/packages/admintasks/src/services/resEnvProviderService.d.ts +9 -0
  61. package/dist/packages/admintasks/src/services/resEnvProviderService.js +238 -0
  62. package/dist/packages/admintasks/src/services/resEnvProviderService.js.map +1 -0
  63. package/dist/packages/admintasks/src/services/restartCorePodsService.d.ts +4 -0
  64. package/dist/packages/admintasks/src/services/restartCorePodsService.js +45 -0
  65. package/dist/packages/admintasks/src/services/restartCorePodsService.js.map +1 -0
  66. package/dist/packages/admintasks/src/services/restartDXCoreService.d.ts +4 -0
  67. package/dist/packages/admintasks/src/services/restartDXCoreService.js +82 -0
  68. package/dist/packages/admintasks/src/services/restartDXCoreService.js.map +1 -0
  69. package/dist/packages/admintasks/src/services/virtualPortalServices.d.ts +33 -0
  70. package/dist/packages/admintasks/src/services/virtualPortalServices.js +169 -0
  71. package/dist/packages/admintasks/src/services/virtualPortalServices.js.map +1 -0
  72. package/dist/packages/admintasks/src/utils/createCredentialVault.xml +14 -0
  73. package/dist/packages/admintasks/src/utils/differential-report-utils.d.ts +11 -0
  74. package/dist/packages/admintasks/src/utils/differential-report-utils.js +1564 -0
  75. package/dist/packages/admintasks/src/utils/differential-report-utils.js.map +1 -0
  76. package/dist/packages/admintasks/src/utils/differential-report-utils.ts +1651 -0
  77. package/dist/packages/admintasks/src/utils/reportAttributes.properties +179 -0
  78. package/dist/packages/dam/package-lock.json +14605 -0
  79. package/dist/packages/dam/package.json +57 -0
  80. package/dist/packages/dam/src/commands/createSecrets.d.ts +4 -0
  81. package/dist/packages/dam/src/commands/createSecrets.js +61 -0
  82. package/dist/packages/dam/src/commands/createSecrets.js.map +1 -0
  83. package/dist/packages/dam/src/commands/deleteDAMStagingMismatch.d.ts +7 -0
  84. package/dist/packages/dam/src/commands/deleteDAMStagingMismatch.js +50 -0
  85. package/dist/packages/dam/src/commands/deleteDAMStagingMismatch.js.map +1 -0
  86. package/dist/packages/dam/src/commands/deleteSchema.d.ts +4 -0
  87. package/dist/packages/dam/src/commands/deleteSchema.js +80 -0
  88. package/dist/packages/dam/src/commands/deleteSchema.js.map +1 -0
  89. package/dist/packages/dam/src/commands/exportAssets.d.ts +5 -0
  90. package/dist/packages/dam/src/commands/exportAssets.js +106 -0
  91. package/dist/packages/dam/src/commands/exportAssets.js.map +1 -0
  92. package/dist/packages/dam/src/commands/findDAMStagingMismatch.d.ts +7 -0
  93. package/dist/packages/dam/src/commands/findDAMStagingMismatch.js +53 -0
  94. package/dist/packages/dam/src/commands/findDAMStagingMismatch.js.map +1 -0
  95. package/dist/packages/dam/src/commands/importAssets.d.ts +4 -0
  96. package/dist/packages/dam/src/commands/importAssets.js +78 -0
  97. package/dist/packages/dam/src/commands/importAssets.js.map +1 -0
  98. package/dist/packages/dam/src/commands/listSchema.d.ts +4 -0
  99. package/dist/packages/dam/src/commands/listSchema.js +44 -0
  100. package/dist/packages/dam/src/commands/listSchema.js.map +1 -0
  101. package/dist/packages/dam/src/commands/stagingMismatchReport.d.ts +15 -0
  102. package/dist/packages/dam/src/commands/stagingMismatchReport.js +168 -0
  103. package/dist/packages/dam/src/commands/stagingMismatchReport.js.map +1 -0
  104. package/dist/packages/dam/src/commands/stagingResync.d.ts +7 -0
  105. package/dist/packages/dam/src/commands/stagingResync.js +53 -0
  106. package/dist/packages/dam/src/commands/stagingResync.js.map +1 -0
  107. package/dist/packages/dam/src/commands/subscriberDeRegistration.d.ts +4 -0
  108. package/dist/packages/dam/src/commands/subscriberDeRegistration.js +45 -0
  109. package/dist/packages/dam/src/commands/subscriberDeRegistration.js.map +1 -0
  110. package/dist/packages/dam/src/commands/subscriberDetails.d.ts +9 -0
  111. package/dist/packages/dam/src/commands/subscriberDetails.js +50 -0
  112. package/dist/packages/dam/src/commands/subscriberDetails.js.map +1 -0
  113. package/dist/packages/dam/src/commands/subscriberRegistration.d.ts +9 -0
  114. package/dist/packages/dam/src/commands/subscriberRegistration.js +62 -0
  115. package/dist/packages/dam/src/commands/subscriberRegistration.js.map +1 -0
  116. package/dist/packages/dam/src/commands/triggerDAMStaging.d.ts +4 -0
  117. package/dist/packages/dam/src/commands/triggerDAMStaging.js +45 -0
  118. package/dist/packages/dam/src/commands/triggerDAMStaging.js.map +1 -0
  119. package/dist/packages/dam/src/commands/triggerDamReindexing.d.ts +4 -0
  120. package/dist/packages/dam/src/commands/triggerDamReindexing.js +54 -0
  121. package/dist/packages/dam/src/commands/triggerDamReindexing.js.map +1 -0
  122. package/dist/packages/dam/src/commands/updateSecrets.d.ts +4 -0
  123. package/dist/packages/dam/src/commands/updateSecrets.js +61 -0
  124. package/dist/packages/dam/src/commands/updateSecrets.js.map +1 -0
  125. package/dist/packages/dam/src/commands/validateAssets.d.ts +4 -0
  126. package/dist/packages/dam/src/commands/validateAssets.js +64 -0
  127. package/dist/packages/dam/src/commands/validateAssets.js.map +1 -0
  128. package/dist/packages/dam/src/errors/CommandLineMessages_en.json +80 -0
  129. package/dist/packages/dam/src/export/collection.d.ts +10 -0
  130. package/dist/packages/dam/src/export/collection.js +291 -0
  131. package/dist/packages/dam/src/export/collection.js.map +1 -0
  132. package/dist/packages/dam/src/export/favorite.d.ts +2 -0
  133. package/dist/packages/dam/src/export/favorite.js +61 -0
  134. package/dist/packages/dam/src/export/favorite.js.map +1 -0
  135. package/dist/packages/dam/src/export/media-item.d.ts +6 -0
  136. package/dist/packages/dam/src/export/media-item.js +193 -0
  137. package/dist/packages/dam/src/export/media-item.js.map +1 -0
  138. package/dist/packages/dam/src/export/media-type-group.d.ts +2 -0
  139. package/dist/packages/dam/src/export/media-type-group.js +43 -0
  140. package/dist/packages/dam/src/export/media-type-group.js.map +1 -0
  141. package/dist/packages/dam/src/export/media-type.d.ts +2 -0
  142. package/dist/packages/dam/src/export/media-type.js +43 -0
  143. package/dist/packages/dam/src/export/media-type.js.map +1 -0
  144. package/dist/packages/dam/src/export/renditions.d.ts +8 -0
  145. package/dist/packages/dam/src/export/renditions.js +255 -0
  146. package/dist/packages/dam/src/export/renditions.js.map +1 -0
  147. package/dist/packages/dam/src/import/collection.d.ts +5 -0
  148. package/dist/packages/dam/src/import/collection.js +148 -0
  149. package/dist/packages/dam/src/import/collection.js.map +1 -0
  150. package/dist/packages/dam/src/import/favorite.d.ts +2 -0
  151. package/dist/packages/dam/src/import/favorite.js +65 -0
  152. package/dist/packages/dam/src/import/favorite.js.map +1 -0
  153. package/dist/packages/dam/src/import/media-items.d.ts +5 -0
  154. package/dist/packages/dam/src/import/media-items.js +182 -0
  155. package/dist/packages/dam/src/import/media-items.js.map +1 -0
  156. package/dist/packages/dam/src/import/media-type-group.d.ts +2 -0
  157. package/dist/packages/dam/src/import/media-type-group.js +68 -0
  158. package/dist/packages/dam/src/import/media-type-group.js.map +1 -0
  159. package/dist/packages/dam/src/import/media-type.d.ts +2 -0
  160. package/dist/packages/dam/src/import/media-type.js +71 -0
  161. package/dist/packages/dam/src/import/media-type.js.map +1 -0
  162. package/dist/packages/dam/src/import/permission.d.ts +5 -0
  163. package/dist/packages/dam/src/import/permission.js +96 -0
  164. package/dist/packages/dam/src/import/permission.js.map +1 -0
  165. package/dist/packages/dam/src/import/renditions.d.ts +9 -0
  166. package/dist/packages/dam/src/import/renditions.js +326 -0
  167. package/dist/packages/dam/src/import/renditions.js.map +1 -0
  168. package/dist/packages/dam/src/messages/messages_en.json +19 -0
  169. package/dist/packages/dam/src/services/authService.d.ts +5 -0
  170. package/dist/packages/dam/src/services/authService.js +55 -0
  171. package/dist/packages/dam/src/services/authService.js.map +1 -0
  172. package/dist/packages/dam/src/services/stagingService.d.ts +37 -0
  173. package/dist/packages/dam/src/services/stagingService.js +440 -0
  174. package/dist/packages/dam/src/services/stagingService.js.map +1 -0
  175. package/dist/packages/dam/src/services/tokenCache.d.ts +8 -0
  176. package/dist/packages/dam/src/services/tokenCache.js +68 -0
  177. package/dist/packages/dam/src/services/tokenCache.js.map +1 -0
  178. package/dist/packages/dam/src/utils/constants.d.ts +70 -0
  179. package/dist/packages/dam/src/utils/constants.js +76 -0
  180. package/dist/packages/dam/src/utils/constants.js.map +1 -0
  181. package/dist/packages/dam/src/utils/interfaces/collection.d.ts +46 -0
  182. package/dist/packages/dam/src/utils/interfaces/collection.js +3 -0
  183. package/dist/packages/dam/src/utils/interfaces/collection.js.map +1 -0
  184. package/dist/packages/dam/src/utils/interfaces/favorite-request.d.ts +6 -0
  185. package/dist/packages/dam/src/utils/interfaces/favorite-request.js +3 -0
  186. package/dist/packages/dam/src/utils/interfaces/favorite-request.js.map +1 -0
  187. package/dist/packages/dam/src/utils/interfaces/media-request.d.ts +54 -0
  188. package/dist/packages/dam/src/utils/interfaces/media-request.js +3 -0
  189. package/dist/packages/dam/src/utils/interfaces/media-request.js.map +1 -0
  190. package/dist/packages/dam/src/utils/interfaces/media-type-group.d.ts +8 -0
  191. package/dist/packages/dam/src/utils/interfaces/media-type-group.js +3 -0
  192. package/dist/packages/dam/src/utils/interfaces/media-type-group.js.map +1 -0
  193. package/dist/packages/dam/src/utils/interfaces/media-type.d.ts +11 -0
  194. package/dist/packages/dam/src/utils/interfaces/media-type.js +3 -0
  195. package/dist/packages/dam/src/utils/interfaces/media-type.js.map +1 -0
  196. package/dist/packages/dam/src/utils/interfaces/media.d.ts +118 -0
  197. package/dist/packages/dam/src/utils/interfaces/media.js +3 -0
  198. package/dist/packages/dam/src/utils/interfaces/media.js.map +1 -0
  199. package/dist/packages/dam/src/utils/service.d.ts +8 -0
  200. package/dist/packages/dam/src/utils/service.js +126 -0
  201. package/dist/packages/dam/src/utils/service.js.map +1 -0
  202. package/dist/packages/dam/src/validation/collection-list-validate.d.ts +2 -0
  203. package/dist/packages/dam/src/validation/collection-list-validate.js +81 -0
  204. package/dist/packages/dam/src/validation/collection-list-validate.js.map +1 -0
  205. package/dist/packages/dam/src/validation/media-list-validate.d.ts +2 -0
  206. package/dist/packages/dam/src/validation/media-list-validate.js +91 -0
  207. package/dist/packages/dam/src/validation/media-list-validate.js.map +1 -0
  208. package/dist/packages/dam/src/validation/media-type-group-validate.d.ts +1 -0
  209. package/dist/packages/dam/src/validation/media-type-group-validate.js +28 -0
  210. package/dist/packages/dam/src/validation/media-type-group-validate.js.map +1 -0
  211. package/dist/packages/dam/src/validation/media-type-validate.d.ts +1 -0
  212. package/dist/packages/dam/src/validation/media-type-validate.js +28 -0
  213. package/dist/packages/dam/src/validation/media-type-validate.js.map +1 -0
  214. package/dist/packages/dam/src/validation/root-validate.d.ts +1 -0
  215. package/dist/packages/dam/src/validation/root-validate.js +42 -0
  216. package/dist/packages/dam/src/validation/root-validate.js.map +1 -0
  217. package/dist/packages/dam/src/validation/validate.rendition.d.ts +1 -0
  218. package/dist/packages/dam/src/validation/validate.rendition.js +69 -0
  219. package/dist/packages/dam/src/validation/validate.rendition.js.map +1 -0
  220. package/dist/packages/dam/src/validation/validate.versions.d.ts +1 -0
  221. package/dist/packages/dam/src/validation/validate.versions.js +67 -0
  222. package/dist/packages/dam/src/validation/validate.versions.js.map +1 -0
  223. package/dist/packages/deployportlet/package-lock.json +20575 -0
  224. package/dist/packages/deployportlet/package.json +51 -0
  225. package/dist/packages/deployportlet/src/commands/deployPortlet.d.ts +4 -0
  226. package/dist/packages/deployportlet/src/commands/deployPortlet.js +99 -0
  227. package/dist/packages/deployportlet/src/commands/deployPortlet.js.map +1 -0
  228. package/dist/packages/deployportlet/src/commands/undeployPortlet.d.ts +4 -0
  229. package/dist/packages/deployportlet/src/commands/undeployPortlet.js +118 -0
  230. package/dist/packages/deployportlet/src/commands/undeployPortlet.js.map +1 -0
  231. package/dist/packages/deployportlet/src/commands/xmlaccess.d.ts +4 -0
  232. package/dist/packages/deployportlet/src/commands/xmlaccess.js +37 -0
  233. package/dist/packages/deployportlet/src/commands/xmlaccess.js.map +1 -0
  234. package/dist/packages/deployportlet/src/errors/CommandLineMessages_en.json +5 -0
  235. package/dist/packages/deployportlet/src/messages/messages_en.json +10 -0
  236. package/dist/packages/deployportlet/src/services/undeployPortletServices.d.ts +4 -0
  237. package/dist/packages/deployportlet/src/services/undeployPortletServices.js +92 -0
  238. package/dist/packages/deployportlet/src/services/undeployPortletServices.js.map +1 -0
  239. package/dist/packages/deployscriptapplication/package-lock.json +20758 -0
  240. package/dist/packages/deployscriptapplication/package.json +48 -0
  241. package/dist/packages/deployscriptapplication/src/commands/list.js +109 -0
  242. package/dist/packages/deployscriptapplication/src/commands/pull.d.ts +6 -0
  243. package/dist/packages/deployscriptapplication/src/commands/pull.js +195 -0
  244. package/dist/packages/deployscriptapplication/src/commands/pull.js.map +1 -0
  245. package/dist/packages/deployscriptapplication/src/commands/push.d.ts +9 -0
  246. package/dist/packages/deployscriptapplication/src/commands/push.js +282 -0
  247. package/dist/packages/deployscriptapplication/src/commands/push.js.map +1 -0
  248. package/dist/packages/deployscriptapplication/src/commands/restoreScriptApplication.d.ts +5 -0
  249. package/dist/packages/deployscriptapplication/src/commands/restoreScriptApplication.js +125 -0
  250. package/dist/packages/deployscriptapplication/src/commands/restoreScriptApplication.js.map +1 -0
  251. package/dist/packages/deployscriptapplication/src/commands/undeployScriptApplication.d.ts +5 -0
  252. package/dist/packages/deployscriptapplication/src/commands/undeployScriptApplication.js +162 -0
  253. package/dist/packages/deployscriptapplication/src/commands/undeployScriptApplication.js.map +1 -0
  254. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages.properties +211 -0
  255. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_ar.properties +211 -0
  256. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_ca.properties +211 -0
  257. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_cs.properties +211 -0
  258. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_da.properties +211 -0
  259. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_de.properties +211 -0
  260. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_el.properties +211 -0
  261. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_en.json +129 -0
  262. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_en.properties +211 -0
  263. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_es.properties +211 -0
  264. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_fi.properties +211 -0
  265. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_fr.properties +211 -0
  266. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_hr.properties +211 -0
  267. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_hu.properties +211 -0
  268. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_it.properties +212 -0
  269. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_iw.properties +211 -0
  270. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_ja.properties +211 -0
  271. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_kk.properties +211 -0
  272. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_ko.properties +211 -0
  273. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_nl.properties +211 -0
  274. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_no.properties +211 -0
  275. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_pl.properties +211 -0
  276. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_pt.properties +211 -0
  277. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_pt_BR.properties +211 -0
  278. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_ro.properties +211 -0
  279. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_ru.properties +211 -0
  280. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_sk.properties +211 -0
  281. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_sl.properties +211 -0
  282. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_sv.properties +211 -0
  283. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_th.properties +211 -0
  284. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_tr.properties +211 -0
  285. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_uk.properties +211 -0
  286. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_zh.properties +210 -0
  287. package/dist/packages/deployscriptapplication/src/errors/CommandLineMessages_zh_TW.properties +211 -0
  288. package/dist/packages/deployscriptapplication/src/messages/messages.properties +63 -0
  289. package/dist/packages/deployscriptapplication/src/messages/messages_ar.properties +63 -0
  290. package/dist/packages/deployscriptapplication/src/messages/messages_ca.properties +63 -0
  291. package/dist/packages/deployscriptapplication/src/messages/messages_cs.properties +63 -0
  292. package/dist/packages/deployscriptapplication/src/messages/messages_da.properties +63 -0
  293. package/dist/packages/deployscriptapplication/src/messages/messages_de.properties +63 -0
  294. package/dist/packages/deployscriptapplication/src/messages/messages_el.properties +63 -0
  295. package/dist/packages/deployscriptapplication/src/messages/messages_en.json +61 -0
  296. package/dist/packages/deployscriptapplication/src/messages/messages_en.properties +63 -0
  297. package/dist/packages/deployscriptapplication/src/messages/messages_es.properties +63 -0
  298. package/dist/packages/deployscriptapplication/src/messages/messages_fi.properties +63 -0
  299. package/dist/packages/deployscriptapplication/src/messages/messages_fr.properties +63 -0
  300. package/dist/packages/deployscriptapplication/src/messages/messages_hr.properties +63 -0
  301. package/dist/packages/deployscriptapplication/src/messages/messages_hu.properties +63 -0
  302. package/dist/packages/deployscriptapplication/src/messages/messages_it.properties +63 -0
  303. package/dist/packages/deployscriptapplication/src/messages/messages_iw.properties +63 -0
  304. package/dist/packages/deployscriptapplication/src/messages/messages_ja.properties +63 -0
  305. package/dist/packages/deployscriptapplication/src/messages/messages_kk.properties +63 -0
  306. package/dist/packages/deployscriptapplication/src/messages/messages_ko.properties +63 -0
  307. package/dist/packages/deployscriptapplication/src/messages/messages_nl.properties +63 -0
  308. package/dist/packages/deployscriptapplication/src/messages/messages_no.properties +63 -0
  309. package/dist/packages/deployscriptapplication/src/messages/messages_pl.properties +63 -0
  310. package/dist/packages/deployscriptapplication/src/messages/messages_pt.properties +63 -0
  311. package/dist/packages/deployscriptapplication/src/messages/messages_pt_BR.properties +63 -0
  312. package/dist/packages/deployscriptapplication/src/messages/messages_ro.properties +63 -0
  313. package/dist/packages/deployscriptapplication/src/messages/messages_ru.properties +63 -0
  314. package/dist/packages/deployscriptapplication/src/messages/messages_sk.properties +63 -0
  315. package/dist/packages/deployscriptapplication/src/messages/messages_sl.properties +63 -0
  316. package/dist/packages/deployscriptapplication/src/messages/messages_sv.properties +63 -0
  317. package/dist/packages/deployscriptapplication/src/messages/messages_th.properties +63 -0
  318. package/dist/packages/deployscriptapplication/src/messages/messages_tr.properties +63 -0
  319. package/dist/packages/deployscriptapplication/src/messages/messages_uk.properties +63 -0
  320. package/dist/packages/deployscriptapplication/src/messages/messages_zh.properties +67 -0
  321. package/dist/packages/deployscriptapplication/src/messages/messages_zh_TW.properties +67 -0
  322. package/dist/packages/deployscriptapplication/src/util/constants.d.ts +74 -0
  323. package/dist/packages/deployscriptapplication/src/util/constants.js +98 -0
  324. package/dist/packages/deployscriptapplication/src/util/constants.js.map +1 -0
  325. package/dist/packages/deployscriptapplication/src/util/generic.d.ts +2 -0
  326. package/dist/packages/deployscriptapplication/src/util/generic.js +29 -0
  327. package/dist/packages/deployscriptapplication/src/util/generic.js.map +1 -0
  328. package/dist/packages/deploytheme/package-lock.json +21204 -0
  329. package/dist/packages/deploytheme/package.json +56 -0
  330. package/dist/packages/deploytheme/src/commands/deployApplication.d.ts +4 -0
  331. package/dist/packages/deploytheme/src/commands/deployApplication.js +115 -0
  332. package/dist/packages/deploytheme/src/commands/deployApplication.js.map +1 -0
  333. package/dist/packages/deploytheme/src/commands/deployTheme.d.ts +7 -0
  334. package/dist/packages/deploytheme/src/commands/deployTheme.js +286 -0
  335. package/dist/packages/deploytheme/src/commands/deployTheme.js.map +1 -0
  336. package/dist/packages/deploytheme/src/commands/undeployApplication.d.ts +4 -0
  337. package/dist/packages/deploytheme/src/commands/undeployApplication.js +46 -0
  338. package/dist/packages/deploytheme/src/commands/undeployApplication.js.map +1 -0
  339. package/dist/packages/deploytheme/src/commands/undeployTheme.d.ts +10 -0
  340. package/dist/packages/deploytheme/src/commands/undeployTheme.js +288 -0
  341. package/dist/packages/deploytheme/src/commands/undeployTheme.js.map +1 -0
  342. package/dist/packages/deploytheme/src/errors/CommandLineMessages_en.json +28 -0
  343. package/dist/packages/deploytheme/src/messages/messages_en.json +30 -0
  344. package/dist/packages/deploytheme/src/services/themeServices.d.ts +15 -0
  345. package/dist/packages/deploytheme/src/services/themeServices.js +413 -0
  346. package/dist/packages/deploytheme/src/services/themeServices.js.map +1 -0
  347. package/dist/packages/deploytheme/src/utils/Export.xml +28 -0
  348. package/dist/packages/livesync/package-lock.json +9737 -0
  349. package/dist/packages/livesync/package.json +49 -0
  350. package/dist/packages/livesync/src/commands/pullTheme.d.ts +5 -0
  351. package/dist/packages/livesync/src/commands/pullTheme.js +104 -0
  352. package/dist/packages/livesync/src/commands/pullTheme.js.map +1 -0
  353. package/dist/packages/livesync/src/commands/pullWcmDesignLibrary.d.ts +18 -0
  354. package/dist/packages/livesync/src/commands/pullWcmDesignLibrary.js +193 -0
  355. package/dist/packages/livesync/src/commands/pullWcmDesignLibrary.js.map +1 -0
  356. package/dist/packages/livesync/src/commands/pushTheme.d.ts +12 -0
  357. package/dist/packages/livesync/src/commands/pushTheme.js +233 -0
  358. package/dist/packages/livesync/src/commands/pushTheme.js.map +1 -0
  359. package/dist/packages/livesync/src/commands/pushWcmDesignLibrary.d.ts +4 -0
  360. package/dist/packages/livesync/src/commands/pushWcmDesignLibrary.js +23 -0
  361. package/dist/packages/livesync/src/commands/pushWcmDesignLibrary.js.map +1 -0
  362. package/dist/packages/livesync/src/errors/CommandLineMessages_en.json +52 -0
  363. package/dist/packages/livesync/src/messages/messages_en.json +33 -0
  364. package/dist/packages/livesync/src/services/EventsQueue.d.ts +12 -0
  365. package/dist/packages/livesync/src/services/EventsQueue.js +66 -0
  366. package/dist/packages/livesync/src/services/EventsQueue.js.map +1 -0
  367. package/dist/packages/livesync/src/services/foldersWcmServices.d.ts +7 -0
  368. package/dist/packages/livesync/src/services/foldersWcmServices.js +120 -0
  369. package/dist/packages/livesync/src/services/foldersWcmServices.js.map +1 -0
  370. package/dist/packages/livesync/src/services/htmlComponentWcmServices.d.ts +6 -0
  371. package/dist/packages/livesync/src/services/htmlComponentWcmServices.js +108 -0
  372. package/dist/packages/livesync/src/services/htmlComponentWcmServices.js.map +1 -0
  373. package/dist/packages/livesync/src/services/initialSyncServices.d.ts +3 -0
  374. package/dist/packages/livesync/src/services/initialSyncServices.js +94 -0
  375. package/dist/packages/livesync/src/services/initialSyncServices.js.map +1 -0
  376. package/dist/packages/livesync/src/services/livesyncUtils.d.ts +2 -0
  377. package/dist/packages/livesync/src/services/livesyncUtils.js +59 -0
  378. package/dist/packages/livesync/src/services/livesyncUtils.js.map +1 -0
  379. package/dist/packages/livesync/src/services/metadataServices.d.ts +16 -0
  380. package/dist/packages/livesync/src/services/metadataServices.js +117 -0
  381. package/dist/packages/livesync/src/services/metadataServices.js.map +1 -0
  382. package/dist/packages/livesync/src/services/ongoingSyncServices.d.ts +10 -0
  383. package/dist/packages/livesync/src/services/ongoingSyncServices.js +266 -0
  384. package/dist/packages/livesync/src/services/ongoingSyncServices.js.map +1 -0
  385. package/dist/packages/livesync/src/services/wcmRestV2Services.d.ts +5 -0
  386. package/dist/packages/livesync/src/services/wcmRestV2Services.js +92 -0
  387. package/dist/packages/livesync/src/services/wcmRestV2Services.js.map +1 -0
  388. package/dist/packages/livesync/src/types/EventHandler.type.d.ts +5 -0
  389. package/dist/packages/livesync/src/types/EventHandler.type.js +3 -0
  390. package/dist/packages/livesync/src/types/EventHandler.type.js.map +1 -0
  391. package/dist/packages/livesync/src/types/EventQueueItem.type.d.ts +7 -0
  392. package/dist/packages/livesync/src/types/EventQueueItem.type.js +3 -0
  393. package/dist/packages/livesync/src/types/EventQueueItem.type.js.map +1 -0
  394. package/dist/packages/livesync/src/types/OngoingSyncHooks.type.d.ts +4 -0
  395. package/dist/packages/livesync/src/types/OngoingSyncHooks.type.js +3 -0
  396. package/dist/packages/livesync/src/types/OngoingSyncHooks.type.js.map +1 -0
  397. package/dist/packages/livesync/src/types/WcmRestApiV2.type.d.ts +99 -0
  398. package/dist/packages/livesync/src/types/WcmRestApiV2.type.js +3 -0
  399. package/dist/packages/livesync/src/types/WcmRestApiV2.type.js.map +1 -0
  400. package/dist/packages/livesync/src/types/index.d.ts +4 -0
  401. package/dist/packages/livesync/src/types/index.js +17 -0
  402. package/dist/packages/livesync/src/types/index.js.map +1 -0
  403. package/dist/packages/mls_exim/package-lock.json +13855 -0
  404. package/dist/packages/mls_exim/package.json +51 -0
  405. package/dist/packages/mls_exim/src/errors/CommandLineMessages_en.json +19 -0
  406. package/dist/packages/mls_exim/src/export/mlsExport.d.ts +7 -0
  407. package/dist/packages/mls_exim/src/export/mlsExport.js +292 -0
  408. package/dist/packages/mls_exim/src/export/mlsExport.js.map +1 -0
  409. package/dist/packages/mls_exim/src/export/mlsExport.ts +371 -0
  410. package/dist/packages/mls_exim/src/import/mlsImport.d.ts +8 -0
  411. package/dist/packages/mls_exim/src/import/mlsImport.js +104 -0
  412. package/dist/packages/mls_exim/src/import/mlsImport.js.map +1 -0
  413. package/dist/packages/mls_exim/src/import/mlsImport.ts +138 -0
  414. package/dist/packages/mls_exim/src/messages/messages_en.json +14 -0
  415. package/dist/packages/mls_exim/src/utils/interfaces/export.d.ts +133 -0
  416. package/dist/packages/mls_exim/src/utils/interfaces/export.js +3 -0
  417. package/dist/packages/mls_exim/src/utils/interfaces/export.js.map +1 -0
  418. package/dist/packages/mls_exim/src/utils/interfaces/export.ts +165 -0
  419. package/dist/packages/mls_exim/src/utils/interfaces/import.d.ts +52 -0
  420. package/dist/packages/mls_exim/src/utils/interfaces/import.js +3 -0
  421. package/dist/packages/mls_exim/src/utils/interfaces/import.js.map +1 -0
  422. package/dist/packages/mls_exim/src/utils/interfaces/import.ts +76 -0
  423. package/dist/packages/sharedlibrary/package-lock.json +20575 -0
  424. package/dist/packages/sharedlibrary/package.json +51 -0
  425. package/dist/packages/sharedlibrary/src/commands/delete.d.ts +4 -0
  426. package/dist/packages/sharedlibrary/src/commands/delete.js +64 -0
  427. package/dist/packages/sharedlibrary/src/commands/delete.js.map +1 -0
  428. package/dist/packages/sharedlibrary/src/commands/upload.d.ts +4 -0
  429. package/dist/packages/sharedlibrary/src/commands/upload.js +105 -0
  430. package/dist/packages/sharedlibrary/src/commands/upload.js.map +1 -0
  431. package/dist/packages/sharedlibrary/src/errors/CommandLineMessages_en.json +10 -0
  432. package/dist/packages/sharedlibrary/src/messages/messages_en.json +7 -0
  433. package/dist/packages/sharedlibrary/src/services/sharedLibraryServices.d.ts +5 -0
  434. package/dist/packages/sharedlibrary/src/services/sharedLibraryServices.js +100 -0
  435. package/dist/packages/sharedlibrary/src/services/sharedLibraryServices.js.map +1 -0
  436. package/dist/packages/syndication/package-lock.json +20575 -0
  437. package/dist/packages/syndication/package.json +51 -0
  438. package/dist/packages/syndication/src/commands/subscriber.d.ts +4 -0
  439. package/dist/packages/syndication/src/commands/subscriber.js +62 -0
  440. package/dist/packages/syndication/src/commands/subscriber.js.map +1 -0
  441. package/dist/packages/syndication/src/commands/syndicationReport.d.ts +2 -0
  442. package/dist/packages/syndication/src/commands/syndicationReport.js +99 -0
  443. package/dist/packages/syndication/src/commands/syndicationReport.js.map +1 -0
  444. package/dist/packages/syndication/src/commands/syndicator.d.ts +4 -0
  445. package/dist/packages/syndication/src/commands/syndicator.js +62 -0
  446. package/dist/packages/syndication/src/commands/syndicator.js.map +1 -0
  447. package/dist/packages/syndication/src/commands/syndicatorFailedItem.d.ts +4 -0
  448. package/dist/packages/syndication/src/commands/syndicatorFailedItem.js +104 -0
  449. package/dist/packages/syndication/src/commands/syndicatorFailedItem.js.map +1 -0
  450. package/dist/packages/syndication/src/errors/CommandLineMessages_en.json +12 -0
  451. package/dist/packages/syndication/src/messages/messages_en.json +9 -0
  452. package/dist/packages/syndication/src/services/syndicationService.d.ts +108 -0
  453. package/dist/packages/syndication/src/services/syndicationService.js +167 -0
  454. package/dist/packages/syndication/src/services/syndicationService.js.map +1 -0
  455. package/dist/src/errors/CommandLineMessages_en.json +53 -0
  456. package/dist/src/index.d.ts +1 -0
  457. package/dist/src/index.js +2207 -0
  458. package/dist/src/index.js.map +1 -0
  459. package/dist/src/services/apiServices.d.ts +32 -0
  460. package/dist/src/services/apiServices.js +932 -0
  461. package/dist/src/services/apiServices.js.map +1 -0
  462. package/dist/src/services/filesServices.d.ts +9 -0
  463. package/dist/src/services/filesServices.js +134 -0
  464. package/dist/src/services/filesServices.js.map +1 -0
  465. package/dist/src/services/requestService.d.ts +4 -0
  466. package/dist/src/services/requestService.js +55 -0
  467. package/dist/src/services/requestService.js.map +1 -0
  468. package/dist/src/utils/commands.d.ts +2 -0
  469. package/dist/src/utils/commands.js +13 -0
  470. package/dist/src/utils/commands.js.map +1 -0
  471. package/dist/src/utils/constants.d.ts +389 -0
  472. package/dist/src/utils/constants.js +464 -0
  473. package/dist/src/utils/constants.js.map +1 -0
  474. package/dist/src/utils/interfaces.d.ts +19 -0
  475. package/dist/src/utils/interfaces.js +3 -0
  476. package/dist/src/utils/interfaces.js.map +1 -0
  477. package/dist/src/utils/logger.d.ts +3 -0
  478. package/dist/src/utils/logger.js +126 -0
  479. package/dist/src/utils/logger.js.map +1 -0
  480. package/dist/src/utils/utils.d.ts +31 -0
  481. package/dist/src/utils/utils.js +791 -0
  482. package/dist/src/utils/utils.js.map +1 -0
  483. package/dist/src/utils/validateOptions.d.ts +4 -0
  484. package/dist/src/utils/validateOptions.js +730 -0
  485. package/dist/src/utils/validateOptions.js.map +1 -0
  486. package/package.json +149 -0
@@ -0,0 +1,932 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.apiServices = void 0;
16
+ const fs_extra_1 = __importDefault(require("fs-extra"));
17
+ const axios_1 = __importDefault(require("axios"));
18
+ const form_data_1 = __importDefault(require("form-data"));
19
+ const lodash_1 = require("lodash");
20
+ const urlencode_1 = __importDefault(require("urlencode"));
21
+ const constants_1 = require("../utils/constants");
22
+ const logger_1 = require("../utils/logger");
23
+ const filesServices_1 = require("./filesServices");
24
+ const utils_1 = require("../utils/utils");
25
+ const requestService_1 = require("./requestService");
26
+ const MaskData = require('maskdata');
27
+ const uploadFileToServer = (uploadFileUrl, filePath, serverUsername, serverPassword) => __awaiter(void 0, void 0, void 0, function* () {
28
+ logger_1.logger.debug('Entering the uploadFileToServer function.');
29
+ logger_1.logger.debug('File path of the local file %s', filePath);
30
+ logger_1.logger.debug('Upload file url %s', uploadFileUrl);
31
+ let fileSize;
32
+ try {
33
+ fileSize = fs_extra_1.default.statSync(filePath).size + constants_1.REQUEST_BUFFER;
34
+ const file = fs_extra_1.default.createReadStream(filePath);
35
+ const formData = new form_data_1.default();
36
+ formData.append('file', file);
37
+ const headers = {
38
+ headers: Object.assign({ 'Content-Type': 'multipart/form-data', Authorization: utils_1.baseEncode(serverUsername, serverPassword) }, formData.getHeaders()),
39
+ maxContentLength: fileSize,
40
+ maxBodyLength: fileSize,
41
+ };
42
+ logger_1.logger.info('Upload file is in progress.');
43
+ const response = yield axios_1.default.post(uploadFileUrl, formData, headers);
44
+ logger_1.logger.debug('Exiting the uploadFileToServer function.');
45
+ return response;
46
+ }
47
+ catch (error) {
48
+ logger_1.logger.debug('Exception in the uploadFileToServer %s', error);
49
+ logger_1.logger.debug('Error code in the uploadFileToServer %s', error.code);
50
+ if (!error.response) {
51
+ if (error.code === 'ERR_FR_MAX_BODY_LENGTH_EXCEEDED') {
52
+ throw new Error(utils_1.errorMessage('ERROR_FILE_UPLOAD_SIZE_EXCEEDED', { 0: fileSize }, true));
53
+ }
54
+ else if (error.code === 'ENOTFOUND') {
55
+ throw new Error(utils_1.errorMessage('ERROR_HOSTNAME', {}, true));
56
+ }
57
+ else if (error.code === 'ECONNREFUSED') {
58
+ throw new Error(utils_1.errorMessage('ERROR_INVALID_PORT', {}, true));
59
+ }
60
+ else {
61
+ throw new Error(utils_1.errorMessage('ERROR_UNKNOWN_HOST', {}, true));
62
+ }
63
+ }
64
+ else if (error.response.status === constants_1.HttpStatus.UNAUTHORIZED) {
65
+ throw new Error(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
66
+ }
67
+ else if (error.response.status === constants_1.HttpStatus.SERVICE_UNAVAILABLE) {
68
+ throw new Error(utils_1.errorMessage('ERROR_DX_SERVICE_UNAVAILABLE', {}, true));
69
+ }
70
+ return error.response;
71
+ }
72
+ });
73
+ const deleteFileFromServer = (deleteFileURL, filePath, serverUsername, serverPassword) => __awaiter(void 0, void 0, void 0, function* () {
74
+ logger_1.logger.debug('Entering the deleteFileFromServer function.');
75
+ logger_1.logger.debug('Delete File URL %s ', deleteFileURL);
76
+ logger_1.logger.debug('Delete File path %s ', filePath);
77
+ const headers = {
78
+ headers: {
79
+ 'Content-Type': 'application/json',
80
+ Authorization: utils_1.baseEncode(serverUsername, serverPassword),
81
+ },
82
+ };
83
+ let deleteFilePath;
84
+ if (filePath) {
85
+ if (filePath.includes('/dxconnect/tmp')) {
86
+ deleteFilePath = filePath.substring(filePath.indexOf('/tmp') + 1, filePath.lastIndexOf('/'));
87
+ }
88
+ else {
89
+ deleteFilePath = filePath.substring(filePath.indexOf('\\tmp') + 1, filePath.lastIndexOf('\\'));
90
+ }
91
+ logger_1.logger.debug('Delete File path is not empty and folder is going to delete is ', deleteFilePath);
92
+ }
93
+ else {
94
+ logger_1.logger.debug('Delete File path is empty');
95
+ throw new Error(utils_1.errorMessage('ERROR_FILE_NOT_FOUND', {}, true));
96
+ }
97
+ const data = {
98
+ path: deleteFilePath,
99
+ };
100
+ try {
101
+ const response = yield axios_1.default.post(deleteFileURL, data, headers);
102
+ logger_1.logger.debug('Exiting the deleteFileFromServer function');
103
+ return response;
104
+ }
105
+ catch (error) {
106
+ logger_1.logger.debug('Exception in the deleteFileFromServer %s', error.response);
107
+ if (error.response.status === constants_1.HttpStatus.UNAUTHORIZED) {
108
+ throw new Error(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
109
+ }
110
+ return error.response;
111
+ }
112
+ });
113
+ const executeXmlAccess = (protocol, inputXmlfile, hostname, port, contextRoot, serverUsername, serverPassword, tagReplacer) => __awaiter(void 0, void 0, void 0, function* () {
114
+ logger_1.logger.debug('Entering the executeXmlAccess function.');
115
+ logger_1.logger.debug('Input xml file %s ', inputXmlfile);
116
+ logger_1.logger.debug('Hostname of xmlaccess execution %s ', hostname);
117
+ logger_1.logger.debug('Port of xmlaccess execution %s ', port);
118
+ let inputData = '';
119
+ try {
120
+ inputData = yield filesServices_1.fileServices.readFileContent(inputXmlfile);
121
+ if (!inputData) {
122
+ throw new Error(utils_1.errorMessage('ERROR_READ_XML_FILE', { 0: 'File Content is empty' }, true));
123
+ }
124
+ if (tagReplacer === constants_1.CONSTANT_VALUES.actionExport) {
125
+ const changeAction = /(<web-app [\S\s]*?action=")[^"]+("[\S\s]*?>)/gmi;
126
+ const changeType = /(<request[\S\s]*?type=")[^"]+("[\S\s]*?>)/gmi;
127
+ inputData = inputData.replace(changeType, '$1export$2').replace(changeAction, '$1export$2');
128
+ }
129
+ else if (tagReplacer) {
130
+ logger_1.logger.debug('War file path is not empty : %s ', tagReplacer);
131
+ const url = `${constants_1.CONSTANT_VALUES.xmlreplaceTagValue}${tagReplacer}`;
132
+ inputData = inputData.replace(/(<url>.*<\/url>)/g, `<url>${url}</url>`);
133
+ }
134
+ logger_1.logger.debug('Input data value is %s', inputData);
135
+ }
136
+ catch (error) {
137
+ logger_1.logger.debug('Exception in reading the file');
138
+ throw new Error(error.message);
139
+ }
140
+ try {
141
+ if (contextRoot.startsWith('/')) {
142
+ contextRoot = contextRoot.substring(1);
143
+ }
144
+ const url = `${protocol}://${hostname}:${port}/${contextRoot}`;
145
+ logger_1.logger.debug('Url of the xml access %s ', url);
146
+ const headers = {
147
+ headers: {
148
+ 'Content-Type': constants_1.CONTENT_TYPE.textXml,
149
+ Accept: constants_1.ACCEPT_TYPE.textOrXml,
150
+ 'User-Agent': constants_1.CONSTANT_VALUES.userAgent,
151
+ Connection: constants_1.CONSTANT_VALUES.connection,
152
+ Authorization: utils_1.baseEncode(serverUsername, serverPassword),
153
+ },
154
+ maxContentLength: constants_1.REQUEST_MAXFILE_SIZE,
155
+ maxBodyLength: constants_1.REQUEST_MAXFILE_SIZE,
156
+ };
157
+ logger_1.logger.debug('Header : %s ', JSON.stringify(headers));
158
+ logger_1.logger.debug('XML Access execution started');
159
+ const resp = yield axios_1.default.post(url, inputData, headers);
160
+ logger_1.logger.debug('Exiting the executeXmlAccess function.');
161
+ return resp;
162
+ }
163
+ catch (error) {
164
+ logger_1.logger.debug('Exception in execute XmlAccess %s', JSON.stringify(error));
165
+ if ((error.code && error.code === constants_1.ERROR_MAX_BODY_LENGTH)
166
+ || (error.code && error.message && error.code === constants_1.ERROR_BAD_REQUEST && error.message === 'Request body larger than maxBodyLength limit')) {
167
+ throw new Error(utils_1.errorMessage('ERROR_FILE_UPLOAD_SIZE_EXCEEDED', { 0: constants_1.MAX_CONTENT_LENGTH }, true));
168
+ }
169
+ if (!error.response) {
170
+ throw new Error(utils_1.errorMessage('ERROR_RESPONSE_UNDEFINED', {}, true));
171
+ }
172
+ if (error.response.status === constants_1.HttpStatus.UNAUTHORIZED) {
173
+ throw new Error(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
174
+ }
175
+ if (error.response.status === constants_1.HttpStatus.FORBIDDEN) {
176
+ throw new Error(error.response.status);
177
+ }
178
+ if (error.response.status === constants_1.HttpStatus.INTERNAL_SERVER_ERROR) {
179
+ throw new Error(error.response.status);
180
+ }
181
+ return error.response;
182
+ }
183
+ });
184
+ const manageApplication = (applicationURL, appFilePath, dxSoapPort, dxUsername, dxPassword, dxConnectUserName, dxConnectPassword, appName, dxProfileName, dxProfilePath, requestId) => __awaiter(void 0, void 0, void 0, function* () {
185
+ logger_1.logger.debug('Entering the deployApplication function.');
186
+ logger_1.logger.debug('Deploy Application URL %s ', applicationURL);
187
+ logger_1.logger.debug('Application File path %s ', appFilePath);
188
+ logger_1.logger.debug('DX Soap Port %s ', dxSoapPort);
189
+ logger_1.logger.debug('DX Profile Name %s ', dxProfileName);
190
+ logger_1.logger.debug('DX Profile Path %s ', dxProfilePath);
191
+ logger_1.logger.debug('Request Id %s ', requestId);
192
+ let response;
193
+ let counter = 1;
194
+ const jsonData = {
195
+ soapPort: dxSoapPort,
196
+ applicationFilePath: appFilePath,
197
+ applicationName: appName,
198
+ };
199
+ if (!requestId && !appFilePath && !applicationURL.includes(constants_1.URL_PARAMS.undeployApplication) && !applicationURL.includes(constants_1.URL_PARAMS.exportApplication)) {
200
+ logger_1.logger.debug('Application file path is invalid');
201
+ logger_1.logger.info(utils_1.errorMessage('ERROR_APPLICATION_PATH_INVALID'));
202
+ throw new Error(utils_1.errorMessage('ERROR_APPLICATION_PATH_INVALID'));
203
+ }
204
+ if (dxProfileName) {
205
+ jsonData.DXCoreProfileName = dxProfileName;
206
+ }
207
+ else if (dxProfilePath) {
208
+ jsonData.DXCoreProfilePath = dxProfilePath;
209
+ }
210
+ if (requestId) {
211
+ applicationURL = `${applicationURL}&uuid=${requestId}`;
212
+ }
213
+ try {
214
+ const axiosConfig = {
215
+ method: 'POST',
216
+ url: applicationURL,
217
+ data: jsonData,
218
+ headers: {
219
+ 'Content-Type': constants_1.CONTENT_TYPE.applicationJson,
220
+ Authorization: utils_1.baseEncode(dxConnectUserName, dxConnectPassword),
221
+ DXAuth: utils_1.baseEncode(dxUsername, dxPassword),
222
+ },
223
+ };
224
+ logger_1.logger.debug('Manage Application request: %s', JSON.stringify(axiosConfig));
225
+ response = yield requestService_1.requestService.axiosService(axiosConfig);
226
+ if (!requestId) {
227
+ while (response && response.status === constants_1.HttpStatus.ACCEPTED) {
228
+ if (counter >= 5) {
229
+ logger_1.logger.info(utils_1.errorMessage('RESPONSE_NOT_READY', {}, true));
230
+ break;
231
+ }
232
+ yield new Promise((resolve) => {
233
+ setTimeout(resolve, 60000);
234
+ });
235
+ logger_1.logger.debug('Try again with UUID - %s', response.data.uuid);
236
+ axiosConfig.url = `${applicationURL}&uuid=${response.data.uuid}`;
237
+ response = yield requestService_1.requestService.axiosService(axiosConfig);
238
+ counter += 1;
239
+ }
240
+ }
241
+ if (response.status === constants_1.HttpStatus.UNAUTHORIZED) {
242
+ logger_1.logger.info(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
243
+ }
244
+ }
245
+ catch (error) {
246
+ logger_1.logger.debug('Exception in the manageApplication %o', error);
247
+ logger_1.logger.error(error.message);
248
+ }
249
+ logger_1.logger.debug('Exiting the manageApplication function');
250
+ return response;
251
+ });
252
+ const login = (dxUsername, dxPassword, baseDxURL) => __awaiter(void 0, void 0, void 0, function* () {
253
+ logger_1.logger.debug('login to DX with base URL: %s', baseDxURL);
254
+ const axiosRequestConfig = {
255
+ method: constants_1.GET,
256
+ url: `${baseDxURL}${constants_1.DX_LOGIN_PATH}`,
257
+ headers: {
258
+ 'Content-Type': constants_1.CONTENT_TYPE.applicationJson,
259
+ Authorization: utils_1.baseEncode(dxUsername, dxPassword),
260
+ },
261
+ };
262
+ logger_1.logger.debug('Request configuration for login to DX - %s', JSON.stringify(axiosRequestConfig));
263
+ const response = yield requestService_1.requestService.axiosService(axiosRequestConfig);
264
+ if (!response) {
265
+ logger_1.logger.debug('Please ensure that the values for dxProtocol, hostname and dxPort are valid.');
266
+ throw new Error(utils_1.errorMessage('ERROR_RESPONSE_UNDEFINED', {}, true));
267
+ }
268
+ if (response.status === constants_1.HttpStatus.SUCCESS) {
269
+ return response.headers['set-cookie'][0];
270
+ }
271
+ if (response.status === constants_1.HttpStatus.UNAUTHORIZED) {
272
+ logger_1.logger.debug('Login failed due to authorisation failure.');
273
+ throw new Error(utils_1.errorMessage('ERROR_LOGIN_AUTHORISATION', {}, true));
274
+ }
275
+ if (response.status === constants_1.HttpStatus.NOT_FOUND) {
276
+ logger_1.logger.debug('Please ensure that the value for contentHandlerPath is valid.');
277
+ throw new Error(utils_1.errorMessage('ERROR_INVALID_CONTENTHANDLER', { 0: baseDxURL }, true));
278
+ }
279
+ logger_1.logger.debug('Response from DX server: %o', response);
280
+ throw response.statusText;
281
+ });
282
+ const searchWebContents = (baseDxURL, cookie, query) => __awaiter(void 0, void 0, void 0, function* () {
283
+ logger_1.logger.debug('Entering the searchWebContents function.');
284
+ try {
285
+ const axiosConfig = {
286
+ method: constants_1.GET,
287
+ url: `${baseDxURL}${constants_1.DX_GET_QUERY_URI_PATH}?${query}`,
288
+ headers: { Cookie: cookie },
289
+ };
290
+ logger_1.logger.debug('Request configuration for query - %s is %s', query, JSON.stringify(axiosConfig));
291
+ return requestService_1.requestService.axiosService(axiosConfig);
292
+ }
293
+ catch (error) {
294
+ logger_1.logger.error('Exception while search web contents data: %o', error);
295
+ throw error;
296
+ }
297
+ });
298
+ const getWCMLibraryIdFromName = (baseDxURL, cookie, wcmLibraryName) => __awaiter(void 0, void 0, void 0, function* () {
299
+ logger_1.logger.debug('Entering the getWCMLibraryIdFromName function.');
300
+ try {
301
+ const axiosConfig = {
302
+ method: constants_1.GET,
303
+ url: `${baseDxURL}${constants_1.DX_GET_QUERY_URI_PATH}?type=Library&title=${wcmLibraryName}`,
304
+ headers: { Cookie: cookie },
305
+ };
306
+ logger_1.logger.debug('Request configuration for querying the contents for the library id or name - %s is %s', wcmLibraryName, JSON.stringify(axiosConfig));
307
+ const response = yield requestService_1.requestService.axiosService(axiosConfig);
308
+ if (!response) {
309
+ logger_1.logger.debug('Please check dxProtocol/hostname/Port are valid or not.');
310
+ return '';
311
+ }
312
+ if (response.status === constants_1.HttpStatus.UNAUTHORIZED) {
313
+ logger_1.logger.debug(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
314
+ throw new Error(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
315
+ }
316
+ if (response && response.status === constants_1.HttpStatus.SUCCESS) {
317
+ if (response.data && response.data.feed && response.data.feed.entry && response.data.feed.entry.length > 0) {
318
+ const libraryIdsArray = yield Promise.all(response.data.feed.entry.map((item) => __awaiter(void 0, void 0, void 0, function* () {
319
+ if ('id' in item) {
320
+ item.id = item.id.replace(/^wcmrest:/, '');
321
+ }
322
+ logger_1.logger.debug('Retrieved library ID for library name - %s, library id is - %s', wcmLibraryName, item.id);
323
+ return item.id;
324
+ })));
325
+ return libraryIdsArray[0];
326
+ }
327
+ logger_1.logger.error(utils_1.errorMessage('ERROR_NO_ID_FOUND_FOR_NAME', { 0: wcmLibraryName }));
328
+ return '';
329
+ }
330
+ logger_1.logger.error(utils_1.errorMessage('ERROR_NO_ID_FOUND_FOR_NAME', { 0: wcmLibraryName }));
331
+ return '';
332
+ }
333
+ catch (error) {
334
+ logger_1.logger.debug('Exception while getting ID from library name: %o', error);
335
+ throw error;
336
+ }
337
+ });
338
+ const getWCMProjectIdFromName = (baseDxURL, cookie, wcmProjectName) => __awaiter(void 0, void 0, void 0, function* () {
339
+ logger_1.logger.debug('Entering the getWCMProjectIdFromName function.');
340
+ try {
341
+ const axiosConfig = {
342
+ method: constants_1.GET,
343
+ url: `${baseDxURL}${constants_1.DX_GET_QUERY_URI_PATH}?type=Project&name=${wcmProjectName}`,
344
+ headers: { Cookie: cookie },
345
+ };
346
+ logger_1.logger.debug('Request configuration for querying the contents for the project name - %s is %s', wcmProjectName, JSON.stringify(axiosConfig));
347
+ const response = yield requestService_1.requestService.axiosService(axiosConfig);
348
+ if (!response) {
349
+ logger_1.logger.debug('Please check dxProtocol/hostname/Port are valid or not.');
350
+ throw new Error(utils_1.errorMessage('ERROR_RESPONSE_UNDEFINED', {}, true));
351
+ }
352
+ if (response.status === constants_1.HttpStatus.UNAUTHORIZED) {
353
+ logger_1.logger.debug(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
354
+ throw new Error(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
355
+ }
356
+ if (response && response.status === constants_1.HttpStatus.SUCCESS) {
357
+ if (response.data && response.data.feed && response.data.feed.entry && response.data.feed.entry.length > 0) {
358
+ const projectIdsArray = yield Promise.all(response.data.feed.entry.map((item) => __awaiter(void 0, void 0, void 0, function* () {
359
+ if ('id' in item) {
360
+ item.id = item.id.replace(/^wcmrest:/, '');
361
+ }
362
+ logger_1.logger.debug('Retrieved project ID for project name - %s, project id is - %s', wcmProjectName, item.id);
363
+ return item.id;
364
+ })));
365
+ return projectIdsArray[0];
366
+ }
367
+ logger_1.logger.debug(utils_1.errorMessage('ERROR_NO_PROJECT_ID_FOUND_FOR_NAME', { 0: wcmProjectName }));
368
+ throw new Error(utils_1.errorMessage('ERROR_NO_PROJECT_ID_FOUND_FOR_NAME', { 0: wcmProjectName }));
369
+ }
370
+ logger_1.logger.debug(utils_1.errorMessage('ERROR_NO_PROJECT_ID_FOUND_FOR_NAME', { 0: wcmProjectName }));
371
+ throw new Error(utils_1.errorMessage('ERROR_NO_PROJECT_ID_FOUND_FOR_NAME', { 0: wcmProjectName }));
372
+ }
373
+ catch (error) {
374
+ logger_1.logger.debug('Exception while getting ID from project name: %o', error);
375
+ throw error;
376
+ }
377
+ });
378
+ const queryBuilder = (page, wcmLibraryId, wcmProjectId, lastModifiedAfter) => __awaiter(void 0, void 0, void 0, function* () {
379
+ let query = '';
380
+ if (wcmLibraryId) {
381
+ query = `type=Content&libraryId=${wcmLibraryId}&pageSize=${constants_1.SEARCH_PAGESIZE}&page=${page}`;
382
+ }
383
+ else {
384
+ query += `type=Content&projectId=${wcmProjectId}&pageSize=${constants_1.SEARCH_PAGESIZE}&page=${page}`;
385
+ }
386
+ if (lastModifiedAfter) {
387
+ const dateFormat = 'yyyy-MM-dd\'T\'HH:mm';
388
+ query += `&lastmodifiedafter=${urlencode_1.default(lastModifiedAfter)}&dateformat=${urlencode_1.default(dateFormat)}`;
389
+ }
390
+ return query;
391
+ });
392
+ const getWebContentIds = (baseDxURL, cookie, page, wcmLibraryId, wcmProjectName, wcmProjectId, lastModifiedAfter) => __awaiter(void 0, void 0, void 0, function* () {
393
+ logger_1.logger.debug('Entering the getWebContentIds function.');
394
+ let contentsIds = [];
395
+ logger_1.logger.debug('Searching web contents with page: %s %d', wcmLibraryId || wcmProjectName, page);
396
+ try {
397
+ const queryType = wcmLibraryId ? `library id - ${wcmLibraryId}` : `project name - ${wcmProjectName}`;
398
+ for (page;; page += 1) {
399
+ const response = yield searchWebContents(baseDxURL, cookie, yield queryBuilder(page, wcmLibraryId, wcmProjectId, lastModifiedAfter));
400
+ if (!response) {
401
+ logger_1.logger.debug('Please check dxProtocol/hostname/Port are valid or not.');
402
+ return [];
403
+ }
404
+ if (response.status === constants_1.HttpStatus.UNAUTHORIZED) {
405
+ logger_1.logger.debug(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
406
+ throw new Error(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
407
+ }
408
+ if (response.data && response.data.feed && response.data.feed.entry && response.data.feed.entry.length > 0) {
409
+ const contentsIdsArray = yield Promise.all(response.data.feed.entry.map((item) => __awaiter(void 0, void 0, void 0, function* () {
410
+ const contentItem = {
411
+ contentId: null,
412
+ lang: null,
413
+ };
414
+ if ('id' in item) {
415
+ contentItem.contentId = item.id.replace(/^wcmrest:/, '');
416
+ if (item.summary && item.summary.lang) {
417
+ contentItem.lang = item.summary.lang;
418
+ }
419
+ }
420
+ return contentItem;
421
+ })));
422
+ contentsIds = [...contentsIds, ...contentsIdsArray];
423
+ }
424
+ else if (response.data && response.data.feed && (!response.data.feed.entry || (response.data.feed.entry && !response.data.feed.entry.length))) {
425
+ logger_1.logger.debug('No contents found for : %s- ', queryType);
426
+ logger_1.logger.error(utils_1.errorMessage('ERROR_NO_CONTENTS_FOR_LIBRARY_OR_PROJECT', { 0: queryType }));
427
+ break;
428
+ }
429
+ else {
430
+ logger_1.logger.debug('Exception while searching web contents data: %d', response.status);
431
+ logger_1.logger.error(utils_1.errorMessage('ERROR_SEARCHING_CONTENTS_DATA', { 0: queryType }));
432
+ break;
433
+ }
434
+ if (response.data.feed && (response.data.feed.total <= constants_1.SEARCH_PAGESIZE || ((constants_1.SEARCH_PAGESIZE * page) > response.data.feed.total))) {
435
+ break;
436
+ }
437
+ }
438
+ logger_1.logger.debug('Contents searched from given data, contents length - %d', contentsIds.length);
439
+ return contentsIds;
440
+ }
441
+ catch (error) {
442
+ logger_1.logger.debug('Exception while searching web contents data: %o', error);
443
+ throw error;
444
+ }
445
+ });
446
+ const getMultilingualTranslationsData = (baseDxURL, cookie, wcmContentIds, wcmProjectId) => __awaiter(void 0, void 0, void 0, function* () {
447
+ logger_1.logger.debug('Entering the getMultilingualTranslationsData function.');
448
+ try {
449
+ logger_1.logger.debug('Retrieving translated web contents for the specified web content ids.');
450
+ const contentsResponse = [];
451
+ for (let index = 0; index < wcmContentIds.length; index += 1) {
452
+ const axiosConfig = {
453
+ method: constants_1.GET,
454
+ url: `${baseDxURL}${constants_1.DX_GET_TRANSLATIONS_URI_PATH}/${wcmContentIds[index].contentId}?allAvailableLang=true&props=true`,
455
+ headers: { Cookie: cookie },
456
+ };
457
+ logger_1.logger.debug('Request configuration for retrieve the translated web contents for the content id - %s is %s', wcmContentIds[index].contentId, JSON.stringify(axiosConfig));
458
+ const response = yield requestService_1.requestService.axiosService(axiosConfig);
459
+ if (!response) {
460
+ logger_1.logger.debug('Please check dxProtocol/hostname/Port are valid or not.');
461
+ return [];
462
+ }
463
+ if (response && response.status === constants_1.HttpStatus.SUCCESS) {
464
+ const responseData = response.data.entry.content.data;
465
+ if (wcmProjectId) {
466
+ if (wcmContentIds[index].lang && (wcmContentIds[index].lang !== responseData.source_language)) {
467
+ logger_1.logger.info(utils_1.message('MLS_EXPORT_RETRIEVED_TRANSLATION', { 0: wcmContentIds[index].contentId }));
468
+ }
469
+ else {
470
+ logger_1.logger.error(utils_1.errorMessage('ERROR_SOURCE_LANGUAGE', { 0: wcmContentIds[index].contentId, 1: responseData.translated_items[0].source_content.locale }));
471
+ }
472
+ if (responseData.translated_items && responseData.translated_items.length) {
473
+ for (let translationIndex = 0; translationIndex < responseData.translated_items.length; translationIndex += 1) {
474
+ if (responseData.translated_items[translationIndex].translated_content && responseData.translated_items[translationIndex].translated_content.length) {
475
+ responseData.translated_items[translationIndex].translated_content = responseData.translated_items[translationIndex].translated_content.filter((item) => {
476
+ return item.locale === wcmContentIds[index].lang;
477
+ });
478
+ }
479
+ }
480
+ }
481
+ }
482
+ else {
483
+ logger_1.logger.info(utils_1.message('MLS_EXPORT_RETRIEVED_TRANSLATION', { 0: wcmContentIds[index].contentId }));
484
+ }
485
+ if (responseData.translated_items && responseData.translated_items[0].translated_content && responseData.translated_items[0].translated_content.length) {
486
+ contentsResponse.push(responseData);
487
+ }
488
+ else {
489
+ logger_1.logger.error(utils_1.errorMessage('ERROR_NO_TRANSLATED_DATA_FOUND', { 0: wcmContentIds[index].contentId }));
490
+ }
491
+ }
492
+ else {
493
+ logger_1.logger.error(utils_1.errorMessage('ERROR_NO_TRANSLATED_DATA_FOUND', { 0: wcmContentIds[index].contentId }));
494
+ return [];
495
+ }
496
+ }
497
+ logger_1.logger.debug('Translated contents found, contents length - %d', contentsResponse.length);
498
+ return contentsResponse;
499
+ }
500
+ catch (error) {
501
+ logger_1.logger.debug('Exception while retrieving translated contents data: %o', error);
502
+ throw error;
503
+ }
504
+ });
505
+ const validateContentImport = (baseDxURL, cookie, wcmContentId, lastModifiedDateOfSource, lastModifiedDateOfTarget, targetLanguagesUUIDs) => __awaiter(void 0, void 0, void 0, function* () {
506
+ try {
507
+ if (lastModifiedDateOfSource && lastModifiedDateOfTarget
508
+ && !Number.isNaN(new Date(lastModifiedDateOfSource).getTime())
509
+ && !Number.isNaN(new Date(lastModifiedDateOfTarget).getTime())) {
510
+ logger_1.logger.debug('Retrieving translated web contents for the specified web content ids.');
511
+ const axiosConfig = {
512
+ method: constants_1.GET,
513
+ url: `${baseDxURL}${constants_1.DX_GET_TRANSLATIONS_URI_PATH}/${wcmContentId}?allAvailableLang=true&props=true`,
514
+ headers: { Cookie: cookie },
515
+ };
516
+ logger_1.logger.debug('Requested configuration for retrieve the translated web contents for the content id - %s is %s', wcmContentId, JSON.stringify(axiosConfig));
517
+ const response = yield requestService_1.requestService.axiosService(axiosConfig);
518
+ if (response && response.status === constants_1.HttpStatus.SUCCESS) {
519
+ const responseData = response.data.entry.content.data;
520
+ const targetModifiedDates = [];
521
+ if (responseData.translated_items && responseData.translated_items.length > 0) {
522
+ const translatedItems = responseData.translated_items[0];
523
+ if (translatedItems.source_content.updated) {
524
+ const sourceModifiedDate = new Date(translatedItems.source_content.updated).toUTCString();
525
+ const sourceValidation = new Date(lastModifiedDateOfSource).getTime() >= new Date(sourceModifiedDate).getTime();
526
+ if (translatedItems.translated_content && translatedItems.translated_content.length > 0) {
527
+ translatedItems.translated_content.forEach((translatedContent) => {
528
+ if (targetLanguagesUUIDs.includes(translatedContent.uuid) && translatedContent.updated) {
529
+ targetModifiedDates.push(translatedContent.updated);
530
+ }
531
+ });
532
+ if (targetModifiedDates.length > 0) {
533
+ const targetValidation = targetModifiedDates.every((date) => {
534
+ const targetModifiedDate = new Date(date).toUTCString();
535
+ return new Date(lastModifiedDateOfTarget).getTime() >= new Date(targetModifiedDate).getTime();
536
+ });
537
+ logger_1.logger.debug('Content Id - %s, source validation - %s, target validation - %s', wcmContentId, sourceValidation, targetValidation);
538
+ return sourceValidation && targetValidation;
539
+ }
540
+ }
541
+ }
542
+ }
543
+ }
544
+ }
545
+ return false;
546
+ }
547
+ catch (error) {
548
+ logger_1.logger.debug('Exception while retrieving translated contents data: %o', error);
549
+ throw error;
550
+ }
551
+ });
552
+ const importMultilingualTranslationsData = (sourceContentIds, fileData, token, baseDXUrl, projectName, forceImport) => __awaiter(void 0, void 0, void 0, function* () {
553
+ try {
554
+ let validationResult = true;
555
+ logger_1.logger.debug('Importing translated web contents for the specified web content ids.');
556
+ if (projectName) {
557
+ baseDXUrl += `/$project/${projectName}`;
558
+ logger_1.logger.debug('baseDXUrl appended with project name - %s', baseDXUrl);
559
+ }
560
+ for (let sourceContentIndex = 0; sourceContentIndex < sourceContentIds.length; sourceContentIndex += 1) {
561
+ const filteredElementsData = lodash_1.filter(fileData, { sourceUUID: sourceContentIds[sourceContentIndex], type: constants_1.CONTENT_ELEMENT_TYPE, wcmType: constants_1.WCM_TYPE });
562
+ const filteredInfoData = lodash_1.filter(fileData, { sourceUUID: sourceContentIds[sourceContentIndex], type: constants_1.CONTENT_INFORMATION_TYPE, wcmType: constants_1.WCM_TYPE });
563
+ const filteredData = [...filteredElementsData, ...filteredInfoData];
564
+ const lastModifiedDateOfSource = filteredData[0].lastModifiedOfSource;
565
+ const lastModifiedDateOfTarget = lodash_1.reduce(filteredData, (lastModifiedDate, data) => {
566
+ const maxDate = Math.max(new Date(lastModifiedDate).getTime(), new Date(data.lastModifiedOfTarget).getTime());
567
+ return new Date(maxDate).toUTCString();
568
+ }, filteredData[0].lastModifiedOfTarget);
569
+ const targetLanguagesObj = {};
570
+ filteredData.forEach((row) => {
571
+ if (!targetLanguagesObj[row.targetLanguage]) {
572
+ targetLanguagesObj[row.targetLanguage] = 1;
573
+ }
574
+ });
575
+ const targetLanguages = Object.keys(targetLanguagesObj);
576
+ const targetLanguagesUUIDObj = {};
577
+ filteredData.forEach((row) => {
578
+ if (!targetLanguagesUUIDObj[row.targetUUID]) {
579
+ targetLanguagesUUIDObj[row.targetUUID] = 1;
580
+ }
581
+ });
582
+ const targetLanguagesUUIDs = Object.keys(targetLanguagesUUIDObj);
583
+ if (!forceImport) {
584
+ validationResult = yield validateContentImport(baseDXUrl, token, sourceContentIds[sourceContentIndex], lastModifiedDateOfSource, lastModifiedDateOfTarget, targetLanguagesUUIDs);
585
+ }
586
+ logger_1.logger.debug('Import validation result for content Id - %s is - %s', sourceContentIds[sourceContentIndex], validationResult);
587
+ if (validationResult) {
588
+ const targetElementsData = [];
589
+ targetLanguages.forEach((targetLanguage) => {
590
+ const importElementsData = [];
591
+ const filteredTargetInfoData = lodash_1.filter(filteredInfoData, { targetLanguage });
592
+ const titleContent = filteredTargetInfoData.find((title) => { return title.field === constants_1.CONTENT_TITLE_TYPE; });
593
+ const descriptionContent = filteredTargetInfoData.find((description) => { return description.field === constants_1.CONTENT_DESCRIPTION_TYPE; });
594
+ const filteredTargetLanguageData = lodash_1.filter(filteredElementsData, { targetLanguage });
595
+ filteredTargetLanguageData.forEach((data) => {
596
+ importElementsData.push({
597
+ name: data.field,
598
+ type: data.componentType,
599
+ data: {
600
+ type: ((data.componentType === constants_1.WCMElementTypes.HTML_COMPONENT || data.componentType === constants_1.WCMElementTypes.RICH_TEXT_COMPONENT) ? constants_1.WCMDataType.HTML : constants_1.WCMDataType.TEXT),
601
+ value: data.target,
602
+ },
603
+ });
604
+ });
605
+ targetElementsData.push(Object.assign(Object.assign(Object.assign({}, titleContent && {
606
+ title: {
607
+ lang: titleContent.targetLanguage,
608
+ value: titleContent.target,
609
+ },
610
+ }), descriptionContent && {
611
+ description: {
612
+ lang: descriptionContent.targetLanguage,
613
+ value: descriptionContent.target,
614
+ },
615
+ }), { elements: { element: importElementsData }, uuid: filteredTargetInfoData[0].targetUUID || filteredTargetLanguageData[0].targetUUID, locale: targetLanguage }));
616
+ });
617
+ const importRequestData = {
618
+ entry: {
619
+ content: {
620
+ data: {
621
+ translated_items: [{ translated_content: targetElementsData }],
622
+ },
623
+ },
624
+ },
625
+ };
626
+ const axiosRequestConfig = {
627
+ method: constants_1.PUT,
628
+ baseURL: baseDXUrl,
629
+ url: `${constants_1.DX_GET_TRANSLATIONS_URI_PATH}/${sourceContentIds[sourceContentIndex]}?allAvailableLang=true`,
630
+ data: importRequestData,
631
+ withCredentials: true,
632
+ headers: {
633
+ Cookie: token,
634
+ accept: constants_1.CONTENT_TYPE.applicationJson,
635
+ 'content-type': constants_1.CONTENT_TYPE.applicationJson,
636
+ },
637
+ };
638
+ logger_1.logger.debug('Request configuration for importing translated data for the source content id - %s is %o', sourceContentIds[sourceContentIndex], axiosRequestConfig);
639
+ const response = yield requestService_1.requestService.axiosService(axiosRequestConfig);
640
+ if (response && response.status === constants_1.HttpStatus.SUCCESS) {
641
+ logger_1.logger.info(utils_1.message('MLS_IMPORT_TRANSLATION_DATA_SUCCESS', { 0: sourceContentIds[sourceContentIndex] }));
642
+ }
643
+ else {
644
+ const result = response ? JSON.stringify(response.data) : utils_1.errorMessage('ERROR_RESPONSE_UNDEFINED', {}, true);
645
+ logger_1.logger.error(utils_1.message('MLS_IMPORT_TRANSLATION_DATA_ERROR', { 0: sourceContentIds[sourceContentIndex], 1: result }));
646
+ }
647
+ }
648
+ else {
649
+ logger_1.logger.error(utils_1.message('MLS_IMPORT_VALIDATION_FAILED', { 0: sourceContentIds[sourceContentIndex] }));
650
+ }
651
+ }
652
+ return true;
653
+ }
654
+ catch (error) {
655
+ logger_1.logger.debug('Exception while importing translated contents data: %o', error);
656
+ throw error;
657
+ }
658
+ });
659
+ const downloadApplication = (downloadUrl, dxUsername, dxPassword, dxConnectUsername, dxConnectPassword) => __awaiter(void 0, void 0, void 0, function* () {
660
+ logger_1.logger.debug('Download Url is : %s', downloadUrl);
661
+ const axiosConfig = {
662
+ method: 'GET',
663
+ url: downloadUrl,
664
+ responseType: constants_1.RESPONSE_TYPE,
665
+ headers: {
666
+ Authorization: utils_1.baseEncode(dxConnectUsername, dxConnectPassword),
667
+ DXAuth: utils_1.baseEncode(dxUsername, dxPassword),
668
+ },
669
+ };
670
+ logger_1.logger.debug('Axios request for download application is : %o', axiosConfig);
671
+ const response = yield requestService_1.requestService.axiosService(axiosConfig);
672
+ if (!response) {
673
+ logger_1.logger.debug(utils_1.errorMessage('ERROR_RESPONSE_UNDEFINED', {}, true));
674
+ throw new Error(utils_1.errorMessage('ERROR_RESPONSE_UNDEFINED', {}, true));
675
+ }
676
+ switch (response.status) {
677
+ case constants_1.HttpStatus.UNAUTHORIZED: {
678
+ logger_1.logger.debug(utils_1.errorMessage('ERROR_THEME_AUTHORISATION'));
679
+ throw new Error(utils_1.errorMessage('ERROR_THEME_AUTHORISATION'));
680
+ }
681
+ case constants_1.HttpStatus.BAD_REQUEST: {
682
+ logger_1.logger.debug('Please provide a valid url');
683
+ return false;
684
+ }
685
+ case constants_1.HttpStatus.NOT_FOUND: {
686
+ try {
687
+ logger_1.logger.debug('Application not found.');
688
+ let result = yield utils_1.streamToString(response.data);
689
+ result = JSON.parse(result);
690
+ throw new Error(result.message);
691
+ }
692
+ catch (error) {
693
+ throw new Error(error);
694
+ }
695
+ }
696
+ case constants_1.HttpStatus.SUCCESS: {
697
+ logger_1.logger.debug('Success in execution of download zip axios call.');
698
+ return response.data;
699
+ }
700
+ case constants_1.HttpStatus.INTERNAL_SERVER_ERROR: {
701
+ logger_1.logger.debug('Execution of undeploy theme failed due to internal server error');
702
+ return false;
703
+ }
704
+ default:
705
+ logger_1.logger.debug('Execution of undeploy theme failed');
706
+ return false;
707
+ }
708
+ });
709
+ const listDAMSchema = (damURL, cookie) => __awaiter(void 0, void 0, void 0, function* () {
710
+ logger_1.logger.debug('Entering to the listDAMSchema function');
711
+ const axiosConfig = {
712
+ method: constants_1.GET,
713
+ url: `${damURL}/schemas`,
714
+ headers: { Cookie: cookie },
715
+ };
716
+ logger_1.logger.debug('DAM axiosConfig - %o', axiosConfig);
717
+ const response = yield requestService_1.requestService.axiosService(axiosConfig);
718
+ if (!response) {
719
+ logger_1.logger.debug('Response is undefined');
720
+ throw new Error(utils_1.errorMessage('ERROR_DAMAPI_RESPONSE_UNDEFINED'));
721
+ }
722
+ logger_1.logger.debug('listDAMSchema Response : %o', response);
723
+ switch (response.status) {
724
+ case constants_1.HttpStatus.UNAUTHORIZED: {
725
+ logger_1.logger.debug(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
726
+ throw new Error(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
727
+ }
728
+ case constants_1.HttpStatus.SUCCESS: {
729
+ logger_1.logger.debug('Execution of schema : success');
730
+ return response;
731
+ }
732
+ case constants_1.HttpStatus.FORBIDDEN: {
733
+ logger_1.logger.debug('Access denied for selected schema');
734
+ throw new Error(utils_1.errorMessage('ERROR_ACCESS_DENIED'));
735
+ }
736
+ case constants_1.HttpStatus.NOT_FOUND: {
737
+ logger_1.logger.debug('Please enter a valid damAPIVersion');
738
+ throw new Error(utils_1.errorMessage('ERROR_DAMAPI_VERSION'));
739
+ }
740
+ case constants_1.HttpStatus.INTERNAL_SERVER_ERROR: {
741
+ logger_1.logger.debug('Failed to delete schema');
742
+ throw new Error(utils_1.errorMessage('ERROR_FAILED_SCHEMA_DELETE'));
743
+ }
744
+ default:
745
+ logger_1.logger.debug('Execution of schema get failed');
746
+ return false;
747
+ }
748
+ });
749
+ const deleteDAMSchema = (damURL, cookie, schemaVersion) => __awaiter(void 0, void 0, void 0, function* () {
750
+ logger_1.logger.debug('Entering to the deleteDAMSchema function');
751
+ const axiosConfig = {
752
+ method: constants_1.DELETE,
753
+ url: `${damURL}/schemas/${schemaVersion}`,
754
+ headers: { Cookie: cookie },
755
+ };
756
+ logger_1.logger.debug('DAM axiosConfig - %o', axiosConfig);
757
+ const response = yield requestService_1.requestService.axiosService(axiosConfig);
758
+ if (!response) {
759
+ logger_1.logger.debug('Response is undefined');
760
+ throw new Error(utils_1.errorMessage('ERROR_DAMAPI_RESPONSE_UNDEFINED'));
761
+ }
762
+ logger_1.logger.debug('deleteDAMSchema Response : %o', response);
763
+ switch (response.status) {
764
+ case constants_1.HttpStatus.UNAUTHORIZED: {
765
+ logger_1.logger.debug(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
766
+ throw new Error(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
767
+ }
768
+ case constants_1.HttpStatus.NO_CONTENT: {
769
+ logger_1.logger.info(utils_1.message('DAM_SCHEMA_DELETE_SUCCESS'));
770
+ return true;
771
+ }
772
+ case constants_1.HttpStatus.NOT_FOUND: {
773
+ if (!response.data.error) {
774
+ logger_1.logger.debug('Please enter a valid damAPIVersion');
775
+ throw new Error(utils_1.errorMessage('ERROR_DAMAPI_VERSION'));
776
+ }
777
+ else {
778
+ logger_1.logger.debug('Please provide a valid schema version');
779
+ throw new Error(utils_1.errorMessage('ERROR_SCHEMA_NOT_FOUND', { 0: schemaVersion }));
780
+ }
781
+ }
782
+ case constants_1.HttpStatus.FORBIDDEN: {
783
+ logger_1.logger.debug('Access denied for selected schema');
784
+ throw new Error(utils_1.errorMessage('ERROR_ACCESS_DENIED'));
785
+ }
786
+ case constants_1.HttpStatus.CONFLICT: {
787
+ logger_1.logger.debug('You are not allowed to delete an active schema');
788
+ throw new Error(utils_1.errorMessage('ERROR_ACTIVE_SCHEMA_NOT_DELETE'));
789
+ }
790
+ case constants_1.HttpStatus.INTERNAL_SERVER_ERROR: {
791
+ logger_1.logger.debug('Failed to delete schema');
792
+ throw new Error(utils_1.errorMessage('ERROR_FAILED_SCHEMA_DELETE'));
793
+ }
794
+ default:
795
+ logger_1.logger.debug('Exception while deleting DAM Schema : failed');
796
+ return false;
797
+ }
798
+ });
799
+ const loginWithRingAPI = (dxUsername, dxPassword, ringAPIURL) => __awaiter(void 0, void 0, void 0, function* () {
800
+ logger_1.logger.debug('login to DX with DXCore API URL: %s', ringAPIURL);
801
+ const axiosRequestConfig = {
802
+ method: constants_1.POST,
803
+ url: `${ringAPIURL}/auth/login`,
804
+ data: {
805
+ username: dxUsername,
806
+ password: dxPassword,
807
+ },
808
+ };
809
+ const logAxiosRequestConfig = Object.assign(Object.assign({}, axiosRequestConfig), { data: Object.assign(Object.assign({}, axiosRequestConfig.data), { password: MaskData.maskPassword(dxPassword) }) });
810
+ logger_1.logger.debug('Request configuration for login to DX - %s', JSON.stringify(logAxiosRequestConfig));
811
+ const response = yield requestService_1.requestService.axiosService(axiosRequestConfig);
812
+ if (!response) {
813
+ logger_1.logger.debug('Please ensure that the values for dxProtocol, hostname and dxPort are valid.');
814
+ throw new Error(utils_1.errorMessage('ERROR_RINGAPI_RESPONSE_UNDEFINED'));
815
+ }
816
+ switch (response.status) {
817
+ case constants_1.HttpStatus.SUCCESS: {
818
+ logger_1.logger.debug('loginWithRingAPI response : %s', response.data.message);
819
+ return response.headers['set-cookie'][0];
820
+ }
821
+ case constants_1.HttpStatus.UNAUTHORIZED: {
822
+ logger_1.logger.debug(utils_1.errorMessage('ERROR_LOGIN_AUTHORISATION', {}, true));
823
+ throw new Error(utils_1.errorMessage('ERROR_LOGIN_AUTHORISATION', {}, true));
824
+ }
825
+ case constants_1.HttpStatus.NOT_FOUND: {
826
+ logger_1.logger.debug(utils_1.errorMessage('ERROR_RINGAPI_VERSION'));
827
+ throw new Error(utils_1.errorMessage('ERROR_RINGAPI_VERSION'));
828
+ }
829
+ default:
830
+ logger_1.logger.debug('Delete dam schema error response %s', JSON.stringify(response.data));
831
+ throw new Error(utils_1.errorMessage('ERROR_DELETE_SCHEMA_RESPONSE', { 0: response.statusText }));
832
+ }
833
+ });
834
+ const startApplication = (startApplicationURL, dxSoapPort, credObj, appName, dxProfileName, dxProfilePath, startAppDetails) => __awaiter(void 0, void 0, void 0, function* () {
835
+ logger_1.logger.debug('Entering the start deployApplication function.');
836
+ logger_1.logger.debug('DX Soap Port %s ', dxSoapPort);
837
+ logger_1.logger.debug('DX Profile Name %s ', dxProfileName);
838
+ logger_1.logger.debug('DX Profile Path %s ', dxProfilePath);
839
+ logger_1.logger.debug('Application Name %s ', appName);
840
+ logger_1.logger.debug('Start Application Details %s ', startAppDetails);
841
+ let startApprResp = false;
842
+ const jsonData = {
843
+ soapPort: dxSoapPort,
844
+ applicationName: appName,
845
+ startAppDetails,
846
+ };
847
+ if (dxProfileName) {
848
+ jsonData.DXCoreProfileName = dxProfileName;
849
+ }
850
+ else if (dxProfilePath) {
851
+ jsonData.DXCoreProfilePath = dxProfilePath;
852
+ }
853
+ try {
854
+ const axiosConfig = {
855
+ method: 'POST',
856
+ url: startApplicationURL,
857
+ data: jsonData,
858
+ headers: {
859
+ 'Content-Type': constants_1.CONTENT_TYPE.applicationJson,
860
+ Authorization: utils_1.baseEncode(credObj.dxConnectUsername, credObj.dxConnectPassword),
861
+ DXAuth: utils_1.baseEncode(credObj.dxUsername, credObj.dxPassword),
862
+ },
863
+ };
864
+ logger_1.logger.debug('Start Manage Application request: %s', JSON.stringify(axiosConfig));
865
+ const response = yield requestService_1.requestService.axiosService(axiosConfig);
866
+ logger_1.logger.debug('Exiting the start manageApplication function');
867
+ if (!response) {
868
+ logger_1.logger.debug('Response is undefined');
869
+ throw new Error(utils_1.errorMessage('ERROR_RESPONSE_UNDEFINED', {}, true));
870
+ }
871
+ if (response.status === constants_1.HttpStatus.UNAUTHORIZED) {
872
+ logger_1.logger.info(utils_1.errorMessage('ERROR_UNAUTHORIZED', {}, true));
873
+ }
874
+ else if (response.status === constants_1.HttpStatus.SUCCESS) {
875
+ logger_1.logger.info(response.data.message);
876
+ startApprResp = true;
877
+ }
878
+ return startApprResp;
879
+ }
880
+ catch (error) {
881
+ logger_1.logger.debug('Exception in the manageApplication %o', error.response.data);
882
+ return error.response;
883
+ }
884
+ });
885
+ const fetchDXCoreVersion = (credObj, baseDxURL) => __awaiter(void 0, void 0, void 0, function* () {
886
+ const dxVersionUrl = `${baseDxURL}${constants_1.URL_PARAMS.version}`;
887
+ logger_1.logger.debug('login to DX with base URL: %s', baseDxURL);
888
+ const axiosRequestConfig = {
889
+ method: constants_1.GET,
890
+ url: `${dxVersionUrl}`,
891
+ headers: {
892
+ 'Content-Type': constants_1.CONTENT_TYPE.applicationJson,
893
+ Authorization: utils_1.baseEncode(credObj.dxConnectUsername, credObj.dxConnectPassword),
894
+ },
895
+ };
896
+ logger_1.logger.debug('Request configuration for login to DX - %s', JSON.stringify(axiosRequestConfig));
897
+ const response = yield requestService_1.requestService.axiosService(axiosRequestConfig);
898
+ if (!response) {
899
+ logger_1.logger.debug('Please ensure that the values for dxProtocol, hostname and dxPort are valid.');
900
+ throw new Error(utils_1.errorMessage('ERROR_RESPONSE_UNDEFINED', {}, true));
901
+ }
902
+ if (response.status === constants_1.HttpStatus.SUCCESS) {
903
+ logger_1.logger.debug('DX Core Version is %s', response.data.version);
904
+ return response.data.version;
905
+ }
906
+ if (response.status === constants_1.HttpStatus.UNAUTHORIZED) {
907
+ logger_1.logger.debug('Login failed due to authorisation failure.');
908
+ throw new Error(utils_1.errorMessage('ERROR_LOGIN_AUTHORISATION', {}, true));
909
+ }
910
+ logger_1.logger.debug('Response from DX server: %o', response);
911
+ throw response.statusText;
912
+ });
913
+ exports.apiServices = {
914
+ uploadFileToServer,
915
+ deleteFileFromServer,
916
+ executeXmlAccess,
917
+ manageApplication,
918
+ downloadApplication,
919
+ getWebContentIds,
920
+ getMultilingualTranslationsData,
921
+ importMultilingualTranslationsData,
922
+ getWCMLibraryIdFromName,
923
+ getWCMProjectIdFromName,
924
+ validateContentImport,
925
+ listDAMSchema,
926
+ deleteDAMSchema,
927
+ loginWithRingAPI,
928
+ login,
929
+ startApplication,
930
+ fetchDXCoreVersion,
931
+ };
932
+ //# sourceMappingURL=apiServices.js.map