From a8ca3d23aadcb0caa8e5d6dffbd24f7460bf085b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Sat, 9 Nov 2024 11:26:29 +0100 Subject: [PATCH 1/2] #1851: add option deploy --ignoreFolders --- lib/cli.js | 7 +++++++ lib/index.js | 1 + lib/metadataTypes/DataExtension.js | 19 +++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/lib/cli.js b/lib/cli.js index 9d87a0b22..29ab2f853 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -193,6 +193,13 @@ yargs(hideBin(process.argv)) group: 'Options for deploy:', describe: 'allows overwriting options.formatOnSave from the config file. Disable formatting via --no-format', + }) + .option('ignoreFolder', { + type: 'boolean', + alias: 'if', + group: 'Options for deploy:', + describe: + 'works with --matchName and allows skipping folder match if there is only 1 name match', }), (argv) => { diff --git a/lib/index.js b/lib/index.js index f5bbb30c4..b35385e02 100644 --- a/lib/index.js +++ b/lib/index.js @@ -96,6 +96,7 @@ class Mcdev { 'fixShared', 'format', 'fromRetrieve', + 'ignoreFolder', 'json', 'keySuffix', 'like', diff --git a/lib/metadataTypes/DataExtension.js b/lib/metadataTypes/DataExtension.js index dcb14e0ac..040503a5d 100644 --- a/lib/metadataTypes/DataExtension.js +++ b/lib/metadataTypes/DataExtension.js @@ -1666,6 +1666,25 @@ class DataExtension extends MetadataType { ` - found ${this.definition.type} ${metadataItem[this.definition.keyField]} in cache by name "${metadataItem[this.definition.nameField]}" and folder "${deployFolderPath}": ${cacheMatchedByName[this.definition.keyField]}` ) ); + } else if ( + Util.OPTIONS.ignoreFolder && + potentials[0][this.definition.folderIdField] !== + metadataItem[this.definition.folderIdField] + ) { + cacheMatchedByName = potentials[0]; + + const cacheFolderPath = cache.searchForField( + 'folder', + potentials[0][this.definition.folderIdField], + 'ID', + 'Path' + ); + + Util.logger.info( + Util.getGrayMsg( + ` - found ${this.definition.type} ${metadataItem[this.definition.keyField]} in cache by name "${metadataItem[this.definition.nameField]}" and but folder is different (--ignoreFolder). New folder: "${deployFolderPath}". Old: "${cacheFolderPath}"` + ) + ); } else { const cacheFolderPath = cache.searchForField( 'folder', From 541952b64bf302b7a463162494d844f3000ed606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Sat, 9 Nov 2024 11:28:58 +0100 Subject: [PATCH 2/2] #0: hotfixes for dataExtension an senderProfile --- lib/metadataTypes/DataExtension.js | 15 ++++++++------- lib/metadataTypes/SenderProfile.js | 10 ---------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/lib/metadataTypes/DataExtension.js b/lib/metadataTypes/DataExtension.js index 040503a5d..ebbd581f9 100644 --- a/lib/metadataTypes/DataExtension.js +++ b/lib/metadataTypes/DataExtension.js @@ -55,6 +55,14 @@ class DataExtension extends MetadataType { try { await this.validation('deploy', metadataMap[metadataKey], deployDir); metadataMap[metadataKey] = await this.preDeployTasks(metadataMap[metadataKey]); + + await this.createOrUpdate( + metadataMap, + metadataKey, + false, + metadataToUpdate, + metadataToCreate + ); } catch (ex) { // output error & remove from deploy list Util.logger.error( @@ -67,13 +75,6 @@ class DataExtension extends MetadataType { filteredByPreDeploy++; continue; } - await this.createOrUpdate( - metadataMap, - metadataKey, - false, - metadataToUpdate, - metadataToCreate - ); } if (metadataToUpdate.length) { Util.logger.info( diff --git a/lib/metadataTypes/SenderProfile.js b/lib/metadataTypes/SenderProfile.js index 0450e03eb..6b9a49b4b 100644 --- a/lib/metadataTypes/SenderProfile.js +++ b/lib/metadataTypes/SenderProfile.js @@ -143,16 +143,6 @@ class SenderProfile extends MetadataType { }): AutoForwardToEmailAddress and AutoForwardToName will be ignored because UseDefaultRMMRules is set to true; setting UseDefaultRMMRules to false` ); metadata.UseDefaultRMMRules = false; - } else if ( - !metadata.UseDefaultRMMRules && - (metadata.AutoForwardToEmailAddress === '' || metadata.AutoForwardToName === '') - ) { - Util.logger.warn( - ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ - metadata[this.definition.keyField] - }): AutoForwardToEmailAddress and AutoForwardToName are required when UseDefaultRMMRules is set to false; setting UseDefaultRMMRules to true` - ); - metadata.UseDefaultRMMRules = true; } if (!Util.OPTIONS.matchName) { // #4 make sure the name is unique