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