@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,544 @@
1
+ import fs, {Dirent, constants} from 'fs';
2
+ import path from 'path';
3
+ import { join } from 'path';
4
+ import {expect, jest, test} from '@jest/globals';
5
+ import chalk from 'chalk';
6
+ import { createRequire } from 'module';
7
+
8
+ import fetch from 'node-fetch';
9
+
10
+ // const util = require('node:util');
11
+ import { exec } from 'child_process';
12
+
13
+ import {
14
+ deleteLocalComponent,
15
+ deleteInfinityServerComponent,
16
+ getComponents,
17
+ getSubComponents,
18
+ getDirectoryFiles,
19
+ getComponentsObj,
20
+ getPegaConfig,
21
+ getPegaServerConfig,
22
+ getComponentDefaults,
23
+ getComponentDirectoryPath,
24
+ convertIntoPascalCase,
25
+ isPascalCase,
26
+ constructCompleteUrl,
27
+ sanitize,
28
+ validateSemver,
29
+ validateRulesetVersion,
30
+ standardizeStr,
31
+ showVersion,
32
+ checkPathAccess
33
+ } from '../../src/util';
34
+
35
+
36
+ const mockAcces = {
37
+ TOKEN_PATH: '.access_token'
38
+ }
39
+
40
+ // should be overridden
41
+ let libraryName = "not valid";
42
+ let organizationName = "not valid";
43
+ let version = "not valid";
44
+
45
+ beforeAll( async () => {
46
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
47
+ const cwdMock = jest.spyOn(process, 'cwd');
48
+ cwdMock.mockReturnValue(thePath);
49
+
50
+
51
+ const oConf = await getPegaConfig();
52
+ libraryName = oConf.component.library;
53
+ version = oConf.component.version;
54
+
55
+
56
+
57
+ });
58
+
59
+ // describe('utils fetch', () => {
60
+ // let promiseStub = null;
61
+
62
+ // const fetchMessage = {
63
+ // message : "Pega_DXIL_MyTestText Component is successfully deleted"
64
+ // }
65
+
66
+ // beforeEach(() => {
67
+ // // Stub fetch response
68
+ // promiseStub = sinon.stub(fetch, "Promise");
69
+ // promiseStub.returns(
70
+ // Promise.resolve({ status: 200, json: () => Promise.resolve(fetchMessage) })
71
+ // );
72
+ // });
73
+
74
+ // afterAll(() => {
75
+ // promiseStub.restore();
76
+ // });
77
+
78
+ // afterEach(() => {
79
+ // sinon.restore();
80
+ // });
81
+
82
+ // it('deleteInfinityServerComponent', async () => {
83
+ // // remove node_module path if exists
84
+ // const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
85
+ // const cwdMock = jest.spyOn(process, 'cwd');
86
+ // cwdMock.mockReturnValue(thePath);
87
+
88
+ // const tokenPath = process.cwd();
89
+ // const logSpy = jest.spyOn(console, 'log');
90
+
91
+
92
+ // // global.fetch = jest.fn(() =>
93
+ // // Promise.resolve({
94
+ // // json: () => Promise.resolve({"message": " Pega_DXIL_MyTestText Component is successfully deleted","status":"200"}),
95
+ // // }),
96
+ // // );
97
+
98
+ // // const fetchMock = jest.spyOn(global, 'fetch').mockImplementation(() =>
99
+ // // Promise.resolve({ json: () => Promise.resolve({"message": " Pega_DXIL_MyTestText Component is successfully deleted","status":"200"}) } ));
100
+
101
+
102
+ // // const fetchMock = jest.spyOn(global, 'fetch').mockImplementation(() =>
103
+ // // new Promise((resolve) =>
104
+ // // resolve({status:"200", json: () => Promise.resolve(" Pega_DXIL_MyTestText Component is successfully deleted") }) ) );
105
+
106
+ // ////
107
+
108
+ // const mockResponse = {p_res: '{"test":"value"}', missingComponents: []}
109
+
110
+ // // stubbing fetch
111
+ // const stubbedFetch = sinon.stub(fetch, 'Promise').returns(Promise.resolve({ok:true, status: 200, json:() => Promise.resolve([{"test":"value"}])}))
112
+
113
+ // ////
114
+
115
+
116
+ // await deleteInfinityServerComponent("Pega_DXIL_MyTestText~|~LoanV2~|~01-01-01", ".access_token");
117
+
118
+
119
+ // expect(logSpy).toHaveBeenCalledWith('deleted');
120
+
121
+
122
+ // cwdMock.mockRestore();
123
+ // logSpy.mockRestore();
124
+ // tokenPathSpy.mockeRestore();
125
+
126
+
127
+ // });
128
+
129
+ // });
130
+
131
+ describe('utils test', () => {
132
+
133
+
134
+ it('checkPathAccess', async () => {
135
+ const logSpy = jest.spyOn(console, 'error')
136
+
137
+ // remove node_module path if exists
138
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
139
+
140
+ await checkPathAccess(thePath);
141
+
142
+ expect(logSpy).not.toBeCalled();
143
+
144
+ logSpy.mockRestore();
145
+
146
+
147
+ });
148
+
149
+ it('NOT checkPathAccess', async () => {
150
+ const logSpy = jest.spyOn(console, 'error')
151
+ const exitMock = jest.spyOn(process, 'exit').mockImplementation(() => {});
152
+
153
+ // remove node_module path if exists
154
+ const thePath = "/notExist";
155
+
156
+ await checkPathAccess(thePath);
157
+
158
+ expect(logSpy).toBeCalled();
159
+ expect(exitMock).toHaveBeenCalledWith(1);
160
+
161
+ logSpy.mockRestore();
162
+ exitMock.mockRestore();
163
+
164
+ });
165
+
166
+ it('getComponents', async () => {
167
+ const dir1 = new Dirent("directory1", constants.UV_DIRENT_DIR);
168
+ const dir2 = new Dirent("directory2", constants.UV_DIRENT_DIR);
169
+
170
+ // remove node_module path if exists
171
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
172
+ const cwdMock = jest.spyOn(process, 'cwd');
173
+ cwdMock.mockReturnValue(thePath);
174
+
175
+ const fsMock = jest.spyOn(fs, 'readdirSync');
176
+ fsMock.mockReturnValue([dir1, dir2]);
177
+
178
+
179
+ const compList = await getComponents();
180
+ expect(compList).not.toBeNull;
181
+ expect(compList).toMatchObject(['directory1', 'directory2']);
182
+
183
+ cwdMock.mockRestore();
184
+ fsMock.mockRestore();
185
+ });
186
+
187
+ it('NOT getComponents', async () => {
188
+ const dir1 = new Dirent("directory1", constants.UV_DIRENT_DIR);
189
+ const dir2 = new Dirent("directory2", constants.UV_DIRENT_DIR);
190
+
191
+ // remove node_module path if exists
192
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
193
+ const cwdMock = jest.spyOn(process, 'cwd');
194
+ cwdMock.mockReturnValue(thePath);
195
+
196
+ const logSpy = jest.spyOn(console, 'error')
197
+ const exitMock = jest.spyOn(process, 'exit').mockImplementation(() => { throw new Error('bad')});
198
+
199
+ const fsMock = jest.spyOn(fs, 'readdirSync');
200
+ fsMock.mockReturnValue([dir1, dir2]);
201
+
202
+ const fsFileMock = jest.spyOn(fs, 'readFileSync');
203
+ fsFileMock.mockReturnValue("{}");
204
+
205
+ try {
206
+ const compList = await getComponents();
207
+ }
208
+ catch (error) {
209
+ expect(logSpy).toBeCalled();
210
+ expect(exitMock).toHaveBeenCalledWith(1);
211
+ }
212
+
213
+
214
+ fsMock.mockRestore();
215
+ fsFileMock.mockRestore();
216
+ exitMock.mockRestore();
217
+ logSpy.mockRestore();
218
+ cwdMock.mockRestore();
219
+
220
+
221
+ });
222
+
223
+
224
+
225
+ it('getSubComponents', async () => {
226
+ const dir1 = new Dirent("directory1", constants.UV_DIRENT_DIR);
227
+ const dir2 = new Dirent("directory2", constants.UV_DIRENT_DIR);
228
+
229
+ // remove node_module path if exists
230
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
231
+ const cwdMock = jest.spyOn(process, 'cwd');
232
+ cwdMock.mockReturnValue(thePath);
233
+
234
+ const fsMock = jest.spyOn(fs, 'readdirSync');
235
+ fsMock.mockReturnValue([dir1, dir2]);
236
+
237
+ const compList = await getSubComponents("/main", "/sub");
238
+ expect(compList).not.toBeNull;
239
+ expect(compList).toMatchObject(['directory1', 'directory2']);
240
+
241
+
242
+ fsMock.mockRestore();
243
+ cwdMock.mockRestore();
244
+ });
245
+
246
+ it('getDirectoryFiles', async () => {
247
+ const file1 = new Dirent("file1", constants.UV_DIRENT_FILE);
248
+ const file2 = new Dirent("file2", constants.UV_DIRENT_FILE);
249
+
250
+ // remove node_module path if exists
251
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
252
+ const cwdMock = jest.spyOn(process, 'cwd');
253
+ cwdMock.mockReturnValue(thePath);
254
+
255
+ const fsMock = jest.spyOn(fs, 'readdirSync');
256
+ fsMock.mockReturnValue([file1, file2]);
257
+
258
+ const compList = await getDirectoryFiles("/main");
259
+ expect(compList).not.toBeNull;
260
+ expect(compList).toMatchObject(['file1', 'file2']);
261
+
262
+
263
+ fsMock.mockRestore();
264
+ cwdMock.mockRestore();
265
+ });
266
+
267
+ it('getComponentsObj', async () => {
268
+ const dir1 = new Dirent("directory1", constants.UV_DIRENT_DIR);
269
+ const dir2 = new Dirent("directory2", constants.UV_DIRENT_DIR);
270
+
271
+ // remove node_module path if exists
272
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
273
+ const cwdMock = jest.spyOn(process, 'cwd');
274
+ cwdMock.mockReturnValue(thePath);
275
+
276
+ const fsMock = jest.spyOn(fs, 'readdirSync');
277
+ fsMock.mockReturnValue([dir1, dir2]);
278
+
279
+ const compList = await getComponentsObj();
280
+ expect(compList).not.toBeNull;
281
+ expect(compList).toMatchObject([{"name": "directory1","value": "directory1"},{"name": "directory2","value": "directory2"}]);
282
+
283
+
284
+ fsMock.mockRestore();
285
+ cwdMock.mockRestore();
286
+ });
287
+
288
+ it('getPegaConfig', async () => {
289
+
290
+ // remove node_module path if exists
291
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
292
+ const cwdMock = jest.spyOn(process, 'cwd');
293
+ cwdMock.mockReturnValue(thePath);
294
+
295
+ const oConf = await getPegaConfig();
296
+
297
+ const sPath = oConf["components-directory-path"];
298
+
299
+ expect(oConf).not.toBeNull;
300
+ expect(sPath).toMatch('src/components');
301
+ expect(oConf.component.library).toMatch(libraryName);
302
+ expect(oConf.component.version).toMatch(version);
303
+
304
+ cwdMock.mockRestore();
305
+
306
+ });
307
+
308
+ it('getPegaServerConfig', async () => {
309
+ // remove node_module path if exists
310
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
311
+ const cwdMock = jest.spyOn(process, 'cwd');
312
+ cwdMock.mockReturnValue(thePath);
313
+
314
+ const oConf = await getPegaServerConfig();
315
+
316
+ expect(oConf).not.toBeNull;
317
+
318
+ expect(oConf.sourceOfComponents).toMatch('Server');
319
+ expect(oConf.serverType).toMatch('infinity');
320
+ expect(oConf.clientId).toMatch('10095186356008396159');
321
+ expect(oConf.grantType).toMatch('authCode');
322
+ expect(oConf.redirectUri).toMatch('https://localhost:4010');
323
+ expect(oConf.authService).toMatch('pega');
324
+
325
+ cwdMock.mockRestore();
326
+
327
+ });
328
+
329
+ it('getComponentDefaults', async () => {
330
+
331
+ // remove node_module path if exists
332
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
333
+ const cwdMock = jest.spyOn(process, 'cwd');
334
+ cwdMock.mockReturnValue(thePath);
335
+
336
+ const oConf = await getComponentDefaults();
337
+
338
+ expect(oConf).not.toBeNull;
339
+ expect(oConf.library).toMatch(libraryName);
340
+ expect(oConf.version).toMatch(version);
341
+
342
+ cwdMock.mockRestore();
343
+
344
+ });
345
+
346
+ it('getComponentDirectoryPath', async () => {
347
+
348
+ // remove node_module path if exists
349
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
350
+ const cwdMock = jest.spyOn(process, 'cwd');
351
+ cwdMock.mockReturnValue(thePath);
352
+
353
+ const sPath = await getComponentDirectoryPath("Pega_DXIL_MyTestText");
354
+
355
+ expect(sPath).not.toBeNull;
356
+ expect(sPath).toContain('/src/components/Pega_DXIL_MyTestText');
357
+
358
+ cwdMock.mockRestore();
359
+
360
+ });
361
+
362
+ it('NOT getComponentDirectoryPath', async () => {
363
+
364
+ // remove node_module path if exists
365
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
366
+ const cwdMock = jest.spyOn(process, 'cwd');
367
+ cwdMock.mockReturnValue(thePath);
368
+
369
+ const logSpy = jest.spyOn(console, 'error')
370
+ const exitMock = jest.spyOn(process, 'exit').mockImplementation(() => { throw new Error('bad')});
371
+
372
+ const fsFileMock = jest.spyOn(fs, 'readFileSync');
373
+ fsFileMock.mockReturnValue("{}");
374
+
375
+ try {
376
+ const sPath = await getComponentDirectoryPath("Pega_DXIL_MyTestText");
377
+ }
378
+ catch (error) {
379
+ expect(logSpy).toBeCalled();
380
+ expect(exitMock).toHaveBeenCalledWith(1);
381
+ }
382
+
383
+ fsFileMock.mockRestore();
384
+ exitMock.mockRestore();
385
+ logSpy.mockRestore();
386
+ cwdMock.mockRestore();
387
+
388
+ });
389
+
390
+ test('convertIntoPascalCase', () => {
391
+ const response = convertIntoPascalCase("Pega_DXIL_MyTestText");
392
+ expect(response).toMatch("PegaDxilMyTestText");
393
+
394
+ });
395
+
396
+ test('isPascalCase', () => {
397
+ const isPascal = isPascalCase("PegaDxilMyTestText");
398
+ expect(isPascal).toBeTruthy();
399
+
400
+ });
401
+
402
+ test('NOT isPascalCase', () => {
403
+ const isPascal = isPascalCase("Pega_DXIL_MyTestText");
404
+ expect(isPascal).not.toBeTruthy();
405
+
406
+ });
407
+
408
+ test('NOT constructCompleteUrl', () => {
409
+ const sUrl = constructCompleteUrl("/user", "myDir/myData");
410
+ expect(sUrl).toMatch("/user/myDir/myData");
411
+
412
+ });
413
+
414
+
415
+ test('sanitize', () => {
416
+ const sUrl = sanitize("%&*^abc123%*%^&*");
417
+ expect(sUrl).toMatch("abc123");
418
+
419
+ });
420
+
421
+
422
+ test('validateSemver', () => {
423
+ const bValid = validateSemver("0.0.1");
424
+ expect(bValid).toBeTruthy();
425
+
426
+ });
427
+
428
+ test('NOT validateSemver', () => {
429
+ const bValid = validateSemver("0.0.1abc");
430
+ expect(bValid).not.toBeTruthy();
431
+
432
+ });
433
+
434
+
435
+ test('validateRulesetVersion', () => {
436
+ const bValid = validateRulesetVersion("01-01-01");
437
+ expect(bValid).toBeTruthy();
438
+
439
+ });
440
+
441
+ test('NOT validateRulesetVersion', () => {
442
+ const bValid = validateRulesetVersion("01-01-01abc");
443
+ expect(bValid).not.toBeTruthy();
444
+
445
+ });
446
+
447
+ test('NOT validateRulesetVersion 00', () => {
448
+ const bValid = validateRulesetVersion("00-01-01");
449
+ expect(bValid).not.toBeTruthy();
450
+
451
+ });
452
+
453
+ test('standardizeStr', () => {
454
+ const sStr = standardizeStr("abcd", 10);
455
+ expect(sStr).toMatch("abcd ");
456
+
457
+ });
458
+
459
+
460
+ it('NOT deleteLocalComponent', async () => {
461
+ // remove node_module path if exists
462
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
463
+ const cwdMock = jest.spyOn(process, 'cwd');
464
+ cwdMock.mockReturnValue(thePath);
465
+
466
+ const logSpy = jest.spyOn(console, 'error')
467
+ const exitMock = jest.spyOn(process, 'exit').mockImplementation(() => { throw new Error('bad')});
468
+
469
+ const fsFileMock = jest.spyOn(fs, 'readFileSync');
470
+ fsFileMock.mockReturnValue("{}");
471
+
472
+ try {
473
+ await deleteLocalComponent("Pega_DXIL_MyTestText");
474
+ }
475
+ catch (error) {
476
+ expect(logSpy).toBeCalled();
477
+ expect(exitMock).toHaveBeenCalledWith(1);
478
+ }
479
+
480
+ fsFileMock.mockRestore();
481
+ exitMock.mockRestore();
482
+ logSpy.mockRestore();
483
+ cwdMock.mockRestore();
484
+
485
+ });
486
+
487
+ it('Not deleteLocalComponent no file', async () => {
488
+ // remove node_module path if exists
489
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
490
+ const cwdMock = jest.spyOn(process, 'cwd');
491
+ cwdMock.mockReturnValue(thePath);
492
+
493
+ try {
494
+ await deleteLocalComponent("Pega_DXIL_MyTestText");
495
+ }
496
+ catch (error) {
497
+ expect(error).not.toBeNull();
498
+ expect(error.toString()).toMatch("Error: No such file Pega_DXIL_MyTestText");
499
+ }
500
+
501
+
502
+
503
+ cwdMock.mockRestore();
504
+
505
+ });
506
+
507
+ it('deleteLocalComponent', async () => {
508
+ // remove node_module path if exists
509
+ const thePath = process.cwd().replace("node_modules/@pega/custom-dx-components","");
510
+ const cwdMock = jest.spyOn(process, 'cwd');
511
+ cwdMock.mockReturnValue(thePath);
512
+
513
+ const logSpy = jest.spyOn(console, 'log')
514
+ const rmSyncMock = jest.spyOn(fs, 'rmSync').mockImplementation(() => { });
515
+
516
+ await deleteLocalComponent("Pega_DXIL_MyTestText");
517
+ expect(logSpy).toHaveBeenCalled();
518
+ expect(logSpy).toHaveBeenCalledWith(`${chalk.red.bold("Pega_DXIL_MyTestText")} is deleted from Local`);
519
+
520
+ cwdMock.mockRestore();
521
+ logSpy.mockRestore();
522
+ rmSyncMock.mockRestore();
523
+
524
+ });
525
+
526
+
527
+
528
+
529
+
530
+ // test('showVersion', () => {
531
+ // const logSpy = jest.spyOn(console, 'log')
532
+
533
+ // const require = createRequire(import.meta.url);
534
+ // const pData = require("@pega/custom-dx-components/package.json");
535
+
536
+ // showVersion();
537
+
538
+ // expect(logSpy).toHaveBeenCalledWith(chalk.green("DX Component Builder v" + pData.version));
539
+
540
+ // logSpy.mockRestore();
541
+ // })
542
+
543
+
544
+ });