mcdev 7.1.3 → 7.2.0

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.
Files changed (144) hide show
  1. package/.fork/custom-commands.json +123 -21
  2. package/.github/ISSUE_TEMPLATE/bug.yml +2 -0
  3. package/.github/dependabot.yml +1 -0
  4. package/.husky/post-checkout +6 -1
  5. package/.husky/post-merge +5 -0
  6. package/@types/lib/Builder.d.ts.map +1 -1
  7. package/@types/lib/Deployer.d.ts.map +1 -1
  8. package/@types/lib/cli.d.ts.map +1 -1
  9. package/@types/lib/index.d.ts.map +1 -1
  10. package/@types/lib/metadataTypes/Asset.d.ts.map +1 -1
  11. package/@types/lib/metadataTypes/AttributeGroup.d.ts.map +1 -1
  12. package/@types/lib/metadataTypes/AttributeSet.d.ts.map +1 -1
  13. package/@types/lib/metadataTypes/Automation.d.ts.map +1 -1
  14. package/@types/lib/metadataTypes/Campaign.d.ts.map +1 -1
  15. package/@types/lib/metadataTypes/ContentArea.d.ts.map +1 -1
  16. package/@types/lib/metadataTypes/DataExtension.d.ts.map +1 -1
  17. package/@types/lib/metadataTypes/DataExtensionField.d.ts.map +1 -1
  18. package/@types/lib/metadataTypes/DataExtract.d.ts.map +1 -1
  19. package/@types/lib/metadataTypes/DataExtractType.d.ts.map +1 -1
  20. package/@types/lib/metadataTypes/Discovery.d.ts.map +1 -1
  21. package/@types/lib/metadataTypes/Email.d.ts.map +1 -1
  22. package/@types/lib/metadataTypes/Event.d.ts.map +1 -1
  23. package/@types/lib/metadataTypes/FileTransfer.d.ts.map +1 -1
  24. package/@types/lib/metadataTypes/Folder.d.ts.map +1 -1
  25. package/@types/lib/metadataTypes/ImportFile.d.ts.map +1 -1
  26. package/@types/lib/metadataTypes/Journey.d.ts +0 -1
  27. package/@types/lib/metadataTypes/Journey.d.ts.map +1 -1
  28. package/@types/lib/metadataTypes/List.d.ts.map +1 -1
  29. package/@types/lib/metadataTypes/MetadataType.d.ts.map +1 -1
  30. package/@types/lib/metadataTypes/MobileKeyword.d.ts.map +1 -1
  31. package/@types/lib/metadataTypes/MobileMessage.d.ts.map +1 -1
  32. package/@types/lib/metadataTypes/Query.d.ts.map +1 -1
  33. package/@types/lib/metadataTypes/Role.d.ts.map +1 -1
  34. package/@types/lib/metadataTypes/Script.d.ts.map +1 -1
  35. package/@types/lib/metadataTypes/SendClassification.d.ts.map +1 -1
  36. package/@types/lib/metadataTypes/SenderProfile.d.ts.map +1 -1
  37. package/@types/lib/metadataTypes/TransactionalEmail.d.ts.map +1 -1
  38. package/@types/lib/metadataTypes/TransactionalMessage.d.ts.map +1 -1
  39. package/@types/lib/metadataTypes/TransactionalPush.d.ts.map +1 -1
  40. package/@types/lib/metadataTypes/TransactionalSMS.d.ts.map +1 -1
  41. package/@types/lib/metadataTypes/TriggeredSend.d.ts.map +1 -1
  42. package/@types/lib/metadataTypes/User.d.ts.map +1 -1
  43. package/@types/lib/metadataTypes/Verification.d.ts.map +1 -1
  44. package/@types/lib/metadataTypes/definitions/Journey.definition.d.ts +0 -1
  45. package/@types/lib/util/auth.d.ts.map +1 -1
  46. package/@types/lib/util/cache.d.ts.map +1 -1
  47. package/@types/lib/util/cli.d.ts.map +1 -1
  48. package/@types/lib/util/config.d.ts.map +1 -1
  49. package/@types/lib/util/devops.d.ts.map +1 -1
  50. package/@types/lib/util/file.d.ts.map +1 -1
  51. package/@types/lib/util/init.config.d.ts.map +1 -1
  52. package/@types/lib/util/init.d.ts.map +1 -1
  53. package/@types/lib/util/init.git.d.ts.map +1 -1
  54. package/@types/lib/util/init.npm.d.ts.map +1 -1
  55. package/@types/lib/util/replaceContentBlockReference.d.ts.map +1 -1
  56. package/@types/lib/util/util.d.ts.map +1 -1
  57. package/@types/types/mcdev.d.d.ts.map +1 -1
  58. package/lib/Builder.js +4 -0
  59. package/lib/Deployer.js +2 -0
  60. package/lib/cli.js +1 -0
  61. package/lib/index.js +31 -0
  62. package/lib/metadataTypes/Asset.js +30 -0
  63. package/lib/metadataTypes/AttributeGroup.js +2 -0
  64. package/lib/metadataTypes/AttributeSet.js +3 -0
  65. package/lib/metadataTypes/Automation.js +15 -0
  66. package/lib/metadataTypes/Campaign.js +1 -0
  67. package/lib/metadataTypes/ContentArea.js +2 -0
  68. package/lib/metadataTypes/DataExtension.js +12 -0
  69. package/lib/metadataTypes/DataExtensionField.js +8 -0
  70. package/lib/metadataTypes/DataExtract.js +3 -0
  71. package/lib/metadataTypes/DataExtractType.js +1 -0
  72. package/lib/metadataTypes/Discovery.js +1 -0
  73. package/lib/metadataTypes/Email.js +2 -0
  74. package/lib/metadataTypes/Event.js +4 -0
  75. package/lib/metadataTypes/FileTransfer.js +1 -0
  76. package/lib/metadataTypes/Folder.js +14 -2
  77. package/lib/metadataTypes/ImportFile.js +2 -0
  78. package/lib/metadataTypes/Journey.js +288 -141
  79. package/lib/metadataTypes/List.js +2 -0
  80. package/lib/metadataTypes/MetadataType.js +34 -0
  81. package/lib/metadataTypes/MobileKeyword.js +8 -0
  82. package/lib/metadataTypes/MobileMessage.js +7 -0
  83. package/lib/metadataTypes/Query.js +9 -0
  84. package/lib/metadataTypes/Role.js +1 -0
  85. package/lib/metadataTypes/Script.js +7 -0
  86. package/lib/metadataTypes/SendClassification.js +2 -0
  87. package/lib/metadataTypes/SenderProfile.js +2 -0
  88. package/lib/metadataTypes/TransactionalEmail.js +23 -3
  89. package/lib/metadataTypes/TransactionalMessage.js +3 -0
  90. package/lib/metadataTypes/TransactionalPush.js +1 -0
  91. package/lib/metadataTypes/TransactionalSMS.js +8 -0
  92. package/lib/metadataTypes/TriggeredSend.js +4 -0
  93. package/lib/metadataTypes/User.js +10 -0
  94. package/lib/metadataTypes/Verification.js +3 -0
  95. package/lib/metadataTypes/definitions/Journey.definition.js +0 -1
  96. package/lib/retrieveChangelog.js +1 -0
  97. package/lib/util/auth.js +3 -0
  98. package/lib/util/cache.js +8 -0
  99. package/lib/util/cli.js +8 -0
  100. package/lib/util/config.js +2 -0
  101. package/lib/util/devops.js +2 -0
  102. package/lib/util/file.js +65 -49
  103. package/lib/util/init.config.js +5 -0
  104. package/lib/util/init.git.js +4 -0
  105. package/lib/util/init.js +4 -0
  106. package/lib/util/init.npm.js +1 -0
  107. package/lib/util/replaceContentBlockReference.js +1 -0
  108. package/lib/util/util.js +29 -0
  109. package/package.json +15 -15
  110. package/test/general.test.js +13 -13
  111. package/test/mockRoot/.mcdevrc.json +1 -1
  112. package/test/resourceFactory.js +27 -4
  113. package/test/resources/9999999/dataExtension/retrieve-response.xml +29 -0
  114. package/test/resources/9999999/dataFolder/+retrieve-QAA-response.xml +387 -0
  115. package/test/resources/9999999/dataFolder/create-ContentType=dataextension,Name=my,ParentFolderID=2-response.xml +33 -0
  116. package/test/resources/9999999/dataFolder/create-ContentType=dataextension,Name=path,ParentFolderID=862002-response.xml +33 -0
  117. package/test/resources/9999999/dataFolder/create-ContentType=dataextension,Name=sub,ParentFolderID=862001-response.xml +33 -0
  118. package/test/resources/9999999/dataFolder/create-ContentType=dataextension,Name=subpath,ParentFolderID=862003-response.xml +33 -0
  119. package/test/resources/9999999/email/v1/category/post-response-parentCatId=290937,name=my,catType=automations.json +7 -0
  120. package/test/resources/9999999/email/v1/category/post-response-parentCatId=862100,name=sub,catType=automations.json +7 -0
  121. package/test/resources/9999999/email/v1/category/post-response-parentCatId=862101,name=path,catType=automations.json +7 -0
  122. package/test/resources/9999999/email/v1/category/post-response-parentCatId=862102,name=subpath,catType=automations.json +7 -0
  123. package/test/resources/9999999/folder-deploy/Data Extensions/my/sub/path/subpath.folder-meta.json +9 -0
  124. package/test/resources/9999999/folder-deploy/Data Extensions/my/sub/path.folder-meta.json +9 -0
  125. package/test/resources/9999999/folder-deploy/Data Extensions/my/sub.folder-meta.json +9 -0
  126. package/test/resources/9999999/folder-deploy/Data Extensions/my.folder-meta.json +9 -0
  127. package/test/resources/9999999/folder-deploy/my automations/my/sub/path/subpath.folder-meta.json +9 -0
  128. package/test/resources/9999999/folder-deploy/my automations/my/sub/path.folder-meta.json +9 -0
  129. package/test/resources/9999999/folder-deploy/my automations/my/sub.folder-meta.json +9 -0
  130. package/test/resources/9999999/folder-deploy/my automations/my.folder-meta.json +9 -0
  131. package/test/resources/9999999/interaction/v1/interactions/get-response.json +38 -0
  132. package/test/resources/9999999/interaction/v1/interactions/key_testExisting_temail_notPublished/get-response.json +226 -0
  133. package/test/resources/9999999/interaction/v1/interactions/transactional/create/post-response.json +3 -0
  134. package/test/resources/9999999/messaging/v1/email/definitions/get-response.json +7 -0
  135. package/test/resources/9999999/messaging/v1/email/definitions/testExisting_temail_notPublished/get-response.json +26 -0
  136. package/test/type.asset.test.js +4 -0
  137. package/test/type.automation.test.js +1 -1
  138. package/test/type.dataExtension.test.js +4 -4
  139. package/test/type.folder.test.js +97 -0
  140. package/test/type.journey.test.js +84 -21
  141. package/test/type.transactionalEmail.test.js +7 -7
  142. package/test/utils.js +44 -5
  143. package/types/mcdev.d.js +27 -0
  144. /package/test/resources/9999999/dataFolder/{retrieve-response-.xml → +retrieve-response.xml} +0 -0
