mcdev 5.0.2 → 5.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 (237) hide show
  1. package/.coverage-comment-template.svelte +177 -161
  2. package/.eslintrc.json +4 -4
  3. package/.github/ISSUE_TEMPLATE/bug.yml +2 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +2 -2
  5. package/.github/dependabot.yml +8 -0
  6. package/.github/workflows/coverage-base-update.yml +6 -2
  7. package/.github/workflows/coverage-develop-branch.yml +7 -8
  8. package/.github/workflows/coverage-main-branch.yml +7 -8
  9. package/.github/workflows/coverage.yml +7 -4
  10. package/.husky/post-checkout +4 -2
  11. package/.husky/post-merge +1 -0
  12. package/.vscode/extensions.json +4 -0
  13. package/docs/dist/documentation.md +756 -294
  14. package/lib/Deployer.js +28 -28
  15. package/lib/MetadataTypeDefinitions.js +1 -1
  16. package/lib/MetadataTypeInfo.js +1 -1
  17. package/lib/Retriever.js +1 -1
  18. package/lib/cli.js +184 -6
  19. package/lib/index.js +493 -22
  20. package/lib/metadataTypes/Asset.js +10 -11
  21. package/lib/metadataTypes/AttributeGroup.js +76 -2
  22. package/lib/metadataTypes/AttributeSet.js +260 -0
  23. package/lib/metadataTypes/Automation.js +771 -247
  24. package/lib/metadataTypes/DataExtension.js +7 -7
  25. package/lib/metadataTypes/DataExtensionField.js +1 -1
  26. package/lib/metadataTypes/Event.js +2 -3
  27. package/lib/metadataTypes/Folder.js +1 -1
  28. package/lib/metadataTypes/Journey.js +5 -6
  29. package/lib/metadataTypes/MetadataType.js +187 -60
  30. package/lib/metadataTypes/MobileKeyword.js +8 -8
  31. package/lib/metadataTypes/MobileMessage.js +5 -5
  32. package/lib/metadataTypes/Query.js +47 -5
  33. package/lib/metadataTypes/Script.js +3 -3
  34. package/lib/metadataTypes/TransactionalSMS.js +5 -5
  35. package/lib/metadataTypes/TriggeredSend.js +25 -50
  36. package/lib/metadataTypes/User.js +7 -4
  37. package/lib/metadataTypes/definitions/Asset.definition.js +1 -0
  38. package/lib/metadataTypes/definitions/AttributeGroup.definition.js +117 -106
  39. package/lib/metadataTypes/definitions/{SetDefinition.definition.js → AttributeSet.definition.js} +54 -27
  40. package/lib/metadataTypes/definitions/Automation.definition.js +74 -21
  41. package/lib/metadataTypes/definitions/DataExtension.definition.js +1 -0
  42. package/lib/metadataTypes/definitions/DataExtract.definition.js +1 -0
  43. package/lib/metadataTypes/definitions/EmailSend.definition.js +1 -0
  44. package/lib/metadataTypes/definitions/Event.definition.js +1 -0
  45. package/lib/metadataTypes/definitions/Filter.definition.js +1 -0
  46. package/lib/metadataTypes/definitions/ImportFile.definition.js +37 -6
  47. package/lib/metadataTypes/definitions/MobileKeyword.definition.js +1 -0
  48. package/lib/metadataTypes/definitions/Query.definition.js +1 -0
  49. package/lib/metadataTypes/definitions/Role.definition.js +1 -0
  50. package/lib/metadataTypes/definitions/TriggeredSend.definition.js +2 -0
  51. package/lib/metadataTypes/definitions/User.definition.js +1 -0
  52. package/lib/util/cache.js +9 -4
  53. package/lib/util/cli.js +40 -0
  54. package/lib/util/devops.js +13 -11
  55. package/lib/util/file.js +2 -2
  56. package/lib/util/init.js +84 -0
  57. package/lib/util/util.js +268 -137
  58. package/package.json +11 -11
  59. package/test/general.test.js +26 -0
  60. package/test/mockRoot/.mcdevrc.json +1 -1
  61. package/test/mockRoot/deploy/testInstance/testBU/automation/testExisting_automation.automation-meta.json +52 -0
  62. package/test/mockRoot/deploy/testInstance/testBU/automation/testNew_automation.automation-meta.json +45 -0
  63. package/test/mockRoot/deploy/testInstance/testBU/dataExtract/testExisting_dataExtract.dataExtract-meta.json +35 -0
  64. package/test/mockRoot/deploy/testInstance/testBU/dataExtract/testNew_dataExtract.dataExtract-meta.json +35 -0
  65. package/test/mockRoot/deploy/testInstance/testBU/fileTransfer/testExisting_fileTransfer.fileTransfer-meta.json +17 -0
  66. package/test/mockRoot/deploy/testInstance/testBU/fileTransfer/testNew_fileTransfer.fileTransfer-meta.json +17 -0
  67. package/test/mockRoot/deploy/testInstance/testBU/importFile/testExisting_importFile.importFile-meta.json +29 -0
  68. package/test/mockRoot/deploy/testInstance/testBU/importFile/testNew_importFile.importFile-meta.json +29 -0
  69. package/test/mockRoot/deploy/testInstance/testBU/query/{testExistingQuery.query-meta.json → testExisting_query.query-meta.json} +2 -2
  70. package/test/mockRoot/deploy/testInstance/testBU/query/testExisting_query_fixKeys.query-meta.json +11 -0
  71. package/test/mockRoot/deploy/testInstance/testBU/query/testExisting_query_fixKeys.query-meta.sql +6 -0
  72. package/test/mockRoot/deploy/testInstance/testBU/query/{testNewQuery.query-meta.json → testNew_query.query-meta.json} +2 -2
  73. package/test/mockRoot/deploy/testInstance/testBU/script/testExisting_script.script-meta.json +6 -0
  74. package/test/mockRoot/deploy/testInstance/testBU/script/testExisting_script.script-meta.ssjs +1 -0
  75. package/test/mockRoot/deploy/testInstance/testBU/script/testNew_script.script-meta.json +6 -0
  76. package/test/mockRoot/deploy/testInstance/testBU/script/testNew_script.script-meta.ssjs +1 -0
  77. package/test/mockRoot/deploy/testInstance/testBU/triggeredSend/testExisting_triggeredSend.triggeredSend-meta.json +29 -0
  78. package/test/mockRoot/deploy/testInstance/testBU/triggeredSend/testNew_triggeredSend.triggeredSend-meta.json +29 -0
  79. package/test/resourceFactory.js +132 -24
  80. package/test/resources/1111111/accountUser/retrieve-ActiveFlag=falseANDCustomerKey=testExisting_userANDEmaillike@-response.xml +27 -0
  81. package/test/resources/1111111/accountUser/retrieve-ActiveFlag=falseANDEmaillike@-response.xml +156 -0
  82. package/test/resources/1111111/accountUser/retrieve-ActiveFlag=trueANDEmailisNullORNamelikeapp userANDMustChangePassword=false-response.xml +87 -0
  83. package/test/resources/1111111/accountUser/retrieve-ActiveFlag=trueANDEmaillike@-response.xml +156 -0
  84. package/test/resources/1111111/accountUser/retrieve-CustomerKey=testExisting_userANDActiveFlag=trueANDEmailisNullORNamelikeapp userANDMustChangePassword=false-response.xml +27 -0
  85. package/test/resources/1111111/accountUserAccount/retrieve-AccountUser.AccountUserID=700301950-response.xml +60 -0
  86. package/test/resources/1111111/user/retrieve-expected.md +4 -2
  87. package/test/resources/9999999/attributeGroup/retrieve-expected.json +25 -0
  88. package/test/resources/9999999/attributeSet/retrieve-expected.json +748 -0
  89. package/test/resources/9999999/automation/build-expected.json +57 -0
  90. package/test/resources/9999999/automation/create-expected.json +45 -0
  91. package/test/resources/9999999/automation/create-testNew_automation-expected.md +28 -0
  92. package/test/resources/9999999/automation/delete-response.xml +40 -0
  93. package/test/resources/9999999/automation/patch_fixKeys-pause-expected.json +44 -0
  94. package/test/resources/9999999/automation/patch_fixKeys-schedule-expected.json +44 -0
  95. package/test/resources/9999999/automation/perform-08afb0e2-b00a-4c88-ad2e-1f7f8788c560-response.xml +42 -0
  96. package/test/resources/9999999/automation/perform-08afb0e2-b00a-4c88-fixKey_pause-response.xml +42 -0
  97. package/test/resources/9999999/automation/perform-08afb0e2-b00a-4c88-fixKey_schedule-response.xml +42 -0
  98. package/test/resources/9999999/automation/perform-a8afb0e2-b00a-4c88-ad2e-1f7f8788c560-response.xml +42 -0
  99. package/test/resources/9999999/automation/retrieve-expected.json +57 -0
  100. package/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md +30 -0
  101. package/test/resources/9999999/automation/schedule-08afb0e2-b00a-4c88-ad2e-1f7f8788c560-response.xml +52 -0
  102. package/test/resources/9999999/automation/schedule-08afb0e2-b00a-4c88-ad2e-pause-response.xml +38 -0
  103. package/test/resources/9999999/automation/schedule-08afb0e2-b00a-4c88-fixKey_pause-response.xml +52 -0
  104. package/test/resources/9999999/automation/schedule-08afb0e2-b00a-4c88-fixKey_schedule-response.xml +52 -0
  105. package/test/resources/9999999/automation/schedule-a8afb0e2-b00a-4c88-ad2e-1f7f8788c560-response.xml +52 -0
  106. package/test/resources/9999999/automation/template-expected.json +57 -0
  107. package/test/resources/9999999/automation/update-expected.json +45 -0
  108. package/test/resources/9999999/automation/update-testExisting_automation-expected.md +28 -0
  109. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json +85 -0
  110. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/patch-response.json +85 -0
  111. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-pause/get-response.json +85 -0
  112. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-pause/patch-response.json +85 -0
  113. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-fixKey_pause/get-response.json +85 -0
  114. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-fixKey_pause/patch-response.json +85 -0
  115. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-fixKey_schedule/get-response.json +85 -0
  116. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-fixKey_schedule/patch-response.json +85 -0
  117. package/test/resources/9999999/automation/v1/automations/a8afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json +85 -0
  118. package/test/resources/9999999/automation/v1/automations/post-response.json +86 -0
  119. package/test/resources/9999999/automation/v1/dataextracts/56c5370a-f988-4f36-b0ee-0f876573f6d7/get-response.json +38 -0
  120. package/test/resources/9999999/automation/v1/dataextracts/56c5370a-f988-4f36-b0ee-0f876573f6d7/patch-response.json +38 -0
  121. package/test/resources/9999999/automation/v1/dataextracts/get-response.json +20 -0
  122. package/test/resources/9999999/automation/v1/dataextracts/post-response.json +38 -0
  123. package/test/resources/9999999/automation/v1/dataextracttypes/get-response.json +50 -0
  124. package/test/resources/9999999/automation/v1/filetransfers/72c328ac-f5b0-4e37-91d3-a775666f15a6/get-response.json +18 -0
  125. package/test/resources/9999999/automation/v1/filetransfers/72c328ac-f5b0-4e37-91d3-a775666f15a6/patch-response.json +18 -0
  126. package/test/resources/9999999/automation/v1/filetransfers/get-response.json +15 -0
  127. package/test/resources/9999999/automation/v1/filetransfers/post-response.json +18 -0
  128. package/test/resources/9999999/automation/v1/ftplocations/get-response.json +18 -0
  129. package/test/resources/9999999/automation/v1/imports/9d16f42c-2260-ed11-b849-48df37d1de8b/patch-response.json +31 -0
  130. package/test/resources/9999999/automation/v1/imports/get-response.json +38 -0
  131. package/test/resources/9999999/automation/v1/imports/post-response.json +30 -0
  132. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dae/actions/start/post-response.txt +1 -0
  133. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/actions/start/post-response.txt +1 -0
  134. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/get-response.json +2 -2
  135. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/patch-response.json +2 -2
  136. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat_fixKeys/get-response.json +17 -0
  137. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat_fixKeys/patch-response.json +18 -0
  138. package/test/resources/9999999/automation/v1/queries/get-response.json +22 -5
  139. package/test/resources/9999999/automation/v1/queries/post-response.json +2 -2
  140. package/test/resources/9999999/automation/v1/scripts/39f6a488-20eb-4ba0-b0b9-023725b574e4/patch-response.json +10 -0
  141. package/test/resources/9999999/automation/v1/scripts/get-response.json +27 -0
  142. package/test/resources/9999999/automation/v1/scripts/post-response.json +10 -0
  143. package/test/resources/9999999/dataExtension/retrieve-Name=testExisting_dataExtension-response.xml +52 -0
  144. package/test/resources/9999999/dataExtensionField/retrieve-DataExtension.CustomerKey=testExisting_dataExtension-response.xml +98 -0
  145. package/test/resources/9999999/dataExtensionField/retrieve-DataExtension.CustomerKey=testNew_dataExtensionORDataExtension.CustomerKey=testExisting_dataExtension-response.xml +99 -0
  146. package/test/resources/9999999/dataExtract/build-expected.json +35 -0
  147. package/test/resources/9999999/dataExtract/get-expected.json +39 -0
  148. package/test/resources/9999999/dataExtract/patch-expected.json +37 -0
  149. package/test/resources/9999999/dataExtract/post-expected.json +37 -0
  150. package/test/resources/9999999/dataExtract/template-expected.json +35 -0
  151. package/test/resources/9999999/dataFolder/retrieve-ContentType=automations-response.xml +48 -0
  152. package/test/resources/9999999/dataFolder/retrieve-ContentType=contextual_suppression_listORContentType=publicationORContentType=suppression_listORContentType=mysubsORContentType=list-response.xml +136 -0
  153. package/test/resources/9999999/dataFolder/retrieve-ContentType=queryactivity-response.xml +48 -0
  154. package/test/resources/9999999/dataFolder/retrieve-ContentType=ssjsactivity-response.xml +48 -0
  155. package/test/resources/9999999/dataFolder/retrieve-ContentType=triggered_send_journeybuilderORContentType=triggered_sendORContentType=hidden-response.xml +276 -0
  156. package/test/resources/9999999/dataFolder/retrieve-response.xml +45 -0
  157. package/test/resources/9999999/email/retrieve-response.xml +203 -0
  158. package/test/resources/9999999/emailSendDefinition/retrieve-IsPlatformObject=falseANDDescriptionnotEqualsSFSendDefinition-response.xml +85 -0
  159. package/test/resources/9999999/fileTransfer/build-expected.json +15 -0
  160. package/test/resources/9999999/fileTransfer/get-expected.json +17 -0
  161. package/test/resources/9999999/fileTransfer/patch-expected.json +17 -0
  162. package/test/resources/9999999/fileTransfer/post-expected.json +17 -0
  163. package/test/resources/9999999/fileTransfer/template-expected.json +15 -0
  164. package/test/resources/9999999/hub/v1/contacts/schema/attributeGroups/get-response.json +585 -0
  165. package/test/resources/9999999/hub/v1/contacts/schema/setDefinitions/get-response.json +19807 -0
  166. package/test/resources/9999999/importFile/build-expected.json +27 -0
  167. package/test/resources/9999999/importFile/get-expected.json +29 -0
  168. package/test/resources/9999999/importFile/patch-expected.json +29 -0
  169. package/test/resources/9999999/importFile/post-expected.json +29 -0
  170. package/test/resources/9999999/importFile/template-expected.json +27 -0
  171. package/test/resources/9999999/legacy/v1/beta/automations/notifications/RkpOcE9qSVh2VUdnYTVJbWFfWW14dzoyNTow/get-response.json +21 -0
  172. package/test/resources/9999999/legacy/v1/beta/automations/notifications/RkpOcE9qSVh2VUdnYTVJbWFfWW14dzoyNTow/post-response.json +0 -0
  173. package/test/resources/9999999/legacy/v1/beta/bulk/automations/automation/definition/get-response.json +30 -0
  174. package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation-response.xml +30 -0
  175. package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_fixKey_pause-response.xml +32 -0
  176. package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_fixKey_schedule-response.xml +32 -0
  177. package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_fixedKey_paused-response.xml +32 -0
  178. package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_fixedKey_scheduled-response.xml +32 -0
  179. package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation_pause-response.xml +30 -0
  180. package/test/resources/9999999/program/retrieve-CustomerKey=testNew_automation-response.xml +30 -0
  181. package/test/resources/9999999/program/retrieve-Name=testExisting_automation-response.xml +31 -0
  182. package/test/resources/9999999/program/retrieve-response.xml +50 -0
  183. package/test/resources/9999999/query/build-expected.json +2 -2
  184. package/test/resources/9999999/query/get-expected.json +2 -2
  185. package/test/resources/9999999/query/get2-expected.json +2 -2
  186. package/test/resources/9999999/query/patch-expected.json +2 -2
  187. package/test/resources/9999999/query/patch_fixKeys-expected.json +11 -0
  188. package/test/resources/9999999/query/patch_fixKeys-expected.sql +6 -0
  189. package/test/resources/9999999/query/post-expected.json +2 -2
  190. package/test/resources/9999999/query/template-expected.json +2 -2
  191. package/test/resources/9999999/queryDefinition/retrieve-CustomerKey=testExisting_query_fixKeysANDStatus=Active-response.xml +30 -0
  192. package/test/resources/9999999/queryDefinition/retrieve-CustomerKey=testExisting_query_fixedKeysANDStatus=Active-response.xml +30 -0
  193. package/test/resources/9999999/queryDefinition/retrieve-CustomerKey=testNew_queryANDStatus=Active-response.xml +30 -0
  194. package/test/resources/9999999/script/build-expected.json +6 -0
  195. package/test/resources/9999999/script/build-expected.ssjs +1 -0
  196. package/test/resources/9999999/script/get-expected.json +8 -0
  197. package/test/resources/9999999/script/get-expected.ssjs +1 -0
  198. package/test/resources/9999999/script/get_noScriptTag-expected.html +1 -0
  199. package/test/resources/9999999/script/get_noScriptTag-expected.json +8 -0
  200. package/test/resources/9999999/script/patch-expected.json +8 -0
  201. package/test/resources/9999999/script/patch-expected.ssjs +1 -0
  202. package/test/resources/9999999/script/post-expected.json +8 -0
  203. package/test/resources/9999999/script/post-expected.ssjs +1 -0
  204. package/test/resources/9999999/script/template-expected.json +6 -0
  205. package/test/resources/9999999/script/template-expected.ssjs +1 -0
  206. package/test/resources/9999999/triggeredSend/build-expected.json +29 -0
  207. package/test/resources/9999999/triggeredSend/get-expected.json +29 -0
  208. package/test/resources/9999999/triggeredSend/patch-expected.json +29 -0
  209. package/test/resources/9999999/triggeredSend/post-expected.json +29 -0
  210. package/test/resources/9999999/triggeredSend/template-expected.json +29 -0
  211. package/test/resources/9999999/triggeredSendDefinition/create-response.xml +75 -0
  212. package/test/resources/9999999/triggeredSendDefinition/delete-response.xml +36 -0
  213. package/test/resources/9999999/triggeredSendDefinition/{retrieve-response.xml → retrieve-TriggeredSendStatusINNew,Active,Inactive,Moved,Canceled-response.xml} +4 -4
  214. package/test/resources/9999999/triggeredSendDefinition/update-response.xml +74 -0
  215. package/test/type.attributeGroup.test.js +55 -0
  216. package/test/type.attributeSet.test.js +55 -0
  217. package/test/type.automation.test.js +886 -0
  218. package/test/type.dataExtension.test.js +3 -1
  219. package/test/type.dataExtract.test.js +187 -0
  220. package/test/type.fileTransfer.test.js +185 -0
  221. package/test/type.importFile.test.js +186 -0
  222. package/test/type.mobileKeyword.test.js +0 -1
  223. package/test/type.query.test.js +497 -33
  224. package/test/type.script.test.js +367 -0
  225. package/test/type.triggeredSend.test.js +152 -0
  226. package/test/type.user.test.js +37 -11
  227. package/test/utils.js +10 -6
  228. package/.coverage-comment-template.md +0 -20
  229. package/lib/metadataTypes/SetDefinition.js +0 -37
  230. /package/test/mockRoot/deploy/testInstance/testBU/query/{testExistingQuery.query-meta.sql → testExisting_query.query-meta.sql} +0 -0
  231. /package/test/mockRoot/deploy/testInstance/testBU/query/{testNewQuery.query-meta.sql → testNew_query.query-meta.sql} +0 -0
  232. /package/test/resources/1111111/accountUser/{retrieve-response.xml → retrieve-ActiveFlag=trueANDCustomerKey=testExisting_userANDEmaillike@-response.xml} +0 -0
  233. /package/test/resources/1111111/accountUserAccount/{retrieve-response.xml → retrieve-AccountUser.AccountUserIDIN700301950,700301951,7471228-response.xml} +0 -0
  234. /package/test/resources/1111111/businessUnit/{retrieve-response.xml → retrieve-ID=1111111-response.xml} +0 -0
  235. /package/test/resources/1111111/list/{retrieve-response.xml → retrieve-CustomerKey=All SubscribersORListName=All Subscribers-response.xml} +0 -0
  236. /package/test/resources/1111111/role/{retrieve-response.xml → retrieve-IsPrivate=false-response.xml} +0 -0
  237. /package/test/resources/9999999/queryDefinition/{retrieve-response.xml → retrieve-CustomerKey=testExisting_queryANDStatus=Active-response.xml} +0 -0
