@hcl-software/dxclient 227.0.0 → 229.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 (331) hide show
  1. package/README.md +4 -0
  2. package/dist/configuration/config.json +1 -0
  3. package/dist/package.json +11 -11
  4. package/dist/packages/admintasks/package-lock.json +8622 -15410
  5. package/dist/packages/admintasks/package.json +10 -6
  6. package/dist/packages/admintasks/src/commands/createCredentialVault.d.ts +2 -2
  7. package/dist/packages/admintasks/src/commands/createCredentialVault.js +61 -74
  8. package/dist/packages/admintasks/src/commands/createCredentialVault.js.map +1 -1
  9. package/dist/packages/admintasks/src/commands/createSyndicationRelation.d.ts +1 -1
  10. package/dist/packages/admintasks/src/commands/createSyndicationRelation.js +38 -49
  11. package/dist/packages/admintasks/src/commands/createSyndicationRelation.js.map +1 -1
  12. package/dist/packages/admintasks/src/commands/createVirtualPortal.d.ts +1 -1
  13. package/dist/packages/admintasks/src/commands/createVirtualPortal.js +33 -44
  14. package/dist/packages/admintasks/src/commands/createVirtualPortal.js.map +1 -1
  15. package/dist/packages/admintasks/src/commands/differentialReport.d.ts +1 -1
  16. package/dist/packages/admintasks/src/commands/differentialReport.js +107 -106
  17. package/dist/packages/admintasks/src/commands/differentialReport.js.map +1 -1
  18. package/dist/packages/admintasks/src/commands/exportVirtualPortal.d.ts +1 -1
  19. package/dist/packages/admintasks/src/commands/exportVirtualPortal.js +35 -46
  20. package/dist/packages/admintasks/src/commands/exportVirtualPortal.js.map +1 -1
  21. package/dist/packages/admintasks/src/commands/exportWCMLibrary.d.ts +1 -1
  22. package/dist/packages/admintasks/src/commands/exportWCMLibrary.js +104 -101
  23. package/dist/packages/admintasks/src/commands/exportWCMLibrary.js.map +1 -1
  24. package/dist/packages/admintasks/src/commands/importVirtualPortal.d.ts +1 -1
  25. package/dist/packages/admintasks/src/commands/importVirtualPortal.js +36 -47
  26. package/dist/packages/admintasks/src/commands/importVirtualPortal.js.map +1 -1
  27. package/dist/packages/admintasks/src/commands/importWCMLibrary.d.ts +1 -1
  28. package/dist/packages/admintasks/src/commands/importWCMLibrary.js +85 -82
  29. package/dist/packages/admintasks/src/commands/importWCMLibrary.js.map +1 -1
  30. package/dist/packages/admintasks/src/commands/listVirtualPortals.d.ts +1 -1
  31. package/dist/packages/admintasks/src/commands/listVirtualPortals.js +26 -37
  32. package/dist/packages/admintasks/src/commands/listVirtualPortals.js.map +1 -1
  33. package/dist/packages/admintasks/src/commands/pznRulesExport.d.ts +1 -1
  34. package/dist/packages/admintasks/src/commands/pznRulesExport.js +52 -63
  35. package/dist/packages/admintasks/src/commands/pznRulesExport.js.map +1 -1
  36. package/dist/packages/admintasks/src/commands/pznRulesImport.d.ts +1 -1
  37. package/dist/packages/admintasks/src/commands/pznRulesImport.js +103 -100
  38. package/dist/packages/admintasks/src/commands/pznRulesImport.js.map +1 -1
  39. package/dist/packages/admintasks/src/commands/resEnvProviderActions.d.ts +1 -1
  40. package/dist/packages/admintasks/src/commands/resEnvProviderActions.js +133 -130
  41. package/dist/packages/admintasks/src/commands/resEnvProviderActions.js.map +1 -1
  42. package/dist/packages/admintasks/src/commands/restartCorePods.d.ts +1 -1
  43. package/dist/packages/admintasks/src/commands/restartCorePods.js +19 -30
  44. package/dist/packages/admintasks/src/commands/restartCorePods.js.map +1 -1
  45. package/dist/packages/admintasks/src/commands/restartDXCore.d.ts +1 -1
  46. package/dist/packages/admintasks/src/commands/restartDXCore.js +52 -50
  47. package/dist/packages/admintasks/src/commands/restartDXCore.js.map +1 -1
  48. package/dist/packages/admintasks/src/errors/CommandLineMessages_en.json +1 -1
  49. package/dist/packages/admintasks/src/services/createSyndicationRelationServices.js +6 -15
  50. package/dist/packages/admintasks/src/services/createSyndicationRelationServices.js.map +1 -1
  51. package/dist/packages/admintasks/src/services/differentialReportService.js +8 -17
  52. package/dist/packages/admintasks/src/services/differentialReportService.js.map +1 -1
  53. package/dist/packages/admintasks/src/services/resEnvProviderService.js +54 -64
  54. package/dist/packages/admintasks/src/services/resEnvProviderService.js.map +1 -1
  55. package/dist/packages/admintasks/src/services/restartCorePodsService.js +7 -16
  56. package/dist/packages/admintasks/src/services/restartCorePodsService.js.map +1 -1
  57. package/dist/packages/admintasks/src/services/restartDXCoreService.js +15 -24
  58. package/dist/packages/admintasks/src/services/restartDXCoreService.js.map +1 -1
  59. package/dist/packages/admintasks/src/services/virtualPortalServices.js +40 -49
  60. package/dist/packages/admintasks/src/services/virtualPortalServices.js.map +1 -1
  61. package/dist/packages/admintasks/src/utils/differential-report-utils.js +1042 -1055
  62. package/dist/packages/admintasks/src/utils/differential-report-utils.js.map +1 -1
  63. package/dist/packages/dam/package-lock.json +3013 -6449
  64. package/dist/packages/dam/package.json +11 -7
  65. package/dist/packages/dam/src/commands/createSecrets.d.ts +1 -1
  66. package/dist/packages/dam/src/commands/createSecrets.js +38 -45
  67. package/dist/packages/dam/src/commands/createSecrets.js.map +1 -1
  68. package/dist/packages/dam/src/commands/deleteDAMStagingMismatch.d.ts +1 -1
  69. package/dist/packages/dam/src/commands/deleteDAMStagingMismatch.js +22 -33
  70. package/dist/packages/dam/src/commands/deleteDAMStagingMismatch.js.map +1 -1
  71. package/dist/packages/dam/src/commands/deleteSchema.d.ts +1 -1
  72. package/dist/packages/dam/src/commands/deleteSchema.js +48 -59
  73. package/dist/packages/dam/src/commands/deleteSchema.js.map +1 -1
  74. package/dist/packages/dam/src/commands/exportAssets.d.ts +1 -1
  75. package/dist/packages/dam/src/commands/exportAssets.js +58 -69
  76. package/dist/packages/dam/src/commands/exportAssets.js.map +1 -1
  77. package/dist/packages/dam/src/commands/findDAMStagingMismatch.d.ts +1 -1
  78. package/dist/packages/dam/src/commands/findDAMStagingMismatch.js +25 -36
  79. package/dist/packages/dam/src/commands/findDAMStagingMismatch.js.map +1 -1
  80. package/dist/packages/dam/src/commands/importAssets.d.ts +1 -1
  81. package/dist/packages/dam/src/commands/importAssets.js +38 -49
  82. package/dist/packages/dam/src/commands/importAssets.js.map +1 -1
  83. package/dist/packages/dam/src/commands/listSchema.d.ts +1 -1
  84. package/dist/packages/dam/src/commands/listSchema.js +19 -30
  85. package/dist/packages/dam/src/commands/listSchema.js.map +1 -1
  86. package/dist/packages/dam/src/commands/stagingMismatchReport.d.ts +1 -1
  87. package/dist/packages/dam/src/commands/stagingMismatchReport.js +79 -76
  88. package/dist/packages/dam/src/commands/stagingMismatchReport.js.map +1 -1
  89. package/dist/packages/dam/src/commands/stagingResync.d.ts +1 -1
  90. package/dist/packages/dam/src/commands/stagingResync.js +25 -36
  91. package/dist/packages/dam/src/commands/stagingResync.js.map +1 -1
  92. package/dist/packages/dam/src/commands/subscriberDeRegistration.d.ts +1 -1
  93. package/dist/packages/dam/src/commands/subscriberDeRegistration.js +19 -30
  94. package/dist/packages/dam/src/commands/subscriberDeRegistration.js.map +1 -1
  95. package/dist/packages/dam/src/commands/subscriberDetails.d.ts +1 -1
  96. package/dist/packages/dam/src/commands/subscriberDetails.js +24 -35
  97. package/dist/packages/dam/src/commands/subscriberDetails.js.map +1 -1
  98. package/dist/packages/dam/src/commands/subscriberRegistration.d.ts +1 -1
  99. package/dist/packages/dam/src/commands/subscriberRegistration.js +34 -45
  100. package/dist/packages/dam/src/commands/subscriberRegistration.js.map +1 -1
  101. package/dist/packages/dam/src/commands/triggerDAMStaging.d.ts +1 -1
  102. package/dist/packages/dam/src/commands/triggerDAMStaging.js +19 -30
  103. package/dist/packages/dam/src/commands/triggerDAMStaging.js.map +1 -1
  104. package/dist/packages/dam/src/commands/triggerDamReindexing.d.ts +1 -1
  105. package/dist/packages/dam/src/commands/triggerDamReindexing.js +26 -38
  106. package/dist/packages/dam/src/commands/triggerDamReindexing.js.map +1 -1
  107. package/dist/packages/dam/src/commands/updateSecrets.d.ts +1 -1
  108. package/dist/packages/dam/src/commands/updateSecrets.js +36 -47
  109. package/dist/packages/dam/src/commands/updateSecrets.js.map +1 -1
  110. package/dist/packages/dam/src/commands/validateAssets.d.ts +1 -1
  111. package/dist/packages/dam/src/commands/validateAssets.js +29 -40
  112. package/dist/packages/dam/src/commands/validateAssets.js.map +1 -1
  113. package/dist/packages/dam/src/export/collection.d.ts +8 -8
  114. package/dist/packages/dam/src/export/collection.js +71 -80
  115. package/dist/packages/dam/src/export/collection.js.map +1 -1
  116. package/dist/packages/dam/src/export/favorite.d.ts +1 -1
  117. package/dist/packages/dam/src/export/favorite.js +10 -19
  118. package/dist/packages/dam/src/export/favorite.js.map +1 -1
  119. package/dist/packages/dam/src/export/media-item.d.ts +4 -4
  120. package/dist/packages/dam/src/export/media-item.js +61 -56
  121. package/dist/packages/dam/src/export/media-item.js.map +1 -1
  122. package/dist/packages/dam/src/export/media-type-group.d.ts +1 -1
  123. package/dist/packages/dam/src/export/media-type-group.js +7 -16
  124. package/dist/packages/dam/src/export/media-type-group.js.map +1 -1
  125. package/dist/packages/dam/src/export/media-type.d.ts +1 -1
  126. package/dist/packages/dam/src/export/media-type.js +7 -16
  127. package/dist/packages/dam/src/export/media-type.js.map +1 -1
  128. package/dist/packages/dam/src/export/renditions.d.ts +6 -6
  129. package/dist/packages/dam/src/export/renditions.js +78 -73
  130. package/dist/packages/dam/src/export/renditions.js.map +1 -1
  131. package/dist/packages/dam/src/import/collection.d.ts +3 -3
  132. package/dist/packages/dam/src/import/collection.js +26 -35
  133. package/dist/packages/dam/src/import/collection.js.map +1 -1
  134. package/dist/packages/dam/src/import/favorite.d.ts +1 -1
  135. package/dist/packages/dam/src/import/favorite.js +8 -17
  136. package/dist/packages/dam/src/import/favorite.js.map +1 -1
  137. package/dist/packages/dam/src/import/media-items.d.ts +3 -3
  138. package/dist/packages/dam/src/import/media-items.js +46 -41
  139. package/dist/packages/dam/src/import/media-items.js.map +1 -1
  140. package/dist/packages/dam/src/import/media-type-group.d.ts +1 -1
  141. package/dist/packages/dam/src/import/media-type-group.js +13 -22
  142. package/dist/packages/dam/src/import/media-type-group.js.map +1 -1
  143. package/dist/packages/dam/src/import/media-type.d.ts +1 -1
  144. package/dist/packages/dam/src/import/media-type.js +12 -21
  145. package/dist/packages/dam/src/import/media-type.js.map +1 -1
  146. package/dist/packages/dam/src/import/permission.d.ts +3 -3
  147. package/dist/packages/dam/src/import/permission.js +21 -30
  148. package/dist/packages/dam/src/import/permission.js.map +1 -1
  149. package/dist/packages/dam/src/import/renditions.d.ts +6 -6
  150. package/dist/packages/dam/src/import/renditions.js +69 -64
  151. package/dist/packages/dam/src/import/renditions.js.map +1 -1
  152. package/dist/packages/dam/src/services/authService.d.ts +1 -1
  153. package/dist/packages/dam/src/services/authService.js +9 -18
  154. package/dist/packages/dam/src/services/authService.js.map +1 -1
  155. package/dist/packages/dam/src/services/stagingService.js +76 -85
  156. package/dist/packages/dam/src/services/stagingService.js.map +1 -1
  157. package/dist/packages/dam/src/services/tokenCache.d.ts +1 -1
  158. package/dist/packages/dam/src/services/tokenCache.js +30 -41
  159. package/dist/packages/dam/src/services/tokenCache.js.map +1 -1
  160. package/dist/packages/dam/src/utils/constants.js +3 -3
  161. package/dist/packages/dam/src/utils/constants.js.map +1 -1
  162. package/dist/packages/dam/src/utils/service.js +59 -70
  163. package/dist/packages/dam/src/utils/service.js.map +1 -1
  164. package/dist/packages/dam/src/validation/collection-list-validate.js +26 -35
  165. package/dist/packages/dam/src/validation/collection-list-validate.js.map +1 -1
  166. package/dist/packages/dam/src/validation/media-list-validate.js +44 -39
  167. package/dist/packages/dam/src/validation/media-list-validate.js.map +1 -1
  168. package/dist/packages/dam/src/validation/media-type-group-validate.js +5 -14
  169. package/dist/packages/dam/src/validation/media-type-group-validate.js.map +1 -1
  170. package/dist/packages/dam/src/validation/media-type-validate.js +5 -14
  171. package/dist/packages/dam/src/validation/media-type-validate.js.map +1 -1
  172. package/dist/packages/dam/src/validation/root-validate.js +10 -19
  173. package/dist/packages/dam/src/validation/root-validate.js.map +1 -1
  174. package/dist/packages/dam/src/validation/validate.rendition.js +17 -26
  175. package/dist/packages/dam/src/validation/validate.rendition.js.map +1 -1
  176. package/dist/packages/dam/src/validation/validate.versions.js +16 -25
  177. package/dist/packages/dam/src/validation/validate.versions.js.map +1 -1
  178. package/dist/packages/deployportlet/package-lock.json +9970 -12728
  179. package/dist/packages/deployportlet/package.json +20 -6
  180. package/dist/packages/deployportlet/src/commands/deployPortlet.d.ts +1 -1
  181. package/dist/packages/deployportlet/src/commands/deployPortlet.js +65 -62
  182. package/dist/packages/deployportlet/src/commands/deployPortlet.js.map +1 -1
  183. package/dist/packages/deployportlet/src/commands/undeployPortlet.d.ts +1 -1
  184. package/dist/packages/deployportlet/src/commands/undeployPortlet.js +80 -77
  185. package/dist/packages/deployportlet/src/commands/undeployPortlet.js.map +1 -1
  186. package/dist/packages/deployportlet/src/commands/xmlaccess.d.ts +1 -1
  187. package/dist/packages/deployportlet/src/commands/xmlaccess.js +14 -25
  188. package/dist/packages/deployportlet/src/commands/xmlaccess.js.map +1 -1
  189. package/dist/packages/deployportlet/src/services/undeployPortletServices.js +34 -43
  190. package/dist/packages/deployportlet/src/services/undeployPortletServices.js.map +1 -1
  191. package/dist/packages/deployscriptapplication/package-lock.json +6395 -12760
  192. package/dist/packages/deployscriptapplication/package.json +11 -4
  193. package/dist/packages/deployscriptapplication/src/commands/pull.d.ts +1 -2
  194. package/dist/packages/deployscriptapplication/src/commands/pull.js +146 -159
  195. package/dist/packages/deployscriptapplication/src/commands/pull.js.map +1 -1
  196. package/dist/packages/deployscriptapplication/src/commands/push.d.ts +3 -3
  197. package/dist/packages/deployscriptapplication/src/commands/push.js +149 -157
  198. package/dist/packages/deployscriptapplication/src/commands/push.js.map +1 -1
  199. package/dist/packages/deployscriptapplication/src/commands/restoreScriptApplication.d.ts +2 -2
  200. package/dist/packages/deployscriptapplication/src/commands/restoreScriptApplication.js +88 -101
  201. package/dist/packages/deployscriptapplication/src/commands/restoreScriptApplication.js.map +1 -1
  202. package/dist/packages/deployscriptapplication/src/commands/undeployScriptApplication.d.ts +2 -2
  203. package/dist/packages/deployscriptapplication/src/commands/undeployScriptApplication.js +118 -131
  204. package/dist/packages/deployscriptapplication/src/commands/undeployScriptApplication.js.map +1 -1
  205. package/dist/packages/deployscriptapplication/src/util/constants.js.map +1 -1
  206. package/dist/packages/deployscriptapplication/src/util/generic.js.map +1 -1
  207. package/dist/packages/deploytheme/package-lock.json +7190 -13434
  208. package/dist/packages/deploytheme/package.json +9 -6
  209. package/dist/packages/deploytheme/src/commands/deployApplication.d.ts +1 -1
  210. package/dist/packages/deploytheme/src/commands/deployApplication.js +87 -84
  211. package/dist/packages/deploytheme/src/commands/deployApplication.js.map +1 -1
  212. package/dist/packages/deploytheme/src/commands/deployTheme.d.ts +4 -4
  213. package/dist/packages/deploytheme/src/commands/deployTheme.js +223 -226
  214. package/dist/packages/deploytheme/src/commands/deployTheme.js.map +1 -1
  215. package/dist/packages/deploytheme/src/commands/undeployApplication.d.ts +1 -1
  216. package/dist/packages/deploytheme/src/commands/undeployApplication.js +21 -32
  217. package/dist/packages/deploytheme/src/commands/undeployApplication.js.map +1 -1
  218. package/dist/packages/deploytheme/src/commands/undeployTheme.d.ts +4 -4
  219. package/dist/packages/deploytheme/src/commands/undeployTheme.js +214 -223
  220. package/dist/packages/deploytheme/src/commands/undeployTheme.js.map +1 -1
  221. package/dist/packages/deploytheme/src/services/themeServices.js +84 -90
  222. package/dist/packages/deploytheme/src/services/themeServices.js.map +1 -1
  223. package/dist/packages/livesync/package-lock.json +2202 -3754
  224. package/dist/packages/livesync/package.json +9 -5
  225. package/dist/packages/livesync/src/commands/pullTheme.d.ts +2 -2
  226. package/dist/packages/livesync/src/commands/pullTheme.js +62 -75
  227. package/dist/packages/livesync/src/commands/pullTheme.js.map +1 -1
  228. package/dist/packages/livesync/src/commands/pullWcmDesignLibrary.d.ts +2 -1
  229. package/dist/packages/livesync/src/commands/pullWcmDesignLibrary.js +255 -288
  230. package/dist/packages/livesync/src/commands/pullWcmDesignLibrary.js.map +1 -1
  231. package/dist/packages/livesync/src/commands/pushTheme.d.ts +4 -4
  232. package/dist/packages/livesync/src/commands/pushTheme.js +125 -140
  233. package/dist/packages/livesync/src/commands/pushTheme.js.map +1 -1
  234. package/dist/packages/livesync/src/commands/pushWcmDesignLibrary.d.ts +2 -2
  235. package/dist/packages/livesync/src/commands/pushWcmDesignLibrary.js +545 -548
  236. package/dist/packages/livesync/src/commands/pushWcmDesignLibrary.js.map +1 -1
  237. package/dist/packages/livesync/src/errors/CommandLineMessages_en.json +15 -11
  238. package/dist/packages/livesync/src/messages/messages_en.json +1 -0
  239. package/dist/packages/livesync/src/services/EventsQueue.js +11 -24
  240. package/dist/packages/livesync/src/services/EventsQueue.js.map +1 -1
  241. package/dist/packages/livesync/src/services/foldersWcmServices.js +21 -30
  242. package/dist/packages/livesync/src/services/foldersWcmServices.js.map +1 -1
  243. package/dist/packages/livesync/src/services/htmlComponentWcmServices.js +19 -28
  244. package/dist/packages/livesync/src/services/htmlComponentWcmServices.js.map +1 -1
  245. package/dist/packages/livesync/src/services/initialSyncServices.js +65 -81
  246. package/dist/packages/livesync/src/services/initialSyncServices.js.map +1 -1
  247. package/dist/packages/livesync/src/services/livesyncUtils.js +54 -49
  248. package/dist/packages/livesync/src/services/livesyncUtils.js.map +1 -1
  249. package/dist/packages/livesync/src/services/metadataServices.js +113 -77
  250. package/dist/packages/livesync/src/services/metadataServices.js.map +1 -1
  251. package/dist/packages/livesync/src/services/ongoingSyncServices.js +192 -176
  252. package/dist/packages/livesync/src/services/ongoingSyncServices.js.map +1 -1
  253. package/dist/packages/livesync/src/services/presentationTemplateWcmServices.js +19 -28
  254. package/dist/packages/livesync/src/services/presentationTemplateWcmServices.js.map +1 -1
  255. package/dist/packages/livesync/src/services/styleSheetComponentWcmServices.js +18 -27
  256. package/dist/packages/livesync/src/services/styleSheetComponentWcmServices.js.map +1 -1
  257. package/dist/packages/livesync/src/services/wcmContext/initialSync.js +29 -23
  258. package/dist/packages/livesync/src/services/wcmContext/initialSync.js.map +1 -1
  259. package/dist/packages/livesync/src/services/wcmContext/stylesheetComponent.js +221 -206
  260. package/dist/packages/livesync/src/services/wcmContext/stylesheetComponent.js.map +1 -1
  261. package/dist/packages/livesync/src/services/wcmContext/wcmLibraryContext.js +4 -4
  262. package/dist/packages/livesync/src/services/wcmContext/wcmLibraryContext.js.map +1 -1
  263. package/dist/packages/livesync/src/services/wcmRestV2Services.js +20 -26
  264. package/dist/packages/livesync/src/services/wcmRestV2Services.js.map +1 -1
  265. package/dist/packages/livesync/src/types/EventHandler.type.d.ts +1 -1
  266. package/dist/packages/livesync/src/types/EventQueueItem.type.d.ts +2 -2
  267. package/dist/packages/livesync/src/types/OngoingSyncHooks.type.d.ts +1 -1
  268. package/dist/packages/livesync/src/types/WCMDesignLibraryCache.type.d.ts +1 -1
  269. package/dist/packages/livesync/src/types/WcmRestApiV2.type.d.ts +8 -8
  270. package/dist/packages/livesync/src/types/index.d.ts +6 -0
  271. package/dist/packages/livesync/src/types/index.js +5 -1
  272. package/dist/packages/livesync/src/types/index.js.map +1 -1
  273. package/dist/packages/mls_exim/package-lock.json +2908 -5990
  274. package/dist/packages/mls_exim/package.json +10 -6
  275. package/dist/packages/mls_exim/src/errors/CommandLineMessages_en.json +1 -0
  276. package/dist/packages/mls_exim/src/export/mlsExport.d.ts +2 -2
  277. package/dist/packages/mls_exim/src/export/mlsExport.js +81 -78
  278. package/dist/packages/mls_exim/src/export/mlsExport.js.map +1 -1
  279. package/dist/packages/mls_exim/src/export/mlsExport.ts +9 -9
  280. package/dist/packages/mls_exim/src/import/mlsImport.d.ts +1 -1
  281. package/dist/packages/mls_exim/src/import/mlsImport.js +38 -46
  282. package/dist/packages/mls_exim/src/import/mlsImport.js.map +1 -1
  283. package/dist/packages/mls_exim/src/import/mlsImport.ts +9 -4
  284. package/dist/packages/sharedlibrary/package-lock.json +6221 -12629
  285. package/dist/packages/sharedlibrary/package.json +9 -6
  286. package/dist/packages/sharedlibrary/src/commands/delete.d.ts +1 -1
  287. package/dist/packages/sharedlibrary/src/commands/delete.js +40 -37
  288. package/dist/packages/sharedlibrary/src/commands/delete.js.map +1 -1
  289. package/dist/packages/sharedlibrary/src/commands/upload.d.ts +1 -1
  290. package/dist/packages/sharedlibrary/src/commands/upload.js +73 -70
  291. package/dist/packages/sharedlibrary/src/commands/upload.js.map +1 -1
  292. package/dist/packages/sharedlibrary/src/errors/CommandLineMessages_en.json +1 -0
  293. package/dist/packages/sharedlibrary/src/services/sharedLibraryServices.js +29 -30
  294. package/dist/packages/sharedlibrary/src/services/sharedLibraryServices.js.map +1 -1
  295. package/dist/packages/syndication/package-lock.json +9970 -12728
  296. package/dist/packages/syndication/package.json +21 -7
  297. package/dist/packages/syndication/src/commands/subscriber.d.ts +1 -1
  298. package/dist/packages/syndication/src/commands/subscriber.js +33 -44
  299. package/dist/packages/syndication/src/commands/subscriber.js.map +1 -1
  300. package/dist/packages/syndication/src/commands/syndicator.d.ts +1 -1
  301. package/dist/packages/syndication/src/commands/syndicator.js +33 -44
  302. package/dist/packages/syndication/src/commands/syndicator.js.map +1 -1
  303. package/dist/packages/syndication/src/commands/syndicatorFailedItem.d.ts +1 -1
  304. package/dist/packages/syndication/src/commands/syndicatorFailedItem.js +67 -78
  305. package/dist/packages/syndication/src/commands/syndicatorFailedItem.js.map +1 -1
  306. package/dist/packages/syndication/src/services/syndicationService.d.ts +8 -8
  307. package/dist/packages/syndication/src/services/syndicationService.js +39 -48
  308. package/dist/packages/syndication/src/services/syndicationService.js.map +1 -1
  309. package/dist/src/errors/CommandLineMessages_en.json +3 -1
  310. package/dist/src/index.js +939 -959
  311. package/dist/src/index.js.map +1 -1
  312. package/dist/src/services/apiServices.js +187 -178
  313. package/dist/src/services/apiServices.js.map +1 -1
  314. package/dist/src/services/filesServices.d.ts +0 -1
  315. package/dist/src/services/filesServices.js +14 -23
  316. package/dist/src/services/filesServices.js.map +1 -1
  317. package/dist/src/services/requestService.js +16 -22
  318. package/dist/src/services/requestService.js.map +1 -1
  319. package/dist/src/utils/constants.d.ts +1 -1
  320. package/dist/src/utils/constants.js +59 -59
  321. package/dist/src/utils/constants.js.map +1 -1
  322. package/dist/src/utils/logger.d.ts +1 -0
  323. package/dist/src/utils/logger.js +58 -61
  324. package/dist/src/utils/logger.js.map +1 -1
  325. package/dist/src/utils/utils.d.ts +8 -6
  326. package/dist/src/utils/utils.js +139 -113
  327. package/dist/src/utils/utils.js.map +1 -1
  328. package/dist/src/utils/validateOptions.d.ts +3 -3
  329. package/dist/src/utils/validateOptions.js +354 -333
  330. package/dist/src/utils/validateOptions.js.map +1 -1
  331. package/package.json +11 -11
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -11,22 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
11
15
  }) : function(o, v) {
12
16
  o["default"] = v;
13
17
  });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
