@hcl-software/dxclient 225.0.0 → 227.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 (156) hide show
  1. package/README.md +211 -3215
  2. package/dist/configuration/versionConfigMap.json +3 -0
  3. package/dist/package.json +4 -4
  4. package/dist/packages/admintasks/src/commands/createCredentialVault.js +0 -1
  5. package/dist/packages/admintasks/src/commands/createCredentialVault.js.map +1 -1
  6. package/dist/packages/admintasks/src/commands/createSyndicationRelation.js +0 -1
  7. package/dist/packages/admintasks/src/commands/createSyndicationRelation.js.map +1 -1
  8. package/dist/packages/admintasks/src/commands/createVirtualPortal.js +0 -1
  9. package/dist/packages/admintasks/src/commands/createVirtualPortal.js.map +1 -1
  10. package/dist/packages/admintasks/src/commands/differentialReport.js +0 -1
  11. package/dist/packages/admintasks/src/commands/differentialReport.js.map +1 -1
  12. package/dist/packages/admintasks/src/commands/exportVirtualPortal.js +0 -1
  13. package/dist/packages/admintasks/src/commands/exportVirtualPortal.js.map +1 -1
  14. package/dist/packages/admintasks/src/commands/exportWCMLibrary.js +1 -2
  15. package/dist/packages/admintasks/src/commands/exportWCMLibrary.js.map +1 -1
  16. package/dist/packages/admintasks/src/commands/importVirtualPortal.js +0 -1
  17. package/dist/packages/admintasks/src/commands/importVirtualPortal.js.map +1 -1
  18. package/dist/packages/admintasks/src/commands/importWCMLibrary.js +0 -1
  19. package/dist/packages/admintasks/src/commands/importWCMLibrary.js.map +1 -1
  20. package/dist/packages/admintasks/src/commands/listVirtualPortals.js +0 -1
  21. package/dist/packages/admintasks/src/commands/listVirtualPortals.js.map +1 -1
  22. package/dist/packages/admintasks/src/commands/pznRulesExport.js +0 -1
  23. package/dist/packages/admintasks/src/commands/pznRulesExport.js.map +1 -1
  24. package/dist/packages/admintasks/src/commands/pznRulesImport.js +0 -1
  25. package/dist/packages/admintasks/src/commands/pznRulesImport.js.map +1 -1
  26. package/dist/packages/admintasks/src/commands/resEnvProviderActions.js +0 -1
  27. package/dist/packages/admintasks/src/commands/resEnvProviderActions.js.map +1 -1
  28. package/dist/packages/admintasks/src/commands/restartCorePods.js +0 -1
  29. package/dist/packages/admintasks/src/commands/restartCorePods.js.map +1 -1
  30. package/dist/packages/admintasks/src/commands/restartDXCore.js +0 -1
  31. package/dist/packages/admintasks/src/commands/restartDXCore.js.map +1 -1
  32. package/dist/packages/dam/src/commands/createSecrets.js +0 -1
  33. package/dist/packages/dam/src/commands/createSecrets.js.map +1 -1
  34. package/dist/packages/dam/src/commands/deleteDAMStagingMismatch.js +0 -1
  35. package/dist/packages/dam/src/commands/deleteDAMStagingMismatch.js.map +1 -1
  36. package/dist/packages/dam/src/commands/deleteSchema.js +0 -1
  37. package/dist/packages/dam/src/commands/deleteSchema.js.map +1 -1
  38. package/dist/packages/dam/src/commands/exportAssets.js +0 -1
  39. package/dist/packages/dam/src/commands/exportAssets.js.map +1 -1
  40. package/dist/packages/dam/src/commands/findDAMStagingMismatch.js +0 -1
  41. package/dist/packages/dam/src/commands/findDAMStagingMismatch.js.map +1 -1
  42. package/dist/packages/dam/src/commands/importAssets.js +0 -1
  43. package/dist/packages/dam/src/commands/importAssets.js.map +1 -1
  44. package/dist/packages/dam/src/commands/listSchema.js +0 -1
  45. package/dist/packages/dam/src/commands/listSchema.js.map +1 -1
  46. package/dist/packages/dam/src/commands/stagingMismatchReport.js +0 -1
  47. package/dist/packages/dam/src/commands/stagingMismatchReport.js.map +1 -1
  48. package/dist/packages/dam/src/commands/stagingResync.js +0 -1
  49. package/dist/packages/dam/src/commands/stagingResync.js.map +1 -1
  50. package/dist/packages/dam/src/commands/subscriberDeRegistration.js +0 -1
  51. package/dist/packages/dam/src/commands/subscriberDeRegistration.js.map +1 -1
  52. package/dist/packages/dam/src/commands/subscriberDetails.js +0 -1
  53. package/dist/packages/dam/src/commands/subscriberDetails.js.map +1 -1
  54. package/dist/packages/dam/src/commands/subscriberRegistration.js +0 -1
  55. package/dist/packages/dam/src/commands/subscriberRegistration.js.map +1 -1
  56. package/dist/packages/dam/src/commands/triggerDAMStaging.js +0 -1
  57. package/dist/packages/dam/src/commands/triggerDAMStaging.js.map +1 -1
  58. package/dist/packages/dam/src/commands/triggerDamReindexing.js +0 -1
  59. package/dist/packages/dam/src/commands/triggerDamReindexing.js.map +1 -1
  60. package/dist/packages/dam/src/commands/updateSecrets.js +0 -1
  61. package/dist/packages/dam/src/commands/updateSecrets.js.map +1 -1
  62. package/dist/packages/dam/src/import/renditions.js +3 -0
  63. package/dist/packages/dam/src/import/renditions.js.map +1 -1
  64. package/dist/packages/deployportlet/src/commands/deployPortlet.js +0 -1
  65. package/dist/packages/deployportlet/src/commands/deployPortlet.js.map +1 -1
  66. package/dist/packages/deployportlet/src/commands/undeployPortlet.js +0 -1
  67. package/dist/packages/deployportlet/src/commands/undeployPortlet.js.map +1 -1
  68. package/dist/packages/deployportlet/src/commands/xmlaccess.js +0 -1
  69. package/dist/packages/deployportlet/src/commands/xmlaccess.js.map +1 -1
  70. package/dist/packages/deployscriptapplication/src/commands/list.js +78 -75
  71. package/dist/packages/deployscriptapplication/src/commands/pull.js +0 -1
  72. package/dist/packages/deployscriptapplication/src/commands/pull.js.map +1 -1
  73. package/dist/packages/deployscriptapplication/src/commands/push.js +0 -1
  74. package/dist/packages/deployscriptapplication/src/commands/push.js.map +1 -1
  75. package/dist/packages/deployscriptapplication/src/commands/restoreScriptApplication.js +0 -1
  76. package/dist/packages/deployscriptapplication/src/commands/restoreScriptApplication.js.map +1 -1
  77. package/dist/packages/deployscriptapplication/src/commands/undeployScriptApplication.js +0 -1
  78. package/dist/packages/deployscriptapplication/src/commands/undeployScriptApplication.js.map +1 -1
  79. package/dist/packages/deploytheme/src/commands/deployApplication.js +0 -1
  80. package/dist/packages/deploytheme/src/commands/deployApplication.js.map +1 -1
  81. package/dist/packages/deploytheme/src/commands/deployTheme.js +0 -2
  82. package/dist/packages/deploytheme/src/commands/deployTheme.js.map +1 -1
  83. package/dist/packages/deploytheme/src/commands/undeployApplication.js +0 -1
  84. package/dist/packages/deploytheme/src/commands/undeployApplication.js.map +1 -1
  85. package/dist/packages/deploytheme/src/commands/undeployTheme.js +0 -2
  86. package/dist/packages/deploytheme/src/commands/undeployTheme.js.map +1 -1
  87. package/dist/packages/livesync/src/commands/pullTheme.js +0 -1
  88. package/dist/packages/livesync/src/commands/pullTheme.js.map +1 -1
  89. package/dist/packages/livesync/src/commands/pullWcmDesignLibrary.d.ts +2 -2
  90. package/dist/packages/livesync/src/commands/pullWcmDesignLibrary.js +35 -14
  91. package/dist/packages/livesync/src/commands/pullWcmDesignLibrary.js.map +1 -1
  92. package/dist/packages/livesync/src/commands/pushTheme.js +0 -1
  93. package/dist/packages/livesync/src/commands/pushTheme.js.map +1 -1
  94. package/dist/packages/livesync/src/commands/pushWcmDesignLibrary.d.ts +4 -1
  95. package/dist/packages/livesync/src/commands/pushWcmDesignLibrary.js +206 -76
  96. package/dist/packages/livesync/src/commands/pushWcmDesignLibrary.js.map +1 -1
  97. package/dist/packages/livesync/src/errors/CommandLineMessages_en.json +57 -28
  98. package/dist/packages/livesync/src/messages/messages_en.json +12 -8
  99. package/dist/packages/livesync/src/services/livesyncUtils.d.ts +3 -2
  100. package/dist/packages/livesync/src/services/livesyncUtils.js +19 -4
  101. package/dist/packages/livesync/src/services/livesyncUtils.js.map +1 -1
  102. package/dist/packages/livesync/src/services/metadataServices.d.ts +26 -5
  103. package/dist/packages/livesync/src/services/metadataServices.js +56 -12
  104. package/dist/packages/livesync/src/services/metadataServices.js.map +1 -1
  105. package/dist/packages/livesync/src/services/ongoingSyncServices.d.ts +3 -0
  106. package/dist/packages/livesync/src/services/ongoingSyncServices.js +170 -71
  107. package/dist/packages/livesync/src/services/ongoingSyncServices.js.map +1 -1
  108. package/dist/packages/livesync/src/services/styleSheetComponentWcmServices.d.ts +5 -0
  109. package/dist/packages/livesync/src/services/styleSheetComponentWcmServices.js +138 -0
  110. package/dist/packages/livesync/src/services/styleSheetComponentWcmServices.js.map +1 -0
  111. package/dist/packages/livesync/src/services/wcmContext/initialSync.d.ts +6 -0
  112. package/dist/packages/livesync/src/services/wcmContext/initialSync.js +39 -0
  113. package/dist/packages/livesync/src/services/wcmContext/initialSync.js.map +1 -0
  114. package/dist/packages/livesync/src/services/wcmContext/stylesheetComponent.d.ts +8 -0
  115. package/dist/packages/livesync/src/services/wcmContext/stylesheetComponent.js +268 -0
  116. package/dist/packages/livesync/src/services/wcmContext/stylesheetComponent.js.map +1 -0
  117. package/dist/packages/livesync/src/services/wcmContext/wcmLibraryContext.d.ts +17 -0
  118. package/dist/packages/livesync/src/services/wcmContext/wcmLibraryContext.js +20 -0
  119. package/dist/packages/livesync/src/services/wcmContext/wcmLibraryContext.js.map +1 -0
  120. package/dist/packages/livesync/src/services/wcmRestV2Services.js +1 -0
  121. package/dist/packages/livesync/src/services/wcmRestV2Services.js.map +1 -1
  122. package/dist/packages/livesync/src/types/EventQueueItem.type.d.ts +3 -2
  123. package/dist/packages/livesync/src/types/WCMDesignLibraryCache.type.d.ts +6 -3
  124. package/dist/packages/livesync/src/types/WcmRestApiV2.type.d.ts +23 -1
  125. package/dist/packages/mls_exim/src/export/mlsExport.js +14 -8
  126. package/dist/packages/mls_exim/src/export/mlsExport.js.map +1 -1
  127. package/dist/packages/mls_exim/src/export/mlsExport.ts +17 -10
  128. package/dist/packages/mls_exim/src/import/mlsImport.js +3 -3
  129. package/dist/packages/mls_exim/src/import/mlsImport.js.map +1 -1
  130. package/dist/packages/mls_exim/src/import/mlsImport.ts +5 -5
  131. package/dist/packages/sharedlibrary/src/commands/delete.js +0 -1
  132. package/dist/packages/sharedlibrary/src/commands/delete.js.map +1 -1
  133. package/dist/packages/sharedlibrary/src/commands/upload.js +0 -1
  134. package/dist/packages/sharedlibrary/src/commands/upload.js.map +1 -1
  135. package/dist/packages/sharedlibrary/src/services/sharedLibraryServices.js +6 -0
  136. package/dist/packages/sharedlibrary/src/services/sharedLibraryServices.js.map +1 -1
  137. package/dist/packages/syndication/src/commands/subscriber.js +0 -1
  138. package/dist/packages/syndication/src/commands/subscriber.js.map +1 -1
  139. package/dist/packages/syndication/src/commands/syndicator.js +0 -1
  140. package/dist/packages/syndication/src/commands/syndicator.js.map +1 -1
  141. package/dist/packages/syndication/src/commands/syndicatorFailedItem.js +0 -1
  142. package/dist/packages/syndication/src/commands/syndicatorFailedItem.js.map +1 -1
  143. package/dist/src/errors/CommandLineMessages_en.json +2 -1
  144. package/dist/src/index.js +2 -1
  145. package/dist/src/index.js.map +1 -1
  146. package/dist/src/services/apiServices.js +6 -0
  147. package/dist/src/services/apiServices.js.map +1 -1
  148. package/dist/src/services/requestService.js +6 -0
  149. package/dist/src/services/requestService.js.map +1 -1
  150. package/dist/src/utils/constants.d.ts +7 -3
  151. package/dist/src/utils/constants.js +11 -2
  152. package/dist/src/utils/constants.js.map +1 -1
  153. package/dist/src/utils/utils.d.ts +1 -0
  154. package/dist/src/utils/utils.js +10 -1
  155. package/dist/src/utils/utils.js.map +1 -1
  156. package/package.json +4 -4