@@ -0,0 +1,52 @@
1
+ {
2
+ "description": "updated on deploy",
3
+ "key": "testExisting_automation",
4
+ "name": "testExisting_automation",
5
+ "r__folder_Path": "my automations",
6
+ "schedule": {
7
+ "endDate": "2022-07-30T00:00:00",
8
+ "icalRecur": "FREQ=DAILY;COUNT=1;INTERVAL=1",
9
+ "startDate": "2022-07-30T00:00:00",
10
+ "timezoneName": "W. Europe Standard Time"
11
+ },
12
+ "status": "PausedSchedule",
13
+ "steps": [
14
+ {
15
+ "activities": [
16
+ {
17
+ "name": "testExisting_dataExtract",
18
+ "r__type": "dataExtract"
19
+ },
20
+ {
21
+ "name": "testExisting_emailSend",
22
+ "r__type": "emailSend"
23
+ },
24
+ {
25
+ "name": "testExisting_fileTransfer",
26
+ "r__type": "fileTransfer"
27
+ },
28
+ {
29
+ "name": "testExisting_importFile",
30
+ "r__type": "importFile"
31
+ },
32
+ {
33
+ "name": "testExisting_query",
34
+ "r__type": "query"
35
+ },
36
+ {
37
+ "name": "testExisting_script",
38
+ "r__type": "script"
39
+ }
40
+ ],
41
+ "name": ""
42
+ }
43
+ ],
44
+ "notifications": [
45
+ {
46
+ "email": ["error-updated@test.accenture.com"],
47
+ "message": "test updated",
48
+ "type": "Error"
49
+ }
50
+ ],
51
+ "type": "scheduled"
52
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "description": "created on deploy",
3
+ "key": "testNew_automation",
4
+ "name": "testNew_automation",
5
+ "r__folder_Path": "my automations",
6
+ "schedule": {
7
+ "startDate": "2020-05-14T02:30:32.11",
8
+ "endDate": "2079-06-06T21:00:00",
9
+ "icalRecur": "FREQ=MINUTELY;UNTIL=20790607T050000;INTERVAL=5",
10
+ "timezoneName": "W. Europe Standard Time"
11
+ },
12
+ "status": "Scheduled",
13
+ "steps": [
14
+ {
15
+ "activities": [
16
+ {
17
+ "name": "testExisting_dataExtract",
18
+ "r__type": "dataExtract"
19
+ },
20
+ {
21
+ "name": "testExisting_emailSend",
22
+ "r__type": "emailSend"
23
+ },
24
+ {
25
+ "name": "testExisting_fileTransfer",
26
+ "r__type": "fileTransfer"
27
+ },
28
+ {
29
+ "name": "testExisting_importFile",
30
+ "r__type": "importFile"
31
+ },
32
+ {
33
+ "name": "testExisting_query",
34
+ "r__type": "query"
35
+ },
36
+ {
37
+ "name": "testExisting_script",
38
+ "r__type": "script"
39
+ }
40
+ ],
41
+ "name": ""
42
+ }
43
+ ],
44
+ "type": "scheduled"
45
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "testExisting_dataExtract",
3
+ "key": "testExisting_dataExtract",
4
+ "description": "updated on deploy",
5
+ "r__dataExtractType_name": "Data Extension Extract",
6
+ "fileSpec": "testExisting-%%Year%%-%%Month%%-%%Day%%",
7
+ "intervalType": 0,
8
+ "dataFields": [
9
+ {
10
+ "name": "ColumnDelimiter",
11
+ "type": "string",
12
+ "value": ","
13
+ },
14
+ {
15
+ "name": "DECustomerKey",
16
+ "type": "string",
17
+ "value": "testExisting_dataExtension"
18
+ },
19
+ {
20
+ "name": "HasColumnHeaders",
21
+ "type": "bool",
22
+ "value": "False"
23
+ },
24
+ {
25
+ "name": "TextQualified",
26
+ "type": "bool",
27
+ "value": "False"
28
+ },
29
+ {
30
+ "name": "UsesLineFeed",
31
+ "type": "bool",
32
+ "value": "False"
33
+ }
34
+ ]
35
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "testNew_dataExtract",
3
+ "key": "testNew_dataExtract",
4
+ "description": "created via deploy",
5
+ "r__dataExtractType_name": "Data Extension Extract",
6
+ "fileSpec": "testNew-%%Year%%-%%Month%%-%%Day%%",
7
+ "intervalType": 0,
8
+ "dataFields": [
9
+ {
10
+ "name": "ColumnDelimiter",
11
+ "type": "string",
12
+ "value": ","
13
+ },
14
+ {
15
+ "name": "DECustomerKey",
16
+ "type": "string",
17
+ "value": "testExisting_dataExtension"
18
+ },
19
+ {
20
+ "name": "HasColumnHeaders",
21
+ "type": "bool",
22
+ "value": "False"
23
+ },
24
+ {
25
+ "name": "TextQualified",
26
+ "type": "bool",
27
+ "value": "False"
28
+ },
29
+ {
30
+ "name": "UsesLineFeed",
31
+ "type": "bool",
32
+ "value": "False"
33
+ }
34
+ ]
35
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "createdDate": "2022-11-09T05:31:56.477",
3
+ "customerKey": "testExisting_fileTransfer",
4
+ "description": "17.11.2022",
5
+ "fileSpec": "%%Year%% updated via deploy",
6
+ "isCompressed": false,
7
+ "isEncrypted": false,
8
+ "isFileSpecLocalized": false,
9
+ "isPgp": false,
10
+ "isUpload": true,
11
+ "maxFileAge": 0,
12
+ "maxFileAgeScheduleOffset": 0,
13
+ "maxImportFrequency": 0,
14
+ "modifiedDate": "2022-11-17T07:13:20.05",
15
+ "name": "testExisting_fileTransfer",
16
+ "r__fileLocation_name": "ExactTarget Enhanced FTP"
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "createdDate": "2022-11-09T05:31:56.477",
3
+ "customerKey": "testNew_fileTransfer",
4
+ "description": "17.11.2022",
5
+ "fileSpec": "%%Year%% created on deploy",
6
+ "isCompressed": false,
7
+ "isEncrypted": false,
8
+ "isFileSpecLocalized": false,
9
+ "isPgp": false,
10
+ "isUpload": true,
11
+ "maxFileAge": 0,
12
+ "maxFileAgeScheduleOffset": 0,
13
+ "maxImportFrequency": 0,
14
+ "modifiedDate": "2022-11-17T07:13:20.05",
15
+ "name": "testNew_fileTransfer",
16
+ "r__fileLocation_name": "ExactTarget Enhanced FTP"
17
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "allowErrors": true,
3
+ "createdDate": "2022-11-09T05:32:30.533",
4
+ "customerKey": "testExisting_importFile",
5
+ "dateFormatLocale": "en-US",
6
+ "deleteFile": false,
7
+ "description": "updated on deploy",
8
+ "fieldMappingType": "InferFromColumnHeadings",
9
+ "fieldMappings": [],
10
+ "fileNamingPattern": "blabla",
11
+ "fileTransferLocationTypeId": 0,
12
+ "fileType": "CSV",
13
+ "filter": "",
14
+ "hasColumnHeader": true,
15
+ "isOrderedImport": true,
16
+ "isSequential": true,
17
+ "maxFileAgeHours": 0,
18
+ "maxFileAgeScheduleOffsetHours": 0,
19
+ "maxImportFrequencyHours": 0,
20
+ "modifiedDate": "2022-11-17T07:13:03.95",
21
+ "name": "testExisting_importFile",
22
+ "sendEmailNotification": false,
23
+ "standardQuotedStrings": true,
24
+ "r__fileLocation_name": "ExactTarget Enhanced FTP",
25
+ "c__destinationType": "DataExtension",
26
+ "r__dataExtension_CustomerKey": "testExisting_dataExtension",
27
+ "c__subscriberImportType": "DataExtension",
28
+ "c__dataAction": "AddUpdate"
29
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "allowErrors": true,
3
+ "createdDate": "2022-11-09T05:32:30.533",
4
+ "customerKey": "testNew_importFile",
5
+ "dateFormatLocale": "en-US",
6
+ "deleteFile": false,
7
+ "description": "created via deploy",
8
+ "fieldMappingType": "InferFromColumnHeadings",
9
+ "fieldMappings": [],
10
+ "fileNamingPattern": "blabla",
11
+ "fileTransferLocationTypeId": 0,
12
+ "fileType": "CSV",
13
+ "filter": "",
14
+ "hasColumnHeader": true,
15
+ "isOrderedImport": true,
16
+ "isSequential": true,
17
+ "maxFileAgeHours": 0,
18
+ "maxFileAgeScheduleOffsetHours": 0,
19
+ "maxImportFrequencyHours": 0,
20
+ "modifiedDate": "2022-11-17T07:13:03.95",
21
+ "name": "testNew_importFile",
22
+ "sendEmailNotification": false,
23
+ "standardQuotedStrings": true,
24
+ "r__fileLocation_name": "ExactTarget Enhanced FTP",
25
+ "c__destinationType": "DataExtension",
26
+ "r__dataExtension_CustomerKey": "testExisting_dataExtension",
27
+ "c__subscriberImportType": "DataExtension",
28
+ "c__dataAction": "AddUpdate"
29
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "testExistingQuery",
3
- "key": "testExistingQuery",
2
+ "name": "testExisting_query",
3
+ "key": "testExisting_query",
4
4
  "description": "updated on deploy",
5
5
  "targetKey": "testExisting_dataExtension",
6
6
  "createdDate": "2022-04-26T15:21:16.453",
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "testExisting_query_fixedKeys",
3
+ "key": "testExisting_query_fixKeys",
4
+ "description": "updated on deploy",
5
+ "targetKey": "testExisting_dataExtension",
6
+ "createdDate": "2022-04-26T15:21:16.453",
7
+ "modifiedDate": "2022-04-26T16:04:15.88",
8
+ "targetUpdateTypeName": "Overwrite",
9
+ "isFrozen": false,
10
+ "r__folder_Path": "Query"
11
+ }
@@ -0,0 +1,6 @@
1
+ SELECT
2
+ SubscriberKey as testField
3
+ FROM
4
+ _Subscribers
5
+ WHERE
6
+ country IN ('test')
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "testNewQuery",
3
- "key": "testNewQuery",
2
+ "name": "testNew_query",
3
+ "key": "testNew_query",
4
4
  "description": "created on deploy",
