@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
package/src/util.js
ADDED
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { promisify } from 'util';
|
|
4
|
+
import https from 'https';
|
|
5
|
+
import inquirer from 'inquirer';
|
|
6
|
+
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import mustache from 'mustache';
|
|
9
|
+
import pascalCase from 'pascalcase';
|
|
10
|
+
import fetch from 'node-fetch';
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
COMPONENTS_DIRECTORY_PATH,
|
|
14
|
+
DXCB_CONFIG_JSON_FILENAME,
|
|
15
|
+
TOKEN_PATH,
|
|
16
|
+
OOTB_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
17
|
+
DELETE_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
18
|
+
OOTB_COMPONENTS,
|
|
19
|
+
TOKEN_URL_V1,
|
|
20
|
+
FIELD_PATH,
|
|
21
|
+
WIDGET_PATH,
|
|
22
|
+
TEMPLATE_PATH,
|
|
23
|
+
COMPONENT_PREFIX_FIELD_PATH,
|
|
24
|
+
COMPONENT_PREFIX_TEMPLATE_PATH,
|
|
25
|
+
COMPONENT_PREFIX_WIDGET_PATH
|
|
26
|
+
} from './constants.js';
|
|
27
|
+
|
|
28
|
+
const access = promisify(fs.access);
|
|
29
|
+
|
|
30
|
+
export const checkPathAccess = async (path, options = {}) => {
|
|
31
|
+
const { errorMessage } = options;
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
await access(path, fs.constants.R_OK);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
const message =
|
|
37
|
+
errorMessage || `${chalk.red.bold('ERROR')} Could not able to access path - ${path}`;
|
|
38
|
+
console.error(message);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const deleteLocalComponent = async (componentKey, category = "custom") => {
|
|
44
|
+
const currentDirectory = process.cwd();
|
|
45
|
+
const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
|
|
46
|
+
const categoryDirectory = join("/", category.toLowerCase());
|
|
47
|
+
|
|
48
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
49
|
+
|
|
50
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
51
|
+
data = JSON.parse(data);
|
|
52
|
+
|
|
53
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
54
|
+
console.error(
|
|
55
|
+
`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
|
|
56
|
+
);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const directory = join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH], categoryDirectory, componentKey);
|
|
61
|
+
|
|
62
|
+
fs.rmdir(directory, { recursive: true }, err => {
|
|
63
|
+
if (err) {
|
|
64
|
+
throw err;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
console.log(`${chalk.red.bold(componentKey)} is deleted from Local`);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const deleteServerComponent = async componentKey => {
|
|
72
|
+
const { server, user, password } = await getPegaServerConfig();
|
|
73
|
+
const url = constructCompleteUrl(server, DELETE_COMPONENT_SERVICE_REST_ENDPOINT);
|
|
74
|
+
const [componentName, rulesetName, rulesetVersion] = componentKey.split('~|~');
|
|
75
|
+
const deleteUrl = `${url}/${componentName}/rulesetname/${rulesetName}/rulesetversion/${rulesetVersion}`;
|
|
76
|
+
try {
|
|
77
|
+
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
78
|
+
|
|
79
|
+
if (OauthData) {
|
|
80
|
+
const {
|
|
81
|
+
access_token: accessToken,
|
|
82
|
+
token_type: tokenType,
|
|
83
|
+
refresh_token: refreshToken
|
|
84
|
+
} = JSON.parse(OauthData);
|
|
85
|
+
fetch(deleteUrl, {
|
|
86
|
+
method: 'DELETE',
|
|
87
|
+
agent: new https.Agent({ rejectUnauthorized: false }),
|
|
88
|
+
headers: {
|
|
89
|
+
Authorization: `${tokenType} ${accessToken}`
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
.then(response => response.text())
|
|
93
|
+
.then(resp => {
|
|
94
|
+
const respData = JSON.parse(resp);
|
|
95
|
+
if (respData.status == 200) {
|
|
96
|
+
console.log(chalk.bold.green(`Success : ${respData.message}`));
|
|
97
|
+
} else {
|
|
98
|
+
throw new Error(`${respData.message}`);
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
.catch(e => Promise.reject(`${chalk.bold.red(e)}`));
|
|
102
|
+
}
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.log(`\n${chalk.bold.red(error)}`);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const getComponents = async (showSeparator = false, category = "custom") => {
|
|
109
|
+
const currentDirectory = process.cwd();
|
|
110
|
+
const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
|
|
111
|
+
const categoryDirectory = join("/", category.toLowerCase());
|
|
112
|
+
|
|
113
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
114
|
+
|
|
115
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
116
|
+
data = JSON.parse(data);
|
|
117
|
+
|
|
118
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
119
|
+
console.error(
|
|
120
|
+
`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
|
|
121
|
+
);
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const directory = join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH], categoryDirectory);
|
|
126
|
+
|
|
127
|
+
const fieldComps = await getSubComponents(directory, FIELD_PATH);
|
|
128
|
+
const templateComps = await getSubComponents(directory, TEMPLATE_PATH);
|
|
129
|
+
const widgetComps = await getSubComponents(directory, WIDGET_PATH);
|
|
130
|
+
|
|
131
|
+
let compList = new Array();
|
|
132
|
+
|
|
133
|
+
if (fieldComps.length > 0) {
|
|
134
|
+
if (showSeparator) compList.push(new inquirer.Separator("---- fields ----"));
|
|
135
|
+
compList.push(...fieldComps);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (templateComps.length > 0) {
|
|
139
|
+
if (showSeparator) compList.push(new inquirer.Separator("---- templates ----"));
|
|
140
|
+
compList.push(...templateComps);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (widgetComps.length > 0) {
|
|
144
|
+
if (showSeparator) compList.push(new inquirer.Separator("---- widgets ----"));
|
|
145
|
+
compList.push(...widgetComps);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return compList;
|
|
149
|
+
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const getSubComponents = async (directory, type) => {
|
|
153
|
+
|
|
154
|
+
const subDirectory = join(directory, type);
|
|
155
|
+
return fs
|
|
156
|
+
.readdirSync(subDirectory, { withFileTypes: true })
|
|
157
|
+
.filter(dirent => dirent.isDirectory())
|
|
158
|
+
.map(dirent => dirent.name);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export const getComponentsObj = async (showSeparator = false, category = "custom") => {
|
|
162
|
+
const currentDirectory = process.cwd();
|
|
163
|
+
const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
|
|
164
|
+
const categoryDirectory = join("/", category.toLowerCase());
|
|
165
|
+
|
|
166
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
167
|
+
|
|
168
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
169
|
+
data = JSON.parse(data);
|
|
170
|
+
|
|
171
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
172
|
+
console.error(
|
|
173
|
+
`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
|
|
174
|
+
);
|
|
175
|
+
process.exit(1);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const directory = join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH], categoryDirectory);
|
|
179
|
+
|
|
180
|
+
const fieldComps = await getSubComponents(directory, FIELD_PATH);
|
|
181
|
+
const templateComps = await getSubComponents(directory, TEMPLATE_PATH);
|
|
182
|
+
const widgetComps = await getSubComponents(directory, WIDGET_PATH);
|
|
183
|
+
|
|
184
|
+
let compList = new Array();
|
|
185
|
+
|
|
186
|
+
if (fieldComps.length > 0) {
|
|
187
|
+
if (showSeparator) compList.push(new inquirer.Separator("---- fields ----"));
|
|
188
|
+
|
|
189
|
+
compList.push(...fieldComps.map(
|
|
190
|
+
name => {
|
|
191
|
+
const container = {};
|
|
192
|
+
container.name = name;
|
|
193
|
+
container.value = COMPONENT_PREFIX_FIELD_PATH + name;
|
|
194
|
+
|
|
195
|
+
return container;
|
|
196
|
+
}
|
|
197
|
+
));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (templateComps.length > 0) {
|
|
201
|
+
if (showSeparator) compList.push(new inquirer.Separator("---- templates ----"));
|
|
202
|
+
compList.push(...templateComps.map(
|
|
203
|
+
name => {
|
|
204
|
+
const container = {};
|
|
205
|
+
container.name = name;
|
|
206
|
+
container.value = COMPONENT_PREFIX_TEMPLATE_PATH + name;
|
|
207
|
+
|
|
208
|
+
return container;
|
|
209
|
+
}
|
|
210
|
+
));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (widgetComps.length > 0) {
|
|
214
|
+
if (showSeparator) compList.push(new inquirer.Separator("---- widgets ----"));
|
|
215
|
+
compList.push(...widgetComps.map(
|
|
216
|
+
name => {
|
|
217
|
+
const container = {};
|
|
218
|
+
container.name = name;
|
|
219
|
+
container.value = COMPONENT_PREFIX_WIDGET_PATH + name;
|
|
220
|
+
|
|
221
|
+
return container;
|
|
222
|
+
}
|
|
223
|
+
));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return compList;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export const getSubComponentsAndDir = async (directory, type) => {
|
|
230
|
+
|
|
231
|
+
const subDirectory = join(directory, type);
|
|
232
|
+
const prefix = type.replace("/", "") + "/";
|
|
233
|
+
|
|
234
|
+
return fs
|
|
235
|
+
.readdirSync(subDirectory, { withFileTypes: true })
|
|
236
|
+
.filter(dirent => dirent.isDirectory())
|
|
237
|
+
.map(dirent => prefix + dirent.name);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export const getComponentsAndSubDirectory = async (category = "custom") => {
|
|
241
|
+
const currentDirectory = process.cwd();
|
|
242
|
+
const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
|
|
243
|
+
const categoryDirectory = join("/", category.toLowerCase());
|
|
244
|
+
|
|
245
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
246
|
+
|
|
247
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
248
|
+
data = JSON.parse(data);
|
|
249
|
+
|
|
250
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
251
|
+
console.error(
|
|
252
|
+
`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
|
|
253
|
+
);
|
|
254
|
+
process.exit(1);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const directory = join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH], categoryDirectory);
|
|
258
|
+
|
|
259
|
+
const fieldComps = await getSubComponentsAndDir(directory, FIELD_PATH);
|
|
260
|
+
const templateComps = await getSubComponentsAndDir(directory, TEMPLATE_PATH);
|
|
261
|
+
const widgetComps = await getSubComponentsAndDir(directory, WIDGET_PATH);
|
|
262
|
+
|
|
263
|
+
let dirAndComp = new Array();
|
|
264
|
+
dirAndComp.push(...fieldComps);
|
|
265
|
+
dirAndComp.push(...templateComps);
|
|
266
|
+
dirAndComp.push(...widgetComps);
|
|
267
|
+
|
|
268
|
+
return dirAndComp;
|
|
269
|
+
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export const removeComponentPrefix = (componentName) => {
|
|
273
|
+
if (componentName.indexOf(COMPONENT_PREFIX_FIELD_PATH) == 0) {
|
|
274
|
+
componentName = componentName.substring(COMPONENT_PREFIX_FIELD_PATH.length);
|
|
275
|
+
}
|
|
276
|
+
else if (componentName.indexOf(COMPONENT_PREFIX_TEMPLATE_PATH) == 0) {
|
|
277
|
+
componentName = componentName.substring(COMPONENT_PREFIX_TEMPLATE_PATH.length);
|
|
278
|
+
}
|
|
279
|
+
else if (componentName.indexOf(COMPONENT_PREFIX_WIDGET_PATH) == 0) {
|
|
280
|
+
componentName = componentName.substring(COMPONENT_PREFIX_WIDGET_PATH.length);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return componentName;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
export const getPegaConfig = async () => {
|
|
288
|
+
const currentDirectory = process.cwd();
|
|
289
|
+
const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
|
|
290
|
+
|
|
291
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
292
|
+
|
|
293
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
294
|
+
data = JSON.parse(data);
|
|
295
|
+
|
|
296
|
+
return data;
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
export const getPegaServerConfig = async () => {
|
|
300
|
+
const config = await getPegaConfig();
|
|
301
|
+
return config['server-config'];
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
export const getComponentDefaults = async () => {
|
|
305
|
+
const config = await getPegaConfig();
|
|
306
|
+
return config.component;
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
export const getComponentDirectoryPath = async (componentKey, category = "custom") => {
|
|
310
|
+
const currentDirectory = process.cwd();
|
|
311
|
+
const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);
|
|
312
|
+
const categoryDirectory = join("/", category.toLowerCase());
|
|
313
|
+
|
|
314
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
315
|
+
|
|
316
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
317
|
+
data = JSON.parse(data);
|
|
318
|
+
|
|
319
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
320
|
+
console.error(
|
|
321
|
+
`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
|
|
322
|
+
);
|
|
323
|
+
process.exit(1);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH], categoryDirectory, componentKey);
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
export const compileMustacheTemplate = (file, data) => {
|
|
330
|
+
const content = fs.readFileSync(file, 'utf8');
|
|
331
|
+
return mustache.render(content, data);
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
export const isPascalCase = string => {
|
|
335
|
+
return string === pascalCase(string);
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
export const convertIntoPascalCase = string => {
|
|
339
|
+
return pascalCase(string);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
export const constructCompleteUrl = (baseServer, endPoint) => {
|
|
343
|
+
return baseServer.endsWith('/') ? `${baseServer}${endPoint}` : `${baseServer}/${endPoint}`;
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
export const nodeFetch = (url, config) => {
|
|
347
|
+
const { method, user, password, headers, ...restConfig } = config;
|
|
348
|
+
|
|
349
|
+
if (url.startsWith('https')) restConfig.agent = new https.Agent({ rejectUnauthorized: false });
|
|
350
|
+
|
|
351
|
+
return fetch(url, {
|
|
352
|
+
method,
|
|
353
|
+
...restConfig,
|
|
354
|
+
headers: {
|
|
355
|
+
'Content-Type': 'application/json;charset=utf-8',
|
|
356
|
+
Authorization: `Basic ${Buffer.from(`${user}:${password}`).toString('base64')}`,
|
|
357
|
+
...headers
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
export const sanitize = str => {
|
|
363
|
+
/* Allow only numbers and case insensitive alphabets */
|
|
364
|
+
str = str.replace(/[^a-zA-Z0-9 ]/g, '');
|
|
365
|
+
/* spaces will be replaced by - */
|
|
366
|
+
str = str.replace(/\s+/g, '-');
|
|
367
|
+
return str;
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
export const validateSemver = str => {
|
|
371
|
+
/* basic semver version validation - 0.0.1-dev */
|
|
372
|
+
const regex = /^[0-9]\d*\.\d+\.\d+(?:-[a-zA-Z0-9]+)?$/g;
|
|
373
|
+
return regex.test(str);
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
export const validateRulesetVersion = str => {
|
|
377
|
+
/* Ruleset version range - 01-99 */
|
|
378
|
+
if (str.indexOf('00') !== -1) {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
/* basic ruleset version validation - 01-01-01 */
|
|
382
|
+
const regex = /^\d\d-\d\d-\d\d$/g;
|
|
383
|
+
return regex.test(str);
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
export const getOOTBComponents = async () => {
|
|
387
|
+
return new Promise((resolve, reject) => {
|
|
388
|
+
fs.readFile(OOTB_COMPONENTS, 'utf-8', async (err, data) => {
|
|
389
|
+
if (err) {
|
|
390
|
+
try {
|
|
391
|
+
const { server } = await getPegaServerConfig();
|
|
392
|
+
const url = constructCompleteUrl(server, OOTB_COMPONENT_SERVICE_REST_ENDPOINT);
|
|
393
|
+
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
394
|
+
if (OauthData) {
|
|
395
|
+
const {
|
|
396
|
+
access_token: accessToken,
|
|
397
|
+
token_type: tokenType,
|
|
398
|
+
refresh_token: refreshToken
|
|
399
|
+
} = JSON.parse(OauthData);
|
|
400
|
+
fetch(url, {
|
|
401
|
+
method: 'GET',
|
|
402
|
+
agent: new https.Agent({ rejectUnauthorized: false }),
|
|
403
|
+
headers: {
|
|
404
|
+
Authorization: `${tokenType} ${accessToken}`
|
|
405
|
+
}
|
|
406
|
+
})
|
|
407
|
+
.then(response => response.text())
|
|
408
|
+
.then(data => {
|
|
409
|
+
if (data.charAt() === '[') {
|
|
410
|
+
data = data.slice(1, -1);
|
|
411
|
+
data = data.replace(/\s/g, '');
|
|
412
|
+
fs.writeFile(OOTB_COMPONENTS, data, err => {
|
|
413
|
+
if (err) {
|
|
414
|
+
console.error(err);
|
|
415
|
+
}
|
|
416
|
+
resolve(data.split(','));
|
|
417
|
+
});
|
|
418
|
+
} else {
|
|
419
|
+
data = JSON.parse(data);
|
|
420
|
+
if (data && data.errors) {
|
|
421
|
+
const errMessages = data.errors;
|
|
422
|
+
errMessages.forEach(msgArr => {
|
|
423
|
+
throw new Error(`Failed with error - ${JSON.stringify(msgArr.message)}`);
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
})
|
|
428
|
+
.catch(e => Promise.reject(`${chalk.bold.red(e)}`));
|
|
429
|
+
}
|
|
430
|
+
} catch (error) {
|
|
431
|
+
throw new Error('Error occurred in validation', error);
|
|
432
|
+
}
|
|
433
|
+
} else {
|
|
434
|
+
resolve(data.split(','));
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
export const getTokenUrl = async (server) => {
|
|
441
|
+
return server.endsWith('/') ? `${server}${TOKEN_URL_V1}` : `${server}/${TOKEN_URL_V1}`;
|
|
442
|
+
};
|