package/lib/util/util.js CHANGED
@@ -53,6 +53,7 @@ export const Util = {
53
53
  packageJsonMcdev: readJsonSync(path.join(__dirname, '../../package.json')),
54
54
  OPTIONS: {},
55
55
  changedKeysMap: {},
56
+
56
57
  /**
57
58
  * helper that allows filtering an object by its keys
58
59
  *
@@ -71,6 +72,7 @@ export const Util = {
71
72
  return obj;
72
73
  }, {});
73
74
  },
75
+
74
76
  /**
75
77
  * extended Array.includes method that allows check if an array-element starts with a certain string
76
78
  *
@@ -81,6 +83,7 @@ export const Util = {
81
83
  includesStartsWith(arr, search) {
82
84
  return this.includesStartsWithIndex(arr, search) >= 0;
83
85
  },
86
+
84
87
  /**
85
88
  * extended Array.includes method that allows check if an array-element starts with a certain string
86
89
  *
@@ -91,6 +94,7 @@ export const Util = {
91
94
  includesStartsWithIndex(arr, search) {
92
95
  return Array.isArray(arr) ? arr.findIndex((el) => el.startsWith(search)) : -1;
93
96
  },
97
+
94
98
  /**
95
99
  * check if a market name exists in current mcdev config
96
100
  *
@@ -156,6 +160,7 @@ export const Util = {
156
160
  throw new Error(`Market List ${mlName} is not defined`);
157
161
  }
158
162
  },
163
+
159
164
  /**
160
165
  * used to ensure the program tells surrounding software that an unrecoverable error occured
161
166
  *
@@ -165,6 +170,7 @@ export const Util = {
165
170
  // Util.logger.debug('Util.signalFataError() sets process.exitCode = 1 unless already set');
166
171
  process.exitCode ||= 1;
167
172
  },
173
+
168
174
  /**
169
175
  * SFMC accepts multiple true values for Boolean attributes for which we are checking here.
170
176
  * The same problem occurs when evaluating boolean CLI flags
@@ -175,6 +181,7 @@ export const Util = {
175
181
  isTrue(attrValue) {
176
182
  return ['true', 'TRUE', 'True', '1', 1, 'Y', 'y', true].includes(attrValue);
177
183
  },
184
+
178
185
  /**
179
186
  * SFMC accepts multiple false values for Boolean attributes for which we are checking here.
180
187
  * The same problem occurs when evaluating boolean CLI flags
@@ -285,6 +292,7 @@ export const Util = {
285
292
 
286
293
  return typeChoices;
287
294
  },
295
+
288
296
  /**
289
297
  * wrapper around our standard winston logging to console and logfile
290
298
  *
@@ -367,6 +375,7 @@ export const Util = {
367
375
  * @type {Logger}
368
376
  */
369
377
  logger: null,
378
+
370
379
  /**
371
380
  * initiate winston logger
372
381
  *
@@ -439,6 +448,7 @@ export const Util = {
439
448
  /* eslint-enable unicorn/prefer-ternary */
440
449
  myWinston.debug(stack);
441
450
  },
