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

5.0.1 #903

Merged
merged 7 commits into from
May 9, 2023
Merged

5.0.1 #903

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
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.0.1
- 5.0.0
- 4.3.4
- 4.3.3
Expand Down
18 changes: 13 additions & 5 deletions lib/metadataTypes/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,33 +149,41 @@ class User extends MetadataType {
// convert SSO / Federation Token into API compliant format
if (metadata.SsoIdentity || metadata.SsoIdentities) {
const ssoIdentity = {};
let error = false;
if (metadata.SsoIdentity) {
// assume metadata.SsoIdentity is an object
ssoIdentity.IsActive = metadata.SsoIdentity.IsActive;
ssoIdentity.FederatedId = metadata.SsoIdentity.FederatedId;
ssoIdentity.FederatedID = metadata.SsoIdentity.FederatedID;
delete metadata.SsoIdentity;
} else if (Array.isArray(metadata.SsoIdentities)) {
// be nice and allow SsoIdentities as an alternative if its an array of objects
ssoIdentity.IsActive = metadata.SsoIdentities[0].IsActive;
ssoIdentity.FederatedId = metadata.SsoIdentities[0].FederatedId;
ssoIdentity.FederatedID = metadata.SsoIdentities[0].FederatedID;
} else if (
Array.isArray(metadata.SsoIdentities?.SsoIdentity) &&
metadata.SsoIdentities?.SsoIdentity.length
) {
// API-compliant format already provided; just use it
ssoIdentity.IsActive = metadata.SsoIdentities.SsoIdentity[0]?.IsActive;
ssoIdentity.FederatedId = metadata.SsoIdentities.SsoIdentity[0]?.FederatedId;
ssoIdentity.FederatedID = metadata.SsoIdentities.SsoIdentity[0]?.FederatedID;
} else {
error = true;
}
if (
(ssoIdentity.IsActive !== true && ssoIdentity.IsActive !== false) ||
!ssoIdentity.FederatedID ||
error
) {
throw new TypeError(
'SsoIdentity should be an object with IsActive and FederatedId properties.'
'SsoIdentity should be an object with IsActive and FederatedID properties.'
);
}
// if SsoIdentity is set, assume this was on purpose and bring it
metadata.SsoIdentities = {
SsoIdentity: [
{
IsActive: ssoIdentity.IsActive,
FederatedId: ssoIdentity.FederatedId,
FederatedID: ssoIdentity.FederatedID,
},
],
};
Expand Down
8 changes: 4 additions & 4 deletions lib/metadataTypes/definitions/User.definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,19 @@ module.exports = {
retrieving: false, // retrieve not supported by API
template: false,
},
'SsoIdentities[]': {
'SsoIdentities.SsoIdentity': {
isCreateable: true,
isUpdateable: true,
retrieving: false,
retrieving: false, // retrieve not supported by API
template: false,
},
'SsoIdentities[].IsActive': {
'SsoIdentities.SsoIdentity[].IsActive': {
isCreateable: true,
isUpdateable: true,
retrieving: false,
template: false,
},
'SsoIdentities[].FederatedID': {
'SsoIdentities.SsoIdentity[].FederatedID': {
isCreateable: true,
isUpdateable: true,
retrieving: false,
Expand Down
11 changes: 10 additions & 1 deletion lib/util/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,16 @@ function setupSDK(sessionKey, authObject) {
if (Util.OPTIONS.api === 'cli') {
console.log(`${Util.color.fgMagenta}API REQUEST >>${Util.color.reset}`, msg); // eslint-disable-line no-console
} else if (Util.OPTIONS.api === 'log') {
let data;
if (msg.data) {
data = msg.data;
delete msg.data;
}
Util.logger.debug('API REQUEST >> ' + JSON.stringify(msg, null, 2));
if (data) {
// printing it separately leads to better formatting
Util.logger.debug('API REQUEST body >> \n ' + data);
}
}
},
logResponse: (res) => {
Expand All @@ -138,7 +147,7 @@ function setupSDK(sessionKey, authObject) {
if (Util.OPTIONS.api === 'cli') {
console.log(`${Util.color.fgMagenta}API RESPONSE <<${Util.color.reset}`, msg); // eslint-disable-line no-console
} else if (Util.OPTIONS.api === 'log') {
Util.logger.debug('API RESPONSE << ' + msg);
Util.logger.debug('API RESPONSE body << \n ' + msg);
}
},
},
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mcdev",
"version": "5.0.0",
"version": "5.0.1",
"description": "Accenture Salesforce Marketing Cloud DevTools",
"author": "Accenture: joern.berkefeld, douglas.midgley, robert.zimmermann, maciej.barnas",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion test/mockRoot/.mcdevrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@
"triggeredSend"
]
},
"version": "5.0.0"
"version": "5.0.1"
}