@pega/custom-dx-components 0.25.19 → 0.25.21
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 +2 -2
- package/src/tasks/build-jest-assets/index.js +5 -5
- package/src/tasks/create/templates/Constellation/Field/Boolean/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Date/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Date/date.ts.mustache +0 -24
- package/src/tasks/create/templates/Constellation/Field/DateTime/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Integer/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/repeat-utils.ts.mustache +0 -4
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Email/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Input/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/Text-URL/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/FORM/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/FORM-region/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Template/PAGE/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Widget/CASE/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Widget/CASE/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE/create-nonce.ts.mustache +1 -0
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/create-nonce.ts.mustache +1 -0
- package/src/tasks/create-lib/helper.js +6 -2
- package/src/tasks/create-lib/index.js +3 -1
- package/src/tasks/delete-pub/index.js +3 -1
- package/src/tasks/export-archive/index.js +10 -5
- package/src/tasks/import-archive/index.js +12 -18
- package/src/tasks/init/template/.eslintrc.json +1 -1
- package/src/tasks/init/template/package.json.mustache +4 -4
- package/src/tasks/list-pub/index.js +15 -7
- package/src/tasks/publish-lib/index.js +131 -135
- package/src/tasks/restore/index.js +7 -1
- package/src/tasks/show-status/index.js +10 -6
- package/src/util.js +83 -4
- package/tests/assets/library/components/create/Pega_DXIL_MyTestText/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyBoolean/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/localizations.json +8 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCurrency/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDateTime/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDecimal/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyEmail/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyForm/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/localizations.json +10 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyInteger/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/localizations.json +10 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyParagraph/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPercentage/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPhone/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPicklist/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/localizations.json +5 -0
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyText/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTextInput/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/config.json +1 -1
- package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyURL/config.json +1 -1
- package/tests/assets/original/components/create/Pega_DXIL_MyTestText/create-nonce.ts +1 -0
- package/tests/assets/original/components/create/shared/PConnProps.d.ts +46 -0
- package/tests/assets/original/components/create/shared/create-nonce.ts +7 -0
- package/tests/assets/original/components/create/shared/suggestions-handler.ts +9 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyBoolean/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/localizations.json +8 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCurrency/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/date.ts +0 -24
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDateTime/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDecimal/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDetails/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyEmail/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyForm/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/localizations.json +10 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyInteger/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/localizations.json +10 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyParagraph/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPercentage/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPhone/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPicklist/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/localizations.json +5 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/repeat-utils.ts +0 -4
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyText/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTextInput/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyURL/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Constellation/shared/PConnProps.d.ts +46 -0
- package/tests/assets/original/components/createAll/Constellation/shared/create-nonce.ts +7 -0
- package/tests/assets/original/components/createAll/Constellation/shared/suggestions-handler.ts +9 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyBoolean/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCurrency/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/date.ts +0 -24
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDateTime/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDecimal/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDetails/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyEmail/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyForm/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyInteger/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyParagraph/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPercentage/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPhone/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPicklist/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/localizations.json +5 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/repeat-utils.ts +0 -4
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyText/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTextInput/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyURL/create-nonce.ts +1 -0
- package/tests/assets/original/components/createAll/Launchpad/shared/PConnProps.d.ts +46 -0
- package/tests/assets/original/components/createAll/Launchpad/shared/create-nonce.ts +7 -0
- package/tests/assets/original/components/createAll/Launchpad/shared/suggestions-handler.ts +9 -0
- package/tests/functional/localCreateAllListDeleteAll.test.js +8 -8
- package/tests/functional/localLibCreateLibAlreadyDeleteLib.test.js +14 -14
- package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +17 -17
- package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +20 -20
- package/tests/functional/localLibCreateLibDeleteLib.test.js +17 -17
- package/tests/functional/localLibCreateLibExportImportLib.test.js +27 -27
- package/tests/functional/localLibCreateLibExportLib.test.js +19 -19
- package/tests/functional/localLibCreateLibImportCompDeleteLib.test.js +14 -14
- package/tests/functional/localLibCreateLibListDeleteLib.test.js +22 -22
- package/tests/functional/localLibCreateLibListMoveDeleteLib.test.js +31 -31
- package/tests/functional/localLibCreateLibListSwitchDeleteLib.test.js +20 -20
- package/tests/functional/localLibCreateLibStatusDeleteLib.test.js +13 -29
- package/tests/functional/localLibCreateLibValidateDeleteLib.test.js +15 -15
- package/tests/functional/localLibCreateLibVersionDeleteLib.test.js +27 -27
- package/tests/functional/localLibCreateLibPermDeleteLib.test.js +0 -144
|
@@ -67,6 +67,8 @@ addDebugLog("doesLibraryExist", `libraryName: ${libraryName}, libraryVersion: ${
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
export const zipLibraryComponent = async (libraryName, version) => {
|
|
70
|
+
addDebugLog("zipLibraryComponent", `libraryName: ${libraryName}, libraryVersion: ${version}`, "");
|
|
71
|
+
|
|
70
72
|
const currentDirectory = process.cwd();
|
|
71
73
|
const libraryDirName = `${libraryName}/${version}`;
|
|
72
74
|
const libraryDirectory = path.join(currentDirectory, libraryDirName);
|
|
@@ -79,15 +81,20 @@ export const zipLibraryComponent = async (libraryName, version) => {
|
|
|
79
81
|
const zipChunks = [];
|
|
80
82
|
archive.on('data', chunk => zipChunks.push(chunk));
|
|
81
83
|
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
+
// No going to add full list of created by buildLib, instead
|
|
85
|
+
// below going just just *.js files and a few specific .json files
|
|
86
|
+
// // Add main directory as src directory in zip
|
|
87
|
+
// archive.directory(libraryDirectory, 'src');
|
|
88
|
+
|
|
89
|
+
// only zip *.js files, not *.js.br, *.js.map, license, text, json, etc.
|
|
90
|
+
archive.glob("*.js", { cwd: libraryDirectory });
|
|
84
91
|
|
|
85
|
-
// Add
|
|
92
|
+
// Add componentsconfig.json.json file (array of config.json)
|
|
86
93
|
if (fs.existsSync(componentsConfigJson)) {
|
|
87
94
|
archive.file(componentsConfigJson, { name: path.basename(componentsConfigJson) });
|
|
88
95
|
}
|
|
89
96
|
|
|
90
|
-
// Add localizations file
|
|
97
|
+
// Add componentslocalization.jspon (array of component localizations) file
|
|
91
98
|
if (fs.existsSync(localizationsJson)) {
|
|
92
99
|
archive.file(localizationsJson, { name: path.basename(localizationsJson) });
|
|
93
100
|
}
|
|
@@ -118,136 +125,138 @@ export const zipLibraryComponent = async (libraryName, version) => {
|
|
|
118
125
|
|
|
119
126
|
|
|
120
127
|
export const publishComponentLibraryToServer = async (data, doFetch) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
128
|
+
addDebugLog("publishComponentToServer", `data: ${data}`, "");
|
|
129
|
+
const { configContent, zipContent, localizationsContent, rulesetName, rulesetVersion, libraryName, version } = data;
|
|
130
|
+
|
|
131
|
+
const defaultPegaServerConfig = await getPegaServerConfig();
|
|
132
|
+
const { serverType, isolationId } = defaultPegaServerConfig;
|
|
133
|
+
const isLaunchpad = serverType === 'launchpad';
|
|
134
|
+
const launchpadRestEndpoint = LP_PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT.replace(
|
|
135
|
+
'{isolationId}',
|
|
136
|
+
isolationId || 'undefined'
|
|
137
|
+
);
|
|
138
|
+
let apiBody;
|
|
139
|
+
|
|
140
|
+
if (isLaunchpad) {
|
|
141
|
+
// currently no launchpad records to rule resolve a library
|
|
142
|
+
|
|
143
|
+
// apiBody = {
|
|
144
|
+
// type: 'CustomComponent',
|
|
145
|
+
// zipContent,
|
|
146
|
+
// componentName: JSON.parse(configContent).componentKey,
|
|
147
|
+
// pxUpdateDateTime: '',
|
|
148
|
+
// environmentID: defaultPegaServerConfig.isolationId
|
|
149
|
+
// };
|
|
150
|
+
} else {
|
|
151
|
+
apiBody = {
|
|
152
|
+
configContent,
|
|
153
|
+
zipContent,
|
|
154
|
+
publishFor: 'constellation',
|
|
155
|
+
rulesetName,
|
|
156
|
+
rulesetVersion,
|
|
157
|
+
libraryName,
|
|
158
|
+
version,
|
|
159
|
+
category: '',
|
|
160
|
+
localizationsContent
|
|
161
|
+
};
|
|
162
|
+
}
|
|
156
163
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if (doFetch) {
|
|
164
|
-
try {
|
|
165
|
-
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
166
|
-
if (OauthData) {
|
|
167
|
-
const {
|
|
168
|
-
access_token: accessToken,
|
|
169
|
-
token_type: tokenType
|
|
170
|
-
// refresh_token: refreshToken
|
|
171
|
-
} = JSON.parse(OauthData);
|
|
172
|
-
let status = 500;
|
|
173
|
-
let headers = {};
|
|
174
|
-
|
|
175
|
-
if (isLaunchpad) {
|
|
176
|
-
headers.cookie = `Pega-AAT=${accessToken}`;
|
|
177
|
-
headers['Content-Type'] = 'application/json';
|
|
178
|
-
} else {
|
|
179
|
-
headers.Authorization = `${tokenType} ${accessToken}`;
|
|
180
|
-
}
|
|
164
|
+
const defaultPegaConfig = await getPegaServerConfig();
|
|
165
|
+
const url = constructCompleteUrl(
|
|
166
|
+
defaultPegaConfig.server,
|
|
167
|
+
isLaunchpad ? launchpadRestEndpoint : PUBLISH_COMPONENT_LIBRARY_SERVICE_REST_ENDPOINT
|
|
168
|
+
);
|
|
181
169
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
170
|
+
if (doFetch) {
|
|
171
|
+
try {
|
|
172
|
+
const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
173
|
+
if (OauthData) {
|
|
174
|
+
const {
|
|
175
|
+
access_token: accessToken,
|
|
176
|
+
token_type: tokenType
|
|
177
|
+
// refresh_token: refreshToken
|
|
178
|
+
} = JSON.parse(OauthData);
|
|
179
|
+
let status = 500;
|
|
180
|
+
let headers = {};
|
|
181
|
+
|
|
182
|
+
if (isLaunchpad) {
|
|
183
|
+
headers.cookie = `Pega-AAT=${accessToken}`;
|
|
184
|
+
headers['Content-Type'] = 'application/json';
|
|
185
|
+
} else {
|
|
186
|
+
headers.Authorization = `${tokenType} ${accessToken}`;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
let spinner;
|
|
190
|
+
|
|
191
|
+
console.log();
|
|
192
|
+
spinner = ora(chalk.green.bold('Publishing library...')).start();
|
|
193
|
+
|
|
194
|
+
const response = await fetch(url, {
|
|
195
|
+
method: 'POST',
|
|
196
|
+
agent: getHttpsAgent(defaultPegaConfig),
|
|
197
|
+
headers,
|
|
198
|
+
body: JSON.stringify(apiBody)
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
spinner.stop();
|
|
202
|
+
|
|
203
|
+
status = response.status;
|
|
204
|
+
if (!response.ok) {
|
|
205
|
+
if (status === 401) {
|
|
206
|
+
throw new Error(
|
|
207
|
+
'Error occurred in authentication. Please regenerate using authenticate'
|
|
208
|
+
);
|
|
209
|
+
// console.log(accessTokenUri, refreshToken);
|
|
210
|
+
/* TODO - Handle refresh_token */
|
|
211
|
+
} else if (status === 404) {
|
|
212
|
+
throw new Error('404: Server resource not found');
|
|
213
|
+
} else if (status === 405) {
|
|
214
|
+
throw new Error('405: Server method not allowed');
|
|
215
|
+
} else if (status === 408) {
|
|
216
|
+
throw new Error('408: Server timed out');
|
|
217
|
+
} else if (response.status === 403) {
|
|
218
|
+
throw new Error('Error forbidden: User does not have privileges to Publish.');
|
|
213
219
|
}
|
|
220
|
+
}
|
|
214
221
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
222
|
+
try {
|
|
223
|
+
// const respData = isLaunchpad ? await response.text() : await response.json();
|
|
224
|
+
const headerType = response.headers.get('content-type');
|
|
225
|
+
const respData = headerType.includes("json") ? await response.json() : await response.text();
|
|
226
|
+
let respMessage = headerType.includes("json") ? respData.message : respData;
|
|
220
227
|
|
|
221
228
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
}
|
|
227
|
-
throw new Error(respMessage);
|
|
229
|
+
if (status === 500) {
|
|
230
|
+
status = 999;
|
|
231
|
+
if (respMessage === '') {
|
|
232
|
+
respMessage = `Server error, please check server logs for error.`;
|
|
228
233
|
}
|
|
234
|
+
throw new Error(respMessage);
|
|
235
|
+
}
|
|
229
236
|
|
|
230
|
-
|
|
237
|
+
console.log(chalk.bold.green(`Success : ${respMessage }`));
|
|
231
238
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
239
|
+
} catch (err) {
|
|
240
|
+
if (status === 500) {
|
|
241
|
+
throw new Error(`Server error, please check server logs for error.`);
|
|
242
|
+
} else if (status === 999) {
|
|
243
|
+
throw new Error(err);
|
|
238
244
|
}
|
|
239
|
-
} else {
|
|
240
|
-
throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
241
245
|
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
throw new Error(err);
|
|
246
|
+
} else {
|
|
247
|
+
throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
245
248
|
}
|
|
249
|
+
} catch (err) {
|
|
250
|
+
// throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
|
|
251
|
+
throw new Error(err);
|
|
246
252
|
}
|
|
247
|
-
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
248
255
|
|
|
249
256
|
|
|
250
257
|
export const publishUILibraryComponentToInfinity = async (content) => {
|
|
258
|
+
addDebugLog("publishUILibraryComponentToInfinity", `content: ${content}`, "");
|
|
259
|
+
|
|
251
260
|
// const compDef = getConfigDefaults();
|
|
252
261
|
// const organization = compDef.organization;
|
|
253
262
|
// const library = compDef.library;
|
|
@@ -267,16 +276,15 @@ export const publishUILibraryComponentToInfinity = async (content) => {
|
|
|
267
276
|
// console.log(chalk.green.bold(`Success: Published ${content.libraryName}/${content.version} to server as a CL.`));
|
|
268
277
|
}
|
|
269
278
|
catch (err) {
|
|
270
|
-
|
|
279
|
+
let sErr = err.toString();
|
|
280
|
+
// strip all Error:
|
|
281
|
+
sErr = sErr.replaceAll("Error: ", "");
|
|
282
|
+
console.log(chalk.bold.red("Error: " + sErr));
|
|
271
283
|
}
|
|
272
284
|
|
|
273
|
-
|
|
274
|
-
|
|
275
285
|
}
|
|
276
286
|
|
|
277
287
|
|
|
278
|
-
|
|
279
|
-
|
|
280
288
|
export const publishNewLibraryAsync = async (libraryName, version, checkDeleted = false) => {
|
|
281
289
|
addDebugLog("publishNewLibraryAsync", `libraryName: ${libraryName}, version: ${version}, checkDeleted: ${checkDeleted} `, "");
|
|
282
290
|
|
|
@@ -372,13 +380,6 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
372
380
|
|
|
373
381
|
version = orgLib.buildVersion;
|
|
374
382
|
|
|
375
|
-
// check to see if devBuild
|
|
376
|
-
// const devBuild = await getConfigDevBuild();
|
|
377
|
-
// const devBuild = orgLib.devBuild;
|
|
378
|
-
// if (devBuild) {
|
|
379
|
-
// version = version.concat("-dev");
|
|
380
|
-
// }
|
|
381
|
-
|
|
382
383
|
}
|
|
383
384
|
|
|
384
385
|
const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
|
|
@@ -414,10 +415,8 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
414
415
|
({version} = versionAnswers);
|
|
415
416
|
}
|
|
416
417
|
|
|
417
|
-
|
|
418
418
|
let okToPublish = true;
|
|
419
419
|
|
|
420
|
-
|
|
421
420
|
// this check matches check below, but for JEST, we don't want to go any further, just verifying if will
|
|
422
421
|
// be caught
|
|
423
422
|
if (noRealPublish && !version.includes("-dev")) {
|
|
@@ -425,7 +424,6 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
425
424
|
return;
|
|
426
425
|
}
|
|
427
426
|
|
|
428
|
-
|
|
429
427
|
if (!version.includes("-dev") && !internalPublish && !isLibraryBasedCL) {
|
|
430
428
|
okToPublish = false;
|
|
431
429
|
const publishAnswers = await inquirer.prompt([
|
|
@@ -457,7 +455,6 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
457
455
|
let content = { libraryName, version, rulesetName, rulesetVersion };
|
|
458
456
|
await publishUILibraryComponentToInfinity(content);
|
|
459
457
|
|
|
460
|
-
|
|
461
458
|
}
|
|
462
459
|
else {
|
|
463
460
|
let libVersionExists = await doesLibraryExist(libraryName, version);
|
|
@@ -515,7 +512,6 @@ addDebugLog("publishLibrary", "", "+");
|
|
|
515
512
|
}
|
|
516
513
|
|
|
517
514
|
|
|
518
|
-
|
|
519
515
|
addDebugLog("publishLibrary", "END", "-");
|
|
520
516
|
|
|
521
517
|
return true;
|
|
@@ -10,9 +10,12 @@ import {
|
|
|
10
10
|
getConfigDefaults,
|
|
11
11
|
getLibraryBased,
|
|
12
12
|
restoreFromArchive,
|
|
13
|
-
cleanUpTemp
|
|
13
|
+
cleanUpTemp,
|
|
14
|
+
forceDefaultsUpdate
|
|
14
15
|
} from '../../util.js';
|
|
15
16
|
|
|
17
|
+
import { showCurrentStatus } from '../show-status/index.js';
|
|
18
|
+
|
|
16
19
|
export default async options => {
|
|
17
20
|
await showVersion();
|
|
18
21
|
await checkLibraryAndArchives();
|
|
@@ -61,6 +64,9 @@ addDebugLog("restoreComponent", "", "+");
|
|
|
61
64
|
process.exit(1);
|
|
62
65
|
});
|
|
63
66
|
console.log(chalk.greenBright('\nComponents restored'));
|
|
67
|
+
|
|
68
|
+
await forceDefaultsUpdate();
|
|
69
|
+
await showCurrentStatus();
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
|
|
@@ -3,12 +3,13 @@ import path from 'path';
|
|
|
3
3
|
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
|
|
6
|
-
import { showVersion, getLibraryBased, addDebugLog, getConfigDefaults, getComponents, checkLibraryAndArchives } from '../../util.js';
|
|
6
|
+
import { showVersion, getLibraryBased, addDebugLog, getConfigDefaults, getComponents, checkLibraryAndArchives, getLibraryBasedCL } from '../../util.js';
|
|
7
7
|
|
|
8
8
|
export const showCurrentStatus = async () => {
|
|
9
9
|
|
|
10
10
|
const configDefaults = getConfigDefaults();
|
|
11
11
|
const componentList = await getComponents();
|
|
12
|
+
const isLibraryBasedCL = getLibraryBasedCL();
|
|
12
13
|
|
|
13
14
|
console.log("");
|
|
14
15
|
console.log("\tCurrent status");
|
|
@@ -16,12 +17,15 @@ export const showCurrentStatus = async () => {
|
|
|
16
17
|
console.log(`\tOrganization:\t ${chalk.bold.green(`${configDefaults.organization}`)}`);
|
|
17
18
|
console.log(`\tLibrary:\t ${chalk.bold.green(`${configDefaults.library}`)}`);
|
|
18
19
|
console.log(`\tVersion:\t ${chalk.bold.green(`${configDefaults.buildVersion}`)}`);
|
|
19
|
-
if (!
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
if (!isLibraryBasedCL) {
|
|
21
|
+
if (!configDefaults.devBuild) {
|
|
22
|
+
console.log(`\tPermanent:\t ${chalk.bold.magentaBright(`${!configDefaults.devBuild}`)}`);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
console.log(`\tPermanent:\t ${chalk.bold.green(`${!configDefaults.devBuild}`)}`);
|
|
26
|
+
}
|
|
24
27
|
}
|
|
28
|
+
|
|
25
29
|
console.log(`\tComponent count: ${chalk.bold.green(`${componentList.length}`)}`);
|
|
26
30
|
|
|
27
31
|
console.log("");
|
package/src/util.js
CHANGED
|
@@ -155,6 +155,11 @@ export const setUpDefaults = async () => {
|
|
|
155
155
|
|
|
156
156
|
if (data[LIBRARY_BASED_CL]) {
|
|
157
157
|
retrievedConfigData.isLibraryBasedCL = data[LIBRARY_BASED_CL];
|
|
158
|
+
|
|
159
|
+
// if this is true, then force librarybased to true, so it doesn't have to be set
|
|
160
|
+
if (retrievedConfigData.isLibraryBasedCL) {
|
|
161
|
+
retrievedConfigData.isLibraryBased = retrievedConfigData.isLibraryBasedCL;
|
|
162
|
+
}
|
|
158
163
|
}
|
|
159
164
|
|
|
160
165
|
|
|
@@ -470,6 +475,55 @@ if (showDebug) addDebugLog("setLibraryBased", "", "");
|
|
|
470
475
|
|
|
471
476
|
}
|
|
472
477
|
|
|
478
|
+
export const setLibraryBasedCL = async (isLibraryBasedCL) => {
|
|
479
|
+
if (showDebug) addDebugLog("setLibraryBased", "", "");
|
|
480
|
+
const currentDirectory = process.cwd();
|
|
481
|
+
const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
482
|
+
|
|
483
|
+
try {
|
|
484
|
+
// force to throw error and not console log
|
|
485
|
+
await checkPathAccess(pegaConfigJsonPath, {}, true);
|
|
486
|
+
}
|
|
487
|
+
catch (ex) {
|
|
488
|
+
// when can't find it, always be false, assume no library based.
|
|
489
|
+
// This is IMPORTANT for init (npx install)
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
|
|
494
|
+
data = JSON.parse(data);
|
|
495
|
+
|
|
496
|
+
if (data[LIBRARY_BASED_CL] != undefined) {
|
|
497
|
+
data[LIBRARY_BASED_CL] = isLibraryBasedCL;
|
|
498
|
+
|
|
499
|
+
// if not undefined, force this as well
|
|
500
|
+
if (data[LIBRARY_BASED] != undefined) {
|
|
501
|
+
data[LIBRARY_BASED] = isLibraryBasedCL;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// update file
|
|
505
|
+
// stringify "4", makes the json string look like JSON in the file, formated instead of a single line
|
|
506
|
+
try {
|
|
507
|
+
fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(data, null, 4), { encoding: 'utf8',flag:'w' });
|
|
508
|
+
}
|
|
509
|
+
catch (err) {
|
|
510
|
+
console.error(err);
|
|
511
|
+
}
|
|
512
|
+
//await forceDefaultsUpdate();
|
|
513
|
+
defaultConfigs.isLibraryBasedCL = isLibraryBasedCL;
|
|
514
|
+
|
|
515
|
+
// force libraryBased if isLibraryBasedCL is true
|
|
516
|
+
defaultConfigs.isLibraryBased = isLibraryBasedCL;
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
// reset
|
|
520
|
+
pegaData = null;
|
|
521
|
+
pegaConfig = null;
|
|
522
|
+
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
}
|
|
526
|
+
|
|
473
527
|
export const getShowDebug = () => {
|
|
474
528
|
// const currentDirectory = process.cwd();
|
|
475
529
|
// const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
|
|
@@ -856,6 +910,26 @@ export const getPegaServerConfig = async () => {
|
|
|
856
910
|
if (showDebug) addDebugLog("getPegaServerConfig", "", "+");
|
|
857
911
|
if (!pegaConfig) {
|
|
858
912
|
pegaConfig = await getPegaConfig();
|
|
913
|
+
|
|
914
|
+
if (getServerType() === "launchpad") {
|
|
915
|
+
|
|
916
|
+
// need to append isolation id for now
|
|
917
|
+
let OAuthData;
|
|
918
|
+
try {
|
|
919
|
+
OAuthData = fs.readFileSync(TOKEN_PATH, 'utf8');
|
|
920
|
+
}
|
|
921
|
+
catch (ex) {
|
|
922
|
+
return ({});
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
if (OAuthData) {
|
|
926
|
+
const oOAuthData = JSON.parse(OAuthData);
|
|
927
|
+
const isolationId = oOAuthData["isolation-ids"].write;
|
|
928
|
+
pegaConfig['server-config'].isolationId = isolationId[0];
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
}
|
|
932
|
+
|
|
859
933
|
sPegaServerConfig = JSON.stringify(pegaConfig['server-config']);
|
|
860
934
|
}
|
|
861
935
|
|
|
@@ -1390,13 +1464,18 @@ if (showDebug) addDebugLog("deleteInfinityServerComponentLibrary", `componentKey
|
|
|
1390
1464
|
|
|
1391
1465
|
try {
|
|
1392
1466
|
const respData = await response.json();
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1467
|
+
const message = respData.message;
|
|
1468
|
+
status = parseInt(respData.status);
|
|
1469
|
+
|
|
1470
|
+
if (status === 200) {
|
|
1471
|
+
console.log(
|
|
1472
|
+
chalk.bold.green(`${message}`)
|
|
1473
|
+
);
|
|
1474
|
+
}
|
|
1396
1475
|
|
|
1397
1476
|
if (status === 500) {
|
|
1398
1477
|
status = 999;
|
|
1399
|
-
throw new Error(
|
|
1478
|
+
throw new Error(message);
|
|
1400
1479
|
}
|
|
1401
1480
|
}
|
|
1402
1481
|
catch (err) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fields": {
|
|
3
|
+
"State name" : "State name",
|
|
4
|
+
"State code" : "State code",
|
|
5
|
+
"State list for": "State list for",
|
|
6
|
+
"Click to show/hide state list": "Click to show/hide state list",
|
|
7
|
+
"State list": "State list",
|
|
8
|
+
"Loading state list": "Loading state list"
|
|
9
|
+
}
|
|
10
|
+
}
|