@pega/dx-component-builder-sdk 0.1.46 → 0.1.48
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/package.json +3 -2
- package/src/auth.js +3 -3
- package/src/cli.js +1 -1
- package/src/constants.js +728 -2
- package/src/tasks/authenticate/index.js +1 -1
- package/src/tasks/build/helper.js +10 -6
- package/src/tasks/build/index.js +76 -22
- package/src/tasks/build-all/helper.js +16 -11
- package/src/tasks/build-all/index.js +108 -44
- package/src/tasks/bundle/{builder → builderAngular}/paths.js +2 -2
- package/src/tasks/bundle/builderAngular/webpack.config.js +342 -0
- package/src/tasks/bundle/builderReact/index.js +218 -0
- package/src/tasks/bundle/builderReact/modules.js +139 -0
- package/src/tasks/bundle/builderReact/paths.js +50 -0
- package/src/tasks/bundle/{builder → builderReact}/webpack.config.js +5 -4
- package/src/tasks/bundle/index.js +64 -5
- package/src/tasks/create/index.js +54 -12
- 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/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/field/Decimal/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/field/Decimal-Currency/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/field/Decimal-Currency/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/field/Decimal-Percentage/index.jsx.mustache +4 -4
- package/src/tasks/create/templates/Constellation/field/Decimal-Percentage/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/field/Integer/index.jsx.mustache +2 -2
- 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/index.jsx.mustache +0 -1
- 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 +14 -0
- package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/time-of-day.js.mustache +6 -5
- package/src/tasks/create/templates/Constellation/template/DETAILS/demo.stories.jsx.mustache +20 -6
- package/src/tasks/create/templates/Constellation/template/DETAILS/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/template/DETAILS/mock.stories.js.mustache +20 -10
- package/src/tasks/create/templates/Constellation/template/DETAILS/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/demo.stories.jsx.mustache +20 -7
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/mock.stories.js.mustache +28 -13
- package/src/tasks/create/templates/Constellation/template/DETAILS-region/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/template/FORM/demo.stories.jsx.mustache +92 -16
- package/src/tasks/create/templates/Constellation/template/FORM/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/template/FORM/mock.stories.js.mustache +24 -12
- package/src/tasks/create/templates/Constellation/template/FORM/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/template/FORM-region/demo.stories.jsx.mustache +91 -13
- package/src/tasks/create/templates/Constellation/template/FORM-region/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/template/FORM-region/mock.stories.js.mustache +24 -12
- package/src/tasks/create/templates/Constellation/template/FORM-region/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/template/PAGE/demo.stories.jsx.mustache +1 -0
- package/src/tasks/create/templates/Constellation/template/PAGE/styles.js.mustache +13 -6
- package/src/tasks/create/templates/Constellation/widget/CASE/index.jsx.mustache +2 -2
- 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/Operator.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/widget/PAGE-CASE/index.jsx.mustache +2 -2
- package/src/tasks/create/templates/Constellation/widget/PAGE-CASE/styles.js.mustache +13 -6
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.html.mustache +42 -0
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.scss.mustache +24 -0
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.ts.mustache +165 -0
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/config.json.mustache +87 -0
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/demo.stories.jsx.mustache +56 -0
- package/src/tasks/create/templates/SDK-Angular/field/Boolean/mock.stories.js.mustache +15 -0
- package/src/tasks/create/templates/SDK-Angular/field/Date/config.json.mustache +147 -0
- package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.html.mustache +35 -0
- package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.ts.mustache +209 -0
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/config.json.mustache +204 -0
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.html.mustache +31 -0
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.ts.mustache +177 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/config.json.mustache +94 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.html.mustache +32 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.ts.mustache +170 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/config.json.mustache +125 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.html.mustache +33 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.ts.mustache +175 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/config.json.mustache +94 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.html.mustache +33 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.ts.mustache +176 -0
- package/src/tasks/create/templates/SDK-Angular/field/Integer/config.json.mustache +88 -0
- package/src/tasks/create/templates/SDK-Angular/field/Integer/integer.component.html.mustache +33 -0
- package/src/tasks/create/templates/SDK-Angular/field/Integer/integer.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Integer/integer.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Integer/integer.component.ts.mustache +180 -0
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/config.json.mustache +86 -0
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.html.mustache +30 -0
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.scss.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.ts.mustache +195 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text/config.json.mustache +83 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text/text.component.html.mustache +17 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text/text.component.scss.mustache +30 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text/text.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text/text.component.ts.mustache +145 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Email/config.json.mustache +83 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Email/text-email.component.html.mustache +31 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Email/text-email.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Email/text-email.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Email/text-email.component.ts.mustache +175 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Input/config.json.mustache +83 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Input/text.component.html.mustache +31 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Input/text.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Input/text.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Input/text.component.ts.mustache +177 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/config.json.mustache +83 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/text-paragraph.component.html.mustache +31 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/text-paragraph.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/text-paragraph.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/text-paragraph.component.ts.mustache +179 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/config.json.mustache +95 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/text-phone.component.html.mustache +30 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/text-phone.component.scss.mustache +81 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/text-phone.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/text-phone.component.ts.mustache +194 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-URL/config.json.mustache +111 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.html.mustache +30 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.spec.ts.mustache +26 -0
- package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.ts.mustache +174 -0
- package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.html.mustache +30 -0
- package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.scss.mustache +20 -0
- package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.ts.mustache +172 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/DefaultForm.svg +29 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/config.json.mustache +21 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/demo.stories.jsx.mustache +71 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.html.mustache +7 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.scss.mustache +7 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.ts.mustache +121 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS/mock.stories.js.mustache +294 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/TwoColumnDetails.svg +28 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/config.json.mustache +27 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/demo.stories.jsx.mustache +73 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.html.mustache +6 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.scss.mustache +7 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.ts.mustache +92 -0
- package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/mock.stories.js.mustache +290 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/DefaultForm.svg +29 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/config.json.mustache +45 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/demo.stories.jsx.mustache +215 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.html.mustache +23 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.scss.mustache +33 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.ts.mustache +71 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/TwoColumn.svg +38 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/config.json.mustache +49 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/demo.stories.jsx.mustache +183 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.html.mustache +16 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.scss.mustache +28 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.ts.mustache +26 -0
- package/src/tasks/create/templates/SDK-Angular/template/FORM-region/mock.stories.js.mustache +132 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/OneColumnPage.svg +28 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/config.json.mustache +32 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/demo.stories.jsx.mustache +80 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/mock.stories.js.mustache +115 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/page.component.html.mustache +15 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/page.component.scss.mustache +3 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/page.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/template/PAGE/page.component.ts.mustache +63 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.html.mustache +15 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.scss.mustache +22 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.ts.mustache +111 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/config.json.mustache +23 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/demo.stories.jsx.mustache +70 -0
- package/src/tasks/create/templates/SDK-Angular/widget/CASE/mock.stories.js.mustache +390 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/config.json.mustache +59 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/demo.stories.jsx.mustache +29 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/mock.stories.js.mustache +23 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/page.component.html.mustache +17 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/page.component.scss.mustache +19 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/page.component.ts.mustache +32 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE/pagecomponent.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/OneColumnPage.svg +36 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/config.json.mustache +66 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/demo.stories.jsx.mustache +52 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/mock.stories.js.mustache +52 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.html.mustache +28 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.scss.mustache +137 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.spec.ts.mustache +25 -0
- package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.ts.mustache +115 -0
- package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +3 -3
- package/src/tasks/create/templates/SDK-React/field/Date/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/DateTime/index.tsx.mustache +6 -7
- package/src/tasks/create/templates/SDK-React/field/Decimal/demo.stories.jsx.mustache +5 -1
- package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +78 -28
- package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +3 -3
- package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/Integer/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/Picklist/demo.stories.jsx.mustache +13 -0
- package/src/tasks/create/templates/SDK-React/field/Picklist/index.tsx.mustache +30 -10
- package/src/tasks/create/templates/SDK-React/field/Text/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/Text-Email/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/Text-Input/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/Text-Paragraph/index.tsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/field/Text-Phone/index.tsx.mustache +6 -5
- package/src/tasks/create/templates/SDK-React/field/Text-URL/index.tsx.mustache +11 -0
- package/src/tasks/create/templates/SDK-React/field/TimeOfDay/config.json.mustache +135 -0
- package/src/tasks/create/templates/SDK-React/field/{TimeofDay → TimeOfDay}/index.tsx.mustache +12 -1
- package/src/tasks/create/templates/SDK-React/template/DETAILS/index.tsx.mustache +7 -3
- package/src/tasks/create/templates/SDK-React/template/DETAILS-region/index.tsx.mustache +8 -4
- package/src/tasks/create/templates/SDK-React/template/FORM/index.tsx.mustache +30 -20
- package/src/tasks/create/templates/SDK-React/template/FORM-region/demo.stories.jsx.mustache +2 -2
- package/src/tasks/create/templates/SDK-React/template/PAGE/demo.stories.jsx.mustache +1 -0
- package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +4 -3
- package/src/tasks/create/templates/SDK-React/widget/PAGE/index.tsx.mustache +7 -7
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.jsx.mustache +2 -10
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +138 -36
- package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/mock.stories.js.mustache +1 -1
- package/src/tasks/create-all/index.js +114 -58
- package/src/tasks/delete/helper.js +88 -24
- package/src/tasks/delete/index.js +17 -8
- package/src/tasks/delete-all/helper.js +88 -25
- package/src/tasks/delete-all/index.js +15 -6
- package/src/tasks/list/index.js +14 -7
- package/src/tasks/map/map.js +212 -20
- package/src/tasks/map-all/index.js +19 -2
- package/src/tasks/override/index.js +137 -76
- package/src/tasks/override-all/index.js +54 -6
- package/src/tasks/publish/helper.js +93 -50
- package/src/tasks/publish/index.js +87 -34
- package/src/tasks/publish-all/helper.js +96 -57
- package/src/tasks/publish-all/index.js +123 -47
- package/src/tasks/rename/index.js +184 -111
- package/src/tasks/validator/index.js +31 -7
- package/src/util.js +173 -20
- package/src/tasks/create/templates/Constellation/field/TimeofDay/styles.js.mustache +0 -7
- /package/src/tasks/bundle/{builder → builderAngular}/index.js +0 -0
- /package/src/tasks/bundle/{builder → builderAngular}/modules.js +0 -0
- /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/config.json.mustache +0 -0
- /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/demo.stories.jsx.mustache +0 -0
- /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/index.jsx.mustache +0 -0
- /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/mock.stories.js.mustache +0 -0
- /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/suggestions-handler.js +0 -0
- /package/src/tasks/create/templates/{SDK-React/field/TimeofDay → SDK-Angular/field/TimeOfDay}/config.json.mustache +0 -0
- /package/src/tasks/create/templates/SDK-React/field/{TimeofDay → TimeOfDay}/demo.stories.jsx.mustache +0 -0
- /package/src/tasks/create/templates/SDK-React/field/{TimeofDay → TimeOfDay}/mock.stories.js.mustache +0 -0
- /package/src/tasks/create/templates/SDK-React/field/{TimeofDay → TimeOfDay}/styles.js.mustache +0 -0
|
@@ -8,8 +8,12 @@ import ncp from 'ncp';
|
|
|
8
8
|
import chalk from 'chalk';
|
|
9
9
|
import { updateComponentMap } from '../map/map.js';
|
|
10
10
|
|
|
11
|
-
import { checkPathAccess, showVersion, getPegaConfig } from '../../util.js';
|
|
12
11
|
import {
|
|
12
|
+
checkPathAccess,
|
|
13
|
+
showVersion,
|
|
14
|
+
getPegaConfig,
|
|
15
|
+
convertIntoKebabCase,
|
|
16
|
+
getFramework,
|
|
13
17
|
getComponentDirectoryPath,
|
|
14
18
|
getComponents,
|
|
15
19
|
getComponentDefaults
|
|
@@ -22,7 +26,8 @@ import { COMPONENT_SCHEMA,
|
|
|
22
26
|
DXCB_COMPONENT_DEFAULTS,
|
|
23
27
|
CUSTOM_TEMPLATES,
|
|
24
28
|
OVERRIDE_TEMPLATE_PATH,
|
|
25
|
-
OVERRIDE_REACT_LIB_PATH
|
|
29
|
+
OVERRIDE_REACT_LIB_PATH,
|
|
30
|
+
OVERRIDE_ANGULAR_LIB_PATH } from '../../constants.js';
|
|
26
31
|
|
|
27
32
|
const pegaConfigJsonPath = path.join(path.resolve(), SDK_CONFIG_JSON_FILENAME);
|
|
28
33
|
|
|
@@ -76,7 +81,20 @@ const checkAndCreateConfigComponentKey = async (targetDirectory) => {
|
|
|
76
81
|
|
|
77
82
|
const getListAvailableComponents = async (type) => {
|
|
78
83
|
const components = await getComponents(false, CATEGORY_OVERRIDE);
|
|
79
|
-
|
|
84
|
+
let fullList;
|
|
85
|
+
const framework = await getFramework();
|
|
86
|
+
switch (framework) {
|
|
87
|
+
case "SDK-Angular":
|
|
88
|
+
fullList = COMPONENT_SCHEMA.overrideAngularComponent[type];
|
|
89
|
+
break;
|
|
90
|
+
case "SDK-React":
|
|
91
|
+
fullList = COMPONENT_SCHEMA.overrideReactComponent[type];
|
|
92
|
+
break;
|
|
93
|
+
case "SDK-WebComponents":
|
|
94
|
+
fullList = COMPONENT_SCHEMA.overrideWCComponent[type];
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
|
|
80
98
|
let availList = [];
|
|
81
99
|
for (var el in fullList) {
|
|
82
100
|
|
|
@@ -99,6 +117,15 @@ const getListAvailableComponents = async (type) => {
|
|
|
99
117
|
return availList;
|
|
100
118
|
}
|
|
101
119
|
|
|
120
|
+
const adjustAngularComponentName = (componentName) => {
|
|
121
|
+
if (componentName.indexOf("/") >= 0) {
|
|
122
|
+
componentName = componentName.split("/")[1];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
return componentName;
|
|
127
|
+
}
|
|
128
|
+
|
|
102
129
|
|
|
103
130
|
const validateCompile = async (
|
|
104
131
|
{
|
|
@@ -113,11 +140,26 @@ const validateCompile = async (
|
|
|
113
140
|
process.exit(1);
|
|
114
141
|
}
|
|
115
142
|
|
|
116
|
-
|
|
117
|
-
|
|
143
|
+
const originalComponentName = componentName;
|
|
144
|
+
|
|
145
|
+
let pegaConfig = await getPegaConfig();
|
|
118
146
|
|
|
119
147
|
// will need to put a case statement here checking framework
|
|
120
|
-
|
|
148
|
+
const framework = await getFramework();
|
|
149
|
+
let templateParentDir = "";
|
|
150
|
+
|
|
151
|
+
switch (framework) {
|
|
152
|
+
case "SDK-Angular":
|
|
153
|
+
templateParentDir = OVERRIDE_ANGULAR_LIB_PATH;
|
|
154
|
+
componentName = adjustAngularComponentName(componentName);
|
|
155
|
+
componentName = convertIntoKebabCase(componentName);
|
|
156
|
+
break;
|
|
157
|
+
case "SDK-React":
|
|
158
|
+
templateParentDir = OVERRIDE_REACT_LIB_PATH;
|
|
159
|
+
break;
|
|
160
|
+
case "SDK-WebComponents":
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
121
163
|
|
|
122
164
|
if (pegaConfig[DXCB_CONFIG] &&
|
|
123
165
|
pegaConfig[DXCB_CONFIG][CUSTOM_TEMPLATES] &&
|
|
@@ -221,76 +263,12 @@ export default async options => {
|
|
|
221
263
|
const widgetList = await getListAvailableComponents("widget");
|
|
222
264
|
const infraList = await getListAvailableComponents("infra");
|
|
223
265
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
message: 'Enter type of component',
|
|
229
|
-
choices: COMPONENT_SCHEMA.overrideType,
|
|
230
|
-
when (propmtType) {
|
|
231
|
-
return promptType === null;
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
name: 'componentName',
|
|
236
|
-
type: 'rawlist',
|
|
237
|
-
message: 'Enter component to be overridden',
|
|
238
|
-
choices: formsList,
|
|
239
|
-
pageSize: 15,
|
|
240
|
-
when(answers) {
|
|
241
|
-
return formsList.length > 0 && (answers.type === 'field' || promptType === 'field');
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
name: 'componentName',
|
|
246
|
-
type: 'rawlist',
|
|
247
|
-
message: 'Enter component to be overridden',
|
|
248
|
-
choices: desList,
|
|
249
|
-
pageSize: 15,
|
|
250
|
-
when(answers) {
|
|
251
|
-
return desList.length > 0 && (answers.type === 'designSystemExtension' || promptType === 'designSystemExtension');
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
name: 'componentName',
|
|
256
|
-
type: 'rawlist',
|
|
257
|
-
message: 'Enter component to be overridden',
|
|
258
|
-
choices: infraList,
|
|
259
|
-
pageSize: 15,
|
|
260
|
-
when(answers) {
|
|
261
|
-
return infraList.length > 0 && (answers.type === 'infra' || promptType === 'infra');
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
name: 'componentName',
|
|
266
|
-
type: 'rawlist',
|
|
267
|
-
message: 'Enter component to be overridden',
|
|
268
|
-
choices: templateList,
|
|
269
|
-
pageSize: 15,
|
|
270
|
-
when(answers) {
|
|
271
|
-
return templateList.length > 0 && (answers.type === 'template' || promptType === 'template');
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
name: 'componentName',
|
|
276
|
-
type: 'rawlist',
|
|
277
|
-
message: 'Enter component to be overridden',
|
|
278
|
-
choices: widgetList,
|
|
279
|
-
pageSize: 15,
|
|
280
|
-
when(answers) {
|
|
281
|
-
return widgetList.length > 0 && (answers.type === 'widget' || promptType === 'widget');
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
|
|
285
|
-
];
|
|
286
|
-
|
|
287
|
-
await inquirer.prompt(questions).then(async answers => {
|
|
288
|
-
let {
|
|
289
|
-
componentName,
|
|
290
|
-
type
|
|
291
|
-
} = answers;
|
|
266
|
+
if (options.params.length >= 5) {
|
|
267
|
+
let componentName = options.params[4];
|
|
268
|
+
let type;
|
|
269
|
+
|
|
292
270
|
if (promptType) type = promptType;
|
|
293
|
-
|
|
271
|
+
|
|
294
272
|
await validateCompile(
|
|
295
273
|
{
|
|
296
274
|
componentName,
|
|
@@ -298,6 +276,89 @@ export default async options => {
|
|
|
298
276
|
},
|
|
299
277
|
options
|
|
300
278
|
);
|
|
301
|
-
}
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
const questions = [
|
|
282
|
+
{
|
|
283
|
+
name: 'type',
|
|
284
|
+
type: 'rawlist',
|
|
285
|
+
message: 'Enter type of component',
|
|
286
|
+
choices: COMPONENT_SCHEMA.overrideType,
|
|
287
|
+
when (propmtType) {
|
|
288
|
+
return promptType === null;
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
name: 'componentName',
|
|
293
|
+
type: 'rawlist',
|
|
294
|
+
message: 'Enter component to be overridden',
|
|
295
|
+
choices: formsList,
|
|
296
|
+
pageSize: 15,
|
|
297
|
+
when(answers) {
|
|
298
|
+
return formsList.length > 0 && (answers.type === 'field' || promptType === 'field');
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: 'componentName',
|
|
303
|
+
type: 'rawlist',
|
|
304
|
+
message: 'Enter component to be overridden',
|
|
305
|
+
choices: desList,
|
|
306
|
+
pageSize: 15,
|
|
307
|
+
when(answers) {
|
|
308
|
+
return desList.length > 0 && (answers.type === 'designSystemExtension' || promptType === 'designSystemExtension');
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
name: 'componentName',
|
|
313
|
+
type: 'rawlist',
|
|
314
|
+
message: 'Enter component to be overridden',
|
|
315
|
+
choices: infraList,
|
|
316
|
+
pageSize: 15,
|
|
317
|
+
when(answers) {
|
|
318
|
+
return infraList.length > 0 && (answers.type === 'infra' || promptType === 'infra');
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
name: 'componentName',
|
|
323
|
+
type: 'rawlist',
|
|
324
|
+
message: 'Enter component to be overridden',
|
|
325
|
+
choices: templateList,
|
|
326
|
+
pageSize: 15,
|
|
327
|
+
when(answers) {
|
|
328
|
+
return templateList.length > 0 && (answers.type === 'template' || promptType === 'template');
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: 'componentName',
|
|
333
|
+
type: 'rawlist',
|
|
334
|
+
message: 'Enter component to be overridden',
|
|
335
|
+
choices: widgetList,
|
|
336
|
+
pageSize: 15,
|
|
337
|
+
when(answers) {
|
|
338
|
+
return widgetList.length > 0 && (answers.type === 'widget' || promptType === 'widget');
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
];
|
|
343
|
+
|
|
344
|
+
await inquirer.prompt(questions).then(async answers => {
|
|
345
|
+
let {
|
|
346
|
+
componentName,
|
|
347
|
+
type
|
|
348
|
+
} = answers;
|
|
349
|
+
if (promptType) type = promptType;
|
|
350
|
+
|
|
351
|
+
await validateCompile(
|
|
352
|
+
{
|
|
353
|
+
componentName,
|
|
354
|
+
type
|
|
355
|
+
},
|
|
356
|
+
options
|
|
357
|
+
);
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
|
|
302
363
|
|
|
303
364
|
};
|
|
@@ -8,11 +8,15 @@ import ncp from 'ncp';
|
|
|
8
8
|
import chalk from 'chalk';
|
|
9
9
|
import { updateComponentMap } from '../map/map.js';
|
|
10
10
|
|
|
11
|
-
import { checkPathAccess, showVersion, getPegaConfig } from '../../util.js';
|
|
12
11
|
import {
|
|
12
|
+
checkPathAccess,
|
|
13
|
+
showVersion,
|
|
14
|
+
getFramework,
|
|
15
|
+
getPegaConfig,
|
|
13
16
|
getComponentDirectoryPath,
|
|
14
17
|
getComponents,
|
|
15
|
-
getComponentDefaults
|
|
18
|
+
getComponentDefaults,
|
|
19
|
+
convertIntoKebabCase
|
|
16
20
|
} from '../../util.js';
|
|
17
21
|
|
|
18
22
|
import { COMPONENT_SCHEMA,
|
|
@@ -22,7 +26,8 @@ import { COMPONENT_SCHEMA,
|
|
|
22
26
|
DXCB_COMPONENT_DEFAULTS,
|
|
23
27
|
CUSTOM_TEMPLATES,
|
|
24
28
|
OVERRIDE_TEMPLATE_PATH,
|
|
25
|
-
OVERRIDE_REACT_LIB_PATH
|
|
29
|
+
OVERRIDE_REACT_LIB_PATH,
|
|
30
|
+
OVERRIDE_ANGULAR_LIB_PATH } from '../../constants.js';
|
|
26
31
|
import { compileMustacheTemplates } from '@pega/dx-component-builder-sdk/src/tasks/create/index.js';
|
|
27
32
|
|
|
28
33
|
const pegaConfigJsonPath = path.join(path.resolve(), SDK_CONFIG_JSON_FILENAME);
|
|
@@ -77,7 +82,19 @@ const checkAndCreateConfigComponentKey = async (targetDirectory) => {
|
|
|
77
82
|
|
|
78
83
|
const getListAvailableComponents = async (type) => {
|
|
79
84
|
const components = await getComponents(false, CATEGORY_OVERRIDE);
|
|
80
|
-
|
|
85
|
+
let fullList;
|
|
86
|
+
const framework = await getFramework();
|
|
87
|
+
switch (framework) {
|
|
88
|
+
case "SDK-Angular":
|
|
89
|
+
fullList = COMPONENT_SCHEMA.overrideAngularComponent[type];
|
|
90
|
+
break;
|
|
91
|
+
case "SDK-React":
|
|
92
|
+
fullList = COMPONENT_SCHEMA.overrideReactComponent[type];
|
|
93
|
+
break;
|
|
94
|
+
case "SDK-WebComponents":
|
|
95
|
+
fullList = COMPONENT_SCHEMA.overrideWCComponent[type];
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
81
98
|
let availList = [];
|
|
82
99
|
for (var el in fullList) {
|
|
83
100
|
|
|
@@ -100,10 +117,20 @@ const getListAvailableComponents = async (type) => {
|
|
|
100
117
|
return availList;
|
|
101
118
|
}
|
|
102
119
|
|
|
120
|
+
const adjustAngularComponentName = (componentName) => {
|
|
121
|
+
if (componentName.indexOf("/") >= 0) {
|
|
122
|
+
componentName = componentName.split("/")[1];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
return componentName;
|
|
128
|
+
}
|
|
129
|
+
|
|
103
130
|
|
|
104
131
|
const validateCompile = async (
|
|
105
132
|
{
|
|
106
|
-
componentName,
|
|
133
|
+
componentName,
|
|
107
134
|
type
|
|
108
135
|
},
|
|
109
136
|
options
|
|
@@ -113,7 +140,28 @@ const validateCompile = async (
|
|
|
113
140
|
await getPegaConfig();
|
|
114
141
|
|
|
115
142
|
// will need to put a case statement here checking framework
|
|
116
|
-
|
|
143
|
+
const framework = await getFramework();
|
|
144
|
+
let templateParentDir = "";
|
|
145
|
+
|
|
146
|
+
let originalComponentName = componentName;
|
|
147
|
+
|
|
148
|
+
switch (framework) {
|
|
149
|
+
case "SDK-Angular":
|
|
150
|
+
templateParentDir = OVERRIDE_ANGULAR_LIB_PATH;
|
|
151
|
+
componentName = adjustAngularComponentName(componentName);
|
|
152
|
+
componentName = convertIntoKebabCase(componentName);
|
|
153
|
+
break;
|
|
154
|
+
case "SDK-React":
|
|
155
|
+
templateParentDir = OVERRIDE_REACT_LIB_PATH;
|
|
156
|
+
break;
|
|
157
|
+
case "SDK-WebComponents":
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (componentName === "") {
|
|
162
|
+
console.log(chalk.red(`${originalComponentName} component doesn't exist`));
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
117
165
|
|
|
118
166
|
if (pegaConfig[DXCB_CONFIG] &&
|
|
119
167
|
pegaConfig[DXCB_CONFIG][CUSTOM_TEMPLATES] &&
|
|
@@ -12,20 +12,40 @@ import {
|
|
|
12
12
|
getComponentsObj,
|
|
13
13
|
getPegaServerConfig,
|
|
14
14
|
validateRulesetVersion,
|
|
15
|
-
getOptionsCategory
|
|
15
|
+
getOptionsCategory,
|
|
16
|
+
getLocalComponentKeyFromConfig,
|
|
17
|
+
getFramework
|
|
16
18
|
} from '../../util.js';
|
|
17
19
|
|
|
18
|
-
import { PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
19
|
-
TOKEN_PATH,
|
|
20
|
-
COMPONENT_SCHEMA,
|
|
21
|
-
CATEGORY_CONSTELLATION,
|
|
20
|
+
import { PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
21
|
+
TOKEN_PATH,
|
|
22
|
+
COMPONENT_SCHEMA,
|
|
23
|
+
CATEGORY_CONSTELLATION,
|
|
22
24
|
CATEGORY_CUSTOM } from '../../constants.js';
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
export const mapConfigJsonToCompanion = async ( componentKey ) => {
|
|
26
28
|
const srcDirectory = await getComponentDirectoryPath(componentKey, CATEGORY_CUSTOM);
|
|
27
|
-
|
|
29
|
+
|
|
28
30
|
let configContent = fs.readFileSync(`${srcDirectory}/config.json`, { encoding: 'utf8' });
|
|
31
|
+
const framework = await getFramework();
|
|
32
|
+
|
|
33
|
+
let associatedComponentKey = componentKey;
|
|
34
|
+
|
|
35
|
+
switch (framework) {
|
|
36
|
+
case "SDK-Angular":
|
|
37
|
+
let arComp = associatedComponentKey.split("/");
|
|
38
|
+
const componentKeyPascal = await getLocalComponentKeyFromConfig(associatedComponentKey);
|
|
39
|
+
arComp[1] = componentKeyPascal;
|
|
40
|
+
associatedComponentKey = arComp.join("/")
|
|
41
|
+
break;
|
|
42
|
+
case "SDK-React":
|
|
43
|
+
break;
|
|
44
|
+
case "SDK-WebComponents":
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const companionDirectory = await getComponentDirectoryPath(associatedComponentKey, CATEGORY_CONSTELLATION);
|
|
29
49
|
|
|
30
50
|
fs.writeFileSync(`${companionDirectory}/config.json`, configContent, { encoding: 'utf8' });
|
|
31
51
|
|
|
@@ -55,6 +75,12 @@ export const getBuildCategory = async (options) => {
|
|
|
55
75
|
|
|
56
76
|
export const getPublishComponentQuestions = async (category) => {
|
|
57
77
|
const components = await getComponentsObj(true, category);
|
|
78
|
+
|
|
79
|
+
if (components.length == 0) {
|
|
80
|
+
console.log(chalk.redBright("No components to publish"));
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
|
|
58
84
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
59
85
|
|
|
60
86
|
return [
|
|
@@ -95,6 +121,7 @@ export const getPublishComponentQuestions = async (category) => {
|
|
|
95
121
|
},
|
|
96
122
|
{
|
|
97
123
|
name: 'devBuild',
|
|
124
|
+
type: 'confirm',
|
|
98
125
|
message: 'Generate development build ?',
|
|
99
126
|
default: defaultPegaConfig.devBuild
|
|
100
127
|
}
|
|
@@ -143,11 +170,13 @@ export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) =>
|
|
|
143
170
|
throw err;
|
|
144
171
|
}
|
|
145
172
|
});
|
|
146
|
-
fs.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
173
|
+
if (fs.existsSync('lib')) {
|
|
174
|
+
fs.rm('lib', { recursive: true }, err => {
|
|
175
|
+
if (err) {
|
|
176
|
+
throw err;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
151
180
|
}
|
|
152
181
|
else {
|
|
153
182
|
if (fs.existsSync(configExtJson)) {
|
|
@@ -178,7 +207,7 @@ export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) =>
|
|
|
178
207
|
return { zipContent, configContent };
|
|
179
208
|
};
|
|
180
209
|
|
|
181
|
-
export const publishComponentToServer = async data => {
|
|
210
|
+
export const publishComponentToServer = async (data, doFetch = true) => {
|
|
182
211
|
const { configContent, zipContent, rulesetName, rulesetVersion } = data;
|
|
183
212
|
let { componentKey } = data;
|
|
184
213
|
|
|
@@ -209,46 +238,60 @@ export const publishComponentToServer = async data => {
|
|
|
209
238
|
defaultPegaConfig.server,
|
|
210
239
|
PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT
|
|
211
240
|
);
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
return response.text();
|
|
232
|
-
})
|
|
233
|
-
.then(resp => {
|
|
234
|
-
const respData = JSON.parse(resp);
|
|
235
|
-
if (status === 401) {
|
|
236
|
-
throw new Error(
|
|
237
|
-
'Error occurred in authentication. Please regenerate using authenticate'
|
|
238
|
-
);
|
|
239
|
-
// console.log(accessTokenUri, refreshToken);
|
|
240
|
-
/* TODO - Handle refresh_token */
|
|
241
|
-
} else if (status == 200) {
|
|
242
|
-
console.log(chalk.bold.green(`Success : ${respData.message}`));
|
|
243
|
-
} else {
|
|
244
|
-
throw new Error(`${respData.message}`);
|
|
245
|
-
}
|
|
241
|
+
|
|
242
|
+
// will be false for functional testing
|
|
243
|
+
if (doFetch) {
|
|
244
|
+
try {
|
|
245
|
+
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
246
|
+
if (OauthData) {
|
|
247
|
+
const {
|
|
248
|
+
access_token: accessToken,
|
|
249
|
+
token_type: tokenType,
|
|
250
|
+
refresh_token: refreshToken
|
|
251
|
+
} = JSON.parse(OauthData);
|
|
252
|
+
let status = 500;
|
|
253
|
+
fetch(url, {
|
|
254
|
+
method: 'POST',
|
|
255
|
+
agent: new https.Agent({ rejectUnauthorized: false }),
|
|
256
|
+
headers: {
|
|
257
|
+
Authorization: `${tokenType} ${accessToken}`
|
|
258
|
+
},
|
|
259
|
+
body: JSON.stringify(apiBody)
|
|
246
260
|
})
|
|
247
|
-
|
|
248
|
-
|
|
261
|
+
.then(response => {
|
|
262
|
+
status = response.status;
|
|
263
|
+
return response.text();
|
|
264
|
+
})
|
|
265
|
+
.then(resp => {
|
|
266
|
+
const respData = JSON.parse(resp);
|
|
267
|
+
if (status === 401) {
|
|
268
|
+
throw new Error(
|
|
269
|
+
'Error occurred in authentication. Please regenerate using authenticate'
|
|
270
|
+
);
|
|
271
|
+
// console.log(accessTokenUri, refreshToken);
|
|
272
|
+
/* TODO - Handle refresh_token */
|
|
273
|
+
} else if (status == 200) {
|
|
274
|
+
console.log(chalk.bold.green(`Success : ${respData.message}`));
|
|
275
|
+
}
|
|
276
|
+
else if (status === 403) {
|
|
277
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
278
|
+
Promise.reject(
|
|
279
|
+
`${chalk.bold.red(
|
|
280
|
+
'Error forbidden: User does not have privileges to Publish.'
|
|
281
|
+
)}`
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
throw new Error(`${respData.message}`);
|
|
286
|
+
}
|
|
287
|
+
})
|
|
288
|
+
.catch(e => Promise.reject(`${chalk.bold.red(e)}`));
|
|
289
|
+
} else {
|
|
290
|
+
throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
291
|
+
}
|
|
292
|
+
} catch (err) {
|
|
249
293
|
throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
250
294
|
}
|
|
251
|
-
} catch (err) {
|
|
252
|
-
throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
253
295
|
}
|
|
296
|
+
|
|
254
297
|
};
|