@@ -48,10 +48,14 @@ const EventsQueue_1 = require("../services/EventsQueue");
48
48
  const livesyncUtils_1 = require("../services/livesyncUtils");
49
49
  const ongoingSyncServices_1 = require("../services/ongoingSyncServices");
50
50
  const presentationTemplateWcmServices_1 = require("../services/presentationTemplateWcmServices");
51
+ const initialSync_1 = require("../services/wcmContext/initialSync");
52
+ const stylesheetComponent_1 = __importDefault(require("../services/wcmContext/stylesheetComponent"));
51
53
  class PushWcmDesignLibrary {
52
54
  constructor() {
53
55
  this.watcher = null;
54
56
  this.eventsQueue = null;
57
+ this.maxRetryCount = 60;
58
+ this.timeInterval = 1000;
55
59
  }
56
60
  invoke(cmdArgs) {
57
61
  return __awaiter(this, void 0, void 0, function* () {
@@ -85,7 +89,9 @@ class PushWcmDesignLibrary {
85
89
  }
86
90
  wcmLibraryName = this.libraryMetaData.name;
87
91
  PushWcmDesignLibrary.savedMetadata = metadataServices_1.loadMetadata(this.libraryPath);
92
+ this.initialSync = new initialSync_1.InitialSync();
88
93
  isSuccess = yield this.pushAll(cmdArgs.wcmLibraryPath);
94
+ yield this.initialSync.syncFiles();
89
95
  if (isSuccess && utils_1.isFeatureEnabled(constants_1.FeaturesEnum.LIVESYNC_WCM_DELETE)) {
90
96
  yield this.deleteFoldersAndFiles(cmdArgs.wcmLibraryPath);
91
97
  }
@@ -127,13 +133,14 @@ class PushWcmDesignLibrary {
127
133
  const folderMetadataPath = path_1.join(libraryPath, '.library', 'Folder');
128
134
  const componentMetadataPath = path_1.join(libraryPath, '.library', 'LibraryHTMLComponent');
129
135
  const presentationTemplateMetadataPath = path_1.join(libraryPath, '.library', 'PresentationTemplate');
136
+ const styleSheetMetadataPath = path_1.join(libraryPath, '.library', 'LibraryStyleSheetComponent');
130
137
  const folderMetadataCollection = fs_extra_1.readdirSync(folderMetadataPath);
131
138
  const deleteFolderJobs = folderMetadataCollection.map((file) => __awaiter(this, void 0, void 0, function* () {
132
139
  const filePath = path_1.join(folderMetadataPath, file);
133
- if (!fs_extra_1.existsSync(filePath))
140
+ if (!fs_extra_1.existsSync(path_1.join(this.libraryPath, filePath)))
134
141
  return;
135
142
  const folderMeta = fs_extra_1.readJSONSync(filePath);
136
- if (!fs_extra_1.existsSync(folderMeta.localPath)) {
143
+ if (!fs_extra_1.existsSync(path_1.join(this.libraryPath, folderMeta.localPath))) {
137
144
  if (!utils_1.isFeatureEnabled(constants_1.FeaturesEnum.LIVESYNC_WCM_DELETE_FOLDER)) {
138
145
  logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_FOLDER_DISABLED', { 0: folderMeta.localPath }));
139
146
  return;
@@ -145,61 +152,85 @@ class PushWcmDesignLibrary {
145
152
  logger_1.logger.debug('Initial Sync - Folder Delete Function Completed');
146
153
  const componentsMetadataCollection = fs_extra_1.readdirSync(componentMetadataPath);
147
154
  const prensentationTemplateMetadataCollection = fs_extra_1.readdirSync(presentationTemplateMetadataPath);
155
+ const StyleSheetMetadataCollection = fs_extra_1.readdirSync(styleSheetMetadataPath);
148
156
  const deleteComponentJobs = componentsMetadataCollection.map((file) => __awaiter(this, void 0, void 0, function* () {
149
157
  const filePath = path_1.join(componentMetadataPath, file);
150
158
  const componentsMeta = fs_extra_1.readJSONSync(filePath);
151
- if (!fs_extra_1.existsSync(componentsMeta.localPath)) {
159
+ if (!fs_extra_1.existsSync(path_1.join(this.libraryPath, componentsMeta.localPath))) {
152
160
  const resp = yield htmlComponentWcmServices_1.deleteHtmlComponent(this.apiOptions, componentsMeta.id);
153
161
  if ([204, 404, 409].includes(resp.status)) {
154
162
  if (resp.status === 409) {
155
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_HTML_CONFLICT', { 0: componentsMeta.name }));
163
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_HTML_COMPONENT_CONFLICT', { 0: componentsMeta.name }));
156
164
  }
157
165
  try {
158
166
  fs.rmSync(filePath);
159
167
  logger_1.logger.info(utils_1.message('LIVESYNC_PUSH_WCM_ONGOING_SYNC_DELETE_HTML_COMPONENT', { 0: componentsMeta.name, 1: this.libraryMetaData.name }));
160
168
  }
161
169
  catch (err) {
162
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_DEFAULT', { 0: componentsMeta.name, 1: err }));
170
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_COMPONENT_DEFAULT', { 0: componentsMeta.name, 1: err }));
163
171
  }
164
172
  }
165
173
  else if (resp.status === 423) {
166
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_LOCKED_FILE', { 0: componentsMeta.name }));
174
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_COMPONENT_LOCKED_FILE', { 0: componentsMeta.name }));
167
175
  }
168
176
  else if (resp.status === 500) {
169
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_GENERIC', { 0: componentsMeta.name, 1: resp.statusText }));
177
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_COMPONENT_GENERIC', { 0: componentsMeta.name, 1: resp.statusText }));
170
178
  }
171
179
  }
172
180
  }));
173
181
  const deleteTemplateJobs = prensentationTemplateMetadataCollection.map((file) => __awaiter(this, void 0, void 0, function* () {
174
182
  const filePath = path_1.join(presentationTemplateMetadataPath, file);
175
183
  const templateMeta = fs_extra_1.readJSONSync(filePath);
176
- if (!fs_extra_1.existsSync(templateMeta.localPath)) {
184
+ if (!fs_extra_1.existsSync(path_1.join(this.libraryPath, templateMeta.localPath))) {
177
185
  const resp = yield presentationTemplateWcmServices_1.deletePresentationTemplate(this.apiOptions, templateMeta.id);
178
186
  if ([204, 404, 409].includes(resp.status)) {
179
187
  if (resp.status === 409) {
180
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_HTML_CONFLICT', { 0: templateMeta.name }));
188
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_PRESENTATION_TEMPLATE_CONFLICT', { 0: templateMeta.name }));
181
189
  }
182
190
  try {
183
191
  fs.rmSync(filePath);
184
192
  logger_1.logger.info(utils_1.message('LIVESYNC_PUSH_WCM_ONGOING_SYNC_DELETE_PRESENTATION_TEMPLATE', { 0: templateMeta.name, 1: this.libraryMetaData.name }));
185
193
  }
186
194
  catch (err) {
187
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_DEFAULT', { 0: templateMeta.name, 1: err }));
195
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_PRESENTATION_TEMPLATE_DEFAULT', { 0: templateMeta.name, 1: err }));
188
196
  }
189
197
  }
190
198
  else if (resp.status === 423) {
191
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_LOCKED_FILE', { 0: templateMeta.name }));
199
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_PRESENTATION_TEMPLATE_LOCKED_FILE', { 0: templateMeta.name }));
192
200
  }
193
201
  else if (resp.status === 500) {
194
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_HTML_GENERIC', { 0: templateMeta.name, 1: resp.statusText }));
202
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_PRESENTATION_TEMPLATE_GENERIC', { 0: templateMeta.name, 1: resp.statusText }));
195
203
  }
196
204
  }
197
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);
210
+ 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);
219
+ }
220
+ catch (e) {
221
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_STYLESHEET_COMPONENT_GENERIC', { 0: filePath, 1: e.message }));
222
+ }
223
+ }));
224
+ }
225
+ yield this.initialSync.syncFiles();
198
226
  return Promise.all(deleteComponentJobs).then(() => {
199
227
  logger_1.logger.debug('Initial Sync - Component Delete Function Completed');
200
228
  return Promise.all(deleteTemplateJobs).then(() => {
201
229
  logger_1.logger.debug('Initial Sync - Presentation Template Delete Function Completed');
202
- return true;
230
+ return Promise.all(deleteStyleSheetJobs).then(() => {
231
+ logger_1.logger.debug('Initial Sync - StyleSheet Delete Function Completed');
232
+ return true;
233
+ });
203
234
  });
204
235
  }).catch(() => { return false; });
205
236
  })).catch(() => { return false; });
@@ -216,7 +247,7 @@ class PushWcmDesignLibrary {
216
247
  if (!parentFolderMeta) {
217
248
  isDeleteSuccess = true;
218
249
  }
219
- else if (parentFolderMeta && !fs_extra_1.existsSync(parentFolderMeta.localPath)) {
250
+ else if (parentFolderMeta && !fs_extra_1.existsSync(path_1.join(this.libraryPath, parentFolderMeta.localPath))) {
220
251
  isDeleteSuccess = yield this.deleteRootMissingFolder(parentFolderMeta.parentID, parentID, parentFolderMeta.name);
221
252
  }
222
253
  else {
@@ -231,7 +262,7 @@ class PushWcmDesignLibrary {
231
262
  return true;
232
263
  }
233
264
  catch (err) {
234
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_FOLDER_DEFAULT', { 0: childName, 1: err }));
265
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_DELETE_FOLDER_DEFAULT', { 0: childName, 1: err.message }));
235
266
  }
236
267
  }
237
268
  else if (resp.status === 423) {
@@ -258,32 +289,62 @@ class PushWcmDesignLibrary {
258
289
  continue;
259
290
  }
260
291
  if (fileName === '.html') {
261
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: filePath }));
292
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: fileName, 1: filePath }));
262
293
  isSuccessful = false;
263
294
  break;
264
295
  }
265
296
  if (path_1.default.extname(filePath) === '.html') {
266
297
  try {
267
- yield this.pushHTMLFile(filePath);
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
+ }
268
310
  }
269
311
  catch (error) {
270
- logger_1.logger.error(`Error pushing HTML file ${filePath}: ${error.message}`);
312
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_GENERIC', { 0: filePath, 1: error.message }));
271
313
  isSuccessful = false;
272
314
  break;
273
315
  }
274
316
  }
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
+ }
335
+ }
275
336
  else if (fileStats.isDirectory()) {
276
337
  try {
277
338
  yield this.pushFolderComponent(filePath);
278
339
  }
279
340
  catch (error) {
280
- logger_1.logger.error(`Error pushing folder component ${filePath}: ${error.message}`);
341
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_GENERIC', { 0: filePath, 1: error.message }));
281
342
  isSuccessful = false;
282
343
  break;
283
344
  }
284
345
  }
285
346
  else {
286
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: filePath }));
347
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: fileName, 1: filePath }));
287
348
  isSuccessful = false;
