@pega/custom-dx-components 8.8.16 → 8.8.18

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 (246) hide show
  1. package/.prettierrc.json +7 -1
  2. package/babel.config.cjs +13 -0
  3. package/jest.config.cjs +37 -0
  4. package/package.json +12 -4
  5. package/src/auth.js +9 -3
  6. package/src/cli.js +12 -0
  7. package/src/constants.js +9 -4
  8. package/src/currentPath.cjs +1 -0
  9. package/src/tasks/authenticate/index.js +43 -40
  10. package/src/tasks/build/helper.js +18 -31
  11. package/src/tasks/build/index.js +26 -6
  12. package/src/tasks/build-all/index.js +15 -3
  13. package/src/tasks/bundle/builder/index.js +5 -0
  14. package/src/tasks/bundle/builder/webpack.config.js +1 -3
  15. package/src/tasks/create/index.js +17 -7
  16. package/src/tasks/create/templates/Constellation/Field/Boolean/styles.js.mustache +13 -6
  17. package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +7 -7
  18. package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +8 -8
  19. package/src/tasks/create/templates/Constellation/Field/Date/styles.js.mustache +13 -6
  20. package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +10 -10
  21. package/src/tasks/create/templates/Constellation/Field/DateTime/date-utils.js.mustache +6 -5
  22. package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +6 -3
  23. package/src/tasks/create/templates/Constellation/Field/DateTime/styles.js.mustache +13 -6
  24. package/src/tasks/create/templates/Constellation/Field/Decimal/styles.js.mustache +13 -6
  25. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/styles.js.mustache +13 -6
  26. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/styles.js.mustache +13 -6
  27. package/src/tasks/create/templates/Constellation/Field/Integer/styles.js.mustache +13 -6
  28. package/src/tasks/create/templates/Constellation/Field/Picklist/styles.js.mustache +13 -6
  29. package/src/tasks/create/templates/Constellation/Field/Text/styles.js.mustache +13 -6
  30. package/src/tasks/create/templates/Constellation/Field/Text-Email/styles.js.mustache +13 -6
  31. package/src/tasks/create/templates/Constellation/Field/Text-Input/styles.js.mustache +13 -6
  32. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/styles.js.mustache +13 -6
  33. package/src/tasks/create/templates/Constellation/Field/Text-Phone/styles.js.mustache +13 -6
  34. package/src/tasks/create/templates/Constellation/Field/Text-URL/styles.js.mustache +13 -6
  35. package/src/tasks/create/templates/Constellation/Field/TimeOfDay/styles.js.mustache +13 -6
  36. package/src/tasks/create/templates/Constellation/Field/TimeOfDay/time-of-day.js.mustache +6 -5
  37. package/src/tasks/create/templates/Constellation/Template/DETAILS/styles.js.mustache +13 -6
  38. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/styles.js.mustache +13 -6
  39. package/src/tasks/create/templates/Constellation/Template/FORM/styles.js.mustache +13 -6
  40. package/src/tasks/create/templates/Constellation/Template/FORM-region/styles.js.mustache +13 -6
  41. package/src/tasks/create/templates/Constellation/Template/PAGE/styles.js.mustache +13 -6
  42. package/src/tasks/create/templates/Constellation/Widget/CASE/styles.js.mustache +13 -6
  43. package/src/tasks/create/templates/Constellation/Widget/PAGE/styles.js.mustache +13 -6
  44. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/styles.js.mustache +13 -6
  45. package/src/tasks/create-all/index.js +109 -150
  46. package/src/tasks/delete/helper.js +87 -53
  47. package/src/tasks/delete/index.js +8 -15
  48. package/src/tasks/delete-all/helper.js +132 -85
  49. package/src/tasks/delete-all/index.js +8 -15
  50. package/src/tasks/index.js +2 -0
  51. package/src/tasks/init/index.js +20 -22
  52. package/src/tasks/init/template/babel.config.cjs +13 -0
  53. package/src/tasks/init/template/jest.config.cjs +21 -0
  54. package/src/tasks/init/template/package.json.mustache +6 -4
  55. package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/config.json +55 -0
  56. package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/demo.stories.jsx +51 -0
  57. package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/index.jsx +60 -0
  58. package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/mock.stories.js +13 -0
  59. package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/styles.js +14 -0
  60. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/Boolean.js +38 -0
  61. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/boolean-format.js +26 -0
  62. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/config.json +145 -0
  63. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/demo.stories.jsx +61 -0
  64. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/event-utils.js +18 -0
  65. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/index.jsx +170 -0
  66. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/mock.stories.js +21 -0
  67. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/styles.js +14 -0
  68. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/OneColumnPage.svg +36 -0
  69. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/config.json +23 -0
  70. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/demo.stories.jsx +78 -0
  71. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/index.jsx +73 -0
  72. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/mock.stories.js +390 -0
  73. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/styles.js +14 -0
  74. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/config.json +291 -0
  75. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/demo.stories.jsx +53 -0
  76. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/event-utils.js +18 -0
  77. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/index.jsx +296 -0
  78. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/mock.stories.js +23 -0
  79. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/styles.js +14 -0
  80. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/suggestions-handler.js +10 -0
  81. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/DateFormatter.js +61 -0
  82. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/FormattedText.jsx +41 -0
  83. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/config.json +195 -0
  84. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/date.js +439 -0
  85. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/demo.stories.jsx +73 -0
  86. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/index.jsx +256 -0
  87. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/mock.stories.js +23 -0
  88. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/styles.js +14 -0
  89. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/suggestions-handler.js +10 -0
  90. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/config.json +256 -0
  91. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/date-time.js +92 -0
  92. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/date-utils.js +288 -0
  93. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/date.js +331 -0
  94. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/demo.stories.jsx +73 -0
  95. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/index.jsx +254 -0
  96. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/mock.stories.js +23 -0
  97. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/styles.js +14 -0
  98. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/suggestions-handler.js +10 -0
  99. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/config.json +278 -0
  100. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/demo.stories.jsx +49 -0
  101. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/event-utils.js +18 -0
  102. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/index.jsx +270 -0
  103. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/mock.stories.js +21 -0
  104. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/styles.js +14 -0
  105. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/suggestions-handler.js +10 -0
  106. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/OneColumnDetails.svg +22 -0
  107. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/StatusWork.jsx +26 -0
  108. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/config.json +35 -0
  109. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/demo.stories.jsx +132 -0
  110. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/index.jsx +83 -0
  111. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/mock.stories.js +189 -0
  112. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/styles.js +14 -0
  113. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/utils.js +152 -0
  114. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/config.json +111 -0
  115. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/demo.stories.jsx +48 -0
  116. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/event-utils.js +18 -0
  117. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/index.jsx +231 -0
  118. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/mock.stories.js +22 -0
  119. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/styles.js +14 -0
  120. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/suggestions-handler.js +10 -0
  121. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/DefaultForm.svg +29 -0
  122. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/config.json +45 -0
  123. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/demo.stories.jsx +166 -0
  124. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/index.jsx +42 -0
  125. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/mock.stories.js +137 -0
  126. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/styles.js +14 -0
  127. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/config.json +344 -0
  128. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/demo.stories.jsx +49 -0
  129. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/event-utils.js +18 -0
  130. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/index.jsx +333 -0
  131. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/mock.stories.js +21 -0
  132. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/styles.js +14 -0
  133. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/suggestions-handler.js +10 -0
  134. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/GetNextWork.jsx +35 -0
  135. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/OneColumnPage.svg +36 -0
  136. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/config.json +32 -0
  137. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/demo.stories.jsx +102 -0
  138. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/index.jsx +70 -0
  139. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/localizations.json +4 -0
  140. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/mock.stories.js +94 -0
  141. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/styles.js +14 -0
  142. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/utils.js +229 -0
  143. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/Avatar.jsx +75 -0
  144. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/OneColumnPage.svg +36 -0
  145. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/Operator.jsx +237 -0
  146. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/config.json +66 -0
  147. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/demo.stories.jsx +68 -0
  148. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/index.jsx +108 -0
  149. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/mock.stories.js +51 -0
  150. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/styles.js +14 -0
  151. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/OneColumnPage.svg +36 -0
  152. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/config.json +59 -0
  153. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/demo.stories.jsx +30 -0
  154. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/index.jsx +48 -0
  155. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/mock.stories.js +23 -0
  156. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/styles.js +14 -0
  157. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/config.json +111 -0
  158. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/demo.stories.jsx +48 -0
  159. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/event-utils.js +18 -0
  160. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/index.jsx +231 -0
  161. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/mock.stories.js +20 -0
  162. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/styles.js +14 -0
  163. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/suggestions-handler.js +10 -0
  164. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/config.json +93 -0
  165. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/demo.stories.jsx +49 -0
  166. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/event-utils.js +18 -0
  167. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/index.jsx +275 -0
  168. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/mock.stories.js +21 -0
  169. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/styles.js +14 -0
  170. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/suggestions-handler.js +10 -0
  171. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/config.json +123 -0
  172. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/demo.stories.jsx +46 -0
  173. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/event-utils.js +18 -0
  174. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/index.jsx +266 -0
  175. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/mock.stories.js +37 -0
  176. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/styles.js +14 -0
  177. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/suggestions-handler.js +10 -0
  178. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/config.json +114 -0
  179. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/demo.stories.jsx +78 -0
  180. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/event-utils.js +18 -0
  181. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/index.jsx +351 -0
  182. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/mock.stories.js +67 -0
  183. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/styles.js +14 -0
  184. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/suggestions-handler.js +10 -0
  185. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/config.json +55 -0
  186. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/demo.stories.jsx +51 -0
  187. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/index.jsx +60 -0
  188. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/mock.stories.js +13 -0
  189. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/styles.js +14 -0
  190. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/StatusWork.jsx +26 -0
  191. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/config.json +111 -0
  192. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/demo.stories.jsx +48 -0
  193. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/event-utils.js +18 -0
  194. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/index.jsx +239 -0
  195. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/mock.stories.js +21 -0
  196. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/styles.js +14 -0
  197. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/suggestions-handler.js +10 -0
  198. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/config.json +185 -0
  199. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/demo.stories.jsx +57 -0
  200. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/index.jsx +213 -0
  201. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/mock.stories.js +20 -0
  202. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/styles.js +14 -0
  203. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/suggestions-handler.js +10 -0
  204. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/time-of-day.js +288 -0
  205. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/StatusWork.jsx +26 -0
  206. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/TwoColumnDetails.svg +28 -0
  207. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/config.json +42 -0
  208. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/demo.stories.jsx +136 -0
  209. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/index.jsx +83 -0
  210. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/mock.stories.js +230 -0
  211. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/styles.js +14 -0
  212. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/utils.js +155 -0
  213. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/TwoColumn.svg +38 -0
  214. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/config.json +27 -0
  215. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/demo.stories.jsx +175 -0
  216. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/index.jsx +45 -0
  217. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/mock.stories.js +143 -0
  218. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/styles.js +14 -0
  219. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/config.json +237 -0
  220. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/demo.stories.jsx +46 -0
  221. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/event-utils.js +18 -0
  222. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/index.jsx +232 -0
  223. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/mock.stories.js +22 -0
  224. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/styles.js +14 -0
  225. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/suggestions-handler.js +10 -0
  226. package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/text-url.jsx +173 -0
  227. package/src/tasks/init/template/test/functionTest/localCreateAllListDeleteAll.test.js +157 -0
  228. package/src/tasks/init/template/test/functionTest/localCreateBuildAllDeleteAll.test.js +148 -0
  229. package/src/tasks/init/template/test/functionTest/localCreateBuildDelete.test.js +84 -0
  230. package/src/tasks/init/template/test/functionTest/localCreateListDelete.test.js +108 -0
  231. package/src/tasks/init/template/test/functionTest/localCreatePublishAllDeleteAll.test.js +148 -0
  232. package/src/tasks/init/template/test/functionTest/localCreatePublishDelete.test.js +84 -0
  233. package/src/tasks/init/template/test/functionTest/localCreateRenameDelete.test.js +84 -0
  234. package/src/tasks/init/template/test/functionTest/localPromoteRevertWP.test.js +59 -0
  235. package/src/tasks/list/helper.js +129 -61
  236. package/src/tasks/list/index.js +3 -4
  237. package/src/tasks/promote-webpack/index.js +126 -0
  238. package/src/tasks/promote-webpack/webpack.config.js +376 -0
  239. package/src/tasks/publish/helper.js +69 -80
  240. package/src/tasks/publish/index.js +29 -12
  241. package/src/tasks/publish-all/helper.js +66 -83
  242. package/src/tasks/publish-all/index.js +30 -18
  243. package/src/tasks/rename/index.js +127 -97
  244. package/src/tasks/revert-webpack/index.js +71 -0
  245. package/src/util.js +205 -108
  246. package/test/unitTest/util.test.js +544 -0
