mcdev 5.0.2 → 5.1.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 (88) hide show
  1. package/.coverage-comment-template.svelte +177 -161
  2. package/.github/ISSUE_TEMPLATE/bug.yml +1 -0
  3. package/.github/dependabot.yml +8 -0
  4. package/.github/workflows/coverage-base-update.yml +6 -2
  5. package/.github/workflows/coverage-develop-branch.yml +7 -6
  6. package/.github/workflows/coverage-main-branch.yml +7 -6
  7. package/.github/workflows/coverage.yml +7 -2
  8. package/.husky/post-checkout +3 -2
  9. package/docs/dist/documentation.md +162 -47
  10. package/lib/Deployer.js +3 -3
  11. package/lib/cli.js +28 -0
  12. package/lib/index.js +173 -2
  13. package/lib/metadataTypes/Automation.js +400 -193
  14. package/lib/metadataTypes/DataExtension.js +5 -5
  15. package/lib/metadataTypes/MetadataType.js +42 -15
  16. package/lib/metadataTypes/Query.js +26 -0
  17. package/lib/metadataTypes/definitions/Asset.definition.js +1 -0
  18. package/lib/metadataTypes/definitions/Automation.definition.js +52 -6
  19. package/lib/metadataTypes/definitions/DataExtension.definition.js +1 -0
  20. package/lib/metadataTypes/definitions/DataExtract.definition.js +1 -0
  21. package/lib/metadataTypes/definitions/EmailSend.definition.js +1 -0
  22. package/lib/metadataTypes/definitions/Event.definition.js +1 -0
  23. package/lib/metadataTypes/definitions/Filter.definition.js +1 -0
  24. package/lib/metadataTypes/definitions/ImportFile.definition.js +1 -0
  25. package/lib/metadataTypes/definitions/MobileKeyword.definition.js +1 -0
  26. package/lib/metadataTypes/definitions/Query.definition.js +1 -0
  27. package/lib/metadataTypes/definitions/Role.definition.js +1 -0
  28. package/lib/metadataTypes/definitions/TriggeredSend.definition.js +1 -0
  29. package/lib/metadataTypes/definitions/User.definition.js +1 -0
  30. package/lib/util/devops.js +13 -11
  31. package/lib/util/util.js +152 -129
  32. package/package.json +5 -5
  33. package/test/general.test.js +26 -0
  34. package/test/mockRoot/.mcdevrc.json +1 -1
  35. package/test/mockRoot/deploy/testInstance/testBU/automation/testExisting_automation.automation-meta.json +53 -0
  36. package/test/mockRoot/deploy/testInstance/testBU/automation/testNew_automation.automation-meta.json +46 -0
  37. package/test/mockRoot/deploy/testInstance/testBU/query/{testExistingQuery.query-meta.json → testExisting_query.query-meta.json} +2 -2
  38. package/test/mockRoot/deploy/testInstance/testBU/query/{testNewQuery.query-meta.json → testNew_query.query-meta.json} +2 -2
  39. package/test/resourceFactory.js +64 -21
  40. package/test/resources/9999999/automation/build-expected.json +58 -0
  41. package/test/resources/9999999/automation/create-expected.json +46 -0
  42. package/test/resources/9999999/automation/create-testNew_automation-expected.md +28 -0
  43. package/test/resources/9999999/automation/delete-response.xml +40 -0
  44. package/test/resources/9999999/automation/retrieve-expected.json +58 -0
  45. package/test/resources/9999999/automation/retrieve-testExisting_automation-expected.md +30 -0
  46. package/test/resources/9999999/automation/template-expected.json +58 -0
  47. package/test/resources/9999999/automation/update-expected.json +46 -0
  48. package/test/resources/9999999/automation/update-testExisting_automation-expected.md +28 -0
  49. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json +85 -0
  50. package/test/resources/9999999/automation/v1/automations/08afb0e2-b00a-4c88-ad2e-1f7f8788c560/patch-response.json +85 -0
  51. package/test/resources/9999999/automation/v1/automations/a8afb0e2-b00a-4c88-ad2e-1f7f8788c560/get-response.json +85 -0
  52. package/test/resources/9999999/automation/v1/automations/post-response.json +85 -0
  53. package/test/resources/9999999/automation/v1/dataextracts/56c5370a-f988-4f36-b0ee-0f876573f6d7/get-response.json +38 -0
  54. package/test/resources/9999999/automation/v1/dataextracts/get-response.json +20 -0
  55. package/test/resources/9999999/automation/v1/filetransfers/72c328ac-f5b0-4e37-91d3-a775666f15a6/get-response.json +18 -0
  56. package/test/resources/9999999/automation/v1/filetransfers/get-response.json +15 -0
  57. package/test/resources/9999999/automation/v1/imports/get-response.json +38 -0
  58. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/actions/start/post-response.txt +1 -0
  59. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/get-response.json +2 -2
  60. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/patch-response.json +2 -2
  61. package/test/resources/9999999/automation/v1/queries/get-response.json +4 -4
  62. package/test/resources/9999999/automation/v1/queries/post-response.json +2 -2
  63. package/test/resources/9999999/automation/v1/scripts/get-response.json +17 -0
  64. package/test/resources/9999999/dataFolder/retrieve-ContentType=automations-response.xml +48 -0
  65. package/test/resources/9999999/dataFolder/retrieve-ContentType=queryactivity-response.xml +48 -0
  66. package/test/resources/9999999/dataFolder/retrieve-response.xml +22 -0
  67. package/test/resources/9999999/emailSendDefinition/retrieve-response.xml +85 -0
  68. package/test/resources/9999999/legacy/v1/beta/automations/notifications/RkpOcE9qSVh2VUdnYTVJbWFfWW14dzoyNTow/get-response.json +21 -0
  69. package/test/resources/9999999/legacy/v1/beta/automations/notifications/RkpOcE9qSVh2VUdnYTVJbWFfWW14dzoyNTow/post-response.json +0 -0
  70. package/test/resources/9999999/legacy/v1/beta/bulk/automations/automation/definition/get-response.json +30 -0
  71. package/test/resources/9999999/program/retrieve-CustomerKey=testExisting_automation-response.xml +30 -0
  72. package/test/resources/9999999/program/retrieve-CustomerKey=testNew_automation-response.xml +30 -0
  73. package/test/resources/9999999/program/retrieve-Name=testExisting_automation-response.xml +31 -0
  74. package/test/resources/9999999/program/retrieve-response.xml +32 -0
  75. package/test/resources/9999999/query/build-expected.json +2 -2
  76. package/test/resources/9999999/query/get-expected.json +2 -2
  77. package/test/resources/9999999/query/get2-expected.json +2 -2
  78. package/test/resources/9999999/query/patch-expected.json +2 -2
  79. package/test/resources/9999999/query/post-expected.json +2 -2
  80. package/test/resources/9999999/query/template-expected.json +2 -2
  81. package/test/type.automation.test.js +259 -0
  82. package/test/type.dataExtension.test.js +3 -0
  83. package/test/type.query.test.js +39 -26
  84. package/test/type.user.test.js +17 -3
  85. package/test/utils.js +7 -6
  86. package/.coverage-comment-template.md +0 -20
  87. /package/test/mockRoot/deploy/testInstance/testBU/query/{testExistingQuery.query-meta.sql → testExisting_query.query-meta.sql} +0 -0
  88. /package/test/mockRoot/deploy/testInstance/testBU/query/{testNewQuery.query-meta.sql → testNew_query.query-meta.sql} +0 -0
