@pega/custom-dx-components 0.23.39 → 0.23.40

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.23.39",
3
+ "version": "0.23.40",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "devDependencies": {
71
71
  "@pega/configs": "^0.6.0",
72
- "@pega/custom-dx-components": "0.23.39",
72
+ "@pega/custom-dx-components": "0.23.40",
73
73
  "@pega/pcore-pconnect-typedefs": "~2.1.1",
74
74
  "@storybook/addon-actions": "^7.6.7",
75
75
  "@storybook/addon-essentials": "^7.6.7",
@@ -27,7 +27,6 @@
27
27
  "questions_askOnce": "server,authService",
28
28
  "questions_askedOnce": ""
29
29
  },
30
- "usePromotedWebPack": false,
31
30
  "component": {
32
31
  "library": "Extensions",
33
32
  "type": "",
@@ -35,5 +34,6 @@
35
34
  "subtype": "",
36
35
  "description": "",
37
36
  "icon": ""
38
- }
37
+ },
38
+ "usePromotedWebPack": false
39
39
  }
@@ -23,8 +23,6 @@ import {
23
23
 
24
24
 
25
25
 
26
- let redirectFile = "";
27
-
28
26
  export const copyWebPack = async () => {
29
27
 
30
28
  // first check to see if already have the file
@@ -80,13 +78,12 @@ export const copyWebPack = async () => {
80
78
  }
81
79
 
82
80
 
83
-
84
-
85
-
81
+ console.log(chalk.bold.green(`Bundler now using ${newWebPackConfigDir}.`));
82
+ console.log(chalk.bold.green(`Utilize this file for webpack modifications.`));
86
83
 
87
84
  }
88
85
 
89
- redirectFile = newWebPackConfigDir;
86
+
90
87
 
91
88
 
92
89
 
@@ -34,6 +34,7 @@ export const renamePromotedWebPack = async () => {
34
34
  process.exit();
35
35
  }
36
36
 
37
+ console.log(chalk.bold.green("Bundler reverted to using internal webpack.config.js."));
37
38
  console.log(chalk.bold.green(`File ${promoteWebPackDir} marked as not used.`));
38
39
 
39
40
  }
package/src/util.js CHANGED
@@ -33,12 +33,14 @@ export const checkPathAccess = async (path, options = {}, throwError = false) =>
33
33
  } catch (err) {
34
34
  if (throwError) {
35
35
  throw new Error(err);
36
- } else {
36
+ }
37
+ else {
37
38
  const message =
38
39
  errorMessage || `${chalk.red.bold('ERROR')} Could not able to access path - ${path}`;
39
40
  console.error(message);
40
41
  process.exit(1);
41
42
  }
43
+
42
44
  }
43
45
  };
44
46
 
@@ -49,7 +51,8 @@ export const getUseWebPackPromotion = async () => {
49
51
  try {
50
52
  // force to throw error and not console log
51
53
  await checkPathAccess(pegaConfigJsonPath, {}, true);
52
- } catch (ex) {
54
+ }
55
+ catch (ex) {
53
56
  // when can't find it, always be false, assume no webpack override.
54
57
  // This is IMPORTANT for init (npx install)
55
58
  return false;
@@ -72,9 +75,10 @@ export const getUseWebPackPromotion = async () => {
72
75
  }
73
76
 
74
77
  return data[USE_PROMOTED_WEB_PACK];
75
- };
76
78
 
77
- export const updateUseWebPackPromotion = async (useValue = false) => {
79
+ }
80
+
81
+ export const updateUseWebPackPromotion = async ( useValue = false ) => {
78
82
  const currentDirectory = process.cwd();
79
83
  const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
80
84
 
@@ -90,10 +94,11 @@ export const updateUseWebPackPromotion = async (useValue = false) => {
90
94
  process.exit(1);
91
95
  }
92
96
 
93
- data.usePromotedWebPack = useValue;
97
+ data["usePromotedWebPack"] = useValue;
94
98
 
95
99
  fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(data, null, 4), { encoding: 'utf8' });
96
- };
100
+
101
+ }
97
102
 