package/src/util.js CHANGED
@@ -2,20 +2,23 @@ import fs from 'fs';
2
2
  import { join } from 'path';
3
3
  import { promisify } from 'util';
4
4
  import https from 'https';
5
+ import crypto from 'node:crypto';
6
+ import { createRequire } from 'module';
5
7
 
6
8
  import chalk from 'chalk';
7
9
  import mustache from 'mustache';
8
10
  import pascalCase from 'pascalcase';
9
11
  import fetch from 'node-fetch';
10
- import { createRequire } from 'module';
11
-
12
+ import checkGit from 'check-git';
12
13
 
14
+ import * as currentPath from './currentPath.cjs';
13
15
  import {
14
16
  COMPONENTS_DIRECTORY_PATH,
15
17
  TASKS_CONFIG_JSON_FILENAME,
16
18
  TOKEN_PATH,
17
19
  OOTB_COMPONENT_SERVICE_REST_ENDPOINT,
18
20
  DELETE_COMPONENT_SERVICE_REST_ENDPOINT,
21
+ LP_DELETE_COMPONENT_SERVICE_REST_ENDPOINT,
19
22
  OOTB_COMPONENTS
20
23
  } from './constants.js';
21
24
 
@@ -27,14 +30,13 @@ export const checkPathAccess = async (path, options = {}) => {
27
30
  try {
28
31
  await access(path, fs.constants.R_OK);
29
32
  } catch (err) {
30
- const message =
31
- errorMessage || `${chalk.red.bold('ERROR')} Could not able to access path - ${path}`;
33
+ const message = errorMessage || `${chalk.red.bold('ERROR')} Could not able to access path - ${path}`;
32
34
  console.error(message);
33
35
  process.exit(1);
34
36
  }
35
37
  };