- return new (P || (P = Promise))(function (resolve, reject) {
24
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
- step((generator = generator.apply(thisArg, _arguments || [])).next());
28
- });
29
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
30
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
31
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
32
37
  };
@@ -57,552 +62,544 @@ class PushWcmDesignLibrary {
57
62
  this.maxRetryCount = 60;
58
63
  this.timeInterval = 1000;
59
64
  }
60
- invoke(cmdArgs) {
61
- return __awaiter(this, void 0, void 0, function* () {
62
- logger_1.logger.debug('Executing function Push WCM Design Library invoke');
65
+ async invoke(cmdArgs) {
66
+ logger_1.logger.debug('Executing function Push WCM Design Library invoke');
67
+ try {
68
+ logger_1.logger.debug('Executing the function Push HTML Components and folders of WCM Design Library');
69
+ let isSuccess = false;
70
+ let wcmLibraryId = '';
71
+ this.libraryPath = cmdArgs.wcmLibraryPath;
72
+ this.libraryMetaData = (0, metadataServices_1.getLibraryMetadata)(this.libraryPath);
73
+ let { wcmLibraryName } = cmdArgs;
74
+ this.apiOptions = {
75
+ dxProtocol: cmdArgs.dxProtocol,
76
+ hostname: cmdArgs.hostname,
77
+ dxPort: cmdArgs.dxPort,
78
+ contenthandlerPath: cmdArgs.contenthandlerPath,
79
+ dxUsername: cmdArgs.dxUsername,
80
+ dxPassword: cmdArgs.dxPassword,
81
+ virtualPortalContext: cmdArgs.virtualPortalContext,
82
+ wcmProjectName: cmdArgs.wcmProjectName,
83
+ };
84
+ const libraryDetails = (wcmLibraryName || (this.libraryMetaData && (this.libraryMetaData.title.value || this.libraryMetaData.title)));
85
+ wcmLibraryId = await (0, livesyncUtils_1.getLibraryId)(libraryDetails, this.apiOptions, 'push');
86
+ logger_1.logger.info((0, utils_1.message)(`Library ID: ${wcmLibraryId}`));
63
87
  try {
64
- logger_1.logger.debug('Executing the function Push HTML Components and folders of WCM Design Library');
65
- let isSuccess = false;
66
- let wcmLibraryId = '';
67
- this.libraryPath = cmdArgs.wcmLibraryPath;
68
- this.libraryMetaData = metadataServices_1.getLibraryMetadata(this.libraryPath);
69
- let { wcmLibraryName } = cmdArgs;
70
- this.apiOptions = {
71
- dxProtocol: cmdArgs.dxProtocol,
72
- hostname: cmdArgs.hostname,
73
- dxPort: cmdArgs.dxPort,
74
- contenthandlerPath: cmdArgs.contenthandlerPath,
75
- dxUsername: cmdArgs.dxUsername,
76
- dxPassword: cmdArgs.dxPassword,
77
- virtualPortalContext: cmdArgs.virtualPortalContext,
78
- wcmProjectName: cmdArgs.wcmProjectName,
79
- };
80
- const libraryDetails = (wcmLibraryName || (this.libraryMetaData && (this.libraryMetaData.title.value || this.libraryMetaData.title)));
81
- wcmLibraryId = yield livesyncUtils_1.getLibraryId(libraryDetails, this.apiOptions, 'push');
82
- logger_1.logger.info(utils_1.message(`Library ID: ${wcmLibraryId}`));
83
- try {
84
- logger_1.logger.info(utils_1.message('LIVESYNC_PUSH_WCM_INITIAL_START'));
85
- this.libraryMetaData = metadataServices_1.getLibraryMetadata(this.libraryPath);
86
- if (!this.libraryMetaData) {
87
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_NO_METADATA', { 0: this.libraryPath }));
88
- return false;
89
- }
90
- wcmLibraryName = this.libraryMetaData.name;
91
- PushWcmDesignLibrary.savedMetadata = metadataServices_1.loadMetadata(this.libraryPath);
92
- this.initialSync = new initialSync_1.InitialSync();
93
- isSuccess = yield this.pushAll(cmdArgs.wcmLibraryPath);
94
- yield this.initialSync.syncFiles();
95
- if (isSuccess && utils_1.isFeatureEnabled(constants_1.FeaturesEnum.LIVESYNC_WCM_DELETE)) {
96
- yield this.deleteFoldersAndFiles(cmdArgs.wcmLibraryPath);
97
- }
98
- PushWcmDesignLibrary.savedMetadata = metadataServices_1.loadMetadata(cmdArgs.wcmLibraryPath);
99
- logger_1.logger.info(utils_1.message('LIVESYNC_PUSH_WCM_INITIAL_END'));
100
- return new Promise((resolve) => {
101
- this.ongoingSync(cmdArgs, {
102
- onWatcherClose: (ongoingSyncSuccess) => __awaiter(this, void 0, void 0, function* () {
103
- if (!ongoingSyncSuccess) {
104
- logger_1.logger.error(utils_1.errorMessage('ERROR_WCM_DESIGN_LIBRARY_ONGOING_PUSH', { 0: wcmLibraryName }));
105
- resolve(false);
106
- }
107
- else {
108
- logger_1.logger.info(utils_1.message('LIVESYNC_PUSH_WCM_DESIGN_LIBRARY_END_SUCCESS'));
109
- resolve(true);
110
- }
111
- }),
112
- });
113
- });
88
+ logger_1.logger.info((0, utils_1.message)('LIVESYNC_PUSH_WCM_INITIAL_START'));
89
+ this.libraryMetaData = (0, metadataServices_1.getLibraryMetadata)(this.libraryPath);
90
+ if (!this.libraryMetaData) {
91
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_NO_METADATA', { 0: this.libraryPath }));
92
+ return false;
114
93
  }
115
- catch (error) {
116
- logger_1.logger.error(utils_1.errorMessage('ERROR_WCM_DESIGN_LIBRARY_PUSH_GENERIC', {
117
- 0: wcmLibraryName,
118
- 1: error.message,
119
- }));
120
- isSuccess = false;
94
+ wcmLibraryName = this.libraryMetaData.name;
95
+ PushWcmDesignLibrary.savedMetadata = (0, metadataServices_1.loadMetadata)(this.libraryPath);
96
+ this.initialSync = new initialSync_1.InitialSync();
97
+ isSuccess = await this.pushAll(cmdArgs.wcmLibraryPath);
98
+ await this.initialSync.syncFiles();
99
+ if (isSuccess && (0, utils_1.isFeatureEnabled)(constants_1.FeaturesEnum.LIVESYNC_WCM_DELETE)) {
100
+ await this.deleteFoldersAndFiles(cmdArgs.wcmLibraryPath);
121
101
  }
122
- return isSuccess;
102
+ PushWcmDesignLibrary.savedMetadata = (0, metadataServices_1.loadMetadata)(cmdArgs.wcmLibraryPath);
103
+ logger_1.logger.info((0, utils_1.message)('LIVESYNC_PUSH_WCM_INITIAL_END'));
104
+ return new Promise((resolve) => {
105
+ this.ongoingSync(cmdArgs, {
106
+ onWatcherClose: async (ongoingSyncSuccess) => {
107
+ if (!ongoingSyncSuccess) {
108
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_WCM_DESIGN_LIBRARY_ONGOING_PUSH', { 0: wcmLibraryName }));
109
+ resolve(false);
110
+ }
111
+ else {
112
+ logger_1.logger.info((0, utils_1.message)('LIVESYNC_PUSH_WCM_DESIGN_LIBRARY_END_SUCCESS'));
113
+ resolve(true);
114
+ }
115
+ },
116
+ });
117
+ });
123
118
  }
124
- catch (e) {
125
- logger_1.logger.error(utils_1.errorMessage('ERROR_WCM_DESIGN_LIBRARY_PUSH_GENERIC', { 0: cmdArgs.wcmLibraryName, 1: e }));
126
- return false;
119
+ catch (error) {
120
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_WCM_DESIGN_LIBRARY_PUSH_GENERIC', {
121
+ 0: wcmLibraryName,
122
+ 1: error.message,
123
+ }));
124
+ isSuccess = false;
127
125
  }
128
- });
126
+ return isSuccess;
127
+ }
128
+ catch (e) {
129
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_WCM_DESIGN_LIBRARY_PUSH_GENERIC', { 0: cmdArgs.wcmLibraryName, 1: e }));
130
+ return false;
131
+ }
129
132
  }
130
- deleteFoldersAndFiles(libraryPath) {
131
- return __awaiter(this, void 0, void 0, function* () {
132
- logger_1.logger.debug('Executing function Push WCM Design Library deleteFoldersAndFiles');
133
- const folderMetadataPath = path_1.join(libraryPath, '.library', 'Folder');
134
- const componentMetadataPath = path_1.join(libraryPath, '.library', 'LibraryHTMLComponent');
135
- const presentationTemplateMetadataPath = path_1.join(libraryPath, '.library', 'PresentationTemplate');
136
- const styleSheetMetadataPath = path_1.join(libraryPath, '.library', 'LibraryStyleSheetComponent');
137
- const folderMetadataCollection = fs_extra_1.readdirSync(folderMetadataPath);
138
- const deleteFolderJobs = folderMetadataCollection.map((file) => __awaiter(this, void 0, void 0, function* () {
139
- const filePath = path_1.join(folderMetadataPath, file);
140
- if (!fs_extra_1.existsSync(path_1.join(this.libraryPath, filePath)))
133
+ async deleteFoldersAndFiles(libraryPath) {
134
+ logger_1.logger.debug('Executing function Push WCM Design Library deleteFoldersAndFiles');
135
+ const folderMetadataPath = (0, path_1.join)(libraryPath, '.library', 'Folder');
136
+ const componentMetadataPath = (0, path_1.join)(libraryPath, '.library', 'LibraryHTMLComponent');
137
+ const presentationTemplateMetadataPath = (0, path_1.join)(libraryPath, '.library', 'PresentationTemplate');
138
+ const styleSheetMetadataPath = (0, path_1.join)(libraryPath, '.library', 'LibraryStyleSheetComponent');
139
+ const folderMetadataCollection = (0, fs_extra_1.readdirSync)(folderMetadataPath);
140
+ const deleteFolderJobs = folderMetadataCollection.map(async (file) => {
141
+ const filePath = (0, path_1.join)(folderMetadataPath, file);
142
+ if (!(0, fs_extra_1.existsSync)((0, path_1.join)(this.libraryPath, filePath)))
143
+ return;
144
+ const folderMeta = (0, fs_extra_1.readJSONSync)(filePath);
145
+ if (!(0, fs_extra_1.existsSync)((0, path_1.join)(this.libraryPath, folderMeta.localPath))) {
146
+ if (!(0, utils_1.isFeatureEnabled)(constants_1.FeaturesEnum.LIVESYNC_WCM_DELETE_FOLDER)) {
147
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_DELETE_FOLDER_DISABLED', { 0: folderMeta.localPath }));
141
148
  return;
142
- const folderMeta = fs_extra_1.readJSONSync(filePath);
143
- if (!fs_extra_1.existsSync(path_1.join(this.libraryPath, folderMeta.localPath))) {
144
- if (!utils_1.isFeatureEnabled(constants_1.FeaturesEnum.LIVESYNC_WCM_DELETE_FOLDER)) {
145
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_FOLDER_DISABLED', { 0: folderMeta.localPath }));
146
- return;
147
- }
148
- yield this.deleteRootMissingFolder(folderMeta.parentID, folderMeta.id, folderMeta.name);
149
149
  }
150
- }));
151
- const isSuccess = yield Promise.all(deleteFolderJobs).then(() => __awaiter(this, void 0, void 0, function* () {
152
- logger_1.logger.debug('Initial Sync - Folder Delete Function Completed');
153
- const componentsMetadataCollection = fs_extra_1.readdirSync(componentMetadataPath);
154
- const prensentationTemplateMetadataCollection = fs_extra_1.readdirSync(presentationTemplateMetadataPath);
155
- const StyleSheetMetadataCollection = fs_extra_1.readdirSync(styleSheetMetadataPath);
156
- const deleteComponentJobs = componentsMetadataCollection.map((file) => __awaiter(this, void 0, void 0, function* () {
157
- const filePath = path_1.join(componentMetadataPath, file);
158
- const componentsMeta = fs_extra_1.readJSONSync(filePath);
159
- if (!fs_extra_1.existsSync(path_1.join(this.libraryPath, componentsMeta.localPath))) {
160
- const resp = yield htmlComponentWcmServices_1.deleteHtmlComponent(this.apiOptions, componentsMeta.id);
161
- if ([204, 404, 409].includes(resp.status)) {
162
- if (resp.status === 409) {
163
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_HTML_COMPONENT_CONFLICT', { 0: componentsMeta.name }));
164
- }
165
- try {
166
- fs.rmSync(filePath);
167
- logger_1.logger.info(utils_1.message('LIVESYNC_PUSH_WCM_ONGOING_SYNC_DELETE_HTML_COMPONENT', { 0: componentsMeta.name, 1: this.libraryMetaData.name }));
168
- }
169
- catch (err) {
170
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_COMPONENT_DEFAULT', { 0: componentsMeta.name, 1: err }));
171
- }
150
+ await this.deleteRootMissingFolder(folderMeta.parentID, folderMeta.id, folderMeta.name);
151
+ }
152
+ });
153
+ const isSuccess = await Promise.all(deleteFolderJobs).then(async () => {
154
+ logger_1.logger.debug('Initial Sync - Folder Delete Function Completed');
155
+ const componentsMetadataCollection = (0, fs_extra_1.readdirSync)(componentMetadataPath);
156
+ const prensentationTemplateMetadataCollection = (0, fs_extra_1.readdirSync)(presentationTemplateMetadataPath);
157
+ const StyleSheetMetadataCollection = (0, fs_extra_1.readdirSync)(styleSheetMetadataPath);
158
+ const deleteComponentJobs = componentsMetadataCollection.map(async (file) => {
159
+ const filePath = (0, path_1.join)(componentMetadataPath, file);
160
+ const componentsMeta = (0, fs_extra_1.readJSONSync)(filePath);
161
+ if (!(0, fs_extra_1.existsSync)((0, path_1.join)(this.libraryPath, componentsMeta.localPath))) {
162
+ const resp = await (0, htmlComponentWcmServices_1.deleteHtmlComponent)(this.apiOptions, componentsMeta.id);
163
+ if ([204, 404, 409].includes(resp.status)) {
164
+ if (resp.status === 409) {
165
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_HTML_COMPONENT_CONFLICT', { 0: componentsMeta.name }));
172
166
  }
173
- else if (resp.status === 423) {
174
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_COMPONENT_LOCKED_FILE', { 0: componentsMeta.name }));
167
+ try {
168
+ fs.rmSync(filePath);
169
+ logger_1.logger.info((0, utils_1.message)('LIVESYNC_PUSH_WCM_ONGOING_SYNC_DELETE_HTML_COMPONENT', { 0: componentsMeta.name, 1: this.libraryMetaData.name }));
175
170
  }
176
- else if (resp.status === 500) {
177
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_COMPONENT_GENERIC', { 0: componentsMeta.name, 1: resp.statusText }));
171
+ catch (err) {
172
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_COMPONENT_DEFAULT', { 0: componentsMeta.name, 1: err }));
178
173
  }
179
174
  }
180
- }));
181
- const deleteTemplateJobs = prensentationTemplateMetadataCollection.map((file) => __awaiter(this, void 0, void 0, function* () {
182
- const filePath = path_1.join(presentationTemplateMetadataPath, file);
183
- const templateMeta = fs_extra_1.readJSONSync(filePath);
184
- if (!fs_extra_1.existsSync(path_1.join(this.libraryPath, templateMeta.localPath))) {
185
- const resp = yield presentationTemplateWcmServices_1.deletePresentationTemplate(this.apiOptions, templateMeta.id);
186
- if ([204, 404, 409].includes(resp.status)) {
187
- if (resp.status === 409) {
188
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_PRESENTATION_TEMPLATE_CONFLICT', { 0: templateMeta.name }));
189
- }
190
- try {
191
- fs.rmSync(filePath);
192
- logger_1.logger.info(utils_1.message('LIVESYNC_PUSH_WCM_ONGOING_SYNC_DELETE_PRESENTATION_TEMPLATE', { 0: templateMeta.name, 1: this.libraryMetaData.name }));
193
- }
194
- catch (err) {
195
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_PRESENTATION_TEMPLATE_DEFAULT', { 0: templateMeta.name, 1: err }));
196
- }
197
- }
198
- else if (resp.status === 423) {
199
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_PRESENTATION_TEMPLATE_LOCKED_FILE', { 0: templateMeta.name }));
200
- }
201
- else if (resp.status === 500) {
202
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_PRESENTATION_TEMPLATE_GENERIC', { 0: templateMeta.name, 1: resp.statusText }));
203
- }
175
+ else if (resp.status === 423) {
176
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_COMPONENT_LOCKED_FILE', { 0: componentsMeta.name }));
204
177
  }
205
- }));
206
- let deleteStyleSheetJobs;
207
- if (livesyncUtils_1.isTypeEnabled('LibraryStyleSheetComponent')) {
208
- deleteStyleSheetJobs = StyleSheetMetadataCollection.map((file) => __awaiter(this, void 0, void 0, function* () {
209
- const filePath = path_1.join(styleSheetMetadataPath, file);
178
+ else if (resp.status === 500) {
179
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_COMPONENT_GENERIC', { 0: componentsMeta.name, 1: resp.statusText }));
180
+ }
181
+ }
182
+ });
183
+ const deleteTemplateJobs = prensentationTemplateMetadataCollection.map(async (file) => {
184
+ const filePath = (0, path_1.join)(presentationTemplateMetadataPath, file);
185
+ const templateMeta = (0, fs_extra_1.readJSONSync)(filePath);
186
+ if (!(0, fs_extra_1.existsSync)((0, path_1.join)(this.libraryPath, templateMeta.localPath))) {
187
+ const resp = await (0, presentationTemplateWcmServices_1.deletePresentationTemplate)(this.apiOptions, templateMeta.id);
188
+ if ([204, 404, 409].includes(resp.status)) {
189
+ if (resp.status === 409) {
190
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_PRESENTATION_TEMPLATE_CONFLICT', { 0: templateMeta.name }));
191
+ }
210
192
  try {
211
- const fileMeta = fs_extra_1.readJSONSync(filePath);
212
- const stylesheetComponent = new stylesheetComponent_1.default(fileMeta.localPath, fileMeta, {
213
- apiOptions: this.apiOptions,
214
- libraryId: this.libraryMetaData.id,
215
- libraryPath: this.libraryPath,
216
- libraryMetaData: this.libraryMetaData,
217
- });
218
- this.initialSync.push(fileMeta.localPath, stylesheetComponent);
193
+ fs.rmSync(filePath);
194
+ logger_1.logger.info((0, utils_1.message)('LIVESYNC_PUSH_WCM_ONGOING_SYNC_DELETE_PRESENTATION_TEMPLATE', { 0: templateMeta.name, 1: this.libraryMetaData.name }));
219
195
  }
220
- catch (e) {
221
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_STYLESHEET_COMPONENT_GENERIC', { 0: filePath, 1: e.message }));
196
+ catch (err) {
197
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_DELETE_PRESENTATION_TEMPLATE_DEFAULT', { 0: templateMeta.name, 1: err }));
222
198
  }
223
- }));
199
+ }
200
+ else if (resp.status === 423) {
201
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_DELETE_PRESENTATION_TEMPLATE_LOCKED_FILE', { 0: templateMeta.name }));
202
+ }
203
+ else if (resp.status === 500) {
204
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_DELETE_PRESENTATION_TEMPLATE_GENERIC', { 0: templateMeta.name, 1: resp.statusText }));
205
+ }
224
206
  }
225
- yield this.initialSync.syncFiles();
226
- return Promise.all(deleteComponentJobs).then(() => {
227
- logger_1.logger.debug('Initial Sync - Component Delete Function Completed');
228
- return Promise.all(deleteTemplateJobs).then(() => {
229
- logger_1.logger.debug('Initial Sync - Presentation Template Delete Function Completed');
230
- return Promise.all(deleteStyleSheetJobs).then(() => {
231
- logger_1.logger.debug('Initial Sync - StyleSheet Delete Function Completed');
232
- return true;
207
+ });
208
+ let deleteStyleSheetJobs;
209
+ if ((0, livesyncUtils_1.isTypeEnabled)('LibraryStyleSheetComponent')) {
210
+ deleteStyleSheetJobs = StyleSheetMetadataCollection.map(async (file) => {
211
+ const filePath = (0, path_1.join)(styleSheetMetadataPath, file);
212
+ try {
213
+ const fileMeta = (0, fs_extra_1.readJSONSync)(filePath);
214
+ const stylesheetComponent = new stylesheetComponent_1.default(fileMeta.localPath, fileMeta, {
215
+ apiOptions: this.apiOptions,
216
+ libraryId: this.libraryMetaData.id,
217
+ libraryPath: this.libraryPath,
218
+ libraryMetaData: this.libraryMetaData,
233
219
  });
220
+ this.initialSync.push(fileMeta.localPath, stylesheetComponent);
221
+ }
222
+ catch (e) {
223
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_DELETE_STYLESHEET_COMPONENT_GENERIC', { 0: filePath, 1: e.message }));
224
+ }
225
+ });
226
+ }
227
+ await this.initialSync.syncFiles();
228
+ return Promise.all(deleteComponentJobs).then(() => {
229
+ logger_1.logger.debug('Initial Sync - Component Delete Function Completed');
230
+ return Promise.all(deleteTemplateJobs).then(() => {
231
+ logger_1.logger.debug('Initial Sync - Presentation Template Delete Function Completed');
232
+ return Promise.all(deleteStyleSheetJobs).then(() => {
233
+ logger_1.logger.debug('Initial Sync - StyleSheet Delete Function Completed');
234
+ return true;
234
235
  });
235
- }).catch(() => { return false; });
236
- })).catch(() => { return false; });
237
- logger_1.logger.debug('Initial Sync - Exiting function Push WCM Design Library deleteFoldersAndFiles');
238
- return isSuccess;
239
- });
236
+ });
237
+ }).catch(() => { return false; });
238
+ }).catch(() => { return false; });
239
+ logger_1.logger.debug('Initial Sync - Exiting function Push WCM Design Library deleteFoldersAndFiles');
240
+ return isSuccess;
240
241
  }
241
- deleteRootMissingFolder(parentID, childID, childName) {
242
- return __awaiter(this, void 0, void 0, function* () {
243
- logger_1.logger.debug('Executing function Push WCM Design Library deleteRootMissingFolder');
244
- let isDeleteSuccess = false;
245
- const parentFolderMeta = metadataServices_1.getFolderMeta(this.libraryPath, parentID);
246
- let resp = { status: 999 };
247
- if (!parentFolderMeta) {
248
- isDeleteSuccess = true;
242
+ async deleteRootMissingFolder(parentID, childID, childName) {
243
+ logger_1.logger.debug('Executing function Push WCM Design Library deleteRootMissingFolder');
244
+ let isDeleteSuccess = false;
245
+ const parentFolderMeta = (0, metadataServices_1.getFolderMeta)(this.libraryPath, parentID);
246
+ let resp = { status: 999 };
247
+ if (!parentFolderMeta) {
248
+ isDeleteSuccess = true;
249
+ }
250
+ else if (parentFolderMeta && !(0, fs_extra_1.existsSync)((0, path_1.join)(this.libraryPath, parentFolderMeta.localPath))) {
251
+ isDeleteSuccess = await this.deleteRootMissingFolder(parentFolderMeta.parentID, parentID, parentFolderMeta.name);
252
+ }
253
+ else {
254
+ resp = await (0, foldersWcmServices_1.deleteFolder)(this.apiOptions, childID);
255
+ isDeleteSuccess = [204, 404].includes(resp.status);
256
+ }
257
+ if (isDeleteSuccess) {
258
+ try {
259
+ const metadataPath = (0, path_1.join)(this.libraryPath, '.library', 'Folder', `${childID}.json`);
260
+ (0, fs_extra_1.rmSync)(metadataPath, { recursive: true, force: true });
261
+ logger_1.logger.info((0, utils_1.message)('LIVESYNC_PUSH_WCM_ONGOING_SYNC_DELETE_FOLDER', { 0: childName, 1: this.libraryMetaData.name }));
262
+ return true;
249
263
  }
250
- else if (parentFolderMeta && !fs_extra_1.existsSync(path_1.join(this.libraryPath, parentFolderMeta.localPath))) {
251
- isDeleteSuccess = yield this.deleteRootMissingFolder(parentFolderMeta.parentID, parentID, parentFolderMeta.name);
264
+ catch (err) {
265
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_DELETE_FOLDER_DEFAULT', { 0: childName, 1: err.message }));
252
266
  }
253
- else {
254
- resp = yield foldersWcmServices_1.deleteFolder(this.apiOptions, childID);
255
- isDeleteSuccess = [204, 404].includes(resp.status);
267
+ }
268
+ else if (resp.status === 423) {
269
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_DELETE_FOLDER_LOCKED', { 0: childName }));
270
+ }
271
+ return false;
272
+ }
273
+ async pushAll(directoryPath) {
274
+ logger_1.logger.debug('Executing function Push WCM Design Library initPusLibraryHTMLComponent');
275
+ const files = (0, fs_extra_1.readdirSync)(directoryPath);
276
+ let isSuccessful = true;
277
+ for (let i = 0; i < files.length; i += 1) {
278
+ let file = files[i];
279
+ if (file.includes('.HTML')) {
280
+ file = file.replace('.HTML', '.html');
256
281
  }
257
- if (isDeleteSuccess) {
258
- try {
259
- const metadataPath = path_1.join(this.libraryPath, '.library', 'Folder', `${childID}.json`);
260
- fs_extra_1.rmSync(metadataPath, { recursive: true, force: true });
261
- logger_1.logger.info(utils_1.message('LIVESYNC_PUSH_WCM_ONGOING_SYNC_DELETE_FOLDER', { 0: childName, 1: this.libraryMetaData.name }));
262
- return true;
263
- }
264
- catch (err) {
265
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_FOLDER_DEFAULT', { 0: childName, 1: err.message }));
282
+ const filePath = (0, path_1.join)(directoryPath, file);
283
+ const fileName = path_1.default.parse(filePath).name;
284
+ const fileStats = (0, fs_extra_1.statSync)(filePath);
285
+ if (!constants_1.LIVESYNC_WCM_LIBRARY_DEFAULT_DIRS.includes(file)) {
286
+ if (directoryPath === this.libraryPath) {
287
+ continue;
266
288
  }
267
- }
268
- else if (resp.status === 423) {
269
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_FOLDER_LOCKED', { 0: childName }));
270
- }
271
- return false;
272
- });
273
- }
274
- pushAll(directoryPath) {
275
- return __awaiter(this, void 0, void 0, function* () {
276
- logger_1.logger.debug('Executing function Push WCM Design Library initPusLibraryHTMLComponent');
277
- const files = fs_extra_1.readdirSync(directoryPath);
278
- let isSuccessful = true;
279
- for (let i = 0; i < files.length; i += 1) {
280
- let file = files[i];
281
- if (file.includes('.HTML')) {
282
- file = file.replace('.HTML', '.html');
289
+ if (fileName === '.html') {
290
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: fileName, 1: filePath }));
291
+ isSuccessful = false;
292
+ break;
283
293
  }
284
- const filePath = path_1.join(directoryPath, file);
285
- const fileName = path_1.default.parse(filePath).name;
286
- const fileStats = fs_extra_1.statSync(filePath);
287
- if (!constants_1.LIVESYNC_WCM_LIBRARY_DEFAULT_DIRS.includes(file)) {
288
- if (directoryPath === this.libraryPath) {
289
- continue;
290
- }
291
- if (fileName === '.html') {
292
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: fileName, 1: filePath }));
293
- isSuccessful = false;
294
- break;
295
- }
296
- if (path_1.default.extname(filePath) === '.html') {
297
- try {
298
- const fileMeta = metadataServices_1.getSavedMetadata(this.libraryPath, filePath, PushWcmDesignLibrary.savedMetadata);
299
- if (fileMeta && fileMeta.type === 'LibraryStyleSheetComponent') {
300
- this.initialSync.push(filePath, new stylesheetComponent_1.default(filePath, fileMeta, {
301
- apiOptions: this.apiOptions,
302
- libraryId: this.libraryMetaData.id,
303
- libraryPath: this.libraryPath,
304
- libraryMetaData: this.libraryMetaData,
305
- }));
306
- }
307
- else {
308
- yield this.pushHTMLFile(filePath, fileMeta);
309
- }
294
+ if (path_1.default.extname(filePath) === '.html') {
295
+ try {
296
+ const fileMeta = (0, metadataServices_1.getSavedMetadata)(this.libraryPath, filePath, PushWcmDesignLibrary.savedMetadata);
297
+ if (fileMeta && fileMeta.type === 'LibraryStyleSheetComponent') {
298
+ this.initialSync.push(filePath, new stylesheetComponent_1.default(filePath, fileMeta, {
299
+ apiOptions: this.apiOptions,
300
+ libraryId: this.libraryMetaData.id,
301
+ libraryPath: this.libraryPath,
302
+ libraryMetaData: this.libraryMetaData,
303
+ }));
310
304
  }
311
- catch (error) {
312
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_GENERIC', { 0: filePath, 1: error.message }));
313
- isSuccessful = false;
314
- break;
305
+ else {
306
+ await this.pushHTMLFile(filePath, fileMeta);
315
307
  }
316
308
  }
317
- else if (path_1.default.extname(filePath) === '.css') {
318
- if (livesyncUtils_1.isTypeEnabled('LibraryStyleSheetComponent')) {
319
- try {
320
- const fileMeta = metadataServices_1.getSavedMetadata(this.libraryPath, filePath, PushWcmDesignLibrary.savedMetadata);
321
- const stylesheetComponent = new stylesheetComponent_1.default(filePath, fileMeta, {
322
- apiOptions: this.apiOptions,
323
- libraryId: this.libraryMetaData.id,
324
- libraryPath: this.libraryPath,
325
- libraryMetaData: this.libraryMetaData,
326
- });
327
- this.initialSync.push(filePath, stylesheetComponent);
328
- }
329
- catch (e) {
330
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_GENERIC', { 0: filePath, 1: e.message }));
331
- isSuccessful = false;
332
- break;
333
- }
334
- }
309
+ catch (error) {
310
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_GENERIC', { 0: filePath, 1: error.message }));
311
+ isSuccessful = false;
312
+ break;
335
313
  }
336
- else if (fileStats.isDirectory()) {
314
+ }
315
+ else if (path_1.default.extname(filePath) === '.css') {
316
+ if ((0, livesyncUtils_1.isTypeEnabled)('LibraryStyleSheetComponent')) {
337
317
  try {
338
- yield this.pushFolderComponent(filePath);
318
+ const fileMeta = (0, metadataServices_1.getSavedMetadata)(this.libraryPath, filePath, PushWcmDesignLibrary.savedMetadata);
319
+ const stylesheetComponent = new stylesheetComponent_1.default(filePath, fileMeta, {
320
+ apiOptions: this.apiOptions,
321
+ libraryId: this.libraryMetaData.id,
322
+ libraryPath: this.libraryPath,
323
+ libraryMetaData: this.libraryMetaData,
324
+ });
325
+ this.initialSync.push(filePath, stylesheetComponent);
339
326
  }
340
- catch (error) {
341
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_GENERIC', { 0: filePath, 1: error.message }));
327
+ catch (e) {
328
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_GENERIC', { 0: filePath, 1: e.message }));
342
329
  isSuccessful = false;
343
330
  break;
344
331
  }
345
332
  }
346
- else {
347
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: fileName, 1: filePath }));
348
- isSuccessful = false;
349
- break;
350
- }
351
333
  }
352
- if (fileStats.isDirectory() && file !== '.library') {
334
+ else if (fileStats.isDirectory()) {
353
335
  try {
354
- yield this.pushAll(filePath);
336
+ await this.pushFolderComponent(filePath);
355
337
  }
356
338
  catch (error) {
357
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_GENERIC', { 0: filePath, 1: error.message }));
339
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_GENERIC', { 0: filePath, 1: error.message }));
358
340
  isSuccessful = false;
359
341
  break;
360
342
  }
361
343
  }
362
- }
363
- return isSuccessful;
364
- });
365
- }
366
- pushHTMLFile(filePath, fileMeta) {
367
- return __awaiter(this, void 0, void 0, function* () {
368
- logger_1.logger.debug('Executing function Push WCM Design Library pushFile');
369
- const directoryPath = path_1.default.parse(filePath).dir;
370
- const directoryFileMeta = metadataServices_1.getSavedMetadata(this.libraryPath, directoryPath, PushWcmDesignLibrary.savedMetadata);
371
- const fileName = path_1.default.parse(filePath).name;
372
- const relativeFilePath = path_1.default.relative(this.libraryPath, filePath);
373
- const libraryID = this.libraryMetaData.id;
374
- let parentID = directoryFileMeta ? directoryFileMeta.id : libraryID;
375
- const fileContent = fs_extra_1.readFileSync(filePath, 'utf8');
376
- const wcmtype = livesyncUtils_1.getWCMType(filePath, this.libraryPath);
377
- let metadata;
378
- if (!livesyncUtils_1.isTypeEnabled(wcmtype) && fileMeta && fileMeta.type === 'LibraryStyleSheetComponent') {
379
- this.initialSync.push(filePath, new stylesheetComponent_1.default(filePath, fileMeta, {
380
- apiOptions: this.apiOptions,
381
- libraryId: this.libraryMetaData.id,
382
- libraryPath: this.libraryPath,
383
- libraryMetaData: this.libraryMetaData,
384
- }));
385
- }
386
- let referenceUrl = '';
387
- if (this.apiOptions.virtualPortalContext) {
388
- referenceUrl = `${this.apiOptions.contenthandlerPath}/${this.apiOptions.virtualPortalContext}`;
389
- }
390
- else {
391
- referenceUrl = `${this.apiOptions.contenthandlerPath}`;
392
- }
393
- if (this.apiOptions.wcmProjectName) {
394
- referenceUrl += `/$project/${this.apiOptions.wcmProjectName}`;
395
- logger_1.logger.debug('referenceUrl appended with project name - %s', this.apiOptions.wcmProjectName);
396
- }
397
- logger_1.logger.debug('referenceUrl: %s', referenceUrl);
398
- const fileIsNew = !fileMeta;
399
- logger_1.logger.debug('File is new? %s', fileIsNew);
400
- let resp = { status: 999 };
401
- const type = livesyncUtils_1.getWCMType(filePath, this.libraryPath);
402
- if (!livesyncUtils_1.isTypeEnabled(type)) {
403
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: relativeFilePath }));
404
- return false;
405
- }
406
- let messageType;
407
- if (fileIsNew) {
408
- let description;
409
- switch (type) {
410
- case 'LibraryHTMLComponent':
411
- description = 'HTML Component Description';
412
- messageType = 'HTML_COMPONENT';
413
- break;
414
- case 'PresentationTemplate':
415
- description = 'Presentation Template Description';
416
- messageType = 'PRESENTATION_TEMPLATE';
417
- break;
418
- default:
419
- logger_1.logger.debug(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: relativeFilePath }));
420
- return false;
421
- }
422
- const data = JSON.stringify({
423
- entry: {
424
- title: {
425
- lang: 'en',
426
- value: fileName,
427
- },
428
- description: {
429
- lang: 'en',
430
- value: description,
431
- },
432
- name: fileName,
433
- type,
434
- link: [
435
- {
436
- rel: 'library',
437
- href: `${referenceUrl}${constants_1.URL_PATH.wcmV2Libraries}/${libraryID}`,
438
- lang: 'en',
439
- label: 'Library',
440
- },
441
- {
442
- rel: 'parent',
443
- href: `${referenceUrl}${constants_1.URL_PATH.wcmV2Folders}/${parentID}`,
444
- lang: 'en',
445
- label: 'Parent',
446
- },
447
- ],
448
- content: {
449
- type: 'text/html',
450
- value: fileContent,
451
- },
452
- },
453
- });
454
- switch (type) {
455
- case 'LibraryHTMLComponent':
456
- messageType = 'HTML_COMPONENT';
457
- resp = yield htmlComponentWcmServices_1.createHtmlComponent(this.apiOptions, data);
458
- break;
459
- case 'PresentationTemplate':
460
- messageType = 'PRESENTATION_TEMPLATE';
461
- resp = yield presentationTemplateWcmServices_1.createPresentationTemplate(this.apiOptions, data);
462
- break;
463
- default:
464
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: relativeFilePath }));
465
- return false;
344
+ else {
345
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: fileName, 1: filePath }));
346
+ isSuccessful = false;
347
+ break;
466
348
  }
467
349
  }
468
- else {
469
- if (fileContent === fileMeta.content.value) {
470
- logger_1.logger.debug('File content unchanged: %s', relativeFilePath);
471
- return true;
350
+ if (fileStats.isDirectory() && file !== '.library') {
351
+ try {
352
+ await this.pushAll(filePath);
472
353
  }
473
- fileMeta.content.value = fileContent;
474
- const data = JSON.stringify({ entry: { author: fileMeta.author, owner: fileMeta.owner, content: fileMeta.content } });
475
- switch (type) {
476
- case 'LibraryHTMLComponent':
477
- messageType = 'HTML_COMPONENT';
478
- resp = yield htmlComponentWcmServices_1.updateHtmlComponent(this.apiOptions, fileMeta.id, data);
479
- break;
480
- case 'PresentationTemplate':
481
- messageType = 'PRESENTATION_TEMPLATE';
482
- resp = yield presentationTemplateWcmServices_1.updatePresentationTemplate(this.apiOptions, fileMeta.id, data);
483
- break;
484
- default:
485
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: relativeFilePath }));
486
- return false;
354
+ catch (error) {
355
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_GENERIC', { 0: filePath, 1: error.message }));
356
+ isSuccessful = false;
357
+ break;
487
358
  }
488
- parentID = fileMeta.parentID;
489
359
  }
490
- switch (resp.status) {
491
- case 200:
492
- case 201:
493
- if (fileMeta && fileMeta.id !== resp.data.id) {
494
- logger_1.logger.error(utils_1.errorMessage(`ERROR_LIVESYNC_PUSH_WCM_UPDATE_${messageType}_HAS_DRAFT`, { 0: relativeFilePath }));
495
- return false;
496
- }
497
- metadata = metadataServices_1.createMetadata(this.libraryPath, resp.data, parentID, libraryID);
498
- if (path_1.relative(this.libraryPath, filePath).toLowerCase() !== metadata.localPath.toLowerCase()) {
499
- fs_extra_1.moveSync(path_1.relative(this.libraryPath, filePath), metadata.localPath);
500
- }
501
- PushWcmDesignLibrary.savedMetadata = metadataServices_1.saveMetadata(this.libraryPath, metadata, PushWcmDesignLibrary.savedMetadata);
502
- logger_1.logger.info(utils_1.message(`LIVESYNC_PUSH_WCM_ONGOING_SYNC_${fileIsNew ? 'CREATE' : 'UPDATE'}_${messageType}`, { 0: relativeFilePath, 1: this.libraryMetaData.name }));
503
- return true;
504
- case 400:
505
- logger_1.logger.error(utils_1.errorMessage(`ERROR_LIVESYNC_PUSH_WCM_${fileIsNew ? 'CREATE' : 'UPDATE'}_${messageType}_DEFAULT`, { 0: relativeFilePath, 1: resp.statusText }));
506
- return false;
507
- case 404:
508
- logger_1.logger.error(utils_1.errorMessage(`ERROR_LIVESYNC_PUSH_WCM_${messageType}_NOTFOUND`, { 0: relativeFilePath }));
509
- return false;
510
- case 423:
511
- logger_1.logger.error(utils_1.errorMessage(`ERROR_LIVESYNC_PUSH_WCM_${messageType}_LOCKED_FILE`, { 0: relativeFilePath }));
512
- return false;
360
+ }
361
+ return isSuccessful;
362
+ }
363
+ async pushHTMLFile(filePath, fileMeta) {
364
+ logger_1.logger.debug('Executing function Push WCM Design Library pushFile');
365
+ const directoryPath = path_1.default.parse(filePath).dir;
366
+ const directoryFileMeta = (0, metadataServices_1.getSavedMetadata)(this.libraryPath, directoryPath, PushWcmDesignLibrary.savedMetadata);
367
+ const fileName = path_1.default.parse(filePath).name;
368
+ const relativeFilePath = path_1.default.relative(this.libraryPath, filePath);
369
+ const libraryID = this.libraryMetaData.id;
370
+ let parentID = directoryFileMeta ? directoryFileMeta.id : libraryID;
371
+ const fileContent = (0, fs_extra_1.readFileSync)(filePath, 'utf8');
372
+ const wcmtype = (0, livesyncUtils_1.getWCMType)(filePath, this.libraryPath);
373
+ let metadata;
374
+ if (!(0, livesyncUtils_1.isTypeEnabled)(wcmtype) && fileMeta && fileMeta.type === 'LibraryStyleSheetComponent') {
375
+ this.initialSync.push(filePath, new stylesheetComponent_1.default(filePath, fileMeta, {
376
+ apiOptions: this.apiOptions,
377
+ libraryId: this.libraryMetaData.id,
378
+ libraryPath: this.libraryPath,
379
+ libraryMetaData: this.libraryMetaData,
380
+ }));
381
+ }
382
+ let referenceUrl = '';
383
+ if (this.apiOptions.virtualPortalContext) {
384
+ referenceUrl = `${this.apiOptions.contenthandlerPath}/${this.apiOptions.virtualPortalContext}`;
385
+ }
386
+ else {
387
+ referenceUrl = `${this.apiOptions.contenthandlerPath}`;
388
+ }
389
+ if (this.apiOptions.wcmProjectName) {
390
+ referenceUrl += `/$project/${this.apiOptions.wcmProjectName}`;
391
+ logger_1.logger.debug('referenceUrl appended with project name - %s', this.apiOptions.wcmProjectName);
392
+ }
393
+ logger_1.logger.debug('referenceUrl: %s', referenceUrl);
394
+ const fileIsNew = !fileMeta;
395
+ logger_1.logger.debug('File is new? %s', fileIsNew);
396
+ let resp = { status: 999 };
397
+ const type = (0, livesyncUtils_1.getWCMType)(filePath, this.libraryPath);
398
+ if (!(0, livesyncUtils_1.isTypeEnabled)(type)) {
399
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: relativeFilePath }));
400
+ return false;
401
+ }
402
+ let messageType;
403
+ if (fileIsNew) {
404
+ let description;
405
+ switch (type) {
406
+ case 'LibraryHTMLComponent':
407
+ description = 'HTML Component Description';
408
+ messageType = 'HTML_COMPONENT';
409
+ break;
410
+ case 'PresentationTemplate':
411
+ description = 'Presentation Template Description';
412
+ messageType = 'PRESENTATION_TEMPLATE';
413
+ break;
513
414
  default:
514
- logger_1.logger.error(utils_1.errorMessage(`ERROR_LIVESYNC_PUSH_WCM_${fileIsNew ? 'CREATE' : 'UPDATE'}_${messageType}_DEFAULT`, { 0: relativeFilePath, 1: resp.statusText }));
415
+ logger_1.logger.debug((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: relativeFilePath }));
515
416
  return false;
516
417
  }
517
- });
518
- }
519
- pushFolderComponent(filePath) {
520
- return __awaiter(this, void 0, void 0, function* () {
521
- logger_1.logger.debug('Executing function Push WCM Design Library pushFile');
522
- const fileName = path_1.default.parse(filePath).name;
523
- const relativeFilePath = path_1.default.relative(this.libraryPath, filePath);
524
- const fileMeta = metadataServices_1.getSavedMetadata(this.libraryPath, filePath, PushWcmDesignLibrary.savedMetadata);
525
- const libraryID = this.libraryMetaData.id;
526
- const directoryPath = path_1.default.parse(filePath).dir;
527
- const directoryFileMeta = metadataServices_1.getSavedMetadata(this.libraryPath, directoryPath, PushWcmDesignLibrary.savedMetadata);
528
- const parentID = directoryFileMeta.id;
529
- const fileIsNew = !fileMeta;
530
- let resp = { status: 999 };
531
- if (fileIsNew) {
532
- const data = {
533
- type: 'Folder',
534
- name: fileName,
535
- description: {
418
+ const data = JSON.stringify({
419
+ entry: {
420
+ title: {
536
421
  lang: 'en',
537
422
  value: fileName,
538
423
  },
539
- title: {
424
+ description: {
540
425
  lang: 'en',
541
- value: fileName,
426
+ value: description,
427
+ },
428
+ name: fileName,
429
+ type,
430
+ link: [
431
+ {
432
+ rel: 'library',
433
+ href: `${referenceUrl}${constants_1.URL_PATH.wcmV2Libraries}/${libraryID}`,
434
+ lang: 'en',
435
+ label: 'Library',
436
+ },
437
+ {
438
+ rel: 'parent',
439
+ href: `${referenceUrl}${constants_1.URL_PATH.wcmV2Folders}/${parentID}`,
440
+ lang: 'en',
441
+ label: 'Parent',
442
+ },
443
+ ],
444
+ content: {
445
+ type: 'text/html',
446
+ value: fileContent,
542
447
  },
543
- libraryID,
544
- parentID,
545
- };
546
- resp = yield foldersWcmServices_1.createFolder(this.apiOptions, libraryID, JSON.stringify(data));
448
+ },
449
+ });
450
+ switch (type) {
451
+ case 'LibraryHTMLComponent':
452
+ messageType = 'HTML_COMPONENT';
453
+ resp = await (0, htmlComponentWcmServices_1.createHtmlComponent)(this.apiOptions, data);
454
+ break;
455
+ case 'PresentationTemplate':
456
+ messageType = 'PRESENTATION_TEMPLATE';
457
+ resp = await (0, presentationTemplateWcmServices_1.createPresentationTemplate)(this.apiOptions, data);
458
+ break;
459
+ default:
460
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: relativeFilePath }));
461
+ return false;
547
462
  }
548
- else {
549
- if (fileMeta.localPath === relativeFilePath) {
550
- logger_1.logger.debug('Folder unchanged: %s', relativeFilePath);
551
- return true;
552
- }
553
- const cleanFolderMeta = Object.assign({}, fileMeta);
554
- delete cleanFolderMeta.localPath;
555
- delete cleanFolderMeta.htmlComponents;
556
- delete cleanFolderMeta.folders;
557
- resp = yield foldersWcmServices_1.updateFolder(this.apiOptions, fileMeta.id, JSON.stringify(cleanFolderMeta));
463
+ }
464
+ else {
465
+ if (fileContent === fileMeta.content.value) {
466
+ logger_1.logger.debug('File content unchanged: %s', relativeFilePath);
467
+ return true;
558
468
  }
559
- switch (resp.status) {
560
- case 200:
561
- case 201:
562
- resp.data.localPath = relativeFilePath;
563
- metadataServices_1.createMetadata(this.libraryPath, resp.data, parentID, libraryID);
564
- PushWcmDesignLibrary.savedMetadata = metadataServices_1.saveMetadata(this.libraryPath, resp.data, PushWcmDesignLibrary.getCache());
565
- logger_1.logger.info(utils_1.message(`LIVESYNC_PUSH_WCM_ONGOING_SYNC_${fileIsNew ? 'CREATE' : 'UPDATE'}_FOLDER`, { 0: relativeFilePath, 1: this.libraryMetaData.name }));
566
- return true;
567
- case 400:
568
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INITIAL_SYNC_CREATE_FOLDER', { 0: relativeFilePath, 1: resp.statusText }));
569
- return false;
570
- case 404:
571
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_UPDATE_FOLDER_NOTFOUND', { 0: relativeFilePath }));
572
- return false;
573
- case 423:
574
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_UPDATE_LOCKED_FOLDER', { 0: relativeFilePath }));
575
- return false;
469
+ fileMeta.content.value = fileContent;
470
+ const data = JSON.stringify({ entry: { author: fileMeta.author, owner: fileMeta.owner, content: fileMeta.content } });
471
+ switch (type) {
472
+ case 'LibraryHTMLComponent':
473
+ messageType = 'HTML_COMPONENT';
474
+ resp = await (0, htmlComponentWcmServices_1.updateHtmlComponent)(this.apiOptions, fileMeta.id, data);
475
+ break;
476
+ case 'PresentationTemplate':
477
+ messageType = 'PRESENTATION_TEMPLATE';
478
+ resp = await (0, presentationTemplateWcmServices_1.updatePresentationTemplate)(this.apiOptions, fileMeta.id, data);
479
+ break;
576
480
  default:
577
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_CREATE_FOLDER_DEFAULT', { 0: relativeFilePath, 1: resp.statusText }));
481
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: relativeFilePath }));
578
482
  return false;
579
483
  }
580
- });
484
+ parentID = fileMeta.parentID;
485
+ }
486
+ let context = '';
487
+ if (resp.data.errors?.message && resp.data.errors.message.length > 0) {
488
+ context = (0, utils_1.errorMessage)('ERROR_CONTEXT', { 0: resp.data.errors.message[0].text });
489
+ }
490
+ switch (resp.status) {
491
+ case 200:
492
+ case 201:
493
+ if (fileMeta && fileMeta.id !== resp.data.id) {
494
+ logger_1.logger.error((0, utils_1.errorMessage)(`ERROR_LIVESYNC_PUSH_WCM_UPDATE_${messageType}_HAS_DRAFT`, { 0: relativeFilePath }));
495
+ return false;
496
+ }
497
+ metadata = (0, metadataServices_1.createMetadata)(this.libraryPath, resp.data, parentID, libraryID);
498
+ if ((0, path_1.relative)(this.libraryPath, filePath).toLowerCase() !== metadata.localPath.toLowerCase()) {
499
+ (0, fs_extra_1.moveSync)((0, path_1.relative)(this.libraryPath, filePath), metadata.localPath);
500
+ }
501
+ PushWcmDesignLibrary.savedMetadata = (0, metadataServices_1.saveMetadata)(this.libraryPath, metadata, PushWcmDesignLibrary.savedMetadata);
502
+ logger_1.logger.info((0, utils_1.message)(`LIVESYNC_PUSH_WCM_ONGOING_SYNC_${fileIsNew ? 'CREATE' : 'UPDATE'}_${messageType}`, { 0: relativeFilePath, 1: this.libraryMetaData.name }));
503
+ return true;
504
+ case 400:
505
+ logger_1.logger.error((0, utils_1.errorMessage)(`ERROR_LIVESYNC_PUSH_WCM_${fileIsNew ? 'CREATE' : 'UPDATE'}_${messageType}_DEFAULT`, { 0: relativeFilePath, 1: resp.statusText }));
506
+ return false;
507
+ case 404:
508
+ logger_1.logger.error((0, utils_1.errorMessage)(`ERROR_LIVESYNC_PUSH_WCM_${messageType}_NOTFOUND`, { 0: relativeFilePath }));
509
+ return false;
510
+ case 423:
511
+ logger_1.logger.error((0, utils_1.errorMessage)(`ERROR_LIVESYNC_PUSH_WCM_${messageType}_LOCKED_FILE`, { 0: relativeFilePath }));
512
+ return false;
513
+ default:
514
+ logger_1.logger.error((0, utils_1.errorMessage)(`ERROR_LIVESYNC_PUSH_WCM_${fileIsNew ? 'CREATE' : 'UPDATE'}_${messageType}_DEFAULT`, { 0: relativeFilePath, 1: resp.statusText, 2: context }));
515
+ return false;
516
+ }
517
+ }
518
+ async pushFolderComponent(filePath) {
519
+ logger_1.logger.debug('Executing function Push WCM Design Library pushFile');
520
+ const fileName = path_1.default.parse(filePath).name;
521
+ const relativeFilePath = path_1.default.relative(this.libraryPath, filePath);
522
+ const fileMeta = (0, metadataServices_1.getSavedMetadata)(this.libraryPath, filePath, PushWcmDesignLibrary.savedMetadata);
523
+ const libraryID = this.libraryMetaData.id;
524
+ const directoryPath = path_1.default.parse(filePath).dir;
525
+ const directoryFileMeta = (0, metadataServices_1.getSavedMetadata)(this.libraryPath, directoryPath, PushWcmDesignLibrary.savedMetadata);
526
+ const parentID = directoryFileMeta.id;
527
+ const fileIsNew = !fileMeta;
528
+ let resp = { status: 999 };
529
+ if (fileIsNew) {
530
+ const data = {
531
+ type: 'Folder',
532
+ name: fileName,
533
+ description: {
534
+ lang: 'en',
535
+ value: fileName,
536
+ },
537
+ title: {
538
+ lang: 'en',
539
+ value: fileName,
540
+ },
541
+ libraryID,
542
+ parentID,
543
+ };
544
+ resp = await (0, foldersWcmServices_1.createFolder)(this.apiOptions, libraryID, JSON.stringify(data));
545
+ }
546
+ else {
547
+ if (fileMeta.localPath === relativeFilePath) {
548
+ logger_1.logger.debug('Folder unchanged: %s', relativeFilePath);
549
+ return true;
550
+ }
551
+ const cleanFolderMeta = { ...fileMeta };
552
+ delete cleanFolderMeta.localPath;
553
+ delete cleanFolderMeta.htmlComponents;
554
+ delete cleanFolderMeta.folders;
555
+ resp = await (0, foldersWcmServices_1.updateFolder)(this.apiOptions, fileMeta.id, JSON.stringify(cleanFolderMeta));
556
+ }
557
+ switch (resp.status) {
558
+ case 200:
559
+ case 201:
560
+ resp.data.localPath = relativeFilePath;
561
+ (0, metadataServices_1.createMetadata)(this.libraryPath, resp.data, parentID, libraryID);
562
+ PushWcmDesignLibrary.savedMetadata = (0, metadataServices_1.saveMetadata)(this.libraryPath, resp.data, PushWcmDesignLibrary.getCache());
563
+ logger_1.logger.info((0, utils_1.message)(`LIVESYNC_PUSH_WCM_ONGOING_SYNC_${fileIsNew ? 'CREATE' : 'UPDATE'}_FOLDER`, { 0: relativeFilePath, 1: this.libraryMetaData.name }));
564
+ return true;
565
+ case 400:
566
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_INITIAL_SYNC_CREATE_FOLDER', { 0: relativeFilePath, 1: resp.statusText }));
567
+ return false;
568
+ case 404:
569
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_UPDATE_FOLDER_NOTFOUND', { 0: relativeFilePath }));
570
+ return false;
571
+ case 423:
572
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_UPDATE_LOCKED_FOLDER', { 0: relativeFilePath }));
573
+ return false;
574
+ default:
575
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_CREATE_FOLDER_DEFAULT', { 0: relativeFilePath, 1: resp.statusText }));
576
+ return false;
577
+ }
581
578
  }
582
579
  ongoingSync(cmdArgs, hooks) {
583
580
  logger_1.logger.debug('Executing function Push WCM Design Library ongoingSync');
584
581
  let isSuccess = true;
585
582
  const { wcmLibraryPath } = cmdArgs;
586
583
  const watchedPaths = [];
587
- if (utils_1.isFeatureEnabled(constants_1.FeaturesEnum.LIVESYNC_WCM_HTML_COMPONENT)) {
588
- watchedPaths.push(path_1.join(wcmLibraryPath, 'Components'));
584
+ if ((0, utils_1.isFeatureEnabled)(constants_1.FeaturesEnum.LIVESYNC_WCM_HTML_COMPONENT)) {
585
+ watchedPaths.push((0, path_1.join)(wcmLibraryPath, 'Components'));
589
586
  }
590
- if (utils_1.isFeatureEnabled(constants_1.FeaturesEnum.LIVESYNC_WCM_STYLE_SHEET) && watchedPaths.length === 0) {
591
- watchedPaths.push(path_1.join(wcmLibraryPath, 'Components'));
587
+ if ((0, utils_1.isFeatureEnabled)(constants_1.FeaturesEnum.LIVESYNC_WCM_STYLE_SHEET) && watchedPaths.length === 0) {
588
+ watchedPaths.push((0, path_1.join)(wcmLibraryPath, 'Components'));
592
589
  }
593
- if (utils_1.isFeatureEnabled(constants_1.FeaturesEnum.LIVESYNC_WCM_PRESENTATION_TEMPLATE)) {
594
- watchedPaths.push(path_1.join(wcmLibraryPath, 'Presentation Templates'));
590
+ if ((0, utils_1.isFeatureEnabled)(constants_1.FeaturesEnum.LIVESYNC_WCM_PRESENTATION_TEMPLATE)) {
591
+ watchedPaths.push((0, path_1.join)(wcmLibraryPath, 'Presentation Templates'));
595
592
  }
596
593
  const handlerProvider = {
597
- [constants_1.ChokidarEvent.ADD]: () => __awaiter(this, void 0, void 0, function* () {
594
+ [constants_1.ChokidarEvent.ADD]: async () => {
598
595
  logger_1.logger.debug('File created');
599
- }),
596
+ },
600
597
  [constants_1.ChokidarEvent.ADD_HTML]: ongoingSyncServices_1.addWCMHtmlFileHandler,
601
598
  [constants_1.ChokidarEvent.ADD_CSS]: ongoingSyncServices_1.addWCMCssFileHandler,
602
599
  [constants_1.ChokidarEvent.ADD_DIR]: ongoingSyncServices_1.addWCMFolderHandler,
603
- [constants_1.ChokidarEvent.CHANGE]: () => __awaiter(this, void 0, void 0, function* () {
600
+ [constants_1.ChokidarEvent.CHANGE]: async () => {
604
601
  logger_1.logger.debug('Updated file event');
605
- }),
602
+ },
606
603
  [constants_1.ChokidarEvent.CHANGE_HTML]: ongoingSyncServices_1.updateWCMHtmlFileHandler,
607
604
  [constants_1.ChokidarEvent.CHANGE_CSS]: ongoingSyncServices_1.updateWCMCssFileHandler,
608
605
  [constants_1.ChokidarEvent.CHANGE_DIR]: ongoingSyncServices_1.updateWCMFolderHandler,
@@ -612,9 +609,9 @@ class PushWcmDesignLibrary {
612
609
  };
613
610
  this.eventsQueue = new EventsQueue_1.EventsQueue(handlerProvider);
614
611
  this.eventsQueue.initialize();
615
- const mappedLibraryPath = utils_1.mapToHostPath(wcmLibraryPath, []);
612
+ const mappedLibraryPath = (0, utils_1.mapToHostPath)(wcmLibraryPath, []);
616
613
  logger_1.logger.debug('Initializing chokidar watcher...');
617
- logger_1.logger.info(utils_1.message('LIVE_SYNC_START', { 0: mappedLibraryPath }));
614
+ logger_1.logger.info((0, utils_1.message)('LIVE_SYNC_START', { 0: mappedLibraryPath }));
618
615
  const STABILITY_THRESHOLD = 100;
619
616
  const POLL_INTERVAL = 2000;
620
617
  const watchOptions = {
@@ -624,19 +621,19 @@ class PushWcmDesignLibrary {
624
621
  },
625
622
  persistent: true,
626
623
  ignoreInitial: true,
627
- ignored: [...filesServices_1.fileServices.getIgnoredPaths(wcmLibraryPath), path_1.join(wcmLibraryPath, '.library')],
624
+ ignored: [...filesServices_1.fileServices.getIgnoredPaths(wcmLibraryPath), (0, path_1.join)(wcmLibraryPath, '.library')],
628
625
  };
629
626
  this.watcher = chokidar_1.default
630
627
  .watch(watchedPaths, watchOptions)
631
- .on(constants_1.ChokidarEvent.ADD, (chokidarPath) => __awaiter(this, void 0, void 0, function* () {
628
+ .on(constants_1.ChokidarEvent.ADD, async (chokidarPath) => {
632
629
  logger_1.logger.debug(`Detected file created: ${chokidarPath}`);
633
630
  const fileType = path_1.default.extname(chokidarPath).toLocaleLowerCase();
634
631
  const fileName = path_1.default.parse(chokidarPath).name;
635
632
  if (!['.html', '.css'].includes(fileType)) {
636
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: fileName, 1: chokidarPath }));
633
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: fileName, 1: chokidarPath }));
637
634
  return;
638
635
  }
639
- const chokidarEventType = livesyncUtils_1.getEventByFileType(chokidarPath, constants_1.ChokidarEvent.ADD);
636
+ const chokidarEventType = (0, livesyncUtils_1.getEventByFileType)(chokidarPath, constants_1.ChokidarEvent.ADD);
640
637
  switch (chokidarEventType) {
641
638
  case constants_1.ChokidarEvent.ADD_HTML:
642
639
  this.eventsQueue.push({
@@ -665,8 +662,8 @@ class PushWcmDesignLibrary {
665
662
  logger_1.logger.debug(`Detected file created: ${chokidarPath}`);
666
663
  break;
667
664
  }
668
- }))
669
- .on(constants_1.ChokidarEvent.ADD_DIR, (chokidarPath) => __awaiter(this, void 0, void 0, function* () {
665
+ })
666
+ .on(constants_1.ChokidarEvent.ADD_DIR, async (chokidarPath) => {
670
667
  logger_1.logger.debug(`Detected folder created: ${chokidarPath}`);
671
668
  this.eventsQueue.push({
672
669
  cmdArgs,
@@ -676,16 +673,16 @@ class PushWcmDesignLibrary {
676
673
  library: this.libraryMetaData,
677
674
  },
678
675
  });
679
- }))
680
- .on(constants_1.ChokidarEvent.CHANGE, (chokidarPath) => __awaiter(this, void 0, void 0, function* () {
676
+ })
677
+ .on(constants_1.ChokidarEvent.CHANGE, async (chokidarPath) => {
681
678
  logger_1.logger.debug(`Detected file updated: ${chokidarPath}`);
682
679
  const fileType = path_1.default.extname(chokidarPath).toLocaleLowerCase();
683
680
  const fileName = path_1.default.parse(chokidarPath).name;
684
681
  if (!['.html', '.css'].includes(fileType)) {
685
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: fileName, 1: chokidarPath }));
682
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: fileName, 1: chokidarPath }));
686
683
  return;
687
684
  }
688
- const chokidarEventType = livesyncUtils_1.getEventByFileType(chokidarPath, constants_1.ChokidarEvent.CHANGE);
685
+ const chokidarEventType = (0, livesyncUtils_1.getEventByFileType)(chokidarPath, constants_1.ChokidarEvent.CHANGE);
689
686
  switch (chokidarEventType) {
690
687
  case constants_1.ChokidarEvent.CHANGE_HTML:
691
688
  this.eventsQueue.push({
@@ -714,13 +711,13 @@ class PushWcmDesignLibrary {
714
711
  logger_1.logger.debug(`Detected file updated: ${chokidarPath}`);
715
712
  this.eventsQueue.push({
716
713
  cmdArgs,
717
- chokidarEvent: livesyncUtils_1.getEventByFileType(chokidarPath, constants_1.ChokidarEvent.CHANGE),
714
+ chokidarEvent: (0, livesyncUtils_1.getEventByFileType)(chokidarPath, constants_1.ChokidarEvent.CHANGE),
718
715
  chokidarPath,
719
716
  });
720
717
  break;
721
718
  }
722
- }))
723
- .on(constants_1.ChokidarEvent.CHANGE_DIR, (chokidarPath) => __awaiter(this, void 0, void 0, function* () {
719
+ })
720
+ .on(constants_1.ChokidarEvent.CHANGE_DIR, async (chokidarPath) => {
724
721
  logger_1.logger.debug(`Detected folder updated: ${chokidarPath}`);
725
722
  this.eventsQueue.push({
726
723
  cmdArgs,
@@ -730,17 +727,16 @@ class PushWcmDesignLibrary {
730
727
  library: this.libraryMetaData,
731
728
  },
732
729
  });
733
- }))
734
- .on(constants_1.ChokidarEvent.UNLINK, (chokidarPath) => __awaiter(this, void 0, void 0, function* () {
735
- var _a;
730
+ })
731
+ .on(constants_1.ChokidarEvent.UNLINK, async (chokidarPath) => {
736
732
  try {
737
733
  logger_1.logger.debug(`Detected file deleted: ${chokidarPath}`);
738
- const chokidarEventType = livesyncUtils_1.getEventByFileType(chokidarPath, constants_1.ChokidarEvent.UNLINK);
739
- const fileMeta = metadataServices_1.getSavedMetadata(this.libraryPath, chokidarPath, PushWcmDesignLibrary.savedMetadata);
734
+ const chokidarEventType = (0, livesyncUtils_1.getEventByFileType)(chokidarPath, constants_1.ChokidarEvent.UNLINK);
735
+ const fileMeta = (0, metadataServices_1.getSavedMetadata)(this.libraryPath, chokidarPath, PushWcmDesignLibrary.savedMetadata);
740
736
  switch (chokidarEventType) {
741
737
  case constants_1.ChokidarEvent.UNLINK_HTML:
742
738
  let eventType = chokidarEventType;
743
- if (!livesyncUtils_1.isTypeEnabled(livesyncUtils_1.getWCMType(chokidarPath, (_a = this.libraryPath) !== null && _a !== void 0 ? _a : '')) && fileMeta.type === 'LibraryStyleSheetComponent') {
739
+ if (!(0, livesyncUtils_1.isTypeEnabled)((0, livesyncUtils_1.getWCMType)(chokidarPath, this.libraryPath ?? '')) && fileMeta.type === 'LibraryStyleSheetComponent') {
744
740
  eventType = constants_1.ChokidarEvent.UNLINK_CSS;
745
741
  }
746
742
  this.eventsQueue.push({
@@ -765,7 +761,10 @@ class PushWcmDesignLibrary {
765
761
  });
766
762
  break;
767
763
  case constants_1.ChokidarEvent.UNLINK:
768
- this.eventsQueue.push({ cmdArgs, chokidarEvent: chokidarEventType, chokidarPath });
764
+ logger_1.logger.debug(`Unsupported file type detected: ${chokidarPath}`);
765
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_LIVESYNC_PUSH_WCM_DELETE_INVALID_EXTENSION', {
766
+ 0: chokidarPath,
767
+ }));
769
768
  break;
770
769
  default:
771
770
  logger_1.logger.debug(`Detected file delete: ${chokidarPath}`);
@@ -774,13 +773,13 @@ class PushWcmDesignLibrary {
774
773
  }
775
774
  catch (error) {
776
775
  logger_1.logger.debug(error.message);
777
- logger_1.logger.error(utils_1.errorMessage('ERROR_WCM_DESIGN_LIBRARY_PUSH_GENERIC', {
776
+ logger_1.logger.error((0, utils_1.errorMessage)('ERROR_WCM_DESIGN_LIBRARY_PUSH_GENERIC', {
778
777
  0: chokidarPath,
779
778
  1: error.message,
780
779
  }));
781
780
  }
782
- }))
783
- .on(constants_1.ChokidarEvent.UNLINK_DIR, (chokidarPath) => __awaiter(this, void 0, void 0, function* () {
781
+ })
782
+ .on(constants_1.ChokidarEvent.UNLINK_DIR, async (chokidarPath) => {
784
783
  logger_1.logger.debug(`Detected folder deleted: ${chokidarPath}`);
785
784
  this.eventsQueue.push({
786
785
  cmdArgs,
@@ -790,55 +789,53 @@ class PushWcmDesignLibrary {
790
789
  library: this.libraryMetaData,
791
790
  },
792
791
  });
793
- }))
794
- .on(constants_1.ChokidarEvent.ERROR, (error) => __awaiter(this, void 0, void 0, function* () {
792
+ })
793
+ .on(constants_1.ChokidarEvent.ERROR, async (error) => {
795
794
  logger_1.logger.debug('Something went wrong while running chokidar watch: %o', error);
796
795
  isSuccess = false;
797
- yield this.closeWatcher(isSuccess);
798
- }))
796
+ await this.closeWatcher(isSuccess);
797
+ })
799
798
  .on(constants_1.ChokidarEvent.READY, () => {
800
- if (hooks && hooks.onWatcherReady && lodash_1.isFunction(hooks.onWatcherReady)) {
799
+ if (hooks && hooks.onWatcherReady && (0, lodash_1.isFunction)(hooks.onWatcherReady)) {
801
800
  hooks.onWatcherReady();
802
801
  }
803
802
  });
804
- const sigIntcallBack = () => __awaiter(this, void 0, void 0, function* () {
803
+ const sigIntcallBack = async () => {
805
804
  const iSuccess = true;
806
805
  process.removeListener('SIGINT', sigIntcallBack);
807
- yield this.closeWatcher(iSuccess);
808
- });
806
+ await this.closeWatcher(iSuccess);
807
+ };
809
808
  process.on('SIGINT', sigIntcallBack);
810
809
  }
811
- closeWatcher(emitIsSuccess, hooks) {
812
- return __awaiter(this, void 0, void 0, function* () {
813
- if (this.watcher) {
814
- yield this.watcher.close();
815
- this.watcher = null;
810
+ async closeWatcher(emitIsSuccess, hooks) {
811
+ if (this.watcher) {
812
+ await this.watcher.close();
813
+ this.watcher = null;
814
+ }
815
+ if (this.eventsQueue) {
816
+ await this.eventsQueue.kill();
817
+ }
818
+ logger_1.logger.info((0, utils_1.message)('LIVESYNC_RUN_CLEANUP_QUEUE'));
819
+ const waitForQueueToFinish = async (retryCount = 0) => {
820
+ if (!this.eventsQueue.queue.running()) {
821
+ return;
816
822
  }
817
- if (this.eventsQueue) {
818
- yield this.eventsQueue.kill();
823
+ if (retryCount < this.maxRetryCount) {
824
+ logger_1.logger.debug('Waiting for queue process to finish...');
825
+ await new Promise((resolve) => {
826
+ return setTimeout(resolve, this.timeInterval);
827
+ });
828
+ await waitForQueueToFinish(retryCount + 1);
819
829
  }
820
- logger_1.logger.info(utils_1.message('LIVESYNC_RUN_CLEANUP_QUEUE'));
821
- const waitForQueueToFinish = (retryCount = 0) => __awaiter(this, void 0, void 0, function* () {
822
- if (!this.eventsQueue.queue.running()) {
823
- return;
824
- }
825
- if (retryCount < this.maxRetryCount) {
826
- logger_1.logger.debug('Waiting for queue process to finish...');
827
- yield new Promise((resolve) => {
828
- return setTimeout(resolve, this.timeInterval);
829
- });
830
- yield waitForQueueToFinish(retryCount + 1);
831
- }
832
- else {
833
- logger_1.logger.info(utils_1.message('LIVESYNC_END_CLEANUP_QUEUE'));
834
- emitIsSuccess = false;
835
- }
836
- });
837
- yield waitForQueueToFinish();
838
- if ((hooks === null || hooks === void 0 ? void 0 : hooks.onWatcherClose) && typeof hooks.onWatcherClose === 'function') {
839
- hooks.onWatcherClose(emitIsSuccess);
830
+ else {
831
+ logger_1.logger.info((0, utils_1.message)('LIVESYNC_END_CLEANUP_QUEUE'));
832
+ emitIsSuccess = false;
840
833
  }
841
- });
834
+ };
835
+ await waitForQueueToFinish();
836
+ if (hooks?.onWatcherClose && typeof hooks.onWatcherClose === 'function') {
837
+ hooks.onWatcherClose(emitIsSuccess);
838
+ }
842
839
  }
843
840
  static updateCache(savedMetadata) {
844
841
  PushWcmDesignLibrary.savedMetadata = savedMetadata;