mcdev 4.1.6 → 4.1.8
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/.github/ISSUE_TEMPLATE/bug.yml +2 -0
- package/README.md +70 -69
- package/docs/dist/documentation.md +34 -34
- package/lib/Deployer.js +27 -19
- package/lib/index.js +1 -1
- package/lib/metadataTypes/Asset.js +8 -8
- package/lib/metadataTypes/DataExtension.js +2 -2
- package/lib/metadataTypes/DataExtensionField.js +1 -1
- package/lib/metadataTypes/Folder.js +29 -15
- package/lib/metadataTypes/MetadataType.js +4 -4
- package/lib/metadataTypes/Query.js +4 -4
- package/lib/metadataTypes/Script.js +4 -4
- package/lib/metadataTypes/definitions/Folder.definition.js +6 -0
- package/lib/util/cli.js +2 -2
- package/lib/util/file.js +1 -1
- package/lib/util/init.config.js +1 -1
- package/lib/util/init.js +1 -1
- package/lib/util/util.js +1 -1
- package/package.json +1 -1
- package/test/mockRoot/.mcdevrc.json +1 -1
|
@@ -400,7 +400,7 @@ Deploys all metadata located in the 'deploy' directory to the specified business
|
|
|
400
400
|
<a name="Deployer._deployBU"></a>
|
|
401
401
|
|
|
402
402
|
### Deployer.\_deployBU(cred, bu, properties, [typeArr], [keyArr], [fromRetrieve]) ⇒ <code>Promise.<TYPE.MultiMetadataTypeMap></code>
|
|
403
|
-
helper for deploy()
|
|
403
|
+
helper for [deploy](deploy)
|
|
404
404
|
|
|
405
405
|
**Kind**: static method of [<code>Deployer</code>](#Deployer)
|
|
406
406
|
**Returns**: <code>Promise.<TYPE.MultiMetadataTypeMap></code> - ensure that BUs are worked on sequentially
|
|
@@ -958,7 +958,7 @@ This method retrieves these and saves them alongside the metadata json
|
|
|
958
958
|
<a name="Asset._readExtendedFileFromFS"></a>
|
|
959
959
|
|
|
960
960
|
### Asset.\_readExtendedFileFromFS(metadata, subType, deployDir, [pathOnly]) ⇒ <code>Promise.<string></code>
|
|
961
|
-
helper for
|
|
961
|
+
helper for [preDeployTasks](preDeployTasks)
|
|
962
962
|
Some metadata types store their actual content as a separate file, e.g. images
|
|
963
963
|
This method reads these from the local FS stores them in the metadata object allowing to deploy it
|
|
964
964
|
|
|
@@ -1013,7 +1013,7 @@ find the subType matching the extendedSubType
|
|
|
1013
1013
|
<a name="Asset.buildDefinitionForNested"></a>
|
|
1014
1014
|
|
|
1015
1015
|
### Asset.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ <code>Promise.<void></code>
|
|
1016
|
-
helper for buildDefinition
|
|
1016
|
+
helper for [buildDefinition](#MetadataType.buildDefinition)
|
|
1017
1017
|
handles extracted code if any are found for complex types
|
|
1018
1018
|
|
|
1019
1019
|
**Kind**: static method of [<code>Asset</code>](#Asset)
|
|
@@ -1030,7 +1030,7 @@ handles extracted code if any are found for complex types
|
|
|
1030
1030
|
<a name="Asset.buildTemplateForNested"></a>
|
|
1031
1031
|
|
|
1032
1032
|
### Asset.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ <code>Promise.<void></code>
|
|
1033
|
-
helper for buildTemplate
|
|
1033
|
+
helper for [buildTemplate](#MetadataType.buildTemplate)
|
|
1034
1034
|
handles extracted code if any are found for complex types
|
|
1035
1035
|
|
|
1036
1036
|
**Kind**: static method of [<code>Asset</code>](#Asset)
|
|
@@ -1051,7 +1051,7 @@ assets of type codesnippetblock will result in 1 json and 1 amp/html file. both
|
|
|
1051
1051
|
<a name="Asset._buildForNested"></a>
|
|
1052
1052
|
|
|
1053
1053
|
### Asset.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ <code>Promise.<void></code>
|
|
1054
|
-
helper for buildDefinition
|
|
1054
|
+
helper for [buildDefinition](#MetadataType.buildDefinition)
|
|
1055
1055
|
handles extracted code if any are found for complex types
|
|
1056
1056
|
|
|
1057
1057
|
**Kind**: static method of [<code>Asset</code>](#Asset)
|
|
@@ -1092,7 +1092,7 @@ parses retrieved Metadata before saving
|
|
|
1092
1092
|
<a name="Asset._mergeCode"></a>
|
|
1093
1093
|
|
|
1094
1094
|
### Asset.\_mergeCode(metadata, deployDir, subType, [templateName], [fileListOnly]) ⇒ <code>Promise.<Array.<TYPE.CodeExtract>></code>
|
|
1095
|
-
helper for
|
|
1095
|
+
helper for [preDeployTasks](preDeployTasks) that loads extracted code content back into JSON
|
|
1096
1096
|
|
|
1097
1097
|
**Kind**: static method of [<code>Asset</code>](#Asset)
|
|
1098
1098
|
**Returns**: <code>Promise.<Array.<TYPE.CodeExtract>></code> - fileList for templating (disregarded during deployment)
|
|
@@ -1108,7 +1108,7 @@ helper for this.preDeployTasks() that loads extracted code content back into JSO
|
|
|
1108
1108
|
<a name="Asset._mergeCode_slots"></a>
|
|
1109
1109
|
|
|
1110
1110
|
### Asset.\_mergeCode\_slots(prefix, metadataSlots, readDirArr, subtypeExtension, subDirArr, fileList, customerKey, [templateName], [fileListOnly]) ⇒ <code>Promise.<void></code>
|
|
1111
|
-
helper for
|
|
1111
|
+
helper for [preDeployTasks](preDeployTasks) that loads extracted code content back into JSON
|
|
1112
1112
|
|
|
1113
1113
|
**Kind**: static method of [<code>Asset</code>](#Asset)
|
|
1114
1114
|
**Returns**: <code>Promise.<void></code> - -
|
|
@@ -1128,7 +1128,7 @@ helper for this.preDeployTasks() that loads extracted code content back into JSO
|
|
|
1128
1128
|
<a name="Asset._extractCode"></a>
|
|
1129
1129
|
|
|
1130
1130
|
### Asset.\_extractCode(metadata) ⇒ <code>TYPE.CodeExtractItem</code>
|
|
1131
|
-
helper for
|
|
1131
|
+
helper for [parseMetadata](parseMetadata) that finds code content in JSON and extracts it
|
|
1132
1132
|
to allow saving that separately and formatted
|
|
1133
1133
|
|
|
1134
1134
|
**Kind**: static method of [<code>Asset</code>](#Asset)
|
|
@@ -1626,7 +1626,7 @@ if create or update operation is needed.
|
|
|
1626
1626
|
<a name="DataExtension._filterUpsertResults"></a>
|
|
1627
1627
|
|
|
1628
1628
|
### DataExtension.\_filterUpsertResults(res) ⇒ <code>boolean</code>
|
|
1629
|
-
helper for upsert()
|
|
1629
|
+
helper for [upsert](upsert)
|
|
1630
1630
|
|
|
1631
1631
|
**Kind**: static method of [<code>DataExtension</code>](#DataExtension)
|
|
1632
1632
|
**Returns**: <code>boolean</code> - true: keep, false: discard
|
|
@@ -1862,7 +1862,7 @@ Retrieves all records for caching
|
|
|
1862
1862
|
<a name="DataExtensionField.convertToSortedArray"></a>
|
|
1863
1863
|
|
|
1864
1864
|
### DataExtensionField.convertToSortedArray(fieldsObj) ⇒ <code>Array.<TYPE.DataExtensionFieldItem></code>
|
|
1865
|
-
helper for DataExtension.
|
|
1865
|
+
helper for [DataExtension._retrieveFieldsForSingleDe](DataExtension._retrieveFieldsForSingleDe) that sorts the fields into an array
|
|
1866
1866
|
|
|
1867
1867
|
**Kind**: static method of [<code>DataExtensionField</code>](#DataExtensionField)
|
|
1868
1868
|
**Returns**: <code>Array.<TYPE.DataExtensionFieldItem></code> - sorted array of field objects
|
|
@@ -3482,7 +3482,7 @@ Helper for writing Metadata to disk, used for Retrieve and deploy
|
|
|
3482
3482
|
<a name="MetadataType.applyTemplateValues"></a>
|
|
3483
3483
|
|
|
3484
3484
|
### MetadataType.applyTemplateValues(code, templateVariables) ⇒ <code>string</code>
|
|
3485
|
-
helper for buildDefinitionForNested
|
|
3485
|
+
helper for [buildDefinitionForNested](buildDefinitionForNested)
|
|
3486
3486
|
searches extracted file for template variable names and applies the market values
|
|
3487
3487
|
|
|
3488
3488
|
**Kind**: static method of [<code>MetadataType</code>](#MetadataType)
|
|
@@ -3496,7 +3496,7 @@ searches extracted file for template variable names and applies the market value
|
|
|
3496
3496
|
<a name="MetadataType.applyTemplateNames"></a>
|
|
3497
3497
|
|
|
3498
3498
|
### MetadataType.applyTemplateNames(code, templateVariables) ⇒ <code>string</code>
|
|
3499
|
-
helper for buildTemplateForNested
|
|
3499
|
+
helper for [buildTemplateForNested](buildTemplateForNested)
|
|
3500
3500
|
searches extracted file for template variable values and applies the market variable names
|
|
3501
3501
|
|
|
3502
3502
|
**Kind**: static method of [<code>MetadataType</code>](#MetadataType)
|
|
@@ -3510,7 +3510,7 @@ searches extracted file for template variable values and applies the market vari
|
|
|
3510
3510
|
<a name="MetadataType.buildDefinitionForNested"></a>
|
|
3511
3511
|
|
|
3512
3512
|
### MetadataType.buildDefinitionForNested(templateDir, targetDir, metadata, variables, templateName) ⇒ <code>Promise.<Array.<Array.<string>>></code>
|
|
3513
|
-
helper for buildDefinition
|
|
3513
|
+
helper for [buildDefinition](buildDefinition)
|
|
3514
3514
|
handles extracted code if any are found for complex types (e.g script, asset, query)
|
|
3515
3515
|
|
|
3516
3516
|
**Kind**: static method of [<code>MetadataType</code>](#MetadataType)
|
|
@@ -3527,7 +3527,7 @@ handles extracted code if any are found for complex types (e.g script, asset, qu
|
|
|
3527
3527
|
<a name="MetadataType.buildTemplateForNested"></a>
|
|
3528
3528
|
|
|
3529
3529
|
### MetadataType.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ <code>Promise.<Array.<Array.<string>>></code>
|
|
3530
|
-
helper for buildTemplate
|
|
3530
|
+
helper for [buildTemplate](buildTemplate)
|
|
3531
3531
|
handles extracted code if any are found for complex types
|
|
3532
3532
|
|
|
3533
3533
|
**Kind**: static method of [<code>MetadataType</code>](#MetadataType)
|
|
@@ -3903,7 +3903,7 @@ prepares a Query for deployment
|
|
|
3903
3903
|
<a name="Query.applyTemplateValues"></a>
|
|
3904
3904
|
|
|
3905
3905
|
### Query.applyTemplateValues(code, templateVariables) ⇒ <code>string</code>
|
|
3906
|
-
helper for buildDefinitionForNested
|
|
3906
|
+
helper for [buildDefinitionForNested](buildDefinitionForNested)
|
|
3907
3907
|
searches extracted SQL file for template variables and applies the market values
|
|
3908
3908
|
|
|
3909
3909
|
**Kind**: static method of [<code>Query</code>](#Query)
|
|
@@ -3917,7 +3917,7 @@ searches extracted SQL file for template variables and applies the market values
|
|
|
3917
3917
|
<a name="Query.buildDefinitionForNested"></a>
|
|
3918
3918
|
|
|
3919
3919
|
### Query.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ <code>Promise.<Array.<Array.<string>>></code>
|
|
3920
|
-
helper for buildDefinition
|
|
3920
|
+
helper for [buildDefinition](#MetadataType.buildDefinition)
|
|
3921
3921
|
handles extracted code if any are found for complex types
|
|
3922
3922
|
|
|
3923
3923
|
**Kind**: static method of [<code>Query</code>](#Query)
|
|
@@ -3934,7 +3934,7 @@ handles extracted code if any are found for complex types
|
|
|
3934
3934
|
<a name="Query.buildTemplateForNested"></a>
|
|
3935
3935
|
|
|
3936
3936
|
### Query.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ <code>Promise.<Array.<Array.<string>>></code>
|
|
3937
|
-
helper for buildTemplate
|
|
3937
|
+
helper for [buildTemplate](#MetadataType.buildTemplate)
|
|
3938
3938
|
handles extracted code if any are found for complex types
|
|
3939
3939
|
|
|
3940
3940
|
**Kind**: static method of [<code>Query</code>](#Query)
|
|
@@ -4184,7 +4184,7 @@ Creates a single Script
|
|
|
4184
4184
|
<a name="Script._mergeCode"></a>
|
|
4185
4185
|
|
|
4186
4186
|
### Script.\_mergeCode(metadata, deployDir, [templateName]) ⇒ <code>Promise.<string></code>
|
|
4187
|
-
helper for
|
|
4187
|
+
helper for [preDeployTasks](preDeployTasks) that loads extracted code content back into JSON
|
|
4188
4188
|
|
|
4189
4189
|
**Kind**: static method of [<code>Script</code>](#Script)
|
|
4190
4190
|
**Returns**: <code>Promise.<string></code> - content for metadata.script
|
|
@@ -4211,7 +4211,7 @@ prepares a Script for deployment
|
|
|
4211
4211
|
<a name="Script.buildDefinitionForNested"></a>
|
|
4212
4212
|
|
|
4213
4213
|
### Script.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ <code>Promise.<Array.<Array.<string>>></code>
|
|
4214
|
-
helper for buildDefinition
|
|
4214
|
+
helper for [buildDefinition](#MetadataType.buildDefinition)
|
|
4215
4215
|
handles extracted code if any are found for complex types
|
|
4216
4216
|
|
|
4217
4217
|
**Kind**: static method of [<code>Script</code>](#Script)
|
|
@@ -4228,7 +4228,7 @@ handles extracted code if any are found for complex types
|
|
|
4228
4228
|
<a name="Script.buildTemplateForNested"></a>
|
|
4229
4229
|
|
|
4230
4230
|
### Script.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ <code>Promise.<Array.<Array.<string>>></code>
|
|
4231
|
-
helper for buildTemplate
|
|
4231
|
+
helper for [buildTemplate](#MetadataType.buildTemplate)
|
|
4232
4232
|
handles extracted code if any are found for complex types
|
|
4233
4233
|
|
|
4234
4234
|
**Kind**: static method of [<code>Script</code>](#Script)
|
|
@@ -4249,7 +4249,7 @@ scripts are saved as 1 json and 1 ssjs file. both files need to be run through t
|
|
|
4249
4249
|
<a name="Script._buildForNested"></a>
|
|
4250
4250
|
|
|
4251
4251
|
### Script.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ <code>Promise.<Array.<Array.<string>>></code>
|
|
4252
|
-
helper for buildTemplateForNested / buildDefinitionForNested
|
|
4252
|
+
helper for [buildTemplateForNested](buildTemplateForNested) / [buildDefinitionForNested](buildDefinitionForNested)
|
|
4253
4253
|
handles extracted code if any are found for complex types
|
|
4254
4254
|
|
|
4255
4255
|
**Kind**: static method of [<code>Script</code>](#Script)
|
|
@@ -4604,7 +4604,7 @@ SFMC accepts multiple false values for Boolean attributes for which we are check
|
|
|
4604
4604
|
<a name="Util._isValidType"></a>
|
|
4605
4605
|
|
|
4606
4606
|
### Util.\_isValidType(selectedType) ⇒ <code>boolean</code>
|
|
4607
|
-
helper for retrieve, retrieveAsTemplate and deploy
|
|
4607
|
+
helper for [retrieve](#Mcdev.retrieve), [retrieveAsTemplate](#Mcdev.retrieveAsTemplate) and [deploy](#Mcdev.deploy)
|
|
4608
4608
|
|
|
4609
4609
|
**Kind**: static method of [<code>Util</code>](#Util)
|
|
4610
4610
|
**Returns**: <code>boolean</code> - type ok or not
|
|
@@ -4892,7 +4892,7 @@ helper around _askCredentials
|
|
|
4892
4892
|
<a name="Cli._askCredentials"></a>
|
|
4893
4893
|
|
|
4894
4894
|
### Cli.\_askCredentials(properties, [credName]) ⇒ <code>Promise.<object></code>
|
|
4895
|
-
helper for addExtraCredential()
|
|
4895
|
+
helper for [addExtraCredential](#Cli.addExtraCredential)
|
|
4896
4896
|
|
|
4897
4897
|
**Kind**: static method of [<code>Cli</code>](#Cli)
|
|
4898
4898
|
**Returns**: <code>Promise.<object></code> - credential info
|
|
@@ -4918,7 +4918,7 @@ allows updating the metadata types that shall be retrieved
|
|
|
4918
4918
|
<a name="Cli._summarizeSubtypes"></a>
|
|
4919
4919
|
|
|
4920
4920
|
### Cli.\_summarizeSubtypes(responses, type) ⇒ <code>void</code>
|
|
4921
|
-
helper for
|
|
4921
|
+
helper for [selectTypes](#Cli.selectTypes) that converts subtypes back to main type if all and only defaults were selected
|
|
4922
4922
|
this keeps the config automatically upgradable when we add new subtypes or change what is selected by default
|
|
4923
4923
|
|
|
4924
4924
|
**Kind**: static method of [<code>Cli</code>](#Cli)
|
|
@@ -5190,7 +5190,7 @@ Saves beautified files in the local file system. Will create the parent director
|
|
|
5190
5190
|
<a name="File._beautify_prettier"></a>
|
|
5191
5191
|
|
|
5192
5192
|
### File.\_beautify\_prettier(directory, filename, filetype, content) ⇒ <code>string</code>
|
|
5193
|
-
helper for writePrettyToFile, applying prettier onto given stringified content
|
|
5193
|
+
helper for [writePrettyToFile](#File.writePrettyToFile), applying prettier onto given stringified content
|
|
5194
5194
|
! Important: run 'await File.initPrettier()' in your MetadataType.retrieve() once before hitting this
|
|
5195
5195
|
|
|
5196
5196
|
**Kind**: static method of [<code>File</code>](#File)
|
|
@@ -5367,7 +5367,7 @@ handles creation/update of all config file from the boilerplate
|
|
|
5367
5367
|
<a name="Init._updateLeaf"></a>
|
|
5368
5368
|
|
|
5369
5369
|
### Init.\_updateLeaf(propertiersCur, defaultPropsCur, fieldName) ⇒ <code>void</code>
|
|
5370
|
-
recursive helper for
|
|
5370
|
+
recursive helper for [fixMcdevConfig](#Init.fixMcdevConfig) that adds missing settings
|
|
5371
5371
|
|
|
5372
5372
|
**Kind**: static method of [<code>Init</code>](#Init)
|
|
5373
5373
|
|
|
@@ -5459,7 +5459,7 @@ Creates template file for properties.json
|
|
|
5459
5459
|
<a name="Init._downloadAllBUs"></a>
|
|
5460
5460
|
|
|
5461
5461
|
### Init.\_downloadAllBUs(bu, gitStatus) ⇒ <code>Promise.<void></code>
|
|
5462
|
-
helper for
|
|
5462
|
+
helper for [initProject](#Init.initProject)
|
|
5463
5463
|
|
|
5464
5464
|
**Kind**: static method of [<code>Init</code>](#Init)
|
|
5465
5465
|
**Returns**: <code>Promise.<void></code> - -
|
|
@@ -5574,7 +5574,7 @@ handles creation/update of all config file from the boilerplate
|
|
|
5574
5574
|
<a name="Init._updateLeaf"></a>
|
|
5575
5575
|
|
|
5576
5576
|
### Init.\_updateLeaf(propertiersCur, defaultPropsCur, fieldName) ⇒ <code>void</code>
|
|
5577
|
-
recursive helper for
|
|
5577
|
+
recursive helper for [fixMcdevConfig](#Init.fixMcdevConfig) that adds missing settings
|
|
5578
5578
|
|
|
5579
5579
|
**Kind**: static method of [<code>Init</code>](#Init)
|
|
5580
5580
|
|
|
@@ -5666,7 +5666,7 @@ Creates template file for properties.json
|
|
|
5666
5666
|
<a name="Init._downloadAllBUs"></a>
|
|
5667
5667
|
|
|
5668
5668
|
### Init.\_downloadAllBUs(bu, gitStatus) ⇒ <code>Promise.<void></code>
|
|
5669
|
-
helper for
|
|
5669
|
+
helper for [initProject](#Init.initProject)
|
|
5670
5670
|
|
|
5671
5671
|
**Kind**: static method of [<code>Init</code>](#Init)
|
|
5672
5672
|
**Returns**: <code>Promise.<void></code> - -
|
|
@@ -5781,7 +5781,7 @@ handles creation/update of all config file from the boilerplate
|
|
|
5781
5781
|
<a name="Init._updateLeaf"></a>
|
|
5782
5782
|
|
|
5783
5783
|
### Init.\_updateLeaf(propertiersCur, defaultPropsCur, fieldName) ⇒ <code>void</code>
|
|
5784
|
-
recursive helper for
|
|
5784
|
+
recursive helper for [fixMcdevConfig](#Init.fixMcdevConfig) that adds missing settings
|
|
5785
5785
|
|
|
5786
5786
|
**Kind**: static method of [<code>Init</code>](#Init)
|
|
5787
5787
|
|
|
@@ -5873,7 +5873,7 @@ Creates template file for properties.json
|
|
|
5873
5873
|
<a name="Init._downloadAllBUs"></a>
|
|
5874
5874
|
|
|
5875
5875
|
### Init.\_downloadAllBUs(bu, gitStatus) ⇒ <code>Promise.<void></code>
|
|
5876
|
-
helper for
|
|
5876
|
+
helper for [initProject](#Init.initProject)
|
|
5877
5877
|
|
|
5878
5878
|
**Kind**: static method of [<code>Init</code>](#Init)
|
|
5879
5879
|
**Returns**: <code>Promise.<void></code> - -
|
|
@@ -5988,7 +5988,7 @@ handles creation/update of all config file from the boilerplate
|
|
|
5988
5988
|
<a name="Init._updateLeaf"></a>
|
|
5989
5989
|
|
|
5990
5990
|
### Init.\_updateLeaf(propertiersCur, defaultPropsCur, fieldName) ⇒ <code>void</code>
|
|
5991
|
-
recursive helper for
|
|
5991
|
+
recursive helper for [fixMcdevConfig](#Init.fixMcdevConfig) that adds missing settings
|
|
5992
5992
|
|
|
5993
5993
|
**Kind**: static method of [<code>Init</code>](#Init)
|
|
5994
5994
|
|
|
@@ -6080,7 +6080,7 @@ Creates template file for properties.json
|
|
|
6080
6080
|
<a name="Init._downloadAllBUs"></a>
|
|
6081
6081
|
|
|
6082
6082
|
### Init.\_downloadAllBUs(bu, gitStatus) ⇒ <code>Promise.<void></code>
|
|
6083
|
-
helper for
|
|
6083
|
+
helper for [initProject](#Init.initProject)
|
|
6084
6084
|
|
|
6085
6085
|
**Kind**: static method of [<code>Init</code>](#Init)
|
|
6086
6086
|
**Returns**: <code>Promise.<void></code> - -
|
|
@@ -6279,7 +6279,7 @@ SFMC accepts multiple false values for Boolean attributes for which we are check
|
|
|
6279
6279
|
<a name="Util._isValidType"></a>
|
|
6280
6280
|
|
|
6281
6281
|
### Util.\_isValidType(selectedType) ⇒ <code>boolean</code>
|
|
6282
|
-
helper for retrieve, retrieveAsTemplate and deploy
|
|
6282
|
+
helper for [retrieve](#Mcdev.retrieve), [retrieveAsTemplate](#Mcdev.retrieveAsTemplate) and [deploy](#Mcdev.deploy)
|
|
6283
6283
|
|
|
6284
6284
|
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6285
6285
|
**Returns**: <code>boolean</code> - type ok or not
|
package/lib/Deployer.js
CHANGED
|
@@ -173,7 +173,7 @@ class Deployer {
|
|
|
173
173
|
return buMultiMetadataTypeMap;
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
176
|
-
* helper for deploy
|
|
176
|
+
* helper for {@link deploy}
|
|
177
177
|
*
|
|
178
178
|
* @param {string} cred name of Credential
|
|
179
179
|
* @param {string} bu name of BU
|
|
@@ -325,6 +325,7 @@ class Deployer {
|
|
|
325
325
|
static async createFolderDefinitions(deployDir, metadata, metadataTypeArr) {
|
|
326
326
|
let i = 0;
|
|
327
327
|
const folderMetadata = {};
|
|
328
|
+
const allowedDeFolderContentTypes = ['dataextension', 'shared_dataextension'];
|
|
328
329
|
for (const metadataType of metadataTypeArr) {
|
|
329
330
|
if (!MetadataTypeInfo[metadataType].definition.dependencies.includes('folder')) {
|
|
330
331
|
Util.logger.debug(` ☇ skipping ${metadataType}: folder not a dependency`);
|
|
@@ -346,23 +347,20 @@ class Deployer {
|
|
|
346
347
|
}
|
|
347
348
|
Util.logger.debug(`Creating relevant folders for ${metadataType} in deploy dir`);
|
|
348
349
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
(
|
|
359
|
-
metadata[metadataType][key].r__folder_ContentType
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
allFolders = allFolders.map((key) => metadata[metadataType][key].r__folder_Path);
|
|
364
|
-
}
|
|
365
|
-
/* eslint-enable unicorn/prefer-ternary */
|
|
350
|
+
const allFolders = Object.keys(metadata[metadataType])
|
|
351
|
+
.filter(
|
|
352
|
+
// filter out root folders (which would not have a slash in their path)
|
|
353
|
+
(key) => metadata[metadataType][key].r__folder_Path.includes('/')
|
|
354
|
+
)
|
|
355
|
+
.filter(
|
|
356
|
+
// filter out dataExtension folders other than standard & shared (--> synchronized / salesforce are not allowed)
|
|
357
|
+
(key) =>
|
|
358
|
+
metadataType !== 'dataExtension' ||
|
|
359
|
+
allowedDeFolderContentTypes.includes(
|
|
360
|
+
metadata[metadataType][key].r__folder_ContentType
|
|
361
|
+
)
|
|
362
|
+
)
|
|
363
|
+
.map((key) => metadata[metadataType][key].r__folder_Path);
|
|
366
364
|
|
|
367
365
|
// deduplicate
|
|
368
366
|
const folderPathSet = new Set(allFolders);
|
|
@@ -384,21 +382,31 @@ class Deployer {
|
|
|
384
382
|
|
|
385
383
|
for (const folder of folderPathArrExtended) {
|
|
386
384
|
i++;
|
|
385
|
+
let contentType = MetadataTypeInfo[metadataType].definition.folderType;
|
|
386
|
+
if (
|
|
387
|
+
metadataType === 'dataExtension' &&
|
|
388
|
+
folder.startsWith('Shared Items/Shared Data Extensions')
|
|
389
|
+
) {
|
|
390
|
+
contentType = 'shared_dataextension';
|
|
391
|
+
}
|
|
387
392
|
folderMetadata[`on-the-fly-${i}`] = {
|
|
388
393
|
Path: folder,
|
|
389
394
|
Name: folder.split('/').pop(),
|
|
390
395
|
Description: '',
|
|
391
|
-
ContentType:
|
|
396
|
+
ContentType: contentType,
|
|
392
397
|
IsActive: true,
|
|
393
398
|
IsEditable: true,
|
|
394
399
|
AllowChildren: true,
|
|
400
|
+
_generated: true,
|
|
395
401
|
};
|
|
396
402
|
}
|
|
397
403
|
}
|
|
398
404
|
|
|
399
405
|
if (i > 0) {
|
|
406
|
+
MetadataTypeInfo.folder.definition.fields._generated.retrieving = true; // ensure we keep that flag in deploy folder
|
|
400
407
|
// await results to allow us to re-read it right after
|
|
401
408
|
await MetadataTypeInfo.folder.saveResults(folderMetadata, deployDir, null);
|
|
409
|
+
MetadataTypeInfo.folder.definition.fields._generated.retrieving = false; // reset flag
|
|
402
410
|
Util.logger.info(`Created folders in deploy dir: ${i}`);
|
|
403
411
|
|
|
404
412
|
// reload from file system to ensure we use the same logic for building the temporary JSON
|
package/lib/index.js
CHANGED
|
@@ -99,7 +99,7 @@ class Asset extends MetadataType {
|
|
|
99
99
|
return { metadata: Object.values(metadata)[0], type: this.definition.type };
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
* helper for retrieve + retrieveAsTemplate
|
|
102
|
+
* helper for {@link retrieve} + {@link retrieveAsTemplate}
|
|
103
103
|
*
|
|
104
104
|
* @private
|
|
105
105
|
* @returns {TYPE.AssetSubType[]} subtype array
|
|
@@ -443,7 +443,7 @@ class Asset extends MetadataType {
|
|
|
443
443
|
);
|
|
444
444
|
}
|
|
445
445
|
/**
|
|
446
|
-
* helper for
|
|
446
|
+
* helper for {@link preDeployTasks}
|
|
447
447
|
* Some metadata types store their actual content as a separate file, e.g. images
|
|
448
448
|
* This method reads these from the local FS stores them in the metadata object allowing to deploy it
|
|
449
449
|
*
|
|
@@ -607,7 +607,7 @@ class Asset extends MetadataType {
|
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
609
|
/**
|
|
610
|
-
* helper for buildDefinition
|
|
610
|
+
* helper for {@link MetadataType.buildDefinition}
|
|
611
611
|
* handles extracted code if any are found for complex types
|
|
612
612
|
*
|
|
613
613
|
* @param {string} templateDir Directory where metadata templates are stored
|
|
@@ -634,7 +634,7 @@ class Asset extends MetadataType {
|
|
|
634
634
|
);
|
|
635
635
|
}
|
|
636
636
|
/**
|
|
637
|
-
* helper for buildTemplate
|
|
637
|
+
* helper for {@link MetadataType.buildTemplate}
|
|
638
638
|
* handles extracted code if any are found for complex types
|
|
639
639
|
*
|
|
640
640
|
* @example assets of type codesnippetblock will result in 1 json and 1 amp/html file. both files need to be run through templating
|
|
@@ -663,7 +663,7 @@ class Asset extends MetadataType {
|
|
|
663
663
|
}
|
|
664
664
|
|
|
665
665
|
/**
|
|
666
|
-
* helper for buildDefinition
|
|
666
|
+
* helper for {@link MetadataType.buildDefinition}
|
|
667
667
|
* handles extracted code if any are found for complex types
|
|
668
668
|
*
|
|
669
669
|
* @param {string} templateDir Directory where metadata templates are stored
|
|
@@ -792,7 +792,7 @@ class Asset extends MetadataType {
|
|
|
792
792
|
return metadata;
|
|
793
793
|
}
|
|
794
794
|
/**
|
|
795
|
-
* helper for
|
|
795
|
+
* helper for {@link preDeployTasks} that loads extracted code content back into JSON
|
|
796
796
|
*
|
|
797
797
|
* @param {TYPE.AssetItem} metadata a single asset definition
|
|
798
798
|
* @param {string} deployDir directory of deploy files
|
|
@@ -1024,7 +1024,7 @@ class Asset extends MetadataType {
|
|
|
1024
1024
|
return fileList;
|
|
1025
1025
|
}
|
|
1026
1026
|
/**
|
|
1027
|
-
* helper for
|
|
1027
|
+
* helper for {@link preDeployTasks} that loads extracted code content back into JSON
|
|
1028
1028
|
*
|
|
1029
1029
|
* @param {string} prefix usually the customerkey
|
|
1030
1030
|
* @param {object} metadataSlots metadata.views.html.slots or deeper slots.<>.blocks.<>.slots
|
|
@@ -1104,7 +1104,7 @@ class Asset extends MetadataType {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
}
|
|
1106
1106
|
/**
|
|
1107
|
-
* helper for
|
|
1107
|
+
* helper for {@link parseMetadata} that finds code content in JSON and extracts it
|
|
1108
1108
|
* to allow saving that separately and formatted
|
|
1109
1109
|
*
|
|
1110
1110
|
* @param {TYPE.AssetItem} metadata a single asset definition
|
|
@@ -123,7 +123,7 @@ class DataExtension extends MetadataType {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
|
-
* helper for upsert
|
|
126
|
+
* helper for {@link upsert}
|
|
127
127
|
*
|
|
128
128
|
* @param {object} res -
|
|
129
129
|
* @returns {boolean} true: keep, false: discard
|
|
@@ -964,7 +964,7 @@ class DataExtension extends MetadataType {
|
|
|
964
964
|
);
|
|
965
965
|
}
|
|
966
966
|
} else if (!error) {
|
|
967
|
-
Util.logger.
|
|
967
|
+
Util.logger.warn(
|
|
968
968
|
` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${
|
|
969
969
|
metadata[this.definition.keyField]
|
|
970
970
|
}): ${ex.message}`
|
|
@@ -32,7 +32,7 @@ class DataExtensionField extends MetadataType {
|
|
|
32
32
|
return super.retrieveSOAP(null, null, requestParams, additionalFields);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* helper for DataExtension.
|
|
35
|
+
* helper for {@link DataExtension._retrieveFieldsForSingleDe} that sorts the fields into an array
|
|
36
36
|
*
|
|
37
37
|
* @param {TYPE.DataExtensionFieldMap} fieldsObj customerKey-based list of fields for one dataExtension
|
|
38
38
|
* @returns {TYPE.DataExtensionFieldItem[]} sorted array of field objects
|
|
@@ -166,7 +166,9 @@ class Folder extends MetadataType {
|
|
|
166
166
|
*/
|
|
167
167
|
static async upsert(metadata) {
|
|
168
168
|
let updateCount = 0;
|
|
169
|
+
let updateFailedCount = 0;
|
|
169
170
|
let createCount = 0;
|
|
171
|
+
let createFailedCount = 0;
|
|
170
172
|
let filteredByPreDeploy = 0;
|
|
171
173
|
const upsertResults = {};
|
|
172
174
|
const sortPairs = toposort(
|
|
@@ -206,12 +208,13 @@ class Folder extends MetadataType {
|
|
|
206
208
|
);
|
|
207
209
|
if (
|
|
208
210
|
existingId &&
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
(metadata[metadataKey]._generated || // of generated, never "update"
|
|
212
|
+
!this.hasChangedGeneric(
|
|
213
|
+
cachedVersion,
|
|
214
|
+
metadata[metadataKey],
|
|
215
|
+
'Path',
|
|
216
|
+
true
|
|
217
|
+
))
|
|
215
218
|
) {
|
|
216
219
|
Util.logger.verbose(
|
|
217
220
|
` - skipping ${this.definition.type} ${
|
|
@@ -228,12 +231,13 @@ class Folder extends MetadataType {
|
|
|
228
231
|
existingId = cachedVersion?.ID;
|
|
229
232
|
if (
|
|
230
233
|
existingId &&
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
(metadata[metadataKey]._generated || // of generated, never "update"
|
|
235
|
+
!this.hasChangedGeneric(
|
|
236
|
+
cachedVersion,
|
|
237
|
+
metadata[metadataKey],
|
|
238
|
+
'Path',
|
|
239
|
+
true
|
|
240
|
+
))
|
|
237
241
|
) {
|
|
238
242
|
Util.logger.verbose(
|
|
239
243
|
` - skipping ${this.definition.type} ${
|
|
@@ -253,10 +257,18 @@ class Folder extends MetadataType {
|
|
|
253
257
|
// if an existing folder exists with the same name/path then use that
|
|
254
258
|
deployableMetadata.ID = existingId;
|
|
255
259
|
result = await this.update(deployableMetadata);
|
|
256
|
-
|
|
260
|
+
if (result) {
|
|
261
|
+
updateCount++;
|
|
262
|
+
} else {
|
|
263
|
+
updateFailedCount++;
|
|
264
|
+
}
|
|
257
265
|
} else {
|
|
258
266
|
result = await this.create(deployableMetadata);
|
|
259
|
-
|
|
267
|
+
if (result) {
|
|
268
|
+
createCount++;
|
|
269
|
+
} else {
|
|
270
|
+
createFailedCount++;
|
|
271
|
+
}
|
|
260
272
|
}
|
|
261
273
|
if (result?.Results) {
|
|
262
274
|
const parsed = this.parseResponseBody({
|
|
@@ -293,7 +305,9 @@ class Folder extends MetadataType {
|
|
|
293
305
|
}
|
|
294
306
|
// Logging
|
|
295
307
|
Util.logger.info(
|
|
296
|
-
`${this.definition.type} upsert: ${createCount}
|
|
308
|
+
`${this.definition.type} upsert: ${createCount} of ${
|
|
309
|
+
createCount + createFailedCount
|
|
310
|
+
} created / ${updateCount} of ${updateCount + updateFailedCount} updated` +
|
|
297
311
|
(filteredByPreDeploy > 0 ? ` / ${filteredByPreDeploy} filtered` : '')
|
|
298
312
|
);
|
|
299
313
|
|
|
@@ -1281,7 +1281,7 @@ class MetadataType {
|
|
|
1281
1281
|
return savedResults;
|
|
1282
1282
|
}
|
|
1283
1283
|
/**
|
|
1284
|
-
* helper for buildDefinitionForNested
|
|
1284
|
+
* helper for {@link buildDefinitionForNested}
|
|
1285
1285
|
* searches extracted file for template variable names and applies the market values
|
|
1286
1286
|
*
|
|
1287
1287
|
* @param {string} code code from extracted code
|
|
@@ -1293,7 +1293,7 @@ class MetadataType {
|
|
|
1293
1293
|
return Mustache.render(code, templateVariables);
|
|
1294
1294
|
}
|
|
1295
1295
|
/**
|
|
1296
|
-
* helper for buildTemplateForNested
|
|
1296
|
+
* helper for {@link buildTemplateForNested}
|
|
1297
1297
|
* searches extracted file for template variable values and applies the market variable names
|
|
1298
1298
|
*
|
|
1299
1299
|
* @param {string} code code from extracted code
|
|
@@ -1305,7 +1305,7 @@ class MetadataType {
|
|
|
1305
1305
|
return Util.replaceByObject(code, templateVariables);
|
|
1306
1306
|
}
|
|
1307
1307
|
/**
|
|
1308
|
-
* helper for buildDefinition
|
|
1308
|
+
* helper for {@link buildDefinition}
|
|
1309
1309
|
* handles extracted code if any are found for complex types (e.g script, asset, query)
|
|
1310
1310
|
*
|
|
1311
1311
|
* @param {string} templateDir Directory where metadata templates are stored
|
|
@@ -1326,7 +1326,7 @@ class MetadataType {
|
|
|
1326
1326
|
return null;
|
|
1327
1327
|
}
|
|
1328
1328
|
/**
|
|
1329
|
-
* helper for buildTemplate
|
|
1329
|
+
* helper for {@link buildTemplate}
|
|
1330
1330
|
* handles extracted code if any are found for complex types
|
|
1331
1331
|
*
|
|
1332
1332
|
* @param {string} templateDir Directory where metadata templates are stored
|
|
@@ -136,7 +136,7 @@ class Query extends MetadataType {
|
|
|
136
136
|
return metadata;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
|
-
* helper for buildDefinitionForNested
|
|
139
|
+
* helper for {@link buildDefinitionForNested}
|
|
140
140
|
* searches extracted SQL file for template variables and applies the market values
|
|
141
141
|
*
|
|
142
142
|
* @param {string} code code from extracted code
|
|
@@ -159,7 +159,7 @@ class Query extends MetadataType {
|
|
|
159
159
|
return Mustache.render(code, templateVariables);
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
|
-
* helper for buildDefinition
|
|
162
|
+
* helper for {@link MetadataType.buildDefinition}
|
|
163
163
|
* handles extracted code if any are found for complex types
|
|
164
164
|
*
|
|
165
165
|
* @param {string} templateDir Directory where metadata templates are stored
|
|
@@ -186,7 +186,7 @@ class Query extends MetadataType {
|
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
|
-
* helper for buildTemplate
|
|
189
|
+
* helper for {@link MetadataType.buildTemplate}
|
|
190
190
|
* handles extracted code if any are found for complex types
|
|
191
191
|
*
|
|
192
192
|
* @example queries are saved as 1 json and 1 sql file. both files need to be run through templating
|
|
@@ -214,7 +214,7 @@ class Query extends MetadataType {
|
|
|
214
214
|
);
|
|
215
215
|
}
|
|
216
216
|
/**
|
|
217
|
-
* helper for buildTemplateForNested / buildDefinitionForNested
|
|
217
|
+
* helper for {@link buildTemplateForNested} / {@link buildDefinitionForNested}
|
|
218
218
|
* handles extracted code if any are found for complex types
|
|
219
219
|
*
|
|
220
220
|
* @private
|