5
5
  "targetKey": "testExisting_dataExtension",
6
6
  "createdDate": "2022-04-26T15:21:16.453",
@@ -0,0 +1,6 @@
1
+ {
2
+ "description": "updated on deploy",
3
+ "key": "testExisting_script",
4
+ "name": "testExisting_script",
5
+ "r__folder_Path": "Scripts"
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "description": "created on deploy",
3
+ "key": "testNew_script",
4
+ "name": "testNew_script",
5
+ "r__folder_Path": "Scripts"
6
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "AllowedSlots": 0,
3
+ "AutoAddSubscribers": false,
4
+ "AutoUpdateSubscribers": false,
5
+ "BatchInterval": 0,
6
+ "BccEmail": "",
7
+ "CreatedDate": "2018-06-25T05:58:00",
8
+ "CustomerKey": "testExisting_triggeredSend",
9
+ "Description": "updated on deploy",
10
+ "DynamicEmailSubject": "You are successfully unsubscribed",
11
+ "EmailSubject": "You are successfully unsubscribed",
12
+ "FromAddress": "unsubscribe@emails.mcdev.accenture.com",
13
+ "FromName": "unsubscribe",
14
+ "IsMultipart": false,
15
+ "IsWrapped": true,
16
+ "Keyword": "",
17
+ "ModifiedDate": "2018-06-25T05:58:00",
18
+ "Name": "testExisting_triggeredSend",
19
+ "NewSlotTrigger": 0,
20
+ "Priority": 4,
21
+ "SendClassification": {
22
+ "CustomerKey": "Default Transactional"
23
+ },
24
+ "SuppressTracking": false,
25
+ "TriggeredSendStatus": "New",
26
+ "TriggeredSendType": "Continuous",
27
+ "r__email_Name": "Sporting Goods for September",
28
+ "r__folder_Path": "Triggered Sends"
29
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "AllowedSlots": 0,
3
+ "AutoAddSubscribers": false,
4
+ "AutoUpdateSubscribers": false,
5
+ "BatchInterval": 0,
6
+ "BccEmail": "",
7
+ "CreatedDate": "2018-06-25T05:58:00",
8
+ "CustomerKey": "testNew_triggeredSend",
9
+ "Description": "created on deploy",
10
+ "DynamicEmailSubject": "You are successfully unsubscribed",
11
+ "EmailSubject": "You are successfully unsubscribed",
12
+ "FromAddress": "unsubscribe@emails.mcdev.accenture.com",
13
+ "FromName": "unsubscribe",
14
+ "IsMultipart": false,
15
+ "IsWrapped": true,
16
+ "Keyword": "",
17
+ "ModifiedDate": "2018-06-25T05:58:00",
18
+ "Name": "testNew_triggeredSend",
19
+ "NewSlotTrigger": 0,
20
+ "Priority": 4,
21
+ "SendClassification": {
22
+ "CustomerKey": "Default Transactional"
23
+ },
24
+ "SuppressTracking": false,
25
+ "TriggeredSendStatus": "New",
26
+ "TriggeredSendType": "Continuous",
27
+ "r__email_Name": "Sporting Goods for September",
28
+ "r__folder_Path": "Triggered Sends"
29
+ }
@@ -1,42 +1,107 @@
1
1
  const fs = require('fs-extra');
