@pega/dx-component-builder-sdk 8.23.14 → 8.23.16
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/cli.js +1 -1
- package/src/tasks/build/helper.js +1 -1
- package/src/tasks/build-all/helper.js +1 -1
- package/src/tasks/create/templates/SDK-React/field/Decimal/demo.stories.jsx.mustache +2 -1
- package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +1 -1
- package/src/tasks/create/templates/SDK-React/template/PAGE/demo.stories.jsx.mustache +1 -0
- package/src/tasks/create/templates/SDK-React/widget/PAGE/index.tsx.mustache +7 -7
- package/src/tasks/publish/helper.js +16 -1
- package/src/tasks/publish-all/helper.js +12 -3
- package/src/tasks/publish-all/index.js +8 -0
- package/src/tasks/validator/index.js +12 -6
- package/src/util.js +21 -2
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -53,7 +53,7 @@ export const getBuildComponentQuestions = async (category) => {
|
|
|
53
53
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
54
54
|
|
|
55
55
|
if (components.length == 0) {
|
|
56
|
-
console.log(chalk.
|
|
56
|
+
console.log(chalk.redBright("No components to build"));
|
|
57
57
|
process.exit(1);
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -47,7 +47,7 @@ export const getBuildComponentQuestions = async (category) => {
|
|
|
47
47
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
48
48
|
|
|
49
49
|
if (components.length == 0) {
|
|
50
|
-
console.log(chalk.
|
|
50
|
+
console.log(chalk.redBright("No components to build"));
|
|
51
51
|
process.exit(1);
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -41,7 +41,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
41
41
|
const propName = pConn.getStateProps().value;
|
|
42
42
|
const helperTextToDisplay = validatemessage || helperText;
|
|
43
43
|
|
|
44
|
-
const [decValue, setDecimalvalue] = useState();
|
|
44
|
+
const [decValue, setDecimalvalue] = useState("");
|
|
45
45
|
const [theCurrDec, setCurrDec] = useState(".");
|
|
46
46
|
const [theCurrSep, setCurrSep] = useState(",");
|
|
47
47
|
|
|
@@ -49,7 +49,7 @@ export default function {{COMPONENT_CLASS_NAME}}(props: any) {
|
|
|
49
49
|
'data-test-id': testId
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
const [currValue, setCurrValue] = useState();
|
|
52
|
+
const [currValue, setCurrValue] = useState("");
|
|
53
53
|
const [theCurrSym, setCurrSym] = useState("$");
|
|
54
54
|
const [theCurrDec, setCurrDec] = useState(".");
|
|
55
55
|
const [theCurrSep, setCurrSep] = useState(",");
|
|
@@ -49,6 +49,7 @@ export const Base{{COMPONENT_CLASS_NAME}} = () => {
|
|
|
49
49
|
if(config.type === 'AppAnnouncement') {
|
|
50
50
|
return (
|
|
51
51
|
<AppAnnouncement
|
|
52
|
+
key='announcement'
|
|
52
53
|
header='Announcements'
|
|
53
54
|
description={configProps.description}
|
|
54
55
|
image={configProps.image.replace(/ /g, '+')}
|
|
@@ -62,16 +62,16 @@ export default function {{COMPONENT_CLASS_NAME}}(props) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
{{COMPONENT_CLASS_NAME}}.defaultProps = {
|
|
65
|
-
header: PropTypes.string,
|
|
66
|
-
description: PropTypes.string,
|
|
67
|
-
datasource: PropTypes.instanceOf(Object),
|
|
68
|
-
whatsnewlink: PropTypes.string
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
{{COMPONENT_CLASS_NAME}}.propTypes = {
|
|
72
65
|
header: "",
|
|
73
66
|
description: "",
|
|
74
67
|
// image: "",
|
|
75
68
|
datasource: [],
|
|
76
69
|
whatsnewlink: ""
|
|
77
70
|
};
|
|
71
|
+
|
|
72
|
+
{{COMPONENT_CLASS_NAME}}.propTypes = {
|
|
73
|
+
header: PropTypes.string,
|
|
74
|
+
description: PropTypes.string,
|
|
75
|
+
datasource: PropTypes.instanceOf(Object),
|
|
76
|
+
whatsnewlink: PropTypes.string
|
|
77
|
+
};
|
|
@@ -55,6 +55,12 @@ export const getBuildCategory = async (options) => {
|
|
|
55
55
|
|
|
56
56
|
export const getPublishComponentQuestions = async (category) => {
|
|
57
57
|
const components = await getComponentsObj(true, category);
|
|
58
|
+
|
|
59
|
+
if (components.length == 0) {
|
|
60
|
+
console.log(chalk.redBright("No components to publish"));
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
58
64
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
59
65
|
|
|
60
66
|
return [
|
|
@@ -241,7 +247,16 @@ export const publishComponentToServer = async data => {
|
|
|
241
247
|
/* TODO - Handle refresh_token */
|
|
242
248
|
} else if (status == 200) {
|
|
243
249
|
console.log(chalk.bold.green(`Success : ${respData.message}`));
|
|
244
|
-
}
|
|
250
|
+
}
|
|
251
|
+
else if (status === 403) {
|
|
252
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
253
|
+
Promise.reject(
|
|
254
|
+
`${chalk.bold.red(
|
|
255
|
+
'Error forbidden: User does not have privileges to Publish.'
|
|
256
|
+
)}`
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
245
260
|
throw new Error(`${respData.message}`);
|
|
246
261
|
}
|
|
247
262
|
})
|
|
@@ -54,8 +54,8 @@ export const getBuildCategory = async (options) => {
|
|
|
54
54
|
];
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
export const getPublishComponentQuestions = async () => {
|
|
58
|
-
|
|
57
|
+
export const getPublishComponentQuestions = async (category) => {
|
|
58
|
+
|
|
59
59
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
60
60
|
|
|
61
61
|
return [
|
|
@@ -238,7 +238,16 @@ export const publishComponentToServer = async data => {
|
|
|
238
238
|
/* TODO - Handle refresh_token */
|
|
239
239
|
} else if (status == 200) {
|
|
240
240
|
console.log(chalk.bold.green(`Success : ${respData.message}`));
|
|
241
|
-
}
|
|
241
|
+
}
|
|
242
|
+
else if (status === 403) {
|
|
243
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
244
|
+
Promise.reject(
|
|
245
|
+
`${chalk.bold.red(
|
|
246
|
+
'Error forbidden: User does not have privileges to Publish.'
|
|
247
|
+
)}`
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
242
251
|
throw new Error(`${respData.message}`);
|
|
243
252
|
}
|
|
244
253
|
})
|
|
@@ -154,6 +154,13 @@ export default async options => {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
const components = await getComponentsObj(false, category);
|
|
157
|
+
|
|
158
|
+
// end if find no componets
|
|
159
|
+
if (components.length == 0) {
|
|
160
|
+
console.log(chalk.redBright("No components to publish"));
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
|
|
157
164
|
const questions = await getPublishComponentQuestions(category);
|
|
158
165
|
const answers = await inquirer.prompt(questions);
|
|
159
166
|
const {sourceMap, devBuild } = answers;
|
|
@@ -180,6 +187,7 @@ export default async options => {
|
|
|
180
187
|
|
|
181
188
|
}
|
|
182
189
|
else {
|
|
190
|
+
|
|
183
191
|
for (const component of components) {
|
|
184
192
|
const componentKey = component.value;
|
|
185
193
|
const componentKeyName = component.name;
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
COMPONENT_SCHEMA,
|
|
10
10
|
CATEGORY_CUSTOM,
|
|
11
11
|
CATEGORY_OVERRIDE } from '../../constants.js';
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
import {
|
|
14
14
|
getComponentDirectoryPath,
|
|
15
15
|
getComponents,
|
|
@@ -34,7 +34,7 @@ const allowedOverrideSubtypes = [
|
|
|
34
34
|
...COMPONENT_SCHEMA.subtype.field.map(({ value }) => value),
|
|
35
35
|
...COMPONENT_SCHEMA.subtype.template.map(({ value }) => value),
|
|
36
36
|
...COMPONENT_SCHEMA.subtype.widget.map(({ value }) => value)
|
|
37
|
-
]), "ACTION", "DATA_CAPTURE", "SUMMARY", "CASEVIEW", "DATAVIEW", "LIST"
|
|
37
|
+
]), "ACTION", "DATA_CAPTURE", "SUMMARY", "CASEVIEW", "DATAVIEW", "LIST", "TAB"
|
|
38
38
|
];
|
|
39
39
|
|
|
40
40
|
const schema = {
|
|
@@ -312,7 +312,7 @@ const overrideSchema = {
|
|
|
312
312
|
};
|
|
313
313
|
|
|
314
314
|
const validateSchema = ajv.compile(schema);
|
|
315
|
-
const
|
|
315
|
+
const validateOverrideSchema = ajv.compile(overrideSchema);
|
|
316
316
|
|
|
317
317
|
|
|
318
318
|
|
|
@@ -352,7 +352,7 @@ export default async (option, category = CATEGORY_CUSTOM) => {
|
|
|
352
352
|
}
|
|
353
353
|
else if (category === CATEGORY_OVERRIDE) {
|
|
354
354
|
// for now, if now file just end
|
|
355
|
-
console.log(`${chalk.bold.yellow('Config file not
|
|
355
|
+
console.log(`${chalk.bold.yellow('Config file not available for: ' + componentToValidate)}`);
|
|
356
356
|
return;
|
|
357
357
|
}
|
|
358
358
|
}
|
|
@@ -360,7 +360,7 @@ export default async (option, category = CATEGORY_CUSTOM) => {
|
|
|
360
360
|
//const data = JSON.parse(fs.readFileSync(path.resolve(configFile), 'utf8'));
|
|
361
361
|
const data = JSON.parse(configData);
|
|
362
362
|
|
|
363
|
-
const valid = (category === CATEGORY_OVERRIDE) ?
|
|
363
|
+
const valid = (category === CATEGORY_OVERRIDE) ? validateOverrideSchema(data) : validateSchema(data);
|
|
364
364
|
|
|
365
365
|
if (valid) {
|
|
366
366
|
|
|
@@ -383,6 +383,12 @@ export default async (option, category = CATEGORY_CUSTOM) => {
|
|
|
383
383
|
|
|
384
384
|
console.log(`${chalk.bold.green(componentToValidate)} schema is valid`);
|
|
385
385
|
} else {
|
|
386
|
-
|
|
386
|
+
if (category === CATEGORY_OVERRIDE) {
|
|
387
|
+
throw new Error(`Invalid: ${ajv.errorsText(validateOverrideSchema.errors)}`);
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
throw new Error(`Invalid: ${ajv.errorsText(validateSchema.errors)}`);
|
|
391
|
+
}
|
|
392
|
+
|
|
387
393
|
}
|
|
388
394
|
};
|
package/src/util.js
CHANGED
|
@@ -120,6 +120,8 @@ export const deleteServerComponent = async componentKey => {
|
|
|
120
120
|
try {
|
|
121
121
|
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
122
122
|
|
|
123
|
+
let status = 500;
|
|
124
|
+
|
|
123
125
|
if (OauthData) {
|
|
124
126
|
const {
|
|
125
127
|
access_token: accessToken,
|
|
@@ -133,7 +135,10 @@ export const deleteServerComponent = async componentKey => {
|
|
|
133
135
|
Authorization: `${tokenType} ${accessToken}`
|
|
134
136
|
}
|
|
135
137
|
})
|
|
136
|
-
.then(response =>
|
|
138
|
+
.then(response => {
|
|
139
|
+
status = response.status;
|
|
140
|
+
return response.text();
|
|
141
|
+
})
|
|
137
142
|
.then(resp => {
|
|
138
143
|
const respData = JSON.parse(resp);
|
|
139
144
|
if (respData.status == 200) {
|
|
@@ -142,7 +147,21 @@ export const deleteServerComponent = async componentKey => {
|
|
|
142
147
|
throw new Error(`${respData.message}`);
|
|
143
148
|
}
|
|
144
149
|
})
|
|
145
|
-
.catch(e =>
|
|
150
|
+
.catch(e => {
|
|
151
|
+
if (status === 403) {
|
|
152
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
153
|
+
Promise.reject(
|
|
154
|
+
`${chalk.bold.red(
|
|
155
|
+
'Error forbidden: User does not have privileges to Delete.'
|
|
156
|
+
)}`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
|
161
|
+
Promise.reject(`${chalk.bold.red(e)}`)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
});
|
|
146
165
|
}
|
|
147
166
|
} catch (error) {
|
|
148
167
|
console.log(`\n${chalk.bold.red(error)}`);
|