@pega/custom-dx-components 0.25.47 → 0.25.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 +1 -1
- package/src/tasks/create-lib/helper.js +2 -0
- package/src/tasks/delete-pub/index.js +1 -1
- package/src/tasks/import-archive/index.js +12 -12
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/list-pub/index.js +3 -2
- package/src/tasks/publish/index.js +4 -0
- package/src/tasks/show-status/index.js +18 -6
- package/src/util.js +29 -11
package/package.json
CHANGED
|
@@ -97,7 +97,9 @@ export const updateAllMigrateToLibChanges = async() => {
|
|
|
97
97
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
console.log();
|
|
100
101
|
console.log(`${chalk.green(`>> Code base was upgraded. You may still have some lint errors that need to be fixed manually.`)}`);
|
|
102
|
+
console.log(`${chalk.green(`>> Run ${chalk.bold(`npm run validateAll`)} to check for issues.`)}`);
|
|
101
103
|
|
|
102
104
|
}
|
|
103
105
|
|
|
@@ -150,7 +150,7 @@ addDebugLog("deletePublished", "END", "-");
|
|
|
150
150
|
// No library with that name
|
|
151
151
|
const serverConfig = await getPegaServerConfig();
|
|
152
152
|
console.log("");
|
|
153
|
-
console.log(chalk.redBright(`No server component libraries exist in current
|
|
153
|
+
console.log(chalk.redBright(`No server component libraries exist in current application ${chalk.redBright.bold(`${app_name} - ${app_version}`)}.`));
|
|
154
154
|
|
|
155
155
|
addDebugLog("listPublished", "END", "-");
|
|
156
156
|
process.exit(1);
|
|
@@ -382,19 +382,19 @@ export const importArch = async(filePath, fileName, hadArchive) => {
|
|
|
382
382
|
if (hadArchive) {
|
|
383
383
|
|
|
384
384
|
if (orgLibName === configDef.currentOrgLib && version === configDef.version) {
|
|
385
|
-
console.log(`\n${chalk.green(`${fileName}`)} has been imported!`);
|
|
385
|
+
console.log(`\n${chalk.bold.green(`${fileName}`)} has been imported!`);
|
|
386
386
|
console.log(`It is the same library/version as your current source.`);
|
|
387
|
-
console.log(`--> You can retrieve and replace current source via ${chalk.green(`npm run restoreLibVersion`)}.`);
|
|
387
|
+
console.log(`--> You can retrieve and replace current source via ${chalk.bold.green(`npm run restoreLibVersion`)}.`);
|
|
388
388
|
console.log("\n");
|
|
389
389
|
}
|
|
390
390
|
else if (orgLibName === configDef.currentOrgLib && version != configDef.version) {
|
|
391
|
-
console.log(`\n${chalk.green(`${fileName}`)} has been imported!`);
|
|
392
|
-
console.log(`--> You can switch to ${chalk.green(`${orgLibName}/${version}`)} via ${chalk.green(`npm run switchLibVersion`)}.`);
|
|
391
|
+
console.log(`\n${chalk.bold.green(`${fileName}`)} has been imported!`);
|
|
392
|
+
console.log(`--> You can switch to ${chalk.bold.green(`${orgLibName}/${version}`)} via ${chalk.bold.green(`npm run switchLibVersion`)}.`);
|
|
393
393
|
console.log("\n");
|
|
394
394
|
}
|
|
395
395
|
else {
|
|
396
|
-
console.log(`\n${chalk.green(`${fileName}`)} has been imported!`);
|
|
397
|
-
console.log(`--> You can switch to ${chalk.green(`${orgLibName}/${version}`)} via ${chalk.green(`npm run switchLib`)}.`);
|
|
396
|
+
console.log(`\n${chalk.bold.green(`${fileName}`)} has been imported!`);
|
|
397
|
+
console.log(`--> You can switch to ${chalk.bold.green(`${orgLibName}/${version}`)} via ${chalk.bold.green(`npm run switchLib`)}.`);
|
|
398
398
|
console.log("\n");
|
|
399
399
|
}
|
|
400
400
|
|
|
@@ -595,19 +595,19 @@ addDebugLog("importArch", `filePath: ${filePath}, fileName: ${fileName}`, "");
|
|
|
595
595
|
|
|
596
596
|
if (hadArchive) {
|
|
597
597
|
if (orgLibName === configDef.currentOrgLib && version === configDef.version) {
|
|
598
|
-
console.log(`\n${chalk.green(`${fileName}`)} has been imported!`);
|
|
598
|
+
console.log(`\n${chalk.bold.green(`${fileName}`)} has been imported!`);
|
|
599
599
|
console.log(`It is the same library/version as your current source.`);
|
|
600
|
-
console.log(`--> You can retrieve and replace current source via ${chalk.green(`npm run restoreLibVersion`)}.`);
|
|
600
|
+
console.log(`--> You can retrieve and replace current source via ${chalk.bold.green(`npm run restoreLibVersion`)}.`);
|
|
601
601
|
console.log("\n");
|
|
602
602
|
}
|
|
603
603
|
else if (orgLibName === configDef.currentOrgLib && version != configDef.version) {
|
|
604
|
-
console.log(`\n${chalk.green(`${fileName}`)} has been imported!`);
|
|
605
|
-
console.log(`--> You can switch to ${chalk.green(`${orgLibName}/${version}`)} via ${chalk.green(`npm run switchLibVersion`)}.`);
|
|
604
|
+
console.log(`\n${chalk.bold.green(`${fileName}`)} has been imported!`);
|
|
605
|
+
console.log(`--> You can switch to ${chalk.bold.green(`${orgLibName}/${version}`)} via ${chalk.bold.green(`npm run switchLibVersion`)}.`);
|
|
606
606
|
console.log("\n");
|
|
607
607
|
}
|
|
608
608
|
else {
|
|
609
|
-
console.log(`\n${chalk.green(`${fileName}`)} has been imported!`);
|
|
610
|
-
console.log(`--> You can switch to ${chalk.green(`${orgLibName}/${version}`)} via ${chalk.green(`npm run switchLib`)}.`);
|
|
609
|
+
console.log(`\n${chalk.bold.green(`${fileName}`)} has been imported!`);
|
|
610
|
+
console.log(`--> You can switch to ${chalk.bold.green(`${orgLibName}/${version}`)} via ${chalk.bold.green(`npm run switchLib`)}.`);
|
|
611
611
|
console.log("\n");
|
|
612
612
|
}
|
|
613
613
|
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"@babel/preset-react": "^7.27.1",
|
|
109
109
|
"@babel/preset-typescript": "^7.27.1",
|
|
110
110
|
"@pega/configs": "^0.16.3",
|
|
111
|
-
"@pega/custom-dx-components": "~0.25.
|
|
111
|
+
"@pega/custom-dx-components": "~0.25.48",
|
|
112
112
|
"@pega/pcore-pconnect-typedefs": "^4.1.0-alpha.1",
|
|
113
113
|
"@storybook/addon-actions": "^8.6.14",
|
|
114
114
|
"@storybook/addon-essentials": "^8.6.14",
|
|
@@ -162,6 +162,7 @@ addDebugLog("listPublished", "", "+");
|
|
|
162
162
|
const isLibraryBasedCL = getLibraryBasedCL();
|
|
163
163
|
if (isLibraryBasedCL) {
|
|
164
164
|
const arLibs = await getInfinityLibraries();
|
|
165
|
+
const {app_name, app_version } = await getApplicationAndVersionFromToken();
|
|
165
166
|
|
|
166
167
|
if (arLibs && arLibs.pxResults && arLibs.pxResults.length > 0) {
|
|
167
168
|
|
|
@@ -169,7 +170,7 @@ addDebugLog("listPublished", "", "+");
|
|
|
169
170
|
const libs = arLibs.pxResults.map((oLib, index) => ({ name: oLib.pyLabel + " (" + oLib.pyRuleSet + ":" + oLib.pyRuleSetVersion + ")", value: index}));
|
|
170
171
|
|
|
171
172
|
|
|
172
|
-
|
|
173
|
+
|
|
173
174
|
const serverConfig = await getPegaServerConfig();
|
|
174
175
|
console.log(`\nServer ${chalk.green.bold(`${serverConfig.server}`)}.`);
|
|
175
176
|
console.log(`List of libraries (including built on) for Application: ${chalk.bold.green(`${app_name} - ${app_version}`)}`);
|
|
@@ -207,7 +208,7 @@ addDebugLog("listPublished", "", "+");
|
|
|
207
208
|
else {
|
|
208
209
|
// No library with that name
|
|
209
210
|
const serverConfig = await getPegaServerConfig();
|
|
210
|
-
console.log(chalk.redBright(`No server component libraries exist in
|
|
211
|
+
console.log(chalk.redBright(`No server component libraries exist in application ${chalk.redBright.bold(`${app_name} - ${app_version}`)}.`));
|
|
211
212
|
// console.log(chalk.redBright(`No server component libraries exist in given ruleset ${chalk.bold(`${serverConfig.rulesetName}:${serverConfig.rulesetVersion}`)}`));
|
|
212
213
|
console.log(chalk.redBright(`You need to publish a library to a ruleset in this application first.`));
|
|
213
214
|
addDebugLog("listPublished", "END", "-");
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
getInputConfigForCommand,
|
|
24
24
|
convertYNToBoolean,
|
|
25
25
|
checkForBranch,
|
|
26
|
+
getApplicationAndVersionFromToken,
|
|
26
27
|
applyPegaData } from '../../util.js';
|
|
27
28
|
|
|
28
29
|
import { getPublishComponentQuestions, publishComponentToServer, zipComponent } from './helper.js';
|
|
@@ -64,10 +65,13 @@ addDebugLog("publish", "", "+");
|
|
|
64
65
|
const serverConfg = await getPegaServerConfig();
|
|
65
66
|
let configJson = {};
|
|
66
67
|
await applyPegaData(configJson);
|
|
68
|
+
const {app_name, app_version, sub } = await getApplicationAndVersionFromToken();
|
|
67
69
|
|
|
68
70
|
console.log();
|
|
69
71
|
console.log(`Publishing to server: ${chalk.green.bold(`${serverConfg.server}`)}`);
|
|
70
72
|
console.log(`Cosmos version: ${chalk.green.bold(`${configJson.packageCosmosVersion}`)}`);
|
|
73
|
+
console.log(`Application: ${chalk.green.bold(`${app_name} - ${app_version}`)} for ${chalk.magentaBright.bold(`${sub}`)}`);
|
|
74
|
+
console.log();
|
|
71
75
|
|
|
72
76
|
if (useInputConfig) {
|
|
73
77
|
const inputConfig = await getInputConfigForCommand("publish");
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
checkLibraryAndArchives,
|
|
9
9
|
getPegaServerConfig,
|
|
10
10
|
getLibraryBasedCL,
|
|
11
|
-
|
|
11
|
+
getApplicationAndVersionFromToken } from '../../util.js';
|
|
12
12
|
|
|
13
13
|
export const showCurrentStatus = async () => {
|
|
14
14
|
|
|
@@ -17,6 +17,7 @@ export const showCurrentStatus = async () => {
|
|
|
17
17
|
const isLibraryBased = getLibraryBased();
|
|
18
18
|
const isLibraryBasedCL = getLibraryBasedCL();
|
|
19
19
|
const pegaServer = await getPegaServerConfig(true);
|
|
20
|
+
const { app_name, app_version } = await getApplicationAndVersionFromToken();
|
|
20
21
|
|
|
21
22
|
console.log("");
|
|
22
23
|
console.log("\tCurrent status");
|
|
@@ -33,7 +34,13 @@ export const showCurrentStatus = async () => {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
if (componentList.length === 0) {
|
|
38
|
+
console.log(`\tComponent count: ${chalk.bold.yellow(`${componentList.length}`)}`);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
console.log(`\tComponent count: ${chalk.bold.green(`${componentList.length}`)}`);
|
|
42
|
+
}
|
|
43
|
+
|
|
37
44
|
|
|
38
45
|
console.log("");
|
|
39
46
|
|
|
@@ -42,10 +49,15 @@ export const showCurrentStatus = async () => {
|
|
|
42
49
|
}
|
|
43
50
|
else {
|
|
44
51
|
|
|
45
|
-
console.log(`\tPublish
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
52
|
+
console.log(`\tPublish configuration`)
|
|
53
|
+
console.log(`\t Server:\t ${chalk.bold.green(`${pegaServer.server}`)} `);
|
|
54
|
+
if (app_name === "**") {
|
|
55
|
+
console.log(`\t Application:\t ${chalk.bold.yellow(`Need to authenticate`)}`);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
console.log(`\t Application:\t ${chalk.bold.green(`${app_name} - ${app_version}`)}`);
|
|
59
|
+
}
|
|
60
|
+
console.log(`\t Ruleset:\t ${chalk.bold.green(`${pegaServer.rulesetName}:`)}${chalk.bold.magenta(`${pegaServer.rulesetVersion}`)}`);
|
|
49
61
|
console.log("");
|
|
50
62
|
}
|
|
51
63
|
|
package/src/util.js
CHANGED
|
@@ -75,6 +75,7 @@ let defaultConfigs = {
|
|
|
75
75
|
useInputConfig: false
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
+
|
|
78
79
|
let pegaConfig = null;
|
|
79
80
|
let pegaData = null;
|
|
80
81
|
let sPegaData;
|
|
@@ -407,9 +408,11 @@ export const checkJWTExpiration = async () => {
|
|
|
407
408
|
const isLibraryBased = getLibraryBased();
|
|
408
409
|
const isLibraryBasedCL = getLibraryBasedCL();
|
|
409
410
|
|
|
410
|
-
if (
|
|
411
|
-
|
|
412
|
-
|
|
411
|
+
if (!isLibraryBasedCL && isLibraryBased) {
|
|
412
|
+
if (tokenAndStaticServer.C11NB2S === undefined) {
|
|
413
|
+
console.log(chalk.redBright("Need to authenticate, missing services token.\nBuilding a library requires authentication to acquire a token to build."));
|
|
414
|
+
process.exit(1);
|
|
415
|
+
}
|
|
413
416
|
}
|
|
414
417
|
|
|
415
418
|
const jwt = jwtDecode(tokenAndStaticServer.C11NB2S);
|
|
@@ -444,26 +447,36 @@ export const checkAccessTokenExpiration = async() => {
|
|
|
444
447
|
}
|
|
445
448
|
|
|
446
449
|
const jwt = jwtDecode(tokenAndStaticServer.access_token);
|
|
447
|
-
const { exp, customer_org } = jwt;
|
|
450
|
+
const { exp, customer_org, sub, app_name, app_version, operator_access } = jwt;
|
|
451
|
+
|
|
452
|
+
|
|
448
453
|
if (exp < (new Date().getTime() + 1) / 1000) {
|
|
449
454
|
console.log(chalk.redBright("Authentication token has expired, please reauthenticate."));
|
|
450
455
|
process.exit(1);
|
|
451
456
|
}
|
|
452
457
|
|
|
453
458
|
|
|
459
|
+
|
|
454
460
|
}
|
|
455
461
|
|
|
462
|
+
|
|
463
|
+
|
|
456
464
|
export const getApplicationAndVersionFromToken = async() => {
|
|
457
465
|
const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
|
|
458
466
|
|
|
459
467
|
if (tokenAndStaticServer.access_token === undefined) {
|
|
460
|
-
console.log(chalk.redBright("Need to authenticate, missing token.\n"));
|
|
461
|
-
process.exit(1);
|
|
468
|
+
// console.log(chalk.redBright("Need to authenticate, missing token.\n"));
|
|
469
|
+
// process.exit(1);
|
|
470
|
+
const app_name = "**";
|
|
471
|
+
const app_version = "**";
|
|
472
|
+
const sub = "**";
|
|
473
|
+
const operator_access = "**";
|
|
474
|
+
return { app_name, app_version, sub, operator_access};
|
|
462
475
|
}
|
|
463
476
|
|
|
464
477
|
const jwt = jwtDecode(tokenAndStaticServer.access_token);
|
|
465
|
-
const { app_name, app_version } = jwt;
|
|
466
|
-
return { app_name, app_version };
|
|
478
|
+
const { app_name, app_version, sub, operator_access } = jwt;
|
|
479
|
+
return { app_name, app_version, sub, operator_access};
|
|
467
480
|
|
|
468
481
|
}
|
|
469
482
|
|
|
@@ -767,7 +780,8 @@ if (showDebug) addDebugLog("restoreTopLevelConfigFiles", `directory: ${directory
|
|
|
767
780
|
|
|
768
781
|
if (configFiles && configFiles.length > 0) {
|
|
769
782
|
for (const configF of configFiles) {
|
|
770
|
-
|
|
783
|
+
// don't want to restore package, package-lock or an archive file
|
|
784
|
+
if (configF !== "package-lock.json" && configF !== "package.json" && (configF.indexOf(".zip") < 0) ) {
|
|
771
785
|
fs.copyFileSync(join(tempDirectory, configF), join(directory, configF));
|
|
772
786
|
}
|
|
773
787
|
}
|
|
@@ -2261,8 +2275,12 @@ if (showDebug) addDebugLog("updateComponentTaskConfig", "", "");
|
|
|
2261
2275
|
// restore ruleset and verion
|
|
2262
2276
|
originalContentsData["server-config"].rulesetName = orgRuleset;
|
|
2263
2277
|
originalContentsData["server-config"].rulesetVersion = orgRulesetVersion;
|
|
2264
|
-
|
|
2265
|
-
|
|
2278
|
+
|
|
2279
|
+
// replace if exists
|
|
2280
|
+
if (orgArchiveRuleset) {
|
|
2281
|
+
originalContentsData["server-config"].archiveRulesetName = orgArchiveRuleset;
|
|
2282
|
+
originalContentsData["server-config"].archiveRulesetVersion = orgArchiveRulesetVersion;
|
|
2283
|
+
}
|
|
2266
2284
|
|
|
2267
2285
|
|
|
2268
2286
|
// if we don't have a devServerPort, add the default
|