451
+
442
452
  /**
443
453
  * errors should cause surrounding applications to take notice
444
454
  * hence we overwrite the default error function here
@@ -458,6 +468,7 @@ export const Util = {
458
468
  `:: mcdev ${Util.packageJsonMcdev.version} :: ⚡ mcdev ${processArgv.join(' ')}`
459
469
  );
460
470
  },
471
+
461
472
  /**
462
473
  * Logger helper for Metadata functions
463
474
  *
@@ -484,6 +495,7 @@ export const Util = {
484
495
  Util.logger[level](`${type}.${method}: ${prependSource}${JSON.stringify(payload)}`);
485
496
  }
486
497
  },
498
+
487
499
  /**
488
500
  * replaces values in a JSON object string, based on a series of
489
501
  * key-value pairs (obj)
@@ -663,6 +675,7 @@ export const Util = {
663
675
  resolveObjPath(path, obj) {
664
676
  return path.split('.').reduce((prev, curr) => (prev ? prev[curr] : null), obj);
665
677
  },
678
+
666
679
  /**
667
680
  * helper to run other commands as if run manually by user
668
681
  *
@@ -693,6 +706,7 @@ export const Util = {
693
706
  return null;
694
707
  }
695
708
  },
709
+
696
710
  /**
697
711
  * standardize check to ensure only one result is returned from template search
698
712
  *
@@ -714,6 +728,7 @@ export const Util = {
714
728
  return matching[0];
715
729
  }
716
730
  },
731
+
717
732
  /**
718
733
  * configures what is displayed in the console
719
734
  *
@@ -749,6 +764,7 @@ export const Util = {
749
764
  Util.logger.level = Util.OPTIONS.loggerLevel;
750
765
  }
751
766
  },
767
+
752
768
  /**
753
769
  * outputs a warning that the given type is still in beta
754
770
  *
@@ -789,6 +805,7 @@ export const Util = {
789
805
  bgWhite: '\x1B[47m',
790
806
  bgGray: '\x1B[100m',
791
807
  },
808
+
792
809
  /**
793
810
  * helper that wraps a message in the correct color codes to have them printed gray
794
811
  *
@@ -798,6 +815,7 @@ export const Util = {
798
815
  getGrayMsg(msg) {
799
816
  return `${Util.color.dim}${msg}${Util.color.reset}`;
800
817
  },
818
+
801
819
  /**
802
820
  * helper to print the subtypes we filtered by
803
821
  *
@@ -814,6 +832,7 @@ export const Util = {
814
832
  );
815
833
  }
816
834
  },
835
+
817
836
  /**
818
837
  * helper to print the subtypes we filtered by
819
838
  *
@@ -836,6 +855,7 @@ export const Util = {
836
855
  }
837
856
  return '';
838
857
  },
858
+
839
859
  /**
840
860
  * pause execution of code; useful when multiple server calls are dependent on each other and might not be executed right away
841
861
  *
@@ -851,6 +871,7 @@ export const Util = {
851
871
  setTimeout(resolve, ms);
852
872
  });
853
873
  },
874
+
854
875
  /**
855
876
  * helper for Asset.extractCode and Script.prepExtractedCode to determine if a code block is a valid SSJS block
856
877
  *
@@ -904,6 +925,7 @@ export const Util = {
904
925
  // no script found
905
926
  return null;
906
927
  },
928
+
907
929
  /**
908
930
  * allows us to filter just like with SQL's LIKE operator
909
931
  *
@@ -925,6 +947,7 @@ export const Util = {
925
947
  // Check matches
926
948
  return new RegExp('^' + search + '$', 'gi').test(testString);
927
949
  },
950
+
928
951
  /**
929
952
  * returns true if no LIKE filter is defined or if all filters match
930
953
  *
@@ -962,6 +985,7 @@ export const Util = {
962
985
  return false;
963
986
  });
964
987
  },
988
+
965
989
  /**
966
990
  * helper used by SOAP methods to ensure the type always uses an upper-cased first letter
967
991
  *
@@ -971,6 +995,7 @@ export const Util = {
971
995
  capitalizeFirstLetter(str) {
972
996
  return str.charAt(0).toUpperCase() + str.slice(1);
973
997
  },
998
+
974
999
  /**
975
1000
  * helper for Retriever and Deployer class
976
1001
  *
@@ -996,6 +1021,7 @@ export const Util = {
996
1021
  }
997
1022
  return typeKeyMap;
998
1023
  },
1024
+
999
1025
  /**
1000
1026
  * helper that converts TypeKeyCombo objects into a string with all relevant -m parameters
1001
1027
  *
@@ -1016,6 +1042,7 @@ export const Util = {
1016
1042
  .join(' ')
1017
1043
  : '';
1018
1044
  },
1045
+
1019
1046
  /**
1020
1047
  * helper that converts TypeKeyCombo objects into a string with all relevant -m parameters
1021
1048
  *
@@ -1049,6 +1076,7 @@ export const Util = {
1049
1076
  .join(', ')
1050
1077
  : '';
1051
1078
  },
1079
+
1052
1080
  /**
1053
1081
  * helper that checks how many keys are defined in TypeKeyCombo object
1054
1082
  *
@@ -1078,6 +1106,7 @@ export const Util = {
1078
1106
  }
1079
1107
  }
1080
1108
  },
1109
+
1081
1110
  /**
1082
1111
  *
1083
1112
  * @param {Array} array array to be chunked
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcdev",
3
- "version": "7.1.3",
3
+ "version": "7.2.0",
4
4
  "description": "Accenture Salesforce Marketing Cloud DevTools",
5
5
  "author": "Accenture: joern.berkefeld, douglas.midgley, robert.zimmermann, maciej.barnas",
6
6
  "license": "MIT",
@@ -71,7 +71,7 @@
71
71
  "console.table": "0.10.0",
72
72
  "deep-equal": "2.2.3",
73
73
  "fs-extra": "11.2.0",
74
- "inquirer": "10.0.1",
74
+ "inquirer": "10.1.8",
75
75
  "json-to-table": "4.2.1",
76
76
  "mustache": "4.2.0",
77
77
  "p-limit": "6.1.0",
@@ -81,38 +81,38 @@
81
81
  "sfmc-sdk": "2.1.2",
82
82
  "simple-git": "3.25.0",
83
83
  "toposort": "2.0.2",
84
- "update-notifier": "7.0.0",
85
- "winston": "3.13.1",
84
+ "update-notifier": "7.2.0",
85
+ "winston": "3.14.2",
86
86
  "yargs": "17.7.2"
87
87
  },
88
88
  "devDependencies": {
89
- "@eslint/js": "9.7.0",
89
+ "@eslint/js": "9.9.0",
90
90
  "@types/fs-extra": "11.0.4",
91
91
  "@types/inquirer": "9.0.7",
92
92
  "@types/mocha": "10.0.7",
93
- "@types/node": "22.0.2",
94
- "@types/yargs": "17.0.32",
93
+ "@types/node": "22.4.2",
94
+ "@types/yargs": "17.0.33",
95
95
  "assert": "2.1.0",
96
- "axios-mock-adapter": "1.22.0",
96
+ "axios-mock-adapter": "2.0.0",
97
97
  "c8": "10.0.0",
98
98
  "chai": "5.1.1",
99
99
  "chai-files": "1.4.0",
100
- "eslint": "9.8.0",
100
+ "eslint": "9.9.0",
101
101
  "eslint-config-prettier": "9.1.0",
102
102
  "eslint-config-ssjs": "2.0.0",
103
- "eslint-plugin-jsdoc": "48.8.3",
103
+ "eslint-plugin-jsdoc": "50.2.2",
104
104
  "eslint-plugin-mocha": "10.5.0",
105
105
  "eslint-plugin-prettier": "5.2.1",
106
106
  "eslint-plugin-unicorn": "55.0.0",
107
107
  "fast-xml-parser": "4.4.1",
108
- "globals": "15.8.0",
109
- "husky": "9.1.4",
110
- "lint-staged": "15.2.7",
111
- "mocha": "10.7.0",
108
+ "globals": "15.9.0",
109
+ "husky": "9.1.5",
110
+ "lint-staged": "15.2.9",
111
+ "mocha": "10.7.3",
112
112
  "mock-fs": "5.2.0",
113
113
  "npm-run-all": "4.1.5",
114
114
  "prettier-eslint": "16.3.0",
115
- "typescript": "5.5.3"
115
+ "typescript": "5.5.4"
116
116
  },
117
117
  "optionalDependencies": {
118
118
  "fsevents": "*"
@@ -61,7 +61,7 @@ describe('GENERAL', () => {
61
61
 
62
62
  assert.equal(
63
63
  testUtils.getAPIHistoryLength(),
64
- 36,
64
+ 38,
65
65
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
66
66
  );
67
67
  return;
@@ -110,7 +110,7 @@ describe('GENERAL', () => {
110
110
 
111
111
  assert.equal(
112
112
  testUtils.getAPIHistoryLength(),
113
- 36,
113
+ 38,
114
114
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
115
115
  );
116
116
  return;
@@ -159,7 +159,7 @@ describe('GENERAL', () => {
159
159
 
160
160
  assert.equal(
161
161
  testUtils.getAPIHistoryLength(),
162
- 36,
162
+ 38,
163
163
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
164
164
  );
165
165
  return;
@@ -231,7 +231,7 @@ describe('GENERAL', () => {
231
231
 
232
232
  assert.equal(
233
233
  testUtils.getAPIHistoryLength(),
234
- 84,
234
+ 86,
235
235
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
236
236
  );
237
237
  return;
@@ -296,7 +296,7 @@ describe('GENERAL', () => {
296
296
 
297
297
  assert.equal(
298
298
  testUtils.getAPIHistoryLength(),
299
- 84,
299
+ 86,
300
300
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
301
301
  );
302
302
  return;
@@ -361,7 +361,7 @@ describe('GENERAL', () => {
361
361
 
362
362
  assert.equal(
363
363
  testUtils.getAPIHistoryLength(),
364
- 84,
364
+ 86,
365
365
  'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
366
366
  );
367
367
  return;
@@ -478,7 +478,7 @@ describe('GENERAL', () => {
478
478
  );
479
479
  assert.equal(
480
480
  Object.keys(result[buName]['dataExtension']).length,
481
- 7,
481
+ 8,
482
482
  'retrieve should have returned 7 dataExtension'
483
483
  );
484
484
  assert.equal(
@@ -918,7 +918,7 @@ describe('GENERAL', () => {
918
918
  // download first before we test buildTemplate
919
919
  await handler.retrieve('testInstance/testBU');
920
920
 
921
- const expectedApiCallsRetrieve = 78;
921
+ const expectedApiCallsRetrieve = 81;
922
922
  assert.equal(
923
923
  testUtils.getAPIHistoryLength(),
924
924
  expectedApiCallsRetrieve,
@@ -1046,7 +1046,7 @@ describe('GENERAL', () => {
1046
1046
  });
1047
1047
 
1048
1048
  it('buildTemplate + buildDefinition for multiple types with keys and --dependencies and --retrieve', async () => {
1049
- const expectedApiCallsRetrieve = 82;
1049
+ const expectedApiCallsRetrieve = 85;
1050
1050
 
1051
1051
  // preparation
1052
1052
  const argvMetadata = [
@@ -1454,7 +1454,7 @@ describe('GENERAL', () => {
1454
1454
  // download everything before we test buildTemplate
1455
1455
  await handler.retrieve('testInstance/testBU');
1456
1456
 
1457
- const expectedApiCallsRetrieve = 78;
1457
+ const expectedApiCallsRetrieve = 81;
1458
1458
  assert.equal(
1459
1459
  testUtils.getAPIHistoryLength(),
1460
1460
  expectedApiCallsRetrieve,
@@ -1564,7 +1564,7 @@ describe('GENERAL', () => {
1564
1564
  });
1565
1565
 
1566
1566
  it('build multiple type with keys and --dependencies and --retrieve', async () => {
1567
- const expectedApiCallsRetrieve = 82;
1567
+ const expectedApiCallsRetrieve = 85;
1568
1568
 
1569
1569
  // preparation
1570
1570
  const argvMetadata = [
@@ -1849,7 +1849,7 @@ describe('GENERAL', () => {
1849
1849
  // download first before we test buildTemplate
1850
1850
  await handler.retrieve('testInstance/testBU');
1851
1851
 
1852
- const expectedApiCallsRetrieve = 78;
1852
+ const expectedApiCallsRetrieve = 81;
1853
1853
  assert.equal(
1854
1854
  testUtils.getAPIHistoryLength(),
1855
1855
  expectedApiCallsRetrieve,
@@ -2075,7 +2075,7 @@ describe('GENERAL', () => {
2075
2075
  assert.equal(process.exitCode, 0, 'publish should not have thrown an error');
2076
2076
  assert.deepEqual(
2077
2077
  publish['testInstance/testBU']?.journey,
2078
- ['id:3c3f4112-9b43-43ca-8a89-aa0375b2c1a2/1'],
2078
+ ['testExisting_journey_Quicksend'],
2079
2079
  'should have published the right journey'
2080
2080
  );
2081
2081
  return;
@@ -100,5 +100,5 @@
100
100
  "verification"
101
101
  ]
102
102
  },
103
- "version": "7.1.3"
103
+ "version": "7.2.0"
104
104
  }
@@ -2,6 +2,13 @@ import fs from 'fs-extra';
2
2
  import path from 'node:path';
3
3
  import { XMLParser } from 'fast-xml-parser';
4
4
  import { Util } from '../lib/util/util.js';
5
+
6
+ import { fileURLToPath } from 'node:url';
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
+ const projectRootHelper = __dirname.split(path.sep);
9
+ projectRootHelper.pop();
10
+ const projectRoot = projectRootHelper.join(path.sep) + path.sep;
11
+
5
12
  const parser = new XMLParser();
6
13
  const attributeParser = new XMLParser({ ignoreAttributes: false });
7
14
  /** @type {typeof Util.color} */