288
349
  break;
289
350
  }
@@ -293,7 +354,7 @@ class PushWcmDesignLibrary {
293
354
  yield this.pushAll(filePath);
294
355
  }
295
356
  catch (error) {
296
- logger_1.logger.error(`Error processing directory ${filePath}: ${error.message}`);
357
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_GENERIC', { 0: filePath, 1: error.message }));
297
358
  isSuccessful = false;
298
359
  break;
299
360
  }
@@ -302,17 +363,26 @@ class PushWcmDesignLibrary {
302
363
  return isSuccessful;
303
364
  });
304
365
  }
305
- pushHTMLFile(filePath) {
366
+ pushHTMLFile(filePath, fileMeta) {
306
367
  return __awaiter(this, void 0, void 0, function* () {
307
368
  logger_1.logger.debug('Executing function Push WCM Design Library pushFile');
308
369
  const directoryPath = path_1.default.parse(filePath).dir;
309
370
  const directoryFileMeta = metadataServices_1.getSavedMetadata(this.libraryPath, directoryPath, PushWcmDesignLibrary.savedMetadata);
310
371
  const fileName = path_1.default.parse(filePath).name;
372
+ const relativeFilePath = path_1.default.relative(this.libraryPath, filePath);
311
373
  const libraryID = this.libraryMetaData.id;
312
374
  let parentID = directoryFileMeta ? directoryFileMeta.id : libraryID;
313
- const fileMeta = metadataServices_1.getSavedMetadata(this.libraryPath, filePath, PushWcmDesignLibrary.savedMetadata);
314
375
  const fileContent = fs_extra_1.readFileSync(filePath, 'utf8');
376
+ const wcmtype = livesyncUtils_1.getWCMType(filePath, this.libraryPath);
315
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
+ }
316
386
  let referenceUrl = '';
317
387
  if (this.apiOptions.virtualPortalContext) {
318
388
  referenceUrl = `${this.apiOptions.contenthandlerPath}/${this.apiOptions.virtualPortalContext}`;
@@ -330,7 +400,7 @@ class PushWcmDesignLibrary {
330
400
  let resp = { status: 999 };
331
401
  const type = livesyncUtils_1.getWCMType(filePath, this.libraryPath);
332
402
  if (!livesyncUtils_1.isTypeEnabled(type)) {
333
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: filePath }));
403
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: relativeFilePath }));
334
404
  return false;