36
38
 
37
- export const deleteLocalComponent = async componentKey => {
39
+ export const deleteLocalComponent = async (componentKey) => {
38
40
  const currentDirectory = process.cwd();
39
41
  const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
40
42
 
@@ -44,25 +46,32 @@ export const deleteLocalComponent = async componentKey => {
44
46
  data = JSON.parse(data);
45
47
 
46
48
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
47
- console.error(
48
- `${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
49
- );
49
+ console.error(`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`);
50
50
  process.exit(1);
51
51
  }
52
52
 
53
53
  const directory = join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH], componentKey);
54
54
 
55
- fs.rm(directory, { recursive: true }, err => {
56
- if (err) {
57
- throw err;
58
- }
59
-
55
+ try {
56
+ fs.rmSync(directory, { recursive: true });
60
57
  console.log(`${chalk.red.bold(componentKey)} is deleted from Local`);
61
- });
58
+ } catch (err) {
59
+ console.log('no file');
60
+ throw new Error(`No such file ${componentKey}`);
61
+ }
62
62
  };
63
63
 
64
- export const deleteServerComponent = async componentKey => {
65
- const { server, user, password } = await getPegaServerConfig();
64
+ export const getHttpsAgent = (serverConfig) => {
65
+ const agentOptions = { rejectUnauthorized: false };
66
+ if (serverConfig.legacyTLS) {
67
+ agentOptions.secureOptions = crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT;
68
+ }
69
+ return new https.Agent(agentOptions);
70
+ };
71
+
72
+ export const deleteServerComponent = async (componentKey) => {
73
+ const serverConfig = await getPegaServerConfig();
74
+ const { server, user, password } = serverConfig;
66
75
  const url = constructCompleteUrl(server, DELETE_COMPONENT_SERVICE_REST_ENDPOINT);
67
76
  const [componentName, rulesetName, rulesetVersion] = componentKey.split('~|~');
68
77
  const deleteUrl = `${url}/${componentName}/rulesetname/${rulesetName}/rulesetversion/${rulesetVersion}`;
@@ -70,26 +79,20 @@ export const deleteServerComponent = async componentKey => {
70
79
  const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
71
80
 
72
81
  if (OauthData) {
73
- const {
74
- access_token: accessToken,
75
- token_type: tokenType,
76
- refresh_token: refreshToken
77
- } = JSON.parse(OauthData);
82
+ const { access_token: accessToken, token_type: tokenType, refresh_token: refreshToken } = JSON.parse(OauthData);
78
83
  fetch(deleteUrl, {
79
84
  method: 'DELETE',
80
- agent: new https.Agent({ rejectUnauthorized: false }),
85
+ agent: getHttpsAgent(serverConfig),
81
86
  headers: {
82
87
  Authorization: `${tokenType} ${accessToken}`
83
88
  }
84
89
  })
85
- .then(response => response.text())
86
- .then(resp => {
90
+ .then((response) => response.text())
91
+ .then((resp) => {
87
92
  let respData;
88
93
  try {
89
94
  respData = JSON.parse(resp);
90
-
91
- }
92
- catch (e) {
95
+ } catch (e) {
93
96
  console.log(chalk.bold.redBright(`Failure : ${resp}`));
94
97
  process.exit(1);
95
98
  }
@@ -99,17 +102,14 @@ export const deleteServerComponent = async componentKey => {
99
102
  } else {
100
103
  throw new Error(`${respData.message}`);
101
104
  }
102
-
103
-
104
105
  })
105
- .catch(e => Promise.reject(`${chalk.bold.red(e)}`));
106
+ .catch((e) => Promise.reject(`${chalk.bold.red(e)}`));
106
107
  }
107
108
  } catch (error) {
108
109
  console.log(`\n${chalk.bold.red(error)}`);
109
110
  }
110
111
  };
111
112
 
112
-
113
113
  export const getComponents = async () => {
114
114
  const currentDirectory = process.cwd();
115
115
  const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
@@ -117,66 +117,56 @@ export const getComponents = async () => {
117
117
  await checkPathAccess(pegaConfigJsonPath);
118
118
 
119
119
  let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
120
+
120
121
  data = JSON.parse(data);
121
122
 
122
123
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
123
- console.error(
124
- `${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
125
- );
124
+ console.error(`${chalk.red.bold('ERROR')} Could not find components directory path in config.json`);
126
125
  process.exit(1);
127
126
  }
128
127
 
129
128
  const directory = join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH]);
130
129
  return fs
131
130
  .readdirSync(directory, { withFileTypes: true })
132
- .filter(dirent => dirent.isDirectory())
133
- .map(dirent => dirent.name);
131
+ .filter((dirent) => dirent.isDirectory())
132
+ .map((dirent) => dirent.name);
134
133
  };