98
103
  export const deleteLocalComponent = async componentKey => {
99
104
  const currentDirectory = process.cwd();
@@ -430,37 +435,55 @@ export const deleteInfinityServerComponent = async componentKey => {
430
435
  status = response.status;
431
436
  if (!response.ok) {
432
437
  if (status === 401) {
433
- throw new Error('Error occurred in authentication. Please regenerate using authenticate');
438
+ throw new Error(
439
+ 'Error occurred in authentication. Please regenerate using authenticate'
440
+ );
434
441
  // console.log(accessTokenUri, refreshToken);
435
442
  /* TODO - Handle refresh_token */
436
- } else if (status === 404) {
443
+ }
444
+ else if (status === 404){
437
445
  throw new Error('404: Server resource not found');
438
- } else if (status === 405) {
446
+ }
447
+ else if (status === 405){
439
448
  throw new Error('405: Server method not allowed');
440
- } else if (status === 408) {
449
+ }
450
+ else if (status === 408){
441
451
  throw new Error('408: Server timed out');
442
- } else if (response.status === 403) {
443
- throw new Error('Error forbidden: User does not have privileges to Publish.');
444
452
  }
453
+ else if (response.status === 403) {
454
+ throw new Error(
455
+ 'Error forbidden: User does not have privileges to Publish.'
456
+ );
457
+ }
458
+
459
+
445
460
  }
446
461
 
447
462
  try {
448
463
  const respData = await response.json();
449
- console.log(chalk.bold.green(`Success : ${respData.message}`));
464
+ console.log(
465
+ chalk.bold.green(`Success : ${respData.message}`)
466
+ );
450
467
 
451
468
  if (status === 500) {
452
469
  status = 999;
453
470
  throw new Error(respData.message);
454
471
  }
455
- } catch (err) {
472
+ }
473
+ catch (err) {
456
474
  if (status === 500) {
457
- throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
458
- } else if (status === 999) {
459
- throw new Error(err);
475
+ throw new Error(
476
+ `Error occurred in authentication. Please regenerate using authenticate`
477
+ );
478
+ }
479
+ else if (status === 999) {
480
+ throw new Error (err);
460
481
  }
461
482
  }
483
+
462
484
  }
463
485
  } catch (error) {
486
+
464
487
  throw new Error(error);
465
488
  }
466
489
  };
@@ -492,6 +515,7 @@ export const deleteLaunchpadServerComponent = async componentKey => {
492
515
  componentName
493
516
  };
494
517
 
518
+
495
519
  const response = await fetch(deleteUrl, {
496
520
  method: 'DELETE',
497
521
  agent: new https.Agent({ rejectUnauthorized: false }),
@@ -502,33 +526,47 @@ export const deleteLaunchpadServerComponent = async componentKey => {
502
526
  status = response.status;
503
527
  if (!response.ok) {
504
528
  if (status === 401) {
505
- throw new Error('Error occurred in authentication. Please regenerate using authenticate');
529
+ throw new Error(
530
+ 'Error occurred in authentication. Please regenerate using authenticate'
531
+ );
506
532
  // console.log(accessTokenUri, refreshToken);
507
533
  /* TODO - Handle refresh_token */
508
- } else if (status === 404) {
534
+ }
535
+ else if (status === 404){
509
536
  throw new Error('404: Server resource not found');
510
- } else if (status === 405) {
537
+ }
538
+ else if (status === 405){
511
539
  throw new Error('405: Server method not allowed');
512
- } else if (status === 408) {
540
+ }
541
+ else if (status === 408){
513
542
  throw new Error('408: Server timed out');
514
- } else if (response.status === 403) {
515
- throw new Error('Error forbidden: User does not have privileges to Publish.');
543
+ }
544
+ else if (response.status === 403) {
545
+ throw new Error(
546
+ 'Error forbidden: User does not have privileges to Publish.'
547
+ );
516
548
  }
517
549
  }
518
550
 
519
551
  try {
520
552
  const respData = await response.text();
521
- console.log(chalk.bold.green(`Success : ${respData}`));
553
+ console.log(
554
+ chalk.bold.green(`Success : ${respData}`)
555
+ );
522
556
 
523
557
  if (status === 500) {
524
558
  status = 999;
525
559
  throw new Error(respData.message);
526
560
  }
527
- } catch (err) {
561
+ }
562
+ catch (err) {
528
563
  if (status === 500) {
529
- throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
530
- } else if (status === 999) {
531
- throw new Error(err);
564
+ throw new Error(
565
+ `Error occurred in authentication. Please regenerate using authenticate`
566
+ );
567
+ }
568
+ else if (status === 999) {
569
+ throw new Error (err);
532
570
  }
533
571
  }
534
572
  }