335
405
  }
336
406
  let messageType;
@@ -346,7 +416,7 @@ class PushWcmDesignLibrary {
346
416
  messageType = 'PRESENTATION_TEMPLATE';
347
417
  break;
348
418
  default:
349
- logger_1.logger.debug(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: filePath }));
419
+ logger_1.logger.debug(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: relativeFilePath }));
350
420
  return false;
351
421
  }
352
422
  const data = JSON.stringify({
@@ -391,17 +461,17 @@ class PushWcmDesignLibrary {
391
461
  resp = yield presentationTemplateWcmServices_1.createPresentationTemplate(this.apiOptions, data);
392
462
  break;
393
463
  default:
394
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: filePath }));
464
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: relativeFilePath }));
395
465
  return false;
396
466
  }
397
467
  }
398
468
  else {
399
469
  if (fileContent === fileMeta.content.value) {
400
- logger_1.logger.debug('File content unchanged: %s', filePath);
470
+ logger_1.logger.debug('File content unchanged: %s', relativeFilePath);
401
471
  return true;
402
472
  }
403
473
  fileMeta.content.value = fileContent;
404
- const data = JSON.stringify({ entry: { content: fileMeta.content } });
474
+ const data = JSON.stringify({ entry: { author: fileMeta.author, owner: fileMeta.owner, content: fileMeta.content } });
405
475
  switch (type) {
406
476
  case 'LibraryHTMLComponent':
407
477
  messageType = 'HTML_COMPONENT';
@@ -412,7 +482,7 @@ class PushWcmDesignLibrary {
412
482
  resp = yield presentationTemplateWcmServices_1.updatePresentationTemplate(this.apiOptions, fileMeta.id, data);
413
483
  break;
414
484
  default:
415
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: filePath }));
485
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILE_TYPE', { 0: relativeFilePath }));
416
486
  return false;
