@pega/custom-dx-components 0.0.1
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/.eslintrc.json +18 -0
- package/.prettierignore +2 -0
- package/.prettierrc.json +1 -0
- package/.vscode/extensions.json +9 -0
- package/.vscode/settings.json +48 -0
- package/LICENSE +185 -0
- package/README.md +204 -0
- package/bin/index.js +5 -0
- package/cspell.json +26 -0
- package/package.json +67 -0
- package/src/cli.js +92 -0
- package/src/constants.js +92 -0
- package/src/tasks/authenticate/helper.js +60 -0
- package/src/tasks/authenticate/index.js +75 -0
- package/src/tasks/create/index.js +304 -0
- package/src/tasks/create/template/config.json.mustache +67 -0
- package/src/tasks/create/template/demo.stories.jsx.mustache +44 -0
- package/src/tasks/create/template/index.jsx.mustache +55 -0
- package/src/tasks/create/template/styles.js.mustache +7 -0
- package/src/tasks/delete/helper.js +105 -0
- package/src/tasks/delete/index.js +45 -0
- package/src/tasks/index.js +9 -0
- package/src/tasks/init/helper.js +63 -0
- package/src/tasks/init/index.js +165 -0
- package/src/tasks/init/template/.eslintrc.json +10 -0
- package/src/tasks/init/template/.prettierrc.json +1 -0
- package/src/tasks/init/template/.storybook/main.js +6 -0
- package/src/tasks/init/template/.storybook/pega-logo.svg +16 -0
- package/src/tasks/init/template/.storybook/preview.tsx +44 -0
- package/src/tasks/init/template/.storybook/theme.js +44 -0
- package/src/tasks/init/template/.stylelintrc.json +4 -0
- package/src/tasks/init/template/.vscode/extensions.json +9 -0
- package/src/tasks/init/template/.vscode/settings.json +48 -0
- package/src/tasks/init/template/README.md +204 -0
- package/src/tasks/init/template/build.config.json +1 -0
- package/src/tasks/init/template/cspell.json +14 -0
- package/src/tasks/init/template/package.json.mustache +69 -0
- package/src/tasks/init/template/src/components/MBTAList/MBTAList.stories.tsx +10 -0
- package/src/tasks/init/template/src/components/MBTAList/MBTAList.tsx +122 -0
- package/src/tasks/init/template/src/components/MBTAList/icons/accessible.icon.tsx +14 -0
- package/src/tasks/init/template/src/components/MBTAList/icons/bus.icon.tsx +13 -0
- package/src/tasks/init/template/src/components/MBTAList/icons/mbta.icon.tsx +10 -0
- package/src/tasks/init/template/src/components/MBTAList/icons/subway.icon.tsx +14 -0
- package/src/tasks/init/template/src/components/MBTAList/index.ts +2 -0
- package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURL.stories.tsx +19 -0
- package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURL.styles.ts +5 -0
- package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURL.types.ts +10 -0
- package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURLDisplay.tsx +25 -0
- package/src/tasks/init/template/src/components/Organization_Library_MediaURL/MediaURLInput.tsx +24 -0
- package/src/tasks/init/template/src/components/Organization_Library_MediaURL/config.json +13 -0
- package/src/tasks/init/template/src/components/Organization_Library_MediaURL/index.ts +2 -0
- package/src/tasks/init/template/src/components/Organization_Library_VideoPlayer/config.json +44 -0
- package/src/tasks/init/template/src/components/Organization_Library_VideoPlayer/demo.stories.jsx +40 -0
- package/src/tasks/init/template/src/components/Organization_Library_VideoPlayer/index.jsx +42 -0
- package/src/tasks/init/template/src/components/Organization_Library_VideoPlayer/styles.js +5 -0
- package/src/tasks/init/template/tasks.config.json +21 -0
- package/src/tasks/init/template/tsconfig.build.json +16 -0
- package/src/tasks/init/template/tsconfig.json +8 -0
- package/src/tasks/list/helper.js +118 -0
- package/src/tasks/list/index.js +51 -0
- package/src/tasks/publish/bundle/builder/index.js +174 -0
- package/src/tasks/publish/bundle/builder/modules.js +139 -0
- package/src/tasks/publish/bundle/builder/paths.js +50 -0
- package/src/tasks/publish/bundle/builder/webpack.config.js +334 -0
- package/src/tasks/publish/bundle/index.js +65 -0
- package/src/tasks/publish/helper.js +145 -0
- package/src/tasks/publish/index.js +55 -0
- package/src/tasks/update/index.js +5 -0
- package/src/tasks/upgrade/index.js +31 -0
- package/src/tasks/validator/index.js +102 -0
- package/src/util.js +277 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import inquirer from 'inquirer';
|
|
6
|
+
import Ajv from 'ajv';
|
|
7
|
+
|
|
8
|
+
import { COMPONENT_SCHEMA } from '../../constants.js';
|
|
9
|
+
import { getComponentDirectoryPath, getComponents, getOOTBComponents } from '../../util.js';
|
|
10
|
+
|
|
11
|
+
const ajv = new Ajv({ allErrors: true });
|
|
12
|
+
|
|
13
|
+
const combinationTypes = ['PAGE', 'CASE'];
|
|
14
|
+
|
|
15
|
+
const allowedSubtypes = [
|
|
16
|
+
...new Set([
|
|
17
|
+
...COMPONENT_SCHEMA.subtype.field.map(({ value }) => value),
|
|
18
|
+
...COMPONENT_SCHEMA.subtype.template,
|
|
19
|
+
...COMPONENT_SCHEMA.subtype.widget,
|
|
20
|
+
combinationTypes
|
|
21
|
+
])
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const schema = {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
baseComponentName: { type: 'string' },
|
|
28
|
+
componentKey: { type: 'string', pattern: '^[A-Za-z0-9]+_[A-Za-z0-9]+_[A-Za-z0-9]+$' },
|
|
29
|
+
name: { type: 'string', pattern: '^[A-Za-z0-9]+_[A-Za-z0-9]+_[A-Za-z0-9]+$' },
|
|
30
|
+
label: { type: 'string' },
|
|
31
|
+
description: { type: 'string' },
|
|
32
|
+
organization: { type: 'string' },
|
|
33
|
+
version: { type: 'string' },
|
|
34
|
+
library: { type: 'string' },
|
|
35
|
+
allowedApplications : { type: 'array' },
|
|
36
|
+
type: { type: 'string', enum: COMPONENT_SCHEMA.type.map(({ value }) => value) },
|
|
37
|
+
subtype: {
|
|
38
|
+
anyOf: [{ type: 'string' }, { type: 'array' }],
|
|
39
|
+
|
|
40
|
+
enum: allowedSubtypes
|
|
41
|
+
},
|
|
42
|
+
icon: { type: 'string' },
|
|
43
|
+
properties: {
|
|
44
|
+
type: 'array',
|
|
45
|
+
uniqueItems: true,
|
|
46
|
+
items: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
name: { type: 'string' },
|
|
50
|
+
label: { type: 'string' },
|
|
51
|
+
format: { type: 'string' }
|
|
52
|
+
},
|
|
53
|
+
required: ['name', 'label', 'format']
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
defaultConfig: { type: 'object' }
|
|
57
|
+
},
|
|
58
|
+
required: ['componentKey', 'name', 'description', 'type', 'subtype', 'properties'],
|
|
59
|
+
additionalProperties: false
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const validateSchema = ajv.compile(schema);
|
|
63
|
+
|
|
64
|
+
export default async option => {
|
|
65
|
+
let componentToValidate = null;
|
|
66
|
+
if (option.params && option.params[3]) {
|
|
67
|
+
componentToValidate = option.params[3];
|
|
68
|
+
} else if (option && option.task === 'validateSchema') {
|
|
69
|
+
const localComponents = await getComponents();
|
|
70
|
+
const answer = await inquirer.prompt({
|
|
71
|
+
name: 'component',
|
|
72
|
+
type: 'rawlist',
|
|
73
|
+
message: 'Select component to validate',
|
|
74
|
+
choices: localComponents
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
componentToValidate = answer.component;
|
|
78
|
+
} else {
|
|
79
|
+
componentToValidate = option;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const componentDirectory = await getComponentDirectoryPath(componentToValidate);
|
|
83
|
+
const configFile = path.join(componentDirectory, 'config.json');
|
|
84
|
+
const data = JSON.parse(fs.readFileSync(path.resolve(configFile), 'utf8'));
|
|
85
|
+
const valid = validateSchema(data);
|
|
86
|
+
|
|
87
|
+
if (valid) {
|
|
88
|
+
if (
|
|
89
|
+
componentToValidate &&
|
|
90
|
+
!/^[A-Za-z0-9]+_[A-Za-z0-9]+_[A-Za-z0-9]+$/.test(componentToValidate)
|
|
91
|
+
) {
|
|
92
|
+
const ootbComponents = await getOOTBComponents();
|
|
93
|
+
if (ootbComponents.includes(componentToValidate)) {
|
|
94
|
+
throw new Error(`Invalid: Error occured in validating ${componentToValidate}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log(`${chalk.bold.green(componentToValidate)} schema is valid`);
|
|
99
|
+
} else {
|
|
100
|
+
throw new Error(`Invalid: ${ajv.errorsText(validateSchema.errors)}`);
|
|
101
|
+
}
|
|
102
|
+
};
|
package/src/util.js
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { promisify } from 'util';
|
|
4
|
+
import https from 'https';
|
|
5
|
+
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import mustache from 'mustache';
|
|
8
|
+
import pascalCase from 'pascalcase';
|
|
9
|
+
import fetch from 'node-fetch';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
COMPONENTS_DIRECTORY_PATH,
|
|
13
|
+
TASKS_CONFIG_JSON_FILENAME,
|
|
14
|
+
TOKEN_PATH,
|
|
15
|
+
OOTB_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
16
|
+
DELETE_COMPONENT_SERVICE_REST_ENDPOINT,
|
|
17
|
+
OOTB_COMPONENTS,
|
|
18
|
+
TOKEN_URL_V1
|
|
19
|
+
} from './constants.js';
|
|
20
|
+
|
|
21
|
+
const access = promisify(fs.access);
|
|
22
|
+
|
|
23
|
+
export const checkPathAccess = async (path, options = {}) => {
|
|
24
|
+
const { errorMessage } = options;
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
await access(path, fs.constants.R_OK);
|
|
28
|
+
} catch (err) {
|
|
29
|
+
const message =
|
|
30
|
+
errorMessage || `${chalk.red.bold('ERROR')} Could not able to access path - ${path}`;
|
|
31
|
+
console.error(message);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const deleteLocalComponent = async componentKey => {
|
|
37
|
+
const currentDirectory = process.cwd();
|
|
38
|
+
const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
39
|
+
|
|
40
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
41
|
+
|
|
42
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
43
|
+
data = JSON.parse(data);
|
|
44
|
+
|
|
45
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
46
|
+
console.error(
|
|
47
|
+
`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
|
|
48
|
+
);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const directory = join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH], componentKey);
|
|
53
|
+
|
|
54
|
+
fs.rmdir(directory, { recursive: true }, err => {
|
|
55
|
+
if (err) {
|
|
56
|
+
throw err;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
console.log(`${chalk.red.bold(componentKey)} is deleted from Local`);
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const deleteServerComponent = async componentKey => {
|
|
64
|
+
const { server, user, password } = await getPegaServerConfig();
|
|
65
|
+
const url = constructCompleteUrl(server, DELETE_COMPONENT_SERVICE_REST_ENDPOINT);
|
|
66
|
+
const [componentName, rulesetName, rulesetVersion] = componentKey.split('~|~');
|
|
67
|
+
const deleteUrl = `${url}/${componentName}/rulesetname/${rulesetName}/rulesetversion/${rulesetVersion}`;
|
|
68
|
+
try {
|
|
69
|
+
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
70
|
+
|
|
71
|
+
if (OauthData) {
|
|
72
|
+
const {
|
|
73
|
+
access_token: accessToken,
|
|
74
|
+
token_type: tokenType,
|
|
75
|
+
refresh_token: refreshToken
|
|
76
|
+
} = JSON.parse(OauthData);
|
|
77
|
+
fetch(deleteUrl, {
|
|
78
|
+
method: 'DELETE',
|
|
79
|
+
agent: new https.Agent({ rejectUnauthorized: false }),
|
|
80
|
+
headers: {
|
|
81
|
+
Authorization: `${tokenType} ${accessToken}`
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
.then(response => response.text())
|
|
85
|
+
.then(resp => {
|
|
86
|
+
const respData = JSON.parse(resp);
|
|
87
|
+
if (respData.status == 200) {
|
|
88
|
+
console.log(chalk.bold.green(`Success : ${respData.message}`));
|
|
89
|
+
} else {
|
|
90
|
+
throw new Error(`${respData.message}`);
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
.catch(e => Promise.reject(`${chalk.bold.red(e)}`));
|
|
94
|
+
}
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.log(`\n${chalk.bold.red(error)}`);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const getComponents = async () => {
|
|
101
|
+
const currentDirectory = process.cwd();
|
|
102
|
+
const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
103
|
+
|
|
104
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
105
|
+
|
|
106
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
107
|
+
data = JSON.parse(data);
|
|
108
|
+
|
|
109
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
110
|
+
console.error(
|
|
111
|
+
`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
|
|
112
|
+
);
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const directory = join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH]);
|
|
117
|
+
return fs
|
|
118
|
+
.readdirSync(directory, { withFileTypes: true })
|
|
119
|
+
.filter(dirent => dirent.isDirectory())
|
|
120
|
+
.map(dirent => dirent.name);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const getPegaConfig = async () => {
|
|
124
|
+
const currentDirectory = process.cwd();
|
|
125
|
+
const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
126
|
+
|
|
127
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
128
|
+
|
|
129
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
130
|
+
data = JSON.parse(data);
|
|
131
|
+
|
|
132
|
+
return data;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export const getPegaServerConfig = async () => {
|
|
136
|
+
const config = await getPegaConfig();
|
|
137
|
+
return config['server-config'];
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const getComponentDefaults = async () => {
|
|
141
|
+
const config = await getPegaConfig();
|
|
142
|
+
return config.component;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const getComponentDirectoryPath = async componentKey => {
|
|
146
|
+
const currentDirectory = process.cwd();
|
|
147
|
+
const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
148
|
+
|
|
149
|
+
await checkPathAccess(pegaConfigJsonPath);
|
|
150
|
+
|
|
151
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
152
|
+
data = JSON.parse(data);
|
|
153
|
+
|
|
154
|
+
if (!data[COMPONENTS_DIRECTORY_PATH]) {
|
|
155
|
+
console.error(
|
|
156
|
+
`${chalk.red.bold('ERROR')} Could not able find components directory path in config.json`
|
|
157
|
+
);
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return join(currentDirectory, data[COMPONENTS_DIRECTORY_PATH], componentKey);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const compileMustacheTemplate = (file, data) => {
|
|
165
|
+
const content = fs.readFileSync(file, 'utf8');
|
|
166
|
+
return mustache.render(content, data);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const isPascalCase = string => {
|
|
170
|
+
return string === pascalCase(string);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export const convertIntoPascalCase = string => {
|
|
174
|
+
return pascalCase(string);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export const constructCompleteUrl = (baseServer, endPoint) => {
|
|
178
|
+
return baseServer.endsWith('/') ? `${baseServer}${endPoint}` : `${baseServer}/${endPoint}`;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export const nodeFetch = (url, config) => {
|
|
182
|
+
const { method, user, password, headers, ...restConfig } = config;
|
|
183
|
+
|
|
184
|
+
if (url.startsWith('https')) restConfig.agent = new https.Agent({ rejectUnauthorized: false });
|
|
185
|
+
|
|
186
|
+
return fetch(url, {
|
|
187
|
+
method,
|
|
188
|
+
...restConfig,
|
|
189
|
+
headers: {
|
|
190
|
+
'Content-Type': 'application/json;charset=utf-8',
|
|
191
|
+
Authorization: `Basic ${Buffer.from(`${user}:${password}`).toString('base64')}`,
|
|
192
|
+
...headers
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export const sanitize = str => {
|
|
198
|
+
/* Allow only numbers and case insensitive alphabets */
|
|
199
|
+
str = str.replace(/[^a-zA-Z0-9 ]/g, '');
|
|
200
|
+
/* spaces will be replaced by - */
|
|
201
|
+
str = str.replace(/\s+/g, '-');
|
|
202
|
+
return str;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export const validateSemver = str => {
|
|
206
|
+
/* basic semver version validation - 0.0.1-dev */
|
|
207
|
+
const regex = /^[0-9]\d*\.\d+\.\d+(?:-[a-zA-Z0-9]+)?$/g;
|
|
208
|
+
return regex.test(str);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export const validateRulesetVersion = str => {
|
|
212
|
+
/* Ruleset version range - 01-99 */
|
|
213
|
+
if (str.indexOf('00') !== -1) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
/* basic ruleset version validation - 01-01-01 */
|
|
217
|
+
const regex = /^\d\d-\d\d-\d\d$/g;
|
|
218
|
+
return regex.test(str);
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export const getOOTBComponents = async () => {
|
|
222
|
+
return new Promise((resolve, reject) => {
|
|
223
|
+
fs.readFile(OOTB_COMPONENTS, 'utf-8', async (err, data) => {
|
|
224
|
+
if (err) {
|
|
225
|
+
try {
|
|
226
|
+
const { server } = await getPegaServerConfig();
|
|
227
|
+
const url = constructCompleteUrl(server, OOTB_COMPONENT_SERVICE_REST_ENDPOINT);
|
|
228
|
+
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
229
|
+
if (OauthData) {
|
|
230
|
+
const {
|
|
231
|
+
access_token: accessToken,
|
|
232
|
+
token_type: tokenType,
|
|
233
|
+
refresh_token: refreshToken
|
|
234
|
+
} = JSON.parse(OauthData);
|
|
235
|
+
fetch(url, {
|
|
236
|
+
method: 'GET',
|
|
237
|
+
agent: new https.Agent({ rejectUnauthorized: false }),
|
|
238
|
+
headers: {
|
|
239
|
+
Authorization: `${tokenType} ${accessToken}`
|
|
240
|
+
}
|
|
241
|
+
})
|
|
242
|
+
.then(response => response.text())
|
|
243
|
+
.then(data => {
|
|
244
|
+
if (data.charAt() === '[') {
|
|
245
|
+
data = data.slice(1, -1);
|
|
246
|
+
data = data.replace(/\s/g, '');
|
|
247
|
+
fs.writeFile(OOTB_COMPONENTS, data, err => {
|
|
248
|
+
if (err) {
|
|
249
|
+
console.error(err);
|
|
250
|
+
}
|
|
251
|
+
resolve(data.split(','));
|
|
252
|
+
});
|
|
253
|
+
} else {
|
|
254
|
+
data = JSON.parse(data);
|
|
255
|
+
if (data && data.errors) {
|
|
256
|
+
const errMessages = data.errors;
|
|
257
|
+
errMessages.forEach(msgArr => {
|
|
258
|
+
throw new Error(`Failed with error - ${JSON.stringify(msgArr.message)}`);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
})
|
|
263
|
+
.catch(e => Promise.reject(`${chalk.bold.red(e)}`));
|
|
264
|
+
}
|
|
265
|
+
} catch (error) {
|
|
266
|
+
throw new Error('Error occurred in validation', error);
|
|
267
|
+
}
|
|
268
|
+
} else {
|
|
269
|
+
resolve(data.split(','));
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
export const getTokenUrl = async (server) => {
|
|
276
|
+
return server.endsWith('/') ? `${server}${TOKEN_URL_V1}` : `${server}/${TOKEN_URL_V1}`;
|
|
277
|
+
};
|