@pega/custom-dx-components 0.25.20 → 0.25.22
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/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/util.js +29 -4
- 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_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_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_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/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/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
|
@@ -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
|
|
package/src/util.js
CHANGED
|
@@ -910,6 +910,26 @@ export const getPegaServerConfig = async () => {
|
|
|
910
910
|
if (showDebug) addDebugLog("getPegaServerConfig", "", "+");
|
|
911
911
|
if (!pegaConfig) {
|
|
912
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
|
+
|
|
913
933
|
sPegaServerConfig = JSON.stringify(pegaConfig['server-config']);
|
|
914
934
|
}
|
|
915
935
|
|
|
@@ -1444,13 +1464,18 @@ if (showDebug) addDebugLog("deleteInfinityServerComponentLibrary", `componentKey
|
|
|
1444
1464
|
|
|
1445
1465
|
try {
|
|
1446
1466
|
const respData = await response.json();
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
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
|
+
}
|
|
1450
1475
|
|
|
1451
1476
|
if (status === 500) {
|
|
1452
1477
|
status = 999;
|
|
1453
|
-
throw new Error(
|
|
1478
|
+
throw new Error(message);
|
|
1454
1479
|
}
|
|
1455
1480
|
}
|
|
1456
1481
|
catch (err) {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {PConnect } from '@pega/pcore-pconnect-typedefs';
|
|
2
|
+
|
|
3
|
+
// PConnProps.d.ts
|
|
4
|
+
// This gives us a place to have each component (which is most DX Components) that is
|
|
5
|
+
// expected to have a getPConnect extend its props (from BaseProps)
|
|
6
|
+
// such that every component will be expected to have a getPConnect() function
|
|
7
|
+
// that returns a PConnect object. (new/better way of doing .propTypes).
|
|
8
|
+
// This PConnProps can be extended to include other props that we know are in every component
|
|
9
|
+
export interface PConnProps {
|
|
10
|
+
// getPConnect should exist for every C11n component. (add @ts-ignore in special cases where it isn't)
|
|
11
|
+
getPConnect: () => typeof PConnect;
|
|
12
|
+
|
|
13
|
+
// Allow any/all other key/value pairs in the BaseProps for now
|
|
14
|
+
// TODO: refine which other props are always expected for various component
|
|
15
|
+
// types and consider further interface "subclassing". For example, we may
|
|
16
|
+
// want to create a "BasePropsForm" that gives guidance on required, readonly, etc.
|
|
17
|
+
// and any other props that every Form component expects.
|
|
18
|
+
// For example, see the PConnFieldProps below.
|
|
19
|
+
// NOTE: if you uncomment the line below, the PConnProps type will allow
|
|
20
|
+
// otherwise undefined types to appear. This can be helpful for debugging
|
|
21
|
+
// or when adding new components whose types aren't yet known.
|
|
22
|
+
// [key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// PConnFieldProps extends PConnProps to bring in the common properties that are
|
|
27
|
+
// associated with most field components (ex: Dropdown, TextInput, etc.) in the
|
|
28
|
+
// components/field directory
|
|
29
|
+
export interface PConnFieldProps extends PConnProps {
|
|
30
|
+
label: string,
|
|
31
|
+
required: boolean,
|
|
32
|
+
disabled: boolean,
|
|
33
|
+
value: any,
|
|
34
|
+
validatemessage: string,
|
|
35
|
+
status?: string,
|
|
36
|
+
onChange?: any,
|
|
37
|
+
onBlur?: any,
|
|
38
|
+
readOnly: boolean,
|
|
39
|
+
testId: string,
|
|
40
|
+
helperText: string,
|
|
41
|
+
displayMode?: string,
|
|
42
|
+
hideLabel: boolean,
|
|
43
|
+
placeholder?: string,
|
|
44
|
+
fieldMetadata?: any,
|
|
45
|
+
additionalProps?: any
|
|
46
|
+
}
|
|
@@ -381,30 +381,6 @@ export function format(value, type, options) {
|
|
|
381
381
|
let formattedValue;
|
|
382
382
|
|
|
383
383
|
switch (type?.toLowerCase()) {
|
|
384
|
-
case 'currency': {
|
|
385
|
-
const defaultOptions = {
|
|
386
|
-
locale: getLocale(),
|
|
387
|
-
position: 'before',
|
|
388
|
-
decPlaces: 2
|
|
389
|
-
};
|
|
390
|
-
const params = { ...defaultOptions, ...options };
|
|
391
|
-
formattedValue = Currency.Currency(value, params);
|
|
392
|
-
break;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
case 'decimal': {
|
|
396
|
-
const defaultOptions = { locale: getLocale(), decPlaces: 2 };
|
|
397
|
-
const params = { ...defaultOptions, ...options };
|
|
398
|
-
formattedValue = Currency.Decimal(value, params);
|
|
399
|
-
break;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
case 'integer': {
|
|
403
|
-
const defaultOptions = { locale: getLocale() };
|
|
404
|
-
const params = { ...defaultOptions, ...options };
|
|
405
|
-
formattedValue = Currency.Integer(value, params);
|
|
406
|
-
break;
|
|
407
|
-
}
|
|
408
384
|
|
|
409
385
|
case 'date': {
|
|
410
386
|
const defaultOptions = {
|