@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
@@ -0,0 +1,59 @@
1
+ // import { exec } from 'child_process';
2
+ const path = require('path');
3
+ const fs = require('fs');
4
+ const util = require('node:util');
5
+ const exec = util.promisify(require('node:child_process').exec);
6
+
7
+ describe('promote and revert webpack', () => {
8
+ it('npm run promoteWebPack', async () => {
9
+ const script = `npm run promoteWebPack`;
10
+
11
+ const { stdout, stderr } = await exec(script);
12
+ // console.log(stdout);
13
+ expect(stdout).not.toBeNull();
14
+ expect(stderr).not.toBeNull();
15
+
16
+ // want message to contain component name
17
+ expect(stdout).toContain('Bundler now using');
18
+ expect(stdout).toContain('webpack.config.js');
19
+
20
+ // utilize
21
+ expect(stdout).toContain('Utilize this file for webpack modifications.');
22
+
23
+ // verify new file exists
24
+ const webPackFile = path.resolve('webpack.config.js');
25
+
26
+ expect(fs.existsSync(webPackFile)).toBeTruthy();
27
+
28
+ // if (doesExist) {
29
+ // // remove it
30
+ // fs.rmdirSync(fileDir, { recursive: true });
31
+ // }
32
+ }, 10000);
33
+
34
+ it('npm run revertWebPack', async () => {
35
+ const script = `npm run revertWebPack`;
36
+
37
+ const { stdout, stderr } = await exec(script);
38
+ // console.log(stdout);
39
+ expect(stdout).not.toBeNull();
40
+ expect(stderr).not.toBeNull();
41
+
42
+ // want message to contain component name
43
+ expect(stdout).toContain('marked as not used.');
44
+ expect(stdout).toContain('webpack.config.js');
45
+
46
+ // message with bundler
47
+ expect(stdout).toContain('Bundler reverted to using internal webpack.config.js.');
48
+
49
+ // verify file marked as not used
50
+ const webPackFile = path.resolve('webpack.config.js.notused');
51
+
52
+ expect(fs.existsSync(webPackFile)).toBeTruthy();
53
+
54
+ // if (doesExist) {
55
+ // // remove it
56
+ // fs.rmdirSync(fileDir, { recursive: true });
57
+ // }
58
+ }, 10000);
59
+ });
@@ -1,18 +1,17 @@
1
1
  import fs from 'fs';
2
- import https from 'https';
3
2
 
4
3
  import chalk from 'chalk';
5
4
  import fetch from 'node-fetch';
6
5
 
7
- import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, LP_LIST_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH } from '../../constants.js';
8
- import { constructCompleteUrl, getComponents, getPegaServerConfig } from '../../util.js';
6
+ import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, LP_LIST_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH, COMPONENT_SCHEMA } from '../../constants.js';
7
+ import { constructCompleteUrl, getComponents, getPegaServerConfig, getHttpsAgent } from '../../util.js';
9
8
 
10
9
  export const SOURCE_OF_COMPONENT_TYPES = {
11
10
  SERVER: 'Server',
12
11
  LOCAL: 'Local'
13
12
  };
14
13
 
