Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug/1761 fix validation rules for deploy and ensure they work on a clone #1762

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion @types/lib/metadataTypes/Journey.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions lib/metadataTypes/DataExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,8 @@ class DataExtension extends MetadataType {
let filteredByPreDeploy = 0;
for (const metadataKey in metadataMap) {
try {
await this.validation('deploy', metadataMap[metadataKey], deployDir);
metadataMap[metadataKey] = await this.preDeployTasks(metadataMap[metadataKey]);
metadataMap[metadataKey] = await this.validation(
'deploy',
metadataMap[metadataKey],
deployDir
);
} catch (ex) {
// output error & remove from deploy list
Util.logger.error(
Expand Down
14 changes: 3 additions & 11 deletions lib/metadataTypes/MetadataType.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,16 +730,11 @@ class MetadataType {
// preDeployTasks parsing
let deployableMetadata;
try {
await this.validation('deploy', metadataMap[metadataKey], deployDir);
deployableMetadata = await this.preDeployTasks(
metadataMap[metadataKey],
deployDir
);

deployableMetadata = await this.validation(
'deploy',
deployableMetadata,
deployDir
);
} catch (ex) {
// do this in case something went wrong during pre-deploy steps to ensure the total counter is correct
hasError = true;
Expand Down Expand Up @@ -1969,11 +1964,7 @@ class MetadataType {
filterCounter++;
continue;
}
results[originalKey] = await this.validation(
'retrieve',
results[originalKey],
retrieveDir
);
await this.validation('retrieve', results[originalKey], retrieveDir);

savedResults[originalKey] = await this.saveToDisk(
results,
Expand Down Expand Up @@ -2800,6 +2791,7 @@ class MetadataType {
* @returns {Promise.<MetadataTypeItem | CodeExtractItem>} Promise of a single metadata item
*/
static async validation(method, item, targetDir) {
item = structuredClone(item);
if (!this.properties.options?.validation?.[method]) {
return item;
}
Expand Down
Loading