2
2
  const path = require('node:path');
3
3
  const { XMLParser } = require('fast-xml-parser');
4
- const { color } = require('../lib/util/util');
4
+ const Util = require('../lib/util/util');
5
5
  const parser = new XMLParser();
6
6
  const attributeParser = new XMLParser({ ignoreAttributes: false });
7
+ let color;
8
+
9
+ /* eslint-disable unicorn/prefer-ternary */
10
+ if (
11
+ process.env.VSCODE_AMD_ENTRYPOINT === 'vs/workbench/api/node/extensionHostProcess' ||
12
+ process.env.VSCODE_CRASH_REPORTER_PROCESS_TYPE === 'extensionHost'
13
+ ) {
14
+ // when we execute the test in a VSCode extension host, we don't want CLI color codes.
15
+ color = new Proxy(
16
+ {},
17
+ {
18
+ /**
19
+ * catch-all for color
20
+ *
21
+ * @returns {string} empty string
22
+ */
23
+ get() {
24
+ return '';
25
+ },
26
+ }
27
+ );
28
+ } else {
29
+ // test is executed directly in a command prompt. Use colors.
30
+ color = Util.color;
31
+ }
32
+ /* eslint-enable unicorn/prefer-ternary */
33
+
7
34
  /**
8
35
  * gets mock SOAP metadata for responding
9
36
  *
10
37
  * @param {string} mcdevAction SOAP action
11
38
  * @param {string} type metadata Type
12
39
  * @param {string} mid of Business Unit
40
+ * @param {object|string} filter likely for customer key
13
41
  * @returns {string} relevant metadata stringified
14
42
  */