@@ -0,0 +1,85 @@
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:e0ba7da7-7e82-42db-a166-42a488ac375b</wsa:MessageID>
11
+ <wsa:RelatesTo>urn:uuid:17a3f405-6bd8-4b30-9230-44fea1749b96</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-96902d78-e86f-4361-855e-c37e2e3b4b58">
15
+ <wsu:Created>2023-06-01T12:04:17Z</wsu:Created>
16
+ <wsu:Expires>2023-06-01T12:09:17Z</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>687d0584-acbe-4bac-bfc2-4c41b73b5a32</RequestID>
24
+ <Results xsi:type="EmailSendDefinition">
25
+ <PartnerKey xsi:nil="true" />
26
+ <CreatedDate>2022-11-14T12:27:29.963</CreatedDate>
27
+ <ModifiedDate>2022-11-14T12:27:29.963</ModifiedDate>
28
+ <ObjectID>9b1c7bf9-4964-ed11-b849-48df37d1de8b</ObjectID>
29
+ <CustomerKey>testExisting_emailSend</CustomerKey>
30
+ <IsPlatformObject>false</IsPlatformObject>
31
+ <Name>testExisting_emailSend</Name>
32
+ <Description>some description</Description>
33
+ <CategoryID>290820</CategoryID>
34
+ <SendClassification>
35
+ <PartnerKey xsi:nil="true" />
36
+ <ObjectID xsi:nil="true" />
37
+ <CustomerKey>test_send_classification</CustomerKey>
38
+ </SendClassification>
39
+ <SenderProfile>
40
+ <PartnerKey xsi:nil="true" />
41
+ <ObjectID xsi:nil="true" />
42
+ <CustomerKey>Test_sender</CustomerKey>
43
+ </SenderProfile>
44
+ <DeliveryProfile>
45
+ <PartnerKey xsi:nil="true" />
46
+ <ObjectID xsi:nil="true" />
47
+ <CustomerKey>Default</CustomerKey>
48
+ </DeliveryProfile>
49
+ <SuppressTracking>false</SuppressTracking>
50
+ <IsSendLogging>false</IsSendLogging>
51
+ <SendDefinitionList>
52
+ <PartnerKey xsi:nil="true" />
53
+ <ObjectID>9d1c7bf9-4964-ed11-b849-48df37d1de8b</ObjectID>
54
+ <List>
55
+ <PartnerKey xsi:nil="true" />
56
+ <ID>32308</ID>
57
+ <ObjectID xsi:nil="true" />
58
+ </List>
59
+ <SendDefinitionListType>SourceList</SendDefinitionListType>
60
+ <CustomObjectID>2c19d707-743e-ed11-b848-48df37b24911</CustomObjectID>
61
+ <DataSourceTypeID>CustomObject</DataSourceTypeID>
62
+ <IsTestObject>false</IsTestObject>
63
+ <SalesForceObjectID />
64
+ <Name />
65
+ </SendDefinitionList>
66
+ <Email>
67
+ <PartnerKey xsi:nil="true" />
68
+ <ID>676709</ID>
69
+ <ObjectID xsi:nil="true" />
70
+ </Email>
71
+ <BccEmail />
72
+ <AutoBccEmail />
73
+ <TestEmailAddr />
74
+ <EmailSubject>someSubject</EmailSubject>
75
+ <DynamicEmailSubject>someSubject</DynamicEmailSubject>
76
+ <IsMultipart>true</IsMultipart>
77
+ <IsWrapped>true</IsWrapped>
78
+ <DeduplicateByEmail>false</DeduplicateByEmail>
79
+ <ExclusionFilter />
80
+ <Additional />
81
+ <CCEmail />
82
+ </Results>
83
+ </RetrieveResponseMsg>
84
+ </soap:Body>
85
+ </soap:Envelope>
@@ -0,0 +1,21 @@
1
+ {
2
+ "programId": "ZGQ4N2M2ZjEtYjJlZi00MDljLTg3MDctYzYwNWQ0MzdiYWI4OjI1OjA",
3
+ "workers": [
4
+ {
5
+ "programId": "ZGQ4N2M2ZjEtYjJlZi00MDljLTg3MDctYzYwNWQ0MzdiYWI4OjI1OjA",
6
+ "id": "YjA2NmVlODEtODllOS00NTE4LTkwYzYtMTY4Mzg2ZTk3MGE4OjEyOjA",
7
+ "notificationType": "Complete",
8
+ "definition": "complete@test.accenture.com",
9
+ "body": "",
10
+ "channelType": "Account"
11
+ },
12
+ {
13
+ "programId": "ZGQ4N2M2ZjEtYjJlZi00MDljLTg3MDctYzYwNWQ0MzdiYWI4OjI1OjA",
14
+ "id": "NGIzZGQ5N2EtMDI0ZS00MzFiLTg5ZWYtNTdjYTI4ODVjMjQ0OjEyOjA",
15
+ "notificationType": "Error",
16
+ "definition": "error@test.accenture.com",
17
+ "body": "test",
18
+ "channelType": "Account"
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "startIndex": 0,
3
+ "itemsPerPage": 50,
4
+ "totalResults": 1,
5
+ "entry": [
6
+ {
7
+ "id": "RkpOcE9qSVh2VUdnYTVJbWFfWW14dzoyNTow",
8
+ "key": "testExisting_automation",
9
+ "createdDate": "2022-01-12T08:41:35.773Z",
10
+ "name": "testExisting_automation",
11
+ "description": "bla bla",
12
+ "clientId": 9999999,
13
+ "status": "Building",
14
+ "createdBy": {
15
+ "id": "NzE3MzUzNDA1OjQ6MA",
16
+ "name": "Tom Tester",
17
+ "email": "tom.tester@accenture.com"
18
+ },
19
+ "modifiedDate": "2022-11-11T16:42:36.513Z",
20
+ "modifiedBy": {
21
+ "id": "NzE3MzUzNDA1OjQ6MA",
22
+ "name": "Tom Tester",
23
+ "email": "tom.tester@accenture.com"
24
+ },
25
+ "isPlatformObject": false,
26
+ "notifications": "https://mcxxxxx.rest.marketingcloudapis.com/legacy/v1/beta/hub/notifications/RkpOcE9qSVh2VUdnYTVJbWFfWW14dzoxMjow",
27
+ "automationType": "scheduled"
28
+ }
29
+ ]
30
+ }
@@ -0,0 +1,30 @@
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:60a72d4a-847e-4d9b-a4eb-a42951078298</wsa:MessageID>
11
+ <wsa:RelatesTo>urn:uuid:0b59ed53-72ec-4481-ae06-4ee78912aef2</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-f95f3fd3-c763-4e2c-929f-33611e9d2eba">
15
+ <wsu:Created>2023-06-01T12:04:20Z</wsu:Created>
16
+ <wsu:Expires>2023-06-01T12:09:20Z</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>3b1c8cee-b270-49cb-b77b-e7b33934d1b6</RequestID>
24
+ <Results xsi:type="Program">
25
+ <PartnerKey xsi:nil="true" />
26
+ <ObjectID>08afb0e2-b00a-4c88-ad2e-1f7f8788c560</ObjectID>
27
+ </Results>
28
+ </RetrieveResponseMsg>
29
+ </soap:Body>
30
+ </soap:Envelope>
@@ -0,0 +1,30 @@
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:60a72d4a-847e-4d9b-a4eb-a42951078298</wsa:MessageID>
11
+ <wsa:RelatesTo>urn:uuid:0b59ed53-72ec-4481-ae06-4ee78912aef2</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-f95f3fd3-c763-4e2c-929f-33611e9d2eba">
15
+ <wsu:Created>2023-06-01T12:04:20Z</wsu:Created>
16
+ <wsu:Expires>2023-06-01T12:09:20Z</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>3b1c8cee-b270-49cb-b77b-e7b33934d1b6</RequestID>
24
+ <Results xsi:type="Program">
25
+ <PartnerKey xsi:nil="true" />
26
+ <ObjectID>a8afb0e2-b00a-4c88-ad2e-1f7f8788c560</ObjectID>
27
+ </Results>
28
+ </RetrieveResponseMsg>
29
+ </soap:Body>
30
+ </soap:Envelope>
@@ -0,0 +1,31 @@
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:60a72d4a-847e-4d9b-a4eb-a42951078298</wsa:MessageID>
11
+ <wsa:RelatesTo>urn:uuid:0b59ed53-72ec-4481-ae06-4ee78912aef2</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-f95f3fd3-c763-4e2c-929f-33611e9d2eba">
15
+ <wsu:Created>2023-06-01T12:04:20Z</wsu:Created>
16
+ <wsu:Expires>2023-06-01T12:09:20Z</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>3b1c8cee-b270-49cb-b77b-e7b33934d1b6</RequestID>
24
+ <Results xsi:type="Program">
25
+ <PartnerKey xsi:nil="true" />
26
+ <ObjectID>08afb0e2-b00a-4c88-ad2e-1f7f8788c560</ObjectID>
27
+ <Name>testExisting_automation</Name>
28
+ </Results>
29
+ </RetrieveResponseMsg>
30
+ </soap:Body>
31
+ </soap:Envelope>
@@ -0,0 +1,32 @@
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:60a72d4a-847e-4d9b-a4eb-a42951078298</wsa:MessageID>
11
+ <wsa:RelatesTo>urn:uuid:0b59ed53-72ec-4481-ae06-4ee78912aef2</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-f95f3fd3-c763-4e2c-929f-33611e9d2eba">
15
+ <wsu:Created>2023-06-01T12:04:20Z</wsu:Created>
16
+ <wsu:Expires>2023-06-01T12:09:20Z</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>3b1c8cee-b270-49cb-b77b-e7b33934d1b6</RequestID>
24
+ <Results xsi:type="Program">
25
+ <PartnerKey xsi:nil="true" />
26
+ <ObjectID>08afb0e2-b00a-4c88-ad2e-1f7f8788c560</ObjectID>
27
+ <Name>testExisting_automation</Name><!--only retrieved for cache-->
28
+ <CustomerKey>testExisting_automation</CustomerKey><!--only retrieved for cache-->
29
+ </Results>
30
+ </RetrieveResponseMsg>
31
+ </soap:Body>
32
+ </soap:Envelope>
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "testExistingQuery",
3
- "key": "testExistingQuery",
2
+ "name": "testTemplated_query",
3
+ "key": "testTemplated_query",
4
4
  "description": "foobar",
5
5
  "targetKey": "testTemplated_dataExtension",
6
6
  "targetUpdateTypeName": "Overwrite",
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "testExistingQuery",
3
- "key": "testExistingQuery",
2
+ "name": "testExisting_query",
3
+ "key": "testExisting_query",
4
4
  "description": "bla bla",
5
5
  "targetKey": "testExisting_dataExtension",
6
6
  "createdDate": "2022-04-26T15:21:16.453",
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "testExistingQuery2",
3
- "key": "testExistingQuery2",
2
+ "name": "testExisting_query2",
3
+ "key": "testExisting_query2",
4
4
  "description": "bla bla",
5
5
  "targetKey": "testExisting_dataExtension",
6
6
  "createdDate": "2022-04-26T15:21:16.453",
@@ -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",
@@ -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",
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "testExistingQuery",
3
- "key": "testExistingQuery",
2
+ "name": "{{{prefix}}}query",
3
+ "key": "{{{prefix}}}query",
4
4
  "description": "{{{description}}}",
5
5
  "targetKey": "{{{prefix}}}dataExtension",
6
6
  "targetUpdateTypeName": "Overwrite",
@@ -0,0 +1,259 @@
1
+ const chai = require('chai');
2
+ const chaiFiles = require('chai-files');
3
+
4
+ chai.use(chaiFiles);
5
+
6
+ const assert = chai.assert;
7
+ const expect = chai.expect;
8
+ const file = chaiFiles.file;
9
+ const cache = require('../lib/util/cache');
10
+ const testUtils = require('./utils');
11
+ const handler = require('../lib/index');
12
+
13
+ describe('type: automation', () => {
14
+ beforeEach(() => {
15
+ testUtils.mockSetup();
16
+ });
17
+ afterEach(() => {
18
+ testUtils.mockReset();
19
+ });
20
+ describe('Retrieve ================', () => {
21
+ it('Should retrieve a automation', async () => {
22
+ // WHEN
23
+ await handler.retrieve('testInstance/testBU', ['automation']);
24
+ // THEN
25
+ assert.equal(process.exitCode, false, 'retrieve should not have thrown an error');
26
+ // get results from cache
27
+ const result = cache.getCache();
28
+ assert.equal(
29
+ result.automation ? Object.keys(result.automation).length : 0,
30
+ 1,
31
+ 'only one automation expected'
32
+ );
33
+ assert.deepEqual(
34
+ await testUtils.getActualJson('testExisting_automation', 'automation'),
35
+ await testUtils.getExpectedJson('9999999', 'automation', 'retrieve'),
36
+
37
+ 'returned metadata was not equal expected'
38
+ );
39
+ // check if MD file was created and equals expectations
40
+ expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal(
41
+ file(
42
+ testUtils.getExpectedFile(
43
+ '9999999',
44
+ 'automation',
45
+ 'retrieve-testExisting_automation',
46
+ 'md'
47
+ )
48
+ )
49
+ );
50
+
51
+ assert.equal(
52
+ testUtils.getAPIHistoryLength(),
53
+ 14,
54
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
55
+ );
56
+ return;
57
+ });
58
+ });
59
+ describe('Deploy ================', () => {
60
+ beforeEach(() => {
61
+ testUtils.mockSetup(true);
62
+ });
63
+ it('Should create & update a automation', async () => {
64
+ // WHEN
65
+ await handler.deploy('testInstance/testBU', ['automation']);
66
+ // THEN
67
+ assert.equal(process.exitCode, false, 'deploy should not have thrown an error');
68
+
69
+ // get results from cache
70
+ const result = cache.getCache();
71
+ assert.equal(
72
+ result.automation ? Object.keys(result.automation).length : 0,
73
+ 2,
74
+ 'two automations expected'
75
+ );
76
+ // insert
77
+ assert.deepEqual(
78
+ await testUtils.getActualJson('testNew_automation', 'automation'),
79
+ await testUtils.getExpectedJson('9999999', 'automation', 'create'),
80
+ 'returned metadata was not equal expected for create'
81
+ );
82
+ // update
83
+ assert.deepEqual(
84
+ await testUtils.getActualJson('testExisting_automation', 'automation'),
85
+ await testUtils.getExpectedJson('9999999', 'automation', 'update'),
86
+ 'returned metadata was not equal expected for update'
87
+ );
88
+ // check if MD file was created and equals expectations
89
+ expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal(
90
+ file(
91
+ testUtils.getExpectedFile(
92
+ '9999999',
93
+ 'automation',
94
+ 'update-testExisting_automation',
95
+ 'md'
96
+ )
97
+ )
98
+ );
99
+
100
+ // check if MD file was created and equals expectations
101
+ expect(file(testUtils.getActualDoc('testNew_automation', 'automation'))).to.equal(
102
+ file(
103
+ testUtils.getExpectedFile(
104
+ '9999999',
105
+ 'automation',
106
+ 'create-testNew_automation',
107
+ 'md'
108
+ )
109
+ )
110
+ );
111
+
112
+ assert.equal(
113
+ testUtils.getAPIHistoryLength(),
114
+ 15,
115
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
116
+ );
117
+ return;
118
+ });
119
+ it('Should change the key during update via --changeKeyValue');
120
+ });
121
+ describe('Templating ================', () => {
122
+ it('Should create a automation template via retrieveAsTemplate and build it', async () => {
123
+ // GIVEN there is a template
124
+ const result = await handler.retrieveAsTemplate(
125
+ 'testInstance/testBU',
126
+ 'automation',
127
+ ['testExisting_automation'],
128
+ 'testSourceMarket'
129
+ );
130
+ assert.equal(
131
+ process.exitCode,
132
+ false,
133
+ 'retrieveAsTemplate should not have thrown an error'
134
+ );
135
+
136
+ // WHEN
137
+ assert.equal(
138
+ result.automation ? Object.keys(result.automation).length : 0,
139
+ 1,
140
+ 'only one automation expected'
141
+ );
142
+ assert.deepEqual(
143
+ await testUtils.getActualTemplateJson('testExisting_automation', 'automation'),
144
+ await testUtils.getExpectedJson('9999999', 'automation', 'template'),
145
+ 'returned template was not equal expected'
146
+ );
147
+ // THEN
148
+ await handler.buildDefinition(
149
+ 'testInstance/testBU',
150
+ 'automation',
151
+ 'testExisting_automation',
152
+ 'testTargetMarket'
153
+ );
154
+ assert.equal(
155
+ process.exitCode,
156
+ false,
157
+ 'buildDefinition should not have thrown an error'
158
+ );
159
+ assert.deepEqual(
160
+ await testUtils.getActualDeployJson('testTemplated_automation', 'automation'),
161
+ await testUtils.getExpectedJson('9999999', 'automation', 'build'),
162
+ 'returned deployment file was not equal expected'
163
+ );
164
+ assert.equal(
165
+ testUtils.getAPIHistoryLength(),
166
+ 14,
167
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
168
+ );
169
+ return;
170
+ });
171
+ it('Should create a automation template via buildTemplate and build it', async () => {
172
+ // download first before we test buildTemplate
173
+ await handler.retrieve('testInstance/testBU', ['automation']);
174
+ // GIVEN there is a template
175
+ const result = await handler.buildTemplate(
176
+ 'testInstance/testBU',
177
+ 'automation',
178
+ ['testExisting_automation'],
179
+ 'testSourceMarket'
180
+ );
181
+ assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error');
182
+ // WHEN
183
+ assert.equal(
184
+ result.automation ? Object.keys(result.automation).length : 0,
185
+ 1,
186
+ 'only one automation expected'
187
+ );
188
+ assert.deepEqual(
189
+ await testUtils.getActualTemplateJson('testExisting_automation', 'automation'),
190
+ await testUtils.getExpectedJson('9999999', 'automation', 'template'),
191
+ 'returned template was not equal expected'
192
+ );
193
+ // THEN
194
+ await handler.buildDefinition(
195
+ 'testInstance/testBU',
196
+ 'automation',
197
+ 'testExisting_automation',
198
+ 'testTargetMarket'
199
+ );
200
+ assert.equal(
201
+ process.exitCode,
202
+ false,
203
+ 'buildDefinition should not have thrown an error'
204
+ );
205
+
206
+ assert.deepEqual(
207
+ await testUtils.getActualDeployJson('testTemplated_automation', 'automation'),
208
+ await testUtils.getExpectedJson('9999999', 'automation', 'build'),
209
+ 'returned deployment file was not equal expected'
210
+ );
211
+ assert.equal(
212
+ testUtils.getAPIHistoryLength(),
213
+ 14,
214
+ 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
215
+ );
216
+ return;
217
+ });
218
+ });
219
+ describe('Delete ================', () => {
220
+ it('Should delete the item', async () => {
221
+ // WHEN
222
+ const result = await handler.deleteByKey('testInstance/testBU', 'automation', [
223
+ 'testExisting_automation',
224
+ ]);
225
+ // THEN
226
+ assert.equal(process.exitCode, false, 'delete should not have thrown an error');
227
+
228
+ assert.equal(result, true, 'should have deleted the item');
229
+ return;
230
+ });
231
+ });
232
+ describe('CI/CD ================', () => {
233
+ it('Should return a list of files based on their type and key', async () => {
234
+ // WHEN
235
+ const fileList = await handler.getFilesToCommit('testInstance/testBU', 'automation', [
236
+ 'testExisting_automation',
237
+ ]);
238
+ // THEN
239
+ assert.equal(
240
+ process.exitCode,
241
+ false,
242
+ 'getFilesToCommit should not have thrown an error'
243
+ );
244
+ assert.equal(fileList.length, 2, 'expected only 2 file paths');
245
+
246
+ assert.equal(
247
+ fileList[0].split('\\').join('/'),
248
+ 'retrieve/testInstance/testBU/automation/testExisting_automation.automation-meta.json',
249
+ 'wrong JSON path'
250
+ );
251
+ assert.equal(
252
+ fileList[1].split('\\').join('/'),
253
+ 'retrieve/testInstance/testBU/automation/testExisting_automation.automation-doc.md',
254
+ 'wrong MD path'
255
+ );
256
+ return;
257
+ });
258
+ });
259
+ });
@@ -1,5 +1,8 @@
1
1
  const chai = require('chai');
2
2
  const chaiFiles = require('chai-files');
3
+
4
+ chai.use(chaiFiles);
5
+
3
6
  const assert = chai.assert;
4
7
  const expect = chai.expect;
5
8
  const file = chaiFiles.file;