@pega/dx-component-builder-sdk 0.1.0
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/.access_token +1 -0
- package/.agilestudio +3 -0
- package/.eslintrc.json +18 -0
- package/.prettierignore +2 -0
- package/.prettierrc.json +1 -0
- package/LICENSE +185 -0
- package/README.md +199 -0
- package/bin/index.js +5 -0
- package/cspell.json +26 -0
- package/package.json +67 -0
- package/src/cli.js +104 -0
- package/src/constants.js +134 -0
- package/src/tasks/authenticate/helper.js +60 -0
- package/src/tasks/authenticate/index.js +81 -0
- package/src/tasks/build/helper.js +125 -0
- package/src/tasks/build/index.js +52 -0
- package/src/tasks/bundle/builder/index.js +218 -0
- package/src/tasks/bundle/builder/modules.js +139 -0
- package/src/tasks/bundle/builder/paths.js +50 -0
- package/src/tasks/bundle/builder/webpack.config.js +336 -0
- package/src/tasks/bundle/index.js +65 -0
- package/src/tasks/create/index.js +380 -0
- package/src/tasks/create/template/config.json.mustache +62 -0
- package/src/tasks/create/template/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/template/index.jsx.mustache +55 -0
- package/src/tasks/create/template/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/Boolean.js.mustache +38 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +26 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/config.json.mustache +145 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +171 -0
- package/src/tasks/create/templates/Constellation/Field/Boolean/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Date/config.json.mustache +195 -0
- package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +327 -0
- package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +254 -0
- package/src/tasks/create/templates/Constellation/Field/Date/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Date/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/config.json.mustache +256 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +93 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-utils.js +286 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +327 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +252 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/config.json.mustache +278 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +272 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/config.json.mustache +291 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +300 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/config.json.mustache +93 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +275 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/config.json.mustache +347 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +335 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/config.json.mustache +114 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +308 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text/config.json.mustache +62 -0
- package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Text/index.jsx.mustache +60 -0
- package/src/tasks/create/templates/Constellation/Field/Text/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/config.json.mustache +111 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +189 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/StatusWork.js +27 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/config.json.mustache +111 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +196 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/config.json.mustache +111 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +189 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/config.json.mustache +123 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +223 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +43 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/config.json.mustache +237 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/event-utils.js.mustache +18 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +232 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.js.mustache +172 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/config.json.mustache +185 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/index.jsx.mustache +213 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/suggestions-handler.js +10 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +286 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/OneColumnDetails.svg +22 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/config.json.mustache +35 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +88 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +155 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/TwoColumnDetails.svg +28 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/config.json.mustache +42 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +88 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +155 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/DefaultForm.svg +29 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/config.json.mustache +45 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +49 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/TwoColumn.svg +38 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/config.json.mustache +27 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +51 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/GetNextWork.js.mustache +29 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/config.json.mustache +32 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +68 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/localizations.json.mustache +4 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +226 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/config.json.mustache +23 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +75 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/config.json.mustache +59 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/index.jsx.mustache +48 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Avatar.js.mustache +73 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Operator.js.mustache +239 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/config.json.mustache +66 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +110 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-Angular/Field/__components.md +4 -0
- package/src/tasks/create/templates/SDK-Angular/Template/__components.md +4 -0
- package/src/tasks/create/templates/SDK-Angular/Widget/__components.md +4 -0
- package/src/tasks/create/templates/SDK-React/Field/Boolean/config.json.mustache +73 -0
- package/src/tasks/create/templates/SDK-React/Field/Boolean/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Boolean/index.tsx.mustache +109 -0
- package/src/tasks/create/templates/SDK-React/Field/Boolean/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Date/config.json.mustache +133 -0
- package/src/tasks/create/templates/SDK-React/Field/Date/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Date/index.tsx.mustache +122 -0
- package/src/tasks/create/templates/SDK-React/Field/Date/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/DateTime/config.json.mustache +190 -0
- package/src/tasks/create/templates/SDK-React/Field/DateTime/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/DateTime/index.tsx.mustache +112 -0
- package/src/tasks/create/templates/SDK-React/Field/DateTime/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/config.json.mustache +80 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/index.tsx.mustache +105 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/config.json.mustache +111 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/index.tsx.mustache +131 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/config.json.mustache +80 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/index.tsx.mustache +128 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/config.json.mustache +74 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/index.tsx.mustache +124 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/config.json.mustache +72 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/index.tsx.mustache +141 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text/config.json.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Field/Text/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text/index.tsx.mustache +119 -0
- package/src/tasks/create/templates/SDK-React/Field/Text/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/config.json.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/index.tsx.mustache +121 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Email/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/config.json.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/index.tsx.mustache +119 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Input/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/config.json.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/index.tsx.mustache +123 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Paragraph/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/config.json.mustache +81 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/index.tsx.mustache +147 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/config.json.mustache +111 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/index.tsx.mustache +98 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-URL/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/config.json.mustache +121 -0
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/index.tsx.mustache +120 -0
- package/src/tasks/create/templates/SDK-React/Field/TimeofDay/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS/DefaultForm.svg +29 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS/config.json.mustache +21 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS/index.tsx.mustache +45 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/TwoColumnDetails.svg +28 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/config.json.mustache +27 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/index.tsx.mustache +53 -0
- package/src/tasks/create/templates/SDK-React/Template/DETAILS-region/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/DefaultForm.css +25 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/DefaultForm.svg +29 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/config.json.mustache +45 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/index.tsx.mustache +63 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM-region/TwoColumn.svg +38 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM-region/config.json.mustache +49 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM-region/index.tsx.mustache +69 -0
- package/src/tasks/create/templates/SDK-React/Template/FORM-region/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/OneColumn.tsx.mustache +32 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/OneColumnPage.svg +28 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/config.json.mustache +32 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/index.tsx.mustache +31 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/config.json.mustache +23 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/index.tsx.mustache +183 -0
- package/src/tasks/create/templates/SDK-React/Widget/CASE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE/config.json.mustache +59 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE/index.tsx.mustache +78 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/config.json.mustache +66 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/index.tsx.mustache +239 -0
- package/src/tasks/create/templates/SDK-React/Widget/PAGE-CASE/styles.js.mustache +7 -0
- package/src/tasks/create/templates/SDK-WebComponents/Field/__components.md +4 -0
- package/src/tasks/create/templates/SDK-WebComponents/Template/__components.md +4 -0
- package/src/tasks/create/templates/SDK-WebComponents/Widget/__components.md +4 -0
- package/src/tasks/delete/helper.js +122 -0
- package/src/tasks/delete/index.js +45 -0
- package/src/tasks/delete-all/helper.js +177 -0
- package/src/tasks/delete-all/index.js +45 -0
- package/src/tasks/index.js +11 -0
- package/src/tasks/linter/index.js +46 -0
- package/src/tasks/list/helper.js +118 -0
- package/src/tasks/list/index.js +51 -0
- package/src/tasks/map/map.js +118 -0
- package/src/tasks/publish/helper.js +147 -0
- package/src/tasks/publish/index.js +72 -0
- package/src/tasks/publish-all/helper.js +139 -0
- package/src/tasks/publish-all/index.js +84 -0
- package/src/tasks/update/index.js +5 -0
- package/src/tasks/upgrade/index.js +31 -0
- package/src/tasks/validator/index.js +216 -0
- package/src/util.js +442 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/* eslint-disable react/no-unused-prop-types */
|
|
2
|
+
import React, {useState} from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import TextField from '@material-ui/core/TextField';
|
|
5
|
+
import Popover from '@material-ui/core/Popover';
|
|
6
|
+
import Grid from '@material-ui/core/Grid';
|
|
7
|
+
import Typography from '@material-ui/core/Typography';
|
|
8
|
+
|
|
9
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
10
|
+
|
|
11
|
+
import Utils from '@pega/react-sdk-components/lib/components/helpers/utils';
|
|
12
|
+
import Styled{{COMPONENT_CLASS_NAME}}Wrapper from './styles';
|
|
13
|
+
|
|
14
|
+
declare const PCore;
|
|
15
|
+
|
|
16
|
+
const useStyles = makeStyles((theme) => ({
|
|
17
|
+
root: {
|
|
18
|
+
padding: theme.spacing(1),
|
|
19
|
+
margin: theme.spacing(1),
|
|
20
|
+
},
|
|
21
|
+
popover: {
|
|
22
|
+
padding: theme.spacing(1),
|
|
23
|
+
margin: theme.spacing(1),
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
// Duplicated runtime code from React SDK
|
|
28
|
+
|
|
29
|
+
// Page Case Widget example
|
|
30
|
+
|
|
31
|
+
// props passed in combination of props from property panel (config.json) and run time props from Constellation
|
|
32
|
+
// any default values in config.pros should be set in defaultProps at bottom of this file
|
|
33
|
+
export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
34
|
+
// const componentName = "Operator";
|
|
35
|
+
const {
|
|
36
|
+
label,
|
|
37
|
+
createLabel,
|
|
38
|
+
updateLabel,
|
|
39
|
+
createOperator,
|
|
40
|
+
updateOperator,
|
|
41
|
+
createDateTime,
|
|
42
|
+
updateDateTime
|
|
43
|
+
} = props;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
const classes = useStyles();
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
const fieldLabel = label.toLowerCase();
|
|
50
|
+
let caseOpLabel = "---";
|
|
51
|
+
let caseOpName = "---";
|
|
52
|
+
let caseOpId = "";
|
|
53
|
+
let caseTime = null;
|
|
54
|
+
|
|
55
|
+
if (fieldLabel === "created") {
|
|
56
|
+
caseOpLabel = createLabel;
|
|
57
|
+
caseOpName = createOperator.userName;
|
|
58
|
+
caseTime = createDateTime;
|
|
59
|
+
caseOpId = createOperator.userId;
|
|
60
|
+
} else if (fieldLabel === "updated") {
|
|
61
|
+
caseOpLabel = updateLabel;
|
|
62
|
+
caseOpName = updateOperator.userName;
|
|
63
|
+
caseTime = updateDateTime;
|
|
64
|
+
caseOpId = updateOperator.userId;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Popover-related
|
|
68
|
+
const [popoverAnchorEl, setPopoverAnchorEl] = useState(null);
|
|
69
|
+
const [popoverFields, setPopoverFields] = useState<Array<any>>([]);
|
|
70
|
+
|
|
71
|
+
const popoverOpen = Boolean(popoverAnchorEl);
|
|
72
|
+
const popoverId = popoverOpen ? 'operator-details-popover' : undefined;
|
|
73
|
+
|
|
74
|
+
const handlePopoverClose = (() => {
|
|
75
|
+
setPopoverAnchorEl(null);
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
function showOperatorDetails(event) {
|
|
79
|
+
|
|
80
|
+
const operatorPreviewPromise = PCore.getUserApi().getOperatorDetails(caseOpId);
|
|
81
|
+
|
|
82
|
+
operatorPreviewPromise.then((res) => {
|
|
83
|
+
const fillerString = "---";
|
|
84
|
+
let fields: any = [];
|
|
85
|
+
if (
|
|
86
|
+
res.data &&
|
|
87
|
+
res.data.pyOperatorInfo &&
|
|
88
|
+
res.data.pyOperatorInfo.pyUserName
|
|
89
|
+
) {
|
|
90
|
+
fields = [
|
|
91
|
+
{
|
|
92
|
+
id: "pyPosition",
|
|
93
|
+
name: "Position",
|
|
94
|
+
value: res.data.pyOperatorInfo.pyPosition ? res.data.pyOperatorInfo.pyPosition : fillerString
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: "pyOrganization",
|
|
98
|
+
name: "Organization",
|
|
99
|
+
value: res.data.pyOperatorInfo.pyOrganization ? res.data.pyOperatorInfo.pyOrganization : fillerString
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "ReportToUserName",
|
|
103
|
+
name: "Reports to",
|
|
104
|
+
value: res.data.pyOperatorInfo.pyReportToUserName ? res.data.pyOperatorInfo.pyReportToUserName : fillerString
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: "pyTelephone",
|
|
108
|
+
name: "Telephone",
|
|
109
|
+
value: res.data.pyOperatorInfo.pyTelephone ? <a href={`tel:${res.data.pyOperatorInfo.pyTelephone}`}>{res.data.pyOperatorInfo.pyTelephone}</a> : fillerString
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "pyEmailAddress",
|
|
113
|
+
name: "Email address",
|
|
114
|
+
value: res.data.pyOperatorInfo.pyEmailAddress ? <a href={`mailto:${res.data.pyOperatorInfo.pyEmailAddress}`}>{res.data.pyOperatorInfo.pyEmailAddress}</a> : fillerString
|
|
115
|
+
}
|
|
116
|
+
];
|
|
117
|
+
} else {
|
|
118
|
+
// eslint-disable-next-line no-console
|
|
119
|
+
console.log(`Operator: PCore.getUserApi().getOperatorDetails(${caseOpId}); returned empty res.data.pyOperatorInfo.pyUserName - adding default`);
|
|
120
|
+
fields = [
|
|
121
|
+
{
|
|
122
|
+
id: "pyPosition",
|
|
123
|
+
name: "Position",
|
|
124
|
+
value: fillerString
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: "pyOrganization",
|
|
128
|
+
name: "Organization",
|
|
129
|
+
value: fillerString
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: "ReportToUserName",
|
|
133
|
+
name: "Reports to",
|
|
134
|
+
value: fillerString
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: "pyTelephone",
|
|
138
|
+
name: "Telephone",
|
|
139
|
+
value: fillerString
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
id: "pyEmailAddress",
|
|
143
|
+
name: "Email address",
|
|
144
|
+
value: fillerString
|
|
145
|
+
}
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
// Whatever the fields are, update the component's popoverFields
|
|
149
|
+
setPopoverFields(fields);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
setPopoverAnchorEl(event.currentTarget);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function getPopoverGrid() {
|
|
156
|
+
// return popoverFields.map((field) => {
|
|
157
|
+
// return <div className={classes.popover}>{field.name}: {field.value}</div>
|
|
158
|
+
// })
|
|
159
|
+
|
|
160
|
+
if (popoverFields.length === 0) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// There are fields, so build the grid.
|
|
165
|
+
return <Grid container className={classes.popover} spacing={1}>
|
|
166
|
+
<Grid item xs={12}><Typography variant="h6">{caseOpName}</Typography></Grid>
|
|
167
|
+
{popoverFields.map((field) => {
|
|
168
|
+
return <React.Fragment key={field.id}>
|
|
169
|
+
<Grid container item xs={12} spacing={1}>
|
|
170
|
+
<Grid item xs={6}><Typography variant="caption">{field.name}</Typography></Grid>
|
|
171
|
+
<Grid item xs={6}><Typography variant="subtitle2">{field.value}</Typography></Grid>
|
|
172
|
+
</Grid>
|
|
173
|
+
</React.Fragment>
|
|
174
|
+
})}
|
|
175
|
+
</Grid>
|
|
176
|
+
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// End of popover-related
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
return <Styled{{COMPONENT_CLASS_NAME}}Wrapper><React.Fragment>
|
|
183
|
+
<TextField
|
|
184
|
+
defaultValue={caseOpName}
|
|
185
|
+
label={caseOpLabel}
|
|
186
|
+
onClick={showOperatorDetails}
|
|
187
|
+
{{! pick new delimiteres for mustache }}
|
|
188
|
+
{{=<% %>=}}
|
|
189
|
+
InputProps={{
|
|
190
|
+
readOnly: true,
|
|
191
|
+
inputProps: {style: {cursor: 'pointer'}}
|
|
192
|
+
}}
|
|
193
|
+
<%={{ }}=%> {{! revert delimiteres for mustache }}
|
|
194
|
+
/>
|
|
195
|
+
<br />
|
|
196
|
+
{Utils.generateDateTime(caseTime, "DateTime-Since")}
|
|
197
|
+
|
|
198
|
+
<Popover
|
|
199
|
+
id={popoverId}
|
|
200
|
+
open={popoverOpen}
|
|
201
|
+
anchorEl={popoverAnchorEl}
|
|
202
|
+
onClose={handlePopoverClose}
|
|
203
|
+
{{! pick new delimiteres for mustache }}
|
|
204
|
+
{{=<% %>=}}
|
|
205
|
+
anchorOrigin={{ vertical: 'bottom', horizontal: 'center'}}
|
|
206
|
+
transformOrigin={{ vertical: 'top', horizontal: 'center'}}
|
|
207
|
+
PaperProps={{ style: {maxWidth: '45ch'}}}
|
|
208
|
+
<%={{ }}=%> {{! revert delimiteres for mustache }}
|
|
209
|
+
>
|
|
210
|
+
{getPopoverGrid()}
|
|
211
|
+
</Popover>
|
|
212
|
+
</React.Fragment>
|
|
213
|
+
</Styled{{COMPONENT_CLASS_NAME}}Wrapper>;
|
|
214
|
+
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
{{COMPONENT_CLASS_NAME}}.defaultProps = {
|
|
218
|
+
createLabel: null,
|
|
219
|
+
updateLabel: null,
|
|
220
|
+
createOperator: null,
|
|
221
|
+
updateOperator: null,
|
|
222
|
+
createDateTime: null,
|
|
223
|
+
updateDateTime: null
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
{{COMPONENT_CLASS_NAME}}.propTypes = {
|
|
227
|
+
getPConnect: PropTypes.func.isRequired,
|
|
228
|
+
label: PropTypes.string,
|
|
229
|
+
createLabel: PropTypes.string,
|
|
230
|
+
updateLabel: PropTypes.string,
|
|
231
|
+
resolveLabel: PropTypes.string,
|
|
232
|
+
createOperator: PropTypes.objectOf(PropTypes.any),
|
|
233
|
+
updateOperator: PropTypes.objectOf(PropTypes.any),
|
|
234
|
+
resolveOperator: PropTypes.objectOf(PropTypes.any),
|
|
235
|
+
createDateTime: PropTypes.string,
|
|
236
|
+
updateDateTime: PropTypes.string,
|
|
237
|
+
resolveDateTime: PropTypes.string,
|
|
238
|
+
hideLabel: PropTypes.bool
|
|
239
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
//import { element } from 'prop-types';
|
|
5
|
+
|
|
6
|
+
import { LIST_COMPONENT_SERVICE_REST_ENDPOINT } from '../../constants.js';
|
|
7
|
+
import {
|
|
8
|
+
constructCompleteUrl,
|
|
9
|
+
deleteLocalComponent,
|
|
10
|
+
deleteServerComponent,
|
|
11
|
+
getComponentsObj,
|
|
12
|
+
getPegaServerConfig,
|
|
13
|
+
nodeFetch
|
|
14
|
+
} from '../../util.js';
|
|
15
|
+
import { getComponentsFromServer } from '../list/helper.js';
|
|
16
|
+
|
|
17
|
+
import { deleteFromComponentMap } from '../map/map.js';
|
|
18
|
+
|
|
19
|
+
export const SOURCE_OF_COMPONENT_TYPES = {
|
|
20
|
+
SERVER: 'Server',
|
|
21
|
+
LOCAL: 'Local'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOption) => {
|
|
25
|
+
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
26
|
+
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
name: 'sourceOfComponents',
|
|
30
|
+
type: 'rawlist',
|
|
31
|
+
message: 'Delete components from Server or Local ?',
|
|
32
|
+
choices: Object.values(SOURCE_OF_COMPONENT_TYPES),
|
|
33
|
+
default: defaultPegaServerConfig.sourceOfComponents,
|
|
34
|
+
when() {
|
|
35
|
+
return !options.params[3];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const deleteLocalComponents = async sourceOfComponents => {
|
|
42
|
+
const localComponents = await getComponentsObj(true);
|
|
43
|
+
//const localComponentsAndSub = await getComponentsAndSubDirectory();
|
|
44
|
+
|
|
45
|
+
if (localComponents.length > 0) {
|
|
46
|
+
const answers = await inquirer.prompt([
|
|
47
|
+
{
|
|
48
|
+
name: 'componentKey',
|
|
49
|
+
type: 'rawlist',
|
|
50
|
+
message: 'Select component to delete',
|
|
51
|
+
choices: localComponents
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'confirmDeletion',
|
|
55
|
+
type: 'confirm',
|
|
56
|
+
message: 'Are you sure ?',
|
|
57
|
+
default: false
|
|
58
|
+
}
|
|
59
|
+
]);
|
|
60
|
+
if (answers.confirmDeletion) {
|
|
61
|
+
await deleteLocalComponent(answers.componentKey);
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
console.log(chalk.bold.redBright(`No custom components in ${sourceOfComponents}`));
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const deleteServerComponents = async (sourceOfComponents, answers) => {
|
|
69
|
+
const spinner = ora('Fetching components from server').start();
|
|
70
|
+
const data = await getComponentsFromServer(answers);
|
|
71
|
+
const componentObj = await getComponentsObj(false);
|
|
72
|
+
|
|
73
|
+
const serverComponents = JSON.parse(data);
|
|
74
|
+
spinner.stop();
|
|
75
|
+
if (serverComponents && serverComponents.pxResults?.length > 0) {
|
|
76
|
+
const choicesArr = serverComponents.pxResults.map(({ label, pyRuleSet, pyRuleSetVersion }) => {
|
|
77
|
+
const name = `${standardizeStr(label, 45)} ${standardizeStr(pyRuleSet, 30)} ${standardizeStr(
|
|
78
|
+
pyRuleSetVersion,
|
|
79
|
+
20
|
|
80
|
+
)}`;
|
|
81
|
+
|
|
82
|
+
const value = `${label}~|~${pyRuleSet}~|~${pyRuleSetVersion}`;
|
|
83
|
+
const short = `Selected component : ${chalk.redBright(
|
|
84
|
+
`${label} ${pyRuleSet} : ${pyRuleSetVersion}`
|
|
85
|
+
)}`;
|
|
86
|
+
|
|
87
|
+
return { name, value, short };
|
|
88
|
+
});
|
|
89
|
+
const answers = await inquirer.prompt({
|
|
90
|
+
name: 'componentToDelete',
|
|
91
|
+
type: 'rawlist',
|
|
92
|
+
pageSize: 10,
|
|
93
|
+
message: `Select component to delete \n ${standardizeStr('Rule name', 48)} ${standardizeStr(
|
|
94
|
+
'Ruleset name',
|
|
95
|
+
30
|
|
96
|
+
)} ${standardizeStr('Ruleset version', 22)}`,
|
|
97
|
+
choices: choicesArr
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
await deleteServerComponent(answers.componentToDelete);
|
|
101
|
+
|
|
102
|
+
const componentName = answers.componentToDelete.split("~")[0];
|
|
103
|
+
const componentKey = componentObj.find( theObj => theObj.name === componentName);
|
|
104
|
+
|
|
105
|
+
if (componentKey != undefined) {
|
|
106
|
+
await deleteFromComponentMap(componentKey.value);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
console.log(chalk.bold.redBright(`No component in map: ` + componnetName));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
} else {
|
|
113
|
+
console.log(chalk.bold.redBright(`No custom components in ${sourceOfComponents}`));
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const standardizeStr = (str, leng) => {
|
|
118
|
+
for (let i = str.length; i <= leng; i++) {
|
|
119
|
+
str += ' ';
|
|
120
|
+
}
|
|
121
|
+
return str;
|
|
122
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
|
|
12
|
+
const deleteComponentsFn = async (sourceOfComponents, answers) => {
|
|
13
|
+
switch (sourceOfComponents) {
|
|
14
|
+
case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
|
|
15
|
+
await deleteLocalComponents(sourceOfComponents);
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
case SOURCE_OF_COMPONENT_TYPES.SERVER: {
|
|
19
|
+
await deleteServerComponents(sourceOfComponents, answers);
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
default: {
|
|
23
|
+
console.log('Source of components needs to be either Local or Server');
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default async options => {
|
|
30
|
+
let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
|
|
31
|
+
if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.LOCAL) {
|
|
32
|
+
sourceOfComponentsOption = options.params[3];
|
|
33
|
+
await deleteComponentsFn(sourceOfComponentsOption);
|
|
34
|
+
} else if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.SERVER) {
|
|
35
|
+
sourceOfComponentsOption = options.params[3];
|
|
36
|
+
const questions = await getDeleteComponentsQuestions(options, sourceOfComponentsOption);
|
|
37
|
+
const answers = await inquirer.prompt(questions);
|
|
38
|
+
await deleteComponentsFn(sourceOfComponentsOption, answers);
|
|
39
|
+
} else {
|
|
40
|
+
const questions = await getDeleteComponentsQuestions(options);
|
|
41
|
+
const answers = await inquirer.prompt(questions);
|
|
42
|
+
const { sourceOfComponents } = answers;
|
|
43
|
+
await deleteComponentsFn(sourceOfComponents, answers);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
|
|
5
|
+
import { LIST_COMPONENT_SERVICE_REST_ENDPOINT } from '../..//constants.js';
|
|
6
|
+
import {
|
|
7
|
+
constructCompleteUrl,
|
|
8
|
+
deleteLocalComponent,
|
|
9
|
+
deleteServerComponent,
|
|
10
|
+
getComponents,
|
|
11
|
+
getComponentsObj,
|
|
12
|
+
getPegaServerConfig,
|
|
13
|
+
validateRulesetVersion,
|
|
14
|
+
nodeFetch
|
|
15
|
+
} from '../../util.js';
|
|
16
|
+
import { getComponentsFromServer } from '../list/helper.js';
|
|
17
|
+
|
|
18
|
+
import { deleteFromComponentMap } from '../map/map.js';
|
|
19
|
+
|
|
20
|
+
export const SOURCE_OF_COMPONENT_TYPES = {
|
|
21
|
+
SERVER: 'Server',
|
|
22
|
+
LOCAL: 'Local'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOption) => {
|
|
26
|
+
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
name: 'sourceOfComponents',
|
|
32
|
+
type: 'rawlist',
|
|
33
|
+
message: 'Delete components from Server or Local ?',
|
|
34
|
+
choices: Object.values(SOURCE_OF_COMPONENT_TYPES),
|
|
35
|
+
default: defaultPegaServerConfig.sourceOfComponents,
|
|
36
|
+
when() {
|
|
37
|
+
return !options.params[3];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
export const deleteLocalComponents = async sourceOfComponents => {
|
|
46
|
+
const localComponents = await getComponentsObj(true);
|
|
47
|
+
|
|
48
|
+
for (var index in localComponents) {
|
|
49
|
+
if (localComponents[index].type != undefined && localComponents[index].type === "separator") {
|
|
50
|
+
console.log(chalk.bold.green(localComponents[index]));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
console.log(chalk.bold.green(localComponents[index].name));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (localComponents.length > 0) {
|
|
59
|
+
const answers = await inquirer.prompt([
|
|
60
|
+
|
|
61
|
+
{
|
|
62
|
+
name: 'confirmDeletion',
|
|
63
|
+
type: 'confirm',
|
|
64
|
+
message: 'Delete all local ?',
|
|
65
|
+
default: false
|
|
66
|
+
}
|
|
67
|
+
]);
|
|
68
|
+
if (answers.confirmDeletion) {
|
|
69
|
+
for (var index in localComponents) {
|
|
70
|
+
if (localComponents[index].type == undefined) {
|
|
71
|
+
var componentToDelete = localComponents[index].value;
|
|
72
|
+
await deleteLocalComponent(componentToDelete);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
console.log(chalk.bold.redBright(`No custom components in ${sourceOfComponents}`));
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const deleteServerComponents = async (sourceOfComponents, answers) => {
|
|
83
|
+
const spinner = ora('Fetching components from server').start();
|
|
84
|
+
const data = await getComponentsFromServer(answers);
|
|
85
|
+
const defaultPegaConfig = await getPegaServerConfig();
|
|
86
|
+
const componentObj = await getComponentsObj(false);
|
|
87
|
+
|
|
88
|
+
const serverComponents = JSON.parse(data);
|
|
89
|
+
spinner.stop();
|
|
90
|
+
if (serverComponents && serverComponents.pxResults?.length > 0) {
|
|
91
|
+
const choicesArr = serverComponents.pxResults.map(({ label, pyRuleSet, pyRuleSetVersion }) => {
|
|
92
|
+
const name = `${standardizeStr(label, 45)} ${standardizeStr(pyRuleSet, 30)} ${standardizeStr(
|
|
93
|
+
pyRuleSetVersion,
|
|
94
|
+
20
|
|
95
|
+
)}`;
|
|
96
|
+
|
|
97
|
+
const value = `${label}~|~${pyRuleSet}~|~${pyRuleSetVersion}`;
|
|
98
|
+
const short = `Selected component : ${chalk.redBright(
|
|
99
|
+
`${label} ${pyRuleSet} : ${pyRuleSetVersion}`
|
|
100
|
+
)}`;
|
|
101
|
+
|
|
102
|
+
return { name, value, short };
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const selectedComp = await inquirer.prompt([
|
|
106
|
+
{
|
|
107
|
+
name: 'rulesetName',
|
|
108
|
+
message: 'Enter ruleset name',
|
|
109
|
+
default: defaultPegaConfig.rulesetName,
|
|
110
|
+
validate: value => {
|
|
111
|
+
if (value.trim()) {
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
return 'Ruleset name cannot be empty';
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: 'rulesetVersion',
|
|
119
|
+
message: 'Enter ruleset version',
|
|
120
|
+
default: defaultPegaConfig.rulesetVersion,
|
|
121
|
+
validate: value => {
|
|
122
|
+
if (validateRulesetVersion(value)) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
return 'Please provide compatible version e.g 01-01-01';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
]);
|
|
129
|
+
|
|
130
|
+
for (var index in choicesArr) {
|
|
131
|
+
var componentToDelete = choicesArr[index].value;
|
|
132
|
+
var arData = componentToDelete.split("~|~");
|
|
133
|
+
if (arData[1] == selectedComp.rulesetName && arData[2] == selectedComp.rulesetVersion) {
|
|
134
|
+
console.log(chalk.bold.green(arData[0]));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
const answers = await inquirer.prompt([
|
|
140
|
+
{
|
|
141
|
+
name: 'confirmDeletion',
|
|
142
|
+
type: 'confirm',
|
|
143
|
+
message: 'Do you want to delete these components ?',
|
|
144
|
+
default: false
|
|
145
|
+
}
|
|
146
|
+
]);
|
|
147
|
+
if (answers.confirmDeletion) {
|
|
148
|
+
for (var index in choicesArr) {
|
|
149
|
+
var componentToDelete = choicesArr[index].value;
|
|
150
|
+
var arData = componentToDelete.split("~|~");
|
|
151
|
+
if (arData[1] == selectedComp.rulesetName && arData[2] == selectedComp.rulesetVersion) {
|
|
152
|
+
await deleteServerComponent(componentToDelete);
|
|
153
|
+
|
|
154
|
+
const componentName = componentToDelete.split("~")[0];
|
|
155
|
+
const componentKey = componentObj.find( theObj => theObj.name === componentName);
|
|
156
|
+
|
|
157
|
+
if (componentKey != undefined) {
|
|
158
|
+
await deleteFromComponentMap(componentKey.value);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
console.log(chalk.bold.redBright(`No component in map: ` + componentName));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
} else {
|
|
168
|
+
console.log(chalk.bold.redBright(`No custom components in ${sourceOfComponents}`));
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export const standardizeStr = (str, leng) => {
|
|
173
|
+
for (let i = str.length; i <= leng; i++) {
|
|
174
|
+
str += ' ';
|
|
175
|
+
}
|
|
176
|
+
return str;
|
|
177
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
|
|
12
|
+
const deleteComponentsFn = async (sourceOfComponents, answers) => {
|
|
13
|
+
switch (sourceOfComponents) {
|
|
14
|
+
case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
|
|
15
|
+
await deleteLocalComponents(sourceOfComponents);
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
case SOURCE_OF_COMPONENT_TYPES.SERVER: {
|
|
19
|
+
await deleteServerComponents(sourceOfComponents, answers);
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
default: {
|
|
23
|
+
console.log('Source of components needs to be either Local or Server');
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default async options => {
|
|
30
|
+
let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
|
|
31
|
+
if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.LOCAL) {
|
|
32
|
+
sourceOfComponentsOption = options.params[3];
|
|
33
|
+
await deleteComponentsFn(sourceOfComponentsOption);
|
|
34
|
+
} else if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.SERVER) {
|
|
35
|
+
sourceOfComponentsOption = options.params[3];
|
|
36
|
+
const questions = await getDeleteComponentsQuestions(options, sourceOfComponentsOption);
|
|
37
|
+
const answers = await inquirer.prompt(questions);
|
|
38
|
+
await deleteComponentsFn(sourceOfComponentsOption, answers);
|
|
39
|
+
} else {
|
|
40
|
+
const questions = await getDeleteComponentsQuestions(options);
|
|
41
|
+
const answers = await inquirer.prompt(questions);
|
|
42
|
+
const { sourceOfComponents } = answers;
|
|
43
|
+
await deleteComponentsFn(sourceOfComponents, answers);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as createComponent } from './create/index.js';
|
|
2
|
+
export { default as deleteComponent } from './delete/index.js';
|
|
3
|
+
export { default as deleteAllComponents } from './delete-all/index.js';
|
|
4
|
+
export { default as publishComponent } from './publish/index.js';
|
|
5
|
+
export { default as publishAllComponents } from './publish-all/index.js';
|
|
6
|
+
export { default as listComponents } from './list/index.js';
|
|
7
|
+
export { default as updateComponent } from './update/index.js';
|
|
8
|
+
export { default as validate } from './validator/index.js';
|
|
9
|
+
export { default as authenticate } from './authenticate/index.js';
|
|
10
|
+
export { default as upgrade } from './upgrade/index.js';
|
|
11
|
+
export { default as buildComponent } from './build/index.js';
|