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

Release 5.3 #1094

Merged
merged 88 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
35438e9
#940: basic concept for fixing shared DEs incl new --fixShared option
JoernBerkefeld Aug 10, 2023
82aaa6c
#940: refactoring
JoernBerkefeld Aug 10, 2023
8eaeb04
#940: fix data model for shared dataextensions postDeploy
JoernBerkefeld Aug 11, 2023
11120cb
#940: remove redundant fields
JoernBerkefeld Aug 11, 2023
32b0310
#940: allow skipping question for more BUs + ensure provided BUs are …
JoernBerkefeld Aug 11, 2023
a9ac14b
#940: fix attributeSet test
JoernBerkefeld Aug 11, 2023
55b54ed
#940: add test for delete dataExtension, delete dataExtensionField, g…
JoernBerkefeld Aug 11, 2023
52463a3
#940: add test for retrieving shared data extensions
JoernBerkefeld Aug 11, 2023
3749ac1
#940: add deploy test for shared dataExtensions with --fixShared
JoernBerkefeld Aug 11, 2023
a4bb88b
#940: improve CICD test for script
JoernBerkefeld Aug 11, 2023
938cf5d
#940: improve logs
JoernBerkefeld Aug 11, 2023
1b605fa
Bump eslint from 8.46.0 to 8.47.0
dependabot[bot] Aug 14, 2023
dea2439
#940: evaluate fix-success; refactoring
JoernBerkefeld Aug 16, 2023
13d6879
#940: allow pre-selecting ALL BUs via --fixShared=*
JoernBerkefeld Aug 16, 2023
87e6267
#940: refactoring & jsdoc
JoernBerkefeld Aug 16, 2023
d2f72ab
#940: refactoring
JoernBerkefeld Aug 16, 2023
08068a8
#940: improve skip fixShared logic and logs
JoernBerkefeld Aug 17, 2023
1076b70
#940: only run fixShared logic if fields of a shared data extension w…
JoernBerkefeld Aug 17, 2023
7947ce3
#940: check if attributeSet fields actually need fixing
JoernBerkefeld Aug 17, 2023
0630c5b
#0: fix incorrect parameter count for retrieveREST
JoernBerkefeld Aug 17, 2023
773ff99
#0: add missing attributeSet fields
JoernBerkefeld Aug 17, 2023
9e65539
#940: jsdoc
JoernBerkefeld Aug 17, 2023
e934250
#940: remove comments
JoernBerkefeld Aug 17, 2023
8cf5ae3
#940: fix test for --fixShared with added fields
JoernBerkefeld Aug 17, 2023
4727745
Merge pull request #1076 from Accenture/dependabot/npm_and_yarn/devel…
JoernBerkefeld Aug 17, 2023
550ebb4
Bump lint-staged from 13.2.3 to 14.0.0
dependabot[bot] Aug 17, 2023
c99777e
Merge pull request #1078 from Accenture/dependabot/npm_and_yarn/devel…
JoernBerkefeld Aug 17, 2023
3df6eae
Bump inquirer from 8.2.5 to 8.2.6
dependabot[bot] Aug 17, 2023
697f7cb
Merge pull request #1077 from Accenture/dependabot/npm_and_yarn/devel…
JoernBerkefeld Aug 17, 2023
82a42e2
Merge remote-tracking branch 'origin/develop' into bugfix/940-fields-…
JoernBerkefeld Aug 17, 2023
a201068
#940: make sure ALL fields on the DE are compared with the attributeS…
JoernBerkefeld Aug 17, 2023
fbb9963
#940: simplified logic by no longer checking for CHANGED fields but s…
JoernBerkefeld Aug 17, 2023
e6852dd
Merge pull request #1074 from Accenture/bugfix/940-fields-added-to-sh…
JoernBerkefeld Aug 17, 2023
f6aee7b
#325: add support to retrieve, cache & upsert dataVerification activi…
JoernBerkefeld Aug 18, 2023
141fa35
#0: fix incorrect delete logic for mobileKeyword
JoernBerkefeld Aug 19, 2023
2cbe93f
#0: fix incorrect delete-tests (array of key passed instead of single…
JoernBerkefeld Aug 19, 2023
c8ef433
#325: rename from dataVerification to verification to match name in S…
JoernBerkefeld Aug 21, 2023
470d751
Bump eslint-plugin-jsdoc from 46.4.6 to 46.5.0
dependabot[bot] Aug 21, 2023
c0cd639
Merge pull request #1085 from Accenture/dependabot/npm_and_yarn/devel…
JoernBerkefeld Aug 22, 2023
1a8fa4f
Bump lint-staged from 14.0.0 to 14.0.1
dependabot[bot] Aug 22, 2023
1490e8a
Merge pull request #1086 from Accenture/dependabot/npm_and_yarn/devel…
JoernBerkefeld Aug 22, 2023
50875e1
Bump fsevents from 2.3.2 to 2.3.3
dependabot[bot] Aug 22, 2023
0847586
Merge pull request #1087 from Accenture/dependabot/npm_and_yarn/devel…
JoernBerkefeld Aug 22, 2023
27504e1
#325: enable retrieve-all for type verification
JoernBerkefeld Aug 22, 2023
6960bc7
#325: avoid SDK's getCollection method as it seems to have some kind …
JoernBerkefeld Aug 22, 2023
a408836
#325: bundle verification retrieve logic in generic retrieveRESTcolle…
JoernBerkefeld Aug 22, 2023
55a92ee
#325: upgrade Automation class to use new retrieveRESTcollection()
JoernBerkefeld Aug 22, 2023
bf8f6f4
#0: improve logs
JoernBerkefeld Aug 22, 2023
4e62e7f
#325: revert require-key logic
JoernBerkefeld Aug 23, 2023
8975371
#1088: attributeSet cannot find shared data extension folders
JoernBerkefeld Aug 23, 2023
17a00e0
#1088: switch attributeSet test to looking into custom attributeSet
JoernBerkefeld Aug 23, 2023
f363b65
#1088: clean up field list of attributeSet
JoernBerkefeld Aug 23, 2023
9af8def
#1088: add All Contacts to attributeSet response
JoernBerkefeld Aug 23, 2023
c970fdf
#1088: remove additional fields from retrieve to increase readability
JoernBerkefeld Aug 23, 2023
f3b2fcd
Merge pull request #1089 from Accenture/bugfix/1088-attributeset-cann…
JoernBerkefeld Aug 23, 2023
bef0105
#1090: make attributeGroup and attributeSet be retrieved by default
JoernBerkefeld Aug 23, 2023
a61a4d7
Merge pull request #1091 from Accenture/feature/1090-retrieve-attribu…
JoernBerkefeld Aug 23, 2023
87dffd6
#325: added tests for type verification
JoernBerkefeld Aug 24, 2023
0d437e9
#325: fix retrieve test for automation
JoernBerkefeld Aug 24, 2023
6cee703
#325: move log msg into generic method
JoernBerkefeld Aug 24, 2023
4ea2779
#325: improve test api logs
JoernBerkefeld Aug 24, 2023
1099ed4
#325: fix caching logic for automations together with verifications
JoernBerkefeld Aug 24, 2023
733b201
#325: fix automation tests after adding type verification
JoernBerkefeld Aug 24, 2023
3e6adb4
Merge branch 'develop' into feature/325-feature-add-support-for-data-…
JoernBerkefeld Aug 24, 2023
5e0f00e
#325: consolidate / fix tests for deleteByKey across types
JoernBerkefeld Aug 25, 2023
78c0908
#847: add test for delete journey
JoernBerkefeld Aug 25, 2023
fe53e9c
#926: fix transactionalEmail create and delete logic to deal with the…
JoernBerkefeld Aug 25, 2023
7c74e14
#0: refactoring
JoernBerkefeld Aug 25, 2023
832dbee
Merge remote-tracking branch 'origin/main' into develop
JoernBerkefeld Aug 25, 2023
34a4487
#325: ensure r__dataExtension_CustomerKey is set even if related data…
JoernBerkefeld Aug 25, 2023
37237b4
#325: ensure generated verification keys get used during joint deploy…
JoernBerkefeld Aug 25, 2023
1b51cb6
Merge branch 'develop' into feature/325-feature-add-support-for-data-…
JoernBerkefeld Aug 25, 2023
7ed4f63
Merge pull request #1083 from Accenture/feature/325-feature-add-suppo…
JoernBerkefeld Aug 25, 2023
5ac58b3
#325: type verification renamed
JoernBerkefeld Aug 28, 2023
0faad87
#1088: ensure multi-BU retrieves do not interact badly with each other
JoernBerkefeld Aug 28, 2023
7551aff
#0: reduce chatter in log files
JoernBerkefeld Aug 28, 2023
4422bb6
Bump eslint from 8.47.0 to 8.48.0
dependabot[bot] Aug 28, 2023
074b156
Merge pull request #1095 from Accenture/dependabot/npm_and_yarn/devel…
JoernBerkefeld Aug 29, 2023
b2620a3
Bump chai from 4.3.7 to 4.3.8
dependabot[bot] Aug 29, 2023
da637cb
Merge pull request #1096 from Accenture/dependabot/npm_and_yarn/devel…
JoernBerkefeld Aug 29, 2023
ea43bc4
Merge remote-tracking branch 'origin/main' into develop
JoernBerkefeld Aug 29, 2023
15bcd9d
#1097: adapted tests to include fields of type Decimal and Number as …
JoernBerkefeld Aug 31, 2023
a64a66a
#1097: fixed decimal length documentation in dataExtension markdowns
JoernBerkefeld Aug 31, 2023
d7de26f
Merge pull request #1098 from Accenture/bugfix/1097-in-the-doc-md-fil…
JoernBerkefeld Aug 31, 2023
ed60e34
#0: manually applied hotfix for outdated sfmc-sdk dependency fast-xml…
JoernBerkefeld Aug 31, 2023
4f125f7
#0: semver dependency hotfix
JoernBerkefeld Aug 31, 2023
96120fe
5.3.0
JoernBerkefeld Aug 31, 2023
e4e4f47
#0: release 5.3 prep
JoernBerkefeld Aug 31, 2023
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
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ body:
label: Version
description: What version of our software are you running? (mcdev --version)
options:
- 5.3.0
- 5.2.0
- 5.1.0
- 5.0.2
Expand Down
409 changes: 400 additions & 9 deletions docs/dist/documentation.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/MetadataTypeDefinitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const MetadataTypeDefinitions = {
transactionalSMS: require('./metadataTypes/definitions/TransactionalSMS.definition'),
triggeredSend: require('./metadataTypes/definitions/TriggeredSend.definition'),
user: require('./metadataTypes/definitions/User.definition'),
verification: require('./metadataTypes/definitions/Verification.definition'),
};