417
487
  }
418
488
  parentID = fileMeta.parentID;
@@ -421,27 +491,27 @@ class PushWcmDesignLibrary {
421
491
  case 200:
422
492
  case 201:
423
493
  if (fileMeta && fileMeta.id !== resp.data.id) {
424
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_UPDATE_HTML_HAS_DRAFT', { 0: fileName }));
494
+ logger_1.logger.error(utils_1.errorMessage(`ERROR_LIVESYNC_PUSH_WCM_UPDATE_${messageType}_HAS_DRAFT`, { 0: relativeFilePath }));
425
495
  return false;
426
496
  }
427
497
  metadata = metadataServices_1.createMetadata(this.libraryPath, resp.data, parentID, libraryID);
428
- if (filePath !== metadata.localPath) {
429
- fs_extra_1.moveSync(filePath, metadata.localPath);
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);
430
500
  }
431
501
  PushWcmDesignLibrary.savedMetadata = metadataServices_1.saveMetadata(this.libraryPath, metadata, PushWcmDesignLibrary.savedMetadata);
432
- logger_1.logger.info(utils_1.message(`LIVESYNC_PUSH_WCM_ONGOING_SYNC_${fileIsNew ? 'CREATE' : 'UPDATE'}_${messageType}`, { 0: fileName, 1: this.libraryMetaData.name }));
502
+ logger_1.logger.info(utils_1.message(`LIVESYNC_PUSH_WCM_ONGOING_SYNC_${fileIsNew ? 'CREATE' : 'UPDATE'}_${messageType}`, { 0: relativeFilePath, 1: this.libraryMetaData.name }));
433
503
  return true;
