mcdev 6.0.0 → 6.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.
@@ -39,6 +39,7 @@ body:
39
39
  label: Version
40
40
  description: What version of our software are you running? (mcdev --version)
41
41
  options:
42
+ - 6.0.1
42
43
  - 6.0.0
43
44
  - 5.3.0
44
45
  - 5.2.0
@@ -22,7 +22,7 @@ jobs:
22
22
  - name: Checkout repository
23
23
  uses: actions/checkout@v4
24
24
 
25
- - uses: actions/setup-node@v3
25
+ - uses: actions/setup-node@v4
26
26
  with:
27
27
  node-version: 16
28
28
  registry-url: https://registry.npmjs.org/
@@ -24,7 +24,7 @@ jobs:
24
24
  git fetch origin ${{ github.event.pull_request.base.ref }} --depth=1000
25
25
 
26
26
  - name: Download artifact for base branch
27
- uses: dawidd6/action-download-artifact@v2
27
+ uses: dawidd6/action-download-artifact@v3
28
28
  continue-on-error: true
29
29
  with:
30
30
  workflow: ${{ github.event.pull_request.base.ref == 'main' && 'coverage-main-branch.yml' || github.event.pull_request.base.ref == 'develop' && 'coverage-develop-branch.yml' || 'coverage.yml' }}
@@ -35,7 +35,7 @@ jobs:
35
35
  search_artifacts: true
36
36
 
37
37
  - name: Download artifact for to be merged branch
38
- uses: dawidd6/action-download-artifact@v2
38
+ uses: dawidd6/action-download-artifact@v3
39
39
  continue-on-error: true
40
40
  with:
41
41
  workflow: 'coverage.yml'
@@ -20,7 +20,7 @@ jobs:
20
20
  ref: ${{ github.event.ref }}
21
21
  fetch-depth: 1000
22
22
 
23
- - uses: actions/setup-node@v3
23
+ - uses: actions/setup-node@v4
24
24
  with:
25
25
  node-version: 16
26
26
 
@@ -20,7 +20,7 @@ jobs:
20
20
  ref: ${{ github.event.ref }}
21
21
  fetch-depth: 1000
22
22
 
23
- - uses: actions/setup-node@v3
23
+ - uses: actions/setup-node@v4
24
24
  with:
25
25
  node-version: 16
26
26
 
@@ -17,7 +17,7 @@ jobs:
17
17
  ref: ${{ github.event.pull_request.head.sha }}
18
18
  fetch-depth: 1000
19
19
 
20
- - uses: actions/setup-node@v3
20
+ - uses: actions/setup-node@v4
21
21
  with:
22
22
  node-version: 16
23
23
 
@@ -56,7 +56,7 @@ jobs:
56
56
  GITHUB_TOKEN: ${{ github.token }}
57
57
 
58
58
  - name: Download artifact for base branch if available, previous
59
- uses: dawidd6/action-download-artifact@v2
59
+ uses: dawidd6/action-download-artifact@v3
60
60
  continue-on-error: true
61
61
  with:
62
62
  workflow: ${{ github.event.pull_request.base.ref == 'main' && 'coverage-main-branch.yml' || github.event.pull_request.base.ref == 'develop' && 'coverage-develop-branch.yml' || 'coverage.yml' }}
@@ -12,7 +12,7 @@ jobs:
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
14
  - uses: actions/checkout@v4
15
- - uses: actions/setup-node@v3
15
+ - uses: actions/setup-node@v4
16
16
  with:
17
17
  node-version: 16
18
18
  - run: npm ci
@@ -23,7 +23,7 @@ jobs:
23
23
  runs-on: ubuntu-latest
24
24
  steps:
25
25
  - uses: actions/checkout@v4
26
- - uses: actions/setup-node@v3
26
+ - uses: actions/setup-node@v4
27
27
  with:
28
28
  node-version: 16
29
29
  registry-url: https://registry.npmjs.org/
package/lib/cli.js CHANGED
@@ -617,13 +617,13 @@ function csvToArray(csv) {
617
617
  return !csv
618
618
  ? null
619
619
  : csv.includes(',')
620
- ? csv
621
- .split(',')
622
- .map((item) =>
623
- // allow whitespace in comma-separated lists
624
- item.trim()
625
- )
626
- // make sure trailing commas are ignored
627
- .filter(Boolean)
628
- : [csv.trim()].filter(Boolean);
620
+ ? csv
621
+ .split(',')
622
+ .map((item) =>
623
+ // allow whitespace in comma-separated lists
624
+ item.trim()
625
+ )
626
+ // make sure trailing commas are ignored
627
+ .filter(Boolean)
628
+ : [csv.trim()].filter(Boolean);
629
629
  }