135
134
 
136
-
137
-
138
-
139
135
  export const getSubComponents = async (directory, type) => {
140
-
141
136
  const subDirectory = join(directory, type);
142
137
  return fs
143
- .readdirSync(subDirectory, { withFileTypes: true })
144
- .filter(dirent => dirent.isDirectory())
145
- .map(dirent => dirent.name);
146
- }
147
-
138
+ .readdirSync(subDirectory, { withFileTypes: true })
139
+ .filter((dirent) => dirent.isDirectory())
140
+ .map((dirent) => dirent.name);
141
+ };
148
142
 
149
143
  export const getDirectoryFiles = async (directory) => {
150
144
  return fs
151
- .readdirSync(directory, { withFileTypes: true })
152
- .filter(dirent => !dirent.isDirectory())
153
- .map(dirent => dirent.name);
154
- }
155
-
145
+ .readdirSync(directory, { withFileTypes: true })
146
+ .filter((dirent) => !dirent.isDirectory())
147
+ .map((dirent) => dirent.name);
148
+ };
156
149
 
157
150
  export const getComponentsObj = async () => {
151
+ const compList = [];
158
152
 
159
- let compList = new Array();
160
-
161
- //const componentList = await getDirectoryFiles(directory);
153
+ // const componentList = await getDirectoryFiles(directory);
162
154
  const componentList = await getComponents();
163
155
 
164
-
165
156
  if (componentList.length > 0) {
166
-
167
- compList.push(...componentList.map(
168
- name => {
157
+ compList.push(
158
+ ...componentList.map((name) => {
169
159
  const container = {};
170
160
  container.name = name;
171
161
  container.value = name;
172
162
 
173
163
  return container;
174
- }
175
- ));
164
+ })
165
+ );
176
166
  }
177
167
 
178
168
  return compList;
179
- }
169
+ };
180
170
 