434
504
  case 400:
435
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_CREATE_HTML_DEFAULT', { 0: fileName, 1: resp.statusText }));
505
+ logger_1.logger.error(utils_1.errorMessage(`ERROR_LIVESYNC_PUSH_WCM_${fileIsNew ? 'CREATE' : 'UPDATE'}_${messageType}_DEFAULT`, { 0: relativeFilePath, 1: resp.statusText }));
436
506
  return false;
437
507
  case 404:
438
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_UPDATE_HTML_NOTFOUND', { 0: fileName }));
508
+ logger_1.logger.error(utils_1.errorMessage(`ERROR_LIVESYNC_PUSH_WCM_${messageType}_NOTFOUND`, { 0: relativeFilePath }));
439
509
  return false;
440
510
  case 423:
441
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_HTML_LOCKED_FILE', { 0: fileName }));
511
+ logger_1.logger.error(utils_1.errorMessage(`ERROR_LIVESYNC_PUSH_WCM_${messageType}_LOCKED_FILE`, { 0: relativeFilePath }));
442
512
  return false;
443
513
  default:
444
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_UPDATE_HTML_DEFAULT', { 0: fileName, 1: resp.statusText }));
514
+ logger_1.logger.error(utils_1.errorMessage(`ERROR_LIVESYNC_PUSH_WCM_${fileIsNew ? 'CREATE' : 'UPDATE'}_${messageType}_DEFAULT`, { 0: relativeFilePath, 1: resp.statusText }));
445
515
  return false;
446
516
  }
447
517
  });
