@pega/dx-component-builder-sdk 0.1.12 → 0.1.14

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/dx-component-builder-sdk",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Utility for building custom UI components",
5
5
  "bin": "./bin/index.js",
6
6
  "scripts": {
package/src/cli.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  deleteAllComponents,
10
10
  generateMissingCompanions,
11
11
  listComponents,
12
+ mapAllComponents,
12
13
  overrideComponent,
13
14
  publishComponent,
14
15
  publishAllComponents,
@@ -21,6 +22,7 @@ const TASKS = {
21
22
  CREATE: 'create',
22
23
  OVERRIDE: 'override',
23
24
  BUILD: 'buildComponent',
25
+ MAP_ALL: "mapAll",
24
26
  PUBLISH: 'publish',
25
27
  PUBLISH_All: 'publishAll',
26
28
  LIST: 'list',
@@ -64,6 +66,10 @@ export default async (args = []) => {
64
66
  overrideComponent(options);
65
67
  break;
66
68
  }
69
+ case TASKS.MAP_ALL: {
70
+ mapAllComponents(options);
71
+ break;
72
+ }
67
73
  case TASKS.PUBLISH: {
68
74
  publishComponent(options);
69
75
  break;
package/src/constants.js CHANGED
@@ -157,7 +157,7 @@ export const COMPONENT_SCHEMA = {
157
157
  },
158
158
  overrideType: [
159
159
  {
160
- name: 'Form (Field)',
160
+ name: 'Field (Form)',
161
161
  value: 'forms'
162
162
  },
163
163
  {
@@ -303,18 +303,10 @@ export const COMPONENT_SCHEMA = {
303
303
  name: 'Assignment Card',
304
304
  value: 'AssignmentCard'
305
305
  },
306
- {
307
- name: 'Attachment',
308
- value: 'Attachment'
309
- },
310
306
  {
311
307
  name: 'Dashboard Filter',
312
308
  value: 'DashboardFilter'
313
309
  },
314
- {
315
- name: 'Defer Load',
316
- value: 'DeferLoad'
317
- },
318
310
  {
319
311
  name: 'Error Boundary',
320
312
  value: 'ErrorBoundary'
@@ -327,14 +319,6 @@ export const COMPONENT_SCHEMA = {
327
319
  name: 'Nav Bar',
328
320
  value: 'NavBar'
329
321
  },
330
- {
331
- name: 'Reference',
332
- value: 'Reference'
333
- },
334
- {
335
- name: 'Region',
336
- value: 'Region'
337
- },
338
322
  {
339
323
  name: 'Stages',
340
324
  value: 'Stages'
@@ -507,6 +491,10 @@ export const COMPONENT_SCHEMA = {
507
491
  name: 'App Announcement',
508
492
  value: 'AppAnnouncement'
509
493
  },
494
+ {
495
+ name: 'Attachment',
496
+ value: 'Attachment'
497
+ },
510
498
  {
511
499
  name: 'Case History',
512
500
  value: 'CaseHistory'
@@ -25,7 +25,6 @@ export const SOURCE_OF_COMPONENT_TYPES = {
25
25
 
26
26
  export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOption) => {
27
27
  const defaultPegaServerConfig = await getPegaServerConfig();
28
- const categoryType = getOptionsCategory(options);
29
28
 
30
29
  return [
31
30
  {
@@ -2,6 +2,7 @@ export { default as createComponent } from './create/index.js';
2
2
  export { default as overrideComponent } from './override/index.js';
3
3
  export { default as deleteComponent } from './delete/index.js';
4
4
  export { default as deleteAllComponents } from './delete-all/index.js';
5
+ export { default as mapAllComponents } from './map-all/index.js';
5
6
  export { default as publishComponent } from './publish/index.js';
6
7
  export { default as publishAllComponents } from './publish-all/index.js';
7
8
  export { default as listComponents } from './list/index.js';
@@ -17,8 +17,6 @@ export const SOURCE_OF_COMPONENT_TYPES = {
17
17
  export const getListComponentsQuestions = async (options, sourceOfComponentsOption) => {
18
18
  const defaultPegaServerConfig = await getPegaServerConfig();
19
19
 
20
- const categoryType = getOptionsCategory(options);
21
-
22
20
  return [
23
21
 
24
22
  {
@@ -0,0 +1,31 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import https from 'https';
4
+
5
+ import fetch from 'node-fetch';
6
+ import AdmZip from 'adm-zip';
7
+ import chalk from 'chalk';
8
+
9
+ import {
10
+ getComponentDirectoryPath,
11
+ getOptionsCategory
12
+ } from '../../util.js';
13
+ import { COMPONENT_SCHEMA, CATEGORY_CONSTELLATION, CATEGORY_CUSTOM } from '../../constants.js';
14
+
15
+
16
+
17
+ export const getBuildCategory = async (options) => {
18
+ const categoryType = getOptionsCategory(options);
19
+
20
+ return [
21
+ {
22
+ name: 'category',
23
+ type: 'rawlist',
24
+ message: 'Category of components ?',
25
+ choices: COMPONENT_SCHEMA.category,
26
+ when() {
27
+ return !options.params[4] && categoryType == null;
28
+ }
29
+ }
30
+ ];
31
+ };
@@ -0,0 +1,58 @@
1
+ import inquirer from 'inquirer';
2
+ import Listr from 'listr';
3
+ import chalk from 'chalk';
4
+
5
+ import validate from '../validator/index.js';
6
+ import { showVersion, getOptionsCategory, getComponentsObj } from '../../util.js';
7
+ import { updateComponentMap } from '../map/map.js';
8
+ import { CATEGORY_CUSTOM } from '../../constants.js';
9
+
10
+
11
+ import { getBuildCategory } from './helper.js';
12
+
13
+
14
+
15
+ export default async options => {
16
+ showVersion();
17
+
18
+ const catQuestion = await getBuildCategory(options);
19
+ const catAnwers = await inquirer.prompt(catQuestion);
20
+
21
+ let category = catAnwers.category;
22
+ if (category == null) {
23
+ category = getOptionsCategory(options);
24
+ }
25
+
26
+
27
+ const components = await getComponentsObj(false, category);
28
+
29
+
30
+ var componentKey;
31
+
32
+ const customTasks = new Listr(
33
+ [
34
+ {
35
+ title: 'Update component map',
36
+ task: async () => {
37
+ await updateComponentMap(componentKey, category);
38
+ }
39
+ }
40
+
41
+ ],
42
+ {
43
+ exitOnError: true
44
+ }
45
+ );
46
+
47
+
48
+ for (var index in components) {
49
+ componentKey = components[index].value;
50
+ console.log(chalk.bold.green("Mapping: " + components[index].name));
51
+ await customTasks.run().catch(err => {
52
+ console.log(chalk.bold.red(err.toString()));
53
+ });
54
+ }
55
+
56
+
57
+ return true;
58
+ };
package/src/util.js CHANGED
@@ -150,6 +150,25 @@ export const getOptionsCategory = (options) => {
150
150
  return categoryType;
151
151
  }
152
152
 
153
+ export const getOptionsSource = (options) => {
154
+ let sourceType = null;
155
+ if (options.params[3]) {
156
+ let srcType = options.params[3];
157
+
158
+ switch (srcType.toLowerCase()) {
159
+ case "server" :
160
+ case "s" :
161
+ sourceType = "Server";
162
+ break;
163
+ case "local" :
164
+ case "l" :
165
+ sourceType = "Local";
166
+ break;
167
+ }
168
+ }
169
+ return sourceType;
170
+ }
171
+
153
172
  export const getComponents = async (showSeparator = false, category = CATEGORY_CUSTOM) => {
154
173
  const currentDirectory = process.cwd();
155
174
  const pegaConfigJsonPath = join(currentDirectory, DXCB_CONFIG_JSON_FILENAME);