15
- export const getListComponentsQuestions = async (options, sourceOfComponentsOption) => {
14
+ export const getListComponentsQuestions = async (options) => {
16
15
  const defaultPegaServerConfig = await getPegaServerConfig();
17
16
 
18
17
  return [
@@ -29,9 +28,9 @@ export const getListComponentsQuestions = async (options, sourceOfComponentsOpti
29
28
  ];
30
29
  };
31
30
 
32
- export const listLocalComponents = async sourceOfComponents => {
31
+ export const listLocalComponents = async (sourceOfComponents) => {
33
32
  let localComponents = await getComponents();
34
- localComponents = localComponents.map(name => ({ 'Rule name': name }));
33
+ localComponents = localComponents.map((name) => ({ 'Rule name': name }));
35
34
  if (localComponents.length > 0) {
36
35
  console.log(chalk.bold.blueBright(`List of custom components in ${sourceOfComponents}`));
37
36
  console.table(localComponents, ['Rule name']);
@@ -40,91 +39,160 @@ export const listLocalComponents = async sourceOfComponents => {
40
39
  }
41
40
  };
42
41
 
43
- export const getComponentsFromServer = async data => {
42
+ async function fetchComponentsFromInfinity(apiUrl, headers) {
43
+ const serverConfig = await getPegaServerConfig();
44
+ return new Promise((resolve, reject) => {
45
+ let status = 500;
46
+ fetch(apiUrl, {
47
+ method: 'GET',
48
+ agent: getHttpsAgent(serverConfig),
49
+ headers
50
+ })
51
+ .then((response) => {
52
+ status = response.status;
53
+ return response.json();
54
+ })
55
+ .then((resp) => {
56
+ // const respData = JSON.parse(resp);
57
+ if (status === 401) {
58
+ throw new Error('Error occurred in authentication. Please regenerate using authenticate');
59
+ // console.log(accessTokenUri, refreshToken);
60
+ /* TODO - Handle refresh_token */
61
+ } else if (status === 200) {
62
+ resolve(resp);
63
+ } else {
64
+ throw new Error(`${resp.message}`);
65
+ }
66
+ })
67
+ // eslint-disable-next-line prefer-promise-reject-errors
68
+ .catch((e) => reject(`${chalk.bold.red(e)}`));
69
+ });
70
+ }
71
+
72
+ async function fetchComponentsFromLaunchpad(apiUrl, headers) {
73
+ const serverConfig = await getPegaServerConfig();
74
+ // constructing urls for all type of components
75
+ const urls = COMPONENT_SCHEMA.type.map((type) => apiUrl.replace('{type}', type.value));
76
+ const statuses = [];
77
+
78
+ return new Promise((resolve, reject) => {
79
+ Promise.all(
80
+ urls.map(async (url) => {
81
+ return fetch(url, {
82
+ method: 'GET',
83
+ agent: getHttpsAgent(serverConfig),
84
+ headers
85
+ });
86
+ })
87
+ )
88
+ .then((responses) => {
89
+ return Promise.all(
90
+ responses.map((res) => {
91
+ statuses.push(res.status);
92
+ if (res.status === 401 || res.status === 503) {
93
+ // Finding a 503 response is sometimes being returned from Launchpad in expired authentication scenario
94
+ throw new Error('Authorization error. Please regenerate using authenticate');
95
+ } else if (res.ok) {
96
+ return res.json();
97
+ } else {
98
+ throw new Error(`Unexpected Error ${res.status} encountered. ${res.message}`);
99
+ }
100
+ })
101
+ );
102
+ })
103
+ .then((data) => {
104
+ const components = data.map((res) => res.components).flat();
105
+ resolve(components);
106
+ })
107
+ // eslint-disable-next-line prefer-promise-reject-errors
108
+ .catch((e) => reject(`${chalk.bold.red(e)}`));
109
+ });
110
+ }
111
+
112
+ export const getComponentsFromServer = async () => {
44
113
  const defaultPegaServerConfig = await getPegaServerConfig();
45
114
  const isLaunchpad = defaultPegaServerConfig.serverType === 'launchpad';
46
115
  const url = constructCompleteUrl(
47
116
  defaultPegaServerConfig.server,
48
- isLaunchpad ? LP_LIST_COMPONENT_SERVICE_REST_ENDPOINT : LIST_COMPONENT_SERVICE_REST_ENDPOINT
117
+ isLaunchpad ? LP_LIST_COMPONENT_SERVICE_REST_ENDPOINT : LIST_COMPONENT_SERVICE_REST_ENDPOINT
49
118
  );
50
119
  return new Promise((resolve, reject) => {
51
120
  try {
52
121
  fs.readFile(TOKEN_PATH, 'utf8', (err, data) => {
53
122
  if (err) {
54
- reject(
55
- `\n${chalk.bold.red(
56
- 'Error occured in authentication. Please regenerate using authenticate'
57
- )}`
58
- );
123
+ // eslint-disable-next-line prefer-promise-reject-errors
124
+ reject(`\n${chalk.bold.red('Error occurred in authentication. Please regenerate using authenticate')}`);
59
125
  }
60
126
  if (data) {
61
- const {
62
- access_token: accessToken,
63
- token_type: tokenType,
64
- refresh_token: refreshToken
65
- } = JSON.parse(data);
66
- let status = 500;
67
-
68
- const headers = {
69
- Authorization: `${tokenType} ${accessToken}`
70
- }
127
+ const { access_token: accessToken, token_type: tokenType } = JSON.parse(data);
128
+
129
+ const headers = {};
71
130
 
72
- if(isLaunchpad) {
131
+ if (isLaunchpad) {
73
132
  headers.cookie = `Pega-AAT=${accessToken}`;
74
- }
75
133
 
76
- fetch(url, {
77
- method: 'GET',
78
- agent: new https.Agent({ rejectUnauthorized: false }),
79
- headers
80
- })
81
- .then(response => {
82
- status = response.status;
83
- return response.text();
84
- })
85
- .then(resp => {
86
- const respData = JSON.parse(resp);
87
- if (status === 401) {
88
- throw new Error(
89
- 'Error occured in authentication. Please regenerate using authenticate'
90
- );
91
- // console.log(accessTokenUri, refreshToken);
92
- /* TODO - Handle refresh_token */
93
- } else if (status == 200) {
94
- resolve(resp);
95
- } else {
96
- throw new Error(`${respData.message}`);
97
- }
98
- })
99
- .catch(e => reject(`${chalk.bold.red(e)}`));
134
+ fetchComponentsFromLaunchpad(url, headers)
135
+ .then((response) => resolve(response))
136
+ .catch((e) => reject(e));
137
+ } else {
138
+ headers.Authorization = `${tokenType} ${accessToken}`;
139
+
140
+ fetchComponentsFromInfinity(url, headers)
141
+ .then((response) => resolve(response))
142
+ .catch((e) => reject(e));
143
+ }
100
144
  }
101
145
  });
102
146
  } catch (error) {
103
147
  console.log(`\n${chalk.bold.red(error)}`);
148
+ // eslint-disable-next-line prefer-promise-reject-errors
104
149
  reject(`${chalk.bold.red(error)}`);
105
150
  }
106
151
  });
107
152
  };
108
153
 
109
- export const displayServerComponents = async data => {
154
+ export const displayServerComponents = async (data) => {
110
155
  const defaultPegaServerConfig = await getPegaServerConfig();
111
156
  const isLaunchpad = defaultPegaServerConfig.serverType === 'launchpad';
112
- const parsedData = JSON.parse(data);
113
- const list = isLaunchpad ? parsedData.components : parsedData.pxResults;
157
+ let list;
158
+ if (isLaunchpad) {
159
+ list = data;
160
+ } else {
161
+ try {
162
+ if (typeof data === 'object') {
163
+ list = data.pxResults;
164
+ } else {
165
+ list = JSON.parse(data).pxResults;
166
+ }
167
+ } catch (ex) {
168
+ /* empty */
169
+ }
170
+ }
114
171
  /**
115
172
  * TODO: Need to modify the components list mapping code to support Launchpad components
116
173
  */
117
- const componentList = list?.map(({ label, pyRuleSet, pyRuleSetVersion }) => ({
118
- 'Rule name': label,
119
- 'Ruleset name': pyRuleSet,
120
- 'Ruleset version': pyRuleSetVersion
121
- }));
174
+ const componentList = list?.map(({ label, pyRuleSet, pyRuleSetVersion, type }) => {
175
+ if (isLaunchpad) {
176
+ return {
177
+ 'Component Name': label,
178
+ Type: type
179
+ };
180
+ }
181
+
182
+ return {
183
+ 'Rule name': label,
184
+ 'Ruleset name': pyRuleSet,
185
+ 'Ruleset version': pyRuleSetVersion
186
+ };
187
+ });
122
188
 
123
189
  if (componentList && componentList.length > 0) {
124
- console.log(
125
- chalk.bold.blueBright(`List of custom components in ${defaultPegaServerConfig.server}`)
126
- );
127
- console.table(componentList, ['Rule name', 'Ruleset name', 'Ruleset version']);
190
+ console.log(chalk.bold.blueBright(`List of custom components in ${defaultPegaServerConfig.server}`));
191
+ if (isLaunchpad) {
192
+ console.table(componentList, ['Component Name', 'Type']);
193
+ } else {
194
+ console.table(componentList, ['Rule name', 'Ruleset name', 'Ruleset version']);
195
+ }
128
196
  } else {
129
197
  console.log(chalk.bold.redBright(`No custom components in ${defaultPegaServerConfig.server}`));
130
198
  }
@@ -1,6 +1,7 @@
1
1
  import inquirer from 'inquirer';
2
2
  import ora from 'ora';
3
- import chalk from 'chalk';
3
+
4
+ import { showVersion } from '../../util.js';
4
5
 
5
6
  import {
6
7
  listLocalComponents,
@@ -10,8 +11,6 @@ import {
10
11
  getListComponentsQuestions
11
12
  } from './helper.js';
12
13
 
13
- import { showVersion } from '../../util.js';
14
-
15
14
  const getList = async (sourceOfComponents, answers) => {
16
15
  switch (sourceOfComponents) {
17
16
  case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
@@ -33,7 +32,7 @@ const getList = async (sourceOfComponents, answers) => {
33
32
  }
34
33
  };
35
34
 
36
- export default async options => {
35
+ export default async (options) => {
37
36
  showVersion();
38
37
 
39
38
  let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
@@ -0,0 +1,126 @@
1
+
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import { join } from 'path';
5
+ import { URL, fileURLToPath } from 'url';
6
+ import chalk from 'chalk';
7
+ import inquirer from 'inquirer';
8
+
9
+ import {
10
+ convertIntoPascalCase,
11
+ checkPathAccess,
12
+ showVersion
13
+ } from '../../util.js';
14
+
15
+ import {
16
+ WEBPACK_CONFIG_JS_FILENAME,
17
+ WEBPACK_PATHS_JS_FILENAME,
18
+ PACKAGE_JSON_FILENAME,
19
+ BUILDER_INDEX_FILE_PATH,
20
+ BUILDER_DIR_FILE_PATH
21
+ } from '../../constants.js';
22
+
23
+
24
+
25
+ let redirectFile = "";
26
+
27
+ export const copyWebPack = async () => {
28
+
29
+ // first check to see if already have the file
30
+ const newWebPackConfigDir = path.resolve(WEBPACK_CONFIG_JS_FILENAME);
31
+ const newWebPackPathsDir = path.resolve(WEBPACK_PATHS_JS_FILENAME);
32
+ let override = true;
33
+ if (fs.existsSync(newWebPackConfigDir)) {
34
+
35
+ console.log("Promoted file " + chalk.bold.yellow(`${newWebPackConfigDir}`) + " already exists.");
36
+ const questions = [
37
+ {
38
+ name: 'override',
39
+ type: 'confirm',
40
+ message: `Overwrite`,
41
+ default: false
42
+ }
43
+ ];
44
+
45
+ await inquirer.prompt(questions).then(async answers => {
46
+ override = answers.override;
47
+ });
48
+
49
+ }
50
+
51
+
52
+ if (override) {
53
+
54
+ const currentDirectory = process.cwd();
55
+ const packageJsonPath = join(currentDirectory, PACKAGE_JSON_FILENAME);
56
+
57
+ await checkPathAccess(packageJsonPath);
58
+
59
+ let data = fs.readFileSync(packageJsonPath, { encoding: 'utf8' });
60
+ data = JSON.parse(data);
61
+
62
+ // if top level package.json is of type=module, then promote standard webpack.config.js that is being
63
+ // used in builder (along with paths.js file), otherwise promote the local copy in promote-webpack directory, which is a version
64
+ // modified to support "require" instead of "import" (and paths code is inside the webpack.config.js file)
65
+ if (data["type"] && data["type"] === "module") {
66
+ const builderIndexDir = fileURLToPath(new URL(BUILDER_DIR_FILE_PATH, import.meta.url));
67
+
68
+ const promoteWebPackConfigDir = path.resolve(path.join(builderIndexDir, WEBPACK_CONFIG_JS_FILENAME));
69
+ const promoteWebPackPathsDir = path.resolve(path.join(builderIndexDir, WEBPACK_PATHS_JS_FILENAME));
70
+
71
+ fs.copyFileSync(promoteWebPackConfigDir, newWebPackConfigDir);
72
+ fs.copyFileSync(promoteWebPackPathsDir, newWebPackPathsDir);
73
+ }
74
+ else {
75
+ const newWebPackDir = path.resolve(WEBPACK_CONFIG_JS_FILENAME);
76
+ const promoteWebPackDir = fileURLToPath(new URL(WEBPACK_CONFIG_JS_FILENAME, import.meta.url));
77
+
78
+ fs.copyFileSync(promoteWebPackDir, newWebPackDir);
79
+ }
80
+
81
+
82
+
83
+
84
+
85
+
86
+ }
87
+
88
+ redirectFile = newWebPackConfigDir;
89
+
90
+
91
+
92
+ }
93
+
94
+ export const updateBuilder = async () => {
95
+
96
+ const builderIndexDir = fileURLToPath(new URL(BUILDER_INDEX_FILE_PATH, import.meta.url));
97
+
98
+ let indexFileJS = fs.readFileSync(builderIndexDir, { encoding: 'utf8' });
99
+
100
+ if (indexFileJS.length > 0) {
101
+ // comment out original webpack reference
102
+
103
+ // if not commented out, comment out
104
+ if (indexFileJS.indexOf("// import configFactory from './webpack.config.js';") < 0) {
105
+ indexFileJS = indexFileJS.replaceAll("import configFactory from './webpack.config.js';", "// import configFactory from './webpack.config.js';");
106
+ }
107
+
108
+ // uncomment out promoted webpack reference
109
+ indexFileJS = indexFileJS.replaceAll("// import configFactory from '../../../../../../../webpack.config.js';", "import configFactory from '../../../../../../../webpack.config.js';");
110
+
111
+ fs.writeFileSync(builderIndexDir, indexFileJS, { encoding: 'utf8' });
112
+
113
+ console.log(chalk.bold.green(`Bundler now using ${redirectFile}.`));
114
+ console.log(chalk.bold.green(`Utilize this file for webpack modifications.`));
115
+ }
116
+
117
+
118
+ }
119
+
120
+ export default async options => {
121
+ showVersion();
122
+
123
+ await copyWebPack();
124
+ await updateBuilder();
125
+
126
+ };