@@ -450,6 +520,7 @@ class PushWcmDesignLibrary {
450
520
  return __awaiter(this, void 0, void 0, function* () {
451
521
  logger_1.logger.debug('Executing function Push WCM Design Library pushFile');
452
522
  const fileName = path_1.default.parse(filePath).name;
523
+ const relativeFilePath = path_1.default.relative(this.libraryPath, filePath);
453
524
  const fileMeta = metadataServices_1.getSavedMetadata(this.libraryPath, filePath, PushWcmDesignLibrary.savedMetadata);
454
525
  const libraryID = this.libraryMetaData.id;
455
526
  const directoryPath = path_1.default.parse(filePath).dir;
@@ -475,8 +546,8 @@ class PushWcmDesignLibrary {
475
546
  resp = yield foldersWcmServices_1.createFolder(this.apiOptions, libraryID, JSON.stringify(data));
476
547
  }
477
548
  else {
478
- if (fileMeta.localPath === filePath) {
479
- logger_1.logger.debug('Folder unchanged: %s', filePath);
549
+ if (fileMeta.localPath === relativeFilePath) {
550
+ logger_1.logger.debug('Folder unchanged: %s', relativeFilePath);
480
551
  return true;
481
552
  }
482
553
  const cleanFolderMeta = Object.assign({}, fileMeta);
@@ -488,22 +559,22 @@ class PushWcmDesignLibrary {
488
559
  switch (resp.status) {
489
560
  case 200:
490
561
  case 201:
491
- resp.data.localPath = filePath;
562
+ resp.data.localPath = relativeFilePath;
492
563
  metadataServices_1.createMetadata(this.libraryPath, resp.data, parentID, libraryID);
493
564
  PushWcmDesignLibrary.savedMetadata = metadataServices_1.saveMetadata(this.libraryPath, resp.data, PushWcmDesignLibrary.getCache());
494
- logger_1.logger.info(utils_1.message(`LIVESYNC_PUSH_WCM_ONGOING_SYNC_${fileIsNew ? 'CREATE' : 'UPDATE'}_FOLDER`, { 0: fileName, 1: this.libraryMetaData.name }));
565
+ logger_1.logger.info(utils_1.message(`LIVESYNC_PUSH_WCM_ONGOING_SYNC_${fileIsNew ? 'CREATE' : 'UPDATE'}_FOLDER`, { 0: relativeFilePath, 1: this.libraryMetaData.name }));
495
566
  return true;
496
567
  case 400:
497
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INITIAL_SYNC_CREATE_FOLDER', { 0: fileName, 1: resp.statusText }));
568
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INITIAL_SYNC_CREATE_FOLDER', { 0: relativeFilePath, 1: resp.statusText }));
498
569
  return false;
499
570
  case 404:
500
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_UPDATE_FOLDER_NOTFOUND', { 0: fileName }));
571
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_UPDATE_FOLDER_NOTFOUND', { 0: relativeFilePath }));
501
572
  return false;
502
573
  case 423:
503
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_UPDATE_LOCKED_FOLDER', { 0: fileName }));
574
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_UPDATE_LOCKED_FOLDER', { 0: relativeFilePath }));
504
575
  return false;
505
576
  default:
506
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_CREATE_FOLDER_DEFAULT', { 0: fileName, 1: resp.statusText }));
577
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_CREATE_FOLDER_DEFAULT', { 0: relativeFilePath, 1: resp.statusText }));
507
578
  return false;
508
579
  }
509
580
  });
@@ -512,24 +583,38 @@ class PushWcmDesignLibrary {
512
583
  logger_1.logger.debug('Executing function Push WCM Design Library ongoingSync');
513
584
  let isSuccess = true;
514
585
  const { wcmLibraryPath } = cmdArgs;
586
+ const watchedPaths = [];
587
+ if (utils_1.isFeatureEnabled(constants_1.FeaturesEnum.LIVESYNC_WCM_HTML_COMPONENT)) {
588
+ watchedPaths.push(path_1.join(wcmLibraryPath, 'Components'));
589
+ }
590
+ if (utils_1.isFeatureEnabled(constants_1.FeaturesEnum.LIVESYNC_WCM_STYLE_SHEET) && watchedPaths.length === 0) {
591
+ watchedPaths.push(path_1.join(wcmLibraryPath, 'Components'));
592
+ }
593
+ if (utils_1.isFeatureEnabled(constants_1.FeaturesEnum.LIVESYNC_WCM_PRESENTATION_TEMPLATE)) {
594
+ watchedPaths.push(path_1.join(wcmLibraryPath, 'Presentation Templates'));
595
+ }
515
596
  const handlerProvider = {
516
597
  [constants_1.ChokidarEvent.ADD]: () => __awaiter(this, void 0, void 0, function* () {
517
598
  logger_1.logger.debug('File created');
518
599
  }),
519
600
  [constants_1.ChokidarEvent.ADD_HTML]: ongoingSyncServices_1.addWCMHtmlFileHandler,
601
+ [constants_1.ChokidarEvent.ADD_CSS]: ongoingSyncServices_1.addWCMCssFileHandler,
520
602
  [constants_1.ChokidarEvent.ADD_DIR]: ongoingSyncServices_1.addWCMFolderHandler,
521
603
  [constants_1.ChokidarEvent.CHANGE]: () => __awaiter(this, void 0, void 0, function* () {
522
604
  logger_1.logger.debug('Updated file event');
523
605
  }),
524
606
  [constants_1.ChokidarEvent.CHANGE_HTML]: ongoingSyncServices_1.updateWCMHtmlFileHandler,
607
+ [constants_1.ChokidarEvent.CHANGE_CSS]: ongoingSyncServices_1.updateWCMCssFileHandler,
525
608
  [constants_1.ChokidarEvent.CHANGE_DIR]: ongoingSyncServices_1.updateWCMFolderHandler,
526
609
  [constants_1.ChokidarEvent.UNLINK_HTML]: ongoingSyncServices_1.deleteWCMHtmlFileHandler,
610
+ [constants_1.ChokidarEvent.UNLINK_CSS]: ongoingSyncServices_1.deleteWCMCssFileHandler,
527
611
  [constants_1.ChokidarEvent.UNLINK_DIR]: ongoingSyncServices_1.deleteWCMFolderHandle,
528
612
  };
529
613
  this.eventsQueue = new EventsQueue_1.EventsQueue(handlerProvider);
530
614
  this.eventsQueue.initialize();
615
+ const mappedLibraryPath = utils_1.mapToHostPath(wcmLibraryPath, []);
531
616
  logger_1.logger.debug('Initializing chokidar watcher...');
532
- logger_1.logger.info(utils_1.message('LIVE_SYNC_START', { 0: wcmLibraryPath }));
617
+ logger_1.logger.info(utils_1.message('LIVE_SYNC_START', { 0: mappedLibraryPath }));
533
618
  const STABILITY_THRESHOLD = 100;
534
619
  const POLL_INTERVAL = 2000;
535
620
  const watchOptions = {
@@ -542,13 +627,13 @@ class PushWcmDesignLibrary {
542
627
  ignored: [...filesServices_1.fileServices.getIgnoredPaths(wcmLibraryPath), path_1.join(wcmLibraryPath, '.library')],
543
628
  };
544
629
  this.watcher = chokidar_1.default
545
- .watch(wcmLibraryPath, watchOptions)
630
+ .watch(watchedPaths, watchOptions)
546
631
  .on(constants_1.ChokidarEvent.ADD, (chokidarPath) => __awaiter(this, void 0, void 0, function* () {
547
632
  logger_1.logger.debug(`Detected file created: ${chokidarPath}`);
633
+ const fileType = path_1.default.extname(chokidarPath).toLocaleLowerCase();
548
634
  const fileName = path_1.default.parse(chokidarPath).name;
549
- const fileType = path_1.default.extname(chokidarPath);
550
- if (fileName === '.html' || fileType !== '.html') {
551
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: chokidarPath }));
635
+ if (!['.html', '.css'].includes(fileType)) {
636
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: fileName, 1: chokidarPath }));
552
637
  return;
553
638
  }
554
639
  const chokidarEventType = livesyncUtils_1.getEventByFileType(chokidarPath, constants_1.ChokidarEvent.ADD);
@@ -563,6 +648,16 @@ class PushWcmDesignLibrary {
563
648
  },
564
649
  });
565
650
  break;
651
+ case constants_1.ChokidarEvent.ADD_CSS:
652
+ this.eventsQueue.push({
653
+ cmdArgs,
654
+ chokidarEvent: chokidarEventType,
655
+ chokidarPath,
656
+ options: {
657
+ library: this.libraryMetaData,
658
+ },
659
+ });
660
+ break;
566
661
  case constants_1.ChokidarEvent.ADD:
567
662
  this.eventsQueue.push({ cmdArgs, chokidarEvent: chokidarEventType, chokidarPath });
568
663
  break;
@@ -584,10 +679,10 @@ class PushWcmDesignLibrary {
584
679
  }))