181
171
  export const getPegaConfig = async () => {
182
172
  const currentDirectory = process.cwd();
@@ -200,7 +190,7 @@ export const getComponentDefaults = async () => {
200
190
  return config.component;
201
191
  };
202
192
 
203
- export const getComponentDirectoryPath = async componentKey => {
193
+ export const getComponentDirectoryPath = async (componentKey) => {
204
194
  const currentDirectory = process.cwd();
205
195
  const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
206
196
 
@@ -210,9 +200,7 @@ export const getComponentDirectoryPath = async componentKey => {
210
200
  data = JSON.parse(data);
211
201
 
212
202
  if (!data[COMPONENTS_DIRECTORY_PATH]) {
213
- console.error(
214
- `${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
215
- );
203
+ console.error(`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`);
216
204
  process.exit(1);
217
205
  }
218
206
 
@@ -224,11 +212,11 @@ export const compileMustacheTemplate = (file, data) => {
224
212
  return mustache.render(content, data);
225
213
  };
226
214
 
227
- export const isPascalCase = string => {
215
+ export const isPascalCase = (string) => {
228
216
  return string === pascalCase(string);
229
217
  };
230
218
 
231
- export const convertIntoPascalCase = string => {
219
+ export const convertIntoPascalCase = (string) => {
232
220
  return pascalCase(string);
233
221
  };
234
222
 
@@ -236,23 +224,7 @@ export const constructCompleteUrl = (baseServer, endPoint) => {
236
224
  return baseServer.endsWith('/') ? `${baseServer}${endPoint}` : `${baseServer}/${endPoint}`;
237
225
  };
238
226
 
239
- export const nodeFetch = (url, config) => {
240
- const { method, user, password, headers, ...restConfig } = config;
241
-
242
- if (url.startsWith('https')) restConfig.agent = new https.Agent({ rejectUnauthorized: false });
243
-
244
- return fetch(url, {
245
- method,
246
- ...restConfig,
247
- headers: {
248
- 'Content-Type': 'application/json;charset=utf-8',
249
- Authorization: `Basic ${Buffer.from(`${user}:${password}`).toString('base64')}`,
250
- ...headers
251
- }
252
- });
253
- };
254
-
255
- export const sanitize = str => {
227
+ export const sanitize = (str) => {
256
228
  /* Allow only numbers and case insensitive alphabets */
257
229
  str = str.replace(/[^a-zA-Z0-9 ]/g, '');
258
230
  /* spaces will be replaced by - */
@@ -260,13 +232,13 @@ export const sanitize = str => {
260
232
  return str;
261
233
  };
262
234
 
263
- export const validateSemver = str => {
235
+ export const validateSemver = (str) => {
264
236
  /* basic semver version validation - 0.0.1-dev */
265
237
  const regex = /^[0-9]\d*\.\d+\.\d+(?:-[a-zA-Z0-9]+)?$/g;
266
238
  return regex.test(str);
267
239
  };
268
240
 
269
- export const validateRulesetVersion = str => {
241
+ export const validateRulesetVersion = (str) => {
270
242
  /* Ruleset version range - 01-99 */
271
243
  if (str.indexOf('00') !== -1) {
272
244
  return false;
@@ -276,52 +248,62 @@ export const validateRulesetVersion = str => {
276
248
  return regex.test(str);
277
249
  };
278
250
 
251
+ export const standardizeStr = (str, length) => {
252
+ return str.padEnd(length);
253
+ };
254
+
279
255
  export const showVersion = () => {
280
256
  // get package version, so can display at start
281
- const require = createRequire(import.meta.url);
282
- const pData = require("@pega/custom-dx-components/package.json");
257
+ // const require = createRequire(import.meta.url);
258
+ const require = createRequire(currentPath.default);
283
259
 
284
- console.log(chalk.green("DX Component Builder v" + pData.version));
260
+ const pData = require('@pega/custom-dx-components/package.json');
261
+
262
+ console.log(chalk.green(`DX Component Builder v${pData.version}`));
285
263
 
286
264
  // do a check of node version, it should be 18 or greater
287
- const arNodeVersion = process.versions.node.split(".");
265
+ const arNodeVersion = process.versions.node.split('.');
288
266
 
289
267
  const nodeMajorVersion = parseInt(arNodeVersion[0]);
290
268
  const nodeMinorVersion = parseInt(arNodeVersion[1]);
291
269
 
292
270
  if (nodeMajorVersion < 18) {
293
- console.log(chalk.redBright("DX Component Builder - SDK requires node v18 or greater, current version: " + process.version));
271
+ console.log(chalk.redBright(`DX Component Builder - SDK requires node v18 or greater, current version: ${process.version}`));
272
+ process.exit(1);
273
+ }
274
+
275
+ const hasGit = checkGit(process.cwd());
276
+
277
+ if (!hasGit) {
278
+ console.log(chalk.redBright('DX Component Builder - SDK git to be installed.'));
294
279
  process.exit(1);
295
280
  }
296
281
  };
297
282
 
298
283
  export const getOOTBComponents = async () => {
299
- return new Promise((resolve, reject) => {
300
- fs.readFile(OOTB_COMPONENTS, 'utf-8', async (err, data) => {
301
- if (err) {
284
+ return new Promise((resolve) => {
285
+ fs.readFile(OOTB_COMPONENTS, 'utf-8', async (error, ootbComponentsData) => {
286
+ if (error) {
302
287
  try {
303
- const { server } = await getPegaServerConfig();
288
+ const serverConfig = await getPegaServerConfig();
289
+ const { server } = serverConfig;
304
290
  const url = constructCompleteUrl(server, OOTB_COMPONENT_SERVICE_REST_ENDPOINT);
305
291
  const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
306
292
  if (OauthData) {
307
- const {
308
- access_token: accessToken,
309
- token_type: tokenType,
310
- refresh_token: refreshToken
311
- } = JSON.parse(OauthData);
293
+ const { access_token: accessToken, token_type: tokenType } = JSON.parse(OauthData);
312
294
  fetch(url, {
313
295
  method: 'GET',
314
- agent: new https.Agent({ rejectUnauthorized: false }),
296
+ agent: getHttpsAgent(serverConfig),
315
297
  headers: {
316
298
  Authorization: `${tokenType} ${accessToken}`
317
299
  }
318
300
  })
319
- .then(response => response.text())
320
- .then(data => {
301
+ .then((response) => response.text())
302
+ .then((data) => {
321
303
  if (data.charAt() === '[') {
322
304
  data = data.slice(1, -1);
323
305
  data = data.replace(/\s/g, '');
324
- fs.writeFile(OOTB_COMPONENTS, data, err => {
306
+ fs.writeFile(OOTB_COMPONENTS, data, (err) => {
325
307
  if (err) {
326
308
  console.error(err);
327
309
  }
@@ -331,20 +313,135 @@ export const getOOTBComponents = async () => {
331
313
  data = JSON.parse(data);
332
314
  if (data && data.errors) {
333
315
  const errMessages = data.errors;
334
- errMessages.forEach(msgArr => {
316
+ errMessages.forEach((msgArr) => {
335
317
  throw new Error(`Failed with error - ${JSON.stringify(msgArr.message)}`);
336
318
  });
337
319
  }
338
320
  }
339
321
  })
340
- .catch(e => Promise.reject(`${chalk.bold.red(e)}`));
322
+ // eslint-disable-next-line prefer-promise-reject-errors
323
+ .catch((e) => Promise.reject(`${chalk.bold.red(e)}`));
341
324
  }
342
- } catch (error) {
343
- throw new Error('Error occurred in validation', error);
325
+ } catch (e) {
326
+ throw new Error('Error occurred in validation', e);
344
327
  }
345
328
  } else {
346
- resolve(data.split(','));
329
+ resolve(ootbComponentsData.split(','));
347
330
  }
348
331
  });
349
332
  });
350
333
  };
334
+
335
+ export const deleteInfinityServerComponent = async (componentKey) => {
336
+ const serverConfig = await getPegaServerConfig();
337
+ const { server } = serverConfig;
338
+ const url = constructCompleteUrl(server, DELETE_COMPONENT_SERVICE_REST_ENDPOINT);
339
+ const [componentName, rulesetName, rulesetVersion] = componentKey.split('~|~');
340
+ const deleteUrl = `${url}/${componentName}/rulesetname/${rulesetName}/rulesetversion/${rulesetVersion}`;
341
+ try {
342
+ const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
343
+
344
+ let status = 500;
345
+
346
+ if (OauthData) {
347
+ const { access_token: accessToken, token_type: tokenType } = JSON.parse(OauthData);
348
+ fetch(deleteUrl, {
349
+ method: 'DELETE',
350
+ agent: getHttpsAgent(serverConfig),
351
+ headers: {
352
+ Authorization: `${tokenType} ${accessToken}`
353
+ }
354
+ })
355
+ .then((response) => {
356
+ status = response.status;
357
+ return response.text();
358
+ })
359
+ .then((resp) => {
360
+ let respData;
361
+ try {
362
+ respData = JSON.parse(resp);
363
+ } catch (e) {
364
+ console.log(chalk.bold.redBright(`Failure : ${resp}`));
365
+ process.exit(1);
366
+ }
367
+
368
+ if (status === 200) {
369
+ console.log(chalk.bold.green(`Success : ${respData.message}`));
370
+ } else {
371
+ throw new Error(`${respData.message}`);
372
+ }
373
+ })
374
+ .catch((e) => {
375
+ if (status === 403) {
376
+ // eslint-disable-next-line prefer-promise-reject-errors
377
+ Promise.reject(`${chalk.bold.red('Error forbidden: User does not have privileges to Delete.')}`);
378
+ } else {
379
+ // eslint-disable-next-line prefer-promise-reject-errors
380
+ Promise.reject(`${chalk.bold.red(e)}`);
381
+ }
382
+ });
383
+ }
384
+ } catch (error) {
385
+ console.log(`\n${chalk.bold.red(error)}`);
386
+ }
387
+ };
388
+
389
+ export const deleteLaunchpadServerComponent = async (componentKey) => {
390
+ const { server, isolationId } = await getPegaServerConfig();
391
+ const deleteUrl = constructCompleteUrl(server, LP_DELETE_COMPONENT_SERVICE_REST_ENDPOINT.replace('{isolationId}', isolationId));
392
+ const [componentName] = componentKey.split('~|~');
393
+
394
+ try {
395
+ const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
396
+
397
+ let status = 500;
398
+
399
+ if (OauthData) {
400
+ const { access_token: accessToken, token_type: tokenType } = JSON.parse(OauthData);
401
+
402
+ const headers = {
403
+ Authorization: `${tokenType} ${accessToken}`,
404
+ cookie: `Pega-AAT=${accessToken}`,
405
+ 'Content-Type': 'application/json'
406
+ };
407
+
408
+ const apiBody = {
409
+ type: 'CustomComponent',
410
+ componentName
411
+ };
412
+
413
+ fetch(deleteUrl, {
414
+ method: 'DELETE',
415
+ agent: new https.Agent({ rejectUnauthorized: false }),
416
+ headers,
417
+ body: JSON.stringify(apiBody)
418
+ })
419
+ .then((response) => {
420
+ status = response.status;
421
+ return response.text();
422
+ })
423
+ .then((response) => {
424
+ if (status === 401) {
425
+ throw new Error('Error occurred in authentication. Please regenerate using authenticate');
426
+ // console.log(accessTokenUri, refreshToken);
427
+ /* TODO - Handle refresh_token */
428
+ } else if (status === 200 || status === 201) {
429
+ console.log(chalk.bold.green(`Success : ${response}`));
430
+ } else {
431
+ throw new Error(`${response.message}`);
432
+ }
433
+ })
434
+ .catch((e) => {
435
+ if (status === 403) {
436
+ // eslint-disable-next-line prefer-promise-reject-errors
437
+ Promise.reject(`${chalk.bold.red('Error forbidden: User does not have privileges to Delete.')}`);
438
+ } else {
439
+ // eslint-disable-next-line prefer-promise-reject-errors
440
+ Promise.reject(`${chalk.bold.red(e)}`);
441
+ }
442
+ });
443
+ }
444
+ } catch (error) {
445
+ console.log(`\n${chalk.bold.red(error)}`);
446
+ }
447
+ };