@@ -32,6 +39,7 @@ if (Util.isRunViaVSCodeExtension) {
32
39
 
33
40
  export const tWarn = `${color.bgYellow}${color.fgBlack}TEST-WARNING${color.reset}`;
34
41
  export const tError = `${color.bgRed}${color.fgBlack}TEST-ERROR${color.reset}`;
42
+
35
43
  /**
36
44
  * gets mock SOAP metadata for responding
37
45
  *
@@ -47,6 +55,7 @@ async function loadSOAPRecords(mcdevAction, type, mid, filter, QueryAllAccounts)
47
55
  const testPath = path.join('test', 'resources', mid.toString(), type, mcdevAction);
48
56
  const filterPath = getFilterPath(filter, QueryAllAccounts);
49
57
  if (await fs.pathExists(testPath + filterPath + '-response.xml')) {
58
+ console.log('loading ' + projectRoot + testPath + filterPath + '-response.xml'); // eslint-disable-line no-console
50
59
  return fs.readFile(testPath + filterPath + '-response.xml', {
51
60
  encoding: 'utf8',
52
61
  });
@@ -62,6 +71,7 @@ async function loadSOAPRecords(mcdevAction, type, mid, filter, QueryAllAccounts)
62
71
  );
63
72
  /* eslint-enable no-console */
64
73
  }