@@ -945,8 +945,8 @@ class Automation extends MetadataType {
945
945
  item.type = scheduleHelper
946
946
  ? 'scheduled'
947
947
  : item.fileTrigger
948
- ? 'triggered'
949
- : undefined;
948
+ ? 'triggered'
949
+ : undefined;
950
950
 
951
951
  // el.schedule.timezoneName
952
952
  if (item.type === 'scheduled') {
@@ -1203,10 +1203,10 @@ class Automation extends MetadataType {
1203
1203
  const patternType = recurHelper['BYMONTH']
1204
1204
  ? 'ByMonth'
1205
1205
  : recurHelper['BYWEEK']
1206
- ? 'ByWeek'
1207
- : recurHelper['BYDAY']
1208
- ? 'ByDay'
1209
- : 'Interval';
1206
+ ? 'ByWeek'
1207
+ : recurHelper['BYDAY']
1208
+ ? 'ByDay'
1209
+ : 'Interval';
1210
1210
  schedule.Recurrence[keyStem + 'lyRecurrencePatternType'] = patternType;
1211
1211
  schedule.Recurrence['@_xsi:type'] = keyStem + 'lyRecurrence';
1212
1212
  schedule.RecurrenceType = keyStem + 'ly';
@@ -1387,8 +1387,8 @@ class Automation extends MetadataType {
1387
1387
  ical.COUNT
1388
1388
  ? ` for ${ical.COUNT} times`
1389
1389
  : ical.UNTIL
1390
- ? ' until end date'
1391
- : ''
1390
+ ? ' until end date'
1391
+ : ''
1392
1392
  }`;
1393
1393
  output += '\n';
1394
1394
  } else if (json.schedule) {
@@ -81,10 +81,10 @@ const Init = {
81
81
  versionsDefault[name] = Object.keys(Util.packageJsonMcdev.dependencies).includes(name)
82
82
  ? Util.packageJsonMcdev.dependencies[name]
83
83
  : // then check mcdev.devDependencies
84
- Object.keys(Util.packageJsonMcdev.devDependencies).includes(name)
85
- ? Util.packageJsonMcdev.devDependencies[name]
86
- : // fallback to using latest version if not found
87
- 'latest';
84
+ Object.keys(Util.packageJsonMcdev.devDependencies).includes(name)
85
+ ? Util.packageJsonMcdev.devDependencies[name]
86
+ : // fallback to using latest version if not found
87
+ 'latest';
88
88
  }
89
89
 
90
90
  const versionsProject = {};
package/lib/util/util.js CHANGED
@@ -805,9 +805,9 @@ export const Util = {
805
805
  // \s* whitespace characters, zero or more times
806
806
  // [^>]*? any character that is not a >, zero or more times, un-greedily
807
807
  // (.*) capture any character, zero or more times
808
- // /ms multiline and dotall flags
808
+ // /s dotall flag
809
809
  // ideally the code looks like <script runat="server">...</script>
810
- const scriptRegex = /^<\s*script [^>]*?>(.*)<\/\s*script\s*>$/ms;
810
+ const scriptRegex = /^<\s*script [^>]*?>(.*)<\/\s*script\s*>$/s;
811
811
  code = code.trim();
812
812
  const regexMatches = scriptRegex.exec(code);
813
813
  if (regexMatches?.length > 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcdev",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "Accenture Salesforce Marketing Cloud DevTools",
5
5
  "author": "Accenture: joern.berkefeld, douglas.midgley, robert.zimmermann, maciej.barnas",
6
6
  "license": "MIT",
@@ -74,14 +74,14 @@
74
74
  "json-to-table": "4.2.1",
75
75
  "mustache": "4.2.0",
76
76
  "p-limit": "4.0.0",
77
- "prettier": "3.0.3",
77
+ "prettier": "3.1.1",
78
78
  "prettier-plugin-sql": "0.15.1",
79
79
  "semver": "7.5.4",
80
80
  "sfmc-sdk": "2.0.1",
81
- "simple-git": "3.20.0",
81
+ "simple-git": "3.22.0",
82
82
  "toposort": "2.0.2",
83
83
  "update-notifier": "6.0.2",
84
- "winston": "3.10.0",
84
+ "winston": "3.11.0",
85
85
  "yargs": "17.7.2"
86
86
  },
87
87
  "devDependencies": {
@@ -90,21 +90,21 @@
90
90
  "c8": "8.0.1",
91
91
  "chai": "4.3.10",
92
92
  "chai-files": "1.4.0",
93
- "eslint": "8.50.0",
93
+ "eslint": "8.56.0",
94
94
  "eslint-config-prettier": "9.0.0",
95
95
  "eslint-config-ssjs": "1.1.11",
96
- "eslint-plugin-jsdoc": "46.8.2",
96
+ "eslint-plugin-jsdoc": "48.0.2",
97
97
  "eslint-plugin-mocha": "10.2.0",
98
- "eslint-plugin-prettier": "5.0.0",
99
- "eslint-plugin-unicorn": "48.0.0",
98
+ "eslint-plugin-prettier": "5.1.2",
99
+ "eslint-plugin-unicorn": "50.0.1",
100
100
  "fast-xml-parser": "4.3.2",
101
101
  "husky": "8.0.3",
102
102
  "jsdoc-to-markdown": "8.0.0",
103
- "lint-staged": "14.0.1",
103
+ "lint-staged": "15.2.0",
104
104
  "mocha": "10.2.0",
105
105
  "mock-fs": "5.2.0",
106
106
  "npm-run-all": "4.1.5",
107
- "prettier-eslint": "15.0.1"
107
+ "prettier-eslint": "16.2.0"
108
108
  },
109
109
  "optionalDependencies": {
110
110
  "fsevents": "*"
@@ -78,5 +78,5 @@
78
78
  "triggeredSend"
79
79
  ]
80
80
  },
81
- "version": "6.0.0"
81
+ "version": "6.0.1"
82
82
  }
@@ -236,7 +236,9 @@ export const soapUrl =
236
236
  export const handleRESTRequest = async (config) => {
237
237
  try {
238
238
  // check if filtered
239
- const urlObj = new URL(config.baseURL + config.url.slice(1));
239
+ const urlObj = new URL(
240
+ config.baseURL + (config.url.startsWith('/') ? config.url.slice(1) : config.url)
241
+ );
240
242
  let filterName;
241
243
  if (urlObj.searchParams.get('$filter')) {
242
244
  filterName = urlObj.searchParams.get('$filter').split(' eq ')[1];
@@ -0,0 +1,13 @@
1
+ <table cellpadding="0" cellspacing="0" width="100%" role="presentation" style="min-width: 100%; " class="stylingblock-content-wrapper"><tr><td class="stylingblock-content-wrapper camarker-inner"><div>
2
+ my 1st html
3
+ </div>
4
+ %%[
5
+ /* my ampscript */
6
+ ]%%
7
+ <script runat="server">
8
+ // my ssjs
9
+ </script>
10
+
11
+ <div>
12
+ my 2nd html
13
+ </div></td></tr></table>
@@ -0,0 +1,41 @@
1
+ {
2
+ "customerKey": "mcdev-issue-1157",
3
+ "assetType": {
4
+ "name": "htmlblock",
5
+ "displayName": "HTML Block"
6
+ },
7
+ "fileProperties": {
8
+ "fileName": "mcdev-issue-1157-Mcdev-strips-content"
9
+ },
10
+ "name": "mcdev-issue-1157-Mcdev-strips-content",
11
+ "owner": {
12
+ "email": "joern.berkefeld@accenture.com",
13
+ "name": "Jörn Berkefeld (ASGR)"
14
+ },
15
+ "createdDate": "2024-01-08T08:26:58.277-06:00",
16
+ "createdBy": {
17
+ "email": "joern.berkefeld@accenture.com",
18
+ "name": "Jörn Berkefeld (ASGR)"
19
+ },
20
+ "modifiedDate": "2024-01-08T08:28:01.6-06:00",
21
+ "modifiedBy": {
22
+ "email": "joern.berkefeld@accenture.com",
23
+ "name": "Jörn Berkefeld (ASGR)"
24
+ },
25
+ "memberId": 9999999,
26
+ "status": {
27
+ "name": "Draft"
28
+ },
29
+ "design": "",
30
+ "meta": {
31
+ "wrapperStyles": {
32
+ "mobile": {
33
+ "visible": true
34
+ },
35
+ "styling": {}
36
+ }
37
+ },
38
+ "availableViews": [],
39
+ "modelVersion": 2,
40
+ "r__folder_Path": "Content Builder"
41
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "customerKey": "mobileMessage_test",
3
+ "assetType": {
4
+ "name": "jsonmessage",
5
+ "displayName": "JSON Message"
6
+ },
7
+ "name": "Mobile Message November 22, 2021(4:20:55 PM)",
8
+ "owner": {
9
+ "email": "joern.berkefeld@accenture.com",
10
+ "name": "Jörn Berkefeld"
11
+ },
12
+ "createdDate": "2021-11-22T09:21:11.933-06:00",
13
+ "createdBy": {
14
+ "email": "joern.berkefeld@accenture.com",
15
+ "name": "Jörn Berkefeld"
16
+ },
17
+ "modifiedDate": "2021-12-16T02:56:24.29-06:00",
18
+ "modifiedBy": {
19
+ "name": "SFMC DEVOPS app user"
20
+ },
21
+ "memberId": 9999999,
22
+ "status": {
23
+ "name": "Draft"
24
+ },
25
+ "views": {
26
+ "push": {
27
+ "thumbnail": {},
28
+ "content": "<!doctype html>\n<html>\n\t<head>\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\t\t<meta name=\"description\" content=\"Push Preview\">\n\t\t<style>\n\thtml,\n\tbody {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\theight: 100%;\n\t\twidth: 100%;\n\t\tline-height: 1.4;\n\t}\n\n\t.push-previewer {\n\t\twidth: inherit;\n\t\theight: inherit;\n\t\tposition: relative;\n\t}\n\n\t.device {\n\t\theight: inherit;\n\t\twidth: inherit;\n\t\tbackground-size: cover;\n\t\tbackground-repeat: no-repeat;\n\t}\n</style> <style>\n\t@font-face {\n\t\tfont-family: 'SF Pro Text - Regular';\n\t\tsrc: url('https://mobilepush-device-previewer.s7.marketingcloudapps.com/fonts/SFProText-Regular.woff') format('woff');\n\t\tfont-weight: normal;\n\t\tfont-style: normal;\n\t}\n\t\n\t@font-face {\n\t\tfont-family: 'Helvetica Neue - Roman';\n\t\tsrc: url('https://mobilepush-device-previewer.s7.marketingcloudapps.com/fonts/HelveticaNeue-Roman.woff') format('woff');\n\t\tfont-weight: normal;\n\t\tfont-style: normal;\n\t}\n\t\n\t@font-face {\n\t\tfont-family: 'SF Compact Text - Light';\n\t\tsrc: url('https://mobilepush-device-previewer.s7.marketingcloudapps.com/fonts/SFCompactText-Light.woff') format('woff');\n\t\tfont-weight: normal;\n\t\tfont-style: normal;\n\t}\n\t\n\t.device.iphone.lock-screen {\n\t\tfont-family: 'SF Pro Text - Regular';\n\t\tbackground-image: url('https://image.s8.exacttarget.com/lib/fe8e1c72746d057a70/m/1/d1948d1e-93af-4b9d-8b28-a087a351e8a8.jpg');\n\t}\n\t\n\t.device.iphone.lock-screen .header {\n\t\ttext-align: center;\n\t\tmargin-bottom: 20px;\n\t}\n\t\n\t.device.iphone.lock-screen .header .time {\n\t\tcolor: #FFFFFF;\n\t\tfont-family: 'SF Compact Text - Light';\n\t\tfont-size: 60px;\n\t\theight: 70px;\n\t}\n\n\t.device.iphone.lock-screen .header .date {\n\t\tcolor: #FFFFFF;\n\t\tfont-family: 'Helvetica Neue - Roman';\n\t\tfont-size: 17px;\n\t}\n\t\n\t.device.iphone.lock-screen .body {\n\t\tbackground: rgba(240, 240, 240, 0.97);\n\t\tborder-radius: 12px;\n\t\tpadding: 10px;\n\t\tmargin: 0 4px;\n\t\topacity: 1;\n\t\tposition: relative;\n\t}\n\t\n\t.device.iphone.lock-screen .body .application {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tborder-radius: 12px 12px 0 0;\n\t\tbackground: #F0F0F0;\n\t\tmargin: -10px -10px 0 -10px;\n\t\tpadding: 10px;\n\t}\n\t\n\t.device.iphone.lock-screen .body .application .icon {\n\t\t\n\t}\n\t\n\t.device.iphone.lock-screen .body .application .icon .icon-placeholder {\n\t\theight: 17px;\n\t\twidth: 17px;\n\t\tborder-radius: 3px;\n\t\tbackground-color: grey;\n\t\tdisplay: inline-block;\n\t\tvertical-align: middle;\n\t}\n\t\n\t.device.iphone.lock-screen .body .application .name {\n\t\tcolor: #000000;\n\t\topacity: .50;\n\t\tfont-size: 12px;\n\t\ttext-overflow: ellipsis;\n\t\toverflow: hidden;\n\t\twhite-space: nowrap;\n\t\twidth: 100%;\n\t\tpadding: 2px 5px 0 10px;\n\t}\n\t\n\t.device.iphone.lock-screen .body .application .timestamp {\n\t\tfont-size: 11px;\n\t\topacity: .50;\n\t\tfont-weight: bold;\n\t\tmargin-left: auto;\n\t}\n\t\n\t.device.iphone.lock-screen .body .media {\n\t\tborder-radius: 3px;\n\t\twidth: 26px;\n\t\theight: 26px;\n\t\tposition: absolute;\n\t\tright: 10px;\n\t\tbottom: 10px;\n\t}\n\t\n\t.device.iphone.lock-screen .body .media img {\n\t\theight: 100%;\n\t\tmax-height: 26px;\n\t\twidth: 100%;\n\t\tmax-width: 26px;\n\t}\n\t\n\t.device.iphone.lock-screen .body .content {\n\t\tcolor: #000000;\n\t\tfont-size: 13px;\n\t\tpadding-top: 5px;\n\t}\n\t\n\t.device.iphone.lock-screen .body .content > div {\n\t\ttext-overflow: ellipsis;\n\t\toverflow: hidden;\n\t}\n\t\n\t.device.iphone.lock-screen .body .content .title {\n\t\tfont-weight: bold;\n\t\twhite-space: nowrap;\n\t}\n\t\n\t.device.iphone.lock-screen .body .content .subtitle {\n\t\tfont-weight: bold;\n\t\twhite-space: nowrap;\n\t}\n\t\n\t.device.iphone.lock-screen .body .content .message {\n\t\twhite-space: pre-wrap;\n\t\tdisplay: -webkit-box;\n\t\t-webkit-line-clamp: 4;\n\t\t-webkit-box-orient: vertical;\n\t\ttext-overflow: ellipsis;\n\t\t-o-text-overflow: ellipsis;\n\t\t-ms-text-overflow: ellipsis;\n\t\tword-break: break-word;\n\t\t-ms-word-wrap: break-word;\n\t\tword-wrap: break-word;\n\t\tmax-height: 75px;\n\t}\n\t\n\t.device.iphone.lock-screen .body .content .message.hasTitle {\n\t\tmax-height: 55px;\n\t\t-webkit-line-clamp: 3;\n\t}\n\t\n\t.device.iphone.lock-screen .body .content .message.hasSubtitle {\n\t\tmax-height: 35px;\n\t\t-webkit-line-clamp: 2;\n\t}\n\t\n\t.device.iphone.lock-screen .body .content.hasMedia .message {\n\t\tpadding-right: 50px;\n\t}\n\t\n\t.device.iphone.lock-screen .body .action {\n\t\tcolor: #157EBF;\n\t\tfont-size: 11px;\n\t\topacity: .3;\n\t\tmargin-top: 5px;\n\t}\n\t\n\t.device.iphone.lock-screen .body .buttons {\n\t\tdisplay: none;\n\t}\n\t\n\t.device.iphone.lock-screen .footer {\n\t\tdisplay: none;\n\t}\n</style>\n\t</head>\n\t<body>\n\t\t<div class=\"push-previewer\">\n\t\t\t<div class=\"device iphone lock-screen\">\n\t\t\t\t<div class=\"header\">\n\t\t\t\t\t<div class=\"time\">12:00 AM</div>\n\t\t\t\t\t<div class=\"date\">January 1, 2020</div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"body\">\n\t\t\t\t\t<div class=\"application\">\n\t\t\t\t\t\t<div class=\"icon\">\n\t\t\t\t\t\t\t<div class=\"icon-placeholder\"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class=\"name\">App Name</div>\n\t\t\t\t\t\t<div class=\"timestamp\">now</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"media\"></div>\n\t\t\t\t\t<div class=\"content \">\n\t\t\t\t\t\t<div class=\"title\">test</div>\n\t\t\t\t\t\t<div class=\"subtitle\"></div>\n\t\t\t\t\t\t<div class=\"message hasTitle \">asdfasf </div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"action\"></div>\n\t\t\t\t\t<div class=\"buttons\">\n\t\t\t\t\t\t<div class=\"button1\"></div>\n\t\t\t\t\t\t<div class=\"button2\"></div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"footer\"></div>\n\t\t\t</div>\n\t\t</div>\n\t</body>\n</html>",
29
+ "meta": {
30
+ "options": {
31
+ "customBlockData": {
32
+ "display:title": "test",
33
+ "channel": "push",
34
+ "showTemplatePicker": false,
35
+ "display:title:display": "test",
36
+ "stack": "S7",
37
+ "openBehavior:actionType": {
38
+ "label": "Open the App",
39
+ "value": "openApp",
40
+ "id": "openApp_0",
41
+ "localizedLabel": "Open the App"
42
+ },
43
+ "display:message": "asdfasf ",
44
+ "currentColumn": 0,
45
+ "display:message:display": "asdfasf ",
46
+ "template": "push",
47
+ "uncheckedPanels": ["pushmedia", "subtitle"]
48
+ }
49
+ }
50
+ },
51
+ "modelVersion": 2
52
+ }
53
+ },
54
+ "availableViews": ["push"],
55
+ "modelVersion": 2,
56
+ "category": {
57
+ "id": 89397,
58
+ "name": "Content Builder",
59
+ "parentId": 0
60
+ }
61
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "id": 1295064,
3
+ "customerKey": "mcdev-issue-1157",
4
+ "objectID": "972974ed-dc44-4df2-ab6e-53bae9070339",
5
+ "assetType": {
6
+ "id": 197,
7
+ "name": "htmlblock",
8
+ "displayName": "HTML Block"
9
+ },
10
+ "fileProperties": {
11
+ "fileName": "mcdev-issue-1157-Mcdev-strips-content"
12
+ },
13
+ "name": "mcdev-issue-1157-Mcdev-strips-content",
14
+ "owner": {
15
+ "id": 700301950,
16
+ "email": "joern.berkefeld@accenture.com",
17
+ "name": "Jörn Berkefeld (ASGR)",
18
+ "userId": "700301950"
19
+ },
20
+ "createdDate": "2024-01-08T08:26:58.277-06:00",
21
+ "createdBy": {
22
+ "id": 700301950,
23
+ "email": "joern.berkefeld@accenture.com",
24
+ "name": "Jörn Berkefeld (ASGR)",
25
+ "userId": "700301950"
26
+ },
27
+ "modifiedDate": "2024-01-08T08:28:01.6-06:00",
28
+ "modifiedBy": {
29
+ "id": 700301950,
30
+ "email": "joern.berkefeld@accenture.com",
31
+ "name": "Jörn Berkefeld (ASGR)",
32
+ "userId": "700301950"
33
+ },
34
+ "enterpriseId": 9999999,
35
+ "memberId": 9999999,
36
+ "status": {
37
+ "id": 1,
38
+ "name": "Draft"
39
+ },
40
+ "thumbnail": {
41
+ "thumbnailUrl": "/v1/assets/1295064/thumbnail"
42
+ },
43
+ "category": {
44
+ "id": 89397,
45
+ "name": "Content Builder",
46
+ "parentId": 0
47
+ },
48
+ "content": "<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" role=\"presentation\" style=\"min-width: 100%; \" class=\"stylingblock-content-wrapper\"><tr><td class=\"stylingblock-content-wrapper camarker-inner\"><div>\n my 1st html\n</div>\n\n%%[ /* my ampscript */ ]%%\n\n<script runat=\"server\">\n// my ssjs\n</script>\n\n<div>\n my 2nd html\n</div></td></tr></table>",
49
+ "design": "",
50
+ "meta": {
51
+ "wrapperStyles": {
52
+ "mobile": {
53
+ "visible": true
54
+ },
55
+ "styling": {}
56
+ }
57
+ },
58
+ "availableViews": [],
59
+ "modelVersion": 2
60
+ }
@@ -0,0 +1,184 @@
1
+ {
2
+ "id": 808714,
3
+ "customerKey": "testExisting_asset_message",
4
+ "objectID": "01f883be-c5c3-4eb1-b6e1-d7036f8153d4",
5
+ "contentType": "application/vnd.etmc.email.Message; kind=paste",
6
+ "assetType": {
7
+ "id": 208,
8
+ "name": "htmlemail",
9
+ "displayName": "HTML Email"
10
+ },
11
+ "name": "testExisting_asset_message",
12
+ "owner": {
13
+ "id": 717129834,
14
+ "email": "joern.berkefeld@accenture.com",
15
+ "name": "Jörn Berkefeld",
16
+ "userId": "717129834"
17
+ },
18
+ "createdDate": "2020-03-06T02:35:15.677-06:00",
19
+ "createdBy": {
20
+ "id": 717129834,
21
+ "email": "joern.berkefeld@accenture.com",
22
+ "name": "Jörn Berkefeld",
23
+ "userId": "717129834"
24
+ },
25
+ "modifiedDate": "2023-08-02T07:08:00.86-06:00",
26
+ "modifiedBy": {
27
+ "id": 700304523,
28
+ "name": "SFMC DEVOPS app user",
29
+ "userId": "700304523"
30
+ },
31
+ "enterpriseId": 7281698,
32
+ "memberId": 7281698,
33
+ "status": {
34
+ "id": 1,
35
+ "name": "Draft"
36
+ },
37
+ "thumbnail": {
38
+ "thumbnailUrl": "/v1/assets/808714/thumbnail"
39
+ },
40
+ "category": {
41
+ "id": 89397,
42
+ "name": "Content Builder",
43
+ "parentId": 0
44
+ },
45
+ "views": {
46
+ "subjectline": {
47
+ "contentType": "application/vnd.etmc.email.View; kind=subjectline",
48
+ "thumbnail": {},
49
+ "content": "TEST",
50
+ "availableViews": [],
51
+ "data": {
52
+ "email": {
53
+ "options": {
54
+ "generateFrom": null
55
+ }
56
+ }
57
+ },
58
+ "modelVersion": 2
59
+ },
60
+ "preheader": {
61
+ "thumbnail": {},
62
+ "availableViews": [],
63
+ "data": {
64
+ "email": {
65
+ "options": {
66
+ "generateFrom": null
67
+ }
68
+ }
69
+ },
70
+ "modelVersion": 2
71
+ },
72
+ "html": {
73
+ "thumbnail": {},
74
+ "content": "<a href=\"%%ftaf_url%%\"\n ><img\n src=\"https://www.exacttarget.com/members/newsletters/gfx/forwardafriendicon.gif\"\n border=\"0\" /></a\n><a href=\"%%profile_center_url%%\" alias=\"Update Profile\">Update Profile</a>\n<table cellpadding=\"2\" cellspacing=\"0\" width=\"600\" id=\"Table5\" border=\"0\">\n <tr>\n <td>\n <font face=\"verdana\" size=\"1\" color=\"#444444\"\n >This email was sent by: <b>%%Member_Busname%%</b><br />%%Member_Addr%%\n %%Member_City%%, %%Member_State%%, %%Member_PostalCode%%, %%Member_Country%%<br /><br\n /></font>\n </td>\n </tr>\n</table>\n<a href=\"%%subscription_center_url%%\" alias=\"Manage Subscriptions\">Manage Subscriptions</a\n><img src=\"https://www.exacttarget.com/images/Powered_By_1206.jpg\" border=\"0\" /><custom\n name=\"opencounter\"\n type=\"tracking\"\n/>\n",
75
+ "availableViews": [],
76
+ "data": {
77
+ "email": {
78
+ "options": {
79
+ "generateFrom": null
80
+ }
81
+ }
82
+ },
83
+ "modelVersion": 2
84
+ },
85
+ "text": {
86
+ "thumbnail": {},
87
+ "availableViews": [],
88
+ "data": {
89
+ "email": {
90
+ "options": {
91
+ "generateFrom": "html"
92
+ }
93
+ }
94
+ },
95
+ "generateFrom": "html",
96
+ "modelVersion": 2
97
+ },
98
+ "viewAsAWebPage": {
99
+ "thumbnail": {},
100
+ "availableViews": [],
101
+ "data": {
102
+ "email": {
103
+ "options": {
104
+ "generateFrom": null
105
+ }
106
+ }
107
+ },
108
+ "modelVersion": 2
109
+ },
110
+ "subscriptioncenter": {
111
+ "thumbnail": {},
112
+ "availableViews": [],
113
+ "data": {
114
+ "email": {
115
+ "options": {
116
+ "generateFrom": null
117
+ }
118
+ }
119
+ },
120
+ "modelVersion": 2
121
+ },
122
+ "forwardHTML": {
123
+ "thumbnail": {},
124
+ "availableViews": [],
125
+ "data": {
126
+ "email": {
127
+ "options": {
128
+ "generateFrom": null
129
+ }
130
+ }
131
+ },
132
+ "modelVersion": 2
133
+ },
134
+ "forwardText": {
135
+ "thumbnail": {},
136
+ "availableViews": [],
137
+ "data": {
138
+ "email": {
139
+ "options": {
140
+ "generateFrom": null
141
+ }
142
+ }
143
+ },
144
+ "modelVersion": 2
145
+ }
146
+ },
147
+ "availableViews": [
148
+ "subjectline",
149
+ "preheader",
150
+ "html",
151
+ "text",
152
+ "viewAsAWebPage",
153
+ "subscriptioncenter",
154
+ "forwardHTML",
155
+ "forwardText"
156
+ ],
157
+ "data": {
158
+ "email": {
159
+ "options": {
160
+ "characterEncoding": "utf-8"
161
+ },
162
+ "legacy": {
163
+ "legacyId": 429827,
164
+ "legacyKey": "c7308370-bb2c-4bd4-83dd-0ea422e2009d",
165
+ "legacyType": "email",
166
+ "legacyCategoryId": 90890
167
+ }
168
+ },
169
+ "approvals": {
170
+ "approvalStatus": {
171
+ "id": 4,
172
+ "name": "Approved",
173
+ "displayName": "Approved"
174
+ }
175
+ }
176
+ },
177
+ "legacyData": {
178
+ "legacyId": 429827,
179
+ "legacyKey": "c7308370-bb2c-4bd4-83dd-0ea422e2009d",
180
+ "legacyType": "email",
181
+ "legacyCategoryId": 90890
182
+ },
183
+ "modelVersion": 2
184
+ }
@@ -23,7 +23,7 @@
23
23
  "userId": "700304523"
24
24
  },
25
25
  "status": { "id": 1, "name": "Draft" },
26
- "category": { "id": 290833, "name": "Content Builder", "parentId": 0 },
26
+ "category": { "id": 89397, "name": "Content Builder", "parentId": 0 },
27
27
  "availableViews": ["html", "text", "subjectline", "preheader"],
28
28
  "data": {
29
29
  "email": {
@@ -64,9 +64,47 @@
64
64
  "userId": "700301950"
65
65
  },
66
66
  "status": { "id": 1, "name": "Draft" },
67
- "category": { "id": 283608, "name": "Content Builder", "parentId": 0 },
67
+ "category": { "id": 89397, "name": "Content Builder", "parentId": 0 },
68
68
  "availableViews": ["push"],
69
69
  "modelVersion": 2
70
+ },
71
+ {
72
+ "id": 1295064,
73
+ "customerKey": "mcdev-issue-1157",
74
+ "assetType": {
75
+ "id": 197,
76
+ "name": "htmlblock",
77
+ "displayName": "HTML Block"
78
+ },
79
+ "fileProperties": {
80
+ "fileName": "dont strip non ssjs content"
81
+ },
82
+ "name": "dont strip non ssjs content",
83
+ "createdDate": "2024-01-08T08:26:58.277-06:00",
84
+ "createdBy": {
85
+ "id": 700301950,
86
+ "email": "joern.berkefeld@accenture.com",
87
+ "name": "Jörn Berkefeld (ASGR)",
88
+ "userId": "700301950"
89
+ },
90
+ "modifiedDate": "2024-01-08T08:28:01.6-06:00",
91
+ "modifiedBy": {
92
+ "id": 700301950,
93
+ "email": "joern.berkefeld@accenture.com",
94
+ "name": "Jörn Berkefeld (ASGR)",
95
+ "userId": "700301950"
96
+ },
97
+ "status": {
98
+ "id": 1,
99
+ "name": "Draft"
100
+ },
101
+ "category": {
102
+ "id": 89397,
103
+ "name": "Content Builder",
104
+ "parentId": 0
105
+ },
106
+ "availableViews": [],
107
+ "modelVersion": 2
70
108
  }
71
109
  ]
72
110
  }
@@ -0,0 +1,70 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
5
+ xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
6
+ xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
7
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
8
+ <soap:Header>
9
+ <wsa:Action>RetrieveResponse</wsa:Action>
10
+ <wsa:MessageID>urn:uuid:00106553-ac00-4e72-b387-42325fe6f93d</wsa:MessageID>
11
+ <wsa:RelatesTo>urn:uuid:a1dd2a9d-b696-480e-9a1b-265f262a8997</wsa:RelatesTo>
12
+ <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
13
+ <wsse:Security>
14
+ <wsu:Timestamp wsu:Id="Timestamp-d82724f8-afc2-4461-8e3e-190aeb6d9625">
15
+ <wsu:Created>2024-01-08T14:30:39Z</wsu:Created>
16
+ <wsu:Expires>2024-01-08T14:35:39Z</wsu:Expires>
17
+ </wsu:Timestamp>
18
+ </wsse:Security>
19
+ </soap:Header>
20
+ <soap:Body>
21
+ <RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
22
+ <OverallStatus>OK</OverallStatus>
23
+ <RequestID>6596087d-d12f-4c9d-9353-783fe01775a3</RequestID>
24
+ <Results xsi:type="DataFolder">
25
+ <Client>
26
+ <ID>9999999</ID>
27
+ </Client>
28
+ <PartnerKey xsi:nil="true" />
29
+ <CreatedDate>2016-07-22T11:52:35.687</CreatedDate>
30
+ <ModifiedDate>2016-07-22T11:52:35.687</ModifiedDate>
31
+ <ID>89397</ID>
32
+ <ObjectID xsi:nil="true" />
33
+ <CustomerKey />
34
+ <ParentFolder>
35
+ <PartnerKey xsi:nil="true" />
36
+ <ID>0</ID>
37
+ <ObjectID xsi:nil="true" />
38
+ </ParentFolder>
39
+ <Name>Content Builder</Name>
40
+ <Description>The root folder for assets</Description>
41
+ <ContentType>asset</ContentType>
42
+ <IsActive>true</IsActive>
43
+ <IsEditable>false</IsEditable>
44
+ <AllowChildren>true</AllowChildren>
45
+ </Results>
46
+ <Results xsi:type="DataFolder">
47
+ <Client>
48
+ <ID>9999999</ID>
49
+ </Client>
50
+ <PartnerKey xsi:nil="true" />
51
+ <CreatedDate>2016-07-29T12:13:07.7</CreatedDate>
52
+ <ModifiedDate>2021-12-16T02:56:14.68</ModifiedDate>
53
+ <ID>90888</ID>
54
+ <ObjectID xsi:nil="true" />
55
+ <CustomerKey />
56
+ <ParentFolder>
57
+ <PartnerKey xsi:nil="true" />
58
+ <ID>89397</ID>
59
+ <ObjectID xsi:nil="true" />
60
+ </ParentFolder>
61
+ <Name>Test Folder</Name>
62
+ <Description />
63
+ <ContentType>asset</ContentType>
64
+ <IsActive>true</IsActive>
65
+ <IsEditable>true</IsEditable>
66
+ <AllowChildren>true</AllowChildren>
67
+ </Results>
68
+ </RetrieveResponseMsg>
69
+ </soap:Body>
70
+ </soap:Envelope>
@@ -0,0 +1,84 @@
1
+ import File from '../lib/util/file.js';
2
+
3
+ import chai, { assert, expect } from 'chai';
4
+ import chaiFiles from 'chai-files';
5
+ import cache from '../lib/util/cache.js';
6
+ import * as testUtils from './utils.js';
7
+ import handler from '../lib/index.js';
8
+ chai.use(chaiFiles);
9
+ const file = chaiFiles.file;
10
+
11
+ /**
12
+ * gets file from Retrieve folder
13
+ *
14
+ * @param {string} customerKey of metadata
15
+ * @param {string} type of metadata
16
+ * @param {string} subtype of metadata
17
+ * @param {string} [buName] used when we need to test on ParentBU
18
+ * @returns {Promise.<string>} file in string form
19
+ */
20
+ function getActualJson(customerKey, type, subtype, buName = 'testBU') {
21
+ return File.readJSON(
22
+ `./retrieve/testInstance/${buName}/${type}/${subtype}/${customerKey}.${type}-${subtype}-meta.json`
23
+ );
24
+ }
25
+ /**
26
+ * gets file from Retrieve folder
27
+ *
28
+ * @param {string} customerKey of metadata
29
+ * @param {string} type of metadata
30
+ * @param {string} subtype of metadata
31
+ * @param {string} ext file extension
32
+ * @returns {string} file path
33
+ */
34
+ function getActualFile(customerKey, type, subtype, ext) {
35
+ return `./retrieve/testInstance/testBU/${type}/${subtype}/${customerKey}.${type}-${subtype}-meta.${ext}`;
36
+ }
37
+
38
+ describe('type: asset', () => {
39
+ beforeEach(() => {
40
+ testUtils.mockSetup();
41
+ });
42
+ afterEach(() => {
43
+ testUtils.mockReset();
44
+ });
45
+ describe('Retrieve ================', () => {
46
+ it('Should retrieve a asset & ensure non-ssjs code is not removed', async () => {
47
+ // WHEN
48
+ const retrieve = await handler.retrieve('testInstance/testBU', ['asset']);
49
+
50
+ // THEN
51
+ assert.equal(process.exitCode, false, 'retrieve should not have thrown an error');
52
+ assert.equal(
53
+ retrieve['testInstance/testBU'].asset
54
+ ? Object.keys(retrieve['testInstance/testBU'].asset).length
55
+ : 0,
56
+ 3,
57
+ 'only 3 assets expected in retrieve response'
58
+ );
59
+ // get results from cache
60
+ const result = cache.getCache();
61
+ assert.equal(
62
+ result.asset ? Object.keys(result.asset).length : 0,
63
+ 3,
64
+ 'only 3 assets expected in cache'
65
+ );
66
+
67
+ assert.deepEqual(
68
+ await getActualJson('mcdev-issue-1157', 'asset', 'block'),
69
+ await testUtils.getExpectedJson('9999999', 'asset', 'block-1157-retrieve'),
70
+ 'returned metadata was not equal expected'
71
+ );
72
+ expect(file(getActualFile('mcdev-issue-1157', 'asset', 'block', 'html'))).to.equal(
73
+ file(testUtils.getExpectedFile('9999999', 'asset', 'block-1157-retrieve', 'html'))
74
+ );
75
+
76
+ assert.equal(
77
+ testUtils.getAPIHistoryLength(),
78
+ 30,
79
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
80
+ );
81
+ return;
82
+ });
83
+ });
84
+ });
@@ -288,7 +288,6 @@ describe('type: automation', () => {
288
288
  1,
289
289
  'one automation expected'
290
290
  );
291
- testUtils.logAPIHistoryDebug();
292
291
  // check number of API calls
293
292
  assert.equal(
294
293
  testUtils.getAPIHistoryLength(),