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.
- package/.fork/custom-commands.json +123 -21
- package/.github/ISSUE_TEMPLATE/bug.yml +2 -0
- package/.github/dependabot.yml +1 -0
- package/.husky/post-checkout +6 -1
- package/.husky/post-merge +5 -0
- package/@types/lib/Builder.d.ts.map +1 -1
- package/@types/lib/Deployer.d.ts.map +1 -1
- package/@types/lib/cli.d.ts.map +1 -1
- package/@types/lib/index.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Asset.d.ts.map +1 -1
- package/@types/lib/metadataTypes/AttributeGroup.d.ts.map +1 -1
- package/@types/lib/metadataTypes/AttributeSet.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Automation.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Campaign.d.ts.map +1 -1
- package/@types/lib/metadataTypes/ContentArea.d.ts.map +1 -1
- package/@types/lib/metadataTypes/DataExtension.d.ts.map +1 -1
- package/@types/lib/metadataTypes/DataExtensionField.d.ts.map +1 -1
- package/@types/lib/metadataTypes/DataExtract.d.ts.map +1 -1
- package/@types/lib/metadataTypes/DataExtractType.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Discovery.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Email.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Event.d.ts.map +1 -1
- package/@types/lib/metadataTypes/FileTransfer.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Folder.d.ts.map +1 -1
- package/@types/lib/metadataTypes/ImportFile.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Journey.d.ts +0 -1
- package/@types/lib/metadataTypes/Journey.d.ts.map +1 -1
- package/@types/lib/metadataTypes/List.d.ts.map +1 -1
- package/@types/lib/metadataTypes/MetadataType.d.ts.map +1 -1
- package/@types/lib/metadataTypes/MobileKeyword.d.ts.map +1 -1
- package/@types/lib/metadataTypes/MobileMessage.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Query.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Role.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Script.d.ts.map +1 -1
- package/@types/lib/metadataTypes/SendClassification.d.ts.map +1 -1
- package/@types/lib/metadataTypes/SenderProfile.d.ts.map +1 -1
- package/@types/lib/metadataTypes/TransactionalEmail.d.ts.map +1 -1
- package/@types/lib/metadataTypes/TransactionalMessage.d.ts.map +1 -1
- package/@types/lib/metadataTypes/TransactionalPush.d.ts.map +1 -1
- package/@types/lib/metadataTypes/TransactionalSMS.d.ts.map +1 -1
- package/@types/lib/metadataTypes/TriggeredSend.d.ts.map +1 -1
- package/@types/lib/metadataTypes/User.d.ts.map +1 -1
- package/@types/lib/metadataTypes/Verification.d.ts.map +1 -1
- package/@types/lib/metadataTypes/definitions/Journey.definition.d.ts +0 -1
- package/@types/lib/util/auth.d.ts.map +1 -1
- package/@types/lib/util/cache.d.ts.map +1 -1
- package/@types/lib/util/cli.d.ts.map +1 -1
- package/@types/lib/util/config.d.ts.map +1 -1
- package/@types/lib/util/devops.d.ts.map +1 -1
- package/@types/lib/util/file.d.ts.map +1 -1
- package/@types/lib/util/init.config.d.ts.map +1 -1
- package/@types/lib/util/init.d.ts.map +1 -1
- package/@types/lib/util/init.git.d.ts.map +1 -1
- package/@types/lib/util/init.npm.d.ts.map +1 -1
- package/@types/lib/util/replaceContentBlockReference.d.ts.map +1 -1
- package/@types/lib/util/util.d.ts.map +1 -1
- package/@types/types/mcdev.d.d.ts.map +1 -1
- package/lib/Builder.js +4 -0
- package/lib/Deployer.js +2 -0
- package/lib/cli.js +1 -0
- package/lib/index.js +31 -0
- package/lib/metadataTypes/Asset.js +30 -0
- package/lib/metadataTypes/AttributeGroup.js +2 -0
- package/lib/metadataTypes/AttributeSet.js +3 -0
- package/lib/metadataTypes/Automation.js +15 -0
- package/lib/metadataTypes/Campaign.js +1 -0
- package/lib/metadataTypes/ContentArea.js +2 -0
- package/lib/metadataTypes/DataExtension.js +12 -0
- package/lib/metadataTypes/DataExtensionField.js +8 -0
- package/lib/metadataTypes/DataExtract.js +3 -0
- package/lib/metadataTypes/DataExtractType.js +1 -0
- package/lib/metadataTypes/Discovery.js +1 -0
- package/lib/metadataTypes/Email.js +2 -0
- package/lib/metadataTypes/Event.js +4 -0
- package/lib/metadataTypes/FileTransfer.js +1 -0
- package/lib/metadataTypes/Folder.js +14 -2
- package/lib/metadataTypes/ImportFile.js +2 -0
- package/lib/metadataTypes/Journey.js +288 -141
- package/lib/metadataTypes/List.js +2 -0
- package/lib/metadataTypes/MetadataType.js +34 -0
- package/lib/metadataTypes/MobileKeyword.js +8 -0
- package/lib/metadataTypes/MobileMessage.js +7 -0
- package/lib/metadataTypes/Query.js +9 -0
- package/lib/metadataTypes/Role.js +1 -0
- package/lib/metadataTypes/Script.js +7 -0
- package/lib/metadataTypes/SendClassification.js +2 -0
- package/lib/metadataTypes/SenderProfile.js +2 -0
- package/lib/metadataTypes/TransactionalEmail.js +23 -3
- package/lib/metadataTypes/TransactionalMessage.js +3 -0
- package/lib/metadataTypes/TransactionalPush.js +1 -0
- package/lib/metadataTypes/TransactionalSMS.js +8 -0
- package/lib/metadataTypes/TriggeredSend.js +4 -0
- package/lib/metadataTypes/User.js +10 -0
- package/lib/metadataTypes/Verification.js +3 -0
- package/lib/metadataTypes/definitions/Journey.definition.js +0 -1
- package/lib/retrieveChangelog.js +1 -0
- package/lib/util/auth.js +3 -0
- package/lib/util/cache.js +8 -0
- package/lib/util/cli.js +8 -0
- package/lib/util/config.js +2 -0
- package/lib/util/devops.js +2 -0
- package/lib/util/file.js +65 -49
- package/lib/util/init.config.js +5 -0
- package/lib/util/init.git.js +4 -0
- package/lib/util/init.js +4 -0
- package/lib/util/init.npm.js +1 -0
- package/lib/util/replaceContentBlockReference.js +1 -0
- package/lib/util/util.js +29 -0
- package/package.json +15 -15
- package/test/general.test.js +13 -13
- package/test/mockRoot/.mcdevrc.json +1 -1
- package/test/resourceFactory.js +27 -4
- package/test/resources/9999999/dataExtension/retrieve-response.xml +29 -0
- package/test/resources/9999999/dataFolder/+retrieve-QAA-response.xml +387 -0
- package/test/resources/9999999/dataFolder/create-ContentType=dataextension,Name=my,ParentFolderID=2-response.xml +33 -0
- package/test/resources/9999999/dataFolder/create-ContentType=dataextension,Name=path,ParentFolderID=862002-response.xml +33 -0
- package/test/resources/9999999/dataFolder/create-ContentType=dataextension,Name=sub,ParentFolderID=862001-response.xml +33 -0
- package/test/resources/9999999/dataFolder/create-ContentType=dataextension,Name=subpath,ParentFolderID=862003-response.xml +33 -0
- package/test/resources/9999999/email/v1/category/post-response-parentCatId=290937,name=my,catType=automations.json +7 -0
- package/test/resources/9999999/email/v1/category/post-response-parentCatId=862100,name=sub,catType=automations.json +7 -0
- package/test/resources/9999999/email/v1/category/post-response-parentCatId=862101,name=path,catType=automations.json +7 -0
- package/test/resources/9999999/email/v1/category/post-response-parentCatId=862102,name=subpath,catType=automations.json +7 -0
- package/test/resources/9999999/folder-deploy/Data Extensions/my/sub/path/subpath.folder-meta.json +9 -0
- package/test/resources/9999999/folder-deploy/Data Extensions/my/sub/path.folder-meta.json +9 -0
- package/test/resources/9999999/folder-deploy/Data Extensions/my/sub.folder-meta.json +9 -0
- package/test/resources/9999999/folder-deploy/Data Extensions/my.folder-meta.json +9 -0
- package/test/resources/9999999/folder-deploy/my automations/my/sub/path/subpath.folder-meta.json +9 -0
- package/test/resources/9999999/folder-deploy/my automations/my/sub/path.folder-meta.json +9 -0
- package/test/resources/9999999/folder-deploy/my automations/my/sub.folder-meta.json +9 -0
- package/test/resources/9999999/folder-deploy/my automations/my.folder-meta.json +9 -0
- package/test/resources/9999999/interaction/v1/interactions/get-response.json +38 -0
- package/test/resources/9999999/interaction/v1/interactions/key_testExisting_temail_notPublished/get-response.json +226 -0
- package/test/resources/9999999/interaction/v1/interactions/transactional/create/post-response.json +3 -0
- package/test/resources/9999999/messaging/v1/email/definitions/get-response.json +7 -0
- package/test/resources/9999999/messaging/v1/email/definitions/testExisting_temail_notPublished/get-response.json +26 -0
- package/test/type.asset.test.js +4 -0
- package/test/type.automation.test.js +1 -1
- package/test/type.dataExtension.test.js +4 -4
- package/test/type.folder.test.js +97 -0
- package/test/type.journey.test.js +84 -21
- package/test/type.transactionalEmail.test.js +7 -7
- package/test/utils.js +44 -5
- package/types/mcdev.d.js +27 -0
- /package/test/resources/9999999/dataFolder/{retrieve-response-.xml → +retrieve-response.xml} +0 -0
|
@@ -26,8 +26,8 @@ describe('type: journey', () => {
|
|
|
26
26
|
const result = cache.getCache();
|
|
27
27
|
assert.equal(
|
|
28
28
|
result.journey ? Object.keys(result.journey).length : 0,
|
|
29
|
-
|
|
30
|
-
'
|
|
29
|
+
4,
|
|
30
|
+
'unexpected number of journeys'
|
|
31
31
|
);
|
|
32
32
|
assert.deepEqual(
|
|
33
33
|
await testUtils.getActualJson('testExisting_journey_Quicksend', 'journey'),
|
|
@@ -46,7 +46,7 @@ describe('type: journey', () => {
|
|
|
46
46
|
);
|
|
47
47
|
assert.equal(
|
|
48
48
|
testUtils.getAPIHistoryLength(),
|
|
49
|
-
|
|
49
|
+
25,
|
|
50
50
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
51
51
|
);
|
|
52
52
|
return;
|
|
@@ -131,7 +131,7 @@ describe('type: journey', () => {
|
|
|
131
131
|
);
|
|
132
132
|
assert.equal(
|
|
133
133
|
testUtils.getAPIHistoryLength(),
|
|
134
|
-
|
|
134
|
+
21,
|
|
135
135
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
136
136
|
);
|
|
137
137
|
return;
|
|
@@ -258,7 +258,7 @@ describe('type: journey', () => {
|
|
|
258
258
|
|
|
259
259
|
assert.equal(
|
|
260
260
|
testUtils.getAPIHistoryLength(),
|
|
261
|
-
|
|
261
|
+
25,
|
|
262
262
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
263
263
|
);
|
|
264
264
|
return;
|
|
@@ -431,7 +431,7 @@ describe('type: journey', () => {
|
|
|
431
431
|
|
|
432
432
|
assert.equal(
|
|
433
433
|
testUtils.getAPIHistoryLength(),
|
|
434
|
-
|
|
434
|
+
31,
|
|
435
435
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
436
436
|
);
|
|
437
437
|
return;
|
|
@@ -466,7 +466,7 @@ describe('type: journey', () => {
|
|
|
466
466
|
|
|
467
467
|
assert.equal(
|
|
468
468
|
testUtils.getAPIHistoryLength(),
|
|
469
|
-
|
|
469
|
+
31,
|
|
470
470
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
471
471
|
);
|
|
472
472
|
return;
|
|
@@ -501,7 +501,7 @@ describe('type: journey', () => {
|
|
|
501
501
|
|
|
502
502
|
assert.equal(
|
|
503
503
|
testUtils.getAPIHistoryLength(),
|
|
504
|
-
|
|
504
|
+
31,
|
|
505
505
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
506
506
|
);
|
|
507
507
|
return;
|
|
@@ -509,6 +509,70 @@ describe('type: journey', () => {
|
|
|
509
509
|
});
|
|
510
510
|
|
|
511
511
|
describe('Publish ================', () => {
|
|
512
|
+
it(`Should not publish a transactional journey by key that is already published`, async () => {
|
|
513
|
+
handler.setOptions({ skipStatusCheck: true });
|
|
514
|
+
// WHEN
|
|
515
|
+
const publish = await handler.publish(
|
|
516
|
+
'testInstance/testBU',
|
|
517
|
+
['journey'],
|
|
518
|
+
['testExisting_temail']
|
|
519
|
+
);
|
|
520
|
+
// THEN
|
|
521
|
+
assert.equal(process.exitCode, 1, 'publish should have thrown an error');
|
|
522
|
+
|
|
523
|
+
assert.deepEqual(
|
|
524
|
+
publish['testInstance/testBU']?.journey,
|
|
525
|
+
[],
|
|
526
|
+
'should have not have published any journey'
|
|
527
|
+
);
|
|
528
|
+
|
|
529
|
+
assert.equal(
|
|
530
|
+
testUtils.getAPIHistoryLength(),
|
|
531
|
+
1,
|
|
532
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
533
|
+
);
|
|
534
|
+
return;
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
it('Should publish a transactional journey by key', async () => {
|
|
538
|
+
handler.setOptions({ skipStatusCheck: true });
|
|
539
|
+
// WHEN
|
|
540
|
+
const publish = await handler.publish(
|
|
541
|
+
'testInstance/testBU',
|
|
542
|
+
['journey'],
|
|
543
|
+
['testExisting_temail_notPublished']
|
|
544
|
+
);
|
|
545
|
+
// THEN
|
|
546
|
+
assert.equal(process.exitCode, 0, 'publish should not have thrown an error');
|
|
547
|
+
// retrieve result
|
|
548
|
+
assert.deepEqual(
|
|
549
|
+
publish['testInstance/testBU']?.journey,
|
|
550
|
+
['testExisting_temail_notPublished'],
|
|
551
|
+
'should have published the right journey'
|
|
552
|
+
);
|
|
553
|
+
|
|
554
|
+
// get callouts
|
|
555
|
+
const publishCallout = testUtils.getRestCallout(
|
|
556
|
+
'post',
|
|
557
|
+
'/interaction/v1/interactions/transactional/create'
|
|
558
|
+
);
|
|
559
|
+
// confirm created item
|
|
560
|
+
assert.deepEqual(
|
|
561
|
+
publishCallout,
|
|
562
|
+
{
|
|
563
|
+
definitionId: 'd4a900fe-3a8f-4cc5-9a49-81286e3e2cd2',
|
|
564
|
+
},
|
|
565
|
+
'publish-payload JSON was not equal expected'
|
|
566
|
+
);
|
|
567
|
+
|
|
568
|
+
assert.equal(
|
|
569
|
+
testUtils.getAPIHistoryLength(),
|
|
570
|
+
33,
|
|
571
|
+
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
572
|
+
);
|
|
573
|
+
return;
|
|
574
|
+
});
|
|
575
|
+
|
|
512
576
|
it('Should publish a journey by key (auto-picks latest version)', async () => {
|
|
513
577
|
handler.setOptions({ skipStatusCheck: true });
|
|
514
578
|
// WHEN
|
|
@@ -535,7 +599,7 @@ describe('type: journey', () => {
|
|
|
535
599
|
assert.deepEqual(
|
|
536
600
|
publishCallout,
|
|
537
601
|
await testUtils.getExpectedJson('9999999', 'journey', 'publish-callout'),
|
|
538
|
-
'
|
|
602
|
+
'publish-payload JSON was not equal expected'
|
|
539
603
|
);
|
|
540
604
|
|
|
541
605
|
assert.equal(
|
|
@@ -559,7 +623,7 @@ describe('type: journey', () => {
|
|
|
559
623
|
// retrieve result
|
|
560
624
|
assert.deepEqual(
|
|
561
625
|
publish['testInstance/testBU']?.journey,
|
|
562
|
-
['
|
|
626
|
+
['testExisting_journey_Quicksend'],
|
|
563
627
|
'should have published the right journey'
|
|
564
628
|
);
|
|
565
629
|
|
|
@@ -572,12 +636,11 @@ describe('type: journey', () => {
|
|
|
572
636
|
assert.deepEqual(
|
|
573
637
|
publishCallout,
|
|
574
638
|
await testUtils.getExpectedJson('9999999', 'journey', 'publish-callout'),
|
|
575
|
-
'
|
|
639
|
+
'publish-payload JSON was not equal expected'
|
|
576
640
|
);
|
|
577
|
-
|
|
578
641
|
assert.equal(
|
|
579
642
|
testUtils.getAPIHistoryLength(),
|
|
580
|
-
|
|
643
|
+
2,
|
|
581
644
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
582
645
|
);
|
|
583
646
|
return;
|
|
@@ -596,7 +659,7 @@ describe('type: journey', () => {
|
|
|
596
659
|
// retrieve result
|
|
597
660
|
assert.deepEqual(
|
|
598
661
|
publish['testInstance/testBU']?.journey,
|
|
599
|
-
['
|
|
662
|
+
['testExisting_journey_Quicksend'],
|
|
600
663
|
'should have published the right journey'
|
|
601
664
|
);
|
|
602
665
|
|
|
@@ -609,7 +672,7 @@ describe('type: journey', () => {
|
|
|
609
672
|
assert.deepEqual(
|
|
610
673
|
publishCallout,
|
|
611
674
|
await testUtils.getExpectedJson('9999999', 'journey', 'publish-callout'),
|
|
612
|
-
'
|
|
675
|
+
'publish-payload JSON was not equal expected'
|
|
613
676
|
);
|
|
614
677
|
|
|
615
678
|
assert.equal(
|
|
@@ -651,12 +714,12 @@ describe('type: journey', () => {
|
|
|
651
714
|
assert.deepEqual(
|
|
652
715
|
publishCallout,
|
|
653
716
|
await testUtils.getExpectedJson('9999999', 'journey', 'publish-callout'),
|
|
654
|
-
'
|
|
717
|
+
'publish-payload JSON was not equal expected'
|
|
655
718
|
);
|
|
656
719
|
|
|
657
720
|
assert.equal(
|
|
658
721
|
testUtils.getAPIHistoryLength(),
|
|
659
|
-
|
|
722
|
+
3,
|
|
660
723
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
661
724
|
);
|
|
662
725
|
return;
|
|
@@ -693,12 +756,12 @@ describe('type: journey', () => {
|
|
|
693
756
|
assert.deepEqual(
|
|
694
757
|
publishCallout,
|
|
695
758
|
await testUtils.getExpectedJson('9999999', 'journey', 'publish-callout'),
|
|
696
|
-
'
|
|
759
|
+
'publish-payload JSON was not equal expected'
|
|
697
760
|
);
|
|
698
761
|
|
|
699
762
|
assert.equal(
|
|
700
763
|
testUtils.getAPIHistoryLength(),
|
|
701
|
-
|
|
764
|
+
3,
|
|
702
765
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
703
766
|
);
|
|
704
767
|
return;
|
|
@@ -735,12 +798,12 @@ describe('type: journey', () => {
|
|
|
735
798
|
assert.deepEqual(
|
|
736
799
|
publishCallout,
|
|
737
800
|
await testUtils.getExpectedJson('9999999', 'journey', 'publish-callout'),
|
|
738
|
-
'
|
|
801
|
+
'publish-payload JSON was not equal expected'
|
|
739
802
|
);
|
|
740
803
|
|
|
741
804
|
assert.equal(
|
|
742
805
|
testUtils.getAPIHistoryLength(),
|
|
743
|
-
|
|
806
|
+
3,
|
|
744
807
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
745
808
|
);
|
|
746
809
|
return;
|
|
@@ -26,8 +26,8 @@ describe('type: transactionalEmail', () => {
|
|
|
26
26
|
const result = cache.getCache();
|
|
27
27
|
assert.equal(
|
|
28
28
|
result.transactionalEmail ? Object.keys(result.transactionalEmail).length : 0,
|
|
29
|
-
|
|
30
|
-
'
|
|
29
|
+
2,
|
|
30
|
+
'unexpected number of transactionalEmail'
|
|
31
31
|
);
|
|
32
32
|
assert.deepEqual(
|
|
33
33
|
await testUtils.getActualJson('testExisting_temail', 'transactionalEmail'),
|
|
@@ -36,7 +36,7 @@ describe('type: transactionalEmail', () => {
|
|
|
36
36
|
);
|
|
37
37
|
assert.equal(
|
|
38
38
|
testUtils.getAPIHistoryLength(),
|
|
39
|
-
|
|
39
|
+
12,
|
|
40
40
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
41
41
|
);
|
|
42
42
|
return;
|
|
@@ -57,8 +57,8 @@ describe('type: transactionalEmail', () => {
|
|
|
57
57
|
const result = cache.getCache();
|
|
58
58
|
assert.equal(
|
|
59
59
|
result.transactionalEmail ? Object.keys(result.transactionalEmail).length : 0,
|
|
60
|
-
|
|
61
|
-
'
|
|
60
|
+
3,
|
|
61
|
+
'unexpected number of transactionalEmails'
|
|
62
62
|
);
|
|
63
63
|
// confirm created item
|
|
64
64
|
assert.deepEqual(
|
|
@@ -75,7 +75,7 @@ describe('type: transactionalEmail', () => {
|
|
|
75
75
|
// check number of API calls
|
|
76
76
|
assert.equal(
|
|
77
77
|
testUtils.getAPIHistoryLength(),
|
|
78
|
-
|
|
78
|
+
14,
|
|
79
79
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
80
80
|
);
|
|
81
81
|
return;
|
|
@@ -137,7 +137,7 @@ describe('type: transactionalEmail', () => {
|
|
|
137
137
|
);
|
|
138
138
|
assert.equal(
|
|
139
139
|
testUtils.getAPIHistoryLength(),
|
|
140
|
-
|
|
140
|
+
12,
|
|
141
141
|
'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests'
|
|
142
142
|
);
|
|
143
143
|
return;
|
package/test/utils.js
CHANGED
|
@@ -33,6 +33,21 @@ const authResources = File.readJsonSync(path.join(__dirname, './resources/auth.j
|
|
|
33
33
|
export async function copyFile(from, to, mid = '9999999') {
|
|
34
34
|
return File.copyFileSimple(`./test/resources/${mid}/${from}`, `./test/resources/${mid}/${to}`);
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* gets file from Retrieve folder
|
|
39
|
+
*
|
|
40
|
+
* @param {string} from source path (starting in bu folder)
|
|
41
|
+
* @param {string} to target path (starting in bu folder)
|
|
42
|
+
* @param {string} [mid] used when we need to test on ParentBU
|
|
43
|
+
* @param {string} [buName] used when we need to test on ParentBU
|
|
44
|
+
* @returns {void} -
|
|
45
|
+
*/
|
|
46
|
+
export function copyToDeploy(from, to, mid = '9999999', buName = 'testBU') {
|
|
47
|
+
console.log(`Copying ${from} to deploy folder`); // eslint-disable-line no-console
|
|
48
|
+
File.copySync(`./test/resources/${mid}/${from}`, `./deploy/testInstance/${buName}/${to}`);
|
|
49
|
+
}
|
|
50
|
+
|
|
36
51
|
/**
|
|
37
52
|
* gets file from Retrieve folder
|
|
38
53
|
*
|
|
@@ -61,6 +76,7 @@ export function getActualDoc(customerKey, type, buName = 'testBU') {
|
|
|
61
76
|
'utf8'
|
|
62
77
|
);
|
|
63
78
|
}
|
|
79
|
+
|
|
64
80
|
/**
|
|
65
81
|
* gets file from Retrieve folder
|
|
66
82
|
*
|
|
@@ -79,6 +95,7 @@ export async function getActualFile(customerKey, type, ext, buName = 'testBU') {
|
|
|
79
95
|
return null;
|
|
80
96
|
}
|
|
81
97
|
}
|
|
98
|
+
|
|
82
99
|
/**
|
|
83
100
|
* gets file from Deploy folder
|
|
84
101
|
*
|
|
@@ -92,6 +109,7 @@ export function getActualDeployJson(customerKey, type, buName = 'testBU') {
|
|
|
92
109
|
`./deploy/testInstance/${buName}/${type}/${customerKey}.${type}-meta.json`
|
|
93
110
|
);
|
|
94
111
|
}
|
|
112
|
+
|
|
95
113
|
/**
|
|
96
114
|
* gets file from Deploy folder
|
|
97
115
|
*
|
|
@@ -107,6 +125,7 @@ export function getActualDeployFile(customerKey, type, ext, buName = 'testBU') {
|
|
|
107
125
|
'utf8'
|
|
108
126
|
);
|
|
109
127
|
}
|
|
128
|
+
|
|
110
129
|
/**
|
|
111
130
|
* gets file from Template folder
|
|
112
131
|
*
|
|
@@ -117,6 +136,7 @@ export function getActualDeployFile(customerKey, type, ext, buName = 'testBU') {
|
|
|
117
136
|
export function getActualTemplateJson(customerKey, type) {
|
|
118
137
|
return File.readJSON(`./template/${type}/${customerKey}.${type}-meta.json`);
|
|
119
138
|
}
|
|
139
|
+
|
|
120
140
|
/**
|
|
121
141
|
* gets file from Template folder
|
|
122
142
|
*
|
|
@@ -128,6 +148,7 @@ export function getActualTemplateJson(customerKey, type) {
|
|
|
128
148
|
export function getActualTemplateFile(customerKey, type, ext) {
|
|
129
149
|
return File.readFile(`./template/${type}/${customerKey}.${type}-meta.${ext}`, 'utf8');
|
|
130
150
|
}
|
|
151
|
+
|
|
131
152
|
/**
|
|
132
153
|
* gets file from resources folder which should be used for comparison
|
|
133
154
|
*
|
|
@@ -139,6 +160,7 @@ export function getActualTemplateFile(customerKey, type, ext) {
|
|
|
139
160
|
export function getExpectedJson(mid, type, action) {
|
|
140
161
|
return File.readJSON(`./test/resources/${mid}/${type}/${action}-expected.json`);
|
|
141
162
|
}
|
|
163
|
+
|
|
142
164
|
/**
|
|
143
165
|
* gets file from resources folder which should be used for comparison
|
|
144
166
|
*
|
|
@@ -151,6 +173,7 @@ export function getExpectedJson(mid, type, action) {
|
|
|
151
173
|
export function getExpectedFile(mid, type, action, ext) {
|
|
152
174
|
return File.readFile(`./test/resources/${mid}/${type}/${action}-expected.${ext}`, 'utf8');
|
|
153
175
|
}
|
|
176
|
+
|
|
154
177
|
/**
|
|
155
178
|
* setup mocks for API and FS
|
|
156
179
|
*
|
|
@@ -267,6 +290,7 @@ export function mockReset() {
|
|
|
267
290
|
fsmock.restore();
|
|
268
291
|
apimock.restore();
|
|
269
292
|
}
|
|
293
|
+
|
|
270
294
|
/**
|
|
271
295
|
* helper to return amount of api callouts
|
|
272
296
|
*
|
|
@@ -280,6 +304,7 @@ export function getAPIHistoryLength(includeToken) {
|
|
|
280
304
|
}
|
|
281
305
|
return historyArr.filter((item) => item.url !== '/v2/token').length;
|
|
282
306
|
}
|
|
307
|
+
|
|
283
308
|
/**
|
|
284
309
|
* helper to return api history
|
|
285
310
|
*
|
|
@@ -288,13 +313,15 @@ export function getAPIHistoryLength(includeToken) {
|
|
|
288
313
|
export function getAPIHistory() {
|
|
289
314
|
return apimock.history;
|
|
290
315
|
}
|
|
316
|
+
|
|
291
317
|
/**
|
|
292
318
|
*
|
|
293
319
|
* @param {'patch'|'delete'|'post'|'get'|'put'} method http method
|
|
294
320
|
* @param {string} url url without domain, end on % if you want to search with startsWith()
|
|
321
|
+
* @param {boolean} returnAll useful for post requests that often have multiple callouts with the same url
|
|
295
322
|
* @returns {object} json payload of the request
|
|
296
323
|
*/
|
|
297
|
-
export function getRestCallout(method, url) {
|
|
324
|
+
export function getRestCallout(method, url, returnAll = false) {
|
|
298
325
|
if (!apimock.history[method]?.length) {
|
|
299
326
|
console.log(`${tWarn} No history for method ${method}.`); // eslint-disable-line no-console
|
|
300
327
|
const methods = Object.keys(apimock.history)
|
|
@@ -304,9 +331,18 @@ export function getRestCallout(method, url) {
|
|
|
304
331
|
return null;
|
|
305
332
|
}
|
|
306
333
|
const subset = apimock.history[method];
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* helper for filter/find
|
|
337
|
+
*
|
|
338
|
+
* @param {any} item history item
|
|
339
|
+
* @returns {boolean} if item matches
|
|
340
|
+
*/
|
|
341
|
+
function findCallout(item) {
|
|
342
|
+
return url.endsWith('%') ? item.url.startsWith(url.slice(0, -1)) : item.url === url;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
const myCallout = returnAll ? subset.filter(findCallout) : subset.find(findCallout);
|
|
310
346
|
if (!myCallout) {
|
|
311
347
|
console.error(`${tWarn} No callout found for ${method} ${url}`); // eslint-disable-line no-console
|
|
312
348
|
const urls = [...new Set(subset.map((el) => el.url))].join('\n- ');
|
|
@@ -317,8 +353,9 @@ export function getRestCallout(method, url) {
|
|
|
317
353
|
console.error(`Available unique urls in method ${method}:\n- ${urls}`); // eslint-disable-line no-console
|
|
318
354
|
return null;
|
|
319
355
|
}
|
|
320
|
-
return JSON.parse(myCallout.data);
|
|
356
|
+
return returnAll ? myCallout.map((el) => JSON.parse(el.data)) : JSON.parse(myCallout.data);
|
|
321
357
|
}
|
|
358
|
+
|
|
322
359
|
/**
|
|
323
360
|
*
|
|
324
361
|
* @param {'Schedule'|'Retrieve'|'Create'|'Update'|'Delete'|'Describe'|'Execute'} requestAction soap request types
|
|
@@ -349,6 +386,7 @@ export function getSoapCallouts(requestAction, objectType) {
|
|
|
349
386
|
}
|
|
350
387
|
return myCallout;
|
|
351
388
|
}
|
|
389
|
+
|
|
352
390
|
/**
|
|
353
391
|
* helper to return most important fields for each api call
|
|
354
392
|
*
|
|
@@ -366,6 +404,7 @@ export function getAPIHistoryDebug() {
|
|
|
366
404
|
});
|
|
367
405
|
return historyArr;
|
|
368
406
|
}
|
|
407
|
+
|
|
369
408
|
/**
|
|
370
409
|
* helper to return most important fields for each api call
|
|
371
410
|
*
|
package/types/mcdev.d.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @property {string} [businessUnit] name of the BU to interact with
|
|
9
9
|
* @property {string} [credential] name of the credential to interact with
|
|
10
10
|
*/
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* @typedef {Object.<string, string>} TemplateMap
|
|
13
14
|
* @typedef {'asset'|'asset-archive'|'asset-asset'|'asset-audio'|'asset-block'|'asset-code'|'asset-document'|'asset-image'|'asset-message'|'asset-other'|'asset-rawimage'|'asset-template'|'asset-textfile'|'asset-video'|'attributeGroup'|'attributeSet'|'automation'|'campaign'|'contentArea'|'dataExtension'|'dataExtensionField'|'dataExtensionTemplate'|'dataExtract'|'dataExtractType'|'discovery'|'deliveryProfile'|'email'|'emailSend'|'event'|'fileLocation'|'fileTransfer'|'filter'|'folder'|'importFile'|'journey'|'list'|'mobileCode'|'mobileKeyword'|'mobileMessage'|'query'|'role'|'script'|'sendClassification'|'senderProfile'|'transactionalEmail'|'transactionalPush'|'transactionalSMS'|'triggeredSend'|'user'|'verification'} SupportedMetadataTypes
|
|
@@ -31,6 +32,7 @@
|
|
|
31
32
|
* @property {CodeExtract[]} codeArr list of code snippets in this item
|
|
32
33
|
* @property {string[]} subFolder mostly set to null, otherwise list of subfolders
|
|
33
34
|
*/
|
|
35
|
+
|
|
34
36
|
/**
|
|
35
37
|
* @typedef {object} CodeExtract
|
|
36
38
|
* @property {string[]} subFolder mostly set to null, otherwise subfolders path split into elements
|
|
@@ -39,6 +41,7 @@
|
|
|
39
41
|
* @property {string} content file content
|
|
40
42
|
* @property {'base64'} [encoding] optional for binary files
|
|
41
43
|
*/
|
|
44
|
+
|
|
42
45
|
/**
|
|
43
46
|
* @typedef {object} QueryItem
|
|
44
47
|
* @property {string} name name
|
|
@@ -59,6 +62,7 @@
|
|
|
59
62
|
* @property {string} [queryDefinitionId] Object ID of query
|
|
60
63
|
* @typedef {Object.<string, QueryItem>} QueryMap
|
|
61
64
|
*/
|
|
65
|
+
|
|
62
66
|
/**
|
|
63
67
|
* @typedef {object} ScriptItem
|
|
64
68
|
* @property {string} name name
|
|
@@ -71,11 +75,13 @@
|
|
|
71
75
|
* @property {string} r__folder_Path folder path in which this DE is saved
|
|
72
76
|
* @typedef {Object.<string, ScriptItem>} ScriptMap
|
|
73
77
|
*/
|
|
78
|
+
|
|
74
79
|
/**
|
|
75
80
|
* @typedef {Object.<string, any>} AssetItem
|
|
76
81
|
* @typedef {Object.<string, AssetItem>} AssetMap
|
|
77
82
|
* @typedef {'archive'|'asset'|'audio'|'block'|'code'|'document'|'image'|'message'|'other'|'rawimage'|'template'|'textfile'|'video'} AssetSubType
|
|
78
83
|
*/
|
|
84
|
+
|
|
79
85
|
/**
|
|
80
86
|
* @typedef {object} DataExtensionFieldItem
|
|
81
87
|
* @property {string} [ObjectID] id
|
|
@@ -93,9 +99,11 @@
|
|
|
93
99
|
* @property {number|string} MaxLength field length
|
|
94
100
|
* @property {string} Scale the number of places after the decimal that the field can hold; example: "0","1", ...
|
|
95
101
|
*/
|
|
102
|
+
|
|
96
103
|
/**
|
|
97
104
|
* @typedef {Object.<string, DataExtensionFieldItem>} DataExtensionFieldMap key: name of field, value: DataExtensionFieldItem
|
|
98
105
|
*/
|
|
106
|
+
|
|
99
107
|
/**
|
|
100
108
|
* @typedef {object} DataExtensionItem
|
|
101
109
|
* @property {string} CustomerKey key
|
|
@@ -126,9 +134,11 @@
|
|
|
126
134
|
* @property {boolean} ResetRetentionPeriodOnImport ?
|
|
127
135
|
* @property {boolean} [DeleteAtEndOfRetentionPeriod] true for retention policy allRecords
|
|
128
136
|
*/
|
|
137
|
+
|
|
129
138
|
/**
|
|
130
139
|
* @typedef {Object.<string, DataExtensionItem>} DataExtensionMap
|
|
131
140
|
*/
|
|
141
|
+
|
|
132
142
|
/**
|
|
133
143
|
* @typedef {object} UserDocument
|
|
134
144
|
* @property {'User'|'Installed Package'|'Inactivated User'} TYPE -
|
|
@@ -170,10 +180,12 @@
|
|
|
170
180
|
* @property {object} [SsoIdentity] -
|
|
171
181
|
* @property {Array|object} [SsoIdentities] -
|
|
172
182
|
*/
|
|
183
|
+
|
|
173
184
|
/**
|
|
174
185
|
* @typedef {{before:UserDocument,after:UserDocument}} UserDocumentDiff
|
|
175
186
|
* @typedef {Object.<string, UserDocument>} UserDocumentMap key=customer key
|
|
176
187
|
*/
|
|
188
|
+
|
|
177
189
|
/**
|
|
178
190
|
* @typedef {object} UserDocumentDocumentHelper
|
|
179
191
|
* @property {string} ActiveFlagDocs docs: user.ActiveFlag === true ? '✓' : '-'
|
|
@@ -187,6 +199,7 @@
|
|
|
187
199
|
* @property {string} IsLockedDocs docs: if the user cannot login
|
|
188
200
|
* @typedef {UserDocument & UserDocumentDocumentHelper} UserDocumentDocument
|
|
189
201
|
*/
|
|
202
|
+
|
|
190
203
|
/**
|
|
191
204
|
* @typedef {object} AccountUserConfiguration
|
|
192
205
|
* @property {object} Client wrapper
|
|
@@ -211,6 +224,7 @@
|
|
|
211
224
|
* @property {number} [displayOrder] order within step; starts with 1 or higher number
|
|
212
225
|
* @property {string} r__type see this.definition.activityTypeMapping
|
|
213
226
|
*/
|
|
227
|
+
|
|
214
228
|
/**
|
|
215
229
|
* @typedef {object} AutomationStep
|
|
216
230
|
* @property {string} name description
|
|
@@ -219,6 +233,7 @@
|
|
|
219
233
|
* @property {number} [stepNumber] step iterator, automatically set during deployment
|
|
220
234
|
* @property {AutomationActivity[]} activities -
|
|
221
235
|
*/
|
|
236
|
+
|
|
222
237
|
/**
|
|
223
238
|
* @typedef {object} AutomationSchedule REST format
|
|
224
239
|
* @property {number} typeId equals schedule.scheduleTypeId; upsert endpoint requires scheduleTypeId. retrieve endpoint returns typeId
|
|
@@ -233,6 +248,7 @@
|
|
|
233
248
|
* @property {any} [scheduledTime] ?
|
|
234
249
|
* @property {string} [scheduledStatus] ?
|
|
235
250
|
*/
|
|
251
|
+
|
|
236
252
|
/**
|
|
237
253
|
* @typedef {object} AutomationScheduleSoap SOAP format
|
|
238
254
|
* @property {string} [RecurrenceType] 'Minutely'|'Hourly'|'Daily'|'Weekly'|'Monthly'|'Yearly'
|
|
@@ -261,6 +277,7 @@
|
|
|
261
277
|
* @property {'EndOn'|'EndAfter'} RecurrenceRangeType set to 'EndOn' if AutomationSchedule.icalRecur contains 'UNTIL'; otherwise to 'EndAfter'
|
|
262
278
|
* @property {number} [Occurrences] only exists if RecurrenceRangeType=='EndAfter'
|
|
263
279
|
*/
|
|
280
|
+
|
|
264
281
|
/**
|
|
265
282
|
* @typedef {object} AutomationItem
|
|
266
283
|
* @property {string} id Object Id
|
|
@@ -296,6 +313,7 @@
|
|
|
296
313
|
* @property {string} [r__folder_Path] folder path
|
|
297
314
|
* @property {string} [categoryId] holds folder ID, replaced with r__folder_Path during retrieve
|
|
298
315
|
*/
|
|
316
|
+
|
|
299
317
|
/**
|
|
300
318
|
* @typedef {object} VerificationItem
|
|
301
319
|
* @property {string} dataVerificationDefinitionId ID / Key
|
|
@@ -331,6 +349,7 @@
|
|
|
331
349
|
* @property {string} _businessUnit mcdev business unit name inside of _credential
|
|
332
350
|
* @typedef {import('simple-git').DiffResultTextFile & McdevDeltaPkgItem} DeltaPkgItem
|
|
333
351
|
*/
|
|
352
|
+
|
|
334
353
|
/**
|
|
335
354
|
* @typedef {import('sfmc-sdk/util').RestError} RestError
|
|
336
355
|
* @typedef {import('sfmc-sdk/util').SOAPError} SOAPError
|
|
@@ -368,30 +387,35 @@
|
|
|
368
387
|
complex
|
|
369
388
|
* @property {boolean} [QueryAllAccounts] all BUs or just one
|
|
370
389
|
*/
|
|
390
|
+
|
|
371
391
|
/**
|
|
372
392
|
* @typedef {object} SoapFilterSimple
|
|
373
393
|
* @property {string} property field
|
|
374
394
|
* @property {'equals'|'notEquals'|'isNull'|'isNotNull'|'greaterThan'|'lessThan'|'greaterThanOrEqual'|'lessThanOrEqual'|'between'|'IN'|'in'|'like'} simpleOperator various options
|
|
375
395
|
* @property {string | number | boolean | string[] | number[]} [value] field value
|
|
376
396
|
*/
|
|
397
|
+
|
|
377
398
|
/**
|
|
378
399
|
* @typedef {object} SoapFilterComplex
|
|
379
400
|
* @property {SoapSDKFilter} leftOperand string for simple or a new filter-object for complex
|
|
380
401
|
* @property {'AND'|'OR'} logicalOperator various options
|
|
381
402
|
* @property {SoapSDKFilter} rightOperand string for simple or a new filter-object for complex; omit for isNull and isNotNull
|
|
382
403
|
*/
|
|
404
|
+
|
|
383
405
|
/**
|
|
384
406
|
* @typedef {object} SoapSDKFilterSimple
|
|
385
407
|
* @property {SoapFilterSimple["property"]} leftOperand string for simple or a new filter-object for complex
|
|
386
408
|
* @property {SoapFilterSimple["simpleOperator"]} operator various options
|
|
387
409
|
* @property {SoapFilterSimple["value"]} [rightOperand] string for simple or a new filter-object for complex; omit for isNull and isNotNull
|
|
388
410
|
*/
|
|
411
|
+
|
|
389
412
|
/**
|
|
390
413
|
* @typedef {object} SoapSDKFilterComplex
|
|
391
414
|
* @property {SoapFilterComplex["leftOperand"]} leftOperand string for simple or a new filter-object for complex
|
|
392
415
|
* @property {SoapFilterComplex["logicalOperator"]} operator various options
|
|
393
416
|
* @property {SoapFilterComplex["rightOperand"]} rightOperand string for simple or a new filter-object for complex; omit for isNull and isNotNull
|
|
394
417
|
*/
|
|
418
|
+
|
|
395
419
|
/**
|
|
396
420
|
* @typedef {SoapSDKFilterSimple | SoapSDKFilterComplex} SoapSDKFilter
|
|
397
421
|
*/
|
|
@@ -414,6 +438,7 @@ complex
|
|
|
414
438
|
* @property {'AND'|'OR'} logicalOperator various options
|
|
415
439
|
* @property {SoapSDKFilter | AssetFilterSimple} [rightOperand] string for simple or a new filter-object for complex; omit for isNull and isNotNull
|
|
416
440
|
*/
|
|
441
|
+
|
|
417
442
|
/**
|
|
418
443
|
* @typedef {object} AssetFilterSimple
|
|
419
444
|
* @property {string} property field
|
|
@@ -448,12 +473,14 @@ complex
|
|
|
448
473
|
* @property {(ex:SDKError,message?:string)=>void} errorStack print error with trace message
|
|
449
474
|
* @typedef {import('winston').Logger & McdevLogger} Logger
|
|
450
475
|
*/
|
|
476
|
+
|
|
451
477
|
/**
|
|
452
478
|
* @typedef {{id: number, key: string, name: string}} AssetItemSimple
|
|
453
479
|
* @typedef {Object.<string, AssetItemSimple>} AssetItemSimpleMap
|
|
454
480
|
* @typedef {Object.<number, AssetItemSimple>} AssetItemIdSimpleMap
|
|
455
481
|
* @typedef {'id'|'key'|'name'} ContentBlockConversionTypes
|
|
456
482
|
*/
|
|
483
|
+
|
|
457
484
|
/**
|
|
458
485
|
* @typedef {object} ExplainType
|
|
459
486
|
* @property {string} name readable name of type
|
/package/test/resources/9999999/dataFolder/{retrieve-response-.xml → +retrieve-response.xml}
RENAMED
|
File without changes
|