@pega/custom-dx-components 0.242.68 → 0.242.70

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/custom-dx-components",
3
- "version": "0.242.68",
3
+ "version": "0.242.70",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -19,7 +19,7 @@
19
19
  "@babel/plugin-transform-class-properties": "^7.23.3",
20
20
  "@babel/preset-react": "^7.23.3",
21
21
  "@pega/auth": "^0.2.19",
22
- "@pega/constellation-dx-components-build-utils": "^1.0.1",
22
+ "@pega/constellation-dx-components-build-utils": "^2.0.10",
23
23
  "ajv": "^8.12.0",
24
24
  "ajv-keywords": "^5.1.0",
25
25
  "archiver": "^7.0.1",
@@ -114,7 +114,7 @@ const compileMustacheTemplates = async (
114
114
  ALLOWEDAPPS: JSON.stringify(allowedApplications),
115
115
  TYPE: type,
116
116
  SUB_TYPE: JSON.stringify(mustacheSubType),
117
- DESCRIPTION: description,
117
+ DESCRIPTION: description || componentLabel,
118
118
  IS_TEMPLATE: isTemplate,
119
119
  IS_PICKLIST: isPicklist,
120
120
  IS_BOOLEAN: isBool,
@@ -430,6 +430,8 @@ addDebugLog("create", "", "+");
430
430
  description,
431
431
  allowedApplications
432
432
  } = answers;
433
+
434
+
433
435
  await validateCompile(
434
436
  {
435
437
  componentName,
@@ -101,7 +101,7 @@
101
101
  },
102
102
  "devDependencies": {
103
103
  "@pega/configs": "^0.15.1",
104
- "@pega/custom-dx-components": "~0.242.68",
104
+ "@pega/custom-dx-components": "~0.242.70",
105
105
  "@pega/pcore-pconnect-typedefs": "3.2.1",
106
106
  "@storybook/addon-actions": "^7.6.19",
107
107
  "@storybook/addon-essentials": "^7.6.19",
@@ -87,8 +87,15 @@ addDebugLog("publish", "", "+");
87
87
  // marking as internal, so no questions will be ask
88
88
  options.params.push("internal");
89
89
 
90
- await buildLibrary(options);
91
- await publishLibrary(options);
90
+ try {
91
+ await buildLibrary(options);
92
+ await publishLibrary(options);
93
+ }
94
+ catch (err) {
95
+ console.log(chalk.redBright(err));
96
+ process.exit(1);
97
+ }
98
+
92
99
  }
93
100
 
94
101
  return true;
@@ -242,7 +242,7 @@ addDebugLog("publishLibrary", "", "+");
242
242
  {
243
243
  name: 'override',
244
244
  type: 'confirm',
245
- message: `Do you wish to overrite it`,
245
+ message: `Do you wish to overwrite it`,
246
246
  default: false
247
247
  }
248
248
  ];
@@ -277,6 +277,7 @@ addDebugLog("publishLibrary", "END", "-");
277
277
  else {
278
278
  console.log(chalk.bold.redBright(`No library versions named ${libraryName}.`));
279
279
  console.log(chalk.bold.redBright(`You need to build library ${libraryName} first.`));
280
+ process.exit(1);
280
281
  }
281
282
 
282
283
 
@@ -315,11 +315,13 @@ const validateOverideSchema = ajv.compile(overrideSchema);
315
315
 
316
316
 