74
+ console.log('loading ' + projectRoot + testPath + '-response.xml'); // eslint-disable-line no-console
65
75
  return fs.readFile(testPath + '-response.xml', {
66
76
  encoding: 'utf8',
67
77
  });
@@ -80,6 +90,7 @@ async function loadSOAPRecords(mcdevAction, type, mid, filter, QueryAllAccounts)
80
90
  encoding: 'utf8',
81
91
  });
82
92
  }
93
+
83
94
  /**
84
95
  * helper for {@link loadSOAPRecords} to get the filter path
85
96
  *
@@ -119,6 +130,7 @@ export function filterToPath(filter, shorten) {
119
130
  }
120
131
  return '';
121
132
  }
133
+
122
134
  /**
123
135
  * helper for filterToPath
124
136
  *
@@ -155,6 +167,7 @@ function _filterToPath(filter, shorten) {
155
167
  throw new Error('unknown filter type');
156
168
  }
157
169
  }
170
+
158
171
  /**
159
172
  * based on request, respond with different soap data
160
173
  *
@@ -179,11 +192,15 @@ export const handleSOAPRequest = async (config) => {
179
192
  break;
180
193
  }
181
194
  case 'Create': {
195
+ let filter = null;
196
+ if (fullObj.Envelope.Body.CreateRequest.Objects['@_xsi:type'] === 'DataFolder') {
197
+ filter = `ContentType=${fullObj.Envelope.Body.CreateRequest.Objects.ContentType},Name=${fullObj.Envelope.Body.CreateRequest.Objects.Name},ParentFolderID=${fullObj.Envelope.Body.CreateRequest.Objects.ParentFolder.ID}`;
198
+ }
182
199
  responseXML = await loadSOAPRecords(
183
200
  config.headers.SOAPAction.toLocaleLowerCase(),
184
201
  fullObj.Envelope.Body.CreateRequest.Objects['@_xsi:type'],
185
202
  jObj.Envelope.Header.fueloauth,
186
- null
203
+ filter
187
204
  );
188
205
 
189
206
  break;
@@ -297,6 +314,12 @@ export const handleRESTRequest = async (config) => {
297
314
  if (myObj) {
298
315
  const op = simpleOperators[myObj.simpleOperator];
299
316
  filterBody = `${myObj.property}${op}${op === 'IN' ? myObj.value.join(',') : myObj.value}`;
317
+ } else if (config.url === '/email/v1/category') {
318
+ const data = JSON.parse(config.data);
319
+
320
+ filterBody = Object.keys(data)
321
+ .map((key) => `${key}=${data[key]}`)
322
+ .join(',');
300
323
  }
301
324
  }
302
325
  const testPathFilterBody = filterBody ? testPath + '-' + filterBody : null;
@@ -313,7 +336,7 @@ export const handleRESTRequest = async (config) => {
313
336
  response.count = response.items.length;
314
337
  return [200, JSON.stringify(response)];
315
338
  } else {
316
- console.log('loading ' + testPathFilter + '.json'); // eslint-disable-line no-console
339
+ console.log('loading ' + projectRoot + testPathFilter + '.json'); // eslint-disable-line no-console
317
340
  return [
318
341
  200,
319
342
  await fs.readFile(testPathFilter + '.json', {
@@ -329,7 +352,7 @@ export const handleRESTRequest = async (config) => {
329
352
  }),
330
353
  ];
331
354
  } else if (testPathFilterBody && (await fs.pathExists(testPathFilterBody + '.json'))) {
332
- console.log('loading ' + testPathFilterBody + '.json'); // eslint-disable-line no-console
355
+ console.log('loading ' + projectRoot + testPathFilterBody + '.json'); // eslint-disable-line no-console
333
356
  return [
334
357
  200,
335
358
  await fs.readFile(testPathFilterBody + '.json', {
@@ -379,7 +402,7 @@ export const handleRESTRequest = async (config) => {
379
402
  response.count = response.items.length;
380
403
  return [200, JSON.stringify(response)];
381
404
  } else {
382
- console.log('loading ' + testPath + '.json'); // eslint-disable-line no-console
405
+ console.log('loading ' + projectRoot + testPath + '.json'); // eslint-disable-line no-console
383
406
 
384
407
  return [
385
408
  200,
@@ -190,6 +190,35 @@
190
190
  <RetainUntil />
191
191
  <CategoryID>2</CategoryID>
192
192
  </Results>
193
+ <Results xsi:type="DataExtension">
194
+ <PartnerKey xsi:nil="true" />
195
+ <CreatedDate>2024-08-21T09:54:28.807</CreatedDate>
196
+ <ModifiedDate>2024-08-21T09:54:28.807</ModifiedDate>
197
+ <ObjectID>3c3a54a5-d55f-ef11-b876-f40343c95928</ObjectID>
198
+ <CustomerKey>testExisting_temail_notPublished</CustomerKey>
199
+ <Name>testExisting_temail_notPublished</Name>
200
+ <Description>Triggered Send Source Data Extension Template</Description>
201
+ <IsSendable>true</IsSendable>
202
+ <IsTestable>false</IsTestable>
203
+ <SendableDataExtensionField>
204
+ <PartnerKey xsi:nil="true" />
205
+ <ObjectID xsi:nil="true" />
206
+ <Name>SubscriberKey</Name>
207
+ </SendableDataExtensionField>
208
+ <SendableSubscriberField>
209
+ <Name>_SubscriberKey</Name>
210
+ </SendableSubscriberField>
211
+ <Template>
212
+ <PartnerKey xsi:nil="true" />
213
+ <ObjectID xsi:nil="true" />
214
+ <CustomerKey>B6E8AE4C-3D93-49B1-B299-E0AE734213DD</CustomerKey>
215
+ </Template>
216
+ <RowBasedRetention>false</RowBasedRetention>
217
+ <ResetRetentionPeriodOnImport>false</ResetRetentionPeriodOnImport>
218
+ <DeleteAtEndOfRetentionPeriod>false</DeleteAtEndOfRetentionPeriod>
219
+ <RetainUntil />
220
+ <CategoryID>2</CategoryID>
221
+ </Results>
193
222
  </RetrieveResponseMsg>
194
223
  </soap:Body>
195
224
  </soap:Envelope>