@pega/dx-component-builder-sdk 0.1.42 → 0.1.44
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/tasks/authenticate/index.js +57 -24
- package/src/tasks/build/index.js +2 -2
- package/src/tasks/build-all/index.js +2 -2
- package/src/tasks/map-all/index.js +2 -2
- package/src/tasks/override/index.js +10 -5
- package/src/tasks/publish/index.js +2 -2
- package/src/tasks/publish-all/index.js +2 -2
package/package.json
CHANGED
|
@@ -25,6 +25,29 @@ const generateAccessToken = async config => {
|
|
|
25
25
|
const sTokenUri = `${server}${serverType === 'infinity' ? TOKEN_URL_V1 : LP_TOKEN_URL}`;
|
|
26
26
|
const sAuthorizeUri = `${server}${serverType === 'infinity' ? AUTHORIZE_URL_V1 : LP_AUTHORIZE_URL}`;
|
|
27
27
|
// console.log(`grantType: ${config.grantType}`);
|
|
28
|
+
const browserAuthSuccessMarkup = `<div style="width: 300px; padding: 10px;">
|
|
29
|
+
<svg xmlns="http://www. w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 311 68" version="1.1">
|
|
30
|
+
<title>Logo</title>
|
|
31
|
+
<defs/>
|
|
32
|
+
<g id="Symbols" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
33
|
+
<g id="Logo">
|
|
34
|
+
<g id="pega_logo_horizontal_positive_rgb">
|
|
35
|
+
<path d="M136.36,17.098 L136.173,17.009 C136.154,16.998 133.96,16.01 132.245,17.815 L132.026,18.046 L135.539,19.768 L136.36,17.098 Z M152.441,36.389 C152.441,36.389 150.91,39.13 150.224,40.143 C149.535,41.164 147.38,41.798 145.517,40.908 C144.665,40.503 136.694,35.854 133.644,36.12 C118.205,37.466 113.999,31.105 113.503,30.527 C113.005,29.949 112.077,30.218 112.74,31.355 C116.127,37.163 126.15,39.856 126.15,39.856 C128.771,46.172 129.085,50.597 129.085,50.597 C126.489,48.574 123.687,46.869 120.714,45.453 C112.768,40.121 100.329,33.518 83.207,29.379 C84.191,15.797 91.044,-3.837 123.092,0.806 C123.092,0.806 129.522,1.86 133.809,4.824 C133.809,4.824 132.779,5.904 131.425,7.256 C130.071,8.605 131.569,9.471 131.569,9.471 L138.338,14.792 C138.417,17.607 138.533,18.396 140.651,20.944 C142.769,23.487 151.004,32.112 152.081,33.266 C153.329,34.6 152.441,36.389 152.441,36.389 Z M78.633,9.915 C76.938,16.897 77.068,23.049 77.939,28.221 C76.33,27.901 74.697,27.594 73.014,27.32 C37.94,21.612 27.361,38.899 31.455,52.916 C19.86,57.274 8.963,62.263 0.214,67.162 C13.98,34.146 43.896,5.087 69.145,1.268 C77.389,0.181 79.708,5.529 78.633,9.915 L78.633,9.915 Z" id="Fill-1" fill="#1F2555"/>
|
|
36
|
+
<path d="M83.492,40.09 C97.157,39.01 110.054,40.381 120.713,45.453 C112.768,40.121 100.329,33.518 83.206,29.379 C82.864,34.111 83.23,38.107 83.492,40.09 Z M81.52,40.262 C66.209,41.723 48.105,46.663 31.455,52.916 C27.361,38.899 37.941,21.612 73.014,27.32 C74.697,27.594 76.33,27.901 77.938,28.221 C78.77,33.166 80.276,37.228 81.52,40.262 L81.52,40.262 Z" id="Fill-2" fill="#00A6A7"/>
|
|
37
|
+
<path d="M286.63,35.039 L291.379,23.446 L296.129,35.039 L286.63,35.039 Z M287.854,14 L272.536,50 L280.553,50 L283.819,41.985 L298.938,41.985 L302.204,50 L310.427,50 L295.108,14 L287.854,14 Z M188.647,26.704 C188.647,29.787 186.335,32.153 182.375,32.153 L176.1,32.153 L176.1,21.149 L182.219,21.149 C186.181,21.149 188.647,23.052 188.647,26.601 L188.647,26.704 Z M182.889,14 L168.18,14 L168.18,50 L176.1,50 L176.1,39.2 L182.115,39.2 C190.19,39.2 196.673,34.878 196.673,26.547 L196.673,26.444 C196.673,19.09 191.48,14 182.889,14 Z M239.764,18.02 C235.989,21.708 234.075,26.376 234.075,31.896 C234.075,37.421 235.953,42.054 239.663,45.675 C243.366,49.292 248.022,51.123 253.503,51.123 C259.992,51.123 265.064,49.159 268.587,45.284 L268.769,45.08 L268.769,28.556 L253.112,28.556 L253.112,35.244 L261.279,35.244 L261.279,41.993 C259.164,43.252 256.525,43.891 253.429,43.891 C250.221,43.891 247.454,42.792 245.203,40.62 C242.958,38.458 241.819,35.527 241.819,31.926 C241.819,28.322 242.992,25.379 245.304,23.18 C247.624,20.972 250.538,19.852 253.966,19.852 C255.769,19.852 257.366,20.074 258.711,20.512 C259.973,20.922 261.251,21.667 262.517,22.712 L266.897,17.183 C264.586,15.147 260.427,12.467 253.503,12.467 C248.162,12.467 243.539,14.336 239.764,18.02 Z M210.336,35.604 L225.842,35.604 L225.842,28.556 L210.336,28.556 L210.336,21.042 L229.623,21.042 L229.623,14 L202.466,14 L202.466,50 L229.879,50 L229.879,42.955 L210.336,42.955 L210.336,35.604 L210.336,35.604 Z" id="Fill-3" fill="#1F2555"/>
|
|
38
|
+
</g>
|
|
39
|
+
</g>
|
|
40
|
+
</g>
|
|
41
|
+
</svg>
|
|
42
|
+
</div>
|
|
43
|
+
<div style="font-size: 2em; font-family: Arial; padding: 10px">
|
|
44
|
+
Authentication is complete!!
|
|
45
|
+
</div>
|
|
46
|
+
<div style="font-size: 13m; font-family: Arial; padding: 10px">
|
|
47
|
+
This browser tab or window may be closed.
|
|
48
|
+
</div>
|
|
49
|
+
<div style="padding: 10px;">
|
|
50
|
+
</div>`;
|
|
28
51
|
|
|
29
52
|
const authCodeConfig = grantType === 'authCode' ? {
|
|
30
53
|
authorizeUri: sAuthorizeUri,
|
|
@@ -32,7 +55,7 @@ const generateAccessToken = async config => {
|
|
|
32
55
|
cert: config.cert,
|
|
33
56
|
key: config.key,
|
|
34
57
|
winTitle: 'DX Component Dev',
|
|
35
|
-
winBodyHtml:
|
|
58
|
+
winBodyHtml: browserAuthSuccessMarkup
|
|
36
59
|
} : {};
|
|
37
60
|
|
|
38
61
|
// Build auth config structure
|
|
@@ -56,30 +79,39 @@ const generateAccessToken = async config => {
|
|
|
56
79
|
authConfig.isolationId = isolationId;
|
|
57
80
|
// authConfig.noPKCE = true;
|
|
58
81
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
const auth = new PegaAuth(authConfig);
|
|
85
|
+
if (grantType === 'authCode') {
|
|
86
|
+
console.log(`${chalk.green('Awaiting authorization to complete (Ctrl-C to exit). You may need to enter credentials within your default browser.')}`);
|
|
87
|
+
}
|
|
88
|
+
// console.log(`authConfig: ${JSON.stringify(authConfig)}`);
|
|
89
|
+
|
|
90
|
+
auth.login()
|
|
91
|
+
.then((token) => {
|
|
92
|
+
if (token?.token_type) {
|
|
93
|
+
fs.writeFile(TOKEN_PATH, JSON.stringify(token), err => {
|
|
94
|
+
if (err) {
|
|
95
|
+
console.error(err);
|
|
96
|
+
return reject(authSuccess);
|
|
97
|
+
}
|
|
98
|
+
console.log(`${chalk.bold.green('Authenticated successfully !!')}`);
|
|
99
|
+
authSuccess = true;
|
|
100
|
+
return resolve(authSuccess);
|
|
101
|
+
});
|
|
102
|
+
} else {
|
|
103
|
+
console.log(`${chalk.bold.red('Authentication failed:' + JSON.stringify(token.errors ? token.errors : token))}`);
|
|
104
|
+
return reject(authSuccess);
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
.catch((e) => {
|
|
108
|
+
console.log(`${chalk.bold.red('Authentication failed:' + e)}`);
|
|
76
109
|
return reject(authSuccess);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
});
|
|
110
|
+
});
|
|
111
|
+
} catch(e) {
|
|
112
|
+
console.log(`Authentication failed: Problem initializing OAuth library`);
|
|
113
|
+
return reject(authSuccess);
|
|
114
|
+
}
|
|
83
115
|
});
|
|
84
116
|
};
|
|
85
117
|
|
|
@@ -142,6 +174,7 @@ export default async options => {
|
|
|
142
174
|
try {
|
|
143
175
|
authOK = await generateAccessToken(serverConfig);
|
|
144
176
|
} catch (e) {
|
|
177
|
+
console.log(`${chalk.bold.red('Authentication failed:' + JSON.stringify(e))}`);
|
|
145
178
|
}
|
|
146
179
|
|
|
147
180
|
delete serverConfig.serverType;
|
package/src/tasks/build/index.js
CHANGED
|
@@ -15,9 +15,9 @@ export default async options => {
|
|
|
15
15
|
showVersion();
|
|
16
16
|
|
|
17
17
|
const catQuestion = await getBuildCategory(options);
|
|
18
|
-
const
|
|
18
|
+
const catAnswers = await inquirer.prompt(catQuestion);
|
|
19
19
|
|
|
20
|
-
let category =
|
|
20
|
+
let category = catAnswers.category;
|
|
21
21
|
if (category == null) {
|
|
22
22
|
category = getOptionsCategory(options);
|
|
23
23
|
}
|
|
@@ -90,9 +90,9 @@ export default async options => {
|
|
|
90
90
|
showVersion();
|
|
91
91
|
|
|
92
92
|
const catQuestion = await getBuildCategory(options);
|
|
93
|
-
const
|
|
93
|
+
const catAnswers = await inquirer.prompt(catQuestion);
|
|
94
94
|
|
|
95
|
-
let category =
|
|
95
|
+
let category = catAnswers.category;
|
|
96
96
|
if (category == null) {
|
|
97
97
|
category = getOptionsCategory(options);
|
|
98
98
|
}
|
|
@@ -12,9 +12,9 @@ export default async options => {
|
|
|
12
12
|
showVersion();
|
|
13
13
|
|
|
14
14
|
const catQuestion = await getBuildCategory(options);
|
|
15
|
-
const
|
|
15
|
+
const catAnswers = await inquirer.prompt(catQuestion);
|
|
16
16
|
|
|
17
|
-
let category =
|
|
17
|
+
let category = catAnswers.category;
|
|
18
18
|
if (category == null) {
|
|
19
19
|
category = getOptionsCategory(options);
|
|
20
20
|
}
|
|
@@ -108,6 +108,11 @@ const validateCompile = async (
|
|
|
108
108
|
options
|
|
109
109
|
) => {
|
|
110
110
|
|
|
111
|
+
if (componentName == undefined) {
|
|
112
|
+
console.log(chalk.red(`No ${type} components exist to override. Possibly already overridden.`));
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
115
|
+
|
|
111
116
|
let pegaConfig =
|
|
112
117
|
await getPegaConfig();
|
|
113
118
|
|
|
@@ -233,7 +238,7 @@ export default async options => {
|
|
|
233
238
|
choices: formsList,
|
|
234
239
|
pageSize: 15,
|
|
235
240
|
when(answers) {
|
|
236
|
-
return answers.type === 'field' || promptType === 'field';
|
|
241
|
+
return formsList.length > 0 && (answers.type === 'field' || promptType === 'field');
|
|
237
242
|
}
|
|
238
243
|
},
|
|
239
244
|
{
|
|
@@ -243,7 +248,7 @@ export default async options => {
|
|
|
243
248
|
choices: desList,
|
|
244
249
|
pageSize: 15,
|
|
245
250
|
when(answers) {
|
|
246
|
-
return answers.type === 'designSystemExtension' || promptType === 'designSystemExtension';
|
|
251
|
+
return desList.length > 0 && (answers.type === 'designSystemExtension' || promptType === 'designSystemExtension');
|
|
247
252
|
}
|
|
248
253
|
},
|
|
249
254
|
{
|
|
@@ -253,7 +258,7 @@ export default async options => {
|
|
|
253
258
|
choices: infraList,
|
|
254
259
|
pageSize: 15,
|
|
255
260
|
when(answers) {
|
|
256
|
-
return answers.type === 'infra' || promptType === 'infra';
|
|
261
|
+
return infraList.length > 0 && (answers.type === 'infra' || promptType === 'infra');
|
|
257
262
|
}
|
|
258
263
|
},
|
|
259
264
|
{
|
|
@@ -263,7 +268,7 @@ export default async options => {
|
|
|
263
268
|
choices: templateList,
|
|
264
269
|
pageSize: 15,
|
|
265
270
|
when(answers) {
|
|
266
|
-
return answers.type === 'template' || promptType === 'template';
|
|
271
|
+
return templateList.length > 0 && (answers.type === 'template' || promptType === 'template');
|
|
267
272
|
}
|
|
268
273
|
},
|
|
269
274
|
{
|
|
@@ -273,7 +278,7 @@ export default async options => {
|
|
|
273
278
|
choices: widgetList,
|
|
274
279
|
pageSize: 15,
|
|
275
280
|
when(answers) {
|
|
276
|
-
return answers.type === 'widget' || promptType === 'widget';
|
|
281
|
+
return widgetList.length > 0 && (answers.type === 'widget' || promptType === 'widget');
|
|
277
282
|
}
|
|
278
283
|
},
|
|
279
284
|
|
|
@@ -22,9 +22,9 @@ export default async options => {
|
|
|
22
22
|
showVersion();
|
|
23
23
|
|
|
24
24
|
const catQuestion = await getBuildCategory(options);
|
|
25
|
-
const
|
|
25
|
+
const catAnswers = await inquirer.prompt(catQuestion);
|
|
26
26
|
|
|
27
|
-
let category =
|
|
27
|
+
let category = catAnswers.category;
|
|
28
28
|
if (category == null) {
|
|
29
29
|
category = getOptionsCategory(options);
|
|
30
30
|
}
|
|
@@ -147,9 +147,9 @@ export default async options => {
|
|
|
147
147
|
showVersion();
|
|
148
148
|
|
|
149
149
|
const catQuestion = await getBuildCategory(options);
|
|
150
|
-
const
|
|
150
|
+
const catAnswers = await inquirer.prompt(catQuestion);
|
|
151
151
|
|
|
152
|
-
let category =
|
|
152
|
+
let category = catAnswers.category;
|
|
153
153
|
if (category == null) {
|
|
154
154
|
category = getOptionsCategory(options);
|
|
155
155
|
}
|