@pega/dx-component-builder-sdk 0.1.5 → 0.1.7
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 +1 -1
- package/src/constants.js +8 -4
- package/src/tasks/build/helper.js +4 -22
- package/src/tasks/build/index.js +54 -7
- package/src/tasks/bundle/index.js +2 -2
- package/src/tasks/create/index.js +50 -4
- package/src/tasks/create/templates/SDK-React/Field/Boolean/demo.stories.jsx.mustache +26 -14
- package/src/tasks/create/templates/SDK-React/Field/Boolean/mock.stories.js.mustache +15 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal/demo.stories.jsx.mustache +17 -10
- package/src/tasks/create/templates/SDK-React/Field/Decimal/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/demo.stories.jsx.mustache +16 -10
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Currency/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/demo.stories.jsx.mustache +17 -10
- package/src/tasks/create/templates/SDK-React/Field/Decimal-Percentage/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Integer/demo.stories.jsx.mustache +16 -10
- package/src/tasks/create/templates/SDK-React/Field/Integer/mock.stories.js.mustache +14 -0
- package/src/tasks/create/templates/SDK-React/Field/Picklist/demo.stories.jsx.mustache +25 -16
- package/src/tasks/create/templates/SDK-React/Field/Picklist/mock.stories.js.mustache +30 -0
- package/src/tasks/create/templates/SDK-React/Field/Text-Phone/demo.stories.jsx.mustache +3 -1
- package/src/tasks/create/templates/SDK-React/Template/PAGE/demo.stories.jsx.mustache +79 -0
- package/src/tasks/create/templates/SDK-React/Template/PAGE/mock.stories.js.mustache +115 -0
- package/src/tasks/delete/helper.js +9 -24
- package/src/tasks/delete/index.js +2 -3
- package/src/tasks/delete-all/helper.js +9 -23
- package/src/tasks/delete-all/index.js +2 -3
- package/src/tasks/list/helper.js +3 -21
- package/src/tasks/list/index.js +2 -3
- package/src/tasks/map/map.js +4 -3
- package/src/tasks/override/index.js +13 -13
- package/src/tasks/publish/helper.js +77 -15
- package/src/tasks/publish/index.js +103 -15
- package/src/tasks/publish-all/helper.js +77 -13
- package/src/tasks/publish-all/index.js +109 -25
- package/src/tasks/validator/index.js +7 -5
- package/src/util.js +69 -17
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { withKnobs
|
|
2
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
3
|
+
import { configProps, stateProps } from './mock.stories';
|
|
3
4
|
|
|
4
|
-
import {{COMPONENT_CLASS_NAME}} from './index.
|
|
5
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: '{{COMPONENT_CLASS_NAME}}',
|
|
@@ -10,30 +11,37 @@ export default {
|
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
13
|
-
const [value, setValue] = useState(
|
|
14
|
+
const [value, setValue] = useState(configProps.value);
|
|
14
15
|
|
|
15
16
|
const props = {
|
|
17
|
+
value,
|
|
18
|
+
placeholder: configProps.placeholder,
|
|
19
|
+
label: configProps.label,
|
|
20
|
+
helperText: configProps.helperText,
|
|
21
|
+
datasource: configProps.datasource,
|
|
22
|
+
testId: configProps.testId,
|
|
23
|
+
hasSuggestions: configProps.hasSuggestions,
|
|
24
|
+
listType: configProps.listType,
|
|
16
25
|
getPConnect: () => {
|
|
17
26
|
return {
|
|
27
|
+
getDataObject: () => {
|
|
28
|
+
return undefined;
|
|
29
|
+
},
|
|
30
|
+
getStateProps: () => {
|
|
31
|
+
return stateProps;
|
|
32
|
+
},
|
|
18
33
|
getActionsApi: () => {
|
|
19
34
|
return {
|
|
20
|
-
updateFieldValue: (propName,
|
|
21
|
-
setValue(
|
|
35
|
+
updateFieldValue: (propName, val) => {
|
|
36
|
+
setValue(val);
|
|
37
|
+
},
|
|
38
|
+
triggerFieldChange: () => {
|
|
39
|
+
return undefined;
|
|
22
40
|
}
|
|
23
41
|
};
|
|
24
|
-
},
|
|
25
|
-
getStateProps: () => {
|
|
26
|
-
return { value: '.name' };
|
|
27
42
|
}
|
|
28
43
|
};
|
|
29
|
-
}
|
|
30
|
-
value,
|
|
31
|
-
placeholder: text('Placeholder', 'Test placeholder'),
|
|
32
|
-
disabled: boolean('Disabled', false),
|
|
33
|
-
readOnly: boolean('Disabled', false),
|
|
34
|
-
required: boolean('Disabled', false),
|
|
35
|
-
label: text('Label', 'Sample Label'),
|
|
36
|
-
testId: text('Test id', 'text-12344566')
|
|
44
|
+
}
|
|
37
45
|
};
|
|
38
46
|
|
|
39
47
|
return (
|
|
@@ -42,3 +50,4 @@ export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
42
50
|
</>
|
|
43
51
|
);
|
|
44
52
|
};
|
|
53
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const configProps = {
|
|
2
|
+
value: '',
|
|
3
|
+
label: 'Picklist Sample',
|
|
4
|
+
placeholder: 'Select...',
|
|
5
|
+
listType: 'associated',
|
|
6
|
+
datasource: [
|
|
7
|
+
{
|
|
8
|
+
key: 'Option 1',
|
|
9
|
+
value: 'Option 1'
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
key: 'Option 2',
|
|
13
|
+
value: 'Option 2'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: 'Option 3',
|
|
17
|
+
value: 'Option 3'
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
helperText: 'Picklist Helper Text',
|
|
21
|
+
testId: 'picklist-12345678',
|
|
22
|
+
hasSuggestions: false
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const stateProps = {
|
|
26
|
+
value: '.PicklistSample',
|
|
27
|
+
placeholder: 'Select...',
|
|
28
|
+
datasource: '.PicklistSample',
|
|
29
|
+
hasSuggestions: false
|
|
30
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { withKnobs } from '@storybook/addon-knobs';
|
|
2
|
+
|
|
3
|
+
import AppAnnouncement from '@pega/react-sdk-components/lib/components/widgets/AppAnnouncement';
|
|
4
|
+
|
|
5
|
+
import { pyHome1Resolved, pyHome1Raw } from './mock.stories';
|
|
6
|
+
|
|
7
|
+
import {{COMPONENT_CLASS_NAME}} from './index.tsx';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: '{{COMPONENT_CLASS_NAME}}',
|
|
11
|
+
decorators: [withKnobs],
|
|
12
|
+
component: {{COMPONENT_CLASS_NAME}}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
16
|
+
|
|
17
|
+
const configProps = pyHome1Resolved.children[0].children[0].config;
|
|
18
|
+
|
|
19
|
+
const props = {
|
|
20
|
+
getPConnect: () => {
|
|
21
|
+
return {
|
|
22
|
+
getStateProps: () => {
|
|
23
|
+
return {};
|
|
24
|
+
},
|
|
25
|
+
getActionsApi: () => {
|
|
26
|
+
return {
|
|
27
|
+
getNextWork: () => {
|
|
28
|
+
return new Promise(resolve => {
|
|
29
|
+
resolve({});
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
updateFieldValue: () => {/* nothing */},
|
|
33
|
+
triggerFieldChange: () => {/* nothing */}
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
getChildren: () => {
|
|
37
|
+
return pyHome1Raw.children;
|
|
38
|
+
},
|
|
39
|
+
getComponentName: () => {
|
|
40
|
+
return '';
|
|
41
|
+
},
|
|
42
|
+
getLocalizedValue: value => {
|
|
43
|
+
return value;
|
|
44
|
+
},
|
|
45
|
+
getRawMetadata: () => {
|
|
46
|
+
return pyHome1Raw;
|
|
47
|
+
},
|
|
48
|
+
createComponent: config => {
|
|
49
|
+
if(config.type === 'AppAnnouncement') {
|
|
50
|
+
return (
|
|
51
|
+
<AppAnnouncement
|
|
52
|
+
header='Announcements'
|
|
53
|
+
description={configProps.description}
|
|
54
|
+
image={configProps.image.replace(/ /g, '+')}
|
|
55
|
+
datasource={configProps.datasource}
|
|
56
|
+
label={configProps.label}
|
|
57
|
+
whatsnewlink={configProps.whatsnewlink}
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
ignoreSuggestion: () => {/* nothing */},
|
|
63
|
+
acceptSuggestion: () => {/* nothing */},
|
|
64
|
+
setInheritedProps: () => {/* nothing */},
|
|
65
|
+
resolveConfigProps: () => {/* nothing */}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const regionAChildren = pyHome1Raw.children[0].children.map(child => {
|
|
71
|
+
return props.getPConnect().createComponent(child);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
<{{COMPONENT_CLASS_NAME}} {...props}>{regionAChildren}</{{COMPONENT_CLASS_NAME}}>
|
|
77
|
+
</>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export const pyHome1Raw = {
|
|
2
|
+
name: 'pyHome1',
|
|
3
|
+
type: 'View',
|
|
4
|
+
config: {
|
|
5
|
+
type: 'landingpage',
|
|
6
|
+
template: 'OneColumnPage',
|
|
7
|
+
icon: 'home-solid',
|
|
8
|
+
title: '@ENV APPLICATION_DESC',
|
|
9
|
+
ruleClass: 'DIXL-MediaCo-UIPages',
|
|
10
|
+
localeReference: '@LR DIXL-MEDIACO-UIPAGES!PAGE!PYHOME1',
|
|
11
|
+
enableGetNextWork: true,
|
|
12
|
+
context: 'pyPortal'
|
|
13
|
+
},
|
|
14
|
+
children: [
|
|
15
|
+
{
|
|
16
|
+
name: 'A',
|
|
17
|
+
type: 'Region',
|
|
18
|
+
children: [
|
|
19
|
+
{
|
|
20
|
+
type: 'AppAnnouncement',
|
|
21
|
+
config: {
|
|
22
|
+
label: '@L App announcement',
|
|
23
|
+
description:
|
|
24
|
+
"We've launched a brand new experience to accelerate your workflow. Check out the guides to help you get the most of Cosmos.",
|
|
25
|
+
whatsnewlink: 'https://design.pega.com',
|
|
26
|
+
image:
|
|
27
|
+
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8+PC9zdmc+',
|
|
28
|
+
datasource: {
|
|
29
|
+
source: [
|
|
30
|
+
{
|
|
31
|
+
"name": "New React based UI rendering"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "Support for followers and recents"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "New authoring experience"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
fields: {
|
|
41
|
+
name: '@P .pyLabel'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
classID: 'DIXL-MediaCo-UIPages'
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const pyHome1Resolved = {
|
|
53
|
+
name: 'pyHome1',
|
|
54
|
+
type: 'View',
|
|
55
|
+
config: {
|
|
56
|
+
type: 'landingpage',
|
|
57
|
+
template: 'OneColumnPage',
|
|
58
|
+
icon: 'home-solid',
|
|
59
|
+
title: '@ENV APPLICATION_DESC',
|
|
60
|
+
ruleClass: 'DIXL-MediaCo-UIPages',
|
|
61
|
+
localeReference: '@LR DIXL-MEDIACO-UIPAGES!PAGE!PYHOME1',
|
|
62
|
+
enableGetNextWork: true,
|
|
63
|
+
context: 'pyPortal'
|
|
64
|
+
},
|
|
65
|
+
children: [
|
|
66
|
+
{
|
|
67
|
+
name: 'A',
|
|
68
|
+
type: 'Region',
|
|
69
|
+
getPConnect: () => {
|
|
70
|
+
return {
|
|
71
|
+
getComponentName: () => {
|
|
72
|
+
return '';
|
|
73
|
+
},
|
|
74
|
+
getComponent: () => {
|
|
75
|
+
return pyHome1Resolved.children[0];
|
|
76
|
+
},
|
|
77
|
+
getConfigProps: () => {
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
children: [
|
|
83
|
+
{
|
|
84
|
+
type: 'AppAnnouncement',
|
|
85
|
+
config: {
|
|
86
|
+
label: '@L App announcement',
|
|
87
|
+
description:
|
|
88
|
+
"We've launched a brand new experience to accelerate your workflow. Check out the guides to help you get the most of Cosmos.",
|
|
89
|
+
whatsnewlink: 'https://design.pega.com',
|
|
90
|
+
image:
|
|
91
|
+
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8+PC9zdmc+',
|
|
92
|
+
datasource: {
|
|
93
|
+
source: [
|
|
94
|
+
{
|
|
95
|
+
"name": "New React based UI rendering"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "Support for followers and recents"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "New authoring experience"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
,
|
|
105
|
+
fields: {
|
|
106
|
+
name: '@P .pyLabel'
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
classID: 'DIXL-MediaCo-UIPages'
|
|
115
|
+
};
|
|
@@ -3,14 +3,15 @@ import inquirer from 'inquirer';
|
|
|
3
3
|
import ora from 'ora';
|
|
4
4
|
//import { element } from 'prop-types';
|
|
5
5
|
|
|
6
|
-
import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, COMPONENT_SCHEMA } from '../../constants.js';
|
|
6
|
+
import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, COMPONENT_SCHEMA, CATEGORY_CONSTELLATION, CATEGORY_CUSTOM, CATEGORY_OVERRIDE } from '../../constants.js';
|
|
7
7
|
import {
|
|
8
8
|
constructCompleteUrl,
|
|
9
9
|
deleteLocalComponent,
|
|
10
10
|
deleteServerComponent,
|
|
11
11
|
getComponentsObj,
|
|
12
12
|
getPegaServerConfig,
|
|
13
|
-
nodeFetch
|
|
13
|
+
nodeFetch,
|
|
14
|
+
getOptionsCategory
|
|
14
15
|
} from '../../util.js';
|
|
15
16
|
import { getComponentsFromServer } from '../list/helper.js';
|
|
16
17
|
|
|
@@ -22,25 +23,6 @@ export const SOURCE_OF_COMPONENT_TYPES = {
|
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
|
|
25
|
-
export const getOptionsCategory = (options) => {
|
|
26
|
-
let categoryType = null;
|
|
27
|
-
if (options.params[3]) {
|
|
28
|
-
let catType = options.params[3];
|
|
29
|
-
|
|
30
|
-
switch (catType.toLowerCase()) {
|
|
31
|
-
case "override" :
|
|
32
|
-
case "o" :
|
|
33
|
-
categoryType = "override";
|
|
34
|
-
break;
|
|
35
|
-
case "custom" :
|
|
36
|
-
case "c" :
|
|
37
|
-
categoryType = "custom";
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return categoryType;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
26
|
export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOption) => {
|
|
45
27
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
46
28
|
const categoryType = getOptionsCategory(options);
|
|
@@ -62,13 +44,13 @@ export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOp
|
|
|
62
44
|
choices: Object.values(SOURCE_OF_COMPONENT_TYPES),
|
|
63
45
|
default: defaultPegaServerConfig.sourceOfComponents,
|
|
64
46
|
when(answers) {
|
|
65
|
-
return !options.params[4] && answers.category !=
|
|
47
|
+
return !options.params[4] && answers.category != CATEGORY_OVERRIDE && categoryType != CATEGORY_OVERRIDE;
|
|
66
48
|
}
|
|
67
49
|
}
|
|
68
50
|
];
|
|
69
51
|
};
|
|
70
52
|
|
|
71
|
-
export const deleteLocalComponents = async (sourceOfComponents, category =
|
|
53
|
+
export const deleteLocalComponents = async (sourceOfComponents, category = CATEGORY_CUSTOM) => {
|
|
72
54
|
const localComponents = await getComponentsObj(true, category);
|
|
73
55
|
//const localComponentsAndSub = await getComponentsAndSubDirectory();
|
|
74
56
|
|
|
@@ -89,8 +71,11 @@ export const deleteLocalComponents = async (sourceOfComponents, category = "cust
|
|
|
89
71
|
]);
|
|
90
72
|
if (answers.confirmDeletion) {
|
|
91
73
|
await deleteLocalComponent(answers.componentKey, category);
|
|
74
|
+
if (category === "custom") {
|
|
75
|
+
await deleteLocalComponent(answers.componentKey, CATEGORY_CONSTELLATION);
|
|
76
|
+
}
|
|
92
77
|
|
|
93
|
-
if (category ===
|
|
78
|
+
if (category === CATEGORY_OVERRIDE) {
|
|
94
79
|
// need to remove the map as well
|
|
95
80
|
if (answers.componentKey != undefined) {
|
|
96
81
|
await deleteFromComponentMap(answers.componentKey, category);
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
import ora from 'ora';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
-
import { showVersion } from '../../util.js';
|
|
4
|
+
import { showVersion, getOptionsCategory } from '../../util.js';
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
deleteLocalComponents,
|
|
8
8
|
SOURCE_OF_COMPONENT_TYPES,
|
|
9
9
|
deleteServerComponents,
|
|
10
|
-
getDeleteComponentsQuestions
|
|
11
|
-
getOptionsCategory
|
|
10
|
+
getDeleteComponentsQuestions
|
|
12
11
|
} from './helper.js';
|
|
13
12
|
|
|
14
13
|
|
|
@@ -2,7 +2,7 @@ import chalk from 'chalk';
|
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
3
|
import ora from 'ora';
|
|
4
4
|
|
|
5
|
-
import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, COMPONENT_SCHEMA } from '../..//constants.js';
|
|
5
|
+
import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, COMPONENT_SCHEMA, CATEGORY_CONSTELLATION, CATEGORY_CUSTOM, CATEGORY_OVERRIDE } from '../..//constants.js';
|
|
6
6
|
import {
|
|
7
7
|
constructCompleteUrl,
|
|
8
8
|
deleteLocalComponent,
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
getComponentsObj,
|
|
12
12
|
getPegaServerConfig,
|
|
13
13
|
validateRulesetVersion,
|
|
14
|
-
nodeFetch
|
|
14
|
+
nodeFetch,
|
|
15
|
+
getOptionsCategory
|
|
15
16
|
} from '../../util.js';
|
|
16
17
|
import { getComponentsFromServer } from '../list/helper.js';
|
|
17
18
|
|
|
@@ -22,24 +23,6 @@ export const SOURCE_OF_COMPONENT_TYPES = {
|
|
|
22
23
|
LOCAL: 'Local'
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
export const getOptionsCategory = (options) => {
|
|
26
|
-
let categoryType = null;
|
|
27
|
-
if (options.params[3]) {
|
|
28
|
-
let catType = options.params[3];
|
|
29
|
-
|
|
30
|
-
switch (catType.toLowerCase()) {
|
|
31
|
-
case "override" :
|
|
32
|
-
case "o" :
|
|
33
|
-
categoryType = "override";
|
|
34
|
-
break;
|
|
35
|
-
case "custom" :
|
|
36
|
-
case "c" :
|
|
37
|
-
categoryType = "custom";
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return categoryType;
|
|
42
|
-
}
|
|
43
26
|
|
|
44
27
|
export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOption) => {
|
|
45
28
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
@@ -62,7 +45,7 @@ export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOp
|
|
|
62
45
|
choices: Object.values(SOURCE_OF_COMPONENT_TYPES),
|
|
63
46
|
default: defaultPegaServerConfig.sourceOfComponents,
|
|
64
47
|
when(answers) {
|
|
65
|
-
return !options.params[4] && answers.category !=
|
|
48
|
+
return !options.params[4] && answers.category != CATEGORY_OVERRIDE && categoryType != CATEGORY_OVERRIDE;
|
|
66
49
|
|
|
67
50
|
}
|
|
68
51
|
}
|
|
@@ -71,7 +54,7 @@ export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOp
|
|
|
71
54
|
|
|
72
55
|
|
|
73
56
|
|
|
74
|
-
export const deleteLocalComponents = async (sourceOfComponents, category =
|
|
57
|
+
export const deleteLocalComponents = async (sourceOfComponents, category = CATEGORY_CUSTOM) => {
|
|
75
58
|
const localComponents = await getComponentsObj(true, category);
|
|
76
59
|
|
|
77
60
|
for (var index in localComponents) {
|
|
@@ -99,8 +82,11 @@ export const deleteLocalComponents = async (sourceOfComponents, category = "cust
|
|
|
99
82
|
if (localComponents[index].type == undefined) {
|
|
100
83
|
var componentToDelete = localComponents[index].value;
|
|
101
84
|
await deleteLocalComponent(componentToDelete, category);
|
|
85
|
+
if (category === "custom") {
|
|
86
|
+
await deleteLocalComponent(componentToDelete, CATEGORY_CONSTELLATION);
|
|
87
|
+
}
|
|
102
88
|
|
|
103
|
-
if (category ===
|
|
89
|
+
if (category === CATEGORY_OVERRIDE) {
|
|
104
90
|
// need to remove the map as well
|
|
105
91
|
if (componentToDelete != undefined) {
|
|
106
92
|
await deleteFromComponentMap(componentToDelete, category);
|
|
@@ -6,11 +6,10 @@ import {
|
|
|
6
6
|
deleteLocalComponents,
|
|
7
7
|
SOURCE_OF_COMPONENT_TYPES,
|
|
8
8
|
deleteServerComponents,
|
|
9
|
-
getDeleteComponentsQuestions
|
|
10
|
-
getOptionsCategory
|
|
9
|
+
getDeleteComponentsQuestions
|
|
11
10
|
} from './helper.js';
|
|
12
11
|
|
|
13
|
-
import { showVersion } from '../../util.js';
|
|
12
|
+
import { showVersion, getOptionsCategory } from '../../util.js';
|
|
14
13
|
|
|
15
14
|
const deleteComponentsFn = async (sourceOfComponents, answers) => {
|
|
16
15
|
switch (sourceOfComponents) {
|
package/src/tasks/list/helper.js
CHANGED
|
@@ -4,8 +4,8 @@ import https from 'https';
|
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import fetch from 'node-fetch';
|
|
6
6
|
|
|
7
|
-
import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH, COMPONENT_SCHEMA } from '../../constants.js';
|
|
8
|
-
import { constructCompleteUrl, getComponents, getPegaServerConfig } from '../../util.js';
|
|
7
|
+
import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH, COMPONENT_SCHEMA, CATEGORY_CUSTOM } from '../../constants.js';
|
|
8
|
+
import { constructCompleteUrl, getComponents, getPegaServerConfig, getOptionsCategory } from '../../util.js';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
export const SOURCE_OF_COMPONENT_TYPES = {
|
|
@@ -13,24 +13,6 @@ export const SOURCE_OF_COMPONENT_TYPES = {
|
|
|
13
13
|
LOCAL: 'Local'
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export const getOptionsCategory = (options) => {
|
|
17
|
-
let categoryType = null;
|
|
18
|
-
if (options.params[3]) {
|
|
19
|
-
let catType = options.params[3];
|
|
20
|
-
|
|
21
|
-
switch (catType.toLowerCase()) {
|
|
22
|
-
case "override" :
|
|
23
|
-
case "o" :
|
|
24
|
-
categoryType = "override";
|
|
25
|
-
break;
|
|
26
|
-
case "custom" :
|
|
27
|
-
case "c" :
|
|
28
|
-
categoryType = "custom";
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return categoryType;
|
|
33
|
-
}
|
|
34
16
|
|
|
35
17
|
export const getListComponentsQuestions = async (options, sourceOfComponentsOption) => {
|
|
36
18
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
@@ -60,7 +42,7 @@ export const getListComponentsQuestions = async (options, sourceOfComponentsOpti
|
|
|
60
42
|
];
|
|
61
43
|
};
|
|
62
44
|
|
|
63
|
-
export const listLocalComponents = async (sourceOfComponents, category =
|
|
45
|
+
export const listLocalComponents = async (sourceOfComponents, category = CATEGORY_CUSTOM) => {
|
|
64
46
|
let localComponents = await getComponents(false, category);
|
|
65
47
|
localComponents = localComponents.map(name => ({ 'Rule name': name }));
|
|
66
48
|
if (localComponents.length > 0) {
|
package/src/tasks/list/index.js
CHANGED
|
@@ -7,11 +7,10 @@ import {
|
|
|
7
7
|
SOURCE_OF_COMPONENT_TYPES,
|
|
8
8
|
getComponentsFromServer,
|
|
9
9
|
displayServerComponents,
|
|
10
|
-
getListComponentsQuestions
|
|
11
|
-
getOptionsCategory
|
|
10
|
+
getListComponentsQuestions
|
|
12
11
|
} from './helper.js';
|
|
13
12
|
|
|
14
|
-
import { showVersion } from '../../util.js';
|
|
13
|
+
import { showVersion, getOptionsCategory } from '../../util.js';
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
const getList = async (sourceOfComponents, answers) => {
|
package/src/tasks/map/map.js
CHANGED
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
12
|
COMPONENTS_DIRECTORY_PATH,
|
|
13
|
-
DXCB_CONFIG_JSON_FILENAME
|
|
13
|
+
DXCB_CONFIG_JSON_FILENAME,
|
|
14
|
+
CATEGORY_CUSTOM
|
|
14
15
|
} from '../../constants.js';
|
|
15
16
|
|
|
16
17
|
export const SDK_LOCAL_COMPONENT_MAP_FILENAME = "sdk-local-component-map.js";
|
|
@@ -18,7 +19,7 @@ export const COMPONENT_PATH = "./src/components";
|
|
|
18
19
|
export const IMPORT_END_TAG = "/*import end";
|
|
19
20
|
export const MAP_END_TAG = "/*map end";
|
|
20
21
|
|
|
21
|
-
export const updateComponentMap = async (componentKey, category =
|
|
22
|
+
export const updateComponentMap = async (componentKey, category = CATEGORY_CUSTOM) => {
|
|
22
23
|
|
|
23
24
|
const pegaConfigJsonPath = path.join(path.resolve(), DXCB_CONFIG_JSON_FILENAME);
|
|
24
25
|
const pegaLocalComponentMapPath = path.join(path.resolve(), SDK_LOCAL_COMPONENT_MAP_FILENAME);
|
|
@@ -77,7 +78,7 @@ export const updateComponentMap = async (componentKey, category = "custom") => {
|
|
|
77
78
|
|
|
78
79
|
};
|
|
79
80
|
|
|
80
|
-
export const deleteFromComponentMap = async (componentKey, category =
|
|
81
|
+
export const deleteFromComponentMap = async (componentKey, category = CATEGORY_CUSTOM) => {
|
|
81
82
|
const pegaLocalComponentMapPath = path.join(path.resolve(), SDK_LOCAL_COMPONENT_MAP_FILENAME);
|
|
82
83
|
const categoryDirectory = join("/", category.toLowerCase());
|
|
83
84
|
const pegaConfigJsonPath = path.join(path.resolve(), DXCB_CONFIG_JSON_FILENAME);
|
|
@@ -10,15 +10,7 @@ import ncp from 'ncp';
|
|
|
10
10
|
import chalk from 'chalk';
|
|
11
11
|
import { updateComponentMap } from '../map/map.js';
|
|
12
12
|
|
|
13
|
-
import { checkPathAccess, getTokenUrl, showVersion } from '../../util.js';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export const DXCB_CONFIG_JSON_FILENAME = 'dxcb.config.json';
|
|
17
|
-
export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
|
|
18
|
-
|
|
19
|
-
const pegaConfigJsonPath = path.join(path.resolve(), DXCB_CONFIG_JSON_FILENAME);
|
|
20
|
-
const pegaConfigInternalJsonPath = path.join(path.resolve(), DXCB_CONFIG_INTERNAL_JSON_FILENAME);
|
|
21
|
-
|
|
13
|
+
import { checkPathAccess, getTokenUrl, showVersion, getDirectoryFiles } from '../../util.js';
|
|
22
14
|
import {
|
|
23
15
|
convertIntoPascalCase,
|
|
24
16
|
compileMustacheTemplate,
|
|
@@ -28,7 +20,15 @@ import {
|
|
|
28
20
|
sanitize,
|
|
29
21
|
validateSemver
|
|
30
22
|
} from '@pega/dx-component-builder-sdk/src/util.js';
|
|
31
|
-
import { COMPONENT_SCHEMA } from '../../constants.js';
|
|
23
|
+
import { COMPONENT_SCHEMA, CATEGORY_OVERRIDE } from '../../constants.js';
|
|
24
|
+
|
|
25
|
+
export const DXCB_CONFIG_JSON_FILENAME = 'dxcb.config.json';
|
|
26
|
+
export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
|
|
27
|
+
|
|
28
|
+
const pegaConfigJsonPath = path.join(path.resolve(), DXCB_CONFIG_JSON_FILENAME);
|
|
29
|
+
const pegaConfigInternalJsonPath = path.join(path.resolve(), DXCB_CONFIG_INTERNAL_JSON_FILENAME);
|
|
30
|
+
|
|
31
|
+
|
|
32
32
|
|
|
33
33
|
const copy = promisify(ncp);
|
|
34
34
|
|
|
@@ -62,9 +62,9 @@ const validateCompile = async (
|
|
|
62
62
|
componentKey = componentKey.split("/")[1];
|
|
63
63
|
}
|
|
64
64
|
const typeLC = type.toLowerCase();
|
|
65
|
-
const targetDirectory = await getComponentDirectoryPath(join(typeLC, "/",componentKey),
|
|
65
|
+
const targetDirectory = await getComponentDirectoryPath(join(typeLC, "/",componentKey), CATEGORY_OVERRIDE);
|
|
66
66
|
|
|
67
|
-
const components = await getComponents(false,
|
|
67
|
+
const components = await getComponents(false, CATEGORY_OVERRIDE);
|
|
68
68
|
if (components.includes(componentKey)) {
|
|
69
69
|
console.log(chalk.red(`${componentKey} component already exists in ${targetDirectory}`));
|
|
70
70
|
return;
|
|
@@ -80,7 +80,7 @@ const validateCompile = async (
|
|
|
80
80
|
console.log(chalk.green(`> Created ${componentKey} component in ${targetDirectory}`));
|
|
81
81
|
|
|
82
82
|
const componentKeyWithType = join(type, componentKey);
|
|
83
|
-
await updateComponentMap(componentKeyWithType,
|
|
83
|
+
await updateComponentMap(componentKeyWithType, CATEGORY_OVERRIDE);
|
|
84
84
|
|
|
85
85
|
console.log(chalk.green(`> Added ${componentKeyWithType} to map`));
|
|
86
86
|
|