mcdev 3.1.3 → 4.0.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 (134) hide show
  1. package/.eslintrc.json +67 -7
  2. package/.github/ISSUE_TEMPLATE/bug.yml +2 -1
  3. package/.github/PULL_REQUEST_TEMPLATE.md +5 -3
  4. package/.github/dependabot.yml +14 -0
  5. package/.github/workflows/code-analysis.yml +57 -0
  6. package/.husky/commit-msg +10 -0
  7. package/.husky/post-checkout +5 -0
  8. package/.husky/pre-commit +2 -1
  9. package/.prettierrc +8 -0
  10. package/.vscode/settings.json +1 -1
  11. package/LICENSE +2 -2
  12. package/README.md +134 -45
  13. package/boilerplate/config.json +5 -11
  14. package/boilerplate/files/.prettierrc +8 -0
  15. package/boilerplate/files/.vscode/extensions.json +0 -1
  16. package/boilerplate/files/.vscode/settings.json +28 -2
  17. package/boilerplate/files/README.md +2 -2
  18. package/boilerplate/forcedUpdates.json +10 -0
  19. package/boilerplate/npm-dependencies.json +5 -5
  20. package/docs/dist/documentation.md +2795 -1724
  21. package/jsconfig.json +1 -1
  22. package/lib/Builder.js +166 -75
  23. package/lib/Deployer.js +244 -96
  24. package/lib/MetadataTypeDefinitions.js +2 -0
  25. package/lib/MetadataTypeInfo.js +2 -0
  26. package/lib/Retriever.js +61 -84
  27. package/lib/cli.js +116 -11
  28. package/lib/index.js +241 -561
  29. package/lib/metadataTypes/AccountUser.js +101 -95
  30. package/lib/metadataTypes/Asset.js +677 -248
  31. package/lib/metadataTypes/AttributeGroup.js +23 -12
  32. package/lib/metadataTypes/Automation.js +451 -354
  33. package/lib/metadataTypes/Campaign.js +33 -93
  34. package/lib/metadataTypes/ContentArea.js +31 -11
  35. package/lib/metadataTypes/DataExtension.js +387 -372
  36. package/lib/metadataTypes/DataExtensionField.js +131 -54
  37. package/lib/metadataTypes/DataExtensionTemplate.js +22 -4
  38. package/lib/metadataTypes/DataExtract.js +61 -48
  39. package/lib/metadataTypes/DataExtractType.js +14 -8
  40. package/lib/metadataTypes/Discovery.js +21 -16
  41. package/lib/metadataTypes/Email.js +32 -12
  42. package/lib/metadataTypes/EmailSendDefinition.js +85 -80
  43. package/lib/metadataTypes/EventDefinition.js +61 -43
  44. package/lib/metadataTypes/FileTransfer.js +72 -52
  45. package/lib/metadataTypes/Filter.js +11 -4
  46. package/lib/metadataTypes/Folder.js +149 -117
  47. package/lib/metadataTypes/FtpLocation.js +14 -8
  48. package/lib/metadataTypes/ImportFile.js +61 -64
  49. package/lib/metadataTypes/Interaction.js +19 -4
  50. package/lib/metadataTypes/List.js +54 -13
  51. package/lib/metadataTypes/MetadataType.js +668 -454
  52. package/lib/metadataTypes/MobileCode.js +46 -0
  53. package/lib/metadataTypes/MobileKeyword.js +114 -0
  54. package/lib/metadataTypes/Query.js +204 -103
  55. package/lib/metadataTypes/Role.js +76 -61
  56. package/lib/metadataTypes/Script.js +145 -81
  57. package/lib/metadataTypes/SetDefinition.js +20 -8
  58. package/lib/metadataTypes/TriggeredSendDefinition.js +78 -58
  59. package/lib/metadataTypes/definitions/Asset.definition.js +21 -10
  60. package/lib/metadataTypes/definitions/AttributeGroup.definition.js +12 -0
  61. package/lib/metadataTypes/definitions/Automation.definition.js +10 -5
  62. package/lib/metadataTypes/definitions/Campaign.definition.js +44 -1
  63. package/lib/metadataTypes/definitions/DataExtension.definition.js +4 -0
  64. package/lib/metadataTypes/definitions/DataExtensionTemplate.definition.js +6 -0
  65. package/lib/metadataTypes/definitions/DataExtract.definition.js +18 -14
  66. package/lib/metadataTypes/definitions/Discovery.definition.js +12 -0
  67. package/lib/metadataTypes/definitions/EmailSendDefinition.definition.js +4 -0
  68. package/lib/metadataTypes/definitions/EventDefinition.definition.js +22 -0
  69. package/lib/metadataTypes/definitions/FileTransfer.definition.js +4 -0
  70. package/lib/metadataTypes/definitions/Filter.definition.js +4 -0
  71. package/lib/metadataTypes/definitions/Folder.definition.js +6 -0
  72. package/lib/metadataTypes/definitions/FtpLocation.definition.js +4 -0
  73. package/lib/metadataTypes/definitions/ImportFile.definition.js +10 -5
  74. package/lib/metadataTypes/definitions/Interaction.definition.js +4 -0
  75. package/lib/metadataTypes/definitions/MobileCode.definition.js +163 -0
  76. package/lib/metadataTypes/definitions/MobileKeyword.definition.js +253 -0
  77. package/lib/metadataTypes/definitions/Query.definition.js +4 -0
  78. package/lib/metadataTypes/definitions/Role.definition.js +5 -0
  79. package/lib/metadataTypes/definitions/Script.definition.js +4 -0
  80. package/lib/metadataTypes/definitions/SetDefinition.definition.js +28 -0
  81. package/lib/metadataTypes/definitions/TriggeredSendDefinition.definition.js +4 -0
  82. package/lib/retrieveChangelog.js +7 -6
  83. package/lib/util/auth.js +117 -0
  84. package/lib/util/businessUnit.js +55 -66
  85. package/lib/util/cache.js +194 -0
  86. package/lib/util/cli.js +90 -116
  87. package/lib/util/config.js +302 -0
  88. package/lib/util/devops.js +240 -50
  89. package/lib/util/file.js +120 -191
  90. package/lib/util/init.config.js +195 -69
  91. package/lib/util/init.git.js +45 -50
  92. package/lib/util/init.js +72 -59
  93. package/lib/util/init.npm.js +48 -39
  94. package/lib/util/util.js +280 -564
  95. package/package.json +44 -33
  96. package/test/dataExtension.test.js +152 -0
  97. package/test/mockRoot/.mcdev-auth.json +8 -0
  98. package/test/mockRoot/.mcdevrc.json +67 -0
  99. package/test/mockRoot/deploy/testInstance/testBU/dataExtension/childBU_dataextension_test.dataExtension-meta.json +39 -0
  100. package/test/mockRoot/deploy/testInstance/testBU/dataExtension/testDataExtension.dataExtension-meta.json +23 -0
  101. package/test/mockRoot/deploy/testInstance/testBU/query/testExistingQuery.query-meta.json +11 -0
  102. package/test/mockRoot/deploy/testInstance/testBU/query/testExistingQuery.query-meta.sql +4 -0
  103. package/test/mockRoot/deploy/testInstance/testBU/query/testQuery.query-meta.json +11 -0
  104. package/test/mockRoot/deploy/testInstance/testBU/query/testQuery.query-meta.sql +4 -0
  105. package/test/query.test.js +149 -0
  106. package/test/resourceFactory.js +142 -0
  107. package/test/resources/1111111/dataFolder/retrieve-response.xml +43 -0
  108. package/test/resources/9999999/automation/v1/queries/549f0568-607c-4940-afef-437965094dat/patch-response.json +18 -0
  109. package/test/resources/9999999/automation/v1/queries/get-response.json +24 -0
  110. package/test/resources/9999999/automation/v1/queries/post-response.json +18 -0
  111. package/test/resources/9999999/dataExtension/build-expected.json +51 -0
  112. package/test/resources/9999999/dataExtension/create-expected.json +23 -0
  113. package/test/resources/9999999/dataExtension/create-response.xml +54 -0
  114. package/test/resources/9999999/dataExtension/retrieve-expected.json +51 -0
  115. package/test/resources/9999999/dataExtension/retrieve-response.xml +47 -0
  116. package/test/resources/9999999/dataExtension/template-expected.json +51 -0
  117. package/test/resources/9999999/dataExtension/update-expected.json +55 -0
  118. package/test/resources/9999999/dataExtension/update-response.xml +52 -0
  119. package/test/resources/9999999/dataExtensionField/retrieve-response.xml +93 -0
  120. package/test/resources/9999999/dataExtensionTemplate/retrieve-response.xml +303 -0
  121. package/test/resources/9999999/dataFolder/retrieve-response.xml +65 -0
  122. package/test/resources/9999999/query/build-expected.json +8 -0
  123. package/test/resources/9999999/query/get-expected.json +11 -0
  124. package/test/resources/9999999/query/patch-expected.json +11 -0
  125. package/test/resources/9999999/query/post-expected.json +11 -0
  126. package/test/resources/9999999/query/template-expected.json +8 -0
  127. package/test/resources/auth.json +32 -0
  128. package/test/resources/rest404-response.json +5 -0
  129. package/test/resources/retrieve-response.xml +21 -0
  130. package/test/utils.js +107 -0
  131. package/types/mcdev.d.js +301 -0
  132. package/CHANGELOG.md +0 -126
  133. package/PULL_REQUEST_TEMPLATE.md +0 -19
  134. package/test/util/file.js +0 -51