585
680
  .on(constants_1.ChokidarEvent.CHANGE, (chokidarPath) => __awaiter(this, void 0, void 0, function* () {
586
681
  logger_1.logger.debug(`Detected file updated: ${chokidarPath}`);
682
+ const fileType = path_1.default.extname(chokidarPath).toLocaleLowerCase();
587
683
  const fileName = path_1.default.parse(chokidarPath).name;
588
- const fileType = path_1.default.extname(chokidarPath);
589
- if (fileName === '.html' || fileType !== '.html') {
590
- logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: chokidarPath }));
684
+ if (!['.html', '.css'].includes(fileType)) {
685
+ logger_1.logger.error(utils_1.errorMessage('ERROR_LIVESYNC_PUSH_WCM_INVALID_FILENAME', { 0: fileName, 1: chokidarPath }));
591
686
  return;
592
687
  }
593
688
  const chokidarEventType = livesyncUtils_1.getEventByFileType(chokidarPath, constants_1.ChokidarEvent.CHANGE);
@@ -602,6 +697,16 @@ class PushWcmDesignLibrary {
602
697
  },
603
698
  });
604
699
  break;
700
+ case constants_1.ChokidarEvent.CHANGE_CSS:
701
+ this.eventsQueue.push({
702
+ cmdArgs,
703
+ chokidarEvent: chokidarEventType,
704
+ chokidarPath,
705
+ options: {
706
+ library: this.libraryMetaData,
707
+ },
708
+ });
709
+ break;
605
710
  case constants_1.ChokidarEvent.CHANGE:
606
711
  this.eventsQueue.push({ cmdArgs, chokidarEvent: chokidarEventType, chokidarPath });
607
712
  break;
@@ -627,25 +732,52 @@ class PushWcmDesignLibrary {
627
732
  });
628
733
  }))
629
734
  .on(constants_1.ChokidarEvent.UNLINK, (chokidarPath) => __awaiter(this, void 0, void 0, function* () {
630
- logger_1.logger.debug(`Detected file deleted: ${chokidarPath}`);
631
- const chokidarEventType = livesyncUtils_1.getEventByFileType(chokidarPath, constants_1.ChokidarEvent.UNLINK);
632
- switch (chokidarEventType) {
633
- case constants_1.ChokidarEvent.UNLINK_HTML:
634
- this.eventsQueue.push({
635
- cmdArgs,
636
- chokidarEvent: chokidarEventType,
637
- chokidarPath,
638
- options: {
639
- library: this.libraryMetaData,
640
- },
641
- });
642
- break;
643
- case constants_1.ChokidarEvent.UNLINK:
644
- this.eventsQueue.push({ cmdArgs, chokidarEvent: chokidarEventType, chokidarPath });
645
- break;
646
- default:
647
- logger_1.logger.debug(`Detected file delete: ${chokidarPath}`);
648
- break;
735
+ var _a;
736
+ try {
737
+ 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);
740
+ switch (chokidarEventType) {
741
+ case constants_1.ChokidarEvent.UNLINK_HTML:
742
+ let eventType = chokidarEventType;
743
+ if (!livesyncUtils_1.isTypeEnabled(livesyncUtils_1.getWCMType(chokidarPath, (_a = this.libraryPath) !== null && _a !== void 0 ? _a : '')) && fileMeta.type === 'LibraryStyleSheetComponent') {
744
+ eventType = constants_1.ChokidarEvent.UNLINK_CSS;
745
+ }
746
+ this.eventsQueue.push({
747
+ cmdArgs,
748
+ chokidarEvent: eventType,
749
+ chokidarPath,
750
+ options: {
751
+ library: this.libraryMetaData,
752
+ fileMeta,
753
+ },
754
+ });
755
+ break;
756
+ case constants_1.ChokidarEvent.UNLINK_CSS:
757
+ this.eventsQueue.push({
758
+ cmdArgs,
759
+ chokidarEvent: chokidarEventType,
760
+ chokidarPath,
761
+ options: {
762
+ library: this.libraryMetaData,
763
+ fileMeta,
764
+ },
765
+ });
766
+ break;
767
+ case constants_1.ChokidarEvent.UNLINK:
768
+ this.eventsQueue.push({ cmdArgs, chokidarEvent: chokidarEventType, chokidarPath });
769
+ break;
770
+ default:
771
+ logger_1.logger.debug(`Detected file delete: ${chokidarPath}`);
772
+ break;
773
+ }
774
+ }
775
+ catch (error) {
776
+ logger_1.logger.debug(error.message);
777
+ logger_1.logger.error(utils_1.errorMessage('ERROR_WCM_DESIGN_LIBRARY_PUSH_GENERIC', {
778
+ 0: chokidarPath,
779
+ 1: error.message,
780
+ }));
649
781
  }
650
782
  }))
651
783
  .on(constants_1.ChokidarEvent.UNLINK_DIR, (chokidarPath) => __awaiter(this, void 0, void 0, function* () {
@@ -686,16 +818,14 @@ class PushWcmDesignLibrary {
686
818
  yield this.eventsQueue.kill();
687
819
  }
688
820
  logger_1.logger.info(utils_1.message('LIVESYNC_RUN_CLEANUP_QUEUE'));
689
- const maxRetryCount = 60;
690
- const timeInterval = 1000;
691
821
  const waitForQueueToFinish = (retryCount = 0) => __awaiter(this, void 0, void 0, function* () {
692
822
  if (!this.eventsQueue.queue.running()) {
693
823
  return;
694
824
  }
695
- if (retryCount < maxRetryCount) {
825
+ if (retryCount < this.maxRetryCount) {
696
826
  logger_1.logger.debug('Waiting for queue process to finish...');
697
827
  yield new Promise((resolve) => {
698
- return setTimeout(resolve, timeInterval);
828
+ return setTimeout(resolve, this.timeInterval);
699
829
  });
700
830
  yield waitForQueueToFinish(retryCount + 1);
701
831
  }