mcdev 3.0.2 → 3.1.2
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/.eslintrc.json +1 -1
- package/.github/ISSUE_TEMPLATE/bug.yml +75 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +3 -2
- package/.issuetracker +11 -3
- package/.vscode/settings.json +3 -3
- package/CHANGELOG.md +88 -0
- package/README.md +245 -141
- package/boilerplate/config.json +3 -2
- package/docs/dist/documentation.md +818 -352
- package/lib/Deployer.js +4 -1
- package/lib/MetadataTypeDefinitions.js +1 -0
- package/lib/MetadataTypeInfo.js +1 -0
- package/lib/Retriever.js +30 -14
- package/lib/cli.js +295 -0
- package/lib/index.js +774 -1019
- package/lib/metadataTypes/AccountUser.js +389 -0
- package/lib/metadataTypes/Asset.js +8 -7
- package/lib/metadataTypes/Automation.js +121 -56
- package/lib/metadataTypes/DataExtension.js +167 -121
- package/lib/metadataTypes/DataExtensionField.js +134 -4
- package/lib/metadataTypes/DataExtract.js +9 -5
- package/lib/metadataTypes/EventDefinition.js +9 -5
- package/lib/metadataTypes/FileTransfer.js +9 -5
- package/lib/metadataTypes/Folder.js +66 -69
- package/lib/metadataTypes/ImportFile.js +13 -12
- package/lib/metadataTypes/MetadataType.js +138 -77
- package/lib/metadataTypes/Query.js +2 -3
- package/lib/metadataTypes/Role.js +13 -8
- package/lib/metadataTypes/Script.js +2 -2
- package/lib/metadataTypes/definitions/AccountUser.definition.js +227 -0
- package/lib/metadataTypes/definitions/Asset.definition.js +1 -0
- package/lib/metadataTypes/definitions/DataExtension.definition.js +1 -1
- package/lib/metadataTypes/definitions/DataExtensionField.definition.js +1 -1
- package/lib/metadataTypes/definitions/Folder.definition.js +1 -1
- package/lib/metadataTypes/definitions/ImportFile.definition.js +2 -1
- package/lib/metadataTypes/definitions/Script.definition.js +5 -5
- package/lib/retrieveChangelog.js +96 -0
- package/lib/util/cli.js +4 -6
- package/lib/util/init.git.js +2 -1
- package/lib/util/util.js +20 -3
- package/package.json +19 -23
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -30
- package/img/README.md/troubleshoot-nodejs-postinstall.jpg +0 -0
- package/postinstall.js +0 -41
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
bodyIteratorField: 'items',
|
|
3
|
-
dependencies: ['ftpLocation', 'dataExtension', 'list'],
|
|
3
|
+
dependencies: ['folder', 'ftpLocation', 'dataExtension', 'list'], // folder has to be kept in here to resolve lists correctly
|
|
4
4
|
destinationObjectTypeMapping: {
|
|
5
|
+
unknown: 783,
|
|
5
6
|
DataExtension: 310,
|
|
6
7
|
List: 13,
|
|
7
8
|
SMS: 584,
|
|
@@ -21,7 +21,7 @@ module.exports = {
|
|
|
21
21
|
createdBy: {
|
|
22
22
|
isCreateable: false,
|
|
23
23
|
isUpdateable: false,
|
|
24
|
-
retrieving:
|
|
24
|
+
retrieving: false,
|
|
25
25
|
template: false,
|
|
26
26
|
},
|
|
27
27
|
createdDate: {
|
|
@@ -51,7 +51,7 @@ module.exports = {
|
|
|
51
51
|
modifiedBy: {
|
|
52
52
|
isCreateable: false,
|
|
53
53
|
isUpdateable: false,
|
|
54
|
-
retrieving:
|
|
54
|
+
retrieving: false,
|
|
55
55
|
template: false,
|
|
56
56
|
},
|
|
57
57
|
modifiedDate: {
|
|
@@ -79,9 +79,9 @@ module.exports = {
|
|
|
79
79
|
template: false,
|
|
80
80
|
},
|
|
81
81
|
status: {
|
|
82
|
-
isCreateable:
|
|
83
|
-
isUpdateable:
|
|
84
|
-
retrieving:
|
|
82
|
+
isCreateable: false,
|
|
83
|
+
isUpdateable: false,
|
|
84
|
+
retrieving: false,
|
|
85
85
|
template: false,
|
|
86
86
|
},
|
|
87
87
|
statusId: {
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* sample file on how to retrieve a simple changelog to use in GUIs or automated processing of any kind
|
|
6
|
+
* @example
|
|
7
|
+
[{
|
|
8
|
+
name: 'deName',
|
|
9
|
+
key: 'deKey',
|
|
10
|
+
t: 'dataExtension',
|
|
11
|
+
cd: '2020-05-06T00:16:00.737',
|
|
12
|
+
cb: 'name of creator',
|
|
13
|
+
ld: '2020-05-06T00:16:00.737',
|
|
14
|
+
lb: 'name of lastmodified'
|
|
15
|
+
}]
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const mcdev = require('./index');
|
|
19
|
+
const Definition = require('./MetadataTypeDefinitions');
|
|
20
|
+
const MetadataType = require('./MetadataTypeInfo');
|
|
21
|
+
|
|
22
|
+
// disable cli logs
|
|
23
|
+
// mcdev._setLoggingLevel({ silent: true });
|
|
24
|
+
|
|
25
|
+
const customDefinition = {
|
|
26
|
+
automation: {
|
|
27
|
+
keyField: 'CustomerKey',
|
|
28
|
+
nameField: 'Name',
|
|
29
|
+
createdDateField: 'CreatedDate',
|
|
30
|
+
createdNameField: 'CreatedBy',
|
|
31
|
+
lastmodDateField: 'LastSaveDate',
|
|
32
|
+
lastmodNameField: 'LastSavedBy',
|
|
33
|
+
},
|
|
34
|
+
dataExtension: {
|
|
35
|
+
keyField: 'CustomerKey',
|
|
36
|
+
nameField: 'Name',
|
|
37
|
+
createdDateField: 'CreatedDate',
|
|
38
|
+
createdNameField: null,
|
|
39
|
+
lastmodDateField: 'ModifiedDate',
|
|
40
|
+
lastmodNameField: null,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
(async function () {
|
|
44
|
+
// get userid>name mapping
|
|
45
|
+
const userList = (await mcdev.retrieve('ACN-Learning/_ParentBU_', 'accountUser', true))
|
|
46
|
+
.accountUser;
|
|
47
|
+
// reduce userList to simple id-name map
|
|
48
|
+
Object.keys(userList).forEach((key) => {
|
|
49
|
+
userList[userList[key].ID] = userList[key].Name;
|
|
50
|
+
delete userList[key];
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// get changed metadata
|
|
54
|
+
const changelogList = await mcdev.retrieve('ACN-Learning/MCDEV_Training_Source', null, true);
|
|
55
|
+
const allMetadata = [];
|
|
56
|
+
Object.keys(changelogList).map((type) => {
|
|
57
|
+
if (changelogList[type]) {
|
|
58
|
+
const def = customDefinition[type] || Definition[type];
|
|
59
|
+
allMetadata.push(
|
|
60
|
+
...Object.keys(changelogList[type]).map((key) => {
|
|
61
|
+
const item = changelogList[type][key];
|
|
62
|
+
if (
|
|
63
|
+
MetadataType[type].isFiltered(item, true) ||
|
|
64
|
+
MetadataType[type].isFiltered(item, false)
|
|
65
|
+
) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const listEntry = {
|
|
70
|
+
name: item[def.nameField],
|
|
71
|
+
key: item[def.keyField],
|
|
72
|
+
t: type,
|
|
73
|
+
cd: item[def.createdDateField],
|
|
74
|
+
cb: getUserName(userList, item, def.createdNameField),
|
|
75
|
+
ld: item[def.lastmodDateField],
|
|
76
|
+
lb: getUserName(userList, item, def.lastmodNameField),
|
|
77
|
+
};
|
|
78
|
+
return listEntry;
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
const finalResult = allMetadata.filter((item) => undefined !== item);
|
|
84
|
+
console.log('finalResult', finalResult);
|
|
85
|
+
})();
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @param {object<string,string>} userList user-id > user-name map
|
|
90
|
+
* @param {object<string,string>} item single metadata item
|
|
91
|
+
* @param {string} fieldname name of field containing the info
|
|
92
|
+
* @returns {string} username or user id or 'n/a'
|
|
93
|
+
*/
|
|
94
|
+
function getUserName(userList, item, fieldname) {
|
|
95
|
+
return userList[item[fieldname]] || item[fieldname] || 'n/a';
|
|
96
|
+
}
|
package/lib/util/cli.js
CHANGED
|
@@ -427,9 +427,8 @@ const Cli = {
|
|
|
427
427
|
subtype,
|
|
428
428
|
type: MetadataDefinitions[el].type + '-' + subtype,
|
|
429
429
|
mainType: MetadataDefinitions[el].type,
|
|
430
|
-
typeRetrieveByDefault:
|
|
431
|
-
el
|
|
432
|
-
].typeRetrieveByDefault.includes(subtype),
|
|
430
|
+
typeRetrieveByDefault:
|
|
431
|
+
MetadataDefinitions[el].typeRetrieveByDefault.includes(subtype),
|
|
433
432
|
});
|
|
434
433
|
}
|
|
435
434
|
}
|
|
@@ -560,9 +559,8 @@ const Cli = {
|
|
|
560
559
|
let lastCountdown = MetadataDefinitions[el].subTypes.length;
|
|
561
560
|
for (const subtype of MetadataDefinitions[el].subTypes) {
|
|
562
561
|
lastCountdown--;
|
|
563
|
-
const subTypeRetrieveByDefault =
|
|
564
|
-
el
|
|
565
|
-
].typeRetrieveByDefault.includes(subtype);
|
|
562
|
+
const subTypeRetrieveByDefault =
|
|
563
|
+
MetadataDefinitions[el].typeRetrieveByDefault.includes(subtype);
|
|
566
564
|
const definition =
|
|
567
565
|
' ' + MetadataDefinitions[el].extendedSubTypes[subtype].join(', ');
|
|
568
566
|
typeChoices.push({
|
package/lib/util/init.git.js
CHANGED
|
@@ -229,7 +229,8 @@ const Init = {
|
|
|
229
229
|
// eslint-disable-next-line require-jsdoc
|
|
230
230
|
validate: function (value) {
|
|
231
231
|
value = value.trim();
|
|
232
|
-
const regex =
|
|
232
|
+
const regex =
|
|
233
|
+
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
233
234
|
if (!value || !regex.test(String(value).toLowerCase())) {
|
|
234
235
|
return 'Please enter valid email';
|
|
235
236
|
}
|
package/lib/util/util.js
CHANGED
|
@@ -110,6 +110,23 @@ const Util = {
|
|
|
110
110
|
'workflows_read',
|
|
111
111
|
'workflows_write',
|
|
112
112
|
],
|
|
113
|
+
/**
|
|
114
|
+
* SFMC accepts multiple true values for Boolean attributes for which we are checking here
|
|
115
|
+
* @param {*} attrValue value
|
|
116
|
+
* @returns {boolean} attribute value == true ? true : false
|
|
117
|
+
*/
|
|
118
|
+
isTrue(attrValue) {
|
|
119
|
+
return ['true', 'TRUE', 'True', '1', 1, 'Y'].includes(attrValue);
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* SFMC accepts multiple false values for Boolean attributes for which we are checking here
|
|
123
|
+
* @param {*} attrValue value
|
|
124
|
+
* @returns {boolean} attribute value == false ? true : false
|
|
125
|
+
*/
|
|
126
|
+
isFalse(attrValue) {
|
|
127
|
+
return ['false', 'FALSE', 'False', '0', 0, 'N'].includes(attrValue);
|
|
128
|
+
},
|
|
129
|
+
|
|
113
130
|
/**
|
|
114
131
|
* defines how the properties.json should look like
|
|
115
132
|
* used for creating a template and for checking if variables are set
|
|
@@ -581,7 +598,7 @@ const Util = {
|
|
|
581
598
|
}
|
|
582
599
|
}
|
|
583
600
|
throw new Error(
|
|
584
|
-
`Missing one or more dependent metadata. ${metadataType} with ${searchField}='${searchValue}' was not found
|
|
601
|
+
`Missing one or more dependent metadata. ${metadataType} with ${searchField}='${searchValue}' was not found on your BU`
|
|
585
602
|
);
|
|
586
603
|
},
|
|
587
604
|
/**
|
|
@@ -627,7 +644,7 @@ const Util = {
|
|
|
627
644
|
}
|
|
628
645
|
}
|
|
629
646
|
throw new Error(
|
|
630
|
-
`Missing one or more dependent metadata. list with ListName='${listName}' and r__folder_Path='${folderPath}' was not found
|
|
647
|
+
`Missing one or more dependent metadata. list with ListName='${listName}' and r__folder_Path='${folderPath}' was not found on your BU`
|
|
631
648
|
);
|
|
632
649
|
},
|
|
633
650
|
|
|
@@ -663,7 +680,7 @@ const Util = {
|
|
|
663
680
|
}
|
|
664
681
|
}
|
|
665
682
|
throw new Error(
|
|
666
|
-
`Missing one or more dependent metadata. list with ${searchField}='${searchValue}' was not found
|
|
683
|
+
`Missing one or more dependent metadata. list with ${searchField}='${searchValue}' was not found on your BU`
|
|
667
684
|
);
|
|
668
685
|
},
|
|
669
686
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcdev",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Accenture Salesforce Marketing Cloud DevTools",
|
|
5
5
|
"author": "joern.berkefeld, douglas.midgley, robert.zimmermann, maciej.barnas",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"main": "./lib/index.js",
|
|
21
21
|
"bin": {
|
|
22
|
-
"mcdev": "./lib/
|
|
22
|
+
"mcdev": "./lib/cli.js"
|
|
23
23
|
},
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=14.16"
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
"scripts": {
|
|
28
28
|
"start": "node lib/index.js",
|
|
29
29
|
"mcdev": "node lib/index.js",
|
|
30
|
-
"postinstall": "node postinstall.js",
|
|
31
30
|
"build": "run-s lint docs",
|
|
32
31
|
"debug": "node --nolazy --inspect-brk=9229 lib/index.js",
|
|
33
32
|
"docs": "jsdoc2md --files lib/**/*.js > docs/dist/documentation.md",
|
|
@@ -38,34 +37,34 @@
|
|
|
38
37
|
},
|
|
39
38
|
"dependencies": {
|
|
40
39
|
"bluebird": "3.7.2",
|
|
41
|
-
"cli-progress": "3.
|
|
40
|
+
"cli-progress": "3.10.0",
|
|
42
41
|
"command-exists": "1.2.9",
|
|
43
42
|
"console.table": "0.10.0",
|
|
44
|
-
"fs-extra": "
|
|
45
|
-
"inquirer": "8.
|
|
43
|
+
"fs-extra": "10.0.0",
|
|
44
|
+
"inquirer": "8.2.0",
|
|
46
45
|
"json-to-table": "4.2.1",
|
|
47
|
-
"mustache": "4.
|
|
48
|
-
"prettier": "2.
|
|
49
|
-
"semver": "
|
|
46
|
+
"mustache": "4.2.0",
|
|
47
|
+
"prettier": "2.5.1",
|
|
48
|
+
"semver": "7.3.5",
|
|
50
49
|
"sfmc-fuelsdk-node": "2.4.0",
|
|
51
|
-
"simple-git": "2.
|
|
50
|
+
"simple-git": "2.48.0",
|
|
52
51
|
"sql-formatter-plus": "1.3.6",
|
|
53
52
|
"toposort": "2.0.2",
|
|
54
53
|
"update-notifier-git": "5.0.3",
|
|
55
|
-
"winston": "3.3.
|
|
56
|
-
"yargs": "
|
|
54
|
+
"winston": "3.3.4",
|
|
55
|
+
"yargs": "17.3.0"
|
|
57
56
|
},
|
|
58
57
|
"devDependencies": {
|
|
59
58
|
"chai": "4.3.4",
|
|
60
|
-
"eslint": "
|
|
61
|
-
"eslint-config-prettier": "8.
|
|
59
|
+
"eslint": "8.4.1",
|
|
60
|
+
"eslint-config-prettier": "8.3.0",
|
|
62
61
|
"eslint-config-ssjs": "1.1.11",
|
|
63
|
-
"eslint-plugin-mocha": "
|
|
64
|
-
"eslint-plugin-prettier": "
|
|
65
|
-
"husky": "
|
|
66
|
-
"jsdoc-to-markdown": "7.
|
|
67
|
-
"lint-staged": "
|
|
68
|
-
"mocha": "
|
|
62
|
+
"eslint-plugin-mocha": "10.0.1",
|
|
63
|
+
"eslint-plugin-prettier": "4.0.0",
|
|
64
|
+
"husky": "7.0.4",
|
|
65
|
+
"jsdoc-to-markdown": "7.1.0",
|
|
66
|
+
"lint-staged": "12.1.2",
|
|
67
|
+
"mocha": "9.1.3",
|
|
69
68
|
"npm-check": "5.9.2",
|
|
70
69
|
"npm-run-all": "4.1.5"
|
|
71
70
|
},
|
|
@@ -73,9 +72,6 @@
|
|
|
73
72
|
"*.{js,jsx,ts,tsx}": [
|
|
74
73
|
"eslint --fix",
|
|
75
74
|
"prettier --write"
|
|
76
|
-
],
|
|
77
|
-
"*.{md}": [
|
|
78
|
-
"prettier --write"
|
|
79
75
|
]
|
|
80
76
|
}
|
|
81
77
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Bug report
|
|
3
|
-
about: Create a report to help us improve
|
|
4
|
-
title: "[BUG] "
|
|
5
|
-
labels: NEW, bug
|
|
6
|
-
assignees: ''
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
**Describe the bug**
|
|
11
|
-
A clear and concise description of what the bug is.
|
|
12
|
-
|
|
13
|
-
**To Reproduce**
|
|
14
|
-
Steps to reproduce the behavior:
|
|
15
|
-
1. Go to '...'
|
|
16
|
-
2. Click on '....'
|
|
17
|
-
3. Scroll down to '....'
|
|
18
|
-
4. See error
|
|
19
|
-
|
|
20
|
-
**Expected behavior**
|
|
21
|
-
A clear and concise description of what you expected to happen.
|
|
22
|
-
|
|
23
|
-
**Screenshots**
|
|
24
|
-
If applicable, add screenshots to help explain your problem.
|
|
25
|
-
|
|
26
|
-
**Versions:**
|
|
27
|
-
- mcdev (mcdev --version):
|
|
28
|
-
- npm (npm --version):
|
|
29
|
-
- node (node --version):
|
|
30
|
-
- Operating system (Windows/Mac):
|
|
Binary file
|
package/postinstall.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
const greenOnBlack = '\x1b[32m\x1b[40m';
|
|
4
|
-
const highlight = '\x1b[7m';
|
|
5
|
-
const reset = '\x1b[0m';
|
|
6
|
-
console.log(greenOnBlack); // green on black
|
|
7
|
-
console.log('Congratulations: You installed Accenture Salesforce Marketing Cloud DevTools!');
|
|
8
|
-
console.log(
|
|
9
|
-
`If you have existing Accenture SFMC DevTools projects please run ${highlight}mcdev upgrade${reset}${greenOnBlack} in each of your project directories.`
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
console.log(reset); // reset cli colors
|
|
13
|
-
|
|
14
|
-
/*
|
|
15
|
-
Color reference
|
|
16
|
-
Reset = "\x1b[0m"
|
|
17
|
-
Bright = "\x1b[1m"
|
|
18
|
-
Dim = "\x1b[2m"
|
|
19
|
-
Underscore = "\x1b[4m"
|
|
20
|
-
Blink = "\x1b[5m"
|
|
21
|
-
Reverse = "\x1b[7m"
|
|
22
|
-
Hidden = "\x1b[8m"
|
|
23
|
-
|
|
24
|
-
FgBlack = "\x1b[30m"
|
|
25
|
-
FgRed = "\x1b[31m"
|
|
26
|
-
FgGreen = "\x1b[32m"
|
|
27
|
-
FgYellow = "\x1b[33m"
|
|
28
|
-
FgBlue = "\x1b[34m"
|
|
29
|
-
FgMagenta = "\x1b[35m"
|
|
30
|
-
FgCyan = "\x1b[36m"
|
|
31
|
-
FgWhite = "\x1b[37m"
|
|
32
|
-
|
|
33
|
-
BgBlack = "\x1b[40m"
|
|
34
|
-
BgRed = "\x1b[41m"
|
|
35
|
-
BgGreen = "\x1b[42m"
|
|
36
|
-
BgYellow = "\x1b[43m"
|
|
37
|
-
BgBlue = "\x1b[44m"
|
|
38
|
-
BgMagenta = "\x1b[45m"
|
|
39
|
-
BgCyan = "\x1b[46m"
|
|
40
|
-
BgWhite = "\x1b[47m"
|
|
41
|
-
*/
|