package/README.md CHANGED
@@ -2,7 +2,12 @@
2
2
 
3
3
  <a id="markdown-accenture-sfmc-devtools" name="accenture-sfmc-devtools"></a>
4
4
 
5
- [![NPM](https://nodei.co/npm/mcdev.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/mcdev)
5
+ [![view on npm](https://badgen.net/github/release/Accenture/sfmc-devtools)](https://www.npmjs.org/package/mcdev)
6
+ [![view on npm](https://badgen.net/npm/node/mcdev)](https://www.npmjs.org/package/mcdev)
7
+ [![license](https://badgen.net/npm/license/mcdev)](https://www.npmjs.org/package/mcdev)
8
+ [![npm module downloads](https://badgen.net/npm/dt/mcdev)](https://www.npmjs.org/package/mcdev)
9
+ [![GitHub closed issues](https://badgen.net/github/closed-issues/Accenture/sfmc-devtools)](https://github.com/Accenture/sfmc-devtools/issues?q=is%3Aissue+is%3Aclosed)
10
+ [![GitHub releases](https://badgen.net/github/releases/Accenture/sfmc-devtools)](https://github.com/Accenture/sfmc-devtools/releases)
6
11
 
7
12
  Accenture Salesforce Marketing Cloud DevTools (mcdev) is a rapid deployment/rollout, backup and development tool for Salesforce Marketing Cloud. It allows you to retrieve and deploy configuration and code across Business Units and instances.
8
13
 
@@ -40,9 +45,10 @@ Accenture Salesforce Marketing Cloud DevTools (mcdev) is a rapid deployment/roll
40
45
  - [6.2.2. deploy](#622-deploy)
41
46
  - [6.2.3. delete](#623-delete)
42
47
  - [6.2.4. retrieveAsTemplate](#624-retrieveastemplate)
43
- - [6.2.5. buildDefinition](#625-builddefinition)
44
- - [6.2.6. buildDefinitionBulk](#626-builddefinitionbulk)
45
- - [6.2.7. createDeltaPkg](#627-createdeltapkg)
48
+ - [6.2.5. buildTemplate](#625-buildtemplate)
49
+ - [6.2.6. buildDefinition](#626-builddefinition)
50
+ - [6.2.7. buildDefinitionBulk](#627-builddefinitionbulk)
51
+ - [6.2.8. createDeltaPkg](#628-createdeltapkg)
46
52
  - [7. Advanced Configuration](#7-advanced-configuration)
47
53
  - [7.1. Config Options](#71-config-options)
48
54
  - [7.2. Metadata specific settings & options](#72-metadata-specific-settings--options)
@@ -117,7 +123,7 @@ If you experience issues installing Accenture SFMC DevTools, please check out th
117
123
  1. Install Accenture SFMC DevTools by running `npm install -g mcdev` (prefix with `sudo` on MacOS)
118
124
  - If you get an error, please see the below troubleshooting section.
119
125
 
120
- When completed you will see `+ mcdev@3.0.0` printed to your screen (or the current version of it respectively).
126
+ When completed you will see `+ mcdev@3.2.0` printed to your screen (or the current version of it respectively).
121
127
 
122
128
  > **_Side note for proud nerds_:**
123
129
  >
@@ -140,14 +146,14 @@ After the successful installation, you will now need to setup the connection to
140
146
  5. Make sure you grant all available rights.
141
147
  6. Go to the access tab and grant it access to all Business Units that you want to use it for, but ensure that the Parent/Global Business Unit is among these.
142
148
  - _Why?_ Shared Data Extensions, roles, users, Business Unit info and some other metadata is internally stored solely on the parent Business Unit and hence can only be retrieved and updated via that BU.
143
- 7. Note down _Client Id_, _Client Secret_ and _Authentication Base URI_.
149
+ 7. Note down _EID_ (Parent MID), _Client Id_, _Client Secret_ and _Authentication Base URI_.
144
150
  2. In your project folder
145
151
  1. Open a CLI in your project folder (e.g. `C:\repos\MyProject\` on Windows or `~/repos/MyProject/` on Mac)
146
152
  2. Run `mcdev init` to start the interactive setup wizard.
147
153
  1. If not found yet, default configuration files will be copied into your project folder, copied by initializing an npm project and a local Git repository.
148
154
  2. The wizard will ask you to name your credential. The name you choose here will be used by all team members because the config is shared via Git.
149
155
  > Being specific here reduces the chance of deploying to the wrong server (instance) in stressful situations. We suggest you use something like `ClientName`, or `ClientName-ProjectName` if you have multiple projects with the same client. In case your project uses multiples instances you might like to use something like `Client-ProjectName-Sandbox` and `Client-ProjectName-PROD`.
150
- 3. It will then continue to ask for the client ID, client secret and Authentication Base URI.
156
+ 3. It will then continue to ask for the EID (Parent MID), client ID, client secret and Authentication Base URI.
151
157
  4. The credentials will be automatically tested & your list of BUs downloaded until finally the central configuration file `.mcdevrc.json` gets created in your project folder.
152
158
  5. Last step is to download an initial backup and commit it into git. No worries - the wizard does that for you!
153
159
  3. If this is the first time you set up Accenture SFMC DevTools or you recently upgraded Accenture SFMC DevTools, please restart VS Code now! A pop-up will likely appear in the lower right corner prompting you to install recommended extensions.
@@ -166,13 +172,13 @@ After the successful installation, you will now need to setup the connection to
166
172
  If Accenture SFMC DevTools was already used to set up the project by somebody in your team, including all of the steps in the above chapter [Initial project configuration](#initial-project-setup), then basically you are in luck. Things are much faster from here on:
167
173
 
168
174
  1. Make sure you went through the chapters [Pre-requisites](#pre-requisites) and [Install Accenture SFMC DevTools](#install-mcdev). Do skip [Initial project configuration](#initial-project-setup)!
169
- 2. Acquire the URL to your Git repo and Clone it to your computer. It should end on `.git`. Also ask your team lead for `Client ID`, `Client Secret` and the `Authentication Base URI`. You will need this later.
175
+ 2. Acquire the URL to your Git repo and Clone it to your computer. It should end on `.git`. Also ask your team lead for `EID (Parent MID)`, `Client ID`, `Client Secret` and the `Authentication Base URI`. You will need this later.
170
176
  > We recommend you create a folder like `C:\repos\` and clone the repo for your current project into that. By default, the repo name will be suggested as a sub-folder name which you should keep in place. That way you will always have one folder in which all your projects can be found in with their respective sub-folders.
171
177
  3. Open your main repo folder (e.g. `C:\repos\`) in the CLI of your choice (e.g. PowerShell on Windows)
172
178
  4. now execute `git clone YOUR-REPO-URL`. This will create a sub-folder with the name of the repo and download everything for you into it (e.g. `C:\repos\YOUR-REPO\`)
173
179
  5. Still in the command prompt, execute `cd YOUR-REPO`. This will switch your current folder (visible before the command prompt) to the new repo folder (`C:\repos\YOUR-REPO\`).
174
180
  6. Assuming you installed Accenture SFMC DevTools globally (recommended!), now execute `mcdev init`.
175
- 7. At this point the system will recognize the previously set up project and ask you for `Client ID`, `Client Secret` and the `Authentication Base URI`.
181
+ 7. At this point the system will recognize the previously set up project and ask you for `EID (Parent MID)`, `Client ID`, `Client Secret` and the `Authentication Base URI`.
176
182
  8. Done.
177
183
 
178
184
  ### 2.5. Recommended additional installs
@@ -269,10 +275,10 @@ npm install -g accenture/sfmc-devtools#develop
269
275
  **Install specific version (using a version tag on npm):**
270
276
 
271
277
  ```bash
272
- npm install -g mcdev@3.1.0
278
+ npm install -g mcdev@3.2.0
273
279
  ```
274
280
 
275
- **Warning**: When you used the above method to install Accenture SFMC DevTools for a specific version or tag, trying to [update Accenture SFMC DevTools](#updating-mcdev) might not download the most recently published official version but instead stay on the version or branch you previously selected (in the above examples: develop, 3.1.0)!
281
+ **Warning**: When you used the above method to install Accenture SFMC DevTools for a specific version or tag, trying to [update Accenture SFMC DevTools](#updating-mcdev) might not download the most recently published official version but instead stay on the version or branch you previously selected (in the above examples: develop, 3.2.0)!
276
282
 
277
283
  > **Note**: The version is currently _not_ updated on the developer branch until a new release is published. Hence, you will not see a change if you run `mcdev --version`.
278
284
 
@@ -391,13 +397,15 @@ The following metadata types are currently supported:
391
397
  | Data Extension Template | `dataExtensionTemplate` | Yes | - | - | - | OOTB Database table schemas used for special cases like Transactional Journeys. |
392
398
  | Data Extract Type | `dataExtractType` | Yes | - | - | - | Types of Data Extracts enabled for a specific business unit. This normally should not be stored. |
393
399
  | E-Mail (Classic) | `email` | Yes | - | - | - | **DEPRECATED**: Old way of saving E-Mails; please migrate these to new E-Mail (`Asset: message`). |
394
- | E-Mail Send Definition | `emailSendDefinition` | Yes | Yes | in backlog | Yes | Mainly used in Automations as "Send Email Activity". |
395
- | Folder | `folder` | Yes | Yes | in backlog | - | Used to structure all kinds of other metadata. |
400
+ | E-Mail Send Definition | `emailSendDefinition` | Yes | Yes | yes (`bt`) | Yes | Mainly used in Automations as "Send Email Activity". |
401
+ | Folder | `folder` | Yes | Yes | yes (`bt`) | - | Used to structure all kinds of other metadata. |
396
402
  | FTPLocation | `ftpLocation` | Yes | - | - | Yes | A File Location which can be used for export or import of files to/from Marketing Cloud. |
397
403
  | Journey | `interaction` | Yes | in backlog | in backlog | - | Journey from Builder (internally called "Interaction"). |
398
- | Journey: Entry Event Definition | `eventDefinition` | Yes | Yes | in backlog | - | Used in Journeys (Interactions) to define Entry Events. |
404
+ | Journey: Entry Event Definition | `eventDefinition` | Yes | Yes | Yes | - | Used in Journeys (Interactions) to define Entry Events. |
399
405
  | List | `list` | Yes | in backlog | - | Yes | Old way of storing data. Still used for central Email Subscriber DB. |
400
- | Role | `role` | Yes | Yes | - | Yes | User Roles define groups that are used to grant users access to SFMC systems. |
406
+ | Mobile Connect Code | `mobileCode` | Yes | No | No | - | Mobile Connect Shore or Long Codes used for sending. First 50 per BU are retrieved |
407
+ | Mobile Connect Keyword | `mobileKeyword` | Yes | Yes | Yes | - | Mobile Connect keywords configured within the Business UNit. First 50 per BU are retrieved |
408
+ | Role | `role` | Yes | Yes | yes (`bt`) | Yes | User Roles define groups that are used to grant users access to SFMC systems. |
401
409
  | Triggered Send | `triggeredSendDefinition` | Yes | Yes | - | Yes | **DEPRECATED**: Sends emails via API or DataExtension Event. |
402
410
  | User | `accountUser` | Yes | in backlog | - | - | Users and Installed Packages including their assigned Roles, BUs and personal permissions |
403
411
 
@@ -457,7 +465,7 @@ _Example - update credentials:_
457
465
  mcdev init yourCredentialName
458
466
  ```
459
467
 
460
- The interactive setup will ask you for a `Client ID` and `Client Secret` of an enhanced installed package (default since August 2019). It also asks for the `Authentication Base Uri`. Each installed package on a given SFMC instance shares the same tenant sub-domain and always shows you 3 domains (Auth, REST and SOAP).
468
+ The interactive setup will ask you for an `EID (Parent MID)`, `Client ID` and `Client Secret` of an installed package. It also asks for the `Authentication Base Uri`. Each installed package on a given SFMC instance shares the same tenant sub-domain and always shows you 3 domains (Auth, REST and SOAP).
461
469
 
462
470
  Example url: `https://mcg123abcysykllg-0321cbs8bbt64.auth.marketingcloudapis.com`
463
471
 
@@ -466,10 +474,9 @@ Example url: `https://mcg123abcysykllg-0321cbs8bbt64.auth.marketingcloudapis.com
466
474
  > You can run this command without the interactive wizard asking questions using the `--skipInteraction` (or short`--yes`/`--y`) flag. In this case, you need to provide a few values in the command:
467
475
  >
468
476
  > ```bash
469
- > mcdev init --y.credentialsName "yourCustomCredentialName" --y.clientId "yourClientIdHere" --y.clientSecret "yourClientSecretHere" --y.tenant "yourTenantSubdomainHere" --y.gitRemoteUrl "https://my.git.server.com/myrepo.git"
477
+ > mcdev init --y.credentialsName "yourCustomCredentialName" --y.client_id "yourClientIdHere" --y.client_secret "yourClientSecretHere" --y.auth_url "https://yourTenantSubdomainHere.auth.marketingcloudapis.com/" --y.gitRemoteUrl "https://my.git.server.com/myrepo.git" --y.account_id 00000000
470
478
  > ```
471
479
  >
472
- > To get the tenant subdomain, please take the Authentication Base Uri and extract the part after `https://` and before `.auth.marketingcloudapis.com`. In the above example this would therefore be `mcg123abcysykllg-0321cbs8bbt64`.
473
480
 
474
481
  #### 6.1.2. upgrade
475
482
 
@@ -523,18 +530,21 @@ mcdev badKeys MyProject/DEV
523
530
 
524
531
  <a id="markdown-document" name="document"></a>
525
532
 
526
- _Command:_ `mcdev document <TYPE> <business unit>`
533
+ _Command:_ `mcdev document <business unit> <TYPE>`
527
534
 
528
535
  _Alias:_ `mcdev doc`
529
536
 
530
- Creates human readable documentation for your metadata. This command is executed by default unless you changed your config manually to set `options.documentOnRetrieve : false`. Therefore, running it manually is typically not required. You can choose to generate **HTML** (`html`) or **Markdown** (`md`) docs via `options.documentType`.
537
+ Creates human readable documentation for your metadata. This command is executed by default for supported types unless you changed your config manually (`metaDataTypes.documentOnRetrieve`). Therefore, running it manually is typically not required. You can choose to generate **HTML** (`html`) or **Markdown** (`md`) docs via `options.documentType`.
531
538
 
532
539
  The default format is set to `md` as Markdown renders nicely in Git as well as in VSCode's Markdown preview and can be copied from there into Confluence and other applications without losing the formatting.
533
540
 
541
+ As standard roles are often not used by projects, we have the optional setting `options.documentStandardRoles` which is by default set to false
542
+
534
543
  Currently supported types:
535
544
 
536
545
  | Name | CLI Argument |
537
546
  | -------------- | --------------- |
547
+ | Automation | `automation` |
538
548
  | Data Extension | `dataExtension` |
539
549
  | Role | `role` |
540
550
  | User | `accountUser` |
@@ -542,7 +552,7 @@ Currently supported types:
542
552
  _Example:_
543
553
 
544
554
  ```bash
545
- mcdev document role myServer
555
+ mcdev document myServer role
546
556
  ```
547
557
 
548
558
  #### 6.1.6. selectTypes
@@ -589,7 +599,7 @@ mcdev explainTypes
589
599
 
590
600
  <a id="markdown-retrieve" name="retrieve"></a>
591
601
 
592
- _Command:_ `mcdev retrieve [business unit] [metadata type]`
602
+ _Command:_ `mcdev retrieve [business unit] [metadata type] [metadata key]`
593
603
 
594
604
  _Alias:_ `mcdev r`
595
605
 
@@ -618,14 +628,29 @@ mcdev retrieve MyProject
618
628
 
619
629
  **retrieve specific type:**
620
630
 
621
- If you want to retrieve only a certain metadata type, let's say `script`, then pass this type in as a second parameter. The other types will remain untouched and in place, if you've previously retrieved them.
631
+ If you want to retrieve only a certain metadata type, let's say `script`, then pass this type in as a second parameter. The other types will remain untouched and in place, if you've previously retrieved them.<br>Similarly, you can pass in multiple comma-separated types but make sure to put them in double-quotes in order to work on all systems.
622
632
 
623
633
  _Example:_
624
634
 
625
635
  ```bash
626
636
  mcdev retrieve MyProject/DEV script
637
+ mcdev retrieve MyProject/DEV "script,query,automation"
638
+ ```
639
+
640
+ **retrieve sepcific type and key:**
641
+
642
+ If you wish you may also specify exact keys that need to be retrieved, filtering down on whats in your retrieve folder even further. Specified keys apply as a filter for all types you specify. If your naming convention does not allow for such an aggregation then please run seperate commands for each type.
643
+
644
+ _Example:_
645
+
646
+ ```bash
647
+ mcdev retrieve MyProject/DEV dataExtension "key1"
648
+ mcdev retrieve MyProject/DEV dataExtension "key1,key2"
649
+ mcdev retrieve MyProject/DEV "script,dataExtension,importFile" "key1,key2"
627
650
  ```
628
651
 
652
+ _Note:_ This is not supported by types `discovery` and `folder`.
653
+
629
654
  **retrieve all BUs:**
630
655
 
631
656
  A special variant of this command allows you to retrieve all Business Units of a given credential at once.
@@ -647,7 +672,7 @@ mcdev retrieve "*"
647
672
 
648
673
  <a id="markdown-deploy" name="deploy"></a>
649
674
 
650
- _Command:_ `mcdev deploy [business unit] [metadata type]`
675
+ _Command:_ `mcdev deploy [business unit] [metadata type] [metadata key] [deploy from retrieve]`
651
676
 
652
677
  _Alias:_ `mcdev d`
653
678
 
@@ -664,12 +689,37 @@ Similarly to `mcdev retrieve` you can also use the interactive mode to select cr
664
689
 
665
690
  **deploy sepcific type:**
666
691
 
667
- If you want to deploy only a certain metadata type, let's say `dataExtension`, then pass this type in as a second parameter. If there are other types in the current BU's deploy folder, these will be ignored and hence _not_ uploaded.
692
+ If you want to deploy only a certain metadata type, let's say `dataExtension`, then pass this type in as a second parameter. If there are other types in the current BU's deploy folder, these will be ignored and hence _not_ uploaded.<br>Similarly, you can pass in multiple comma-separated types but make sure to put them in double-quotes in order to work on all systems.
668
693
 
669
694
  _Example:_
670
695
 
671
696
  ```bash
672
697
  mcdev deploy MyProject/DEV dataExtension
698
+ mcdev deploy MyProject/DEV "script,dataExtension,importFile"
699
+ ```
700
+
701
+ **deploy sepcific type and key:**
702
+
703
+ If you wish you may also specify exact keys that need to be deployed, filtering down on whats in your deploy folder even further. Specified keys apply as a filter for all types you specify. If your naming convention does not allow for such an aggregation then please run seperate commands for each type.
704
+
705
+ _Example:_
706
+
707
+ ```bash
708
+ mcdev deploy MyProject/DEV dataExtension "key1"
709
+ mcdev deploy MyProject/DEV dataExtension "key1,key2"
710
+ mcdev deploy MyProject/DEV "script,dataExtension,importFile" "key1,key2"
711
+ ```
712
+
713
+ **deploy from retrieve folder:**
714
+
715
+ Sometimes it's convenient to deploy right from the retrieve folder when you are using mcdev as a developer tool rather than only for deployments to other BUs. For this scenario we added the 4th parameter. In that case it does not look into `deploy/` but into `retrieve/` to find what it needs to deploy.
716
+
717
+ _Example:_
718
+
719
+ ```bash
720
+ mcdev deploy MyProject/DEV dataExtension "key1" true
721
+ mcdev deploy MyProject/DEV dataExtension "key1,key2" true
722
+ mcdev deploy MyProject/DEV "script,dataExtension,importFile" "key1,key2" true
673
723
  ```
674
724
 
675
725
  **deploy all BUs:**
@@ -704,11 +754,17 @@ Currently supported types:
704
754
  | Name | CLI Argument |
705
755
  | -------------- | --------------- |
706
756
  | Data Extension | `dataExtension` |
757
+ | Data Extension Field | `dataExtensionField` |
758
+ | Email Send Definition | `Email Send Definition` |
759
+ | List | `list` |
760
+ | Triggered Send | `triggeredSendDefinition` |
707
761
 
708
762
  _Example:_
709
763
 
710
764
  ```bash
711
765
  mcdev delete MyProject/_ParentBU_ dataExtension MyUserTable
766
+
767
+ mcdev delete MyProject/_ParentBU_ dataExtensionField MyUserTable.MyFieldName
712
768
  ```
713
769
 
714
770
  #### 6.2.4. retrieveAsTemplate
@@ -749,7 +805,45 @@ This will result in the following files being created in your `template/` direct
749
805
  - `table2.dataExtension-meta.json`
750
806
  - `table3.dataExtension-meta.json`
751
807
 
752
- #### 6.2.5. buildDefinition
808
+ #### 6.2.5. buildTemplate
809
+
810
+ <a id="markdown-buildtemplate" name="buildtemplate"></a>
811
+
812
+ _Command:_ `mcdev buildTemplate <business unit> <type> <name> <market>`
813
+
814
+ _Alias:_ `mcdev bt`
815
+
816
+ The `bt` command uses previously retrieved metadata on the your local computer and uses your `market` configuration in `.mcdevrc.json` to replace strings with variables. The result is then stored in your `template/` folder. Please note that files stored here will keep their original name, despite this possibly containing market-specific suffixes or similar. Also note, that contrary to the deploy & retrieve folders, you will not see credential- or Business Unit-sub-folders here.
817
+
818
+ This command is a prerequisite for the `buildDefintion` command. Alternatively though, you can copy-paste retrieved metadata from your `retrieve/` folder to your `template/` folder and update it manually - or even create it from scratch.
819
+
820
+ > **Note**: Before using this command, you need to configure your markets first! Check out our guide on [Market Configuration](#market-configuration) to understand how to use templating and prepare your market config.
821
+
822
+ Currently supported types: Check out [Metadata Type Support](#metadata-type-support).
823
+
824
+ _Example:_
825
+
826
+ ```bash
827
+ mcdev bt MyProject/DEV dataExtension MyUserTable pilotMarketDEV1
828
+ ```
829
+
830
+ This will result in `MyUserTable.dataExtension-meta.json` being created in your `template/` directory:
831
+
832
+ **buildTemplate for multiple sources:**
833
+
834
+ You can also create multiple templates with multiple sources at once. Simply specify them in a comma-separated list and put that list in quotes:
835
+
836
+ ```bash
837
+ mcdev bt MyProject/DEV dataExtension "table1,table2,table3" pilotMarketDEV1
838
+ ```
839
+
840
+ This will result in the following files being created in your `template/` directory:
841
+
842
+ - `table1.dataExtension-meta.json`
843
+ - `table2.dataExtension-meta.json`
844
+ - `table3.dataExtension-meta.json`
845
+
846
+ #### 6.2.6. buildDefinition
753
847
 
754
848
  <a id="markdown-builddefinition" name="builddefinition"></a>
755
849
 
@@ -790,7 +884,7 @@ This will result in the following files being created in your `retrieve/MyProjec
790
884
  - `table2.dataExtension-meta.json`
791
885
  - `table3.dataExtension-meta.json`
792
886
 
793
- #### 6.2.6. buildDefinitionBulk
887
+ #### 6.2.7. buildDefinitionBulk
794
888
 
795
889
  <a id="markdown-builddefinitionbulk" name="builddefinitionbulk"></a>
796
890
 
@@ -810,7 +904,7 @@ _Example:_
810
904
  mcdev bdb pilotMarketsQA dataExtension MyUserTable
811
905
  ```
812
906
 
813
- #### 6.2.7. createDeltaPkg
907
+ #### 6.2.8. createDeltaPkg
814
908
 
815
909
  <a id="markdown-createdeltapkg" name="createdeltapkg"></a>
816
910
 
@@ -973,6 +1067,7 @@ The central config in `.mcdevrc.json` holds multiple adjustable settings:
973
1067
  }
974
1068
  },
975
1069
  "documentType": "md",
1070
+ "documentStandardRoles": true,
976
1071
  "exclude": {
977
1072
  "role": {
978
1073
  "CustomerKey": ["excludedRoleKey","excludedOtherRoleKey"]
@@ -986,18 +1081,15 @@ The central config in `.mcdevrc.json` holds multiple adjustable settings:
986
1081
  "serverTimeOffset": -6
987
1082
  },
988
1083
  "directories": {
989
- "badKeys": "docs/badKeys/",
990
- "businessUnits": "businessUnits/",
991
- "dataExtension": "docs/dataExtension/",
992
- "deltaPackage": "docs/deltaPackage/",
993
- "deploy": "deploy/",
994
- "retrieve": "retrieve/",
995
- "roles": "docs/roles/",
996
- "template": "template/",
997
- "templateBuilds": ["retrieve/", "deploy/"]
1084
+ "businessUnits": "businessUnits/",
1085
+ "deploy": "deploy/",
1086
+ "docs": "docs/",
1087
+ "retrieve": "retrieve/",
1088
+ "template": "template/",
1089
+ "templateBuilds": ["retrieve/", "deploy/"]
998
1090
  },
999
1091
  "metaDataTypes": {
1000
- "documentOnRetrieve": ["role", "dataExtension"],
1092
+ "documentOnRetrieve": ["accountUser", "automation", "dataExtension", "role"],
1001
1093
  "retrieve": [...]
1002
1094
  }
1003
1095
  }
@@ -1009,17 +1101,14 @@ The central config in `.mcdevrc.json` holds multiple adjustable settings:
1009
1101
  | options.deployment.sourceTargetMapping | `{"deployment-source": "deployment-target"}` | Configuration of 1 or many source-target marketList combos for `mcdev createDeltaPkg` |
1010
1102
  | options.deployment.targetBranchBuMapping | `{"release/*": "...","master": ["..."]}` | Can be used by CI/CD pipelines to know what BUs shall be deployed to upon a merge into one of the specified branches |
1011
1103
  | options.documentType | 'md' | Defines the format for documentation ('md', 'html', 'both') |
1104
+ | options.documentStandardRoles | false | Optionally skip standard role documentation by setting to false |
1012
1105
  | options.exclude.`type`.`field` | [] | Allows you to filter out metadata on retrieve based on their field values, e.g. CustomerKey (previously `options.filter`) |
1013
1106
  | options.include.`type`.`field` | [] | Allows you to filter out metadata on retrieve based on their field values, e.g. CustomerKey |
1014
1107
  | options.serverTimeOffset | -6 | Used to work around quirks in how SFMC handles timezones; For stack4: set to -7 (US Mountain time); others: -6 (US Central) |
1015
- | directories.badKeys | 'docs/badKeys/' | Where the documentation for bad key-name combos is stored on retrieve |
1016
1108
  | directories.businessUnits | 'businessUnits/' | Directory to save BU base details in |
1017
- | directories.dataExtension | 'docs/dataExtension/' | Directory for `document dataExtension` output |
1018
- | directories.deltaPackage | 'docs/deltaPackage/' | Where `createDeltaPkg` stores its log |
1019
1109
  | directories.deploy | 'deploy/' | Where `deploy` searches for files to deploy |
1110
+ | directories.docs | 'docs/' | Directory for `document` output |
1020
1111
  | directories.retrieve | 'retrieve/' | Where `retrieve` stores downloaded files |
1021
- | directories.roles | 'docs/roles/' | Directory for `document role` output |
1022
- | directories.users | 'docs/users/' | Directory for `document accountUser` output |
1023
1112
  | directories.template | 'template/' | Where `rt` stores downloaded templates & `bd` retrieves them from |
1024
1113
  | directories.templateBuilds | ['retrieve/','deploy/'] | Where `bd` saves final deployment versions in. This can hold multiple directories, e.g. ['retrieve/','deploy/'] |
1025
1114
  | metaDataTypes.documentOnRetrieve | ['role','dataExtension'] | automatically executes `document` for selected types |
@@ -1420,7 +1509,7 @@ If you use Accenture SFMC DevTools in your team it is recommended to install you
1420
1509
 
1421
1510
  If you do need to install it locally, make sure you don't commit your project's package.json with this change or you might break mcdev for other developers in your team that either didn't clone the Accenture SFMC DevTools repo or stored in a different directory.
1422
1511
 
1423
- To test your new **global** developer setup, run `mcdev --version` in CLI which should return the current version (e.g. `3.0.0`). Then, go into your mcdev repo and update the version with the suffix `-dev`, e.g. to `3.0.0-dev` and then run `mcdev --version` again to verify that your change propagates instantly.
1512
+ To test your new **global** developer setup, run `mcdev --version` in CLI which should return the current version (e.g. `3.2.0`). Then, go into your mcdev repo and update the version with the suffix `-dev`, e.g. to `3.2.0-dev` and then run `mcdev --version` again to verify that your change propagates instantly.
1424
1513
 
1425
1514
  <a name="local-install"></a>
1426
1515
 
@@ -1447,7 +1536,7 @@ The following explains how you _could_ install it locally for certain edge cases
1447
1536
  4. Afterwards, install Accenture SFMC DevTools by running `npm install --save-dev mcdev`
1448
1537
  - If you get an error, please see the below troubleshooting section.
1449
1538
 
1450
- When completed you will see `+ mcdev@3.0.0` printed to your screen (or the current version of it respectively).
1539
+ When completed you will see `+ mcdev@3.2.0` printed to your screen (or the current version of it respectively).
1451
1540
 
1452
1541
  ### 9.3. NPM Scripts
1453
1542
 
@@ -1,10 +1,7 @@
1
1
  {
2
2
  "credentials": {
3
3
  "default": {
4
- "clientId": "--- update me ---",
5
- "clientSecret": "--- update me ---",
6
- "tenant": "--- update me ---",
7
- "eid": "000000000",
4
+ "eid": 0,
8
5
  "businessUnits": {}
9
6
  }
10
7
  },
@@ -20,21 +17,18 @@
20
17
  }
21
18
  },
22
19
  "documentType": "md",
20
+ "documentStandardRoles": false,
23
21
  "exclude": {},
24
22
  "include": {},
25
23
  "serverTimeOffset": -6
26
24
  },
27
25
  "directories": {
28
- "badKeys": "docs/badKeys/",
29
26
  "businessUnits": "businessUnits/",
30
- "dataExtension": "docs/dataExtension/",
31
- "deltaPackage": "docs/deltaPackage/",
32
27
  "deploy": "deploy/",
28
+ "docs": "docs/",
33
29
  "retrieve": "retrieve/",
34
- "roles": "docs/roles/",
35
30
  "template": "template/",
36
- "templateBuilds": ["retrieve/", "deploy/"],
37
- "users": "docs/users/"
31
+ "templateBuilds": ["retrieve/", "deploy/"]
38
32
  },
39
33
  "markets": {
40
34
  "DEV-NL": {
@@ -79,7 +73,7 @@
79
73
  }
80
74
  },
81
75
  "metaDataTypes": {
82
- "documentOnRetrieve": ["accountUser", "dataExtension", "role"],
76
+ "documentOnRetrieve": ["accountUser", "automation", "dataExtension", "role"],
83
77
  "retrieve": []
84
78
  }
85
79
  }
@@ -11,6 +11,14 @@
11
11
  "parser": "babel",
12
12
  "trailingComma": "none"
13
13
  }
14
+ },
15
+ {
16
+ "files": "*.sql",
17
+ "options": {
18
+ "formatter": "sql-formatter",
19
+ "language": "tsql",
20
+ "uppercase": true
21
+ }
14
22
  }
15
23
  ]
16
24
  }
@@ -15,7 +15,6 @@
15
15
  "editorconfig.editorconfig",
16
16
  "esbenp.prettier-vscode",
17
17
  "sergey-agadzhanov.ampscript",
18
- "adpyke.vscode-sql-formatter",
19
18
 
20
19
  // Markdown / Readme.md
21
20
  "joernberkefeld.markdown-preview-bitbucket-innersource"
@@ -1,4 +1,29 @@
1
1
  {
2
+ "explorer.fileNesting.enabled": true,
3
+ "explorer.fileNesting.expand": false,
4
+ "explorer.fileNesting.patterns": {
5
+ "*.ts": "${capture}.js",
6
+ "*.js": "${capture}.js.map, ${capture}.min.js, ${capture}.d.ts, ${capture}.asset-code-meta.json",
7
+ "*.jsx": "${capture}.js",
8
+ "*.tsx": "${capture}.ts",
9
+ "tsconfig.json": "tsconfig.*.json",
10
+ "package.json": "package-lock.json, yarn.lock",
11
+ "*-doc.md": "${capture}-meta.json",
12
+ "*.asset-asset-meta.html": "${dirname}.asset-asset-meta.json",
13
+ "*.asset-message-meta.html": "${dirname}.asset-message-meta.json",
14
+ "*.html": "${capture}.asset-code-meta.json",
15
+ "*.css": "${capture}.asset-code-meta.json",
16
+ "*.docx": "${capture}.asset-document-meta.json",
17
+ "*.ics": "${capture}.asset-document-meta.json",
18
+ "*.pdf": "${capture}.asset-document-meta.json",
19
+ "*.jpg": "${capture}.asset-image-meta.json",
20
+ "*.png": "${capture}.asset-image-meta.json",
21
+ "*.gif": "${capture}.asset-image-meta.json",
22
+ "*-meta.sql": "${capture}-meta.json",
23
+ "*-meta.ssjs": "${capture}-meta.json",
24
+ "*-meta.amp": "${capture}-meta.json",
25
+ "*-meta.html": "${capture}-meta.json"
26
+ },
2
27
  "editor.codeActionsOnSave": {
3
28
  "source.fixAll.eslint": true
4
29
  },
@@ -11,8 +36,9 @@
11
36
  "node_modules": true
12
37
  },
13
38
  "javascript.validate.enable": false,
14
- "sql-formatter.indent": " ",
15
- "sql-formatter.uppercase": true,
39
+ "[sql]": {
40
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
41
+ },
16
42
  "[html]": {
17
43
  "editor.defaultFormatter": "esbenp.prettier-vscode"
18
44
  },
@@ -2,8 +2,8 @@
2
2
 
3
3
  This project relies on **Accenture SFMC DevTools**!
4
4
 
5
- - Get it, check out the official docs & get support here: https://go.accenture.com/mcdev
5
+ - Get it, check out the official docs & get support here: https://github.com/Accenture/sfmc-devtools
6
6
 
7
7
  ---
8
8
 
9
- © 2021 Accenture - [www.accenture.com](https://www.accenture.com/)
9
+ © 2022 Accenture - [www.accenture.com](https://www.accenture.com/)
@@ -0,0 +1,10 @@
1
+ [
2
+ {
3
+ "version": "4.0.0",
4
+ "files": [".vscode/settings.json", ".vscode/extensions.json", ".prettierrc"]
5
+ },
6
+ {
7
+ "version": "3.1.0",
8
+ "files": [".vscode/settings.json"]
9
+ }
10
+ ]
@@ -1,10 +1,10 @@
1
1
  [
2
- "eslint",
3
- "prettier",
4
- "eslint-config-ssjs",
5
2
  "eslint-config-prettier",
6
- "eslint-plugin-prettier",
3
+ "eslint-config-ssjs",
7
4
  "eslint-plugin-jsdoc",
8
- "npm-check",
5
+ "eslint-plugin-prettier",
6
+ "eslint",
7
+ "prettier-plugin-sql",
8
+ "prettier",
9
9
  "sfmc-boilerplate"
10
10
  ]