mcdev 5.0.0 → 5.0.1
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/README.md
CHANGED
|
@@ -47,7 +47,7 @@ Find info on the latest releases with a detailed changelog in the [GitHub Releas
|
|
|
47
47
|
|
|
48
48
|
If you want to enhance Accenture SFMC DevTools you are welcome to fork the repo and create a pull request. Please understand that we will have to conduct a code review before accepting your changes.
|
|
49
49
|
|
|
50
|
-
More details on how to best do that are described in our [wiki](https://github.com/Accenture/sfmc-devtools/wiki/
|
|
50
|
+
More details on how to best do that are described in our [wiki](https://github.com/Accenture/sfmc-devtools/wiki/10.-Contribute).
|
|
51
51
|
|
|
52
52
|
## Main Contacts
|
|
53
53
|
|
|
@@ -149,25 +149,33 @@ class User extends MetadataType {
|
|
|
149
149
|
// convert SSO / Federation Token into API compliant format
|
|
150
150
|
if (metadata.SsoIdentity || metadata.SsoIdentities) {
|
|
151
151
|
const ssoIdentity = {};
|
|
152
|
+
let error = false;
|
|
152
153
|
if (metadata.SsoIdentity) {
|
|
153
154
|
// assume metadata.SsoIdentity is an object
|
|
154
155
|
ssoIdentity.IsActive = metadata.SsoIdentity.IsActive;
|
|
155
|
-
ssoIdentity.
|
|
156
|
+
ssoIdentity.FederatedID = metadata.SsoIdentity.FederatedID;
|
|
156
157
|
delete metadata.SsoIdentity;
|
|
157
158
|
} else if (Array.isArray(metadata.SsoIdentities)) {
|
|
158
159
|
// be nice and allow SsoIdentities as an alternative if its an array of objects
|
|
159
160
|
ssoIdentity.IsActive = metadata.SsoIdentities[0].IsActive;
|
|
160
|
-
ssoIdentity.
|
|
161
|
+
ssoIdentity.FederatedID = metadata.SsoIdentities[0].FederatedID;
|
|
161
162
|
} else if (
|
|
162
163
|
Array.isArray(metadata.SsoIdentities?.SsoIdentity) &&
|
|
163
164
|
metadata.SsoIdentities?.SsoIdentity.length
|
|
164
165
|
) {
|
|
165
166
|
// API-compliant format already provided; just use it
|
|
166
167
|
ssoIdentity.IsActive = metadata.SsoIdentities.SsoIdentity[0]?.IsActive;
|
|
167
|
-
ssoIdentity.
|
|
168
|
+
ssoIdentity.FederatedID = metadata.SsoIdentities.SsoIdentity[0]?.FederatedID;
|
|
168
169
|
} else {
|
|
170
|
+
error = true;
|
|
171
|
+
}
|
|
172
|
+
if (
|
|
173
|
+
(ssoIdentity.IsActive !== true && ssoIdentity.IsActive !== false) ||
|
|
174
|
+
!ssoIdentity.FederatedID ||
|
|
175
|
+
error
|
|
176
|
+
) {
|
|
169
177
|
throw new TypeError(
|
|
170
|
-
'SsoIdentity should be an object with IsActive and
|
|
178
|
+
'SsoIdentity should be an object with IsActive and FederatedID properties.'
|
|
171
179
|
);
|
|
172
180
|
}
|
|
173
181
|
// if SsoIdentity is set, assume this was on purpose and bring it
|
|
@@ -175,7 +183,7 @@ class User extends MetadataType {
|
|
|
175
183
|
SsoIdentity: [
|
|
176
184
|
{
|
|
177
185
|
IsActive: ssoIdentity.IsActive,
|
|
178
|
-
|
|
186
|
+
FederatedID: ssoIdentity.FederatedID,
|
|
179
187
|
},
|
|
180
188
|
],
|
|
181
189
|
};
|
|
@@ -196,19 +196,19 @@ module.exports = {
|
|
|
196
196
|
retrieving: false, // retrieve not supported by API
|
|
197
197
|
template: false,
|
|
198
198
|
},
|
|
199
|
-
'SsoIdentities
|
|
199
|
+
'SsoIdentities.SsoIdentity': {
|
|
200
200
|
isCreateable: true,
|
|
201
201
|
isUpdateable: true,
|
|
202
|
-
retrieving: false,
|
|
202
|
+
retrieving: false, // retrieve not supported by API
|
|
203
203
|
template: false,
|
|
204
204
|
},
|
|
205
|
-
'SsoIdentities[].IsActive': {
|
|
205
|
+
'SsoIdentities.SsoIdentity[].IsActive': {
|
|
206
206
|
isCreateable: true,
|
|
207
207
|
isUpdateable: true,
|
|
208
208
|
retrieving: false,
|
|
209
209
|
template: false,
|
|
210
210
|
},
|
|
211
|
-
'SsoIdentities[].FederatedID': {
|
|
211
|
+
'SsoIdentities.SsoIdentity[].FederatedID': {
|
|
212
212
|
isCreateable: true,
|
|
213
213
|
isUpdateable: true,
|
|
214
214
|
retrieving: false,
|
package/lib/util/auth.js
CHANGED
|
@@ -129,7 +129,16 @@ function setupSDK(sessionKey, authObject) {
|
|
|
129
129
|
if (Util.OPTIONS.api === 'cli') {
|
|
130
130
|
console.log(`${Util.color.fgMagenta}API REQUEST >>${Util.color.reset}`, msg); // eslint-disable-line no-console
|
|
131
131
|
} else if (Util.OPTIONS.api === 'log') {
|
|
132
|
+
let data;
|
|
133
|
+
if (msg.data) {
|
|
134
|
+
data = msg.data;
|
|
135
|
+
delete msg.data;
|
|
136
|
+
}
|
|
132
137
|
Util.logger.debug('API REQUEST >> ' + JSON.stringify(msg, null, 2));
|
|
138
|
+
if (data) {
|
|
139
|
+
// printing it separately leads to better formatting
|
|
140
|
+
Util.logger.debug('API REQUEST body >> \n ' + data);
|
|
141
|
+
}
|
|
133
142
|
}
|
|
134
143
|
},
|
|
135
144
|
logResponse: (res) => {
|
|
@@ -138,7 +147,7 @@ function setupSDK(sessionKey, authObject) {
|
|
|
138
147
|
if (Util.OPTIONS.api === 'cli') {
|
|
139
148
|
console.log(`${Util.color.fgMagenta}API RESPONSE <<${Util.color.reset}`, msg); // eslint-disable-line no-console
|
|
140
149
|
} else if (Util.OPTIONS.api === 'log') {
|
|
141
|
-
Util.logger.debug('API RESPONSE << ' + msg);
|
|
150
|
+
Util.logger.debug('API RESPONSE body << \n ' + msg);
|
|
142
151
|
}
|
|
143
152
|
},
|
|
144
153
|
},
|
package/package.json
CHANGED