@pega/custom-dx-components 25.1.10-alpha-0.12 → 25.1.10-alpha-0.13

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/README.md CHANGED
@@ -4,6 +4,24 @@
4
4
 
5
5
  This project provides you with an environment to extend Constellation by giving you tools to create and publish custom components that are not available from the Constellation installation.
6
6
 
7
+ ## Before you begin
8
+ Review the following checklist before you create a Constellation DX component:
9
+
10
+ ## Design considerations
11
+ Involve an Experience Designer in your process. This will help you determine the exact issue to be resolved. For more information on the role of an Experience Designer, see **Experience Designer**[here](https://community.pega.com/roles/experience-designer).
12
+
13
+ ## The Experience Designer must meet the following requirements:
14
+ Must have a background in UI and UX design.
15
+ Must understand Pega's best practices for design. For more information, see **Best practices for designing with the Constellation design system**[here](https://design.pega.com/design/getting-started/).
16
+
17
+ ## Functionality considerations
18
+ Check if an existing component in App Studio contains the features you need. If not, check for existing components that contain similar features.
19
+ Connect with Pega Support to find out if a component containing a similar feature will be included in the next release. If yes, assess if you can wait for the next release.
20
+
21
+ ## Maintenance considerations
22
+ Ensure you have the bandwidth to maintain the Constellation DX component and keep it up-to-date with every release of Pega Infinity. Evaluate if doing this might prevent you from upgrading to future releases of Pega Infinity.
23
+ Evaluate if you are able to meet the compliance standards for data privacy and accessibility for Constellation DX components. Note that not meeting these standards might lead to legal compliance issues.
24
+
7
25
  ## Prerequisites
8
26
 
9
27
  Ensure you have access to the following in your system:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/custom-dx-components",
3
- "version": "25.1.10-alpha-0.12",
3
+ "version": "25.1.10-alpha-0.13",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "keywords": [
@@ -45,6 +45,10 @@ export default async options => {
45
45
  // process and exit
46
46
  if (useInputConfig) {
47
47
  const inputConfig = await getInputConfigForCommand("createLib");
48
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
49
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
50
+ process.exit(1);
51
+ }
48
52
 
49
53
  if (convertYNToBoolean(inputConfig.okToContinue)) {
50
54
  const libraryName = inputConfig.libraryName;
@@ -58,6 +58,10 @@ addDebugLog("createVersion", "", "+");
58
58
  // process and no inputs
59
59
  if (useInputConfig) {
60
60
  const inputConfig = await getInputConfigForCommand("createLibVersion");
61
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
62
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
63
+ process.exit(1);
64
+ }
61
65
 
62
66
  if (convertYNToBoolean(inputConfig.okToContinue)) {
63
67
  version = inputConfig.libraryVersion;
@@ -236,7 +236,18 @@ addDebugLog("deleteLibrary", "", "+");
236
236
 
237
237
  if (useInputConfig) {
238
238
  const inputConfig = await getInputConfigForCommand("deleteLib");
239
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
240
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
241
+ process.exit(1);
242
+ }
243
+
239
244
  libraryName = inputConfig.libraryName;
245
+ if (libraryName.indexOf("_") < 0) {
246
+ // need to add in organization
247
+ libraryName = `${compDef.organization}_${libraryName}`;
248
+ }
249
+
250
+
240
251
  version = inputConfig.libraryVersion;
241
252
  const isPermanent = inputConfig?.isPermanent || "N";
242
253
  let permBuild = convertYNToBoolean(isPermanent);
@@ -41,6 +41,11 @@ addDebugLog("deleteVersion", "", "+");
41
41
 
42
42
  if (useInputConfig) {
43
43
  const inputConfig = await getInputConfigForCommand("deleteLibVersion");
44
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
45
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
46
+ process.exit(1);
47
+ }
48
+
44
49
  version = inputConfig.libraryVersion;
45
50
  const isPermanent = inputConfig?.isPermanent || "N";
46
51
  let permBuild = convertYNToBoolean(isPermanent);
@@ -5,6 +5,7 @@ import { join } from 'path';
5
5
  import inquirer from 'inquirer';
6
6
  import ncp from 'ncp';
7
7
  import chalk from 'chalk';
8
+ import { Listr } from 'listr2';
8
9
 
9
10
  import {
10
11
  checkPathAccess,
@@ -145,6 +146,7 @@ addDebugLog("exportCLArch", `exportPath: ${exportPath}, orgLibName: ${orgLibName
145
146
  // archive it
146
147
  output = await zipVersionAndArchiveCL(configDef.currentOrgLib, configDef.buildVersion);
147
148
 
149
+
148
150
  // if archiving, need to wait before copying
149
151
  output.on('close', function() {
150
152
  fs.copyFileSync(archFileName, exportFile );
@@ -402,7 +404,26 @@ export default async options => {
402
404
  else {
403
405
  await checkAccessTokenExpiration();
404
406
 
405
- // publish to server
407
+
408
+ const tasks = new Listr(
409
+ [
410
+ {
411
+ title: 'Saving local archive',
412
+ task: async () => {
413
+
414
+ // local archive so it will get stored
415
+ await zipVersionAndArchive(orgLibName, selectedVersion);
416
+ }
417
+ }
418
+ ],
419
+ { concurrent: false, exitOnError: true }
420
+ );
421
+
422
+ await tasks.run().catch(err => {
423
+ console.log(chalk.bold.red(err.toString()));
424
+ process.exit(1);
425
+ });
426
+
406
427
  await publishArchive(orgLibName, selectedVersion);
407
428
 
408
429
  }
@@ -726,35 +726,103 @@ export default async options => {
726
726
 
727
727
  if (useInputConfig) {
728
728
  const inputConfig = await getInputConfigForCommand("importLibVersion");
729
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
730
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
731
+ process.exit(1);
732
+ }
733
+
734
+ const serverOrDirectory = inputConfig.serverOrDirectory;
729
735
  const filePath = inputConfig.fileLocation;
730
736
  const fileName = inputConfig.fileName;
737
+ const serverAppName = "ComponentLibraryArchive";
738
+ const serverArchiveName = inputConfig.serverArchiveName;
739
+ const serverArchiveType = "zip";
740
+ const serverRulesetName = inputConfig.serverRulesetName;
741
+ const serverRulesetVersion = inputConfig.serverRulesetVersion;
731
742
 
732
743
 
733
744
  console.log("");
734
745
 
735
- const tasks = new Listr(
736
- [
737
- {
738
- title: `Importing archive`,
739
- task: async () => {
740
- await importArch( filePath, fileName, hasArch);
746
+ if (serverOrDirectory.toLowerCase() === "server") {
747
+ await checkAccessTokenExpiration();
748
+
749
+
750
+ if (serverArchiveName) {
751
+ // ALL option
752
+ const defaultPegaServerConfig = await getPegaServerConfig();
753
+
754
+ let fileName = `${serverArchiveName}.${serverArchiveType}`;
755
+ let fileData;
756
+
757
+ console.log("");
758
+
759
+ const tasks = new Listr(
760
+ [
761
+ {
762
+ title: 'Fetching archive from server',
763
+ task: async () => {
764
+ // get archive
765
+ fileData = await getServerLibraryArchive(serverAppName, serverArchiveName, serverArchiveType, serverRulesetName, serverRulesetVersion);
766
+ }
767
+ },
768
+ {
769
+ title: 'Saving archive in store',
770
+ task: async () => {
771
+ await writeZipBuffer(fileName, fileData.pyFileSource);
772
+
773
+ // import archive
774
+ const currentDirectory = process.cwd();
775
+ const tempDirectory = join(currentDirectory, TEMP_PATH);
776
+
777
+ await importArchServer( tempDirectory, fileName, hasArch);
778
+ }
779
+ }
780
+ ],
781
+ { concurrent: false, exitOnError: true }
782
+ );
783
+
784
+ await tasks.run().catch(err => {
785
+ console.log(chalk.bold.red(err.toString()));
786
+ process.exit(1);
787
+ });
788
+
789
+
790
+
791
+ }
792
+ else {
793
+ // No library with that name
794
+ console.log(chalk.redBright(`No library archives exist on server.`));
795
+ process.exit();
796
+
797
+ }
798
+ }
799
+ else {
800
+ const tasks = new Listr(
801
+ [
802
+ {
803
+ title: `Importing archive`,
804
+ task: async () => {
805
+ await importArch( filePath, fileName, hasArch);
806
+ }
741
807
  }
742
- }
743
- ],
744
- { concurrent: false, exitOnError: true }
745
- );
808
+ ],
809
+ { concurrent: false, exitOnError: true }
810
+ );
746
811
 
747
812
 
748
- await tasks.run().catch(err => {
749
- console.log(chalk.bold.red(err.toString()));
750
- process.exit(1);
751
- });
813
+ await tasks.run().catch(err => {
814
+ console.log(chalk.bold.red(err.toString()));
815
+ process.exit(1);
816
+ });
817
+
818
+ console.log("");
819
+
820
+ // reapply to save if changed, because imported task.config may have overriden and we want
821
+ // to keep what was entered as the latest
822
+ await updateSavedFilePath(filePath);
823
+ }
752
824
 
753
- console.log("");
754
825
 
755
- // reapply to save if changed, because imported task.config may have overriden and we want
756
- // to keep what was entered as the latest
757
- await updateSavedFilePath(filePath);
758
826
 
759
827
  }
760
828
  else {
@@ -4,6 +4,24 @@
4
4
 
5
5
  This project provides you with an environment to extend Constellation by giving you tools to create and publish custom components that are not available from the Constellation installation.
6
6
 
7
+ ## Before you begin
8
+ Review the following checklist before you create a Constellation DX component:
9
+
10
+ ## Design considerations
11
+ Involve an Experience Designer in your process. This will help you determine the exact issue to be resolved. For more information on the role of an Experience Designer, see **Experience Designer**[here](https://community.pega.com/roles/experience-designer).
12
+
13
+ ## The Experience Designer must meet the following requirements:
14
+ Must have a background in UI and UX design.
15
+ Must understand Pega's best practices for design. For more information, see **Best practices for designing with the Constellation design system**[here](https://design.pega.com/design/getting-started/).
16
+
17
+ ## Functionality considerations
18
+ Check if an existing component in App Studio contains the features you need. If not, check for existing components that contain similar features.
19
+ Connect with Pega Support to find out if a component containing a similar feature will be included in the next release. If yes, assess if you can wait for the next release.
20
+
21
+ ## Maintenance considerations
22
+ Ensure you have the bandwidth to maintain the Constellation DX component and keep it up-to-date with every release of Pega Infinity. Evaluate if doing this might prevent you from upgrading to future releases of Pega Infinity.
23
+ Evaluate if you are able to meet the compliance standards for data privacy and accessibility for Constellation DX components. Note that not meeting these standards might lead to legal compliance issues.
24
+
7
25
  ## Prerequisites
8
26
 
9
27
  Ensure you have access to the following in your system:
@@ -107,7 +107,7 @@
107
107
  "@babel/preset-react": "^7.27.1",
108
108
  "@babel/preset-typescript": "^7.27.1",
109
109
  "@pega/configs": "^0.16.3",
110
- "@pega/custom-dx-components": "~25.1.10-alpha-0.12",
110
+ "@pega/custom-dx-components": "~25.1.10-alpha-0.13",
111
111
  "@pega/pcore-pconnect-typedefs": "^4.1.0-alpha.1",
112
112
  "@storybook/addon-actions": "^8.6.14",
113
113
  "@storybook/addon-essentials": "^8.6.14",
@@ -75,6 +75,10 @@ addDebugLog("publish", "", "+");
75
75
 
76
76
  if (useInputConfig) {
77
77
  const inputConfig = await getInputConfigForCommand("publish");
78
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
79
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
80
+ process.exit(1);
81
+ }
78
82
 
79
83
  const okToPubPerm = inputConfig?.okToPublishPermanent || "Y";
80
84
  const okToPublishPerm = convertYNToBoolean(okToPubPerm);
@@ -11,7 +11,10 @@ import {
11
11
  getLibraryBased,
12
12
  restoreFromArchive,
13
13
  cleanUpTemp,
14
- forceDefaultsUpdate
14
+ forceDefaultsUpdate,
15
+ getUseInputConfig,
16
+ getInputConfigForCommand,
17
+ convertYNToBoolean
15
18
  } from '../../util.js';
16
19
 
17
20
  import { showCurrentStatus } from '../show-status/index.js';
@@ -19,6 +22,7 @@ import {
19
22
  export default async options => {
20
23
  await showVersion();
21
24
  await checkLibraryAndArchives();
25
+ const useInputConfig = getUseInputConfig();
22
26
 
23
27
  addDebugLog("restoreComponent", "", "+");
24
28
 
@@ -31,26 +35,43 @@ addDebugLog("restoreComponent", "", "+");
31
35
  }
32
36
  const confDef = getConfigDefaults();
33
37
 
34
- console.log(chalk.bold.yellow('\nChanges not saved to local storage will be LOST, code will be restored from local storage.'));
35
- console.log("");
36
38
 
37
39
  let restoreFromStore = {};
38
40
 
39
- if (options.params.length === 4) {
40
- const optConfirm = options.params[3];
41
- restoreFromStore["confirmRestore"] = optConfirm === 'Y' || optConfirm === 'y' || optConfirm === true || optConfirm === 'true' ? true : false;
41
+ if (useInputConfig) {
42
+ const inputConfig = await getInputConfigForCommand("restoreLibVersion");
43
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
44
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
45
+ process.exit(1);
46
+ }
47
+
48
+ const okToRestore = convertYNToBoolean(inputConfig.okToRestore);
49
+
50
+ restoreFromStore.confirmRestore = okToRestore;
51
+
42
52
  }
43
53
  else {
44
- restoreFromStore = await inquirer.prompt([
45
- {
46
- name: 'confirmRestore',
47
- type: 'confirm',
48
- message: `Restoring ${chalk.bold.green(`${confDef.displayLibVersion}`)} from local storage, proceed ?`,
49
- default: true
50
- }
51
- ]);
54
+ console.log(chalk.bold.yellow('\nChanges not saved to local storage will be LOST, code will be restored from local storage.'));
55
+ console.log("");
56
+
57
+ if (options.params.length === 4) {
58
+ const optConfirm = options.params[3];
59
+ restoreFromStore["confirmRestore"] = optConfirm === 'Y' || optConfirm === 'y' || optConfirm === true || optConfirm === 'true' ? true : false;
60
+ }
61
+ else {
62
+ restoreFromStore = await inquirer.prompt([
63
+ {
64
+ name: 'confirmRestore',
65
+ type: 'confirm',
66
+ message: `Restoring ${chalk.bold.green(`${confDef.displayLibVersion}`)} from local storage, proceed ?`,
67
+ default: true
68
+ }
69
+ ]);
70
+ }
52
71
  }
53
72
 
73
+
74
+
54
75
  if (restoreFromStore.confirmRestore) {
55
76
  const switchToFileName = `${confDef.currentOrgLib}_${confDef.version}.arch.zip`;
56
77
  const tasks = new Listr(
@@ -141,6 +141,11 @@ addDebugLog("setPerm", "", "+");
141
141
 
142
142
  if (useInputConfig) {
143
143
  const inputConfig = await getInputConfigForCommand("setPermanent");
144
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
145
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
146
+ process.exit(1);
147
+ }
148
+
144
149
  inputYN = inputConfig.makePermanent;
145
150
 
146
151
  }
@@ -10,12 +10,16 @@ import {
10
10
  getConfigDefaults,
11
11
  getLibraryBased,
12
12
  zipVersionAndArchive,
13
- cleanUpTemp
13
+ cleanUpTemp,
14
+ getUseInputConfig,
15
+ getInputConfigForCommand,
16
+ convertYNToBoolean
14
17
  } from '../../util.js';
15
18
 
16
19
  export default async options => {
17
20
  await showVersion();
18
21
  await checkLibraryAndArchives();
22
+ const useInputConfig = getUseInputConfig();
19
23
 
20
24
  addDebugLog("storeComponents", "", "+");
21
25
 
@@ -29,26 +33,43 @@ addDebugLog("storeComponents", "", "+");
29
33
  const confDef = getConfigDefaults();
30
34
 
31
35
 
32
- console.log(chalk.bold.yellow('\nBe sure to SAVE all changes before storing, or changes will NOT be stored.'));
33
36
 
34
37
  let answers = {};
35
38
 
36
- if (options.params.length === 4) {
37
- const optConfirm = options.params[3];
38
- answers["confirmStore"] = optConfirm === 'Y' || optConfirm === 'y' || optConfirm === true || optConfirm === 'true' ? true : false;
39
+ if (useInputConfig) {
40
+ const inputConfig = await getInputConfigForCommand("storeLibVersion");
41
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
42
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
43
+ process.exit(1);
44
+ }
45
+
46
+ const okToStore = convertYNToBoolean(inputConfig.okToStore);
47
+
48
+ answers.confirmStore = okToStore;
49
+
39
50
  }
40
51
  else {
52
+ console.log(chalk.bold.yellow('\nBe sure to SAVE all changes before storing, or changes will NOT be stored.'));
53
+
54
+ if (options.params.length === 4) {
55
+ const optConfirm = options.params[3];
56
+ answers["confirmStore"] = optConfirm === 'Y' || optConfirm === 'y' || optConfirm === true || optConfirm === 'true' ? true : false;
57
+ }
58
+ else {
41
59
 
42
- answers = await inquirer.prompt([
43
- {
44
- name: 'confirmStore',
45
- type: 'confirm',
46
- message: `Storing ${chalk.green(`${confDef.currentOrgLib}/${confDef.buildVersion}`)} to local storage, proceed ?`,
47
- default: true
48
- }
49
- ]);
60
+ answers = await inquirer.prompt([
61
+ {
62
+ name: 'confirmStore',
63
+ type: 'confirm',
64
+ message: `Storing ${chalk.green(`${confDef.currentOrgLib}/${confDef.buildVersion}`)} to local storage, proceed ?`,
65
+ default: true
66
+ }
67
+ ]);
68
+ }
50
69
  }
51
70
 
71
+
72
+
52
73
  if (answers.confirmStore) {
53
74
  console.log("");
54
75
 
@@ -62,6 +62,10 @@ addDebugLog("switchLibrary", "", "+");
62
62
  // process and no inputs
63
63
  if (useInputConfig) {
64
64
  const inputConfig = await getInputConfigForCommand("switchLib");
65
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
66
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
67
+ process.exit(1);
68
+ }
65
69
 
66
70
  if (convertYNToBoolean(inputConfig.okToContinue)) {
67
71
  const newLibraryName = inputConfig.libraryName;
@@ -62,6 +62,10 @@ addDebugLog("switchVersion", "", "+");
62
62
  // process and no inputs
63
63
  if (useInputConfig) {
64
64
  const inputConfig = await getInputConfigForCommand("switchLibVersion");
65
+ if (!inputConfig || Object.keys(inputConfig).length === 0) {
66
+ console.log(chalk.redBright("Configured for input config, but no input.config.json file found."));
67
+ process.exit(1);
68
+ }
65
69
 
66
70
  okToContinue = convertYNToBoolean(inputConfig.okToContinue);
67
71
  if (okToContinue) {