@pega/custom-dx-components 0.25.22 → 0.25.24
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 +1 -1
- package/src/tasks/build-jest-assets/index.js +0 -1
- package/src/tasks/build-lib/helper.js +0 -2
- package/src/tasks/build-lib/index.js +3 -3
- package/src/tasks/create/index.js +5 -1
- package/src/tasks/create/templates/Constellation/Field/Boolean/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Date/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/DateTime/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/config.json.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/config.json.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/config.json.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Widget/CASE/config.json.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/config.json.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/config.json.mustache +1 -0
- package/src/tasks/create-all/index.js +5 -1
- package/src/tasks/delete/helper.js +0 -1
- package/src/tasks/delete/index.js +5 -1
- package/src/tasks/delete-lib/helper.js +0 -1
- package/src/tasks/delete-pub/helper.js +7 -2
- package/src/tasks/delete-version/index.js +0 -1
- package/src/tasks/export-archive/helper.js +7 -1
- package/src/tasks/export-archive/index.js +10 -34
- package/src/tasks/import-archive/helper.js +19 -5
- package/src/tasks/import-archive/index.js +247 -35
- package/src/tasks/import-comp/helper.js +0 -2
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/init/template/tasks.config.json +1 -1
- package/src/tasks/list/helper.js +17 -2
- package/src/tasks/list-lib/index.js +10 -1
- package/src/tasks/list-pub/helper.js +2 -4
- package/src/tasks/list-pub/index.js +15 -2
- package/src/tasks/publish/helper.js +0 -1
- package/src/tasks/publish/index.js +13 -1
- package/src/tasks/publish-all/index.js +10 -1
- package/src/tasks/publish-archive/index.js +53 -83
- package/src/tasks/publish-lib/index.js +0 -23
- package/src/tasks/rename/index.js +9 -1
- package/src/tasks/restore/index.js +19 -13
- package/src/tasks/set-perm/index.js +0 -2
- package/src/tasks/show-help/index.js +1 -5
- package/src/tasks/show-status/index.js +19 -6
- package/src/tasks/store/index.js +39 -18
- package/src/tasks/switch-lib/helper.js +0 -1
- package/src/tasks/validator/index.js +10 -5
- package/src/util.js +21 -77
- package/tests/assets/library/components/create/Pega_DXIL_MyTestText/config.json +1 -0
- package/tests/assets/library/components/create/shared/create-nonce.ts +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyBoolean/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCurrency/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/date.ts +0 -24
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDateTime/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDecimal/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyEmail/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyForm/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyInteger/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyParagraph/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPercentage/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPhone/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPicklist/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/repeat-utils.ts +0 -4
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyText/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTextInput/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyURL/config.json +1 -0
- package/tests/assets/library/components/createAll/Constellation/shared/create-nonce.ts +1 -0
- package/tests/assets/original/components/create/Pega_DXIL_MyTestText/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyBoolean/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCurrency/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDateTime/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDecimal/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDetails/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyEmail/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyForm/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyInteger/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyParagraph/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPercentage/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPhone/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPicklist/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyText/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTextInput/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/config.json +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyURL/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyBoolean/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCurrency/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDateTime/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDecimal/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDetails/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyEmail/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyForm/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyInteger/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyParagraph/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPercentage/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPhone/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPicklist/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyText/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTextInput/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/config.json +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyURL/config.json +1 -0
- package/tests/functional/localCreateBuildAllDeleteAll.test.js +8 -8
- package/tests/functional/localCreateBuildDelete.test.js +8 -8
- package/tests/functional/localCreateListDelete.test.js +8 -8
- package/tests/functional/localCreatePublishAllDeleteAll.test.js +8 -8
- package/tests/functional/localCreatePublishDelete.test.js +8 -8
- package/tests/functional/localCreateRenameDelete.test.js +8 -8
- package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +1 -1
- package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +1 -1
- package/tests/functional/localLibCreateLibStoreRestoreDeleteLib.test.js +376 -0
|
@@ -4,8 +4,7 @@ import fetch from 'node-fetch';
|
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import { zipUnArchiveToTempAndReturnBuffer, constructCompleteUrl, getHttpsAgent, getPegaServerConfig, addDebugLog, getConfigDefaults, zipVersionAndArchiveAndReturnBuffer } from '../../util.js';
|
|
7
|
+
import { zipUnArchiveToTempAndReturnBuffer, constructCompleteUrl, getHttpsAgent, getPegaServerConfig, addDebugLog, getConfigDefaults } from '../../util.js';
|
|
9
8
|
|
|
10
9
|
import { getPublishComponentQuestions } from './helper.js';
|
|
11
10
|
|
|
@@ -18,9 +17,9 @@ import {
|
|
|
18
17
|
} from '../../constants.js';
|
|
19
18
|
|
|
20
19
|
|
|
21
|
-
export const publishComponentLibraryArchiveToServer = async (data, doFetch) => {
|
|
20
|
+
export const publishComponentLibraryArchiveToServer = async (data, zipContent, doFetch) => {
|
|
22
21
|
addDebugLog("publishComponentToServer", `data: ${data}`, "");
|
|
23
|
-
const {
|
|
22
|
+
const { rulesetName, rulesetVersion, libraryName, version } = data;
|
|
24
23
|
|
|
25
24
|
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
26
25
|
const { serverType, isolationId } = defaultPegaServerConfig;
|
|
@@ -30,35 +29,24 @@ export const publishComponentLibraryArchiveToServer = async (data, doFetch) => {
|
|
|
30
29
|
isolationId || 'undefined'
|
|
31
30
|
);
|
|
32
31
|
let apiBody;
|
|
32
|
+
let urlParams;
|
|
33
33
|
|
|
34
34
|
if (isLaunchpad) {
|
|
35
35
|
// currently no launchpad records to rule resolve a library
|
|
36
36
|
|
|
37
|
-
// apiBody = {
|
|
38
|
-
// type: 'CustomComponent',
|
|
39
|
-
// zipContent,
|
|
40
|
-
// componentName: JSON.parse(configContent).componentKey,
|
|
41
|
-
// pxUpdateDateTime: '',
|
|
42
|
-
// environmentID: defaultPegaServerConfig.isolationId
|
|
43
|
-
// };
|
|
44
37
|
} else {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
publishFor: 'constellation',
|
|
48
|
-
rulesetName,
|
|
49
|
-
rulesetVersion,
|
|
50
|
-
libraryName,
|
|
51
|
-
version,
|
|
52
|
-
category: ''
|
|
53
|
-
};
|
|
38
|
+
urlParams = `/library-name/${libraryName}/library-version/${version}/rulesetname/${rulesetName}/rulesetversion/${rulesetVersion}`;
|
|
39
|
+
|
|
54
40
|
}
|
|
55
41
|
|
|
56
42
|
const defaultPegaConfig = await getPegaServerConfig();
|
|
57
|
-
|
|
43
|
+
let url = constructCompleteUrl(
|
|
58
44
|
defaultPegaConfig.server,
|
|
59
45
|
isLaunchpad ? launchpadRestEndpoint : PUBLISH_COMPONENT_LIBRARY_ARCHIVE_SERVICE_REST_ENDPOINT
|
|
60
46
|
);
|
|
61
47
|
|
|
48
|
+
url = url.concat(urlParams);
|
|
49
|
+
|
|
62
50
|
if (doFetch) {
|
|
63
51
|
try {
|
|
64
52
|
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
@@ -76,13 +64,15 @@ export const publishComponentLibraryArchiveToServer = async (data, doFetch) => {
|
|
|
76
64
|
headers['Content-Type'] = 'application/json';
|
|
77
65
|
} else {
|
|
78
66
|
headers.Authorization = `${tokenType} ${accessToken}`;
|
|
67
|
+
headers['Content-Type'] = 'application/json';
|
|
79
68
|
}
|
|
80
69
|
|
|
70
|
+
|
|
81
71
|
const response = await fetch(url, {
|
|
82
72
|
method: 'POST',
|
|
83
73
|
agent: getHttpsAgent(defaultPegaConfig),
|
|
84
74
|
headers,
|
|
85
|
-
body: JSON.stringify(
|
|
75
|
+
body: JSON.stringify(zipContent)
|
|
86
76
|
});
|
|
87
77
|
|
|
88
78
|
status = response.status;
|
|
@@ -114,6 +104,7 @@ export const publishComponentLibraryArchiveToServer = async (data, doFetch) => {
|
|
|
114
104
|
}
|
|
115
105
|
} catch (err) {
|
|
116
106
|
if (status === 500) {
|
|
107
|
+
const respData = isLaunchpad ? await response.text() : await response.json();
|
|
117
108
|
throw new Error(
|
|
118
109
|
`Error occurred in authentication. Please regenerate using authenticate`
|
|
119
110
|
);
|
|
@@ -147,6 +138,7 @@ export default async (orgLibName, selectedVersion) => {
|
|
|
147
138
|
const rulesetQuestions = await getPublishComponentQuestions();
|
|
148
139
|
const rulesetAnswers = await inquirer.prompt(rulesetQuestions);
|
|
149
140
|
const { rulesetName, rulesetVersion} = rulesetAnswers;
|
|
141
|
+
const mainDirectory = process.cwd();
|
|
150
142
|
|
|
151
143
|
let content = {
|
|
152
144
|
libraryName : orgLibName,
|
|
@@ -157,38 +149,25 @@ export default async (orgLibName, selectedVersion) => {
|
|
|
157
149
|
|
|
158
150
|
if (orgLibName === configDef.currentOrgLib && selectedVersion === configDef.buildVersion) {
|
|
159
151
|
|
|
160
|
-
/*
|
|
161
|
-
console.log("\nYou've selected the current working library/version.");
|
|
162
|
-
console.log("Export store or the current.");
|
|
163
|
-
const archAnswers = await inquirer.prompt([
|
|
164
|
-
{
|
|
165
|
-
name: 'currentOrStore',
|
|
166
|
-
type: 'rawlist',
|
|
167
|
-
message: 'Select current or store',
|
|
168
|
-
default: "Current",
|
|
169
|
-
choices: ["Current", "Store"]
|
|
170
|
-
},
|
|
171
|
-
]);
|
|
172
|
-
|
|
173
|
-
const currentOrStore = archAnswers.currentOrStore;
|
|
174
|
-
|
|
175
|
-
if (currentOrStore === "Current") {
|
|
176
|
-
archiveBeforeStore = true;
|
|
177
|
-
}
|
|
178
|
-
*/
|
|
179
152
|
archiveBeforeStore = true;
|
|
180
153
|
|
|
154
|
+
|
|
181
155
|
if (archiveBeforeStore) {
|
|
182
156
|
|
|
183
|
-
// returns both the output promise and the buffer that can be sent to PegaInfinity
|
|
184
|
-
let zipBuffer = await zipVersionAndArchiveAndReturnBuffer(configDef.currentOrgLib, configDef.buildVersion);
|
|
185
157
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
158
|
+
const archiveFileName = `${orgLibName}_${selectedVersion}.arch.zip`;
|
|
159
|
+
const archiveDirectory = join (mainDirectory, ARCHIVES_PATH, `${orgLibName}`, `${selectedVersion}`);
|
|
160
|
+
if (fs.existsSync(archiveDirectory)) {
|
|
161
|
+
const archiveFile = join(archiveDirectory, archiveFileName);
|
|
162
|
+
|
|
163
|
+
let zipContent = fs.readFileSync(archiveFile).toString("base64");
|
|
164
|
+
|
|
165
|
+
if (zipContent != null) {
|
|
166
|
+
|
|
167
|
+
zipContent = zipContent.replaceAll('"', "");
|
|
189
168
|
|
|
190
169
|
try {
|
|
191
|
-
publishComponentLibraryArchiveToServer(content, true )
|
|
170
|
+
publishComponentLibraryArchiveToServer(content, zipContent, true )
|
|
192
171
|
.then( () => {
|
|
193
172
|
console.log(chalk.green.bold(`Success: Published Archive ${content.libraryName}/${content.version} to server.`));
|
|
194
173
|
})
|
|
@@ -200,9 +179,10 @@ export default async (orgLibName, selectedVersion) => {
|
|
|
200
179
|
console.log(chalk.bold.red(err.toString()));
|
|
201
180
|
}
|
|
202
181
|
|
|
203
|
-
}
|
|
204
182
|
|
|
205
|
-
|
|
183
|
+
|
|
184
|
+
}
|
|
185
|
+
}
|
|
206
186
|
|
|
207
187
|
return;
|
|
208
188
|
|
|
@@ -213,48 +193,38 @@ export default async (orgLibName, selectedVersion) => {
|
|
|
213
193
|
// for now, to get a "buffer" from a zip file, need to unzip it in a /temp directory
|
|
214
194
|
// then re-zip. During the re-zip, create a buffer that can be passed to PegaInfinity
|
|
215
195
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
const archiveDirectory = join (mainDirectory, ARCHIVES_PATH, `${orgLibName}`, `${selectedVersion}`);
|
|
219
|
-
if (fs.existsSync(archiveDirectory)) {
|
|
220
|
-
const archiveFile = join(archiveDirectory, archiveFileName);
|
|
221
|
-
|
|
222
|
-
// unzip to /temp, then re-zip and retrieve the buffer (remove /temp later)
|
|
223
|
-
let zipBuffer = await zipUnArchiveToTempAndReturnBuffer(orgLibName, selectedVersion);
|
|
224
|
-
|
|
225
|
-
zipBuffer.output.on('close', function() {
|
|
226
|
-
|
|
227
|
-
// get rid of temp directory, regardless
|
|
228
|
-
const tempDirectory = join (mainDirectory, TEMP_PATH);
|
|
229
|
-
if (fs.existsSync(tempDirectory)) {
|
|
230
|
-
fs.rmSync(tempDirectory, { recursive: true });
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
if (zipBuffer.zipContent != null) {
|
|
196
|
+
// unzip to /temp, then re-zip and retrieve the buffer (remove /temp later)
|
|
197
|
+
let zipBuffer = await zipUnArchiveToTempAndReturnBuffer(orgLibName, selectedVersion);
|
|
234
198
|
|
|
235
|
-
|
|
199
|
+
zipBuffer.output.on('close', function() {
|
|
236
200
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
.catch( (err) => {
|
|
243
|
-
console.log(chalk.red.bold(err));
|
|
244
|
-
})
|
|
245
|
-
}
|
|
246
|
-
catch (err) {
|
|
247
|
-
console.log(chalk.bold.red(err.toString()));
|
|
248
|
-
}
|
|
201
|
+
// get rid of temp directory, regardless
|
|
202
|
+
const tempDirectory = join (mainDirectory, TEMP_PATH);
|
|
203
|
+
if (fs.existsSync(tempDirectory)) {
|
|
204
|
+
fs.rmSync(tempDirectory, { recursive: true });
|
|
205
|
+
}
|
|
249
206
|
|
|
207
|
+
if (zipBuffer.zipContent != null) {
|
|
250
208
|
|
|
209
|
+
content = { ...content, zipContent: zipBuffer.zipContent};
|
|
251
210
|
|
|
211
|
+
try {
|
|
212
|
+
publishComponentLibraryArchiveToServer(content, zipBuffer.zipContent, true )
|
|
213
|
+
.then( () => {
|
|
214
|
+
console.log(chalk.green.bold(`Success: Published Archive ${content.libraryName}/${content.version} to server.`));
|
|
215
|
+
})
|
|
216
|
+
.catch( (err) => {
|
|
217
|
+
console.log(chalk.red.bold(err));
|
|
218
|
+
})
|
|
219
|
+
}
|
|
220
|
+
catch (err) {
|
|
221
|
+
console.log(chalk.bold.red(err.toString()));
|
|
252
222
|
}
|
|
253
223
|
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
}
|
|
224
|
+
}
|
|
257
225
|
|
|
226
|
+
});
|
|
258
227
|
|
|
259
228
|
}
|
|
229
|
+
|
|
260
230
|
};
|
|
@@ -12,7 +12,6 @@ import { lintComponent } from '../linter/index.js';
|
|
|
12
12
|
import { constructCompleteUrl, getComponentDirectoryPath, getHttpsAgent, getPegaServerConfig, showVersion, getC11NB2STokenAndStaticServer, getLocalLibraryVersions, getLibraryBased, getLibraryBasedCL, deletePublishExtras, addDebugLog, checkLibraryAndArchives, checkJWTExpiration, getConfigDefaults } from '../../util.js';
|
|
13
13
|
|
|
14
14
|
import { publishLib, listLibJSONResponse, deleteLibVersion } from '@pega/constellation-dx-components-build-utils/index.js';
|
|
15
|
-
import { default as buildLibrary } from '../build-lib/index.js';
|
|
16
15
|
|
|
17
16
|
import { getLibraryVersionQuestion } from './helper.js';
|
|
18
17
|
|
|
@@ -99,7 +98,6 @@ addDebugLog("zipLibraryComponent", `libraryName: ${libraryName}, libraryVersion:
|
|
|
99
98
|
archive.file(localizationsJson, { name: path.basename(localizationsJson) });
|
|
100
99
|
}
|
|
101
100
|
|
|
102
|
-
|
|
103
101
|
await archive.finalize();
|
|
104
102
|
|
|
105
103
|
const zipBuffer = Buffer.concat(zipChunks);
|
|
@@ -140,13 +138,6 @@ addDebugLog("publishComponentToServer", `data: ${data}`, "");
|
|
|
140
138
|
if (isLaunchpad) {
|
|
141
139
|
// currently no launchpad records to rule resolve a library
|
|
142
140
|
|
|
143
|
-
// apiBody = {
|
|
144
|
-
// type: 'CustomComponent',
|
|
145
|
-
// zipContent,
|
|
146
|
-
// componentName: JSON.parse(configContent).componentKey,
|
|
147
|
-
// pxUpdateDateTime: '',
|
|
148
|
-
// environmentID: defaultPegaServerConfig.isolationId
|
|
149
|
-
// };
|
|
150
141
|
} else {
|
|
151
142
|
apiBody = {
|
|
152
143
|
configContent,
|
|
@@ -257,20 +248,12 @@ addDebugLog("publishComponentToServer", `data: ${data}`, "");
|
|
|
257
248
|
export const publishUILibraryComponentToInfinity = async (content) => {
|
|
258
249
|
addDebugLog("publishUILibraryComponentToInfinity", `content: ${content}`, "");
|
|
259
250
|
|
|
260
|
-
// const compDef = getConfigDefaults();
|
|
261
|
-
// const organization = compDef.organization;
|
|
262
|
-
// const library = compDef.library;
|
|
263
|
-
// const version = compDef.buildVersion;
|
|
264
|
-
// // const currentOrgLib = organization.concat('_').concat(library);
|
|
265
|
-
// const currentOrgLib = compDef.currentOrgLib;
|
|
266
|
-
|
|
267
251
|
console.log(chalk.green(`Publishing ${content.libraryName}/${content.version} to server...`));
|
|
268
252
|
|
|
269
253
|
const fromZip = await zipLibraryComponent(content.libraryName, content.version);
|
|
270
254
|
|
|
271
255
|
content = { ...fromZip, ...content };
|
|
272
256
|
|
|
273
|
-
// console.log(content);
|
|
274
257
|
try {
|
|
275
258
|
await publishComponentLibraryToServer(content, true );
|
|
276
259
|
// console.log(chalk.green.bold(`Success: Published ${content.libraryName}/${content.version} to server as a CL.`));
|
|
@@ -318,9 +301,6 @@ addDebugLog("publishLib", "services call", "");
|
|
|
318
301
|
await publishLib(libraryName, version, tokenAndStaticServer.C11NB2S, tokenAndStaticServer.appStaticContentServer);
|
|
319
302
|
addDebugLog("deleteLib", "services end", "");
|
|
320
303
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
304
|
}
|
|
325
305
|
|
|
326
306
|
|
|
@@ -375,7 +355,6 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
375
355
|
const orgLib = getConfigDefaults();
|
|
376
356
|
library = orgLib.library;
|
|
377
357
|
organization = orgLib.organization;
|
|
378
|
-
// libraryName = `${organization}_${library}`;
|
|
379
358
|
libraryName = orgLib.currentOrgLib;
|
|
380
359
|
|
|
381
360
|
version = orgLib.buildVersion;
|
|
@@ -394,8 +373,6 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
394
373
|
const compDef = getConfigDefaults();
|
|
395
374
|
organization = compDef.organization;
|
|
396
375
|
library = compDef.library;
|
|
397
|
-
|
|
398
|
-
// libraryName = `${organization}_${library}`;
|
|
399
376
|
libraryName = compDef.currentOrgLib;
|
|
400
377
|
|
|
401
378
|
try {
|
|
@@ -7,7 +7,15 @@ import inquirer from 'inquirer';
|
|
|
7
7
|
import ncp from 'ncp';
|
|
8
8
|
import chalk from 'chalk';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
checkPathAccess,
|
|
12
|
+
showVersion,
|
|
13
|
+
getComponentsObj,
|
|
14
|
+
getDirectoryFiles,
|
|
15
|
+
addDebugLog,
|
|
16
|
+
checkLibraryAndArchives,
|
|
17
|
+
getConfigDefaults,
|
|
18
|
+
getLibraryBased } from '../../util.js';
|
|
11
19
|
import { TASKS_CONFIG_JSON_FILENAME, COMPONENTS_DIRECTORY_PATH, COMPONENTS_PATH } from '../../constants.js';
|
|
12
20
|
|
|
13
21
|
|
|
@@ -34,14 +34,25 @@ addDebugLog("restoreComponent", "", "+");
|
|
|
34
34
|
console.log(chalk.bold.yellow('\nChanges not saved to local storage will be LOST, code will be restored from local storage.'));
|
|
35
35
|
console.log("");
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
let restoreFromStore = {};
|
|
38
|
+
|
|
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;
|
|
42
|
+
}
|
|
43
|
+
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
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
45
56
|
|
|
46
57
|
if (restoreFromStore.confirmRestore) {
|
|
47
58
|
const switchToFileName = `${confDef.currentOrgLib}_${confDef.version}.arch.zip`;
|
|
@@ -50,7 +61,6 @@ addDebugLog("restoreComponent", "", "+");
|
|
|
50
61
|
{
|
|
51
62
|
title: `Restoring ${confDef.displayLibVersion}`,
|
|
52
63
|
task: async () => {
|
|
53
|
-
// await zipVersionAndArchive(confDef.currentOrgLib, confDef.buildVersion);
|
|
54
64
|
await restoreFromArchive(switchToFileName, confDef.currentOrgLib, confDef.version);
|
|
55
65
|
}
|
|
56
66
|
}
|
|
@@ -69,10 +79,6 @@ addDebugLog("restoreComponent", "", "+");
|
|
|
69
79
|
await showCurrentStatus();
|
|
70
80
|
}
|
|
71
81
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
82
|
addDebugLog("restoreComponent", "", "-");
|
|
77
83
|
|
|
78
84
|
};
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
1
|
import chalk from 'chalk';
|
|
5
|
-
|
|
6
2
|
import { showVersion, getLibraryBased, getLibraryBasedCL } from '../../util.js';
|
|
7
3
|
|
|
8
4
|
export const showCurrentStatus = async () => {
|
|
@@ -116,7 +112,7 @@ export const showHelpV2 = (isCL) => {
|
|
|
116
112
|
|
|
117
113
|
console.log(`\n${chalk.underline(`Notes`)}`);
|
|
118
114
|
console.log(`The following commands will store existing version in storage before executing the command:`);
|
|
119
|
-
console.log(`${chalk.cyan(`createLib, switchLib, createLibVersion, switchLibVersion, publishLibVersion, exportLibVersion`)}`);
|
|
115
|
+
console.log(`${chalk.cyan(`createLib, switchLib, createLibVersion, switchLibVersion, publishLibVersion, exportLibVersion, storeLibVersion`)}`);
|
|
120
116
|
console.log(`\nWhen editing in an IDE, always ${chalk.yellow("SAVE")} changes to components before doing a library/version context switch`);
|
|
121
117
|
console.log(`or changes will be lost!`);
|
|
122
118
|
console.log(`\nStoring is to LOCAL storage and is not backed up. You should export your library/versions archives to ${chalk.yellow("git")}`);
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
1
|
import chalk from 'chalk';
|
|
5
2
|
|
|
6
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
showVersion,
|
|
5
|
+
getLibraryBased,
|
|
6
|
+
getConfigDefaults,
|
|
7
|
+
getComponents,
|
|
8
|
+
checkLibraryAndArchives,
|
|
9
|
+
getPegaServerConfig,
|
|
10
|
+
getLibraryBasedCL } from '../../util.js';
|
|
7
11
|
|
|
8
12
|
export const showCurrentStatus = async () => {
|
|
9
13
|
|
|
10
14
|
const configDefaults = getConfigDefaults();
|
|
11
15
|
const componentList = await getComponents();
|
|
12
16
|
const isLibraryBasedCL = getLibraryBasedCL();
|
|
17
|
+
const pegaServer = await getPegaServerConfig();
|
|
13
18
|
|
|
14
19
|
console.log("");
|
|
15
20
|
console.log("\tCurrent status");
|
|
@@ -30,7 +35,15 @@ export const showCurrentStatus = async () => {
|
|
|
30
35
|
|
|
31
36
|
console.log("");
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
if (isLibraryBasedCL) {
|
|
39
|
+
|
|
40
|
+
console.log(`\tRuleSet:\t ${chalk.bold.green(`${pegaServer.rulesetName}`)}`);
|
|
41
|
+
console.log(`\tRuleSet Version: ${chalk.bold.green(`${pegaServer.rulesetVersion}`)}`);
|
|
42
|
+
console.log("");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
};
|
|
34
47
|
|
|
35
48
|
|
|
36
49
|
export default async options => {
|
|
@@ -46,4 +59,4 @@ export default async options => {
|
|
|
46
59
|
|
|
47
60
|
|
|
48
61
|
|
|
49
|
-
}
|
|
62
|
+
};
|
package/src/tasks/store/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
import { Listr } from 'listr2';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
+
import inquirer from 'inquirer';
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
|
-
|
|
7
7
|
showVersion,
|
|
8
8
|
addDebugLog,
|
|
9
9
|
checkLibraryAndArchives,
|
|
@@ -26,30 +26,51 @@ addDebugLog("storeComponents", "", "+");
|
|
|
26
26
|
console.log(`Command only supported for ${chalk.bold.green('library mode')} components.`)
|
|
27
27
|
process.exit();
|
|
28
28
|
}
|
|
29
|
+
const confDef = getConfigDefaults();
|
|
30
|
+
|
|
29
31
|
|
|
30
32
|
console.log(chalk.bold.yellow('\nBe sure to SAVE all changes before storing, or changes will NOT be stored.'));
|
|
31
33
|
|
|
34
|
+
let answers = {};
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
|
|
42
|
+
answers = await inquirer.prompt([
|
|
37
43
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
name: 'confirmStore',
|
|
45
|
+
type: 'confirm',
|
|
46
|
+
message: `Storing ${chalk.green(`${confDef.currentOrgLib}/${confDef.buildVersion}`)} to local storage, proceed ?`,
|
|
47
|
+
default: true
|
|
42
48
|
}
|
|
43
|
-
]
|
|
44
|
-
|
|
45
|
-
);
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
console.log(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
if (answers.confirmStore) {
|
|
53
|
+
console.log("");
|
|
54
|
+
|
|
55
|
+
const tasks = new Listr(
|
|
56
|
+
[
|
|
57
|
+
{
|
|
58
|
+
title: `Store ${confDef.displayLibVersion}`,
|
|
59
|
+
task: async () => {
|
|
60
|
+
await zipVersionAndArchive(confDef.currentOrgLib, confDef.buildVersion);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
{ concurrent: false, exitOnError: true }
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
await tasks.run().catch(err => {
|
|
68
|
+
console.log(chalk.bold.red(err.toString()));
|
|
69
|
+
addDebugLog("storeComponents", "", "-");
|
|
70
|
+
process.exit(1);
|
|
71
|
+
});
|
|
72
|
+
console.log(chalk.greenBright('\nComponents Stored'));
|
|
73
|
+
}
|
|
53
74
|
|
|
54
75
|
addDebugLog("storeComponents", "", "-");
|
|
55
76
|
|
|
@@ -318,8 +318,10 @@ export default async (option) => {
|
|
|
318
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);
|
|
@@ -369,13 +373,14 @@ export default async (option) => {
|
|
|
369
373
|
componentToValidate &&
|
|
370
374
|
!/^[A-Za-z0-9]+_[A-Za-z0-9]+_[A-Za-z0-9]+$/.test(componentToValidate)
|
|
371
375
|
) {
|
|
372
|
-
const ootbComponents = await getOOTBComponents();
|
|
373
|
-
if (ootbComponents.includes(componentToValidate)) {
|
|
374
|
-
throw new Error(`Invalid: Error occurred in validating ${componentToValidate}`);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
376
|
|
|
377
|
+
if (throwTheError) {
|
|
378
|
+
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
379
|
|
|
380
|
+
}
|
|
381
|
+
console.log(`${chalk.redBright(`Error: Invalid name of component '${componentToValidate}' .\n Component name (and component folder) MUST be of the form: 'Org_Lib_ComponentName'.`)}`);
|
|
382
|
+
process.exit(1);
|
|
383
|
+
}
|
|
379
384
|
|
|
380
385
|
console.log(`${chalk.bold.green(componentToValidate)} schema is valid`);
|
|
381
386
|
} else {
|