@pega/dx-component-builder-sdk 0.1.6 → 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 +5 -4
- 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 +7 -25
- package/src/tasks/delete/index.js +2 -3
- package/src/tasks/delete-all/helper.js +7 -24
- 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 +56 -10
package/package.json
CHANGED
package/src/constants.js
CHANGED
|
@@ -22,6 +22,10 @@ export const COMPONENT_PREFIX_WIDGETS_PATH = "widgets/";
|
|
|
22
22
|
export const COMPONENT_PREFIX_DSE_PATH = "designSystemExtensions/";
|
|
23
23
|
export const COMPONENT_PREFIX_INFRA_PATH = "infra/";
|
|
24
24
|
|
|
25
|
+
export const CATEGORY_CUSTOM = "custom";
|
|
26
|
+
export const CATEGORY_OVERRIDE = "override";
|
|
27
|
+
export const CATEGORY_CONSTELLATION = "constellation";
|
|
28
|
+
|
|
25
29
|
/* REST end points */
|
|
26
30
|
export const PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT = 'PRRestService/dev/v1/publish_component';
|
|
27
31
|
export const LIST_COMPONENT_SERVICE_REST_ENDPOINT = 'PRRestService/dev/v1/list_component';
|
|
@@ -225,7 +229,7 @@ export const COMPONENT_SCHEMA = {
|
|
|
225
229
|
},
|
|
226
230
|
{
|
|
227
231
|
name: 'Radio Buttons',
|
|
228
|
-
value: '
|
|
232
|
+
value: 'RadioButtons'
|
|
229
233
|
},
|
|
230
234
|
{
|
|
231
235
|
name: 'Semantic Link',
|
|
@@ -312,8 +316,8 @@ export const COMPONENT_SCHEMA = {
|
|
|
312
316
|
value: 'DeferLoad'
|
|
313
317
|
},
|
|
314
318
|
{
|
|
315
|
-
name: 'Error
|
|
316
|
-
value: '
|
|
319
|
+
name: 'Error Boundary',
|
|
320
|
+
value: 'ErrorBoundary'
|
|
317
321
|
},
|
|
318
322
|
{
|
|
319
323
|
name: 'Multi Step',
|
|
@@ -493,7 +497,7 @@ export const COMPONENT_SCHEMA = {
|
|
|
493
497
|
widgets: [
|
|
494
498
|
{
|
|
495
499
|
name: 'App Announcement',
|
|
496
|
-
value: '
|
|
500
|
+
value: 'AppAnnouncement'
|
|
497
501
|
},
|
|
498
502
|
{
|
|
499
503
|
name: 'Case History',
|
|
@@ -12,31 +12,13 @@ import {
|
|
|
12
12
|
getComponents,
|
|
13
13
|
getComponentsObj,
|
|
14
14
|
getPegaServerConfig,
|
|
15
|
-
validateRulesetVersion
|
|
15
|
+
validateRulesetVersion,
|
|
16
|
+
getOptionsCategory,
|
|
16
17
|
} from '../../util.js';
|
|
17
|
-
import { PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH, COMPONENT_SCHEMA } from '../../constants.js';
|
|
18
|
+
import { PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH, COMPONENT_SCHEMA, CATEGORY_CUSTOM } from '../../constants.js';
|
|
18
19
|
|
|
19
|
-
export const getOptionsCategory = (options) => {
|
|
20
|
-
let categoryType = null;
|
|
21
|
-
if (options.params[3]) {
|
|
22
|
-
let catType = options.params[3];
|
|
23
|
-
|
|
24
|
-
switch (catType.toLowerCase()) {
|
|
25
|
-
case "override" :
|
|
26
|
-
case "o" :
|
|
27
|
-
categoryType = "override";
|
|
28
|
-
break;
|
|
29
|
-
case "custom" :
|
|
30
|
-
case "c" :
|
|
31
|
-
categoryType = "custom";
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return categoryType;
|
|
36
|
-
}
|
|
37
20
|
|
|
38
21
|
export const getBuildCategory = async (options) => {
|
|
39
|
-
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
40
22
|
const categoryType = getOptionsCategory(options);
|
|
41
23
|
|
|
42
24
|
return [
|
|
@@ -83,7 +65,7 @@ export const getBuildComponentQuestions = async (category) => {
|
|
|
83
65
|
];
|
|
84
66
|
};
|
|
85
67
|
|
|
86
|
-
export const zipComponent = async (componentKey, category =
|
|
68
|
+
export const zipComponent = async (componentKey, category = CATEGORY_CUSTOM) => {
|
|
87
69
|
const srcDirectory = await getComponentDirectoryPath(componentKey, category);
|
|
88
70
|
const buildDirectory = await path.join(path.resolve(), 'dist/components', componentKey);
|
|
89
71
|
const configJson = `${srcDirectory}/config.json`;
|
package/src/tasks/build/index.js
CHANGED
|
@@ -6,8 +6,10 @@ import validate from '../validator/index.js';
|
|
|
6
6
|
|
|
7
7
|
import bundleComponent from '../bundle/index.js';
|
|
8
8
|
import lintComponent from '../linter/index.js';
|
|
9
|
-
import { getBuildComponentQuestions, getBuildCategory
|
|
10
|
-
import { getComponentDirectoryPath, showVersion } from '../../util.js';
|
|
9
|
+
import { getBuildComponentQuestions, getBuildCategory } from './helper.js';
|
|
10
|
+
import { getComponentDirectoryPath, showVersion, getOptionsCategory } from '../../util.js';
|
|
11
|
+
|
|
12
|
+
import { CATEGORY_CUSTOM } from '../../constants.js';
|
|
11
13
|
|
|
12
14
|
export default async options => {
|
|
13
15
|
showVersion();
|
|
@@ -28,7 +30,45 @@ export default async options => {
|
|
|
28
30
|
...answers
|
|
29
31
|
};
|
|
30
32
|
|
|
31
|
-
const
|
|
33
|
+
const customTasks = new Listr(
|
|
34
|
+
[
|
|
35
|
+
{
|
|
36
|
+
title: 'Validate config schema',
|
|
37
|
+
task: async () => {
|
|
38
|
+
await validate(componentKey, category);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: 'Lint component',
|
|
43
|
+
task: async () => {
|
|
44
|
+
const targetDirectory = await getComponentDirectoryPath(componentKey, category);
|
|
45
|
+
// console.log(`in buildComponent Lint component task: componentKey: ${componentKey} targetDirectory: ${targetDirectory}`);
|
|
46
|
+
await lintComponent(targetDirectory);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: 'Bundle component',
|
|
51
|
+
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, category),
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
title: 'Lint companion component',
|
|
55
|
+
task: async () => {
|
|
56
|
+
const targetDirectory = await getComponentDirectoryPath(componentKey, "constellation");
|
|
57
|
+
// console.log(`in buildComponent Lint component task: componentKey: ${componentKey} targetDirectory: ${targetDirectory}`);
|
|
58
|
+
await lintComponent(targetDirectory);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
title: 'Bundle companion component',
|
|
63
|
+
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, "constellation")
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
{
|
|
67
|
+
exitOnError: true
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const overrideTasks = new Listr(
|
|
32
72
|
[
|
|
33
73
|
{
|
|
34
74
|
title: 'Validate config schema',
|
|
@@ -47,7 +87,6 @@ export default async options => {
|
|
|
47
87
|
{
|
|
48
88
|
title: 'Bundle Component',
|
|
49
89
|
task: async () => await bundleComponent(componentKey, sourceMap, devBuild, category),
|
|
50
|
-
skip: () => (options.skipBundle ? 'Skipped bundling component' : undefined)
|
|
51
90
|
}
|
|
52
91
|
],
|
|
53
92
|
{
|
|
@@ -55,8 +94,16 @@ export default async options => {
|
|
|
55
94
|
}
|
|
56
95
|
);
|
|
57
96
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
97
|
+
if (category == CATEGORY_CUSTOM) {
|
|
98
|
+
await customTasks.run().catch(err => {
|
|
99
|
+
console.log(chalk.bold.red(err.toString()));
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
await overrideTasks.run().catch(err => {
|
|
104
|
+
console.log(chalk.bold.red(err.toString()));
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
61
108
|
return true;
|
|
62
109
|
};
|
|
@@ -2,14 +2,14 @@ import path from 'path';
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import { stat } from 'fs/promises';
|
|
4
4
|
|
|
5
|
-
import { BUILD_CONFIG_JSON_FILENAME } from '../../constants.js';
|
|
5
|
+
import { BUILD_CONFIG_JSON_FILENAME, CATEGORY_CUSTOM } from '../../constants.js';
|
|
6
6
|
import { getComponentDirectoryPath } from '../../util.js';
|
|
7
7
|
|
|
8
8
|
import buildComponent from './builder/index.js';
|
|
9
9
|
|
|
10
10
|
const extensions = ['ts', 'tsx', 'js', 'jsx'];
|
|
11
11
|
|
|
12
|
-
const bundleComponent = async (componentKey, sourceMap, devBuild, category =
|
|
12
|
+
const bundleComponent = async (componentKey, sourceMap, devBuild, category = CATEGORY_CUSTOM) => {
|
|
13
13
|
const componentDirectory = await getComponentDirectoryPath(componentKey, category);
|
|
14
14
|
|
|
15
15
|
const idx = (
|
|
@@ -9,6 +9,7 @@ import ncp from 'ncp';
|
|
|
9
9
|
import chalk from 'chalk';
|
|
10
10
|
|
|
11
11
|
import { checkPathAccess, getTokenUrl, showVersion } from '../../util.js';
|
|
12
|
+
import { CATEGORY_CONSTELLATION } from '../../constants.js';
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
export const DXCB_CONFIG_JSON_FILENAME = 'dxcb.config.json';
|
|
@@ -44,7 +45,7 @@ const copyComponentTemplate = async options => {
|
|
|
44
45
|
|
|
45
46
|
};
|
|
46
47
|
|
|
47
|
-
const compileMustacheTemplates = async (
|
|
48
|
+
export const compileMustacheTemplates = async (
|
|
48
49
|
componentDirectory,
|
|
49
50
|
{
|
|
50
51
|
componentKey,
|
|
@@ -166,13 +167,13 @@ const validateCompile = async (
|
|
|
166
167
|
|
|
167
168
|
const typeLC = type.toLowerCase();
|
|
168
169
|
const targetDirectory = await getComponentDirectoryPath(join(typeLC, "/",componentKey));
|
|
169
|
-
const targetDirectoryConstellation = await getComponentDirectoryPath(join(typeLC, "/",componentKey),
|
|
170
|
+
const targetDirectoryConstellation = await getComponentDirectoryPath(join(typeLC, "/",componentKey), CATEGORY_CONSTELLATION);
|
|
170
171
|
|
|
171
172
|
const components = await getComponents(false);
|
|
172
173
|
if (components.includes(componentKey)) {
|
|
173
174
|
console.log(chalk.red(`${componentKey} component already exists in ${targetDirectory}`));
|
|
174
175
|
|
|
175
|
-
let componentsConstellation = await getComponents(false,
|
|
176
|
+
let componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
|
|
176
177
|
if (components.includes(componentKey)) {
|
|
177
178
|
console.log(chalk.red(`${componentKey} companion component already exists in ${targetDirectoryConstellation}`));
|
|
178
179
|
}
|
|
@@ -180,7 +181,7 @@ const validateCompile = async (
|
|
|
180
181
|
return;
|
|
181
182
|
}
|
|
182
183
|
// test for constellation
|
|
183
|
-
const componentsConstellation = await getComponents(false,
|
|
184
|
+
const componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
|
|
184
185
|
if (components.includes(componentKey)) {
|
|
185
186
|
console.log(chalk.red(`${componentKey} companion component already exists in ${targetDirectoryConstellation}`));
|
|
186
187
|
return;
|
|
@@ -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: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zEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8+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+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuM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|
|
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
|
|
|
@@ -90,10 +72,10 @@ export const deleteLocalComponents = async (sourceOfComponents, category = "cust
|
|
|
90
72
|
if (answers.confirmDeletion) {
|
|
91
73
|
await deleteLocalComponent(answers.componentKey, category);
|
|
92
74
|
if (category === "custom") {
|
|
93
|
-
await deleteLocalComponent(answers.componentKey,
|
|
75
|
+
await deleteLocalComponent(answers.componentKey, CATEGORY_CONSTELLATION);
|
|
94
76
|
}
|
|
95
77
|
|
|
96
|
-
if (category ===
|
|
78
|
+
if (category === CATEGORY_OVERRIDE) {
|
|
97
79
|
// need to remove the map as well
|
|
98
80
|
if (answers.componentKey != undefined) {
|
|
99
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) {
|
|
@@ -100,10 +83,10 @@ export const deleteLocalComponents = async (sourceOfComponents, category = "cust
|
|
|
100
83
|
var componentToDelete = localComponents[index].value;
|
|
101
84
|
await deleteLocalComponent(componentToDelete, category);
|
|
102
85
|
if (category === "custom") {
|
|
103
|
-
await deleteLocalComponent(componentToDelete,
|
|
86
|
+
await deleteLocalComponent(componentToDelete, CATEGORY_CONSTELLATION);
|
|
104
87
|
}
|
|
105
88
|
|
|
106
|
-
if (category ===
|
|
89
|
+
if (category === CATEGORY_OVERRIDE) {
|
|
107
90
|
// need to remove the map as well
|
|
108
91
|
if (componentToDelete != undefined) {
|
|
109
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) => {
|