@pega/custom-dx-components 8.8.17 → 8.8.19
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.
- package/.prettierrc.json +7 -1
- package/babel.config.cjs +13 -0
- package/jest.config.cjs +37 -0
- package/package.json +12 -4
- package/src/auth.js +9 -3
- package/src/constants.js +7 -5
- package/src/currentPath.cjs +1 -0
- package/src/tasks/authenticate/index.js +43 -40
- package/src/tasks/build/helper.js +18 -31
- package/src/tasks/build/index.js +26 -6
- package/src/tasks/build-all/index.js +15 -3
- package/src/tasks/bundle/builder/index.js +1 -1
- package/src/tasks/bundle/builder/webpack.config.js +1 -3
- package/src/tasks/create/index.js +17 -7
- package/src/tasks/create/templates/Constellation/Field/Boolean/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +7 -7
- package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +8 -8
- package/src/tasks/create/templates/Constellation/Field/Date/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +10 -10
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-utils.js.mustache +6 -5
- package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +6 -3
- package/src/tasks/create/templates/Constellation/Field/DateTime/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Decimal/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Integer/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Picklist/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Text/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Text-Email/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Text-Input/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/Text-URL/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/TimeOfDay/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Field/TimeOfDay/time-of-day.js.mustache +6 -5
- package/src/tasks/create/templates/Constellation/Template/DETAILS/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Template/FORM/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Template/FORM-region/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Template/PAGE/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Widget/CASE/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Widget/PAGE/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/styles.js.mustache +13 -6
- package/src/tasks/create-all/index.js +109 -150
- package/src/tasks/delete/helper.js +87 -53
- package/src/tasks/delete/index.js +8 -15
- package/src/tasks/delete-all/helper.js +132 -85
- package/src/tasks/delete-all/index.js +8 -15
- package/src/tasks/init/index.js +20 -22
- package/src/tasks/init/template/.storybook/package.json +1 -0
- package/src/tasks/init/template/babel.config.cjs +13 -0
- package/src/tasks/init/template/jest.config.cjs +21 -0
- package/src/tasks/init/template/package.json.mustache +6 -4
- package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/config.json +55 -0
- package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/demo.stories.jsx +51 -0
- package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/index.jsx +60 -0
- package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/mock.stories.js +13 -0
- package/src/tasks/init/template/test/assets/components/create/Pega_DXIL_MyTestText/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/Boolean.js +38 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/boolean-format.js +26 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/config.json +145 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/demo.stories.jsx +61 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/index.jsx +170 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/mock.stories.js +21 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyBoolean/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/OneColumnPage.svg +36 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/config.json +23 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/demo.stories.jsx +78 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/index.jsx +73 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/mock.stories.js +390 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCaseWidget/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/config.json +291 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/demo.stories.jsx +53 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/index.jsx +296 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/mock.stories.js +23 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyCurrency/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/DateFormatter.js +61 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/FormattedText.jsx +41 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/config.json +195 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/date.js +439 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/demo.stories.jsx +73 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/index.jsx +256 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/mock.stories.js +23 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDate/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/config.json +256 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/date-time.js +92 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/date-utils.js +288 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/date.js +331 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/demo.stories.jsx +73 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/index.jsx +254 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/mock.stories.js +23 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDateTime/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/config.json +278 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/demo.stories.jsx +49 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/index.jsx +270 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/mock.stories.js +21 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDecimal/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/OneColumnDetails.svg +22 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/StatusWork.jsx +26 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/config.json +35 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/demo.stories.jsx +132 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/index.jsx +83 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/mock.stories.js +189 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyDetails/utils.js +152 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/config.json +111 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/demo.stories.jsx +48 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/index.jsx +231 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/mock.stories.js +22 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyEmail/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/DefaultForm.svg +29 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/config.json +45 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/demo.stories.jsx +166 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/index.jsx +42 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/mock.stories.js +137 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyForm/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/config.json +344 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/demo.stories.jsx +49 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/index.jsx +333 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/mock.stories.js +21 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyInteger/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/GetNextWork.jsx +35 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/OneColumnPage.svg +36 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/config.json +32 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/demo.stories.jsx +102 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/index.jsx +70 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/localizations.json +4 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/mock.stories.js +94 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPage/utils.js +229 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/Avatar.jsx +75 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/OneColumnPage.svg +36 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/Operator.jsx +237 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/config.json +66 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/demo.stories.jsx +68 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/index.jsx +108 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/mock.stories.js +51 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageCaseWidget/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/OneColumnPage.svg +36 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/config.json +59 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/demo.stories.jsx +30 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/index.jsx +48 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/mock.stories.js +23 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPageWidget/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/config.json +111 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/demo.stories.jsx +48 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/index.jsx +231 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/mock.stories.js +20 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyParagraph/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/config.json +93 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/demo.stories.jsx +49 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/index.jsx +275 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/mock.stories.js +21 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPercentage/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/config.json +123 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/demo.stories.jsx +46 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/index.jsx +266 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/mock.stories.js +37 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPhone/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/config.json +114 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/demo.stories.jsx +78 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/index.jsx +351 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/mock.stories.js +67 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyPicklist/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/config.json +55 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/demo.stories.jsx +51 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/index.jsx +60 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/mock.stories.js +13 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyText/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/StatusWork.jsx +26 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/config.json +111 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/demo.stories.jsx +48 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/index.jsx +239 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/mock.stories.js +21 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTextInput/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/config.json +185 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/demo.stories.jsx +57 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/index.jsx +213 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/mock.stories.js +20 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTimeOfDay/time-of-day.js +288 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/StatusWork.jsx +26 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/TwoColumnDetails.svg +28 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/config.json +42 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/demo.stories.jsx +136 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/index.jsx +83 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/mock.stories.js +230 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnDetails/utils.js +155 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/TwoColumn.svg +38 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/config.json +27 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/demo.stories.jsx +175 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/index.jsx +45 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/mock.stories.js +143 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyTwoColumnForm/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/config.json +237 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/demo.stories.jsx +46 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/event-utils.js +18 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/index.jsx +232 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/mock.stories.js +22 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/styles.js +14 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/suggestions-handler.js +10 -0
- package/src/tasks/init/template/test/assets/components/createAll/Pega_DXIL_MyURL/text-url.jsx +173 -0
- package/src/tasks/init/template/test/functionTest/localCreateAllListDeleteAll.test.js +157 -0
- package/src/tasks/init/template/test/functionTest/localCreateBuildAllDeleteAll.test.js +148 -0
- package/src/tasks/init/template/test/functionTest/localCreateBuildDelete.test.js +84 -0
- package/src/tasks/init/template/test/functionTest/localCreateListDelete.test.js +108 -0
- package/src/tasks/init/template/test/functionTest/localCreatePublishAllDeleteAll.test.js +148 -0
- package/src/tasks/init/template/test/functionTest/localCreatePublishDelete.test.js +84 -0
- package/src/tasks/init/template/test/functionTest/localCreateRenameDelete.test.js +84 -0
- package/src/tasks/init/template/test/functionTest/localPromoteRevertWP.test.js +59 -0
- package/src/tasks/list/helper.js +129 -61
- package/src/tasks/list/index.js +3 -4
- package/src/tasks/promote-webpack/index.js +45 -13
- package/src/tasks/publish/helper.js +69 -89
- package/src/tasks/publish/index.js +29 -12
- package/src/tasks/publish-all/helper.js +66 -92
- package/src/tasks/publish-all/index.js +30 -18
- package/src/tasks/rename/index.js +127 -97
- package/src/tasks/revert-webpack/index.js +4 -4
- package/src/util.js +205 -127
- package/test/unitTest/util.test.js +544 -0
- /package/src/tasks/init/template/.storybook/{main.js → main.cjs} +0 -0
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
// utilizing theming, comment out, if want individual style
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Configuration } from '@pega/cosmos-react-core';
|
|
2
4
|
|
|
3
|
-
export default styled
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export default styled(Configuration)``;
|
|
6
|
+
|
|
7
|
+
// individual style, comment out above, and uncomment here and add styles
|
|
8
|
+
// import styled, { css } from 'styled-components';
|
|
9
|
+
//
|
|
10
|
+
// export default styled.div(() => {
|
|
11
|
+
// return css`
|
|
12
|
+
// margin: 0px 0;
|
|
13
|
+
// `;
|
|
14
|
+
// });
|
|
@@ -22,51 +22,32 @@ import {
|
|
|
22
22
|
sanitize,
|
|
23
23
|
validateSemver
|
|
24
24
|
} from '../../util.js';
|
|
25
|
-
import {
|
|
26
|
-
COMPONENT_SCHEMA,
|
|
27
|
-
COMPONENTS_DIRECTORY_PATH,
|
|
28
|
-
TASKS_CONFIG_JSON_FILENAME,
|
|
29
|
-
COMPONENTS_PATH,
|
|
30
|
-
CATEGORY_CONSTELLATION
|
|
31
|
-
} from '../../constants.js';
|
|
25
|
+
import { COMPONENT_SCHEMA, COMPONENTS_DIRECTORY_PATH, TASKS_CONFIG_JSON_FILENAME, COMPONENTS_PATH, CATEGORY_CONSTELLATION } from '../../constants.js';
|
|
32
26
|
|
|
33
27
|
const pegaConfigJsonPath = path.join(path.resolve(), TASKS_CONFIG_JSON_FILENAME);
|
|
34
28
|
|
|
35
29
|
const copy = promisify(ncp);
|
|
36
30
|
|
|
37
|
-
const copyComponentTemplate = async options => {
|
|
31
|
+
const copyComponentTemplate = async (options) => {
|
|
38
32
|
if (options.targetDirectory) {
|
|
39
33
|
return copy(options.templateDirectory, options.targetDirectory, {
|
|
40
34
|
clobber: false
|
|
41
35
|
});
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
36
|
+
} else {
|
|
44
37
|
return copy(options.templateDirectoryConstellation, options.targetDirectoryConstellation, {
|
|
45
38
|
clobber: false,
|
|
46
39
|
filter: (fileName) => {
|
|
47
40
|
// filter out the file config.json or config.json.mustache
|
|
48
|
-
if (fileName.indexOf(
|
|
41
|
+
if (fileName.indexOf('config.json') >= 0) return false;
|
|
49
42
|
else return true;
|
|
50
43
|
}
|
|
51
44
|
});
|
|
52
45
|
}
|
|
53
|
-
|
|
54
46
|
};
|
|
55
47
|
|
|
56
48
|
export const compileMustacheTemplates = async (
|
|
57
49
|
componentDirectory,
|
|
58
|
-
{
|
|
59
|
-
componentKey,
|
|
60
|
-
componentName,
|
|
61
|
-
componentLabel,
|
|
62
|
-
library,
|
|
63
|
-
version,
|
|
64
|
-
type,
|
|
65
|
-
subtype,
|
|
66
|
-
description,
|
|
67
|
-
organization,
|
|
68
|
-
allowedApplications
|
|
69
|
-
}
|
|
50
|
+
{ componentKey, componentName, componentLabel, library, version, type, subtype, description, organization, allowedApplications }
|
|
70
51
|
) => {
|
|
71
52
|
const files = fs.readdirSync(componentDirectory);
|
|
72
53
|
const componentClassName = convertIntoPascalCase(componentKey);
|
|
@@ -83,19 +64,18 @@ export const compileMustacheTemplates = async (
|
|
|
83
64
|
let mustacheSubType = subtype;
|
|
84
65
|
|
|
85
66
|
// overrides
|
|
86
|
-
if (typeof
|
|
67
|
+
if (typeof mustacheSubType == 'string') {
|
|
87
68
|
switch (mustacheSubType) {
|
|
88
|
-
case
|
|
89
|
-
mustacheSubType =
|
|
69
|
+
case 'FORM-region':
|
|
70
|
+
mustacheSubType = 'FORM';
|
|
90
71
|
break;
|
|
91
|
-
case
|
|
92
|
-
mustacheSubType =
|
|
72
|
+
case 'DETAILS-region':
|
|
73
|
+
mustacheSubType = 'DETAILS';
|
|
93
74
|
break;
|
|
94
|
-
case
|
|
95
|
-
mustacheSubType =
|
|
75
|
+
case 'Text-Input':
|
|
76
|
+
mustacheSubType = 'Text';
|
|
96
77
|
break;
|
|
97
78
|
}
|
|
98
|
-
|
|
99
79
|
}
|
|
100
80
|
|
|
101
81
|
if (allowedApplications.trim() === '') {
|
|
@@ -107,8 +87,8 @@ export const compileMustacheTemplates = async (
|
|
|
107
87
|
allowedApplications = [].concat(allowedApplications);
|
|
108
88
|
}
|
|
109
89
|
|
|
110
|
-
allowedApplications = allowedApplications.filter(el => !!el.trim()).map(el => el.trim());
|
|
111
|
-
files.forEach(file => {
|
|
90
|
+
allowedApplications = allowedApplications.filter((el) => !!el.trim()).map((el) => el.trim());
|
|
91
|
+
files.forEach((file) => {
|
|
112
92
|
const filePath = path.join(componentDirectory, file);
|
|
113
93
|
|
|
114
94
|
const output = compileMustacheTemplate(filePath, {
|
|
@@ -133,27 +113,14 @@ export const compileMustacheTemplates = async (
|
|
|
133
113
|
});
|
|
134
114
|
};
|
|
135
115
|
|
|
136
|
-
|
|
137
|
-
export const validateCompileAll = async (
|
|
138
|
-
{
|
|
139
|
-
prefix,
|
|
140
|
-
library,
|
|
141
|
-
version,
|
|
142
|
-
allowedApplications,
|
|
143
|
-
organization
|
|
144
|
-
},
|
|
145
|
-
options,
|
|
146
|
-
|
|
147
|
-
) => {
|
|
148
|
-
|
|
149
|
-
|
|
116
|
+
export const validateCompileAll = async ({ prefix, library, version, allowedApplications, organization }, options) => {
|
|
150
117
|
for (let fieldIdx in COMPONENT_SCHEMA.subtype.field) {
|
|
151
|
-
const type =
|
|
118
|
+
const type = 'Field';
|
|
152
119
|
const subtype = COMPONENT_SCHEMA.subtype.field[fieldIdx].value;
|
|
153
120
|
const prefixNoSpace = prefix.replace(/\s+/g, '');
|
|
154
121
|
const componentNameNoSpace = COMPONENT_SCHEMA.subtype.field[fieldIdx].name.replace(/\s+/g, '');
|
|
155
|
-
const componentName =
|
|
156
|
-
const componentLabel =
|
|
122
|
+
const componentName = ''.concat(prefixNoSpace).concat(componentNameNoSpace);
|
|
123
|
+
const componentLabel = ''.concat(prefix).concat(' ').concat(COMPONENT_SCHEMA.subtype.field[fieldIdx].name);
|
|
157
124
|
const description = componentLabel;
|
|
158
125
|
|
|
159
126
|
await validateCompile(
|
|
@@ -169,23 +136,23 @@ export const validateCompileAll = async (
|
|
|
169
136
|
allowedApplications
|
|
170
137
|
},
|
|
171
138
|
options
|
|
172
|
-
)
|
|
139
|
+
);
|
|
173
140
|
}
|
|
174
141
|
|
|
175
142
|
for (let templateIdx in COMPONENT_SCHEMA.subtype.template) {
|
|
176
|
-
const type =
|
|
143
|
+
const type = 'Template';
|
|
177
144
|
const subtype = COMPONENT_SCHEMA.subtype.template[templateIdx].value;
|
|
178
145
|
const prefixNoSpace = prefix.replace(/\s+/g, '');
|
|
179
|
-
let templateNameOriginal
|
|
180
|
-
let templateName =
|
|
146
|
+
let templateNameOriginal = COMPONENT_SCHEMA.subtype.template[templateIdx].name;
|
|
147
|
+
let templateName = convertIntoPascalCase(COMPONENT_SCHEMA.subtype.template[templateIdx].name);
|
|
181
148
|
let templateLabel = convertIntoPascalCase(COMPONENT_SCHEMA.subtype.template[templateIdx].name);
|
|
182
|
-
if (templateNameOriginal.indexOf(
|
|
183
|
-
let templateNameBase = convertIntoPascalCase(templateNameOriginal.replace(
|
|
184
|
-
templateName =
|
|
185
|
-
templateLabel =
|
|
149
|
+
if (templateNameOriginal.indexOf('region') >= 0) {
|
|
150
|
+
let templateNameBase = convertIntoPascalCase(templateNameOriginal.replace(' region', ''));
|
|
151
|
+
templateName = 'TwoColumn'.concat(templateNameBase);
|
|
152
|
+
templateLabel = 'Two Column '.concat(templateNameBase);
|
|
186
153
|
}
|
|
187
|
-
const componentName =
|
|
188
|
-
const componentLabel =
|
|
154
|
+
const componentName = ''.concat(prefixNoSpace).concat(templateName);
|
|
155
|
+
const componentLabel = ''.concat(prefix).concat(' ').concat(templateLabel);
|
|
189
156
|
const description = componentLabel;
|
|
190
157
|
|
|
191
158
|
await validateCompile(
|
|
@@ -201,22 +168,21 @@ export const validateCompileAll = async (
|
|
|
201
168
|
allowedApplications
|
|
202
169
|
},
|
|
203
170
|
options
|
|
204
|
-
)
|
|
171
|
+
);
|
|
205
172
|
}
|
|
206
173
|
|
|
207
|
-
|
|
208
174
|
for (let widgetIdx in COMPONENT_SCHEMA.subtype.widget) {
|
|
209
|
-
const type =
|
|
175
|
+
const type = 'Widget';
|
|
210
176
|
const subtype = COMPONENT_SCHEMA.subtype.widget[widgetIdx].value;
|
|
211
177
|
const prefixNoSpace = prefix.replace(/\s+/g, '');
|
|
212
|
-
let widgetNameOriginal
|
|
213
|
-
let widgetName = convertIntoPascalCase(COMPONENT_SCHEMA.subtype.widget[widgetIdx].name).concat(
|
|
214
|
-
let widgetLabel = convertIntoPascalCase(COMPONENT_SCHEMA.subtype.widget[widgetIdx].name).concat(
|
|
215
|
-
if (widgetName.indexOf(
|
|
216
|
-
widgetName = convertIntoPascalCase(widgetNameOriginal.replace(
|
|
178
|
+
let widgetNameOriginal = COMPONENT_SCHEMA.subtype.widget[widgetIdx].name;
|
|
179
|
+
let widgetName = convertIntoPascalCase(COMPONENT_SCHEMA.subtype.widget[widgetIdx].name).concat('Widget');
|
|
180
|
+
let widgetLabel = convertIntoPascalCase(COMPONENT_SCHEMA.subtype.widget[widgetIdx].name).concat(' Widget');
|
|
181
|
+
if (widgetName.indexOf('&') >= 0) {
|
|
182
|
+
widgetName = convertIntoPascalCase(widgetNameOriginal.replace(' & ', ''));
|
|
217
183
|
}
|
|
218
|
-
const componentName =
|
|
219
|
-
const componentLabel =
|
|
184
|
+
const componentName = ''.concat(prefixNoSpace).concat(widgetName);
|
|
185
|
+
const componentLabel = ''.concat(prefix).concat(' ').concat(widgetLabel);
|
|
220
186
|
const description = componentLabel;
|
|
221
187
|
|
|
222
188
|
await validateCompile(
|
|
@@ -232,32 +198,17 @@ export const validateCompileAll = async (
|
|
|
232
198
|
allowedApplications
|
|
233
199
|
},
|
|
234
200
|
options
|
|
235
|
-
)
|
|
201
|
+
);
|
|
236
202
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
|
|
203
|
+
};
|
|
241
204
|
|
|
242
205
|
export const validateCompile = async (
|
|
243
|
-
{
|
|
244
|
-
library,
|
|
245
|
-
organization,
|
|
246
|
-
componentName,
|
|
247
|
-
componentLabel,
|
|
248
|
-
version,
|
|
249
|
-
framework,
|
|
250
|
-
type,
|
|
251
|
-
subtype,
|
|
252
|
-
description,
|
|
253
|
-
allowedApplications
|
|
254
|
-
},
|
|
206
|
+
{ library, organization, componentName, componentLabel, version, framework, type, subtype, description, allowedApplications },
|
|
255
207
|
options
|
|
256
208
|
) => {
|
|
257
|
-
|
|
258
209
|
let sSubType = subtype;
|
|
259
210
|
if (Array.isArray(subtype)) {
|
|
260
|
-
sSubType = subtype.join(
|
|
211
|
+
sSubType = subtype.join('-');
|
|
261
212
|
}
|
|
262
213
|
|
|
263
214
|
const typeLC = type.toLowerCase();
|
|
@@ -269,10 +220,9 @@ export const validateCompile = async (
|
|
|
269
220
|
let pegaConfig = await getPegaConfig();
|
|
270
221
|
let templateParentDir = `./templates/${framework}`;
|
|
271
222
|
|
|
272
|
-
|
|
273
223
|
const templateDir = `${templateParentDir}/${type}/${sSubType}`;
|
|
274
224
|
let templateDirectory = fileURLToPath(new URL(templateDir, import.meta.url));
|
|
275
|
-
templateDirectory = templateDirectory.replace(
|
|
225
|
+
templateDirectory = templateDirectory.replace(path.sep + 'create-all', path.sep + 'create');
|
|
276
226
|
|
|
277
227
|
const componentKey = `${organization}_${library}_${componentName}`;
|
|
278
228
|
|
|
@@ -280,7 +230,6 @@ export const validateCompile = async (
|
|
|
280
230
|
|
|
281
231
|
const components = await getComponents(false);
|
|
282
232
|
|
|
283
|
-
|
|
284
233
|
if (components.includes(componentKey)) {
|
|
285
234
|
console.log(chalk.red(`${componentKey} component already exists in ${targetDirectory}`));
|
|
286
235
|
|
|
@@ -306,14 +255,10 @@ export const validateCompile = async (
|
|
|
306
255
|
allowedApplications
|
|
307
256
|
});
|
|
308
257
|
|
|
309
|
-
|
|
310
258
|
console.log(chalk.green(`created ${componentKey} component in ${targetDirectory}`));
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
259
|
};
|
|
315
260
|
|
|
316
|
-
export default async options => {
|
|
261
|
+
export default async (options) => {
|
|
317
262
|
showVersion();
|
|
318
263
|
|
|
319
264
|
await checkPathAccess(pegaConfigJsonPath);
|
|
@@ -322,67 +267,27 @@ export default async options => {
|
|
|
322
267
|
data = data && JSON.parse(data);
|
|
323
268
|
|
|
324
269
|
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
325
|
-
console.error(
|
|
326
|
-
`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
|
|
327
|
-
);
|
|
270
|
+
console.error(`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`);
|
|
328
271
|
process.exit(1);
|
|
329
272
|
}
|
|
330
273
|
|
|
331
274
|
const componentData = data[COMPONENTS_PATH];
|
|
332
275
|
|
|
333
276
|
const { library } = componentData;
|
|
334
|
-
|
|
277
|
+
let { organization } = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8'));
|
|
335
278
|
|
|
336
279
|
let componentDefaults = await getComponentDefaults();
|
|
337
280
|
componentDefaults.library = library;
|
|
338
281
|
|
|
282
|
+
if (options.params.length >= 8) {
|
|
283
|
+
const prefix = options.params[3];
|
|
284
|
+
const version = options.params[4];
|
|
285
|
+
const library = options.params[5];
|
|
286
|
+
const allowedApplications = options.params[6];
|
|
287
|
+
|
|
288
|
+
// overwrite
|
|
289
|
+
organization = options.params[7];
|
|
339
290
|
|
|
340
|
-
const questions = [
|
|
341
|
-
{
|
|
342
|
-
name: 'prefix',
|
|
343
|
-
message: 'Enter prefix label'
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
name: 'version',
|
|
347
|
-
message: 'Enter component version',
|
|
348
|
-
default: componentDefaults.version,
|
|
349
|
-
validate: value => {
|
|
350
|
-
if (validateSemver(value)) {
|
|
351
|
-
return true;
|
|
352
|
-
}
|
|
353
|
-
return 'Please provide semver compatible version e.g 0.0.1';
|
|
354
|
-
}
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
name: 'library',
|
|
358
|
-
message: 'Enter library name (required)',
|
|
359
|
-
default: componentDefaults.library,
|
|
360
|
-
validate: value => {
|
|
361
|
-
/* value should not be empty
|
|
362
|
-
It should not have spaces
|
|
363
|
-
It should not start with a number
|
|
364
|
-
Only case-insensitive alphanumeric values are allowed
|
|
365
|
-
*/
|
|
366
|
-
if (value && !/^\d/.test(value) && value === sanitize(value)) {
|
|
367
|
-
return true;
|
|
368
|
-
}
|
|
369
|
-
return 'Only alphanumeric values are allowed, starting with alphabets';
|
|
370
|
-
}
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
name: 'allowedApplications',
|
|
374
|
-
message: 'Please enter the application names to be supported (comma-separated). ',
|
|
375
|
-
suffix: 'Keep empty for all applications'
|
|
376
|
-
}
|
|
377
|
-
];
|
|
378
|
-
|
|
379
|
-
await inquirer.prompt(questions).then(async answers => {
|
|
380
|
-
const {
|
|
381
|
-
prefix,
|
|
382
|
-
library,
|
|
383
|
-
version,
|
|
384
|
-
allowedApplications
|
|
385
|
-
} = answers;
|
|
386
291
|
await validateCompileAll(
|
|
387
292
|
{
|
|
388
293
|
prefix,
|
|
@@ -393,6 +298,60 @@ export default async options => {
|
|
|
393
298
|
},
|
|
394
299
|
options
|
|
395
300
|
);
|
|
396
|
-
}
|
|
397
|
-
|
|
301
|
+
} else {
|
|
302
|
+
const questions = [
|
|
303
|
+
{
|
|
304
|
+
name: 'prefix',
|
|
305
|
+
message: 'Enter prefix label'
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
name: 'version',
|
|
309
|
+
message: 'Enter component version',
|
|
310
|
+
default: componentDefaults.version,
|
|
311
|
+
validate: (value) => {
|
|
312
|
+
if (validateSemver(value)) {
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
return 'Please provide semver compatible version e.g 0.0.1';
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
name: 'library',
|
|
320
|
+
message: 'Enter library name (required)',
|
|
321
|
+
default: componentDefaults.library,
|
|
322
|
+
validate: (value) => {
|
|
323
|
+
/* value should not be empty
|
|
324
|
+
It should not have spaces
|
|
325
|
+
It should not start with a number
|
|
326
|
+
Only case-insensitive alphanumeric values are allowed
|
|
327
|
+
*/
|
|
328
|
+
if (value && !/^\d/.test(value) && value === sanitize(value)) {
|
|
329
|
+
return true;
|
|
330
|
+
}
|
|
331
|
+
return 'Only alphanumeric values are allowed, starting with alphabets';
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
name: 'allowedApplications',
|
|
336
|
+
message: 'Please enter the application names to be supported (comma-separated). ',
|
|
337
|
+
suffix: 'Keep empty for all applications'
|
|
338
|
+
}
|
|
339
|
+
];
|
|
340
|
+
|
|
341
|
+
await inquirer.prompt(questions).then(async (answers) => {
|
|
342
|
+
const { library, version, allowedApplications } = answers;
|
|
343
|
+
let { prefix } = answers;
|
|
344
|
+
prefix = prefix.replace(/[^a-zA-Z0-9 ]/g, '');
|
|
345
|
+
await validateCompileAll(
|
|
346
|
+
{
|
|
347
|
+
prefix,
|
|
348
|
+
library,
|
|
349
|
+
version,
|
|
350
|
+
allowedApplications,
|
|
351
|
+
organization
|
|
352
|
+
},
|
|
353
|
+
options
|
|
354
|
+
);
|
|
355
|
+
});
|
|
356
|
+
}
|
|
398
357
|
};
|
|
@@ -2,23 +2,22 @@ import chalk from 'chalk';
|
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
3
|
import ora from 'ora';
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
import {
|
|
7
6
|
deleteLocalComponent,
|
|
8
|
-
|
|
7
|
+
deleteInfinityServerComponent,
|
|
8
|
+
deleteLaunchpadServerComponent,
|
|
9
9
|
getComponents,
|
|
10
|
-
getPegaServerConfig
|
|
10
|
+
getPegaServerConfig,
|
|
11
|
+
standardizeStr
|
|
11
12
|
} from '../../util.js';
|
|
12
13
|
import { getComponentsFromServer } from '../list/helper.js';
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
15
|
export const SOURCE_OF_COMPONENT_TYPES = {
|
|
17
16
|
SERVER: 'Server',
|
|
18
17
|
LOCAL: 'Local'
|
|
19
18
|
};
|
|
20
19
|
|
|
21
|
-
export const getDeleteComponentsQuestions = async (options
|
|
20
|
+
export const getDeleteComponentsQuestions = async (options) => {
|
|
22
21
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
23
22
|
|
|
24
23
|
return [
|
|
@@ -35,26 +34,35 @@ export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOp
|
|
|
35
34
|
];
|
|
36
35
|
};
|
|
37
36
|
|
|
38
|
-
export const deleteLocalComponents = async sourceOfComponents => {
|
|
37
|
+
export const deleteLocalComponents = async (sourceOfComponents, options) => {
|
|
39
38
|
const localComponents = await getComponents();
|
|
40
39
|
|
|
41
40
|
if (localComponents.length > 0) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
if (options.params.length >= 6) {
|
|
42
|
+
const componentKey = options.params[4];
|
|
43
|
+
const sDeletion = options.params[5];
|
|
44
|
+
const confirmDeletion = sDeletion === 'Y' || sDeletion === 'y' || sDeletion === true || sDeletion === 'true';
|
|
45
|
+
if (confirmDeletion) {
|
|
46
|
+
await deleteLocalComponent(componentKey);
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
const answers = await inquirer.prompt([
|
|
50
|
+
{
|
|
51
|
+
name: 'componentKey',
|
|
52
|
+
type: 'rawlist',
|
|
53
|
+
message: 'Select component to delete',
|
|
54
|
+
choices: localComponents
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'confirmDeletion',
|
|
58
|
+
type: 'confirm',
|
|
59
|
+
message: 'Are you sure ?',
|
|
60
|
+
default: false
|
|
61
|
+
}
|
|
62
|
+
]);
|
|
63
|
+
if (answers.confirmDeletion) {
|
|
64
|
+
await deleteLocalComponent(answers.componentKey);
|
|
54
65
|
}
|
|
55
|
-
]);
|
|
56
|
-
if (answers.confirmDeletion) {
|
|
57
|
-
await deleteLocalComponent(answers.componentKey);
|
|
58
66
|
}
|
|
59
67
|
} else {
|
|
60
68
|
console.log(chalk.bold.redBright(`No custom components in ${sourceOfComponents}`));
|
|
@@ -63,45 +71,71 @@ export const deleteLocalComponents = async sourceOfComponents => {
|
|
|
63
71
|
|
|
64
72
|
export const deleteServerComponents = async (sourceOfComponents, answers) => {
|
|
65
73
|
const spinner = ora('Fetching components from server').start();
|
|
74
|
+
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
75
|
+
const isLaunchpad = defaultPegaServerConfig.serverType === 'launchpad';
|
|
66
76
|
const data = await getComponentsFromServer(answers);
|
|
67
77
|
|
|
68
|
-
|
|
78
|
+
let serverComponents;
|
|
79
|
+
if (isLaunchpad) {
|
|
80
|
+
serverComponents = data;
|
|
81
|
+
} else {
|
|
82
|
+
try {
|
|
83
|
+
if (typeof data === 'object') {
|
|
84
|
+
serverComponents = data.pxResults;
|
|
85
|
+
} else {
|
|
86
|
+
serverComponents = JSON.parse(data).pxResults;
|
|
87
|
+
}
|
|
88
|
+
} catch (ex) {
|
|
89
|
+
/* empty */
|
|
90
|
+
}
|
|
91
|
+
}
|
|
69
92
|
spinner.stop();
|
|
70
|
-
if (serverComponents && serverComponents.pxResults?.length > 0) {
|
|
71
|
-
const choicesArr = serverComponents.pxResults.map(({ label, pyRuleSet, pyRuleSetVersion }) => {
|
|
72
|
-
const name = `${standardizeStr(label, 45)} ${standardizeStr(pyRuleSet, 30)} ${standardizeStr(
|
|
73
|
-
pyRuleSetVersion,
|
|
74
|
-
20
|
|
75
|
-
)}`;
|
|
76
93
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
94
|
+
if (serverComponents && serverComponents?.length > 0) {
|
|
95
|
+
if (isLaunchpad) {
|
|
96
|
+
const choicesArr = serverComponents.map(({ name: componentName, type, version }) => {
|
|
97
|
+
const name = `${standardizeStr(componentName, 45)} ${standardizeStr(type, 20)} ${standardizeStr(version, 20)}`;
|
|
81
98
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const answers = await inquirer.prompt({
|
|
85
|
-
name: 'componentToDelete',
|
|
86
|
-
type: 'rawlist',
|
|
87
|
-
pageSize: 10,
|
|
88
|
-
message: `Select component to delete \n ${standardizeStr('Rule name', 48)} ${standardizeStr(
|
|
89
|
-
'Ruleset name',
|
|
90
|
-
30
|
|
91
|
-
)} ${standardizeStr('Ruleset version', 22)}`,
|
|
92
|
-
choices: choicesArr
|
|
93
|
-
});
|
|
94
|
-
await deleteServerComponent(answers.componentToDelete);
|
|
99
|
+
const value = `${componentName}~|~${type}~|~${version}`;
|
|
100
|
+
const short = `\n Selected component : ${chalk.redBright(`${componentName} ${type} : ${version}`)}`;
|
|
95
101
|
|
|
102
|
+
return { name, value, short };
|
|
103
|
+
});
|
|
96
104
|
|
|
105
|
+
const launchpadAnswers = await inquirer.prompt({
|
|
106
|
+
name: 'componentToDelete',
|
|
107
|
+
type: 'rawlist',
|
|
108
|
+
pageSize: 10,
|
|
109
|
+
message: `Select component to delete \n ${standardizeStr('Component Name', 48)} ${standardizeStr('Type', 20)} ${standardizeStr(
|
|
110
|
+
'Version',
|
|
111
|
+
22
|
|
112
|
+
)}`,
|
|
113
|
+
choices: choicesArr
|
|
114
|
+
});
|
|
115
|
+
await deleteLaunchpadServerComponent(launchpadAnswers.componentToDelete);
|
|
116
|
+
} else {
|
|
117
|
+
// logic for Infinity
|
|
118
|
+
const choicesArr = serverComponents.map(({ label, pyRuleSet, pyRuleSetVersion }) => {
|
|
119
|
+
const name = `${standardizeStr(label, 45)} ${standardizeStr(pyRuleSet, 30)} ${standardizeStr(pyRuleSetVersion, 20)}`;
|
|
120
|
+
|
|
121
|
+
const value = `${label}~|~${pyRuleSet}~|~${pyRuleSetVersion}`;
|
|
122
|
+
const short = `\n Selected component : ${chalk.redBright(`${label} ${pyRuleSet} : ${pyRuleSetVersion}`)}`;
|
|
123
|
+
|
|
124
|
+
return { name, value, short };
|
|
125
|
+
});
|
|
126
|
+
const infinityAnswers = await inquirer.prompt({
|
|
127
|
+
name: 'componentToDelete',
|
|
128
|
+
type: 'rawlist',
|
|
129
|
+
pageSize: 10,
|
|
130
|
+
message: `Select component to delete \n ${standardizeStr('Rule name', 48)} ${standardizeStr('Ruleset name', 30)} ${standardizeStr(
|
|
131
|
+
'Ruleset version',
|
|
132
|
+
22
|
|
133
|
+
)}`,
|
|
134
|
+
choices: choicesArr
|
|
135
|
+
});
|
|
136
|
+
await deleteInfinityServerComponent(infinityAnswers.componentToDelete);
|
|
137
|
+
}
|
|
97
138
|
} else {
|
|
98
139
|
console.log(chalk.bold.redBright(`No custom components in ${sourceOfComponents}`));
|
|
99
140
|
}
|
|
100
141
|
};
|
|
101
|
-
|
|
102
|
-
export const standardizeStr = (str, leng) => {
|
|
103
|
-
for (let i = str.length; i <= leng; i++) {
|
|
104
|
-
str += ' ';
|
|
105
|
-
}
|
|
106
|
-
return str;
|
|
107
|
-
};
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
|
-
import ora from 'ora';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
deleteLocalComponents,
|
|
7
|
-
SOURCE_OF_COMPONENT_TYPES,
|
|
8
|
-
deleteServerComponents,
|
|
9
|
-
getDeleteComponentsQuestions
|
|
10
|
-
} from './helper.js';
|
|
11
2
|
|
|
12
3
|
import { showVersion } from '../../util.js';
|
|
13
4
|
|
|
14
|
-
|
|
5
|
+
import { deleteLocalComponents, SOURCE_OF_COMPONENT_TYPES, deleteServerComponents, getDeleteComponentsQuestions } from './helper.js';
|
|
6
|
+
|
|
7
|
+
const deleteComponentsFn = async (sourceOfComponents, answers, options) => {
|
|
15
8
|
switch (sourceOfComponents) {
|
|
16
9
|
case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
|
|
17
|
-
await deleteLocalComponents(sourceOfComponents);
|
|
10
|
+
await deleteLocalComponents(sourceOfComponents, options);
|
|
18
11
|
break;
|
|
19
12
|
}
|
|
20
13
|
case SOURCE_OF_COMPONENT_TYPES.SERVER: {
|
|
@@ -28,22 +21,22 @@ const deleteComponentsFn = async (sourceOfComponents, answers) => {
|
|
|
28
21
|
}
|
|
29
22
|
};
|
|
30
23
|
|
|
31
|
-
export default async options => {
|
|
24
|
+
export default async (options) => {
|
|
32
25
|
showVersion();
|
|
33
26
|
|
|
34
27
|
let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
|
|
35
28
|
if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.LOCAL) {
|
|
36
29
|
sourceOfComponentsOption = options.params[3];
|
|
37
|
-
await deleteComponentsFn(sourceOfComponentsOption);
|
|
30
|
+
await deleteComponentsFn(sourceOfComponentsOption, null, options);
|
|
38
31
|
} else if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.SERVER) {
|
|
39
32
|
sourceOfComponentsOption = options.params[3];
|
|
40
33
|
const questions = await getDeleteComponentsQuestions(options, sourceOfComponentsOption);
|
|
41
34
|
const answers = await inquirer.prompt(questions);
|
|
42
|
-
await deleteComponentsFn(sourceOfComponentsOption, answers);
|
|
35
|
+
await deleteComponentsFn(sourceOfComponentsOption, answers, options);
|
|
43
36
|
} else {
|
|
44
37
|
const questions = await getDeleteComponentsQuestions(options);
|
|
45
38
|
const answers = await inquirer.prompt(questions);
|
|
46
39
|
const { sourceOfComponents } = answers;
|
|
47
|
-
await deleteComponentsFn(sourceOfComponents, answers);
|
|
40
|
+
await deleteComponentsFn(sourceOfComponents, answers, options);
|
|
48
41
|
}
|
|
49
42
|
};
|