15
- exports.loadSOAPRecords = async (mcdevAction, type, mid) => {
43
+ exports.loadSOAPRecords = async (mcdevAction, type, mid, filter) => {
16
44
  type = type[0].toLowerCase() + type.slice(1);
17
- const testPath = path.join(
18
- 'test',
19
- 'resources',
20
- mid.toString(),
21
- type,
22
- mcdevAction + '-response.xml'
23
- );
24
- if (await fs.pathExists(testPath)) {
25
- return fs.readFile(testPath, {
45
+ const testPath = path.join('test', 'resources', mid.toString(), type, mcdevAction);
46
+ const filterPath =
47
+ typeof filter === 'string' && filter ? '-' + filter : this.filterToPath(filter);
48
+ if (await fs.pathExists(testPath + filterPath + '-response.xml')) {
49
+ return fs.readFile(testPath + filterPath + '-response.xml', {
50
+ encoding: 'utf8',
51
+ });
52
+ } else if (await fs.pathExists(testPath + '-response.xml')) {
53
+ if (filterPath) {
54
+ /* eslint-disable no-console */
55
+ console.log(
56
+ `${color.bgYellow}${color.fgBlack}TEST-WARNING${
57
+ color.reset
58
+ }: You are loading your reponse from ${
59
+ testPath + '-response.xml'
60
+ } instead of the more specific ${
61
+ testPath + filterPath + '-response.xml'
62
+ }. Make sure this is intended`
63
+ );
64
+ /* eslint-enable no-console */
65
+ }
66
+ return fs.readFile(testPath + '-response.xml', {
26
67
  encoding: 'utf8',
27
68
  });
28
69
  }
29
70
  /* eslint-disable no-console */
30
71
  console.log(
31
- `${color.bgRed}${color.fgBlack}test-error${color.reset}: Please create file ${testPath}`
72
+ `${color.bgRed}${color.fgBlack}TEST-ERROR${color.reset}: Please create file ${
73
+ filterPath ? testPath + filterPath + '-response.xml or ' : ''
74
+ }${testPath + '-response.xml'}`
32
75
  );
33
76
  /* eslint-enable no-console */
34
- process.exitCode = 404;
35
77
 
78
+ // return error
79
+ process.exitCode = 404;
36
80
  return fs.readFile(path.join('test', 'resources', mcdevAction + '-response.xml'), {
37
81
  encoding: 'utf8',
38
82
  });
39
83
  };
84
+ exports.filterToPath = (filter) => {
85
+ if (filter) {
86
+ return '-' + this._filterToPath(filter);
87
+ }
88
+ return '';
89
+ };
90
+ exports._filterToPath = (filter) => {
91
+ if (filter.Property && filter.SimpleOperator) {
92
+ return `${filter.Property}${filter.SimpleOperator.replace('equals', '=')}${
93
+ filter.Value === undefined ? '' : filter.Value
94
+ }`;
95
+ } else if (filter.LeftOperand && filter.LogicalOperator && filter.RightOperand) {
96
+ return (
97
+ this._filterToPath(filter.LeftOperand) +
98
+ filter.LogicalOperator +
99
+ this._filterToPath(filter.RightOperand)
100
+ );
101
+ } else {
102
+ throw new Error('unknown filter type');
103
+ }
104
+ };
40
105
  /**
41
106
  * based on request, respond with different soap data
42
107
  *
@@ -53,7 +118,8 @@ exports.handleSOAPRequest = async (config) => {
53
118
  responseXML = await this.loadSOAPRecords(
54
119
  config.headers.SOAPAction.toLocaleLowerCase(),
55
120
  jObj.Envelope.Body.RetrieveRequestMsg.RetrieveRequest.ObjectType,
56
- jObj.Envelope.Header.fueloauth
121
+ jObj.Envelope.Header.fueloauth,
122
+ jObj.Envelope.Body.RetrieveRequestMsg.RetrieveRequest.Filter
57
123
  );
58
124
 
59
125
  break;
@@ -62,7 +128,8 @@ exports.handleSOAPRequest = async (config) => {
62
128
  responseXML = await this.loadSOAPRecords(
63
129
  config.headers.SOAPAction.toLocaleLowerCase(),
64
130
  fullObj.Envelope.Body.CreateRequest.Objects['@_xsi:type'],
65
- jObj.Envelope.Header.fueloauth
131
+ jObj.Envelope.Header.fueloauth,
132
+ null
66
133
  );
67
134
 
68
135
  break;
@@ -71,7 +138,8 @@ exports.handleSOAPRequest = async (config) => {
71
138
  responseXML = await this.loadSOAPRecords(
72
139
  config.headers.SOAPAction.toLocaleLowerCase(),
73
140
  fullObj.Envelope.Body.UpdateRequest.Objects['@_xsi:type'],
74
- jObj.Envelope.Header.fueloauth
141
+ jObj.Envelope.Header.fueloauth,
142
+ null
75
143
  );
76
144
 
77
145
  break;
@@ -82,13 +150,46 @@ exports.handleSOAPRequest = async (config) => {
82
150
  fullObj.Envelope.Body.ConfigureRequestMsg.Configurations.Configuration[0][
83
151
  '@_xsi:type'
84
152
  ],
85
- jObj.Envelope.Header.fueloauth
153
+ jObj.Envelope.Header.fueloauth,
154
+ null
155
+ );
156
+
157
+ break;
158
+ }
159
+ case 'Delete': {
160
+ responseXML = await this.loadSOAPRecords(
161
+ config.headers.SOAPAction.toLocaleLowerCase(),
162
+ fullObj.Envelope.Body.DeleteRequest.Objects['@_xsi:type'],
163
+ jObj.Envelope.Header.fueloauth,
164
+ null
165
+ );
166
+
167
+ break;
168
+ }
169
+ case 'Schedule': {
170
+ responseXML = await this.loadSOAPRecords(
171
+ config.headers.SOAPAction.toLocaleLowerCase(),
172
+ fullObj.Envelope.Body.ScheduleRequestMsg.Interactions.Interaction['@_xsi:type'],
173
+ jObj.Envelope.Header.fueloauth,
174
+ fullObj.Envelope.Body.ScheduleRequestMsg.Interactions.Interaction.ObjectID
175
+ );
176
+
177
+ break;
178
+ }
179
+ case 'Perform': {
180
+ responseXML = await this.loadSOAPRecords(
181
+ config.headers.SOAPAction.toLocaleLowerCase(),
182
+ fullObj.Envelope.Body.PerformRequestMsg.Definitions.Definition['@_xsi:type'],
183
+ jObj.Envelope.Header.fueloauth,
184
+ fullObj.Envelope.Body.PerformRequestMsg.Definitions.Definition.ObjectID
86
185
  );
87
186
 
88
187
  break;
89
188
  }
90
189
  default: {
91
- throw new Error('This SOAP Action is not supported by test handler');
190
+ throw new Error(
191
+ `The SOAP Action ${config.headers.SOAPAction} is not supported by test handler`
192
+ );
92
193
  }
93
194
  }
94
195
 
@@ -121,15 +222,15 @@ exports.handleRESTRequest = async (config) => {
121
222
  'resources',
122
223
  config.headers.Authorization.replace('Bearer ', ''),
123
224
  urlObj.pathname,
124
- config.method + '-response.json'
225
+ config.method + '-response'
125
226
  )
126
227
  .replace(':', '_'); // replace : with _ for Windows
127
228
 
128
- if (await fs.pathExists(testPath)) {
229
+ if (await fs.pathExists(testPath + '.json')) {
129
230
  // build filter logic to ensure templating works
130
231
  if (filterName) {
131
232
  const response = JSON.parse(
132
- await fs.readFile(testPath, {
233
+ await fs.readFile(testPath + '.json', {
133
234
  encoding: 'utf8',
134
235
  })
135
236
  );
@@ -139,22 +240,29 @@ exports.handleRESTRequest = async (config) => {
139
240
  } else {
140
241
  return [
141
242
  200,
142
- await fs.readFile(testPath, {
243
+ await fs.readFile(testPath + '.json', {
143
244
  encoding: 'utf8',
144
245
  }),
145
246
  ];
146
247
  }
248
+ } else if (await fs.pathExists(testPath + '.txt')) {
249
+ return [
250
+ 200,
251
+ await fs.readFile(testPath + '.txt', {
252
+ encoding: 'utf8',
253
+ }),
254
+ ];
147
255
  } else {
148
256
  /* eslint-disable no-console */
149
257
  console.log(
150
- `${color.bgRed}${color.fgBlack}test-error${color.reset}: Please create file ${testPath}`
258
+ `${color.bgRed}${color.fgBlack}TEST-ERROR${color.reset}: Please create file ${testPath}.json/.txt`
151
259
  );
152
260
  /* eslint-enable no-console */
153
261
  process.exitCode = 404;
154
262
 
155
263
  return [
156
264
  404,
157
- fs.readFile(path.join('test', 'resources', 'rest404-response.json'), {
265
+ await fs.readFile(path.join('test', 'resources', 'rest404-response.json'), {
158
266
  encoding: 'utf8',
159
267
  }),
160
268
  ];