317
317
  export default async (option) => {
318
- // addDebugLog("validate","", "");
318
+ // addDebugLog("validate","", "");
319
319
 
320
320
  let componentToValidate = null;
321
+ let throwTheError = false;
321
322
  if (option.params && option.params[3]) {
322
323
  componentToValidate = option.params[3];
324
+ throwTheError = true;
323
325
  } else if (option && option.task === 'validateSchema') {
324
326
  const localComponents = await getComponents();
325
327
  const answer = await inquirer.prompt({
@@ -332,8 +334,10 @@ export default async (option) => {
332
334
  componentToValidate = answer.component;
333
335
  } else if (option.name) {
334
336
  componentToValidate = option.value;
337
+ throwTheError = true;
335
338
  } else {
336
339
  componentToValidate = option;
340
+ throwTheError = true;
337
341
  }
338
342
 
339
343
  const componentDirectory = await getComponentDirectoryPath(componentToValidate);
@@ -365,17 +369,23 @@ export default async (option) => {
365
369
 
366
370
  if (valid) {
367
371
 
372
+ if (data.description === "") {
373
+ throw new Error(`Invalid schema json in config.json: 'description' cannot be blank.`);
374
+ process.exit(1);
375
+ }
376
+
368
377
  if (
369
378
  componentToValidate &&
370
379
  !/^[A-Za-z0-9]+_[A-Za-z0-9]+_[A-Za-z0-9]+$/.test(componentToValidate)
371
380
  ) {
372
- const ootbComponents = await getOOTBComponents();
373
- if (ootbComponents.includes(componentToValidate)) {
374
- throw new Error(`Invalid: Error occurred in validating ${componentToValidate}`);
375
- }
376
- }
377
381
 
382
+ if (throwTheError) {
383
+ throw new Error (`${chalk.redBright(`Error: Invalid name of component '${componentToValidate}' .\n Component name (and component folder) MUST be of the form: 'Org_Lib_ComponentName'.`)}`);
378
384
 
385
+ }
386
+ console.log(`${chalk.redBright(`Error: Invalid name of component '${componentToValidate}' .\n Component name (and component folder) MUST be of the form: 'Org_Lib_ComponentName'.`)}`);
387
+ process.exit(1);
388
+ }
379
389
 
380
390
  console.log(`${chalk.bold.green(componentToValidate)} schema is valid`);
381
391
  } else {
package/src/util.js CHANGED
@@ -836,6 +836,28 @@ export const getPegaServerConfig = async () => {
836
836
  if (showDebug) addDebugLog("getPegaServerConfig", "", "+");
837
837
  if (!pegaConfig) {
838
838
  pegaConfig = await getPegaConfig();
839
+
840
+ if (getServerType() === "launchpad") {
841
+
842
+ // need to append isolation id for now
843
+ let OAuthData;
844
+ try {
845
+ OAuthData = fs.readFileSync(TOKEN_PATH, 'utf8');
846
+ }
847
+ catch (ex) {
848
+ return ({});
849
+ }
850
+
851
+ if (OAuthData) {
852
+ const oOAuthData = JSON.parse(OAuthData);
853
+ if (oOAuthData["isolation-ids"]) {
854
+ const isolationId = oOAuthData["isolation-ids"].write;
855
+ pegaConfig['server-config'].isolationId = isolationId[0];
856
+ }
857
+
858
+ }
859
+
860
+ }
839
861
  sPegaServerConfig = JSON.stringify(pegaConfig['server-config']);
840
862
  }
841
863
 
@@ -1434,7 +1456,8 @@ if (showDebug) addDebugLog("updateC11NB2SForInfinity", "", "");
1434
1456
 
1435
1457
  const objOauthData = JSON.parse(OAuthData);
1436
1458
  objOauthData["C11NB2S"] = bootstrap.tokens.C11NB2S;
1437
- objOauthData["appStaticContentServer"] = bootstrap.serviceConfig.appStaticContentServer;
1459
+ // objOauthData["appStaticContentServer"] = bootstrap.serviceConfig.appStaticContentServer;
1460
+ objOauthData["appStaticContentServer"] = (bootstrap.serviceConfig.appStaticContentServer != "no-cdn" && bootstrap.serviceConfig.appStaticContentServer != "") ? bootstrap.serviceConfig.appStaticContentServer : bootstrap.serviceConfig.staticContentServer;
1438
1461
 
1439
1462
  // write out file
1440
1463
  fs.writeFileSync(TOKEN_PATH, JSON.stringify(objOauthData), { encoding: 'utf8',flag:'w' });