module.exports = MetadataTypeDefinitions;
1 change: 1 addition & 0 deletions lib/MetadataTypeInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const MetadataTypeInfo = {
transactionalSMS: require('./metadataTypes/TransactionalSMS'),
triggeredSend: require('./metadataTypes/TriggeredSend'),
user: require('./metadataTypes/User'),
verification: require('./metadataTypes/Verification'),
};

module.exports = MetadataTypeInfo;
7 changes: 6 additions & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ yargs
},
})
.command({
command: 'deploy [BU] [TYPE] [KEY] [--fromRetrieve] [--refresh]',
command: 'deploy [BU] [TYPE] [KEY]',
aliases: ['d'],
desc: 'deploys local metadata to a business unit',
builder: (yargs) => {
Expand Down Expand Up @@ -97,6 +97,11 @@ yargs
group: 'Options for deploy:',
describe:
'optionally start existing schedule instead of running item once immediately (only works for automations)',
})
.option('fixShared', {
group: 'Options for deploy:',
describe:
"optionally ensure that updates to shared DataExtensions become visible in child BU's data designer (SF Known issue W-11031095)",
});
},
handler: (argv) => {
Expand Down
5 changes: 4 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ class Mcdev {
'commitHistory',
'execute',
'filter',
'fixShared',
'fromRetrieve',
'json',
'like',
'noLogColors',
'noLogFile',
'refresh',
'_runningTest',
'schedule',
'skipInteraction',
];
Expand Down Expand Up @@ -310,7 +312,8 @@ class Mcdev {
triggeredSend: 'triggeredSendDefinition',
user: 'accountUser',
};
Util.logger.info(`:: Retrieving ${cred}/${bu}\n`);
Util.logger.info('');
Util.logger.info(`:: Retrieving ${cred}/${bu}`);
const retrieveTypesArr = [];
if (selectedTypesArr) {
for (const selectedType of Array.isArray(selectedTypesArr)
Expand Down
129 changes: 118 additions & 11 deletions lib/metadataTypes/AttributeSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@ class AttributeSet extends MetadataType {
const result = await AttributeGroup.retrieveForCache();
cache.setMetadata('attributeGroup', result.metadata);
}
return super.retrieveREST(
retrieveDir,
'/hub/v1/contacts/schema/setDefinitions',
null,
null,
key
);
return super.retrieveREST(retrieveDir, '/hub/v1/contacts/schema/setDefinitions', null, key);
}
/**
* Retrieves Metadata of schema set definitions for caching.
Expand All @@ -47,6 +41,110 @@ class AttributeSet extends MetadataType {
static retrieveForCache() {
return super.retrieveREST(null, '/hub/v1/contacts/schema/setDefinitions');
}
/**
* used to identify updated shared data extensions that are used in attributeSets.
* helper for DataExtension.#fixShared_onBU
*
* @param {Object.<string, string>} sharedDataExtensionMap ID-Key relationship of shared data extensions
* @param {object} fixShared_fields DataExtensionField.fixShared_fields
* @returns {Promise.<string[]>} Promise of list of shared dataExtension IDs
*/
static async fixShared_retrieve(sharedDataExtensionMap, fixShared_fields) {
if (!Object.keys(sharedDataExtensionMap).length) {
return [];
}
const result = await super.retrieveREST(null, '/hub/v1/contacts/schema/setDefinitions');
const metadataMap = result?.metadata;
if (metadataMap && Object.keys(metadataMap).length) {
const sharedDeIds = Object.keys(metadataMap)
.filter(
(asKey) =>
metadataMap[asKey].storageLogicalType === 'ExactTargetSchema' ||
metadataMap[asKey].storageLogicalType === 'DataExtension'
)
.filter((asKey) => {
// check if dataExtension ID is found on any attributeSet of this BU
if (sharedDataExtensionMap[metadataMap[asKey].storageReferenceID.value]) {
Util.logger.debug(
` shared dataExtension ID ${metadataMap[asKey].storageReferenceID.value} found in attributeSet ${asKey}`
);
return true;
} else {
return false;
}
})
.filter((asKey) => {
// check if any of the dataExtension fields dont exist on the attributeSet or are out of date
const deKey =
sharedDataExtensionMap[metadataMap[asKey].storageReferenceID.value];
const asFields = metadataMap[asKey].valueDefinitions;
const deFields = Object.values(fixShared_fields[deKey]);
return deFields.some((deField) => {
const search = asFields.filter((asf) => asf.name === deField.Name);
if (!search.length) {
Util.logger.debug(
Util.getGrayMsg(
` - Field ${deField.Name} not found in attributeSet; Note: only first recognized difference is printed to log`
)
);
return true;
}
const asField = search[0];
if (asField.dataType !== deField.FieldType) {
Util.logger.debug(
Util.getGrayMsg(
` - Field ${deField.Name} FieldType changed (old: ${asField.dataType}; new: ${deField.FieldType}); Note: only first recognized difference is printed to log`
)
);
return true;
}
asField.defaultValue ||= '';
if (
(asField.defaultValue && deField.DefaultValue === '') ||
(deField.FieldType === 'Boolean' &&
deField.DefaultValue !== '' &&
(deField.DefaultValue
? 'True'
: 'False' !== asField.defaultValue)) ||
(deField.FieldType !== 'Boolean' &&
deField.DefaultValue !== asField.defaultValue)
) {
Util.logger.debug(
` - Field ${deField.Name} DefaultValue changed (old: ${asField.defaultValue}; new: ${deField.DefaultValue}); Note: only first recognized difference is printed to log`
);
return true;
}
// some field types don't carry the length property. reset to 0 to ease comparison
asField.length ||= 0;
if (asField.length !== deField.MaxLength) {
Util.logger.debug(
` - Field ${deField.Name} MaxLength changed (old: ${asField.length}; new: ${deField.MaxLength}); Note: only first recognized difference is printed to log`
);
return true;
}
if (asField.isNullable !== deField.IsRequired) {
Util.logger.debug(
` - Field ${deField.Name} IsRequired changed (old: ${asField.isNullable}; new: ${deField.IsRequired}); Note: only first recognized difference is printed to log`
);
return true;
}
if (asField.isPrimaryKey !== deField.IsPrimaryKey) {
Util.logger.debug(
` - Field ${deField.Name} IsPrimaryKey changed (old: ${asField.isPrimaryKey}; new: ${deField.IsPrimaryKey}); Note: only first recognized difference is printed to log`
);
return true;
}
return false;
});
})
.map((key) => metadataMap[key].storageReferenceID.value)
.filter(Boolean);
return sharedDeIds;
} else {
// nothing to do - return empty array
return [];
}
}

/**
* Builds map of metadata entries mapped to their keyfields
Expand Down Expand Up @@ -83,7 +181,7 @@ class AttributeSet extends MetadataType {
switch (metadata.storageLogicalType) {
case 'ExactTargetSchema': // synced / shared DEs
case 'DataExtension': {
// local DEs
// shared / local DEs
try {
metadata.r__dataExtension_CustomerKey = cache.searchForField(
'dataExtension',
Expand Down Expand Up @@ -226,6 +324,12 @@ class AttributeSet extends MetadataType {
// Member ID
delete metadata.customObjectOwnerMID;

// remove duplicate ID fields (main field is definitionID)
delete metadata.setDefinitionID;
if (metadata.dataRetentionProperties?.setDefinitionID) {
delete metadata.dataRetentionProperties?.setDefinitionID;
}

// connectingID.identifierType seems to be always set to 'FullyQualifiedName' - to be sure we check it here and remove it if it's the case
if (metadata.connectingID?.identifierType === 'FullyQualifiedName') {
// remove useless field
Expand All @@ -241,16 +345,19 @@ class AttributeSet extends MetadataType {
* @returns {object[]} all system value definitions
*/
static _getSystemValueDefinitions() {
if (!this.systemValueDefinitions) {
this.systemValueDefinitions = Object.values(cache.getCache()['attributeSet'])
this.systemValueDefinitions ||= {};
if (!this.systemValueDefinitions[this.buObject.mid]) {
this.systemValueDefinitions[this.buObject.mid] = Object.values(
cache.getCache()['attributeSet']
)
.flatMap((item) => {
if (item.isSystemDefined) {
return item.valueDefinitions;
}
})
.filter(Boolean);
}
return this.systemValueDefinitions;
return this.systemValueDefinitions[this.buObject.mid];
}
}

Expand Down
Loading