diff --git a/docs/dist/documentation.md b/docs/dist/documentation.md index 656712476..7ca0015c9 100644 --- a/docs/dist/documentation.md +++ b/docs/dist/documentation.md @@ -132,6 +132,16 @@ Provides default functionality that can be overwritten by child metadata type cl
Retrieves metadata from a business unit and saves it to the local filesystem.
main class
+MetadataType
FileTransfer MetadataType
+MetadataType class that gets extended by their specific metadata type class. +Provides default functionality that can be overwritten by child metadata type classes
+SDK
Returns an SDK instance to be used for API calls
Array.<string>
helper to convert CSVs into an array. if only one value was given, it's also returned as an array
+Promise.<Object.<string, Array.<string>>>
run a method across BUs
+Promise.<Array.<string>>
helper for Mcdev.#runMethod
+Array.<string>
helper for Mcdev.#runOnBU
+Promise.<Array.<string>>
Updates the key to match the name field
+Promise.<void>
* [.document(businessUnit, type)](#Mcdev.document) ⇒ Promise.<void>
* [.deleteByKey(businessUnit, type, customerKey)](#Mcdev.deleteByKey) ⇒ Promise.<boolean>
+ * [.resolveId(businessUnit, type, id)](#Mcdev.resolveId) ⇒ Promise.<{key:string, name:string, path:string}>
+ * [.refresh(businessUnit, type, [keyArr])](#Mcdev.refresh) ⇒ Promise.<void>
+ * [.badKeys(businessUnit)](#Mcdev.badKeys) ⇒ Promise.<void>
+ * [.retrieveAsTemplate(businessUnit, selectedType, name, market)](#Mcdev.retrieveAsTemplate) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+ * [.buildTemplate(businessUnit, selectedType, keyArr, market)](#Mcdev.buildTemplate) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+ * [.buildDefinition(businessUnit, selectedType, name, market)](#Mcdev.buildDefinition) ⇒ Promise.<void>
+ * [.buildDefinitionBulk(listName, type, name)](#Mcdev.buildDefinitionBulk) ⇒ Promise.<void>
+ * [.getFilesToCommit(businessUnit, selectedType, keyArr)](#Mcdev.getFilesToCommit) ⇒ Promise.<Array.<string>>
+ * [.schedule(businessUnit, [selectedType], [keys])](#Mcdev.schedule) ⇒ Promise.<Object.<string, Array.<string>>>
+ * [.execute(businessUnit, [selectedType], [keys])](#Mcdev.execute) ⇒ Promise.<Object.<string, Array.<string>>>
+ * [.pause(businessUnit, [selectedType], [keys])](#Mcdev.pause) ⇒ Promise.<Object.<string, Array.<string>>>
+ * [.fixKeys(businessUnit, selectedType, [keys])](#Mcdev.fixKeys) ⇒ Promise.<Object.<string, Array.<string>>>
+ * [.version()](#Mcdev.version) ⇒ string
+ * [.setSkipInteraction([skipInteraction])](#Mcdev.setSkipInteraction) ⇒ void
+ * [.setLoggingLevel(argv)](#Mcdev.setLoggingLevel) ⇒ void
+ * [.setOptions(argv)](#Mcdev.setOptions) ⇒ void
+ * [.createDeltaPkg(argv)](#Mcdev.createDeltaPkg) ⇒ Promise.<Array.<TYPE.DeltaPkgItem>>
+ * [.selectTypes()](#Mcdev.selectTypes) ⇒ Promise
+ * [.explainTypes()](#Mcdev.explainTypes) ⇒ Array.<object>
+ * [.upgrade()](#Mcdev.upgrade) ⇒ Promise.<boolean>
+ * [.retrieve(businessUnit, [selectedTypesArr], [keys], [changelogOnly])](#Mcdev.retrieve) ⇒ Promise.<object>
+ * [.deploy(businessUnit, [selectedTypesArr], [keyArr])](#Mcdev.deploy) ⇒ Promise.<Object.<string, TYPE.MultiMetadataTypeMap>>
+ * [.initProject([credentialsName])](#Mcdev.initProject) ⇒ Promise.<void>
+ * [.joinProject()](#Mcdev.joinProject) ⇒ Promise.<void>
+ * [.findBUs(credentialsName)](#Mcdev.findBUs) ⇒ Promise.<void>
+ * [.document(businessUnit, type)](#Mcdev.document) ⇒ Promise.<void>
+ * [.deleteByKey(businessUnit, type, customerKey)](#Mcdev.deleteByKey) ⇒ Promise.<boolean>
+ * [.resolveId(businessUnit, type, id)](#Mcdev.resolveId) ⇒ Promise.<{key:string, name:string, path:string}>
* [.refresh(businessUnit, type, [keyArr])](#Mcdev.refresh) ⇒ Promise.<void>
* [.badKeys(businessUnit)](#Mcdev.badKeys) ⇒ Promise.<void>
* [.retrieveAsTemplate(businessUnit, selectedType, name, market)](#Mcdev.retrieveAsTemplate) ⇒ Promise.<TYPE.MultiMetadataTypeList>
@@ -703,6 +756,20 @@ deletes metadata from MC instance by key
| type | string
| supported metadata type |
| customerKey | string
| Identifier of metadata |
+
+
+### Mcdev.resolveId(businessUnit, type, id) ⇒ Promise.<{key:string, name:string, path:string}>
+get name & key for provided id
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<{key:string, name:string, path:string}>
- key, name and path of metadata; null if not found
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| type | string
| supported metadata type |
+| id | string
| Identifier of metadata |
+
### Mcdev.refresh(businessUnit, type, [keyArr]) ⇒ Promise.<void>
@@ -856,1630 +923,1681 @@ Updates the key to match the name field
| selectedType | TYPE.SupportedMetadataTypes
| limit to given metadata types |
| [keys] | Array.<string>
| customerkey of the metadata |
-
+
-## Asset ⇐ [MetadataType
](#MetadataType)
-FileTransfer MetadataType
+### Mcdev.version() ⇒ string
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: string
- current version of mcdev
+
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+### Mcdev.setSkipInteraction([skipInteraction]) ⇒ void
+helper method to use unattended mode when including mcdev as a package
-* [Asset](#Asset) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, _, [subTypeArr], [key])](#Asset.retrieve) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
- * [.retrieveForCache([_], [subTypeArr])](#Asset.retrieveForCache) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
- * [.retrieveAsTemplate(templateDir, name, templateVariables, [selectedSubType])](#Asset.retrieveAsTemplate) ⇒ Promise.<{metadata: TYPE.AssetItem, type: string}>
- * [.create(metadata)](#Asset.create) ⇒ Promise
- * [.update(metadata)](#Asset.update) ⇒ Promise
- * [.requestSubType(subType, [retrieveDir], [templateName], [templateVariables], key)](#Asset.requestSubType) ⇒ Promise
- * [.requestAndSaveExtended(items, subType, retrieveDir, [templateVariables])](#Asset.requestAndSaveExtended) ⇒ Promise
- * [._retrieveExtendedFile(metadata, subType, retrieveDir)](#Asset._retrieveExtendedFile) ⇒ Promise.<void>
- * [._readExtendedFileFromFS(metadata, subType, deployDir, [pathOnly])](#Asset._readExtendedFileFromFS) ⇒ Promise.<string>
- * [.postRetrieveTasks(metadata)](#Asset.postRetrieveTasks) ⇒ TYPE.CodeExtractItem
- * [.postDeployTasks(metadata, _, createdUpdated)](#Asset.postDeployTasks) ⇒ Promise.<void>
- * [.preDeployTasks(metadata, deployDir)](#Asset.preDeployTasks) ⇒ Promise.<TYPE.AssetItem>
- * [._getMainSubtype(extendedSubType)](#Asset._getMainSubtype) ⇒ string
- * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Asset.buildDefinitionForNested) ⇒ Promise.<void>
- * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Asset.buildTemplateForNested) ⇒ Promise.<void>
- * [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#Asset._buildForNested) ⇒ Promise.<void>
- * [.setFolderPath(metadata)](#Asset.setFolderPath)
- * [.setFolderId(metadata)](#Asset.setFolderId)
- * [._mergeCode(metadata, deployDir, subType, [templateName], [fileListOnly])](#Asset._mergeCode) ⇒ Promise.<Array.<TYPE.CodeExtract>>
- * [._mergeCode_slots(prefix, metadataSlots, readDirArr, subtypeExtension, subDirArr, fileList, customerKey, [templateName], [fileListOnly])](#Asset._mergeCode_slots) ⇒ Promise.<void>
- * [._extractCode(metadata)](#Asset._extractCode) ⇒ TYPE.CodeExtractItem
- * [._extractCode_slots(prefix, metadataSlots, codeArr)](#Asset._extractCode_slots) ⇒ void
- * [.getJsonFromFS(dir, [_], selectedSubType)](#Asset.getJsonFromFS) ⇒ TYPE.MetadataTypeMap
- * [.findSubType(templateDir, templateName)](#Asset.findSubType) ⇒ Promise.<TYPE.AssetSubType>
- * [.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName)](#Asset.readSecondaryFolder) ⇒ TYPE.AssetItem
- * [.getFilesToCommit(keyArr)](#Asset.getFilesToCommit) ⇒ Array.<string>
- * [.deleteByKey(customerKey)](#Asset.deleteByKey) ⇒ Promise.<boolean>
- * [.postDeleteTasks(customerKey)](#Asset.postDeleteTasks) ⇒ void
+**Kind**: static method of [Mcdev
](#Mcdev)
-
+| Param | Type | Description |
+| --- | --- | --- |
+| [skipInteraction] | boolean
\| TYPE.skipInteraction
| signals what to insert automatically for things usually asked via wizard |
-### Asset.retrieve(retrieveDir, _, [subTypeArr], [key]) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
-Retrieves Metadata of Asset
+
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise.<{metadata: TYPE.AssetMap, type: string}>
- Promise
+### Mcdev.setLoggingLevel(argv) ⇒ void
+configures what is displayed in the console
+
+**Kind**: static method of [Mcdev
](#Mcdev)
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| _ | void
| - |
-| [subTypeArr] | Array.<TYPE.AssetSubType>
| optionally limit to a single subtype |
-| [key] | string
| customer key |
+| argv | object
| list of command line parameters given by user |
+| [argv.silent] | boolean
| only errors printed to CLI |
+| [argv.verbose] | boolean
| chatty user CLI output |
+| [argv.debug] | boolean
| enables developer output & features |
-
+
-### Asset.retrieveForCache([_], [subTypeArr]) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
-Retrieves asset metadata for caching
+### Mcdev.setOptions(argv) ⇒ void
+allows setting system wide / command related options
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise.<{metadata: TYPE.AssetMap, type: string}>
- Promise
+**Kind**: static method of [Mcdev
](#Mcdev)
| Param | Type | Description |
| --- | --- | --- |
-| [_] | void
| parameter not used |
-| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+| argv | object
| list of command line parameters given by user |
-
+
-### Asset.retrieveAsTemplate(templateDir, name, templateVariables, [selectedSubType]) ⇒ Promise.<{metadata: TYPE.AssetItem, type: string}>
-Retrieves asset metadata for templating
+### Mcdev.createDeltaPkg(argv) ⇒ Promise.<Array.<TYPE.DeltaPkgItem>>
+handler for 'mcdev createDeltaPkg
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise.<{metadata: TYPE.AssetItem, type: string}>
- Promise
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Array.<TYPE.DeltaPkgItem>>
- list of changed items
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where retrieved metadata directory will be saved |
-| name | string
| name of the metadata file |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| [selectedSubType] | TYPE.AssetSubType
| optionally limit to a single subtype |
+| argv | object
| yargs parameters |
+| [argv.range] | string
| git commit range into deploy directory |
+| [argv.filter] | string
| filter file paths that start with any |
+| [argv.diffArr] | Array.<TYPE.DeltaPkgItem>
| list of files to include in delta package (skips git diff when provided) |
-
+
-### Asset.create(metadata) ⇒ Promise
-Creates a single asset
+### Mcdev.selectTypes() ⇒ Promise
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise
- .
+
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise
- Promise
+### Mcdev.explainTypes() ⇒ Array.<object>
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Array.<object>
- list of supported types with their apiNames
+
+
+### Mcdev.upgrade() ⇒ Promise.<boolean>
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<boolean>
- success flag
+
+
+### Mcdev.retrieve(businessUnit, [selectedTypesArr], [keys], [changelogOnly]) ⇒ Promise.<object>
+Retrieve all metadata from the specified business unit into the local file system.
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<object>
- -
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.AssetItem
| a single asset |
+| businessUnit | string
| references credentials from properties.json |
+| [selectedTypesArr] | Array.<TYPE.SupportedMetadataTypes>
\| TYPE.TypeKeyCombo
| limit retrieval to given metadata type |
+| [keys] | Array.<string>
| limit retrieval to given metadata key |
+| [changelogOnly] | boolean
| skip saving, only create json in memory |
-
+
-### Asset.update(metadata) ⇒ Promise
-Updates a single asset
+### Mcdev.deploy(businessUnit, [selectedTypesArr], [keyArr]) ⇒ Promise.<Object.<string, TYPE.MultiMetadataTypeMap>>
+Deploys all metadata located in the 'deploy' directory to the specified business unit
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise
- Promise
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, TYPE.MultiMetadataTypeMap>>
- deployed metadata per BU (first key: bu name, second key: metadata type)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.AssetItem
| a single asset |
+| businessUnit | string
| references credentials from properties.json |
+| [selectedTypesArr] | Array.<TYPE.SupportedMetadataTypes>
| limit deployment to given metadata type |
+| [keyArr] | Array.<string>
| limit deployment to given metadata keys |
-
+
-### Asset.requestSubType(subType, [retrieveDir], [templateName], [templateVariables], key) ⇒ Promise
-Retrieves Metadata of a specific asset type
+### Mcdev.initProject([credentialsName]) ⇒ Promise.<void>
+Creates template file for properties.json
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise
- Promise
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
-| [retrieveDir] | string
| target directory for saving assets |
-| [templateName] | string
| name of the metadata file |
-| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| key | string
| customer key to filter by |
+| [credentialsName] | string
| identifying name of the installed package / project |
-
+
-### Asset.requestAndSaveExtended(items, subType, retrieveDir, [templateVariables]) ⇒ Promise
-Retrieves extended metadata (files or extended content) of asset
+### Mcdev.joinProject() ⇒ Promise.<void>
+Clones an existing project from git repository and installs it
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise
- Promise
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+
+### Mcdev.findBUs(credentialsName) ⇒ Promise.<void>
+Refreshes BU names and ID's from MC instance
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| items | Array
| array of items to retrieve |
-| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
-| retrieveDir | string
| target directory for saving assets |
-| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| credentialsName | string
| identifying name of the installed package / project |
-
+
-### Asset.\_retrieveExtendedFile(metadata, subType, retrieveDir) ⇒ Promise.<void>
-Some metadata types store their actual content as a separate file, e.g. images
-This method retrieves these and saves them alongside the metadata json
+### Mcdev.document(businessUnit, type) ⇒ Promise.<void>
+Creates docs for supported metadata types in Markdown and/or HTML format
-**Kind**: static method of [Asset
](#Asset)
+**Kind**: static method of [Mcdev
](#Mcdev)
**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.AssetItem
| a single asset |
-| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
-| retrieveDir | string
| target directory for saving assets |
-
-
+| businessUnit | string
| references credentials from properties.json |
+| type | string
| metadata type |
-### Asset.\_readExtendedFileFromFS(metadata, subType, deployDir, [pathOnly]) ⇒ Promise.<string>
-helper for [preDeployTasks](#Asset.preDeployTasks)
-Some metadata types store their actual content as a separate file, e.g. images
-This method reads these from the local FS stores them in the metadata object allowing to deploy it
+
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise.<string>
- if found will return the path of the binary file
-
-| Param | Type | Default | Description |
-| --- | --- | --- | --- |
-| metadata | TYPE.AssetItem
| | a single asset |
-| subType | TYPE.AssetSubType
| | group of similar assets to put in a folder (ie. images) |
-| deployDir | string
| | directory of deploy files |
-| [pathOnly] | boolean
| false
| used by getFilesToCommit which does not need the binary file to be actually read |
-
-
-
-### Asset.postRetrieveTasks(metadata) ⇒ TYPE.CodeExtractItem
-manages post retrieve steps
+### Mcdev.deleteByKey(businessUnit, type, customerKey) ⇒ Promise.<boolean>
+deletes metadata from MC instance by key
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: TYPE.CodeExtractItem
- metadata
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<boolean>
- true if successful, false otherwise
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.AssetItem
| a single asset |
+| businessUnit | string
| references credentials from properties.json |
+| type | string
| supported metadata type |
+| customerKey | string
| Identifier of metadata |
-
+
-### Asset.postDeployTasks(metadata, _, createdUpdated) ⇒ Promise.<void>
-Gets executed after deployment of metadata type
+### Mcdev.resolveId(businessUnit, type, id) ⇒ Promise.<{key:string, name:string, path:string}>
+get name & key for provided id
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise.<void>
- -
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<{key:string, name:string, path:string}>
- key, name and path of metadata; null if not found
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
-| _ | TYPE.MetadataTypeMap
| originalMetadata to be updated (contains additioanl fields) |
-| createdUpdated | Object
| counter representing successful creates/updates |
+| businessUnit | string
| references credentials from properties.json |
+| type | string
| supported metadata type |
+| id | string
| Identifier of metadata |
-
+
-### Asset.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.AssetItem>
-prepares an asset definition for deployment
+### Mcdev.refresh(businessUnit, type, [keyArr]) ⇒ Promise.<void>
+ensures triggered sends are restarted to ensure they pick up on changes of the underlying emails
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise.<TYPE.AssetItem>
- Promise
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.AssetItem
| a single asset |
-| deployDir | string
| directory of deploy files |
+| businessUnit | string
| references credentials from properties.json |
+| type | string
| references credentials from properties.json |
+| [keyArr] | Array.<string>
| metadata keys |
-
+
-### Asset.\_getMainSubtype(extendedSubType) ⇒ string
-find the subType matching the extendedSubType
+### Mcdev.badKeys(businessUnit) ⇒ Promise.<void>
+Converts metadata to legacy format. Output is saved in 'converted' directory
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: string
- subType: block, message, other, etc
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| extendedSubType | string
| webpage, htmlblock, etc |
+| businessUnit | string
| references credentials from properties.json |
-
+
-### Asset.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<void>
-helper for [buildDefinition](#MetadataType.buildDefinition)
-handles extracted code if any are found for complex types
+### Mcdev.retrieveAsTemplate(businessUnit, selectedType, name, market) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+Retrieve a specific metadata file and templatise.
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise.<void>
- -
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<TYPE.MultiMetadataTypeList>
- -
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
| Directory where built definitions will be saved |
-| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
+| businessUnit | string
| references credentials from properties.json |
+| selectedType | string
| supported metadata type |
+| name | Array.<string>
| name of the metadata |
+| market | string
| market which should be used to revert template |
-
+
-### Asset.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<void>
-helper for [buildTemplate](#MetadataType.buildTemplate)
-handles extracted code if any are found for complex types
+### Mcdev.buildTemplate(businessUnit, selectedType, keyArr, market) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+Build a template based on a list of metadata files in the retrieve folder.
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise.<void>
- -
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<TYPE.MultiMetadataTypeList>
- -
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
+| businessUnit | string
| references credentials from properties.json |
+| selectedType | string
| supported metadata type |
+| keyArr | Array.<string>
| customerkey of the metadata |
+| market | string
| market localizations |
-**Example**
-```js
-assets of type codesnippetblock will result in 1 json and 1 amp/html file. both files need to be run through templating
-```
-
+
-### Asset.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ Promise.<void>
-helper for [buildDefinition](#MetadataType.buildDefinition)
-handles extracted code if any are found for complex types
+### Mcdev.buildDefinition(businessUnit, selectedType, name, market) ⇒ Promise.<void>
+Build a specific metadata file based on a template.
-**Kind**: static method of [Asset
](#Asset)
+**Kind**: static method of [Mcdev
](#Mcdev)
**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
| Directory where built definitions will be saved |
-| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
-| mode | 'definition'
\| 'template'
| defines what we use this helper for |
+| businessUnit | string
| references credentials from properties.json |
+| selectedType | string
| supported metadata type |
+| name | string
| name of the metadata |
+| market | string
| market localizations |
-
+
-### Asset.setFolderPath(metadata)
-generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
+### Mcdev.buildDefinitionBulk(listName, type, name) ⇒ Promise.<void>
+Build a specific metadata file based on a template using a list of bu-market combos
-**Kind**: static method of [Asset
](#Asset)
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single script activity definition |
-
-
+| listName | string
| name of list of BU-market combos |
+| type | string
| supported metadata type |
+| name | string
| name of the metadata |
-### Asset.setFolderId(metadata)
-Asset-specific script that retrieves the folder ID from cache and updates the given metadata with it before deploy
+
-**Kind**: static method of [Asset
](#Asset)
+### Mcdev.getFilesToCommit(businessUnit, selectedType, keyArr) ⇒ Promise.<Array.<string>>
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Array.<string>>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
-
-
-
-### Asset.\_mergeCode(metadata, deployDir, subType, [templateName], [fileListOnly]) ⇒ Promise.<Array.<TYPE.CodeExtract>>
-helper for [preDeployTasks](#Asset.preDeployTasks) that loads extracted code content back into JSON
-
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise.<Array.<TYPE.CodeExtract>>
- fileList for templating (disregarded during deployment)
-
-| Param | Type | Default | Description |
-| --- | --- | --- | --- |
-| metadata | TYPE.AssetItem
| | a single asset definition |
-| deployDir | string
| | directory of deploy files |
-| subType | TYPE.AssetSubType
| | asset-subtype name |
-| [templateName] | string
| | name of the template used to built defintion (prior applying templating) |
-| [fileListOnly] | boolean
| false
| does not read file contents nor update metadata if true |
-
-
-
-### Asset.\_mergeCode\_slots(prefix, metadataSlots, readDirArr, subtypeExtension, subDirArr, fileList, customerKey, [templateName], [fileListOnly]) ⇒ Promise.<void>
-helper for [preDeployTasks](#Asset.preDeployTasks) that loads extracted code content back into JSON
-
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise.<void>
- -
-
-| Param | Type | Default | Description |
-| --- | --- | --- | --- |
-| prefix | string
| | usually the customerkey |
-| metadataSlots | object
| | metadata.views.html.slots or deeper slots.<>.blocks.<>.slots |
-| readDirArr | Array.<string>
| | directory of deploy files |
-| subtypeExtension | string
| | asset-subtype name ending on -meta |
-| subDirArr | Array.<string>
| | directory of files w/o leading deploy dir |
-| fileList | Array.<object>
| | directory of files w/o leading deploy dir |
-| customerKey | string
| | external key of template (could have been changed if used during templating) |
-| [templateName] | string
| | name of the template used to built defintion (prior applying templating) |
-| [fileListOnly] | boolean
| false
| does not read file contents nor update metadata if true |
+| businessUnit | string
| references credentials from properties.json |
+| selectedType | string
| supported metadata type |
+| keyArr | Array.<string>
| customerkey of the metadata |
-
+
-### Asset.\_extractCode(metadata) ⇒ TYPE.CodeExtractItem
-helper for [postRetrieveTasks](#Asset.postRetrieveTasks) that finds code content in JSON and extracts it
-to allow saving that separately and formatted
+### Mcdev.schedule(businessUnit, [selectedType], [keys]) ⇒ Promise.<Object.<string, Array.<string>>>
+Schedule an item (shortcut for execute --schedule)
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: TYPE.CodeExtractItem
- { json: metadata, codeArr: object[], subFolder: string[] }
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, Array.<string>>>
- key: business unit name, value: list of scheduled item keys
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.AssetItem
| a single asset definition |
+| businessUnit | string
| name of BU |
+| [selectedType] | TYPE.SupportedMetadataTypes
| limit to given metadata types |
+| [keys] | Array.<string>
| customerkey of the metadata |
-
+
-### Asset.\_extractCode\_slots(prefix, metadataSlots, codeArr) ⇒ void
-**Kind**: static method of [Asset
](#Asset)
+### Mcdev.execute(businessUnit, [selectedType], [keys]) ⇒ Promise.<Object.<string, Array.<string>>>
+Start/execute an item
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, Array.<string>>>
- key: business unit name, value: list of executed item keys
| Param | Type | Description |
| --- | --- | --- |
-| prefix | string
| usually the customerkey |
-| metadataSlots | object
| metadata.views.html.slots or deeper slots.<>.blocks.<>.slots |
-| codeArr | Array.<object>
| to be extended array for extracted code |
+| businessUnit | string
| name of BU |
+| [selectedType] | TYPE.SupportedMetadataTypes
| limit to given metadata types |
+| [keys] | Array.<string>
| customerkey of the metadata |
-
+
-### Asset.getJsonFromFS(dir, [_], selectedSubType) ⇒ TYPE.MetadataTypeMap
-Returns file contents mapped to their fileName without '.json' ending
+### Mcdev.pause(businessUnit, [selectedType], [keys]) ⇒ Promise.<Object.<string, Array.<string>>>
+pause an item
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: TYPE.MetadataTypeMap
- fileName => fileContent map
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, Array.<string>>>
- key: business unit name, value: list of paused item keys
| Param | Type | Description |
| --- | --- | --- |
-| dir | string
| directory that contains '.json' files to be read |
-| [_] | void
| unused parameter |
-| selectedSubType | Array.<string>
| asset, message, ... |
+| businessUnit | string
| name of BU |
+| [selectedType] | TYPE.SupportedMetadataTypes
| limit to given metadata types |
+| [keys] | Array.<string>
| customerkey of the metadata |
-
+
-### Asset.findSubType(templateDir, templateName) ⇒ Promise.<TYPE.AssetSubType>
-check template directory for complex types that open subfolders for their subtypes
+### Mcdev.fixKeys(businessUnit, selectedType, [keys]) ⇒ Promise.<Object.<string, Array.<string>>>
+Updates the key to match the name field
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise.<TYPE.AssetSubType>
- subtype name
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, Array.<string>>>
- key: business unit name, value: list of paused item keys
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| templateName | string
| name of the metadata file |
+| businessUnit | string
| name of BU |
+| selectedType | TYPE.SupportedMetadataTypes
| limit to given metadata types |
+| [keys] | Array.<string>
| customerkey of the metadata |
-
+
-### Asset.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName) ⇒ TYPE.AssetItem
-optional method used for some types to try a different folder structure
+## Asset ⇐ [MetadataType
](#MetadataType)
+FileTransfer MetadataType
-**Kind**: static method of [Asset
](#Asset)
-**Returns**: TYPE.AssetItem
- metadata
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
-| Param | Type | Description |
-| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| typeDirArr | Array.<string>
| current subdir for this type |
-| templateName | string
| name of the metadata template |
-| fileName | string
| name of the metadata template file w/o extension |
+* [Asset](#Asset) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, _, [subTypeArr], [key])](#Asset.retrieve) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+ * [.retrieveForCache([_], [subTypeArr])](#Asset.retrieveForCache) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables, [selectedSubType])](#Asset.retrieveAsTemplate) ⇒ Promise.<{metadata: TYPE.AssetItem, type: string}>
+ * [.create(metadata)](#Asset.create) ⇒ Promise
+ * [.update(metadata)](#Asset.update) ⇒ Promise
+ * [.requestSubType(subType, [retrieveDir], [templateName], [templateVariables], key)](#Asset.requestSubType) ⇒ Promise
+ * [.requestAndSaveExtended(items, subType, retrieveDir, [templateVariables])](#Asset.requestAndSaveExtended) ⇒ Promise
+ * [._retrieveExtendedFile(metadata, subType, retrieveDir)](#Asset._retrieveExtendedFile) ⇒ Promise.<void>
+ * [._readExtendedFileFromFS(metadata, subType, deployDir, [pathOnly])](#Asset._readExtendedFileFromFS) ⇒ Promise.<string>
+ * [.postRetrieveTasks(metadata)](#Asset.postRetrieveTasks) ⇒ TYPE.CodeExtractItem
+ * [.postDeployTasks(metadata, _, createdUpdated)](#Asset.postDeployTasks) ⇒ Promise.<void>
+ * [.preDeployTasks(metadata, deployDir)](#Asset.preDeployTasks) ⇒ Promise.<TYPE.AssetItem>
+ * [._getMainSubtype(extendedSubType)](#Asset._getMainSubtype) ⇒ string
+ * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Asset.buildDefinitionForNested) ⇒ Promise.<void>
+ * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Asset.buildTemplateForNested) ⇒ Promise.<void>
+ * [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#Asset._buildForNested) ⇒ Promise.<void>
+ * [.setFolderPath(metadata)](#Asset.setFolderPath)
+ * [.setFolderId(metadata)](#Asset.setFolderId)
+ * [._mergeCode(metadata, deployDir, subType, [templateName], [fileListOnly])](#Asset._mergeCode) ⇒ Promise.<Array.<TYPE.CodeExtract>>
+ * [._mergeCode_slots(prefix, metadataSlots, readDirArr, subtypeExtension, subDirArr, fileList, customerKey, [templateName], [fileListOnly])](#Asset._mergeCode_slots) ⇒ Promise.<void>
+ * [._extractCode(metadata)](#Asset._extractCode) ⇒ TYPE.CodeExtractItem
+ * [._extractCode_slots(prefix, metadataSlots, codeArr)](#Asset._extractCode_slots) ⇒ void
+ * [.getJsonFromFS(dir, [_], selectedSubType)](#Asset.getJsonFromFS) ⇒ TYPE.MetadataTypeMap
+ * [.findSubType(templateDir, templateName)](#Asset.findSubType) ⇒ Promise.<TYPE.AssetSubType>
+ * [.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName)](#Asset.readSecondaryFolder) ⇒ TYPE.AssetItem
+ * [.getFilesToCommit(keyArr)](#Asset.getFilesToCommit) ⇒ Array.<string>
+ * [.deleteByKey(customerKey)](#Asset.deleteByKey) ⇒ Promise.<boolean>
+ * [.postDeleteTasks(customerKey)](#Asset.postDeleteTasks) ⇒ void
+ * [.resolveId(id)](#Asset.resolveId) ⇒ Promise.<{key:string, name:string, path:string}>
+ * [.retrieve(retrieveDir, _, [subTypeArr], [key])](#Asset.retrieve) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+ * [.retrieveForCache([_], [subTypeArr])](#Asset.retrieveForCache) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables, [selectedSubType])](#Asset.retrieveAsTemplate) ⇒ Promise.<{metadata: TYPE.AssetItem, type: string}>
+ * [.create(metadata)](#Asset.create) ⇒ Promise
+ * [.update(metadata)](#Asset.update) ⇒ Promise
+ * [.requestSubType(subType, [retrieveDir], [templateName], [templateVariables], key)](#Asset.requestSubType) ⇒ Promise
+ * [.requestAndSaveExtended(items, subType, retrieveDir, [templateVariables])](#Asset.requestAndSaveExtended) ⇒ Promise
+ * [._retrieveExtendedFile(metadata, subType, retrieveDir)](#Asset._retrieveExtendedFile) ⇒ Promise.<void>
+ * [._readExtendedFileFromFS(metadata, subType, deployDir, [pathOnly])](#Asset._readExtendedFileFromFS) ⇒ Promise.<string>
+ * [.postRetrieveTasks(metadata)](#Asset.postRetrieveTasks) ⇒ TYPE.CodeExtractItem
+ * [.postDeployTasks(metadata, _, createdUpdated)](#Asset.postDeployTasks) ⇒ Promise.<void>
+ * [.preDeployTasks(metadata, deployDir)](#Asset.preDeployTasks) ⇒ Promise.<TYPE.AssetItem>
+ * [._getMainSubtype(extendedSubType)](#Asset._getMainSubtype) ⇒ string
+ * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Asset.buildDefinitionForNested) ⇒ Promise.<void>
+ * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Asset.buildTemplateForNested) ⇒ Promise.<void>
+ * [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#Asset._buildForNested) ⇒ Promise.<void>
+ * [.setFolderPath(metadata)](#Asset.setFolderPath)
+ * [.setFolderId(metadata)](#Asset.setFolderId)
+ * [._mergeCode(metadata, deployDir, subType, [templateName], [fileListOnly])](#Asset._mergeCode) ⇒ Promise.<Array.<TYPE.CodeExtract>>
+ * [._mergeCode_slots(prefix, metadataSlots, readDirArr, subtypeExtension, subDirArr, fileList, customerKey, [templateName], [fileListOnly])](#Asset._mergeCode_slots) ⇒ Promise.<void>
+ * [._extractCode(metadata)](#Asset._extractCode) ⇒ TYPE.CodeExtractItem
+ * [._extractCode_slots(prefix, metadataSlots, codeArr)](#Asset._extractCode_slots) ⇒ void
+ * [.getJsonFromFS(dir, [_], selectedSubType)](#Asset.getJsonFromFS) ⇒ TYPE.MetadataTypeMap
+ * [.findSubType(templateDir, templateName)](#Asset.findSubType) ⇒ Promise.<TYPE.AssetSubType>
+ * [.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName)](#Asset.readSecondaryFolder) ⇒ TYPE.AssetItem
+ * [.getFilesToCommit(keyArr)](#Asset.getFilesToCommit) ⇒ Array.<string>
+ * [.deleteByKey(customerKey)](#Asset.deleteByKey) ⇒ Promise.<boolean>
+ * [.postDeleteTasks(customerKey)](#Asset.postDeleteTasks) ⇒ void
+ * [.resolveId(id)](#Asset.resolveId) ⇒ Promise.<{key:string, name:string, path:string}>
-
+
-### Asset.getFilesToCommit(keyArr) ⇒ Array.<string>
-should return only the json for all but asset, query and script that are saved as multiple files
-additionally, the documentation for dataExtension and automation should be returned
+### Asset.retrieve(retrieveDir, _, [subTypeArr], [key]) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+Retrieves Metadata of Asset
**Kind**: static method of [Asset
](#Asset)
-**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+**Returns**: Promise.<{metadata: TYPE.AssetMap, type: string}>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| keyArr | Array.<string>
| customerkey of the metadata |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| _ | void
| - |
+| [subTypeArr] | Array.<TYPE.AssetSubType>
| optionally limit to a single subtype |
+| [key] | string
| customer key |
-
+
-### Asset.deleteByKey(customerKey) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
+### Asset.retrieveForCache([_], [subTypeArr]) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+Retrieves asset metadata for caching
**Kind**: static method of [Asset
](#Asset)
-**Returns**: Promise.<boolean>
- deletion success flag
+**Returns**: Promise.<{metadata: TYPE.AssetMap, type: string}>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of data extension |
+| [_] | void
| parameter not used |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
-
+
-### Asset.postDeleteTasks(customerKey) ⇒ void
-clean up after deleting a metadata item
-cannot use the generic method due to the complexity of how assets are saved to disk
+### Asset.retrieveAsTemplate(templateDir, name, templateVariables, [selectedSubType]) ⇒ Promise.<{metadata: TYPE.AssetItem, type: string}>
+Retrieves asset metadata for templating
**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{metadata: TYPE.AssetItem, type: string}>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of metadata item |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| name | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| [selectedSubType] | TYPE.AssetSubType
| optionally limit to a single subtype |
-
+
-## AttributeGroup ⇐ [MetadataType
](#MetadataType)
-AttributeGroup MetadataType
+### Asset.create(metadata) ⇒ Promise
+Creates a single asset
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
-* [AttributeGroup](#AttributeGroup) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#AttributeGroup.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache()](#AttributeGroup.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.postRetrieveTasks(metadata)](#AttributeGroup.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.AssetItem
| a single asset |
-
+
-### AttributeGroup.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of schema attribute groups.
+### Asset.update(metadata) ⇒ Promise
+Updates a single asset
-**Kind**: static method of [AttributeGroup
](#AttributeGroup)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
-
-
-
-### AttributeGroup.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of schema attribute groups for caching.
+| metadata | TYPE.AssetItem
| a single asset |
-**Kind**: static method of [AttributeGroup
](#AttributeGroup)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
-
+
-### AttributeGroup.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
-manages post retrieve steps
+### Asset.requestSubType(subType, [retrieveDir], [templateName], [templateVariables], key) ⇒ Promise
+Retrieves Metadata of a specific asset type
-**Kind**: static method of [AttributeGroup
](#AttributeGroup)
-**Returns**: TYPE.MetadataTypeItem
- metadata
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single metadata |
+| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
+| [retrieveDir] | string
| target directory for saving assets |
+| [templateName] | string
| name of the metadata file |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| key | string
| customer key to filter by |
-
+
-## AttributeSet ⇐ [MetadataType
](#MetadataType)
-AttributeSet MetadataType
+### Asset.requestAndSaveExtended(items, subType, retrieveDir, [templateVariables]) ⇒ Promise
+Retrieves extended metadata (files or extended content) of asset
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
-* [AttributeSet](#AttributeSet) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#AttributeSet.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache()](#AttributeSet.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.fixShared_retrieve(sharedDataExtensionMap, fixShared_fields)](#AttributeSet.fixShared_retrieve) ⇒ Promise.<Array.<string>>
- * [.parseResponseBody(body, [singleRetrieve])](#AttributeSet.parseResponseBody) ⇒ TYPE.MetadataTypeMap
- * [.postRetrieveTasks(metadata)](#AttributeSet.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
- * [._getSystemValueDefinitions()](#AttributeSet._getSystemValueDefinitions) ⇒ Array.<object>
+| Param | Type | Description |
+| --- | --- | --- |
+| items | Array
| array of items to retrieve |
+| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
+| retrieveDir | string
| target directory for saving assets |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### AttributeSet.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of schema set Definitions.
+### Asset.\_retrieveExtendedFile(metadata, subType, retrieveDir) ⇒ Promise.<void>
+Some metadata types store their actual content as a separate file, e.g. images
+This method retrieves these and saves them alongside the metadata json
-**Kind**: static method of [AttributeSet
](#AttributeSet)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
-
-
-
-### AttributeSet.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of schema set definitions for caching.
+| metadata | TYPE.AssetItem
| a single asset |
+| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
+| retrieveDir | string
| target directory for saving assets |
-**Kind**: static method of [AttributeSet
](#AttributeSet)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
-
+
-### AttributeSet.fixShared\_retrieve(sharedDataExtensionMap, fixShared_fields) ⇒ Promise.<Array.<string>>
-used to identify updated shared data extensions that are used in attributeSets.
-helper for DataExtension.#fixShared_onBU
+### Asset.\_readExtendedFileFromFS(metadata, subType, deployDir, [pathOnly]) ⇒ Promise.<string>
+helper for [preDeployTasks](#Asset.preDeployTasks)
+Some metadata types store their actual content as a separate file, e.g. images
+This method reads these from the local FS stores them in the metadata object allowing to deploy it
-**Kind**: static method of [AttributeSet
](#AttributeSet)
-**Returns**: Promise.<Array.<string>>
- Promise of list of shared dataExtension IDs
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<string>
- if found will return the path of the binary file
-| Param | Type | Description |
-| --- | --- | --- |
-| sharedDataExtensionMap | Object.<string, string>
| ID-Key relationship of shared data extensions |
-| fixShared_fields | object
| DataExtensionField.fixShared_fields |
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| metadata | TYPE.AssetItem
| | a single asset |
+| subType | TYPE.AssetSubType
| | group of similar assets to put in a folder (ie. images) |
+| deployDir | string
| | directory of deploy files |
+| [pathOnly] | boolean
| false
| used by getFilesToCommit which does not need the binary file to be actually read |
-
+
-### AttributeSet.parseResponseBody(body, [singleRetrieve]) ⇒ TYPE.MetadataTypeMap
-Builds map of metadata entries mapped to their keyfields
+### Asset.postRetrieveTasks(metadata) ⇒ TYPE.CodeExtractItem
+manages post retrieve steps
-**Kind**: static method of [AttributeSet
](#AttributeSet)
-**Returns**: TYPE.MetadataTypeMap
- keyField => metadata map
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.CodeExtractItem
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| body | object
| json of response body |
-| [singleRetrieve] | string
\| number
| key of single item to filter by |
+| metadata | TYPE.AssetItem
| a single asset |
-
+
-### AttributeSet.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
-manages post retrieve steps
+### Asset.postDeployTasks(metadata, _, createdUpdated) ⇒ Promise.<void>
+Gets executed after deployment of metadata type
-**Kind**: static method of [AttributeSet
](#AttributeSet)
-**Returns**: TYPE.MetadataTypeItem
- metadata
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single metadata |
+| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| _ | TYPE.MetadataTypeMap
| originalMetadata to be updated (contains additioanl fields) |
+| createdUpdated | Object
| counter representing successful creates/updates |
-
-
-### AttributeSet.\_getSystemValueDefinitions() ⇒ Array.<object>
-helper for [postRetrieveTasks](#AttributeSet.postRetrieveTasks)
-
-**Kind**: static method of [AttributeSet
](#AttributeSet)
-**Returns**: Array.<object>
- all system value definitions
-
+
-## Automation ⇐ [MetadataType
](#MetadataType)
-Automation MetadataType
+### Asset.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.AssetItem>
+prepares an asset definition for deployment
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<TYPE.AssetItem>
- Promise
-* [Automation](#Automation) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#Automation.retrieve) ⇒ Promise.<TYPE.AutomationMapObj>
- * [.handleRESTErrors(ex, id)](#Automation.handleRESTErrors) ⇒ null
- * [.retrieveChangelog()](#Automation.retrieveChangelog) ⇒ Promise.<TYPE.AutomationMapObj>
- * [.retrieveForCache()](#Automation.retrieveForCache) ⇒ Promise.<TYPE.AutomationMapObj>
- * [.retrieveAsTemplate(templateDir, name, templateVariables)](#Automation.retrieveAsTemplate) ⇒ Promise.<TYPE.AutomationItemObj>
- * [.postRetrieveTasks(metadata)](#Automation.postRetrieveTasks) ⇒ TYPE.AutomationItem
\| void
- * [.execute(keyArr)](#Automation.execute) ⇒ Promise.<Array.<string>>
- * [.getErrorsREST(ex)](#Automation.getErrorsREST) ⇒ Array.<string>
\| void
- * [.pause(keyArr)](#Automation.pause) ⇒ Promise.<Array.<string>>
- * [.deploy(metadata, targetBU, retrieveDir)](#Automation.deploy) ⇒ Promise.<TYPE.AutomationMap>
- * [.create(metadata)](#Automation.create) ⇒ Promise
- * [.update(metadata, metadataBefore)](#Automation.update) ⇒ Promise
- * [.preDeployTasks(metadata)](#Automation.preDeployTasks) ⇒ Promise.<TYPE.AutomationItem>
- * [.validateDeployMetadata(metadata)](#Automation.validateDeployMetadata) ⇒ boolean
- * [.postDeployTasks(metadataMap, originalMetadataMap)](#Automation.postDeployTasks) ⇒ Promise.<void>
- * [.setFolderPath(metadata)](#Automation.setFolderPath)
- * [.setFolderId(metadata)](#Automation.setFolderId)
- * [._buildSchedule(scheduleObject)](#Automation._buildSchedule) ⇒ TYPE.AutomationScheduleSoap
- * [._calcTime(offsetServer, dateInput, [offsetInput])](#Automation._calcTime) ⇒ string
- * [.document([metadata])](#Automation.document) ⇒ Promise.<void>
- * [.getFilesToCommit(keyArr)](#Automation.getFilesToCommit) ⇒ Array.<string>
- * [.deleteByKey(customerKey)](#Automation.deleteByKey) ⇒ boolean
- * [.postDeleteTasks(customerKey)](#Automation.postDeleteTasks) ⇒ void
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.AssetItem
| a single asset |
+| deployDir | string
| directory of deploy files |
-
+
-### Automation.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.AutomationMapObj>
-Retrieves Metadata of Automation
+### Asset.\_getMainSubtype(extendedSubType) ⇒ string
+find the subType matching the extendedSubType
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Promise.<TYPE.AutomationMapObj>
- Promise of metadata
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: string
- subType: block, message, other, etc
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| extendedSubType | string
| webpage, htmlblock, etc |
-
+
-### Automation.handleRESTErrors(ex, id) ⇒ null
-helper for [this.retrieveRESTcollection](this.retrieveRESTcollection)
+### Asset.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<void>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: null
- -
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| ex | Error
| exception |
-| id | string
| id or key of item |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
| Directory where built definitions will be saved |
+| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
-
+
-### Automation.retrieveChangelog() ⇒ Promise.<TYPE.AutomationMapObj>
-Retrieves Metadata of Automation
+### Asset.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<void>
+helper for [buildTemplate](#MetadataType.buildTemplate)
+handles extracted code if any are found for complex types
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Promise.<TYPE.AutomationMapObj>
- Promise of metadata
-
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
-### Automation.retrieveForCache() ⇒ Promise.<TYPE.AutomationMapObj>
-Retrieves automation metadata for caching
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Promise.<TYPE.AutomationMapObj>
- Promise of metadata
-
+**Example**
+```js
+assets of type codesnippetblock will result in 1 json and 1 amp/html file. both files need to be run through templating
+```
+
-### Automation.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<TYPE.AutomationItemObj>
-Retrieve a specific Automation Definition by Name
+### Asset.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ Promise.<void>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Promise.<TYPE.AutomationItemObj>
- Promise of metadata
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where retrieved metadata directory will be saved |
-| name | string
| name of the metadata file |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
| Directory where built definitions will be saved |
+| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+| mode | 'definition'
\| 'template'
| defines what we use this helper for |
-
+
-### Automation.postRetrieveTasks(metadata) ⇒ TYPE.AutomationItem
\| void
-manages post retrieve steps
+### Asset.setFolderPath(metadata)
+generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: TYPE.AutomationItem
\| void
- parsed item
+**Kind**: static method of [Asset
](#Asset)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.AutomationItem
| a single automation |
+| metadata | TYPE.MetadataTypeItem
| a single script activity definition |
-
+
-### Automation.execute(keyArr) ⇒ Promise.<Array.<string>>
-a function to start query execution via API
+### Asset.setFolderId(metadata)
+Asset-specific script that retrieves the folder ID from cache and updates the given metadata with it before deploy
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Promise.<Array.<string>>
- Returns list of keys that were executed
+**Kind**: static method of [Asset
](#Asset)
| Param | Type | Description |
| --- | --- | --- |
-| keyArr | Array.<string>
| customerkey of the metadata |
+| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-### Automation.getErrorsREST(ex) ⇒ Array.<string>
\| void
-Standardizes a check for multiple messages but adds query specific filters to error texts
+### Asset.\_mergeCode(metadata, deployDir, subType, [templateName], [fileListOnly]) ⇒ Promise.<Array.<TYPE.CodeExtract>>
+helper for [preDeployTasks](#Asset.preDeployTasks) that loads extracted code content back into JSON
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Array.<string>
\| void
- formatted Error Message
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<Array.<TYPE.CodeExtract>>
- fileList for templating (disregarded during deployment)
-| Param | Type | Description |
-| --- | --- | --- |
-| ex | object
| response payload from REST API |
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| metadata | TYPE.AssetItem
| | a single asset definition |
+| deployDir | string
| | directory of deploy files |
+| subType | TYPE.AssetSubType
| | asset-subtype name |
+| [templateName] | string
| | name of the template used to built defintion (prior applying templating) |
+| [fileListOnly] | boolean
| false
| does not read file contents nor update metadata if true |
-
+
-### Automation.pause(keyArr) ⇒ Promise.<Array.<string>>
-a function to start query execution via API
+### Asset.\_mergeCode\_slots(prefix, metadataSlots, readDirArr, subtypeExtension, subDirArr, fileList, customerKey, [templateName], [fileListOnly]) ⇒ Promise.<void>
+helper for [preDeployTasks](#Asset.preDeployTasks) that loads extracted code content back into JSON
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Promise.<Array.<string>>
- Returns list of keys that were paused
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
-| Param | Type | Description |
-| --- | --- | --- |
-| keyArr | Array.<string>
| customerkey of the metadata |
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| prefix | string
| | usually the customerkey |
+| metadataSlots | object
| | metadata.views.html.slots or deeper slots.<>.blocks.<>.slots |
+| readDirArr | Array.<string>
| | directory of deploy files |
+| subtypeExtension | string
| | asset-subtype name ending on -meta |
+| subDirArr | Array.<string>
| | directory of files w/o leading deploy dir |
+| fileList | Array.<object>
| | directory of files w/o leading deploy dir |
+| customerKey | string
| | external key of template (could have been changed if used during templating) |
+| [templateName] | string
| | name of the template used to built defintion (prior applying templating) |
+| [fileListOnly] | boolean
| false
| does not read file contents nor update metadata if true |
-
+
-### Automation.deploy(metadata, targetBU, retrieveDir) ⇒ Promise.<TYPE.AutomationMap>
-Deploys automation - the saved file is the original one due to large differences required for deployment
+### Asset.\_extractCode(metadata) ⇒ TYPE.CodeExtractItem
+helper for [postRetrieveTasks](#Asset.postRetrieveTasks) that finds code content in JSON and extracts it
+to allow saving that separately and formatted
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Promise.<TYPE.AutomationMap>
- Promise
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.CodeExtractItem
- { json: metadata, codeArr: object[], subFolder: string[] }
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.AutomationMap
| metadata mapped by their keyField |
-| targetBU | string
| name/shorthand of target businessUnit for mapping |
-| retrieveDir | string
| directory where metadata after deploy should be saved |
-
-
+| metadata | TYPE.AssetItem
| a single asset definition |
-### Automation.create(metadata) ⇒ Promise
-Creates a single automation
+
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Promise
- Promise
+### Asset.\_extractCode\_slots(prefix, metadataSlots, codeArr) ⇒ void
+**Kind**: static method of [Asset
](#Asset)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.AutomationItem
| single metadata entry |
+| prefix | string
| usually the customerkey |
+| metadataSlots | object
| metadata.views.html.slots or deeper slots.<>.blocks.<>.slots |
+| codeArr | Array.<object>
| to be extended array for extracted code |
-
+
-### Automation.update(metadata, metadataBefore) ⇒ Promise
-Updates a single automation
+### Asset.getJsonFromFS(dir, [_], selectedSubType) ⇒ TYPE.MetadataTypeMap
+Returns file contents mapped to their fileName without '.json' ending
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Promise
- Promise
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.MetadataTypeMap
- fileName => fileContent map
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.AutomationItem
| single metadata entry |
-| metadataBefore | TYPE.AutomationItem
| metadata mapped by their keyField |
+| dir | string
| directory that contains '.json' files to be read |
+| [_] | void
| unused parameter |
+| selectedSubType | Array.<string>
| asset, message, ... |
-
+
-### Automation.preDeployTasks(metadata) ⇒ Promise.<TYPE.AutomationItem>
-Gets executed before deploying metadata
+### Asset.findSubType(templateDir, templateName) ⇒ Promise.<TYPE.AssetSubType>
+check template directory for complex types that open subfolders for their subtypes
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Promise.<TYPE.AutomationItem>
- Promise
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<TYPE.AssetSubType>
- subtype name
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.AutomationItem
| metadata mapped by their keyField |
+| templateDir | string
| Directory where metadata templates are stored |
+| templateName | string
| name of the metadata file |
-
+
-### Automation.validateDeployMetadata(metadata) ⇒ boolean
-Validates the automation to be sure it can be deployed.
-Whitelisted Activites are deployed but require configuration
+### Asset.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName) ⇒ TYPE.AssetItem
+optional method used for some types to try a different folder structure
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: boolean
- result if automation can be deployed based on steps
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.AssetItem
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.AutomationItem
| single automation record |
+| templateDir | string
| Directory where metadata templates are stored |
+| typeDirArr | Array.<string>
| current subdir for this type |
+| templateName | string
| name of the metadata template |
+| fileName | string
| name of the metadata template file w/o extension |
-
+
-### Automation.postDeployTasks(metadataMap, originalMetadataMap) ⇒ Promise.<void>
-Gets executed after deployment of metadata type
+### Asset.getFilesToCommit(keyArr) ⇒ Array.<string>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Promise.<void>
- -
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
| Param | Type | Description |
| --- | --- | --- |
-| metadataMap | TYPE.AutomationMap
| metadata mapped by their keyField |
-| originalMetadataMap | TYPE.AutomationMap
| metadata to be updated (contains additioanl fields) |
+| keyArr | Array.<string>
| customerkey of the metadata |
-
+
-### Automation.setFolderPath(metadata)
-generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
+### Asset.deleteByKey(customerKey) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
-**Kind**: static method of [Automation
](#Automation)
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<boolean>
- deletion success flag
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single script activity definition |
+| customerKey | string
| Identifier of data extension |
-
+
-### Automation.setFolderId(metadata)
-automation-specific script that retrieves the folder ID from cache and updates the given metadata with it before deploy
+### Asset.postDeleteTasks(customerKey) ⇒ void
+clean up after deleting a metadata item
+cannot use the generic method due to the complexity of how assets are saved to disk
-**Kind**: static method of [Automation
](#Automation)
+**Kind**: static method of [Asset
](#Asset)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| customerKey | string
| Identifier of metadata item |
-
+
-### Automation.\_buildSchedule(scheduleObject) ⇒ TYPE.AutomationScheduleSoap
-Builds a schedule object to be used for scheduling an automation
-based on combination of ical string and start/end dates.
+### Asset.resolveId(id) ⇒ Promise.<{key:string, name:string, path:string}>
+get name & key for provided id
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: TYPE.AutomationScheduleSoap
- Schedulable object for soap API (currently not rest supported)
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{key:string, name:string, path:string}>
- key, name and path of metadata; null if not found
| Param | Type | Description |
| --- | --- | --- |
-| scheduleObject | TYPE.AutomationSchedule
| child of automation metadata used for scheduling |
+| id | string
| Identifier of metadata |
-
+
-### Automation.\_calcTime(offsetServer, dateInput, [offsetInput]) ⇒ string
-used to convert dates to the system timezone required for startDate
+### Asset.retrieve(retrieveDir, _, [subTypeArr], [key]) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+Retrieves Metadata of Asset
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: string
- date in server
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{metadata: TYPE.AssetMap, type: string}>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| offsetServer | number
| stack4: US Mountain time (UTC-7); other stacks: US Central (UTC-6) |
-| dateInput | string
\| Date
| date in ISO format (2021-12-05T20:00:00.983) |
-| [offsetInput] | string
| timzone difference (+02:00) |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| _ | void
| - |
+| [subTypeArr] | Array.<TYPE.AssetSubType>
| optionally limit to a single subtype |
+| [key] | string
| customer key |
-
+
-### Automation.document([metadata]) ⇒ Promise.<void>
-Parses metadata into a readable Markdown/HTML format then saves it
+### Asset.retrieveForCache([_], [subTypeArr]) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+Retrieves asset metadata for caching
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Promise.<void>
- -
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{metadata: TYPE.AssetMap, type: string}>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| [metadata] | TYPE.AutomationMap
| a list of dataExtension definitions |
+| [_] | void
| parameter not used |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
-
+
-### Automation.getFilesToCommit(keyArr) ⇒ Array.<string>
-should return only the json for all but asset, query and script that are saved as multiple files
-additionally, the documentation for dataExtension and automation should be returned
+### Asset.retrieveAsTemplate(templateDir, name, templateVariables, [selectedSubType]) ⇒ Promise.<{metadata: TYPE.AssetItem, type: string}>
+Retrieves asset metadata for templating
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{metadata: TYPE.AssetItem, type: string}>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| keyArr | Array.<string>
| customerkey of the metadata |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| name | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| [selectedSubType] | TYPE.AssetSubType
| optionally limit to a single subtype |
-
+
-### Automation.deleteByKey(customerKey) ⇒ boolean
-Delete a metadata item from the specified business unit
+### Asset.create(metadata) ⇒ Promise
+Creates a single asset
-**Kind**: static method of [Automation
](#Automation)
-**Returns**: boolean
- deletion success status
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of data extension |
+| metadata | TYPE.AssetItem
| a single asset |
-
+
-### Automation.postDeleteTasks(customerKey) ⇒ void
-clean up after deleting a metadata item
+### Asset.update(metadata) ⇒ Promise
+Updates a single asset
-**Kind**: static method of [Automation
](#Automation)
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of metadata item |
+| metadata | TYPE.AssetItem
| a single asset |
-
+
-## Campaign ⇐ [MetadataType
](#MetadataType)
-Campaign MetadataType
+### Asset.requestSubType(subType, [retrieveDir], [templateName], [templateVariables], key) ⇒ Promise
+Retrieves Metadata of a specific asset type
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
-* [Campaign](#Campaign) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#Campaign.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache()](#Campaign.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.getAssetTags(retrieveDir, campaignId, name)](#Campaign.getAssetTags) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+| Param | Type | Description |
+| --- | --- | --- |
+| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
+| [retrieveDir] | string
| target directory for saving assets |
+| [templateName] | string
| name of the metadata file |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| key | string
| customer key to filter by |
-
+
-### Campaign.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of campaigns. Afterwards, starts metadata retrieval for their campaign assets
+### Asset.requestAndSaveExtended(items, subType, retrieveDir, [templateVariables]) ⇒ Promise
+Retrieves extended metadata (files or extended content) of asset
-**Kind**: static method of [Campaign
](#Campaign)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
-
-
-
-### Campaign.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves event definition metadata for caching
+| items | Array
| array of items to retrieve |
+| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
+| retrieveDir | string
| target directory for saving assets |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
-**Kind**: static method of [Campaign
](#Campaign)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
-
+
-### Campaign.getAssetTags(retrieveDir, campaignId, name) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Parses campaign asset response body and returns metadata entries mapped to their id
+### Asset.\_retrieveExtendedFile(metadata, subType, retrieveDir) ⇒ Promise.<void>
+Some metadata types store their actual content as a separate file, e.g. images
+This method retrieves these and saves them alongside the metadata json
-**Kind**: static method of [Campaign
](#Campaign)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Campaign Asset Object
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| folder where to save |
-| campaignId | string
| of camapaign to retrieve |
-| name | string
| of camapaign for saving |
+| metadata | TYPE.AssetItem
| a single asset |
+| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
+| retrieveDir | string
| target directory for saving assets |
-
+
-## ContentArea ⇐ [MetadataType
](#MetadataType)
-ContentArea MetadataType
+### Asset.\_readExtendedFileFromFS(metadata, subType, deployDir, [pathOnly]) ⇒ Promise.<string>
+helper for [preDeployTasks](#Asset.preDeployTasks)
+Some metadata types store their actual content as a separate file, e.g. images
+This method reads these from the local FS stores them in the metadata object allowing to deploy it
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<string>
- if found will return the path of the binary file
-* [ContentArea](#ContentArea) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#ContentArea.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.setFolderPath(metadata)](#ContentArea.setFolderPath)
- * [.postRetrieveTasks(metadata)](#ContentArea.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| metadata | TYPE.AssetItem
| | a single asset |
+| subType | TYPE.AssetSubType
| | group of similar assets to put in a folder (ie. images) |
+| deployDir | string
| | directory of deploy files |
+| [pathOnly] | boolean
| false
| used by getFilesToCommit which does not need the binary file to be actually read |
-
+
-### ContentArea.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+### Asset.postRetrieveTasks(metadata) ⇒ TYPE.CodeExtractItem
+manages post retrieve steps
-**Kind**: static method of [ContentArea
](#ContentArea)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.CodeExtractItem
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| metadata | TYPE.AssetItem
| a single asset |
-
+
-### ContentArea.setFolderPath(metadata)
-generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
+### Asset.postDeployTasks(metadata, _, createdUpdated) ⇒ Promise.<void>
+Gets executed after deployment of metadata type
-**Kind**: static method of [ContentArea
](#ContentArea)
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single script activity definition |
+| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| _ | TYPE.MetadataTypeMap
| originalMetadata to be updated (contains additioanl fields) |
+| createdUpdated | Object
| counter representing successful creates/updates |
-
+
-### ContentArea.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
-parses retrieved Metadata before saving
+### Asset.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.AssetItem>
+prepares an asset definition for deployment
-**Kind**: static method of [ContentArea
](#ContentArea)
-**Returns**: TYPE.MetadataTypeItem
- parsed item
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<TYPE.AssetItem>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| metadata | TYPE.AssetItem
| a single asset |
+| deployDir | string
| directory of deploy files |
-
+
-## DataExtension ⇐ [MetadataType
](#MetadataType)
-DataExtension MetadataType
+### Asset.\_getMainSubtype(extendedSubType) ⇒ string
+find the subType matching the extendedSubType
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: string
- subType: block, message, other, etc
-* [DataExtension](#DataExtension) ⇐ [MetadataType
](#MetadataType)
- * [.upsert(metadataMap)](#DataExtension.upsert) ⇒ Promise
- * [.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate)](#DataExtension.createOrUpdate) ⇒ 'create'
\| 'update'
\| 'skip'
- * [.create(metadata)](#DataExtension.create) ⇒ Promise
- * [.update(metadata)](#DataExtension.update) ⇒ Promise
- * [.postDeployTasks(upsertedMetadata, originalMetadata, createdUpdated)](#DataExtension.postDeployTasks) ⇒ void
- * [.retrieve(retrieveDir, [additionalFields], [_], [key])](#DataExtension.retrieve) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
- * [.retrieveSharedForCache([additionalFields])](#DataExtension.retrieveSharedForCache) ⇒ Promise.<TYPE.DataExtensionMap>
- * [.retrieveChangelog([additionalFields])](#DataExtension.retrieveChangelog) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
- * [.postRetrieveTasks(metadata)](#DataExtension.postRetrieveTasks) ⇒ TYPE.DataExtensionItem
- * [.preDeployTasks(metadata)](#DataExtension.preDeployTasks) ⇒ Promise.<TYPE.DataExtensionItem>
- * [.document([metadataMap])](#DataExtension.document) ⇒ Promise.<void>
- * [.deleteByKey(customerKey)](#DataExtension.deleteByKey) ⇒ Promise.<boolean>
- * [.postDeleteTasks(customerKey)](#DataExtension.postDeleteTasks) ⇒ Promise.<void>
- * [.retrieveForCache()](#DataExtension.retrieveForCache) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
- * [.retrieveAsTemplate(templateDir, name, templateVariables)](#DataExtension.retrieveAsTemplate) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
- * [.setFolderPath(metadata)](#DataExtension.setFolderPath)
- * [.getFilesToCommit(keyArr)](#DataExtension.getFilesToCommit) ⇒ Array.<string>
+| Param | Type | Description |
+| --- | --- | --- |
+| extendedSubType | string
| webpage, htmlblock, etc |
-
+
-### DataExtension.upsert(metadataMap) ⇒ Promise
-Upserts dataExtensions after retrieving them from source and target to compare
-if create or update operation is needed.
+### Asset.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<void>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: Promise
- Promise
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| metadataMap | TYPE.DataExtensionMap
| dataExtensions mapped by their customerKey |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
| Directory where built definitions will be saved |
+| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
-
+
-### DataExtension.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate) ⇒ 'create'
\| 'update'
\| 'skip'
-helper for [upsert](#MetadataType.upsert)
+### Asset.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<void>
+helper for [buildTemplate](#MetadataType.buildTemplate)
+handles extracted code if any are found for complex types
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: 'create'
\| 'update'
\| 'skip'
- action to take
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| metadataMap | TYPE.MetadataTypeMap
| list of metadata |
-| metadataKey | string
| key of item we are looking at |
-| hasError | boolean
| error flag from previous code |
-| metadataToUpdate | Array.<TYPE.MetadataTypeItemDiff>
| list of items to update |
-| metadataToCreate | Array.<TYPE.MetadataTypeItem>
| list of items to create |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
-
+**Example**
+```js
+assets of type codesnippetblock will result in 1 json and 1 amp/html file. both files need to be run through templating
+```
+
-### DataExtension.create(metadata) ⇒ Promise
-Create a single dataExtension. Also creates their columns in 'dataExtension.columns'
+### Asset.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ Promise.<void>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: Promise
- Promise
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.DataExtensionItem
| single metadata entry |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
| Directory where built definitions will be saved |
+| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+| mode | 'definition'
\| 'template'
| defines what we use this helper for |
-
+
-### DataExtension.update(metadata) ⇒ Promise
-Updates a single dataExtension. Also updates their columns in 'dataExtension.columns'
+### Asset.setFolderPath(metadata)
+generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: Promise
- Promise
+**Kind**: static method of [Asset
](#Asset)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.DataExtensionItem
| single metadata entry |
+| metadata | TYPE.MetadataTypeItem
| a single script activity definition |
-
+
-### DataExtension.postDeployTasks(upsertedMetadata, originalMetadata, createdUpdated) ⇒ void
-Gets executed after deployment of metadata type
+### Asset.setFolderId(metadata)
+Asset-specific script that retrieves the folder ID from cache and updates the given metadata with it before deploy
-**Kind**: static method of [DataExtension
](#DataExtension)
+**Kind**: static method of [Asset
](#Asset)
| Param | Type | Description |
| --- | --- | --- |
-| upsertedMetadata | TYPE.DataExtensionMap
| metadata mapped by their keyField |
-| originalMetadata | TYPE.DataExtensionMap
| metadata to be updated (contains additioanl fields) |
-| createdUpdated | Object
| counter representing successful creates/updates |
+| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-### DataExtension.retrieve(retrieveDir, [additionalFields], [_], [key]) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
-Retrieves dataExtension metadata. Afterwards starts retrieval of dataExtensionColumn metadata retrieval
+### Asset.\_mergeCode(metadata, deployDir, subType, [templateName], [fileListOnly]) ⇒ Promise.<Array.<TYPE.CodeExtract>>
+helper for [preDeployTasks](#Asset.preDeployTasks) that loads extracted code content back into JSON
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
- Promise of item map
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<Array.<TYPE.CodeExtract>>
- fileList for templating (disregarded during deployment)
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| metadata | TYPE.AssetItem
| | a single asset definition |
+| deployDir | string
| | directory of deploy files |
+| subType | TYPE.AssetSubType
| | asset-subtype name |
+| [templateName] | string
| | name of the template used to built defintion (prior applying templating) |
+| [fileListOnly] | boolean
| false
| does not read file contents nor update metadata if true |
+
+
+
+### Asset.\_mergeCode\_slots(prefix, metadataSlots, readDirArr, subtypeExtension, subDirArr, fileList, customerKey, [templateName], [fileListOnly]) ⇒ Promise.<void>
+helper for [preDeployTasks](#Asset.preDeployTasks) that loads extracted code content back into JSON
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| prefix | string
| | usually the customerkey |
+| metadataSlots | object
| | metadata.views.html.slots or deeper slots.<>.blocks.<>.slots |
+| readDirArr | Array.<string>
| | directory of deploy files |
+| subtypeExtension | string
| | asset-subtype name ending on -meta |
+| subDirArr | Array.<string>
| | directory of files w/o leading deploy dir |
+| fileList | Array.<object>
| | directory of files w/o leading deploy dir |
+| customerKey | string
| | external key of template (could have been changed if used during templating) |
+| [templateName] | string
| | name of the template used to built defintion (prior applying templating) |
+| [fileListOnly] | boolean
| false
| does not read file contents nor update metadata if true |
+
+
+
+### Asset.\_extractCode(metadata) ⇒ TYPE.CodeExtractItem
+helper for [postRetrieveTasks](#Asset.postRetrieveTasks) that finds code content in JSON and extracts it
+to allow saving that separately and formatted
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.CodeExtractItem
- { json: metadata, codeArr: object[], subFolder: string[] }
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-| [_] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
-
-
+| metadata | TYPE.AssetItem
| a single asset definition |
-### DataExtension.retrieveSharedForCache([additionalFields]) ⇒ Promise.<TYPE.DataExtensionMap>
-get shared dataExtensions from parent BU and merge them into the cache
-helper for [retrieve](#DataExtension.retrieve) and for AttributeSet.fixShared_retrieve
+
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: Promise.<TYPE.DataExtensionMap>
- keyField => metadata map
+### Asset.\_extractCode\_slots(prefix, metadataSlots, codeArr) ⇒ void
+**Kind**: static method of [Asset
](#Asset)
| Param | Type | Description |
| --- | --- | --- |
-| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| prefix | string
| usually the customerkey |
+| metadataSlots | object
| metadata.views.html.slots or deeper slots.<>.blocks.<>.slots |
+| codeArr | Array.<object>
| to be extended array for extracted code |
-
+
-### DataExtension.retrieveChangelog([additionalFields]) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
-Retrieves dataExtension metadata. Afterwards starts retrieval of dataExtensionColumn metadata retrieval
+### Asset.getJsonFromFS(dir, [_], selectedSubType) ⇒ TYPE.MetadataTypeMap
+Returns file contents mapped to their fileName without '.json' ending
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
- Promise of item map
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.MetadataTypeMap
- fileName => fileContent map
| Param | Type | Description |
| --- | --- | --- |
-| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| dir | string
| directory that contains '.json' files to be read |
+| [_] | void
| unused parameter |
+| selectedSubType | Array.<string>
| asset, message, ... |
-
+
-### DataExtension.postRetrieveTasks(metadata) ⇒ TYPE.DataExtensionItem
-manages post retrieve steps
+### Asset.findSubType(templateDir, templateName) ⇒ Promise.<TYPE.AssetSubType>
+check template directory for complex types that open subfolders for their subtypes
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: TYPE.DataExtensionItem
- metadata
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<TYPE.AssetSubType>
- subtype name
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.DataExtensionItem
| a single dataExtension |
+| templateDir | string
| Directory where metadata templates are stored |
+| templateName | string
| name of the metadata file |
-
+
-### DataExtension.preDeployTasks(metadata) ⇒ Promise.<TYPE.DataExtensionItem>
-prepares a DataExtension for deployment
+### Asset.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName) ⇒ TYPE.AssetItem
+optional method used for some types to try a different folder structure
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: Promise.<TYPE.DataExtensionItem>
- Promise of updated single DE
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.AssetItem
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.DataExtensionItem
| a single data Extension |
+| templateDir | string
| Directory where metadata templates are stored |
+| typeDirArr | Array.<string>
| current subdir for this type |
+| templateName | string
| name of the metadata template |
+| fileName | string
| name of the metadata template file w/o extension |
-
+
-### DataExtension.document([metadataMap]) ⇒ Promise.<void>
-Parses metadata into a readable Markdown/HTML format then saves it
+### Asset.getFilesToCommit(keyArr) ⇒ Array.<string>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: Promise.<void>
- -
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
| Param | Type | Description |
| --- | --- | --- |
-| [metadataMap] | TYPE.DataExtensionMap
| a list of dataExtension definitions |
+| keyArr | Array.<string>
| customerkey of the metadata |
-
+
-### DataExtension.deleteByKey(customerKey) ⇒ Promise.<boolean>
+### Asset.deleteByKey(customerKey) ⇒ Promise.<boolean>
Delete a metadata item from the specified business unit
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: Promise.<boolean>
- deletion success status
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<boolean>
- deletion success flag
| Param | Type | Description |
| --- | --- | --- |
| customerKey | string
| Identifier of data extension |
-
+
-### DataExtension.postDeleteTasks(customerKey) ⇒ Promise.<void>
+### Asset.postDeleteTasks(customerKey) ⇒ void
clean up after deleting a metadata item
+cannot use the generic method due to the complexity of how assets are saved to disk
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: Promise.<void>
- - promise
+**Kind**: static method of [Asset
](#Asset)
| Param | Type | Description |
| --- | --- | --- |
| customerKey | string
| Identifier of metadata item |
-
-
-### DataExtension.retrieveForCache() ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
-Retrieves folder metadata into local filesystem. Also creates a uniquePath attribute for each folder.
-
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
- Promise
-
+
-### DataExtension.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
-Retrieves dataExtension metadata in template format.
+### Asset.resolveId(id) ⇒ Promise.<{key:string, name:string, path:string}>
+get name & key for provided id
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
- Promise of items
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{key:string, name:string, path:string}>
- key, name and path of metadata; null if not found
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where retrieved metadata directory will be saved |
-| name | string
| name of the metadata item |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| id | string
| Identifier of metadata |
-
+
-### DataExtension.setFolderPath(metadata)
-dataExtension logic that retrieves the folder path from cache and updates the given metadata with it after retrieve
-it also sets the content type which is basically the subtype
+## AttributeGroup ⇐ [MetadataType
](#MetadataType)
+AttributeGroup MetadataType
-**Kind**: static method of [DataExtension
](#DataExtension)
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
+* [AttributeGroup](#AttributeGroup) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#AttributeGroup.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache()](#AttributeGroup.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.postRetrieveTasks(metadata)](#AttributeGroup.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+
+
+
+### AttributeGroup.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of schema attribute groups.
+
+**Kind**: static method of [AttributeGroup
](#AttributeGroup)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single script activity definition |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### DataExtension.getFilesToCommit(keyArr) ⇒ Array.<string>
-should return only the json for all but asset, query and script that are saved as multiple files
-additionally, the documentation for dataExtension and automation should be returned
+### AttributeGroup.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of schema attribute groups for caching.
-**Kind**: static method of [DataExtension
](#DataExtension)
-**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+**Kind**: static method of [AttributeGroup
](#AttributeGroup)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+
+### AttributeGroup.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
+manages post retrieve steps
+
+**Kind**: static method of [AttributeGroup
](#AttributeGroup)
+**Returns**: TYPE.MetadataTypeItem
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| keyArr | Array.<string>
| customerkey of the metadata |
+| metadata | TYPE.MetadataTypeItem
| a single metadata |
-
+
-## DataExtensionField ⇐ [MetadataType
](#MetadataType)
-DataExtensionField MetadataType
+## AttributeSet ⇐ [MetadataType
](#MetadataType)
+AttributeSet MetadataType
**Kind**: global class
**Extends**: [MetadataType
](#MetadataType)
-* [DataExtensionField](#DataExtensionField) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [additionalFields])](#DataExtensionField.retrieve) ⇒ Promise.<{metadata: TYPE.DataExtensionFieldMap, type: string}>
- * [.retrieveForCache([requestParams], [additionalFields])](#DataExtensionField.retrieveForCache) ⇒ Promise.<{metadata: TYPE.DataExtensionFieldMap, type: string}>
- * [.convertToSortedArray(fieldsObj)](#DataExtensionField.convertToSortedArray) ⇒ Array.<TYPE.DataExtensionFieldItem>
- * [.sortDeFields(a, b)](#DataExtensionField.sortDeFields) ⇒ boolean
- * [.postRetrieveTasks(metadata, forDataExtension)](#DataExtensionField.postRetrieveTasks) ⇒ TYPE.DataExtensionFieldItem
- * [.prepareDeployColumnsOnUpdate(deployColumns, deKey)](#DataExtensionField.prepareDeployColumnsOnUpdate) ⇒ Promise.<Object.<string, TYPE.DataExtensionFieldItem>>
- * [.deleteByKey(customerKey)](#DataExtensionField.deleteByKey) ⇒ Promise.<boolean>
- * [.deleteByKeySOAP(customerKey, [fieldId])](#DataExtensionField.deleteByKeySOAP) ⇒ boolean
- * [.postDeleteTasks(customerKey)](#DataExtensionField.postDeleteTasks) ⇒ void
+* [AttributeSet](#AttributeSet) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#AttributeSet.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache()](#AttributeSet.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.fixShared_retrieve(sharedDataExtensionMap, fixShared_fields)](#AttributeSet.fixShared_retrieve) ⇒ Promise.<Array.<string>>
+ * [.parseResponseBody(body, [singleRetrieve])](#AttributeSet.parseResponseBody) ⇒ TYPE.MetadataTypeMap
+ * [.postRetrieveTasks(metadata)](#AttributeSet.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+ * [._getSystemValueDefinitions()](#AttributeSet._getSystemValueDefinitions) ⇒ Array.<object>
-
+
-### DataExtensionField.retrieve(retrieveDir, [additionalFields]) ⇒ Promise.<{metadata: TYPE.DataExtensionFieldMap, type: string}>
-Retrieves all records and saves it to disk
+### AttributeSet.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of schema set Definitions.
-**Kind**: static method of [DataExtensionField
](#DataExtensionField)
-**Returns**: Promise.<{metadata: TYPE.DataExtensionFieldMap, type: string}>
- Promise of items
+**Kind**: static method of [AttributeSet
](#AttributeSet)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
| Param | Type | Description |
| --- | --- | --- |
| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### DataExtensionField.retrieveForCache([requestParams], [additionalFields]) ⇒ Promise.<{metadata: TYPE.DataExtensionFieldMap, type: string}>
-Retrieves all records for caching
+### AttributeSet.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of schema set definitions for caching.
-**Kind**: static method of [DataExtensionField
](#DataExtensionField)
-**Returns**: Promise.<{metadata: TYPE.DataExtensionFieldMap, type: string}>
- Promise of items
+**Kind**: static method of [AttributeSet
](#AttributeSet)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+
+
+### AttributeSet.fixShared\_retrieve(sharedDataExtensionMap, fixShared_fields) ⇒ Promise.<Array.<string>>
+used to identify updated shared data extensions that are used in attributeSets.
+helper for DataExtension.#fixShared_onBU
+
+**Kind**: static method of [AttributeSet
](#AttributeSet)
+**Returns**: Promise.<Array.<string>>
- Promise of list of shared dataExtension IDs
| Param | Type | Description |
| --- | --- | --- |
-| [requestParams] | TYPE.SoapRequestParams
| required for the specific request (filter for example) |
-| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| sharedDataExtensionMap | Object.<string, string>
| ID-Key relationship of shared data extensions |
+| fixShared_fields | object
| DataExtensionField.fixShared_fields |
-
+
-### DataExtensionField.convertToSortedArray(fieldsObj) ⇒ Array.<TYPE.DataExtensionFieldItem>
-helper for DataExtension.retrieveFieldsForSingleDe that sorts the fields into an array
+### AttributeSet.parseResponseBody(body, [singleRetrieve]) ⇒ TYPE.MetadataTypeMap
+Builds map of metadata entries mapped to their keyfields
-**Kind**: static method of [DataExtensionField
](#DataExtensionField)
-**Returns**: Array.<TYPE.DataExtensionFieldItem>
- sorted array of field objects
+**Kind**: static method of [AttributeSet
](#AttributeSet)
+**Returns**: TYPE.MetadataTypeMap
- keyField => metadata map
| Param | Type | Description |
| --- | --- | --- |
-| fieldsObj | TYPE.DataExtensionFieldMap
| customerKey-based list of fields for one dataExtension |
+| body | object
| json of response body |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
-
+
-### DataExtensionField.sortDeFields(a, b) ⇒ boolean
-sorting method to ensure `Ordinal` is respected
+### AttributeSet.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
+manages post retrieve steps
-**Kind**: static method of [DataExtensionField
](#DataExtensionField)
-**Returns**: boolean
- sorting based on Ordinal
+**Kind**: static method of [AttributeSet
](#AttributeSet)
+**Returns**: TYPE.MetadataTypeItem
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| a | TYPE.DataExtensionFieldItem
| - |
-| b | TYPE.DataExtensionFieldItem
| - |
+| metadata | TYPE.MetadataTypeItem
| a single metadata |
-
+
-### DataExtensionField.postRetrieveTasks(metadata, forDataExtension) ⇒ TYPE.DataExtensionFieldItem
-manages post retrieve steps
+### AttributeSet.\_getSystemValueDefinitions() ⇒ Array.<object>
+helper for [postRetrieveTasks](#AttributeSet.postRetrieveTasks)
-**Kind**: static method of [DataExtensionField
](#DataExtensionField)
-**Returns**: TYPE.DataExtensionFieldItem
- metadata
+**Kind**: static method of [AttributeSet
](#AttributeSet)
+**Returns**: Array.<object>
- all system value definitions
+
-| Param | Type | Description |
-| --- | --- | --- |
-| metadata | TYPE.DataExtensionFieldItem
| a single item |
-| forDataExtension | boolean
| when used by DataExtension class we remove more fields |
+## Automation ⇐ [MetadataType
](#MetadataType)
+Automation MetadataType
-
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
-### DataExtensionField.prepareDeployColumnsOnUpdate(deployColumns, deKey) ⇒ Promise.<Object.<string, TYPE.DataExtensionFieldItem>>
-Mofifies passed deployColumns for update by mapping ObjectID to their target column's values.
-Removes FieldType field if its the same in deploy and target column, because it results in an error even if its of the same type
+* [Automation](#Automation) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#Automation.retrieve) ⇒ Promise.<TYPE.AutomationMapObj>
+ * [.handleRESTErrors(ex, id)](#Automation.handleRESTErrors) ⇒ null
+ * [.retrieveChangelog()](#Automation.retrieveChangelog) ⇒ Promise.<TYPE.AutomationMapObj>
+ * [.retrieveForCache()](#Automation.retrieveForCache) ⇒ Promise.<TYPE.AutomationMapObj>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables)](#Automation.retrieveAsTemplate) ⇒ Promise.<TYPE.AutomationItemObj>
+ * [.postRetrieveTasks(metadata)](#Automation.postRetrieveTasks) ⇒ TYPE.AutomationItem
\| void
+ * [.execute(keyArr)](#Automation.execute) ⇒ Promise.<Array.<string>>
+ * [.getErrorsREST(ex)](#Automation.getErrorsREST) ⇒ Array.<string>
\| void
+ * [.pause(keyArr)](#Automation.pause) ⇒ Promise.<Array.<string>>
+ * [.deploy(metadata, targetBU, retrieveDir)](#Automation.deploy) ⇒ Promise.<TYPE.AutomationMap>
+ * [.create(metadata)](#Automation.create) ⇒ Promise
+ * [.update(metadata, metadataBefore)](#Automation.update) ⇒ Promise
+ * [.preDeployTasks(metadata)](#Automation.preDeployTasks) ⇒ Promise.<TYPE.AutomationItem>
+ * [.validateDeployMetadata(metadata)](#Automation.validateDeployMetadata) ⇒ boolean
+ * [.postDeployTasks(metadataMap, originalMetadataMap)](#Automation.postDeployTasks) ⇒ Promise.<void>
+ * [.setFolderPath(metadata)](#Automation.setFolderPath)
+ * [.setFolderId(metadata)](#Automation.setFolderId)
+ * [._buildSchedule(scheduleObject)](#Automation._buildSchedule) ⇒ TYPE.AutomationScheduleSoap
+ * [._calcTime(offsetServer, dateInput, [offsetInput])](#Automation._calcTime) ⇒ string
+ * [.document([metadata])](#Automation.document) ⇒ Promise.<void>
+ * [.getFilesToCommit(keyArr)](#Automation.getFilesToCommit) ⇒ Array.<string>
+ * [.deleteByKey(customerKey)](#Automation.deleteByKey) ⇒ boolean
+ * [.postDeleteTasks(customerKey)](#Automation.postDeleteTasks) ⇒ void
-**Kind**: static method of [DataExtensionField
](#DataExtensionField)
-**Returns**: Promise.<Object.<string, TYPE.DataExtensionFieldItem>>
- existing fields by their original name to allow re-adding FieldType after update
+
+
+### Automation.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.AutomationMapObj>
+Retrieves Metadata of Automation
+
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: Promise.<TYPE.AutomationMapObj>
- Promise of metadata
| Param | Type | Description |
| --- | --- | --- |
-| deployColumns | Array.<TYPE.DataExtensionFieldItem>
| Columns of data extension that will be deployed |
-| deKey | string
| external/customer key of Data Extension |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### DataExtensionField.deleteByKey(customerKey) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
+### Automation.handleRESTErrors(ex, id) ⇒ null
+helper for [this.retrieveRESTcollection](this.retrieveRESTcollection)
-**Kind**: static method of [DataExtensionField
](#DataExtensionField)
-**Returns**: Promise.<boolean>
- deletion success status
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: null
- -
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of data extension |
+| ex | Error
| exception |
+| id | string
| id or key of item |
-
+
-### DataExtensionField.deleteByKeySOAP(customerKey, [fieldId]) ⇒ boolean
-Delete a data extension from the specified business unit
+### Automation.retrieveChangelog() ⇒ Promise.<TYPE.AutomationMapObj>
+Retrieves Metadata of Automation
-**Kind**: static method of [DataExtensionField
](#DataExtensionField)
-**Returns**: boolean
- deletion success flag
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: Promise.<TYPE.AutomationMapObj>
- Promise of metadata
+
-| Param | Type | Description |
-| --- | --- | --- |
-| customerKey | string
| Identifier of metadata |
-| [fieldId] | string
| for programmatic deletes only one can pass in the ID directly |
+### Automation.retrieveForCache() ⇒ Promise.<TYPE.AutomationMapObj>
+Retrieves automation metadata for caching
-
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: Promise.<TYPE.AutomationMapObj>
- Promise of metadata
+
-### DataExtensionField.postDeleteTasks(customerKey) ⇒ void
-clean up after deleting a metadata item
+### Automation.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<TYPE.AutomationItemObj>
+Retrieve a specific Automation Definition by Name
-**Kind**: static method of [DataExtensionField
](#DataExtensionField)
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: Promise.<TYPE.AutomationItemObj>
- Promise of metadata
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of metadata item |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| name | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-## DataExtensionTemplate ⇐ [MetadataType
](#MetadataType)
-DataExtensionTemplate MetadataType
+### Automation.postRetrieveTasks(metadata) ⇒ TYPE.AutomationItem
\| void
+manages post retrieve steps
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
-
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: TYPE.AutomationItem
\| void
- parsed item
-### DataExtensionTemplate.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.AutomationItem
| a single automation |
-**Kind**: static method of [DataExtensionTemplate
](#DataExtensionTemplate)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+
+### Automation.execute(keyArr) ⇒ Promise.<Array.<string>>
+a function to start query execution via API
+
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: Promise.<Array.<string>>
- Returns list of keys that were executed
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| keyArr | Array.<string>
| customerkey of the metadata |
-
+
-## DataExtract ⇐ [MetadataType
](#MetadataType)
-DataExtract MetadataType
+### Automation.getErrorsREST(ex) ⇒ Array.<string>
\| void
+Standardizes a check for multiple messages but adds query specific filters to error texts
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: Array.<string>
\| void
- formatted Error Message
-* [DataExtract](#DataExtract) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#DataExtract.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache()](#DataExtract.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveAsTemplate(templateDir, name, templateVariables)](#DataExtract.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
- * [.create(dataExtract)](#DataExtract.create) ⇒ Promise
- * [.update(dataExtract)](#DataExtract.update) ⇒ Promise
- * [.preDeployTasks(metadata)](#DataExtract.preDeployTasks) ⇒ TYPE.MetadataTypeItem
- * [.postRetrieveTasks(metadata)](#DataExtract.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
- * [.deleteByKey(customerKey)](#DataExtract.deleteByKey) ⇒ Promise.<boolean>
+| Param | Type | Description |
+| --- | --- | --- |
+| ex | object
| response payload from REST API |
-
+
-### DataExtract.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of Data Extract Activity.
-Endpoint /automation/v1/dataextracts/ returns all Data Extracts
+### Automation.pause(keyArr) ⇒ Promise.<Array.<string>>
+a function to start query execution via API
-**Kind**: static method of [DataExtract
](#DataExtract)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: Promise.<Array.<string>>
- Returns list of keys that were paused
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
-
-
-
-### DataExtract.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of Data Extract Activity for caching
+| keyArr | Array.<string>
| customerkey of the metadata |
-**Kind**: static method of [DataExtract
](#DataExtract)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
-
+
-### DataExtract.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
-Retrieve a specific dataExtract Definition by Name
+### Automation.deploy(metadata, targetBU, retrieveDir) ⇒ Promise.<TYPE.AutomationMap>
+Deploys automation - the saved file is the original one due to large differences required for deployment
-**Kind**: static method of [DataExtract
](#DataExtract)
-**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- Promise of metadata
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: Promise.<TYPE.AutomationMap>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where retrieved metadata directory will be saved |
-| name | string
| name of the metadata file |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| metadata | TYPE.AutomationMap
| metadata mapped by their keyField |
+| targetBU | string
| name/shorthand of target businessUnit for mapping |
+| retrieveDir | string
| directory where metadata after deploy should be saved |
-
+
-### DataExtract.create(dataExtract) ⇒ Promise
-Creates a single Data Extract
+### Automation.create(metadata) ⇒ Promise
+Creates a single automation
-**Kind**: static method of [DataExtract
](#DataExtract)
+**Kind**: static method of [Automation
](#Automation)
**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| dataExtract | TYPE.MetadataTypeItem
| a single Data Extract |
+| metadata | TYPE.AutomationItem
| single metadata entry |
-
+
-### DataExtract.update(dataExtract) ⇒ Promise
-Updates a single Data Extract
+### Automation.update(metadata, metadataBefore) ⇒ Promise
+Updates a single automation
-**Kind**: static method of [DataExtract
](#DataExtract)
+**Kind**: static method of [Automation
](#Automation)
**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| dataExtract | TYPE.MetadataTypeItem
| a single Data Extract |
+| metadata | TYPE.AutomationItem
| single metadata entry |
+| metadataBefore | TYPE.AutomationItem
| metadata mapped by their keyField |
-
+
-### DataExtract.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
-prepares a dataExtract for deployment
+### Automation.preDeployTasks(metadata) ⇒ Promise.<TYPE.AutomationItem>
+Gets executed before deploying metadata
-**Kind**: static method of [DataExtract
](#DataExtract)
-**Returns**: TYPE.MetadataTypeItem
- metadata object
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: Promise.<TYPE.AutomationItem>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single dataExtract activity definition |
+| metadata | TYPE.AutomationItem
| metadata mapped by their keyField |
-
+
-### DataExtract.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
-manages post retrieve steps
+### Automation.validateDeployMetadata(metadata) ⇒ boolean
+Validates the automation to be sure it can be deployed.
+Whitelisted Activites are deployed but require configuration
-**Kind**: static method of [DataExtract
](#DataExtract)
-**Returns**: TYPE.MetadataTypeItem
- metadata
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: boolean
- result if automation can be deployed based on steps
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| metadata | TYPE.AutomationItem
| single automation record |
-
+
-### DataExtract.deleteByKey(customerKey) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
+### Automation.postDeployTasks(metadataMap, originalMetadataMap) ⇒ Promise.<void>
+Gets executed after deployment of metadata type
-**Kind**: static method of [DataExtract
](#DataExtract)
-**Returns**: Promise.<boolean>
- deletion success flag
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of data extension |
+| metadataMap | TYPE.AutomationMap
| metadata mapped by their keyField |
+| originalMetadataMap | TYPE.AutomationMap
| metadata to be updated (contains additioanl fields) |
-
+
-## DataExtractType ⇐ [MetadataType
](#MetadataType)
-DataExtractType MetadataType
-Only for Caching No retrieve/upsert is required
-as this is a configuration in the EID
+### Automation.setFolderPath(metadata)
+generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [Automation
](#Automation)
-* [DataExtractType](#DataExtractType) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#DataExtractType.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache()](#DataExtractType.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single script activity definition |
-
+
-### DataExtractType.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of Data Extract Type.
+### Automation.setFolderId(metadata)
+automation-specific script that retrieves the folder ID from cache and updates the given metadata with it before deploy
-**Kind**: static method of [DataExtractType
](#DataExtractType)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [Automation
](#Automation)
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-### DataExtractType.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of Data Extract Type for caching.
+### Automation.\_buildSchedule(scheduleObject) ⇒ TYPE.AutomationScheduleSoap
+Builds a schedule object to be used for scheduling an automation
+based on combination of ical string and start/end dates.
-**Kind**: static method of [DataExtractType
](#DataExtractType)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
-
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: TYPE.AutomationScheduleSoap
- Schedulable object for soap API (currently not rest supported)
-## Discovery ⇐ [MetadataType
](#MetadataType)
-ImportFile MetadataType
+| Param | Type | Description |
+| --- | --- | --- |
+| scheduleObject | TYPE.AutomationSchedule
| child of automation metadata used for scheduling |
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
-
+
-### Discovery.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves API endpoint
-documentation: https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/routes.htm
+### Automation.\_calcTime(offsetServer, dateInput, [offsetInput]) ⇒ string
+used to convert dates to the system timezone required for startDate
-**Kind**: static method of [Discovery
](#Discovery)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: string
- date in server
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| not used |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| offsetServer | number
| stack4: US Mountain time (UTC-7); other stacks: US Central (UTC-6) |
+| dateInput | string
\| Date
| date in ISO format (2021-12-05T20:00:00.983) |
+| [offsetInput] | string
| timzone difference (+02:00) |
-
+
-## Email ⇐ [MetadataType
](#MetadataType)
-Email MetadataType
+### Automation.document([metadata]) ⇒ Promise.<void>
+Parses metadata into a readable Markdown/HTML format then saves it
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: Promise.<void>
- -
-* [Email](#Email) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#Email.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.saveResults(results, retrieveDir, [overrideType], [templateVariables])](#Email.saveResults) ⇒ Promise.<TYPE.MetadataTypeMap>
- * [.postRetrieveTasks(metadata)](#Email.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+| Param | Type | Description |
+| --- | --- | --- |
+| [metadata] | TYPE.AutomationMap
| a list of dataExtension definitions |
-
+
-### Email.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+### Automation.getFilesToCommit(keyArr) ⇒ Array.<string>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
-**Kind**: static method of [Email
](#Email)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| keyArr | Array.<string>
| customerkey of the metadata |
-
+
-### Email.saveResults(results, retrieveDir, [overrideType], [templateVariables]) ⇒ Promise.<TYPE.MetadataTypeMap>
-Helper for writing Metadata to disk, used for Retrieve and deploy
+### Automation.deleteByKey(customerKey) ⇒ boolean
+Delete a metadata item from the specified business unit
-**Kind**: static method of [Email
](#Email)
-**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of saved metadata
+**Kind**: static method of [Automation
](#Automation)
+**Returns**: boolean
- deletion success status
| Param | Type | Description |
| --- | --- | --- |
-| results | TYPE.MetadataTypeMap
| metadata results from deploy |
-| retrieveDir | string
| directory where metadata should be stored after deploy/retrieve |
-| [overrideType] | string
| for use when there is a subtype (such as folder-queries) |
-| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| customerKey | string
| Identifier of data extension |
-
+
-### Email.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
-manages post retrieve steps
+### Automation.postDeleteTasks(customerKey) ⇒ void
+clean up after deleting a metadata item
-**Kind**: static method of [Email
](#Email)
-**Returns**: TYPE.MetadataTypeItem
- Array with one metadata object and one query string
+**Kind**: static method of [Automation
](#Automation)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single query |
+| customerKey | string
| Identifier of metadata item |
-
+
-## EmailSend ⇐ [MetadataType
](#MetadataType)
-MessageSendActivity MetadataType
+## Campaign ⇐ [MetadataType
](#MetadataType)
+Campaign MetadataType
**Kind**: global class
**Extends**: [MetadataType
](#MetadataType)
-* [EmailSend](#EmailSend) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#EmailSend.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.update(metadataItem)](#EmailSend.update) ⇒ Promise
- * [.create(metadataItem)](#EmailSend.create) ⇒ Promise
- * [.deleteByKey(customerKey)](#EmailSend.deleteByKey) ⇒ Promise.<boolean>
- * [.preDeployTasks(metadata)](#EmailSend.preDeployTasks) ⇒ Promise.<TYPE.MetadataTypeItem>
- * [.postRetrieveTasks(metadata)](#EmailSend.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+* [Campaign](#Campaign) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#Campaign.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache()](#Campaign.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.getAssetTags(retrieveDir, campaignId, name)](#Campaign.getAssetTags) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-
+
-### EmailSend.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+### Campaign.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of campaigns. Afterwards, starts metadata retrieval for their campaign assets
-**Kind**: static method of [EmailSend
](#EmailSend)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [Campaign
](#Campaign)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
| Param | Type | Description |
| --- | --- | --- |
@@ -2488,564 +2606,498 @@ Retrieves SOAP based metadata of metadata type into local filesystem. executes c
| [__] | void
| unused parameter |
| [key] | string
| customer key of single item to retrieve |
-
+
-### EmailSend.update(metadataItem) ⇒ Promise
-Updates a single item
+### Campaign.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves event definition metadata for caching
-**Kind**: static method of [EmailSend
](#EmailSend)
-**Returns**: Promise
- Promise
+**Kind**: static method of [Campaign
](#Campaign)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+
+### Campaign.getAssetTags(retrieveDir, campaignId, name) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Parses campaign asset response body and returns metadata entries mapped to their id
+
+**Kind**: static method of [Campaign
](#Campaign)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Campaign Asset Object
| Param | Type | Description |
| --- | --- | --- |
-| metadataItem | TYPE.MetadataTypeItem
| a single item |
+| retrieveDir | string
| folder where to save |
+| campaignId | string
| of camapaign to retrieve |
+| name | string
| of camapaign for saving |
-
+
-### EmailSend.create(metadataItem) ⇒ Promise
-Creates a single item
+## ContentArea ⇐ [MetadataType
](#MetadataType)
+ContentArea MetadataType
-**Kind**: static method of [EmailSend
](#EmailSend)
-**Returns**: Promise
- Promise
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
-| Param | Type | Description |
-| --- | --- | --- |
-| metadataItem | TYPE.MetadataTypeItem
| a single item |
+* [ContentArea](#ContentArea) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#ContentArea.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.setFolderPath(metadata)](#ContentArea.setFolderPath)
+ * [.postRetrieveTasks(metadata)](#ContentArea.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
-
+
-### EmailSend.deleteByKey(customerKey) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
+### ContentArea.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
-**Kind**: static method of [EmailSend
](#EmailSend)
-**Returns**: Promise.<boolean>
- deletion success status
+**Kind**: static method of [ContentArea
](#ContentArea)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of data extension |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### EmailSend.preDeployTasks(metadata) ⇒ Promise.<TYPE.MetadataTypeItem>
-prepares a single item for deployment
+### ContentArea.setFolderPath(metadata)
+generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
-**Kind**: static method of [EmailSend
](#EmailSend)
-**Returns**: Promise.<TYPE.MetadataTypeItem>
- Promise
+**Kind**: static method of [ContentArea
](#ContentArea)
| Param | Type | Description |
| --- | --- | --- |
| metadata | TYPE.MetadataTypeItem
| a single script activity definition |
-
+
-### EmailSend.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
-manages post retrieve steps
+### ContentArea.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
+parses retrieved Metadata before saving
-**Kind**: static method of [EmailSend
](#EmailSend)
-**Returns**: TYPE.MetadataTypeItem
- Array with one metadata object and one query string
+**Kind**: static method of [ContentArea
](#ContentArea)
+**Returns**: TYPE.MetadataTypeItem
- parsed item
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single query |
+| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-## Event ⇐ [MetadataType
](#MetadataType)
-Event MetadataType
+## DataExtension ⇐ [MetadataType
](#MetadataType)
+DataExtension MetadataType
**Kind**: global class
**Extends**: [MetadataType
](#MetadataType)
-* [Event](#Event) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#Event.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache()](#Event.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveAsTemplate(templateDir, name, templateVariables)](#Event.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
- * [.postRetrieveTasks(eventDef)](#Event.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
- * [.deleteByKey(key)](#Event.deleteByKey) ⇒ Promise.<boolean>
- * [.deploy(metadata, deployDir, retrieveDir)](#Event.deploy) ⇒ Promise.<TYPE.MetadataTypeMap>
- * [.create(metadata)](#Event.create) ⇒ Promise
- * [.update(metadataEntry)](#Event.update) ⇒ Promise
- * [.preDeployTasks(metadata)](#Event.preDeployTasks) ⇒ TYPE.MetadataTypeItem
- * [.parseMetadata(metadata)](#Event.parseMetadata) ⇒ TYPE.MetadataTypeItem
+* [DataExtension](#DataExtension) ⇐ [MetadataType
](#MetadataType)
+ * [.upsert(metadataMap)](#DataExtension.upsert) ⇒ Promise
+ * [.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate)](#DataExtension.createOrUpdate) ⇒ 'create'
\| 'update'
\| 'skip'
+ * [.create(metadata)](#DataExtension.create) ⇒ Promise
+ * [.update(metadata)](#DataExtension.update) ⇒ Promise
+ * [.postDeployTasks(upsertedMetadata, originalMetadata, createdUpdated)](#DataExtension.postDeployTasks) ⇒ void
+ * [.retrieve(retrieveDir, [additionalFields], [_], [key])](#DataExtension.retrieve) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
+ * [.retrieveSharedForCache([additionalFields])](#DataExtension.retrieveSharedForCache) ⇒ Promise.<TYPE.DataExtensionMap>
+ * [.retrieveChangelog([additionalFields])](#DataExtension.retrieveChangelog) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
+ * [.postRetrieveTasks(metadata)](#DataExtension.postRetrieveTasks) ⇒ TYPE.DataExtensionItem
+ * [.preDeployTasks(metadata)](#DataExtension.preDeployTasks) ⇒ Promise.<TYPE.DataExtensionItem>
+ * [.document([metadataMap])](#DataExtension.document) ⇒ Promise.<void>
+ * [.deleteByKey(customerKey)](#DataExtension.deleteByKey) ⇒ Promise.<boolean>
+ * [.postDeleteTasks(customerKey)](#DataExtension.postDeleteTasks) ⇒ Promise.<void>
+ * [.retrieveForCache()](#DataExtension.retrieveForCache) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables)](#DataExtension.retrieveAsTemplate) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
+ * [.setFolderPath(metadata)](#DataExtension.setFolderPath)
+ * [.getFilesToCommit(keyArr)](#DataExtension.getFilesToCommit) ⇒ Array.<string>
-
+
-### Event.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of Event Definition.
-Endpoint /interaction/v1/EventDefinitions return all Event Definitions with all details.
-Currently it is not needed to loop over Imports with endpoint /interaction/v1/EventDefinitions/{id}
+### DataExtension.upsert(metadataMap) ⇒ Promise
+Upserts dataExtensions after retrieving them from source and target to compare
+if create or update operation is needed.
-**Kind**: static method of [Event
](#Event)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
-
-
-
-### Event.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves event definition metadata for caching
+| metadataMap | TYPE.DataExtensionMap
| dataExtensions mapped by their customerKey |
-**Kind**: static method of [Event
](#Event)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
-
+
-### Event.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
-Retrieve a specific Event Definition by Name
+### DataExtension.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate) ⇒ 'create'
\| 'update'
\| 'skip'
+helper for [upsert](#MetadataType.upsert)
-**Kind**: static method of [Event
](#Event)
-**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- Promise of metadata
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: 'create'
\| 'update'
\| 'skip'
- action to take
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where retrieved metadata directory will be saved |
-| name | string
| name of the metadata file |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| metadataMap | TYPE.MetadataTypeMap
| list of metadata |
+| metadataKey | string
| key of item we are looking at |
+| hasError | boolean
| error flag from previous code |
+| metadataToUpdate | Array.<TYPE.MetadataTypeItemDiff>
| list of items to update |
+| metadataToCreate | Array.<TYPE.MetadataTypeItem>
| list of items to create |
-
+
-### Event.postRetrieveTasks(eventDef) ⇒ TYPE.MetadataTypeItem
-manages post retrieve steps
+### DataExtension.create(metadata) ⇒ Promise
+Create a single dataExtension. Also creates their columns in 'dataExtension.columns'
-**Kind**: static method of [Event
](#Event)
-**Returns**: TYPE.MetadataTypeItem
- metadata
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| eventDef | TYPE.MetadataTypeItem
| a single item of Event Definition |
+| metadata | TYPE.DataExtensionItem
| single metadata entry |
-
+
-### Event.deleteByKey(key) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
+### DataExtension.update(metadata) ⇒ Promise
+Updates a single dataExtension. Also updates their columns in 'dataExtension.columns'
-**Kind**: static method of [Event
](#Event)
-**Returns**: Promise.<boolean>
- deletion success status
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| key | string
| Identifier of item |
+| metadata | TYPE.DataExtensionItem
| single metadata entry |
-
+
-### Event.deploy(metadata, deployDir, retrieveDir) ⇒ Promise.<TYPE.MetadataTypeMap>
-Deploys metadata - merely kept here to be able to print [logBeta](#Util.logBeta) once per deploy
+### DataExtension.postDeployTasks(upsertedMetadata, originalMetadata, createdUpdated) ⇒ void
+Gets executed after deployment of metadata type
-**Kind**: static method of [Event
](#Event)
-**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of keyField => metadata map
+**Kind**: static method of [DataExtension
](#DataExtension)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
-| deployDir | string
| directory where deploy metadata are saved |
-| retrieveDir | string
| directory where metadata after deploy should be saved |
+| upsertedMetadata | TYPE.DataExtensionMap
| metadata mapped by their keyField |
+| originalMetadata | TYPE.DataExtensionMap
| metadata to be updated (contains additioanl fields) |
+| createdUpdated | Object
| counter representing successful creates/updates |
-
+
-### Event.create(metadata) ⇒ Promise
-Creates a single Event Definition
+### DataExtension.retrieve(retrieveDir, [additionalFields], [_], [key]) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
+Retrieves dataExtension metadata. Afterwards starts retrieval of dataExtensionColumn metadata retrieval
-**Kind**: static method of [Event
](#Event)
-**Returns**: Promise
- Promise
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
- Promise of item map
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single Event Definition |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [_] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### Event.update(metadataEntry) ⇒ Promise
-Updates a single Event Definition (using PUT method since PATCH isn't supported)
+### DataExtension.retrieveSharedForCache([additionalFields]) ⇒ Promise.<TYPE.DataExtensionMap>
+get shared dataExtensions from parent BU and merge them into the cache
+helper for [retrieve](#DataExtension.retrieve) and for AttributeSet.fixShared_retrieve
-**Kind**: static method of [Event
](#Event)
-**Returns**: Promise
- Promise
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: Promise.<TYPE.DataExtensionMap>
- keyField => metadata map
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| a single Event Definition |
-
-
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-### Event.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
-prepares an event definition for deployment
+
-**Kind**: static method of [Event
](#Event)
-**Returns**: TYPE.MetadataTypeItem
- parsed version
+### DataExtension.retrieveChangelog([additionalFields]) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
+Retrieves dataExtension metadata. Afterwards starts retrieval of dataExtensionColumn metadata retrieval
+
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
- Promise of item map
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single eventDefinition |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-
+
-### Event.parseMetadata(metadata) ⇒ TYPE.MetadataTypeItem
-parses retrieved Metadata before saving
+### DataExtension.postRetrieveTasks(metadata) ⇒ TYPE.DataExtensionItem
+manages post retrieve steps
-**Kind**: static method of [Event
](#Event)
-**Returns**: TYPE.MetadataTypeItem
- parsed metadata
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: TYPE.DataExtensionItem
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single event definition |
+| metadata | TYPE.DataExtensionItem
| a single dataExtension |
-
+
-## FtpLocation ⇐ [MetadataType
](#MetadataType)
-ImportFile MetadataType
+### DataExtension.preDeployTasks(metadata) ⇒ Promise.<TYPE.DataExtensionItem>
+prepares a DataExtension for deployment
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: Promise.<TYPE.DataExtensionItem>
- Promise of updated single DE
-* [FtpLocation](#FtpLocation) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#FtpLocation.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache()](#FtpLocation.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.DataExtensionItem
| a single data Extension |
-
+
-### FtpLocation.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of FtpLocation
-Endpoint /automation/v1/ftplocations/ return all FtpLocations
+### DataExtension.document([metadataMap]) ⇒ Promise.<void>
+Parses metadata into a readable Markdown/HTML format then saves it
-**Kind**: static method of [FtpLocation
](#FtpLocation)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
-
-
-
-### FtpLocation.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves folder metadata into local filesystem. Also creates a uniquePath attribute for each folder.
+| [metadataMap] | TYPE.DataExtensionMap
| a list of dataExtension definitions |
-**Kind**: static method of [FtpLocation
](#FtpLocation)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
-
+
-## FileTransfer ⇐ [MetadataType
](#MetadataType)
-FileTransfer MetadataType
+### DataExtension.deleteByKey(customerKey) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: Promise.<boolean>
- deletion success status
-* [FileTransfer](#FileTransfer) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#FileTransfer.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache()](#FileTransfer.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveAsTemplate(templateDir, name, templateVariables)](#FileTransfer.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
- * [.create(fileTransfer)](#FileTransfer.create) ⇒ Promise
- * [.update(fileTransfer)](#FileTransfer.update) ⇒ Promise
- * [.preDeployTasks(metadata)](#FileTransfer.preDeployTasks) ⇒ Promise
- * [.postRetrieveTasks(metadata)](#FileTransfer.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
- * [.deleteByKey(customerKey)](#FileTransfer.deleteByKey) ⇒ Promise.<boolean>
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of data extension |
-
+
-### FileTransfer.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of FileTransfer Activity.
-Endpoint /automation/v1/filetransfers/ returns all File Transfers
+### DataExtension.postDeleteTasks(customerKey) ⇒ Promise.<void>
+clean up after deleting a metadata item
-**Kind**: static method of [FileTransfer
](#FileTransfer)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: Promise.<void>
- - promise
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| customerKey | string
| Identifier of metadata item |
-
+
-### FileTransfer.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of FileTransfer Activity for caching
+### DataExtension.retrieveForCache() ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
+Retrieves folder metadata into local filesystem. Also creates a uniquePath attribute for each folder.
-**Kind**: static method of [FileTransfer
](#FileTransfer)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
-
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
- Promise
+
-### FileTransfer.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
-Retrieve a specific File Transfer Definition by Name
+### DataExtension.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
+Retrieves dataExtension metadata in template format.
-**Kind**: static method of [FileTransfer
](#FileTransfer)
-**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- Promise
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: Promise.<{metadata: TYPE.DataExtensionMap, type: string}>
- Promise of items
| Param | Type | Description |
| --- | --- | --- |
| templateDir | string
| Directory where retrieved metadata directory will be saved |
-| name | string
| name of the metadata file |
+| name | string
| name of the metadata item |
| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### FileTransfer.create(fileTransfer) ⇒ Promise
-Creates a single File Transfer
+### DataExtension.setFolderPath(metadata)
+dataExtension logic that retrieves the folder path from cache and updates the given metadata with it after retrieve
+it also sets the content type which is basically the subtype
-**Kind**: static method of [FileTransfer
](#FileTransfer)
-**Returns**: Promise
- Promise
+**Kind**: static method of [DataExtension
](#DataExtension)
| Param | Type | Description |
| --- | --- | --- |
-| fileTransfer | TYPE.MetadataTypeItem
| a single File Transfer |
+| metadata | TYPE.MetadataTypeItem
| a single script activity definition |
-
+
-### FileTransfer.update(fileTransfer) ⇒ Promise
-Updates a single File Transfer
+### DataExtension.getFilesToCommit(keyArr) ⇒ Array.<string>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
-**Kind**: static method of [FileTransfer
](#FileTransfer)
-**Returns**: Promise
- Promise
+**Kind**: static method of [DataExtension
](#DataExtension)
+**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
| Param | Type | Description |
| --- | --- | --- |
-| fileTransfer | TYPE.MetadataTypeItem
| a single File Transfer |
+| keyArr | Array.<string>
| customerkey of the metadata |
-
+
-### FileTransfer.preDeployTasks(metadata) ⇒ Promise
-prepares a fileTransfer for deployment
+## DataExtensionField ⇐ [MetadataType
](#MetadataType)
+DataExtensionField MetadataType
-**Kind**: static method of [FileTransfer
](#FileTransfer)
-**Returns**: Promise
- Promise
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
-| Param | Type | Description |
-| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single fileTransfer activity definition |
+* [DataExtensionField](#DataExtensionField) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [additionalFields])](#DataExtensionField.retrieve) ⇒ Promise.<{metadata: TYPE.DataExtensionFieldMap, type: string}>
+ * [.retrieveForCache([requestParams], [additionalFields])](#DataExtensionField.retrieveForCache) ⇒ Promise.<{metadata: TYPE.DataExtensionFieldMap, type: string}>
+ * [.convertToSortedArray(fieldsObj)](#DataExtensionField.convertToSortedArray) ⇒ Array.<TYPE.DataExtensionFieldItem>
+ * [.sortDeFields(a, b)](#DataExtensionField.sortDeFields) ⇒ boolean
+ * [.postRetrieveTasks(metadata, forDataExtension)](#DataExtensionField.postRetrieveTasks) ⇒ TYPE.DataExtensionFieldItem
+ * [.prepareDeployColumnsOnUpdate(deployColumns, deKey)](#DataExtensionField.prepareDeployColumnsOnUpdate) ⇒ Promise.<Object.<string, TYPE.DataExtensionFieldItem>>
+ * [.deleteByKey(customerKey)](#DataExtensionField.deleteByKey) ⇒ Promise.<boolean>
+ * [.deleteByKeySOAP(customerKey, [fieldId])](#DataExtensionField.deleteByKeySOAP) ⇒ boolean
+ * [.postDeleteTasks(customerKey)](#DataExtensionField.postDeleteTasks) ⇒ void
-
+
-### FileTransfer.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
-manages post retrieve steps
+### DataExtensionField.retrieve(retrieveDir, [additionalFields]) ⇒ Promise.<{metadata: TYPE.DataExtensionFieldMap, type: string}>
+Retrieves all records and saves it to disk
-**Kind**: static method of [FileTransfer
](#FileTransfer)
-**Returns**: TYPE.MetadataTypeItem
- parsed metadata
+**Kind**: static method of [DataExtensionField
](#DataExtensionField)
+**Returns**: Promise.<{metadata: TYPE.DataExtensionFieldMap, type: string}>
- Promise of items
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single fileTransfer activity definition |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-
+
-### FileTransfer.deleteByKey(customerKey) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
+### DataExtensionField.retrieveForCache([requestParams], [additionalFields]) ⇒ Promise.<{metadata: TYPE.DataExtensionFieldMap, type: string}>
+Retrieves all records for caching
-**Kind**: static method of [FileTransfer
](#FileTransfer)
-**Returns**: Promise.<boolean>
- deletion success flag
+**Kind**: static method of [DataExtensionField
](#DataExtensionField)
+**Returns**: Promise.<{metadata: TYPE.DataExtensionFieldMap, type: string}>
- Promise of items
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of data extension |
-
-
-
-## Filter ⇐ [MetadataType
](#MetadataType)
-Filter MetadataType
+| [requestParams] | TYPE.SoapRequestParams
| required for the specific request (filter for example) |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
-
+
-### Filter.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of Filter.
-Endpoint /automation/v1/filters/ returns all Filters,
-but only with some of the fields. So it is needed to loop over
-Filters with the endpoint /automation/v1/filters/{id}
+### DataExtensionField.convertToSortedArray(fieldsObj) ⇒ Array.<TYPE.DataExtensionFieldItem>
+helper for DataExtension.retrieveFieldsForSingleDe that sorts the fields into an array
-**Kind**: static method of [Filter
](#Filter)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+**Kind**: static method of [DataExtensionField
](#DataExtensionField)
+**Returns**: Array.<TYPE.DataExtensionFieldItem>
- sorted array of field objects
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| fieldsObj | TYPE.DataExtensionFieldMap
| customerKey-based list of fields for one dataExtension |
-
+
-## Folder ⇐ [MetadataType
](#MetadataType)
-Folder MetadataType
+### DataExtensionField.sortDeFields(a, b) ⇒ boolean
+sorting method to ensure `Ordinal` is respected
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [DataExtensionField
](#DataExtensionField)
+**Returns**: boolean
- sorting based on Ordinal
-* [Folder](#Folder) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key])](#Folder.retrieve) ⇒ Promise
- * [.retrieveForCache([_], [subTypeArr])](#Folder.retrieveForCache) ⇒ Promise
- * [.upsert(metadata)](#Folder.upsert) ⇒ Promise.<object>
- * [.create(metadataEntry)](#Folder.create) ⇒ Promise
- * [.update(metadataEntry)](#Folder.update) ⇒ Promise
- * [.preDeployTasks(metadata)](#Folder.preDeployTasks) ⇒ Promise.<TYPE.MetadataTypeItem>
- * [.getJsonFromFS(dir, [listBadKeys])](#Folder.getJsonFromFS) ⇒ TYPE.MetadataTypeMap
- * [.retrieveHelper([additionalFields], [queryAllAccounts], [contentTypeList])](#Folder.retrieveHelper) ⇒ Promise.<object>
- * [.postRetrieveTasks(metadata)](#Folder.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
- * [.saveResults(results, retrieveDir, mid)](#Folder.saveResults) ⇒ Promise.<object>
+| Param | Type | Description |
+| --- | --- | --- |
+| a | TYPE.DataExtensionFieldItem
| - |
+| b | TYPE.DataExtensionFieldItem
| - |
-
+
-### Folder.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key]) ⇒ Promise
-Retrieves metadata of metadata type into local filesystem. executes callback with retrieved metadata
+### DataExtensionField.postRetrieveTasks(metadata, forDataExtension) ⇒ TYPE.DataExtensionFieldItem
+manages post retrieve steps
-**Kind**: static method of [Folder
](#Folder)
-**Returns**: Promise
- Promise
+**Kind**: static method of [DataExtensionField
](#DataExtensionField)
+**Returns**: TYPE.DataExtensionFieldItem
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-| [subTypeArr] | Array.<string>
| content type of folder |
-| [key] | string
| customer key of single item to retrieve |
-
-
-
-### Folder.retrieveForCache([_], [subTypeArr]) ⇒ Promise
-Retrieves folder metadata for caching
-
-**Kind**: static method of [Folder
](#Folder)
-**Returns**: Promise
- Promise
-
-| Param | Type | Description |
-| --- | --- | --- |
-| [_] | void
| parameter not used |
-| [subTypeArr] | Array.<string>
| content type of folder |
-
-
-
-### Folder.upsert(metadata) ⇒ Promise.<object>
-Folder upsert (copied from Metadata Upsert), after retrieving from target
-and comparing to check if create or update operation is needed.
-Copied due to having a dependency on itself, meaning the created need to be serial
-
-**Kind**: static method of [Folder
](#Folder)
-**Returns**: Promise.<object>
- Promise of saved metadata
-
-| Param | Type | Description |
-| --- | --- | --- |
-| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
-
-
-
-### Folder.create(metadataEntry) ⇒ Promise
-creates a folder based on metatadata
-
-**Kind**: static method of [Folder
](#Folder)
-**Returns**: Promise
- Promise
-
-| Param | Type | Description |
-| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| metadata of the folder |
+| metadata | TYPE.DataExtensionFieldItem
| a single item |
+| forDataExtension | boolean
| when used by DataExtension class we remove more fields |
-
+
-### Folder.update(metadataEntry) ⇒ Promise
-Updates a single Folder.
+### DataExtensionField.prepareDeployColumnsOnUpdate(deployColumns, deKey) ⇒ Promise.<Object.<string, TYPE.DataExtensionFieldItem>>
+Mofifies passed deployColumns for update by mapping ObjectID to their target column's values.
+Removes FieldType field if its the same in deploy and target column, because it results in an error even if its of the same type
-**Kind**: static method of [Folder
](#Folder)
-**Returns**: Promise
- Promise
+**Kind**: static method of [DataExtensionField
](#DataExtensionField)
+**Returns**: Promise.<Object.<string, TYPE.DataExtensionFieldItem>>
- existing fields by their original name to allow re-adding FieldType after update
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| single metadata entry |
+| deployColumns | Array.<TYPE.DataExtensionFieldItem>
| Columns of data extension that will be deployed |
+| deKey | string
| external/customer key of Data Extension |
-
+
-### Folder.preDeployTasks(metadata) ⇒ Promise.<TYPE.MetadataTypeItem>
-prepares a folder for deployment
+### DataExtensionField.deleteByKey(customerKey) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
-**Kind**: static method of [Folder
](#Folder)
-**Returns**: Promise.<TYPE.MetadataTypeItem>
- Promise of parsed folder metadata
+**Kind**: static method of [DataExtensionField
](#DataExtensionField)
+**Returns**: Promise.<boolean>
- deletion success status
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single folder definition |
+| customerKey | string
| Identifier of data extension |
-
+
-### Folder.getJsonFromFS(dir, [listBadKeys]) ⇒ TYPE.MetadataTypeMap
-Returns file contents mapped to their filename without '.json' ending
+### DataExtensionField.deleteByKeySOAP(customerKey, [fieldId]) ⇒ boolean
+Delete a data extension from the specified business unit
-**Kind**: static method of [Folder
](#Folder)
-**Returns**: TYPE.MetadataTypeMap
- fileName => fileContent map
+**Kind**: static method of [DataExtensionField
](#DataExtensionField)
+**Returns**: boolean
- deletion success flag
| Param | Type | Description |
| --- | --- | --- |
-| dir | string
| directory that contains '.json' files to be read |
-| [listBadKeys] | boolean
| do not print errors, used for badKeys() |
+| customerKey | string
| Identifier of metadata |
+| [fieldId] | string
| for programmatic deletes only one can pass in the ID directly |
-
+
-### Folder.retrieveHelper([additionalFields], [queryAllAccounts], [contentTypeList]) ⇒ Promise.<object>
-Helper to retrieve the folders as promise
+### DataExtensionField.postDeleteTasks(customerKey) ⇒ void
+clean up after deleting a metadata item
-**Kind**: static method of [Folder
](#Folder)
-**Returns**: Promise.<object>
- soap object
+**Kind**: static method of [DataExtensionField
](#DataExtensionField)
| Param | Type | Description |
| --- | --- | --- |
-| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-| [queryAllAccounts] | boolean
| which queryAllAccounts setting to use |
-| [contentTypeList] | Array.<string>
| content type of folder |
-
-
-
-### Folder.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
-Gets executed after retreive of metadata type
+| customerKey | string
| Identifier of metadata item |
-**Kind**: static method of [Folder
](#Folder)
-**Returns**: TYPE.MetadataTypeItem
- cloned metadata
+
-| Param | Type | Description |
-| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| metadata mapped by their keyField |
+## DataExtensionTemplate ⇐ [MetadataType
](#MetadataType)
+DataExtensionTemplate MetadataType
-
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
-### Folder.saveResults(results, retrieveDir, mid) ⇒ Promise.<object>
-Helper for writing Metadata to disk, used for Retrieve and deploy
+### DataExtensionTemplate.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
-**Kind**: static method of [Folder
](#Folder)
-**Returns**: Promise.<object>
- Promise of saved metadata
+**Kind**: static method of [DataExtensionTemplate
](#DataExtensionTemplate)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
| Param | Type | Description |
| --- | --- | --- |
-| results | object
| metadata results from deploy |
-| retrieveDir | string
| directory where metadata should be stored after deploy/retrieve |
-| mid | number
| current mid for this credential / business unit |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-
+
-## ImportFile ⇐ [MetadataType
](#MetadataType)
-ImportFile MetadataType
+## DataExtract ⇐ [MetadataType
](#MetadataType)
+DataExtract MetadataType
**Kind**: global class
**Extends**: [MetadataType
](#MetadataType)
-* [ImportFile](#ImportFile) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#ImportFile.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache([_], [__], [key])](#ImportFile.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveAsTemplate(templateDir, name, templateVariables)](#ImportFile.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
- * [.create(importFile)](#ImportFile.create) ⇒ Promise
- * [.update(importFile)](#ImportFile.update) ⇒ Promise
- * [.deploy(metadataMap, deployDir, retrieveDir)](#ImportFile.deploy) ⇒ Promise.<TYPE.MetadataTypeMap>
- * [.preDeployTasks(metadata)](#ImportFile.preDeployTasks) ⇒ Promise
- * [.postRetrieveTasks(metadata)](#ImportFile.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
- * [.deleteByKey(customerKey)](#ImportFile.deleteByKey) ⇒ Promise.<boolean>
+* [DataExtract](#DataExtract) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#DataExtract.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache()](#DataExtract.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables)](#DataExtract.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+ * [.create(dataExtract)](#DataExtract.create) ⇒ Promise
+ * [.update(dataExtract)](#DataExtract.update) ⇒ Promise
+ * [.preDeployTasks(metadata)](#DataExtract.preDeployTasks) ⇒ TYPE.MetadataTypeItem
+ * [.postRetrieveTasks(metadata)](#DataExtract.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+ * [.deleteByKey(customerKey)](#DataExtract.deleteByKey) ⇒ Promise.<boolean>
-
+
-### ImportFile.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of Import File.
-Endpoint /automation/v1/imports/ return all Import Files with all details.
-Currently it is not needed to loop over Imports with endpoint /automation/v1/imports/{id}
+### DataExtract.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of Data Extract Activity.
+Endpoint /automation/v1/dataextracts/ returns all Data Extracts
-**Kind**: static method of [ImportFile
](#ImportFile)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+**Kind**: static method of [DataExtract
](#DataExtract)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
| Param | Type | Description |
| --- | --- | --- |
@@ -3054,27 +3106,20 @@ Currently it is not needed to loop over Imports with endpoint /automation/v1/imp
| [__] | void
| unused parameter |
| [key] | string
| customer key of single item to retrieve |
-
-
-### ImportFile.retrieveForCache([_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves import definition metadata for caching
-
-**Kind**: static method of [ImportFile
](#ImportFile)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+
-| Param | Type | Description |
-| --- | --- | --- |
-| [_] | void
| parameter not used |
-| [__] | void
| parameter not used |
-| [key] | string
| customer key of single item to retrieve |
+### DataExtract.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of Data Extract Activity for caching
-
+**Kind**: static method of [DataExtract
](#DataExtract)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
-### ImportFile.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
-Retrieve a specific Import Definition by Name
+### DataExtract.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+Retrieve a specific dataExtract Definition by Name
-**Kind**: static method of [ImportFile
](#ImportFile)
-**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- Promise
+**Kind**: static method of [DataExtract
](#DataExtract)
+**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- Promise of metadata
| Param | Type | Description |
| --- | --- | --- |
@@ -3082,111 +3127,87 @@ Retrieve a specific Import Definition by Name
| name | string
| name of the metadata file |
| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### ImportFile.create(importFile) ⇒ Promise
-Creates a single Import File
+### DataExtract.create(dataExtract) ⇒ Promise
+Creates a single Data Extract
-**Kind**: static method of [ImportFile
](#ImportFile)
+**Kind**: static method of [DataExtract
](#DataExtract)
**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| importFile | TYPE.MetadataTypeItem
| a single Import File |
+| dataExtract | TYPE.MetadataTypeItem
| a single Data Extract |
-
+
-### ImportFile.update(importFile) ⇒ Promise
-Updates a single Import File
+### DataExtract.update(dataExtract) ⇒ Promise
+Updates a single Data Extract
-**Kind**: static method of [ImportFile
](#ImportFile)
+**Kind**: static method of [DataExtract
](#DataExtract)
**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| importFile | TYPE.MetadataTypeItem
| a single Import File |
-
-
-
-### ImportFile.deploy(metadataMap, deployDir, retrieveDir) ⇒ Promise.<TYPE.MetadataTypeMap>
-Deploys metadata
-
-**Kind**: static method of [ImportFile
](#ImportFile)
-**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of keyField => metadata map
-
-| Param | Type | Description |
-| --- | --- | --- |
-| metadataMap | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
-| deployDir | string
| directory where deploy metadata are saved |
-| retrieveDir | string
| directory where metadata after deploy should be saved |
+| dataExtract | TYPE.MetadataTypeItem
| a single Data Extract |
-
+
-### ImportFile.preDeployTasks(metadata) ⇒ Promise
-prepares a import definition for deployment
+### DataExtract.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
+prepares a dataExtract for deployment
-**Kind**: static method of [ImportFile
](#ImportFile)
-**Returns**: Promise
- Promise
+**Kind**: static method of [DataExtract
](#DataExtract)
+**Returns**: TYPE.MetadataTypeItem
- metadata object
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single importDef |
+| metadata | TYPE.MetadataTypeItem
| a single dataExtract activity definition |
-
+
-### ImportFile.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
+### DataExtract.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
manages post retrieve steps
-**Kind**: static method of [ImportFile
](#ImportFile)
-**Returns**: TYPE.MetadataTypeItem
- parsed metadata
+**Kind**: static method of [DataExtract
](#DataExtract)
+**Returns**: TYPE.MetadataTypeItem
- metadata
| Param | Type | Description |
| --- | --- | --- |
| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-### ImportFile.deleteByKey(customerKey) ⇒ Promise.<boolean>
+### DataExtract.deleteByKey(customerKey) ⇒ Promise.<boolean>
Delete a metadata item from the specified business unit
-**Kind**: static method of [ImportFile
](#ImportFile)
+**Kind**: static method of [DataExtract
](#DataExtract)
**Returns**: Promise.<boolean>
- deletion success flag
| Param | Type | Description |
| --- | --- | --- |
| customerKey | string
| Identifier of data extension |
-
+
-## Journey ⇐ [MetadataType
](#MetadataType)
-Journey MetadataType
-! BETA RELEASE of journey support (v4.3.0); it so far only resolves a limited amount of dependencies and will likely break during cross-BU deployments!
-id: A unique id of the journey assigned by the journey’s API during its creation
-key: A unique id of the journey within the MID. Can be generated by the developer
-definitionId: A unique UUID provided by Salesforce Marketing Cloud. Each version of a journey has a unique DefinitionID while the Id and Key remain the same. Version 1 will have id == definitionId
+## DataExtractType ⇐ [MetadataType
](#MetadataType)
+DataExtractType MetadataType
+Only for Caching No retrieve/upsert is required
+as this is a configuration in the EID
**Kind**: global class
**Extends**: [MetadataType
](#MetadataType)
-* [Journey](#Journey) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#Journey.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.deleteByKey(key)](#Journey.deleteByKey) ⇒ Promise.<boolean>
- * [.deploy(metadata, deployDir, retrieveDir)](#Journey.deploy) ⇒ Promise.<TYPE.MetadataTypeMap>
- * [.update(metadata)](#Journey.update) ⇒ Promise
- * [.create(metadata)](#Journey.create) ⇒ Promise
- * [.saveResults(results, retrieveDir, [overrideType], [templateVariables])](#Journey.saveResults) ⇒ Promise.<TYPE.MetadataTypeMap>
- * [._postRetrieveTasksBulk(metadataMap)](#Journey._postRetrieveTasksBulk)
- * [.postRetrieveTasks(metadata)](#Journey.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
- * [.preDeployTasks(metadata)](#Journey.preDeployTasks) ⇒ TYPE.MetadataTypeItem
- * [.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate)](#Journey.createOrUpdate) ⇒ 'create'
\| 'update'
\| 'skip'
+* [DataExtractType](#DataExtractType) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#DataExtractType.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache()](#DataExtractType.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-
+
-### Journey.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of Journey
+### DataExtractType.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of Data Extract Type.
-**Kind**: static method of [Journey
](#Journey)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+**Kind**: static method of [DataExtractType
](#DataExtractType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
| Param | Type | Description |
| --- | --- | --- |
@@ -3195,62 +3216,70 @@ Retrieves Metadata of Journey
| [__] | void
| unused parameter |
| [key] | string
| customer key of single item to retrieve |
-
+
-### Journey.deleteByKey(key) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
+### DataExtractType.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of Data Extract Type for caching.
-**Kind**: static method of [Journey
](#Journey)
-**Returns**: Promise.<boolean>
- deletion success status
+**Kind**: static method of [DataExtractType
](#DataExtractType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
-| Param | Type | Description |
-| --- | --- | --- |
-| key | string
| Identifier of item |
+## Discovery ⇐ [MetadataType
](#MetadataType)
+ImportFile MetadataType
-
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
-### Journey.deploy(metadata, deployDir, retrieveDir) ⇒ Promise.<TYPE.MetadataTypeMap>
-Deploys metadata - merely kept here to be able to print [logBeta](#Util.logBeta) once per deploy
+### Discovery.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves API endpoint
+documentation: https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/routes.htm
-**Kind**: static method of [Journey
](#Journey)
-**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of keyField => metadata map
+**Kind**: static method of [Discovery
](#Discovery)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
-| deployDir | string
| directory where deploy metadata are saved |
-| retrieveDir | string
| directory where metadata after deploy should be saved |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| not used |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### Journey.update(metadata) ⇒ Promise
-Updates a single item
+## Email ⇐ [MetadataType
](#MetadataType)
+Email MetadataType
-**Kind**: static method of [Journey
](#Journey)
-**Returns**: Promise
- Promise
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
-| Param | Type | Description |
-| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+* [Email](#Email) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#Email.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.saveResults(results, retrieveDir, [overrideType], [templateVariables])](#Email.saveResults) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.postRetrieveTasks(metadata)](#Email.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
-
+
-### Journey.create(metadata) ⇒ Promise
-Creates a single item
+### Email.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
-**Kind**: static method of [Journey
](#Journey)
-**Returns**: Promise
- Promise
+**Kind**: static method of [Email
](#Email)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### Journey.saveResults(results, retrieveDir, [overrideType], [templateVariables]) ⇒ Promise.<TYPE.MetadataTypeMap>
+### Email.saveResults(results, retrieveDir, [overrideType], [templateVariables]) ⇒ Promise.<TYPE.MetadataTypeMap>
Helper for writing Metadata to disk, used for Retrieve and deploy
-**Kind**: static method of [Journey
](#Journey)
+**Kind**: static method of [Email
](#Email)
**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of saved metadata
| Param | Type | Description |
@@ -3260,3056 +3289,8294 @@ Helper for writing Metadata to disk, used for Retrieve and deploy
| [overrideType] | string
| for use when there is a subtype (such as folder-queries) |
| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### Journey.\_postRetrieveTasksBulk(metadataMap)
-helper for Journey's [saveResults](#Journey.saveResults). Gets executed after retreive of metadata type and
+### Email.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
+manages post retrieve steps
-**Kind**: static method of [Journey
](#Journey)
+**Kind**: static method of [Email
](#Email)
+**Returns**: TYPE.MetadataTypeItem
- Array with one metadata object and one query string
| Param | Type | Description |
| --- | --- | --- |
-| metadataMap | TYPE.MetadataTypeMap
| key=customer key, value=metadata |
+| metadata | TYPE.MetadataTypeItem
| a single query |
-
+
-### Journey.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
-manages post retrieve steps
-! BETA RELEASE of journey support (v4.3.0); it so far only resolves a limited amount of dependencies and will likely break during cross-BU deployments!
+## EmailSend ⇐ [MetadataType
](#MetadataType)
+MessageSendActivity MetadataType
-**Kind**: static method of [Journey
](#Journey)
-**Returns**: TYPE.MetadataTypeItem
- Array with one metadata object
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
-| Param | Type | Description |
-| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+* [EmailSend](#EmailSend) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#EmailSend.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.update(metadataItem)](#EmailSend.update) ⇒ Promise
+ * [.create(metadataItem)](#EmailSend.create) ⇒ Promise
+ * [.deleteByKey(customerKey)](#EmailSend.deleteByKey) ⇒ Promise.<boolean>
+ * [.preDeployTasks(metadata)](#EmailSend.preDeployTasks) ⇒ Promise.<TYPE.MetadataTypeItem>
+ * [.postRetrieveTasks(metadata)](#EmailSend.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
-
+
-### Journey.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
-prepares a TSD for deployment
-! BETA RELEASE of journey support (v4.3.0); it so far only resolves a limited amount of dependencies and will likely break during cross-BU deployments!
+### EmailSend.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
-**Kind**: static method of [Journey
](#Journey)
-**Returns**: TYPE.MetadataTypeItem
- metadata object
+**Kind**: static method of [EmailSend
](#EmailSend)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| of a single TSD |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### Journey.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate) ⇒ 'create'
\| 'update'
\| 'skip'
-helper for [upsert](#MetadataType.upsert)
+### EmailSend.update(metadataItem) ⇒ Promise
+Updates a single item
-**Kind**: static method of [Journey
](#Journey)
-**Returns**: 'create'
\| 'update'
\| 'skip'
- action to take
+**Kind**: static method of [EmailSend
](#EmailSend)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| metadataMap | TYPE.MetadataTypeMap
| list of metadata |
-| metadataKey | string
| key of item we are looking at |
-| hasError | boolean
| error flag from previous code |
-| metadataToUpdate | Array.<TYPE.MetadataTypeItemDiff>
| list of items to update |
-| metadataToCreate | Array.<TYPE.MetadataTypeItem>
| list of items to create |
-
-
-
-## List ⇐ [MetadataType
](#MetadataType)
-List MetadataType
-
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
-
-* [List](#List) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#List.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache()](#List.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.deleteByKey(customerKey)](#List.deleteByKey) ⇒ Promise.<boolean>
- * [.postRetrieveTasks(list)](#List.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
- * [.parseMetadata(metadata, [parseForCache])](#List.parseMetadata) ⇒ TYPE.MetadataTypeItem
+| metadataItem | TYPE.MetadataTypeItem
| a single item |
-
+
-### List.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of Lists
+### EmailSend.create(metadataItem) ⇒ Promise
+Creates a single item
-**Kind**: static method of [List
](#List)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+**Kind**: static method of [EmailSend
](#EmailSend)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
-
-
-
-### List.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Gets metadata cache with limited fields and does not store value to disk
+| metadataItem | TYPE.MetadataTypeItem
| a single item |
-**Kind**: static method of [List
](#List)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
-
+
-### List.deleteByKey(customerKey) ⇒ Promise.<boolean>
+### EmailSend.deleteByKey(customerKey) ⇒ Promise.<boolean>
Delete a metadata item from the specified business unit
-**Kind**: static method of [List
](#List)
+**Kind**: static method of [EmailSend
](#EmailSend)
**Returns**: Promise.<boolean>
- deletion success status
| Param | Type | Description |
| --- | --- | --- |
| customerKey | string
| Identifier of data extension |
-
+
-### List.postRetrieveTasks(list) ⇒ TYPE.MetadataTypeItem
-manages post retrieve steps
+### EmailSend.preDeployTasks(metadata) ⇒ Promise.<TYPE.MetadataTypeItem>
+prepares a single item for deployment
-**Kind**: static method of [List
](#List)
-**Returns**: TYPE.MetadataTypeItem
- metadata
+**Kind**: static method of [EmailSend
](#EmailSend)
+**Returns**: Promise.<TYPE.MetadataTypeItem>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| list | TYPE.MetadataTypeItem
| a single list |
+| metadata | TYPE.MetadataTypeItem
| a single script activity definition |
-
+
-### List.parseMetadata(metadata, [parseForCache]) ⇒ TYPE.MetadataTypeItem
-parses retrieved Metadata before saving
+### EmailSend.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
+manages post retrieve steps
-**Kind**: static method of [List
](#List)
-**Returns**: TYPE.MetadataTypeItem
- Array with one metadata object and one sql string
+**Kind**: static method of [EmailSend
](#EmailSend)
+**Returns**: TYPE.MetadataTypeItem
- Array with one metadata object and one query string
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single list definition |
-| [parseForCache] | boolean
| if set to true, the Category ID is kept |
+| metadata | TYPE.MetadataTypeItem
| a single query |
-
+
-## MetadataType
-MetadataType class that gets extended by their specific metadata type class.
-Provides default functionality that can be overwritten by child metadata type classes
+## Event ⇐ [MetadataType
](#MetadataType)
+Event MetadataType
**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
-* [MetadataType](#MetadataType)
- * [.client](#MetadataType.client) : TYPE.SDK
- * [.properties](#MetadataType.properties) : TYPE.Mcdevrc
- * [.subType](#MetadataType.subType) : string
- * [.buObject](#MetadataType.buObject) : TYPE.BuObject
- * [.getJsonFromFS(dir, [listBadKeys])](#MetadataType.getJsonFromFS) ⇒ TYPE.MetadataTypeMap
- * [.getFieldNamesToRetrieve([additionalFields], [isCaching])](#MetadataType.getFieldNamesToRetrieve) ⇒ Array.<string>
- * [.deploy(metadata, deployDir, retrieveDir)](#MetadataType.deploy) ⇒ Promise.<TYPE.MetadataTypeMap>
- * [.postDeployTasks(upsertResults, originalMetadata, createdUpdated)](#MetadataType.postDeployTasks) ⇒ void
- * [.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields)](#MetadataType.postCreateTasks) ⇒ void
- * [.postUpdateTasks(metadataEntry, apiResponse)](#MetadataType.postUpdateTasks) ⇒ void
- * [.postDeployTasks_legacyApi(metadataEntry, apiResponse)](#MetadataType.postDeployTasks_legacyApi) ⇒ Promise.<void>
- * [.postRetrieveTasks(metadata, targetDir, [isTemplating])](#MetadataType.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
- * [.setFolderPath(metadata)](#MetadataType.setFolderPath)
- * [.setFolderId(metadata)](#MetadataType.setFolderId)
- * [.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key])](#MetadataType.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveChangelog([additionalFields], [subTypeArr])](#MetadataType.retrieveChangelog) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache([additionalFields], [subTypeArr], [key])](#MetadataType.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveAsTemplate(templateDir, name, templateVariables, [subType])](#MetadataType.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
- * [.retrieveTemplateREST(templateDir, uri, templateVariables, name)](#MetadataType.retrieveTemplateREST) ⇒ Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
- * [.buildTemplate(retrieveDir, templateDir, key, templateVariables)](#MetadataType.buildTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
- * [.preDeployTasks(metadata, deployDir)](#MetadataType.preDeployTasks) ⇒ Promise.<TYPE.MetadataTypeItem>
- * [.create(metadata, deployDir)](#MetadataType.create) ⇒ void
- * [.update(metadata, [metadataBefore])](#MetadataType.update) ⇒ void
- * [.refresh()](#MetadataType.refresh) ⇒ void
- * [.execute()](#MetadataType.execute) ⇒ void
- * [.pause()](#MetadataType.pause) ⇒ void
- * [.hasChanged(cachedVersion, metadata, [fieldName])](#MetadataType.hasChanged) ⇒ boolean
- * [.hasChangedGeneric(cachedVersion, metadata, [fieldName], [silent])](#MetadataType.hasChangedGeneric) ⇒ boolean
- * [.upsert(metadataMap, deployDir)](#MetadataType.upsert) ⇒ Promise.<TYPE.MetadataTypeMap>
- * [.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate)](#MetadataType.createOrUpdate) ⇒ 'create'
\| 'update'
\| 'skip'
- * [.createREST(metadataEntry, uri)](#MetadataType.createREST) ⇒ Promise.<object>
\| null
- * [.createSOAP(metadataEntry, [handleOutside])](#MetadataType.createSOAP) ⇒ Promise.<object>
\| null
- * [.updateREST(metadataEntry, uri, [httpMethod])](#MetadataType.updateREST) ⇒ Promise.<object>
\| null
- * [.updateSOAP(metadataEntry, [handleOutside])](#MetadataType.updateSOAP) ⇒ Promise.<object>
\| null
- * [._handleSOAPErrors(ex, msg, [metadataEntry], [handleOutside])](#MetadataType._handleSOAPErrors)
- * [.getSOAPErrorMsg(ex)](#MetadataType.getSOAPErrorMsg) ⇒ string
- * [.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields])](#MetadataType.retrieveSOAP) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveREST(retrieveDir, uri, [templateVariables], [singleRetrieve])](#MetadataType.retrieveREST) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
- * [.retrieveRESTcollection(urlArray, [concurrentRequests], [logAmountOfUrls])](#MetadataType.retrieveRESTcollection) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
- * [.handleRESTErrors(ex, id)](#MetadataType.handleRESTErrors) ⇒ null
- * [.executeREST(uri, key)](#MetadataType.executeREST) ⇒ Promise.<{key:string, response:string}>
- * [.executeSOAP([metadataEntry])](#MetadataType.executeSOAP) ⇒ Promise.<{key:string, response:object}>
- * [.runDocumentOnRetrieve([singleRetrieve], metadataMap)](#MetadataType.runDocumentOnRetrieve) ⇒ Promise.<void>
- * [.parseResponseBody(body, [singleRetrieve])](#MetadataType.parseResponseBody) ⇒ TYPE.MetadataTypeMap
- * [.deleteFieldByDefinition(metadataEntry, fieldPath, definitionProperty, origin)](#MetadataType.deleteFieldByDefinition) ⇒ void
- * [.removeNotCreateableFields(metadataEntry)](#MetadataType.removeNotCreateableFields) ⇒ void
- * [.removeNotUpdateableFields(metadataEntry)](#MetadataType.removeNotUpdateableFields) ⇒ void
- * [.keepTemplateFields(metadataEntry)](#MetadataType.keepTemplateFields) ⇒ void
- * [.keepRetrieveFields(metadataEntry)](#MetadataType.keepRetrieveFields) ⇒ void
- * [.isFiltered(metadataEntry, [include])](#MetadataType.isFiltered) ⇒ boolean
- * [.isFilteredFolder(metadataEntry, [include])](#MetadataType.isFilteredFolder) ⇒ boolean
- * [.saveResults(results, retrieveDir, [overrideType], [templateVariables])](#MetadataType.saveResults) ⇒ Promise.<TYPE.MetadataTypeMap>
- * [.applyTemplateValues(code, templateVariables)](#MetadataType.applyTemplateValues) ⇒ string
- * [.applyTemplateNames(code, templateVariables)](#MetadataType.applyTemplateNames) ⇒ string
- * [.buildDefinitionForNested(templateDir, targetDir, metadata, variables, templateName)](#MetadataType.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#MetadataType.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [.findSubType(templateDir, templateName)](#MetadataType.findSubType) ⇒ Promise.<string>
- * [.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName, ex)](#MetadataType.readSecondaryFolder) ⇒ object
- * [.buildDefinition(templateDir, targetDir, templateName, variables)](#MetadataType.buildDefinition) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.getErrorsREST(ex)](#MetadataType.getErrorsREST) ⇒ Array.<string>
\| void
- * [.document([metadata], [isDeploy])](#MetadataType.document) ⇒ void
- * [.deleteByKey(customerKey)](#MetadataType.deleteByKey) ⇒ boolean
- * [.postDeleteTasks(customerKey, [additionalExtensions])](#MetadataType.postDeleteTasks) ⇒ Promise.<void>
- * [.deleteByKeySOAP(customerKey, [overrideKeyField], [handleOutside])](#MetadataType.deleteByKeySOAP) ⇒ Promise.<boolean>
- * [.deleteByKeyREST(url, key, [handleOutside])](#MetadataType.deleteByKeyREST) ⇒ Promise.<boolean>
- * [.readBUMetadataForType(readDir, [listBadKeys], [buMetadata])](#MetadataType.readBUMetadataForType) ⇒ object
- * [.getFilesToCommit(keyArr)](#MetadataType.getFilesToCommit) ⇒ Promise.<Array.<string>>
- * [.getKeysForFixing(metadataMap)](#MetadataType.getKeysForFixing) ⇒ Array.<string>
-
-
-
-### MetadataType.client : TYPE.SDK
-**Kind**: static property of [MetadataType
](#MetadataType)
-
-
-### MetadataType.properties : TYPE.Mcdevrc
-**Kind**: static property of [MetadataType
](#MetadataType)
-
-
-### MetadataType.subType : string
-**Kind**: static property of [MetadataType
](#MetadataType)
-
+* [Event](#Event) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#Event.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache()](#Event.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables)](#Event.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+ * [.postRetrieveTasks(eventDef)](#Event.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+ * [.deleteByKey(key)](#Event.deleteByKey) ⇒ Promise.<boolean>
+ * [.deploy(metadata, deployDir, retrieveDir)](#Event.deploy) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.create(metadata)](#Event.create) ⇒ Promise
+ * [.update(metadataEntry)](#Event.update) ⇒ Promise
+ * [.preDeployTasks(metadata)](#Event.preDeployTasks) ⇒ TYPE.MetadataTypeItem
+ * [.parseMetadata(metadata)](#Event.parseMetadata) ⇒ TYPE.MetadataTypeItem
-### MetadataType.buObject : TYPE.BuObject
-**Kind**: static property of [MetadataType
](#MetadataType)
-
+
-### MetadataType.getJsonFromFS(dir, [listBadKeys]) ⇒ TYPE.MetadataTypeMap
-Returns file contents mapped to their filename without '.json' ending
+### Event.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of Event Definition.
+Endpoint /interaction/v1/EventDefinitions return all Event Definitions with all details.
+Currently it is not needed to loop over Imports with endpoint /interaction/v1/EventDefinitions/{id}
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: TYPE.MetadataTypeMap
- fileName => fileContent map
+**Kind**: static method of [Event
](#Event)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
| Param | Type | Description |
| --- | --- | --- |
-| dir | string
| directory that contains '.json' files to be read |
-| [listBadKeys] | boolean
| do not print errors, used for badKeys() |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### MetadataType.getFieldNamesToRetrieve([additionalFields], [isCaching]) ⇒ Array.<string>
-Returns fieldnames of Metadata Type. 'this.definition.fields' variable only set in child classes.
+### Event.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves event definition metadata for caching
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Array.<string>
- Fieldnames
+**Kind**: static method of [Event
](#Event)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+
+### Event.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+Retrieve a specific Event Definition by Name
+
+**Kind**: static method of [Event
](#Event)
+**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- Promise of metadata
| Param | Type | Description |
| --- | --- | --- |
-| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-| [isCaching] | boolean
| if true, then check if field should be skipped for caching |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| name | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### MetadataType.deploy(metadata, deployDir, retrieveDir) ⇒ Promise.<TYPE.MetadataTypeMap>
-Deploys metadata
+### Event.postRetrieveTasks(eventDef) ⇒ TYPE.MetadataTypeItem
+manages post retrieve steps
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of keyField => metadata map
+**Kind**: static method of [Event
](#Event)
+**Returns**: TYPE.MetadataTypeItem
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
-| deployDir | string
| directory where deploy metadata are saved |
-| retrieveDir | string
| directory where metadata after deploy should be saved |
+| eventDef | TYPE.MetadataTypeItem
| a single item of Event Definition |
-
+
-### MetadataType.postDeployTasks(upsertResults, originalMetadata, createdUpdated) ⇒ void
-Gets executed after deployment of metadata type
+### Event.deleteByKey(key) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
-**Kind**: static method of [MetadataType
](#MetadataType)
+**Kind**: static method of [Event
](#Event)
+**Returns**: Promise.<boolean>
- deletion success status
| Param | Type | Description |
| --- | --- | --- |
-| upsertResults | TYPE.MetadataTypeMap
| metadata mapped by their keyField as returned by update/create |
-| originalMetadata | TYPE.MetadataTypeMap
| metadata to be updated (contains additioanl fields) |
-| createdUpdated | Object
| counter representing successful creates/updates |
+| key | string
| Identifier of item |
-
+
-### MetadataType.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields) ⇒ void
-helper for [createREST](#MetadataType.createREST)
+### Event.deploy(metadata, deployDir, retrieveDir) ⇒ Promise.<TYPE.MetadataTypeMap>
+Deploys metadata - merely kept here to be able to print [logBeta](#Util.logBeta) once per deploy
-**Kind**: static method of [MetadataType
](#MetadataType)
+**Kind**: static method of [Event
](#Event)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of keyField => metadata map
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
-| apiResponse | object
| varies depending on the API call |
-| metadataEntryWithAllFields | TYPE.MetadataTypeItem
| like metadataEntry but before non-creatable fields were stripped |
+| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| deployDir | string
| directory where deploy metadata are saved |
+| retrieveDir | string
| directory where metadata after deploy should be saved |
-
+
-### MetadataType.postUpdateTasks(metadataEntry, apiResponse) ⇒ void
-helper for [updateREST](#MetadataType.updateREST)
+### Event.create(metadata) ⇒ Promise
+Creates a single Event Definition
-**Kind**: static method of [MetadataType
](#MetadataType)
+**Kind**: static method of [Event
](#Event)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
-| apiResponse | object
| varies depending on the API call |
+| metadata | TYPE.MetadataTypeItem
| a single Event Definition |
-
+
-### MetadataType.postDeployTasks\_legacyApi(metadataEntry, apiResponse) ⇒ Promise.<void>
-helper for [createREST](#MetadataType.createREST) when legacy API endpoints as these do not return the created item but only their new id
+### Event.update(metadataEntry) ⇒ Promise
+Updates a single Event Definition (using PUT method since PATCH isn't supported)
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<void>
- -
+**Kind**: static method of [Event
](#Event)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
-| apiResponse | object
| varies depending on the API call |
+| metadataEntry | TYPE.MetadataTypeItem
| a single Event Definition |
-
+
-### MetadataType.postRetrieveTasks(metadata, targetDir, [isTemplating]) ⇒ TYPE.MetadataTypeItem
-Gets executed after retreive of metadata type
+### Event.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
+prepares an event definition for deployment
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: TYPE.MetadataTypeItem
- cloned metadata
+**Kind**: static method of [Event
](#Event)
+**Returns**: TYPE.MetadataTypeItem
- parsed version
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
-| targetDir | string
| folder where retrieves should be saved |
-| [isTemplating] | boolean
| signals that we are retrieving templates |
+| metadata | TYPE.MetadataTypeItem
| a single eventDefinition |
-
+
-### MetadataType.setFolderPath(metadata)
-generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
+### Event.parseMetadata(metadata) ⇒ TYPE.MetadataTypeItem
+parses retrieved Metadata before saving
-**Kind**: static method of [MetadataType
](#MetadataType)
+**Kind**: static method of [Event
](#Event)
+**Returns**: TYPE.MetadataTypeItem
- parsed metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| metadata | TYPE.MetadataTypeItem
| a single event definition |
-
+
-### MetadataType.setFolderId(metadata)
-generic script that retrieves the folder ID from cache and updates the given metadata with it before deploy
+## FtpLocation ⇐ [MetadataType
](#MetadataType)
+ImportFile MetadataType
-**Kind**: static method of [MetadataType
](#MetadataType)
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
-| Param | Type | Description |
-| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+* [FtpLocation](#FtpLocation) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#FtpLocation.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache()](#FtpLocation.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-
+
-### MetadataType.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Gets metadata from Marketing Cloud
+### FtpLocation.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of FtpLocation
+Endpoint /automation/v1/ftplocations/ return all FtpLocations
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
+**Kind**: static method of [FtpLocation
](#FtpLocation)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
| Param | Type | Description |
| --- | --- | --- |
| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
| [key] | string
| customer key of single item to retrieve |
-
+
-### MetadataType.retrieveChangelog([additionalFields], [subTypeArr]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Gets metadata from Marketing Cloud
+### FtpLocation.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves folder metadata into local filesystem. Also creates a uniquePath attribute for each folder.
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
+**Kind**: static method of [FtpLocation
](#FtpLocation)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+
-| Param | Type | Description |
-| --- | --- | --- |
-| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+## FileTransfer ⇐ [MetadataType
](#MetadataType)
+FileTransfer MetadataType
-
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
-### MetadataType.retrieveForCache([additionalFields], [subTypeArr], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Gets metadata cache with limited fields and does not store value to disk
+* [FileTransfer](#FileTransfer) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#FileTransfer.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache()](#FileTransfer.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables)](#FileTransfer.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+ * [.create(fileTransfer)](#FileTransfer.create) ⇒ Promise
+ * [.update(fileTransfer)](#FileTransfer.update) ⇒ Promise
+ * [.preDeployTasks(metadata)](#FileTransfer.preDeployTasks) ⇒ Promise
+ * [.postRetrieveTasks(metadata)](#FileTransfer.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+ * [.deleteByKey(customerKey)](#FileTransfer.deleteByKey) ⇒ Promise.<boolean>
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
+
+
+### FileTransfer.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of FileTransfer Activity.
+Endpoint /automation/v1/filetransfers/ returns all File Transfers
+
+**Kind**: static method of [FileTransfer
](#FileTransfer)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
| [key] | string
| customer key of single item to retrieve |
-
+
-### MetadataType.retrieveAsTemplate(templateDir, name, templateVariables, [subType]) ⇒ Promise.<TYPE.MetadataTypeItemObj>
-Gets metadata cache with limited fields and does not store value to disk
+### FileTransfer.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of FileTransfer Activity for caching
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- metadata
+**Kind**: static method of [FileTransfer
](#FileTransfer)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+
+
+### FileTransfer.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+Retrieve a specific File Transfer Definition by Name
+
+**Kind**: static method of [FileTransfer
](#FileTransfer)
+**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- Promise
| Param | Type | Description |
| --- | --- | --- |
| templateDir | string
| Directory where retrieved metadata directory will be saved |
| name | string
| name of the metadata file |
| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| [subType] | string
| optionally limit to a single subtype |
-
+
-### MetadataType.retrieveTemplateREST(templateDir, uri, templateVariables, name) ⇒ Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
-Retrieve a specific Script by Name
+### FileTransfer.create(fileTransfer) ⇒ Promise
+Creates a single File Transfer
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
- Promise
+**Kind**: static method of [FileTransfer
](#FileTransfer)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where retrieved metadata directory will be saved |
-| uri | string
| rest endpoint for GET |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| name | string
| name (not key) of the metadata item |
+| fileTransfer | TYPE.MetadataTypeItem
| a single File Transfer |
-
+
-### MetadataType.buildTemplate(retrieveDir, templateDir, key, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
-Gets metadata cache with limited fields and does not store value to disk
+### FileTransfer.update(fileTransfer) ⇒ Promise
+Updates a single File Transfer
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- single metadata
+**Kind**: static method of [FileTransfer
](#FileTransfer)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| templateDir | string
| (List of) Directory where built definitions will be saved |
-| key | string
| name of the metadata file |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| fileTransfer | TYPE.MetadataTypeItem
| a single File Transfer |
-
+
-### MetadataType.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.MetadataTypeItem>
-Gets executed before deploying metadata
+### FileTransfer.preDeployTasks(metadata) ⇒ Promise
+prepares a fileTransfer for deployment
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<TYPE.MetadataTypeItem>
- Promise of a single metadata item
+**Kind**: static method of [FileTransfer
](#FileTransfer)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single metadata item |
-| deployDir | string
| folder where files for deployment are stored |
+| metadata | TYPE.MetadataTypeItem
| a single fileTransfer activity definition |
-
+
-### MetadataType.create(metadata, deployDir) ⇒ void
-Abstract create method that needs to be implemented in child metadata type
+### FileTransfer.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
+manages post retrieve steps
-**Kind**: static method of [MetadataType
](#MetadataType)
+**Kind**: static method of [FileTransfer
](#FileTransfer)
+**Returns**: TYPE.MetadataTypeItem
- parsed metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| single metadata entry |
-| deployDir | string
| directory where deploy metadata are saved |
+| metadata | TYPE.MetadataTypeItem
| a single fileTransfer activity definition |
-
+
-### MetadataType.update(metadata, [metadataBefore]) ⇒ void
-Abstract update method that needs to be implemented in child metadata type
+### FileTransfer.deleteByKey(customerKey) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
-**Kind**: static method of [MetadataType
](#MetadataType)
+**Kind**: static method of [FileTransfer
](#FileTransfer)
+**Returns**: Promise.<boolean>
- deletion success flag
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| single metadata entry |
-| [metadataBefore] | TYPE.MetadataTypeItem
| metadata mapped by their keyField |
+| customerKey | string
| Identifier of data extension |
-
+
-### MetadataType.refresh() ⇒ void
-Abstract refresh method that needs to be implemented in child metadata type
+## Filter ⇐ [MetadataType
](#MetadataType)
+Filter MetadataType
-**Kind**: static method of [MetadataType
](#MetadataType)
-
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
-### MetadataType.execute() ⇒ void
-Abstract execute method that needs to be implemented in child metadata type
+### Filter.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of Filter.
+Endpoint /automation/v1/filters/ returns all Filters,
+but only with some of the fields. So it is needed to loop over
+Filters with the endpoint /automation/v1/filters/{id}
-**Kind**: static method of [MetadataType
](#MetadataType)
-
+**Kind**: static method of [Filter
](#Filter)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
-### MetadataType.pause() ⇒ void
-Abstract pause method that needs to be implemented in child metadata type
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-**Kind**: static method of [MetadataType
](#MetadataType)
-
+
-### MetadataType.hasChanged(cachedVersion, metadata, [fieldName]) ⇒ boolean
-test if metadata was actually changed or not to potentially skip it during deployment
+## Folder ⇐ [MetadataType
](#MetadataType)
+Folder MetadataType
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: boolean
- true if metadata was changed
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
-| Param | Type | Description |
-| --- | --- | --- |
-| cachedVersion | TYPE.MetadataTypeItem
| cached version from the server |
-| metadata | TYPE.MetadataTypeItem
| item to upload |
-| [fieldName] | string
| optional field name to use for identifying the record in logs |
+* [Folder](#Folder) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key])](#Folder.retrieve) ⇒ Promise
+ * [.retrieveForCache([_], [subTypeArr])](#Folder.retrieveForCache) ⇒ Promise
+ * [.upsert(metadata)](#Folder.upsert) ⇒ Promise.<object>
+ * [.create(metadataEntry)](#Folder.create) ⇒ Promise
+ * [.update(metadataEntry)](#Folder.update) ⇒ Promise
+ * [.preDeployTasks(metadata)](#Folder.preDeployTasks) ⇒ Promise.<TYPE.MetadataTypeItem>
+ * [.getJsonFromFS(dir, [listBadKeys])](#Folder.getJsonFromFS) ⇒ TYPE.MetadataTypeMap
+ * [.retrieveHelper([additionalFields], [queryAllAccounts], [contentTypeList])](#Folder.retrieveHelper) ⇒ Promise.<object>
+ * [.postRetrieveTasks(metadata)](#Folder.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+ * [.saveResults(results, retrieveDir, mid)](#Folder.saveResults) ⇒ Promise.<object>
-
+
-### MetadataType.hasChangedGeneric(cachedVersion, metadata, [fieldName], [silent]) ⇒ boolean
-test if metadata was actually changed or not to potentially skip it during deployment
+### Folder.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key]) ⇒ Promise
+Retrieves metadata of metadata type into local filesystem. executes callback with retrieved metadata
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: boolean
- true on first identified deviation or false if none are found
+**Kind**: static method of [Folder
](#Folder)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| cachedVersion | TYPE.MetadataTypeItem
| cached version from the server |
-| metadata | TYPE.MetadataTypeItem
| item to upload |
-| [fieldName] | string
| optional field name to use for identifying the record in logs |
-| [silent] | boolean
| optionally suppress logging |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [subTypeArr] | Array.<string>
| content type of folder |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### MetadataType.upsert(metadataMap, deployDir) ⇒ Promise.<TYPE.MetadataTypeMap>
-MetadataType upsert, after retrieving from target and comparing to check if create or update operation is needed.
+### Folder.retrieveForCache([_], [subTypeArr]) ⇒ Promise
+Retrieves folder metadata for caching
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<TYPE.MetadataTypeMap>
- keyField => metadata map
+**Kind**: static method of [Folder
](#Folder)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| metadataMap | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
-| deployDir | string
| directory where deploy metadata are saved |
+| [_] | void
| parameter not used |
+| [subTypeArr] | Array.<string>
| content type of folder |
-
+
-### MetadataType.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate) ⇒ 'create'
\| 'update'
\| 'skip'
-helper for [upsert](#MetadataType.upsert)
+### Folder.upsert(metadata) ⇒ Promise.<object>
+Folder upsert (copied from Metadata Upsert), after retrieving from target
+and comparing to check if create or update operation is needed.
+Copied due to having a dependency on itself, meaning the created need to be serial
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: 'create'
\| 'update'
\| 'skip'
- action to take
+**Kind**: static method of [Folder
](#Folder)
+**Returns**: Promise.<object>
- Promise of saved metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadataMap | TYPE.MetadataTypeMap
| list of metadata |
-| metadataKey | string
| key of item we are looking at |
-| hasError | boolean
| error flag from previous code |
-| metadataToUpdate | Array.<TYPE.MetadataTypeItemDiff>
| list of items to update |
-| metadataToCreate | Array.<TYPE.MetadataTypeItem>
| list of items to create |
+| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
-
+
-### MetadataType.createREST(metadataEntry, uri) ⇒ Promise.<object>
\| null
-Creates a single metadata entry via REST
+### Folder.create(metadataEntry) ⇒ Promise
+creates a folder based on metatadata
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
+**Kind**: static method of [Folder
](#Folder)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
-| uri | string
| rest endpoint for POST |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata of the folder |
-
+
-### MetadataType.createSOAP(metadataEntry, [handleOutside]) ⇒ Promise.<object>
\| null
-Creates a single metadata entry via fuel-soap (generic lib not wrapper)
+### Folder.update(metadataEntry) ⇒ Promise
+Updates a single Folder.
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
+**Kind**: static method of [Folder
](#Folder)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
| metadataEntry | TYPE.MetadataTypeItem
| single metadata entry |
-| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
-
-
-### MetadataType.updateREST(metadataEntry, uri, [httpMethod]) ⇒ Promise.<object>
\| null
-Updates a single metadata entry via REST
-
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
-
-| Param | Type | Default | Description |
-| --- | --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| | a single metadata Entry |
-| uri | string
| | rest endpoint for PATCH |
-| [httpMethod] | 'patch'
\| 'post'
\| 'put'
| patch
| defaults to 'patch'; some update requests require PUT instead of PATCH |
-
-
+
-### MetadataType.updateSOAP(metadataEntry, [handleOutside]) ⇒ Promise.<object>
\| null
-Updates a single metadata entry via fuel-soap (generic lib not wrapper)
+### Folder.preDeployTasks(metadata) ⇒ Promise.<TYPE.MetadataTypeItem>
+prepares a folder for deployment
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
+**Kind**: static method of [Folder
](#Folder)
+**Returns**: Promise.<TYPE.MetadataTypeItem>
- Promise of parsed folder metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| single metadata entry |
-| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
+| metadata | TYPE.MetadataTypeItem
| a single folder definition |
-
+
-### MetadataType.\_handleSOAPErrors(ex, msg, [metadataEntry], [handleOutside])
-**Kind**: static method of [MetadataType
](#MetadataType)
+### Folder.getJsonFromFS(dir, [listBadKeys]) ⇒ TYPE.MetadataTypeMap
+Returns file contents mapped to their filename without '.json' ending
+
+**Kind**: static method of [Folder
](#Folder)
+**Returns**: TYPE.MetadataTypeMap
- fileName => fileContent map
| Param | Type | Description |
| --- | --- | --- |
-| ex | Error
| error that occured |
-| msg | 'creating'
\| 'updating'
| what to print in the log |
-| [metadataEntry] | TYPE.MetadataTypeItem
| single metadata entry |
-| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
+| dir | string
| directory that contains '.json' files to be read |
+| [listBadKeys] | boolean
| do not print errors, used for badKeys() |
-
+
-### MetadataType.getSOAPErrorMsg(ex) ⇒ string
-helper for [_handleSOAPErrors](#MetadataType._handleSOAPErrors)
+### Folder.retrieveHelper([additionalFields], [queryAllAccounts], [contentTypeList]) ⇒ Promise.<object>
+Helper to retrieve the folders as promise
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: string
- error message
+**Kind**: static method of [Folder
](#Folder)
+**Returns**: Promise.<object>
- soap object
| Param | Type | Description |
| --- | --- | --- |
-| ex | Error
| error that occured |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [queryAllAccounts] | boolean
| which queryAllAccounts setting to use |
+| [contentTypeList] | Array.<string>
| content type of folder |
-
+
-### MetadataType.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves SOAP via generic fuel-soap wrapper based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+### Folder.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
+Gets executed after retreive of metadata type
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of item map
+**Kind**: static method of [Folder
](#Folder)
+**Returns**: TYPE.MetadataTypeItem
- cloned metadata
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [requestParams] | TYPE.SoapRequestParams
| required for the specific request (filter for example) |
-| [singleRetrieve] | string
\| number
| key of single item to filter by |
-| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| metadata | TYPE.MetadataTypeItem
| metadata mapped by their keyField |
-
+
-### MetadataType.retrieveREST(retrieveDir, uri, [templateVariables], [singleRetrieve]) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
-Retrieves Metadata for Rest Types
+### Folder.saveResults(results, retrieveDir, mid) ⇒ Promise.<object>
+Helper for writing Metadata to disk, used for Retrieve and deploy
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
- Promise of item map (single item for templated result)
+**Kind**: static method of [Folder
](#Folder)
+**Returns**: Promise.<object>
- Promise of saved metadata
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| uri | string
| rest endpoint for GET |
-| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| [singleRetrieve] | string
\| number
| key of single item to filter by |
+| results | object
| metadata results from deploy |
+| retrieveDir | string
| directory where metadata should be stored after deploy/retrieve |
+| mid | number
| current mid for this credential / business unit |
-
+
-### MetadataType.retrieveRESTcollection(urlArray, [concurrentRequests], [logAmountOfUrls]) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
- Promise of item map (single item for templated result)
+## ImportFile ⇐ [MetadataType
](#MetadataType)
+ImportFile MetadataType
-| Param | Type | Default | Description |
-| --- | --- | --- | --- |
-| urlArray | Array.<object>
| | {uri: string, id: string} combo of URL and ID/key of metadata |
-| [concurrentRequests] | number
| 10
| optionally set a different amount of concurrent requests |
-| [logAmountOfUrls] | boolean
| true
| if true, prints an info message about to-be loaded amount of metadata |
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
-
+* [ImportFile](#ImportFile) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#ImportFile.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache([_], [__], [key])](#ImportFile.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables)](#ImportFile.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+ * [.create(importFile)](#ImportFile.create) ⇒ Promise
+ * [.update(importFile)](#ImportFile.update) ⇒ Promise
+ * [.deploy(metadataMap, deployDir, retrieveDir)](#ImportFile.deploy) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.preDeployTasks(metadata)](#ImportFile.preDeployTasks) ⇒ Promise
+ * [.postRetrieveTasks(metadata)](#ImportFile.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+ * [.deleteByKey(customerKey)](#ImportFile.deleteByKey) ⇒ Promise.<boolean>
-### MetadataType.handleRESTErrors(ex, id) ⇒ null
-helper for [this.retrieveRESTcollection](this.retrieveRESTcollection)
+
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: null
- -
+### ImportFile.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of Import File.
+Endpoint /automation/v1/imports/ return all Import Files with all details.
+Currently it is not needed to loop over Imports with endpoint /automation/v1/imports/{id}
+
+**Kind**: static method of [ImportFile
](#ImportFile)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| ex | Error
| exception |
-| id | string
| id or key of item |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### MetadataType.executeREST(uri, key) ⇒ Promise.<{key:string, response:string}>
-Used to execute a query/automation etc.
+### ImportFile.retrieveForCache([_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves import definition metadata for caching
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<{key:string, response:string}>
- metadata key and API response (OK or error)
+**Kind**: static method of [ImportFile
](#ImportFile)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| uri | string
| REST endpoint where the POST request should be sent |
-| key | string
| item key |
+| [_] | void
| parameter not used |
+| [__] | void
| parameter not used |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### MetadataType.executeSOAP([metadataEntry]) ⇒ Promise.<{key:string, response:object}>
-Used to execute a query/automation etc.
+### ImportFile.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+Retrieve a specific Import Definition by Name
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<{key:string, response:object}>
- metadata key and API response
+**Kind**: static method of [ImportFile
](#ImportFile)
+**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| [metadataEntry] | TYPE.MetadataTypeItem
| single metadata entry |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| name | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### MetadataType.runDocumentOnRetrieve([singleRetrieve], metadataMap) ⇒ Promise.<void>
-helper for [retrieveREST](#MetadataType.retrieveREST) and [retrieveSOAP](#MetadataType.retrieveSOAP)
+### ImportFile.create(importFile) ⇒ Promise
+Creates a single Import File
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<void>
- -
+**Kind**: static method of [ImportFile
](#ImportFile)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| [singleRetrieve] | string
\| number
| key of single item to filter by |
-| metadataMap | TYPE.MetadataTypeMap
| saved metadata |
+| importFile | TYPE.MetadataTypeItem
| a single Import File |
-
+
-### MetadataType.parseResponseBody(body, [singleRetrieve]) ⇒ TYPE.MetadataTypeMap
-Builds map of metadata entries mapped to their keyfields
+### ImportFile.update(importFile) ⇒ Promise
+Updates a single Import File
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: TYPE.MetadataTypeMap
- keyField => metadata map
+**Kind**: static method of [ImportFile
](#ImportFile)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| body | object
| json of response body |
-| [singleRetrieve] | string
\| number
| key of single item to filter by |
+| importFile | TYPE.MetadataTypeItem
| a single Import File |
-
+
-### MetadataType.deleteFieldByDefinition(metadataEntry, fieldPath, definitionProperty, origin) ⇒ void
-Deletes a field in a metadata entry if the selected definition property equals false.
+### ImportFile.deploy(metadataMap, deployDir, retrieveDir) ⇒ Promise.<TYPE.MetadataTypeMap>
+Deploys metadata
-**Kind**: static method of [MetadataType
](#MetadataType)
+**Kind**: static method of [ImportFile
](#ImportFile)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of keyField => metadata map
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| One entry of a metadataType |
-| fieldPath | string
| field path to be checked if it conforms to the definition (dot seperated if nested): 'fuu.bar' |
-| definitionProperty | 'isCreateable'
\| 'isUpdateable'
\| 'retrieving'
\| 'templating'
| delete field if definitionProperty equals false for specified field. Options: [isCreateable | isUpdateable] |
-| origin | string
| string of parent object, required when using arrays as these are parsed slightly differently. |
+| metadataMap | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| deployDir | string
| directory where deploy metadata are saved |
+| retrieveDir | string
| directory where metadata after deploy should be saved |
-**Example**
-```js
-Removes field (or nested fields childs) that are not updateable
-deleteFieldByDefinition(metadataEntry, 'CustomerKey', 'isUpdateable');
-```
-
+
-### MetadataType.removeNotCreateableFields(metadataEntry) ⇒ void
-Remove fields from metadata entry that are not createable
+### ImportFile.preDeployTasks(metadata) ⇒ Promise
+prepares a import definition for deployment
-**Kind**: static method of [MetadataType
](#MetadataType)
+**Kind**: static method of [ImportFile
](#ImportFile)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+| metadata | TYPE.MetadataTypeItem
| a single importDef |
-
+
-### MetadataType.removeNotUpdateableFields(metadataEntry) ⇒ void
-Remove fields from metadata entry that are not updateable
+### ImportFile.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
+manages post retrieve steps
-**Kind**: static method of [MetadataType
](#MetadataType)
+**Kind**: static method of [ImportFile
](#ImportFile)
+**Returns**: TYPE.MetadataTypeItem
- parsed metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-### MetadataType.keepTemplateFields(metadataEntry) ⇒ void
-Remove fields from metadata entry that are not needed in the template
+### ImportFile.deleteByKey(customerKey) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
-**Kind**: static method of [MetadataType
](#MetadataType)
+**Kind**: static method of [ImportFile
](#ImportFile)
+**Returns**: Promise.<boolean>
- deletion success flag
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
-
-
+| customerKey | string
| Identifier of data extension |
-### MetadataType.keepRetrieveFields(metadataEntry) ⇒ void
-Remove fields from metadata entry that are not needed in the stored metadata
+
-**Kind**: static method of [MetadataType
](#MetadataType)
+## Journey ⇐ [MetadataType
](#MetadataType)
+Journey MetadataType
+! BETA RELEASE of journey support (v4.3.0); it so far only resolves a limited amount of dependencies and will likely break during cross-BU deployments!
+id: A unique id of the journey assigned by the journey’s API during its creation
+key: A unique id of the journey within the MID. Can be generated by the developer
+definitionId: A unique UUID provided by Salesforce Marketing Cloud. Each version of a journey has a unique DefinitionID while the Id and Key remain the same. Version 1 will have id == definitionId
-| Param | Type | Description |
-| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
-
+* [Journey](#Journey) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#Journey.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.deleteByKey(key)](#Journey.deleteByKey) ⇒ Promise.<boolean>
+ * [.deploy(metadata, deployDir, retrieveDir)](#Journey.deploy) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.update(metadata)](#Journey.update) ⇒ Promise
+ * [.create(metadata)](#Journey.create) ⇒ Promise
+ * [.saveResults(results, retrieveDir, [overrideType], [templateVariables])](#Journey.saveResults) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [._postRetrieveTasksBulk(metadataMap)](#Journey._postRetrieveTasksBulk)
+ * [.postRetrieveTasks(metadata)](#Journey.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+ * [.preDeployTasks(metadata)](#Journey.preDeployTasks) ⇒ TYPE.MetadataTypeItem
+ * [.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate)](#Journey.createOrUpdate) ⇒ 'create'
\| 'update'
\| 'skip'
-### MetadataType.isFiltered(metadataEntry, [include]) ⇒ boolean
-checks if the current metadata entry should be saved on retrieve or not
+
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: boolean
- true: skip saving == filtered; false: continue with saving
+### Journey.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of Journey
+
+**Kind**: static method of [Journey
](#Journey)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
-| [include] | boolean
| true: use definition.include / options.include; false=exclude: use definition.filter / options.exclude |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### MetadataType.isFilteredFolder(metadataEntry, [include]) ⇒ boolean
-optionally filter by what folder something is in
+### Journey.deleteByKey(key) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: boolean
- true: filtered == do NOT save; false: not filtered == do save
+**Kind**: static method of [Journey
](#Journey)
+**Returns**: Promise.<boolean>
- deletion success status
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | object
| metadata entry |
-| [include] | boolean
| true: use definition.include / options.include; false=exclude: use definition.filter / options.exclude |
+| key | string
| Identifier of item |
-
+
-### MetadataType.saveResults(results, retrieveDir, [overrideType], [templateVariables]) ⇒ Promise.<TYPE.MetadataTypeMap>
-Helper for writing Metadata to disk, used for Retrieve and deploy
+### Journey.deploy(metadata, deployDir, retrieveDir) ⇒ Promise.<TYPE.MetadataTypeMap>
+Deploys metadata - merely kept here to be able to print [logBeta](#Util.logBeta) once per deploy
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of saved metadata
+**Kind**: static method of [Journey
](#Journey)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of keyField => metadata map
| Param | Type | Description |
| --- | --- | --- |
-| results | TYPE.MetadataTypeMap
| metadata results from deploy |
-| retrieveDir | string
| directory where metadata should be stored after deploy/retrieve |
-| [overrideType] | string
| for use when there is a subtype (such as folder-queries) |
-| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| deployDir | string
| directory where deploy metadata are saved |
+| retrieveDir | string
| directory where metadata after deploy should be saved |
-
+
-### MetadataType.applyTemplateValues(code, templateVariables) ⇒ string
-helper for [buildDefinitionForNested](#MetadataType.buildDefinitionForNested)
-searches extracted file for template variable names and applies the market values
+### Journey.update(metadata) ⇒ Promise
+Updates a single item
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: string
- code with markets applied
+**Kind**: static method of [Journey
](#Journey)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| code | string
| code from extracted code |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-### MetadataType.applyTemplateNames(code, templateVariables) ⇒ string
-helper for [buildTemplateForNested](#MetadataType.buildTemplateForNested)
-searches extracted file for template variable values and applies the market variable names
+### Journey.create(metadata) ⇒ Promise
+Creates a single item
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: string
- code with markets applied
+**Kind**: static method of [Journey
](#Journey)
+**Returns**: Promise
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| code | string
| code from extracted code |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-### MetadataType.buildDefinitionForNested(templateDir, targetDir, metadata, variables, templateName) ⇒ Promise.<Array.<Array.<string>>>
-helper for [buildDefinition](#MetadataType.buildDefinition)
-handles extracted code if any are found for complex types (e.g script, asset, query)
+### Journey.saveResults(results, retrieveDir, [overrideType], [templateVariables]) ⇒ Promise.<TYPE.MetadataTypeMap>
+Helper for writing Metadata to disk, used for Retrieve and deploy
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+**Kind**: static method of [Journey
](#Journey)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of saved metadata
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
| Directory where built definitions will be saved |
-| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
-| variables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
+| results | TYPE.MetadataTypeMap
| metadata results from deploy |
+| retrieveDir | string
| directory where metadata should be stored after deploy/retrieve |
+| [overrideType] | string
| for use when there is a subtype (such as folder-queries) |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### MetadataType.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
-helper for [buildTemplate](#MetadataType.buildTemplate)
-handles extracted code if any are found for complex types
+### Journey.\_postRetrieveTasksBulk(metadataMap)
+helper for Journey's [saveResults](#Journey.saveResults). Gets executed after retreive of metadata type and
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+**Kind**: static method of [Journey
](#Journey)
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
+| metadataMap | TYPE.MetadataTypeMap
| key=customer key, value=metadata |
-
+
-### MetadataType.findSubType(templateDir, templateName) ⇒ Promise.<string>
-check template directory for complex types that open subfolders for their subtypes
+### Journey.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
+manages post retrieve steps
+! BETA RELEASE of journey support (v4.3.0); it so far only resolves a limited amount of dependencies and will likely break during cross-BU deployments!
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<string>
- subtype name
+**Kind**: static method of [Journey
](#Journey)
+**Returns**: TYPE.MetadataTypeItem
- Array with one metadata object
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| templateName | string
| name of the metadata file |
+| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-### MetadataType.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName, ex) ⇒ object
-optional method used for some types to try a different folder structure
+### Journey.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
+prepares a TSD for deployment
+! BETA RELEASE of journey support (v4.3.0); it so far only resolves a limited amount of dependencies and will likely break during cross-BU deployments!
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: object
- metadata
+**Kind**: static method of [Journey
](#Journey)
+**Returns**: TYPE.MetadataTypeItem
- metadata object
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| typeDirArr | Array.<string>
| current subdir for this type |
-| templateName | string
| name of the metadata template |
-| fileName | string
| name of the metadata template file w/o extension |
-| ex | Error
| error from first attempt |
+| metadata | TYPE.MetadataTypeItem
| of a single TSD |
-
+
-### MetadataType.buildDefinition(templateDir, targetDir, templateName, variables) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Builds definition based on template
-NOTE: Most metadata files should use this generic method, unless custom
-parsing is required (for example scripts & queries)
+### Journey.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate) ⇒ 'create'
\| 'update'
\| 'skip'
+helper for [upsert](#MetadataType.upsert)
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of item map
+**Kind**: static method of [Journey
](#Journey)
+**Returns**: 'create'
\| 'update'
\| 'skip'
- action to take
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| templateName | string
| name of the metadata file |
-| variables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| metadataMap | TYPE.MetadataTypeMap
| list of metadata |
+| metadataKey | string
| key of item we are looking at |
+| hasError | boolean
| error flag from previous code |
+| metadataToUpdate | Array.<TYPE.MetadataTypeItemDiff>
| list of items to update |
+| metadataToCreate | Array.<TYPE.MetadataTypeItem>
| list of items to create |
-
+
-### MetadataType.getErrorsREST(ex) ⇒ Array.<string>
\| void
-Standardizes a check for multiple messages
+## List ⇐ [MetadataType
](#MetadataType)
+List MetadataType
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Array.<string>
\| void
- formatted Error Message
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
-| Param | Type | Description |
-| --- | --- | --- |
-| ex | object
| response payload from REST API |
+* [List](#List) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#List.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache()](#List.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.deleteByKey(customerKey)](#List.deleteByKey) ⇒ Promise.<boolean>
+ * [.postRetrieveTasks(list)](#List.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+ * [.parseMetadata(metadata, [parseForCache])](#List.parseMetadata) ⇒ TYPE.MetadataTypeItem
-
+
-### MetadataType.document([metadata], [isDeploy]) ⇒ void
-Gets metadata cache with limited fields and does not store value to disk
+### List.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of Lists
-**Kind**: static method of [MetadataType
](#MetadataType)
+**Kind**: static method of [List
](#List)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| [metadata] | TYPE.MetadataTypeMap
| a list of type definitions |
-| [isDeploy] | boolean
| used to skip non-supported message during deploy |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### MetadataType.deleteByKey(customerKey) ⇒ boolean
+### List.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata cache with limited fields and does not store value to disk
+
+**Kind**: static method of [List
](#List)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+
+### List.deleteByKey(customerKey) ⇒ Promise.<boolean>
Delete a metadata item from the specified business unit
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: boolean
- deletion success status
+**Kind**: static method of [List
](#List)
+**Returns**: Promise.<boolean>
- deletion success status
| Param | Type | Description |
| --- | --- | --- |
| customerKey | string
| Identifier of data extension |
-
+
-### MetadataType.postDeleteTasks(customerKey, [additionalExtensions]) ⇒ Promise.<void>
-clean up after deleting a metadata item
+### List.postRetrieveTasks(list) ⇒ TYPE.MetadataTypeItem
+manages post retrieve steps
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<void>
- - Promise
+**Kind**: static method of [List
](#List)
+**Returns**: TYPE.MetadataTypeItem
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of metadata item |
-| [additionalExtensions] | Array.<string>
| additional file extensions to delete on top of `${this.definition.type}-meta.json` |
+| list | TYPE.MetadataTypeItem
| a single list |
-
+
-### MetadataType.deleteByKeySOAP(customerKey, [overrideKeyField], [handleOutside]) ⇒ Promise.<boolean>
-Delete a data extension from the specified business unit
+### List.parseMetadata(metadata, [parseForCache]) ⇒ TYPE.MetadataTypeItem
+parses retrieved Metadata before saving
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<boolean>
- deletion success flag
+**Kind**: static method of [List
](#List)
+**Returns**: TYPE.MetadataTypeItem
- Array with one metadata object and one sql string
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of metadata |
-| [overrideKeyField] | string
| optionally change the name of the key field if the api uses a different name |
-| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
-
-
+| metadata | TYPE.MetadataTypeItem
| a single list definition |
+| [parseForCache] | boolean
| if set to true, the Category ID is kept |
-### MetadataType.deleteByKeyREST(url, key, [handleOutside]) ⇒ Promise.<boolean>
-Delete a data extension from the specified business unit
+
+
+## MetadataType
+MetadataType class that gets extended by their specific metadata type class.
+Provides default functionality that can be overwritten by child metadata type classes
+
+**Kind**: global class
+
+* [MetadataType](#MetadataType)
+ * [.client](#MetadataType.client) : TYPE.SDK
+ * [.properties](#MetadataType.properties) : TYPE.Mcdevrc
+ * [.subType](#MetadataType.subType) : string
+ * [.buObject](#MetadataType.buObject) : TYPE.BuObject
+ * [.client](#MetadataType.client) : TYPE.SDK
+ * [.properties](#MetadataType.properties) : TYPE.Mcdevrc
+ * [.subType](#MetadataType.subType) : string
+ * [.buObject](#MetadataType.buObject) : TYPE.BuObject
+ * [.getJsonFromFS(dir, [listBadKeys])](#MetadataType.getJsonFromFS) ⇒ TYPE.MetadataTypeMap
+ * [.getFieldNamesToRetrieve([additionalFields], [isCaching])](#MetadataType.getFieldNamesToRetrieve) ⇒ Array.<string>
+ * [.deploy(metadata, deployDir, retrieveDir)](#MetadataType.deploy) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.postDeployTasks(upsertResults, originalMetadata, createdUpdated)](#MetadataType.postDeployTasks) ⇒ void
+ * [.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields)](#MetadataType.postCreateTasks) ⇒ void
+ * [.postUpdateTasks(metadataEntry, apiResponse)](#MetadataType.postUpdateTasks) ⇒ void
+ * [.postDeployTasks_legacyApi(metadataEntry, apiResponse)](#MetadataType.postDeployTasks_legacyApi) ⇒ Promise.<void>
+ * [.postRetrieveTasks(metadata, targetDir, [isTemplating])](#MetadataType.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+ * [.setFolderPath(metadata)](#MetadataType.setFolderPath)
+ * [.setFolderId(metadata)](#MetadataType.setFolderId)
+ * [.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key])](#MetadataType.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveChangelog([additionalFields], [subTypeArr])](#MetadataType.retrieveChangelog) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache([additionalFields], [subTypeArr], [key])](#MetadataType.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables, [subType])](#MetadataType.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+ * [.retrieveTemplateREST(templateDir, uri, templateVariables, name)](#MetadataType.retrieveTemplateREST) ⇒ Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
+ * [.buildTemplate(retrieveDir, templateDir, key, templateVariables)](#MetadataType.buildTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+ * [.preDeployTasks(metadata, deployDir)](#MetadataType.preDeployTasks) ⇒ Promise.<TYPE.MetadataTypeItem>
+ * [.create(metadata, deployDir)](#MetadataType.create) ⇒ void
+ * [.update(metadata, [metadataBefore])](#MetadataType.update) ⇒ void
+ * [.refresh()](#MetadataType.refresh) ⇒ void
+ * [.execute()](#MetadataType.execute) ⇒ void
+ * [.pause()](#MetadataType.pause) ⇒ void
+ * [.hasChanged(cachedVersion, metadata, [fieldName])](#MetadataType.hasChanged) ⇒ boolean
+ * [.hasChangedGeneric(cachedVersion, metadata, [fieldName], [silent])](#MetadataType.hasChangedGeneric) ⇒ boolean
+ * [.upsert(metadataMap, deployDir)](#MetadataType.upsert) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate)](#MetadataType.createOrUpdate) ⇒ 'create'
\| 'update'
\| 'skip'
+ * [.createREST(metadataEntry, uri)](#MetadataType.createREST) ⇒ Promise.<object>
\| null
+ * [.createSOAP(metadataEntry, [handleOutside])](#MetadataType.createSOAP) ⇒ Promise.<object>
\| null
+ * [.updateREST(metadataEntry, uri, [httpMethod])](#MetadataType.updateREST) ⇒ Promise.<object>
\| null
+ * [.updateSOAP(metadataEntry, [handleOutside])](#MetadataType.updateSOAP) ⇒ Promise.<object>
\| null
+ * [._handleSOAPErrors(ex, msg, [metadataEntry], [handleOutside])](#MetadataType._handleSOAPErrors)
+ * [.getSOAPErrorMsg(ex)](#MetadataType.getSOAPErrorMsg) ⇒ string
+ * [.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields])](#MetadataType.retrieveSOAP) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveREST(retrieveDir, uri, [templateVariables], [singleRetrieve])](#MetadataType.retrieveREST) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+ * [.retrieveRESTcollection(urlArray, [concurrentRequests], [logAmountOfUrls])](#MetadataType.retrieveRESTcollection) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+ * [.handleRESTErrors(ex, id)](#MetadataType.handleRESTErrors) ⇒ null
+ * [.executeREST(uri, key)](#MetadataType.executeREST) ⇒ Promise.<{key:string, response:string}>
+ * [.executeSOAP([metadataEntry])](#MetadataType.executeSOAP) ⇒ Promise.<{key:string, response:object}>
+ * [.runDocumentOnRetrieve([singleRetrieve], metadataMap)](#MetadataType.runDocumentOnRetrieve) ⇒ Promise.<void>
+ * [.parseResponseBody(body, [singleRetrieve])](#MetadataType.parseResponseBody) ⇒ TYPE.MetadataTypeMap
+ * [.deleteFieldByDefinition(metadataEntry, fieldPath, definitionProperty, origin)](#MetadataType.deleteFieldByDefinition) ⇒ void
+ * [.removeNotCreateableFields(metadataEntry)](#MetadataType.removeNotCreateableFields) ⇒ void
+ * [.removeNotUpdateableFields(metadataEntry)](#MetadataType.removeNotUpdateableFields) ⇒ void
+ * [.keepTemplateFields(metadataEntry)](#MetadataType.keepTemplateFields) ⇒ void
+ * [.keepRetrieveFields(metadataEntry)](#MetadataType.keepRetrieveFields) ⇒ void
+ * [.isFiltered(metadataEntry, [include])](#MetadataType.isFiltered) ⇒ boolean
+ * [.isFilteredFolder(metadataEntry, [include])](#MetadataType.isFilteredFolder) ⇒ boolean
+ * [.saveResults(results, retrieveDir, [overrideType], [templateVariables])](#MetadataType.saveResults) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.applyTemplateValues(code, templateVariables)](#MetadataType.applyTemplateValues) ⇒ string
+ * [.applyTemplateNames(code, templateVariables)](#MetadataType.applyTemplateNames) ⇒ string
+ * [.buildDefinitionForNested(templateDir, targetDir, metadata, variables, templateName)](#MetadataType.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#MetadataType.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.findSubType(templateDir, templateName)](#MetadataType.findSubType) ⇒ Promise.<string>
+ * [.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName, ex)](#MetadataType.readSecondaryFolder) ⇒ object
+ * [.buildDefinition(templateDir, targetDir, templateName, variables)](#MetadataType.buildDefinition) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.getErrorsREST(ex)](#MetadataType.getErrorsREST) ⇒ Array.<string>
\| void
+ * [.document([metadata], [isDeploy])](#MetadataType.document) ⇒ void
+ * [.resolveId(id)](#MetadataType.resolveId) ⇒ Promise.<string>
+ * [.deleteByKey(customerKey)](#MetadataType.deleteByKey) ⇒ boolean
+ * [.postDeleteTasks(customerKey, [additionalExtensions])](#MetadataType.postDeleteTasks) ⇒ Promise.<void>
+ * [.deleteByKeySOAP(customerKey, [overrideKeyField], [handleOutside])](#MetadataType.deleteByKeySOAP) ⇒ Promise.<boolean>
+ * [.deleteByKeyREST(url, key, [handleOutside])](#MetadataType.deleteByKeyREST) ⇒ Promise.<boolean>
+ * [.readBUMetadataForType(readDir, [listBadKeys], [buMetadata])](#MetadataType.readBUMetadataForType) ⇒ object
+ * [.getFilesToCommit(keyArr)](#MetadataType.getFilesToCommit) ⇒ Promise.<Array.<string>>
+ * [.getKeysForFixing(metadataMap)](#MetadataType.getKeysForFixing) ⇒ Array.<string>
+ * [.getJsonFromFS(dir, [listBadKeys])](#MetadataType.getJsonFromFS) ⇒ TYPE.MetadataTypeMap
+ * [.getFieldNamesToRetrieve([additionalFields], [isCaching])](#MetadataType.getFieldNamesToRetrieve) ⇒ Array.<string>
+ * [.deploy(metadata, deployDir, retrieveDir)](#MetadataType.deploy) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.postDeployTasks(upsertResults, originalMetadata, createdUpdated)](#MetadataType.postDeployTasks) ⇒ void
+ * [.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields)](#MetadataType.postCreateTasks) ⇒ void
+ * [.postUpdateTasks(metadataEntry, apiResponse)](#MetadataType.postUpdateTasks) ⇒ void
+ * [.postDeployTasks_legacyApi(metadataEntry, apiResponse)](#MetadataType.postDeployTasks_legacyApi) ⇒ Promise.<void>
+ * [.postRetrieveTasks(metadata, targetDir, [isTemplating])](#MetadataType.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+ * [.setFolderPath(metadata)](#MetadataType.setFolderPath)
+ * [.setFolderId(metadata)](#MetadataType.setFolderId)
+ * [.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key])](#MetadataType.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveChangelog([additionalFields], [subTypeArr])](#MetadataType.retrieveChangelog) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache([additionalFields], [subTypeArr], [key])](#MetadataType.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables, [subType])](#MetadataType.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+ * [.retrieveTemplateREST(templateDir, uri, templateVariables, name)](#MetadataType.retrieveTemplateREST) ⇒ Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
+ * [.buildTemplate(retrieveDir, templateDir, key, templateVariables)](#MetadataType.buildTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+ * [.preDeployTasks(metadata, deployDir)](#MetadataType.preDeployTasks) ⇒ Promise.<TYPE.MetadataTypeItem>
+ * [.create(metadata, deployDir)](#MetadataType.create) ⇒ void
+ * [.update(metadata, [metadataBefore])](#MetadataType.update) ⇒ void
+ * [.refresh()](#MetadataType.refresh) ⇒ void
+ * [.execute()](#MetadataType.execute) ⇒ void
+ * [.pause()](#MetadataType.pause) ⇒ void
+ * [.hasChanged(cachedVersion, metadata, [fieldName])](#MetadataType.hasChanged) ⇒ boolean
+ * [.hasChangedGeneric(cachedVersion, metadata, [fieldName], [silent])](#MetadataType.hasChangedGeneric) ⇒ boolean
+ * [.upsert(metadataMap, deployDir)](#MetadataType.upsert) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate)](#MetadataType.createOrUpdate) ⇒ 'create'
\| 'update'
\| 'skip'
+ * [.createREST(metadataEntry, uri)](#MetadataType.createREST) ⇒ Promise.<object>
\| null
+ * [.createSOAP(metadataEntry, [handleOutside])](#MetadataType.createSOAP) ⇒ Promise.<object>
\| null
+ * [.updateREST(metadataEntry, uri, [httpMethod])](#MetadataType.updateREST) ⇒ Promise.<object>
\| null
+ * [.updateSOAP(metadataEntry, [handleOutside])](#MetadataType.updateSOAP) ⇒ Promise.<object>
\| null
+ * [._handleSOAPErrors(ex, msg, [metadataEntry], [handleOutside])](#MetadataType._handleSOAPErrors)
+ * [.getSOAPErrorMsg(ex)](#MetadataType.getSOAPErrorMsg) ⇒ string
+ * [.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields])](#MetadataType.retrieveSOAP) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveREST(retrieveDir, uri, [templateVariables], [singleRetrieve])](#MetadataType.retrieveREST) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+ * [.retrieveRESTcollection(urlArray, [concurrentRequests], [logAmountOfUrls])](#MetadataType.retrieveRESTcollection) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+ * [.handleRESTErrors(ex, id)](#MetadataType.handleRESTErrors) ⇒ null
+ * [.executeREST(uri, key)](#MetadataType.executeREST) ⇒ Promise.<{key:string, response:string}>
+ * [.executeSOAP([metadataEntry])](#MetadataType.executeSOAP) ⇒ Promise.<{key:string, response:object}>
+ * [.runDocumentOnRetrieve([singleRetrieve], metadataMap)](#MetadataType.runDocumentOnRetrieve) ⇒ Promise.<void>
+ * [.parseResponseBody(body, [singleRetrieve])](#MetadataType.parseResponseBody) ⇒ TYPE.MetadataTypeMap
+ * [.deleteFieldByDefinition(metadataEntry, fieldPath, definitionProperty, origin)](#MetadataType.deleteFieldByDefinition) ⇒ void
+ * [.removeNotCreateableFields(metadataEntry)](#MetadataType.removeNotCreateableFields) ⇒ void
+ * [.removeNotUpdateableFields(metadataEntry)](#MetadataType.removeNotUpdateableFields) ⇒ void
+ * [.keepTemplateFields(metadataEntry)](#MetadataType.keepTemplateFields) ⇒ void
+ * [.keepRetrieveFields(metadataEntry)](#MetadataType.keepRetrieveFields) ⇒ void
+ * [.isFiltered(metadataEntry, [include])](#MetadataType.isFiltered) ⇒ boolean
+ * [.isFilteredFolder(metadataEntry, [include])](#MetadataType.isFilteredFolder) ⇒ boolean
+ * [.saveResults(results, retrieveDir, [overrideType], [templateVariables])](#MetadataType.saveResults) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.applyTemplateValues(code, templateVariables)](#MetadataType.applyTemplateValues) ⇒ string
+ * [.applyTemplateNames(code, templateVariables)](#MetadataType.applyTemplateNames) ⇒ string
+ * [.buildDefinitionForNested(templateDir, targetDir, metadata, variables, templateName)](#MetadataType.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#MetadataType.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.findSubType(templateDir, templateName)](#MetadataType.findSubType) ⇒ Promise.<string>
+ * [.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName, ex)](#MetadataType.readSecondaryFolder) ⇒ object
+ * [.buildDefinition(templateDir, targetDir, templateName, variables)](#MetadataType.buildDefinition) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.getErrorsREST(ex)](#MetadataType.getErrorsREST) ⇒ Array.<string>
\| void
+ * [.document([metadata], [isDeploy])](#MetadataType.document) ⇒ void
+ * [.resolveId(id)](#MetadataType.resolveId) ⇒ Promise.<string>
+ * [.deleteByKey(customerKey)](#MetadataType.deleteByKey) ⇒ boolean
+ * [.postDeleteTasks(customerKey, [additionalExtensions])](#MetadataType.postDeleteTasks) ⇒ Promise.<void>
+ * [.deleteByKeySOAP(customerKey, [overrideKeyField], [handleOutside])](#MetadataType.deleteByKeySOAP) ⇒ Promise.<boolean>
+ * [.deleteByKeyREST(url, key, [handleOutside])](#MetadataType.deleteByKeyREST) ⇒ Promise.<boolean>
+ * [.readBUMetadataForType(readDir, [listBadKeys], [buMetadata])](#MetadataType.readBUMetadataForType) ⇒ object
+ * [.getFilesToCommit(keyArr)](#MetadataType.getFilesToCommit) ⇒ Promise.<Array.<string>>
+ * [.getKeysForFixing(metadataMap)](#MetadataType.getKeysForFixing) ⇒ Array.<string>
+
+
+
+### MetadataType.client : TYPE.SDK
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.properties : TYPE.Mcdevrc
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.subType : string
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.buObject : TYPE.BuObject
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.client : TYPE.SDK
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.properties : TYPE.Mcdevrc
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.subType : string
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.buObject : TYPE.BuObject
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.getJsonFromFS(dir, [listBadKeys]) ⇒ TYPE.MetadataTypeMap
+Returns file contents mapped to their filename without '.json' ending
**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<boolean>
- deletion success flag
+**Returns**: TYPE.MetadataTypeMap
- fileName => fileContent map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| dir | string
| directory that contains '.json' files to be read |
+| [listBadKeys] | boolean
| do not print errors, used for badKeys() |
+
+
+
+### MetadataType.getFieldNamesToRetrieve([additionalFields], [isCaching]) ⇒ Array.<string>
+Returns fieldnames of Metadata Type. 'this.definition.fields' variable only set in child classes.
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Array.<string>
- Fieldnames
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [isCaching] | boolean
| if true, then check if field should be skipped for caching |
+
+
+
+### MetadataType.deploy(metadata, deployDir, retrieveDir) ⇒ Promise.<TYPE.MetadataTypeMap>
+Deploys metadata
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of keyField => metadata map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| deployDir | string
| directory where deploy metadata are saved |
+| retrieveDir | string
| directory where metadata after deploy should be saved |
+
+
+
+### MetadataType.postDeployTasks(upsertResults, originalMetadata, createdUpdated) ⇒ void
+Gets executed after deployment of metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| upsertResults | TYPE.MetadataTypeMap
| metadata mapped by their keyField as returned by update/create |
+| originalMetadata | TYPE.MetadataTypeMap
| metadata to be updated (contains additioanl fields) |
+| createdUpdated | Object
| counter representing successful creates/updates |
+
+
+
+### MetadataType.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields) ⇒ void
+helper for [createREST](#MetadataType.createREST)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
+| metadataEntryWithAllFields | TYPE.MetadataTypeItem
| like metadataEntry but before non-creatable fields were stripped |
+
+
+
+### MetadataType.postUpdateTasks(metadataEntry, apiResponse) ⇒ void
+helper for [updateREST](#MetadataType.updateREST)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
+
+
+
+### MetadataType.postDeployTasks\_legacyApi(metadataEntry, apiResponse) ⇒ Promise.<void>
+helper for [createREST](#MetadataType.createREST) when legacy API endpoints as these do not return the created item but only their new id
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
+
+
+
+### MetadataType.postRetrieveTasks(metadata, targetDir, [isTemplating]) ⇒ TYPE.MetadataTypeItem
+Gets executed after retreive of metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: TYPE.MetadataTypeItem
- cloned metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+| targetDir | string
| folder where retrieves should be saved |
+| [isTemplating] | boolean
| signals that we are retrieving templates |
+
+
+
+### MetadataType.setFolderPath(metadata)
+generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### MetadataType.setFolderId(metadata)
+generic script that retrieves the folder ID from cache and updates the given metadata with it before deploy
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### MetadataType.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata from Marketing Cloud
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### MetadataType.retrieveChangelog([additionalFields], [subTypeArr]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata from Marketing Cloud
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+
+
+
+### MetadataType.retrieveForCache([additionalFields], [subTypeArr], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata cache with limited fields and does not store value to disk
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### MetadataType.retrieveAsTemplate(templateDir, name, templateVariables, [subType]) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+Gets metadata cache with limited fields and does not store value to disk
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| name | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| [subType] | string
| optionally limit to a single subtype |
+
+
+
+### MetadataType.retrieveTemplateREST(templateDir, uri, templateVariables, name) ⇒ Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
+Retrieve a specific Script by Name
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| uri | string
| rest endpoint for GET |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| name | string
| name (not key) of the metadata item |
+
+
+
+### MetadataType.buildTemplate(retrieveDir, templateDir, key, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+Gets metadata cache with limited fields and does not store value to disk
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- single metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| templateDir | string
| (List of) Directory where built definitions will be saved |
+| key | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### MetadataType.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.MetadataTypeItem>
+Gets executed before deploying metadata
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeItem>
- Promise of a single metadata item
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single metadata item |
+| deployDir | string
| folder where files for deployment are stored |
+
+
+
+### MetadataType.create(metadata, deployDir) ⇒ void
+Abstract create method that needs to be implemented in child metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| deployDir | string
| directory where deploy metadata are saved |
+
+
+
+### MetadataType.update(metadata, [metadataBefore]) ⇒ void
+Abstract update method that needs to be implemented in child metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| [metadataBefore] | TYPE.MetadataTypeItem
| metadata mapped by their keyField |
+
+
+
+### MetadataType.refresh() ⇒ void
+Abstract refresh method that needs to be implemented in child metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+
+### MetadataType.execute() ⇒ void
+Abstract execute method that needs to be implemented in child metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+
+### MetadataType.pause() ⇒ void
+Abstract pause method that needs to be implemented in child metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+
+### MetadataType.hasChanged(cachedVersion, metadata, [fieldName]) ⇒ boolean
+test if metadata was actually changed or not to potentially skip it during deployment
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true if metadata was changed
+
+| Param | Type | Description |
+| --- | --- | --- |
+| cachedVersion | TYPE.MetadataTypeItem
| cached version from the server |
+| metadata | TYPE.MetadataTypeItem
| item to upload |
+| [fieldName] | string
| optional field name to use for identifying the record in logs |
+
+
+
+### MetadataType.hasChangedGeneric(cachedVersion, metadata, [fieldName], [silent]) ⇒ boolean
+test if metadata was actually changed or not to potentially skip it during deployment
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true on first identified deviation or false if none are found
+
+| Param | Type | Description |
+| --- | --- | --- |
+| cachedVersion | TYPE.MetadataTypeItem
| cached version from the server |
+| metadata | TYPE.MetadataTypeItem
| item to upload |
+| [fieldName] | string
| optional field name to use for identifying the record in logs |
+| [silent] | boolean
| optionally suppress logging |
+
+
+
+### MetadataType.upsert(metadataMap, deployDir) ⇒ Promise.<TYPE.MetadataTypeMap>
+MetadataType upsert, after retrieving from target and comparing to check if create or update operation is needed.
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- keyField => metadata map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataMap | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| deployDir | string
| directory where deploy metadata are saved |
+
+
+
+### MetadataType.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate) ⇒ 'create'
\| 'update'
\| 'skip'
+helper for [upsert](#MetadataType.upsert)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: 'create'
\| 'update'
\| 'skip'
- action to take
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataMap | TYPE.MetadataTypeMap
| list of metadata |
+| metadataKey | string
| key of item we are looking at |
+| hasError | boolean
| error flag from previous code |
+| metadataToUpdate | Array.<TYPE.MetadataTypeItemDiff>
| list of items to update |
+| metadataToCreate | Array.<TYPE.MetadataTypeItem>
| list of items to create |
+
+
+
+### MetadataType.createREST(metadataEntry, uri) ⇒ Promise.<object>
\| null
+Creates a single metadata entry via REST
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| uri | string
| rest endpoint for POST |
+
+
+
+### MetadataType.createSOAP(metadataEntry, [handleOutside]) ⇒ Promise.<object>
\| null
+Creates a single metadata entry via fuel-soap (generic lib not wrapper)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| single metadata entry |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
+
+
+
+### MetadataType.updateREST(metadataEntry, uri, [httpMethod]) ⇒ Promise.<object>
\| null
+Updates a single metadata entry via REST
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| | a single metadata Entry |
+| uri | string
| | rest endpoint for PATCH |
+| [httpMethod] | 'patch'
\| 'post'
\| 'put'
| patch
| defaults to 'patch'; some update requests require PUT instead of PATCH |
+
+
+
+### MetadataType.updateSOAP(metadataEntry, [handleOutside]) ⇒ Promise.<object>
\| null
+Updates a single metadata entry via fuel-soap (generic lib not wrapper)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| single metadata entry |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
+
+
+
+### MetadataType.\_handleSOAPErrors(ex, msg, [metadataEntry], [handleOutside])
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| ex | Error
| error that occured |
+| msg | 'creating'
\| 'updating'
| what to print in the log |
+| [metadataEntry] | TYPE.MetadataTypeItem
| single metadata entry |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
+
+
+
+### MetadataType.getSOAPErrorMsg(ex) ⇒ string
+helper for [_handleSOAPErrors](#MetadataType._handleSOAPErrors)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: string
- error message
+
+| Param | Type | Description |
+| --- | --- | --- |
+| ex | Error
| error that occured |
+
+
+
+### MetadataType.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves SOAP via generic fuel-soap wrapper based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of item map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [requestParams] | TYPE.SoapRequestParams
| required for the specific request (filter for example) |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+
+
+
+### MetadataType.retrieveREST(retrieveDir, uri, [templateVariables], [singleRetrieve]) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+Retrieves Metadata for Rest Types
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
- Promise of item map (single item for templated result)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| uri | string
| rest endpoint for GET |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+
+
+
+### MetadataType.retrieveRESTcollection(urlArray, [concurrentRequests], [logAmountOfUrls]) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
- Promise of item map (single item for templated result)
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| urlArray | Array.<object>
| | {uri: string, id: string} combo of URL and ID/key of metadata |
+| [concurrentRequests] | number
| 10
| optionally set a different amount of concurrent requests |
+| [logAmountOfUrls] | boolean
| true
| if true, prints an info message about to-be loaded amount of metadata |
+
+
+
+### MetadataType.handleRESTErrors(ex, id) ⇒ null
+helper for [this.retrieveRESTcollection](this.retrieveRESTcollection)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: null
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| ex | Error
| exception |
+| id | string
| id or key of item |
+
+
+
+### MetadataType.executeREST(uri, key) ⇒ Promise.<{key:string, response:string}>
+Used to execute a query/automation etc.
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{key:string, response:string}>
- metadata key and API response (OK or error)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| uri | string
| REST endpoint where the POST request should be sent |
+| key | string
| item key |
+
+
+
+### MetadataType.executeSOAP([metadataEntry]) ⇒ Promise.<{key:string, response:object}>
+Used to execute a query/automation etc.
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{key:string, response:object}>
- metadata key and API response
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [metadataEntry] | TYPE.MetadataTypeItem
| single metadata entry |
+
+
+
+### MetadataType.runDocumentOnRetrieve([singleRetrieve], metadataMap) ⇒ Promise.<void>
+helper for [retrieveREST](#MetadataType.retrieveREST) and [retrieveSOAP](#MetadataType.retrieveSOAP)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+| metadataMap | TYPE.MetadataTypeMap
| saved metadata |
+
+
+
+### MetadataType.parseResponseBody(body, [singleRetrieve]) ⇒ TYPE.MetadataTypeMap
+Builds map of metadata entries mapped to their keyfields
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: TYPE.MetadataTypeMap
- keyField => metadata map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| body | object
| json of response body |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+
+
+
+### MetadataType.deleteFieldByDefinition(metadataEntry, fieldPath, definitionProperty, origin) ⇒ void
+Deletes a field in a metadata entry if the selected definition property equals false.
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| One entry of a metadataType |
+| fieldPath | string
| field path to be checked if it conforms to the definition (dot seperated if nested): 'fuu.bar' |
+| definitionProperty | 'isCreateable'
\| 'isUpdateable'
\| 'retrieving'
\| 'templating'
| delete field if definitionProperty equals false for specified field. Options: [isCreateable | isUpdateable] |
+| origin | string
| string of parent object, required when using arrays as these are parsed slightly differently. |
+
+**Example**
+```js
+Removes field (or nested fields childs) that are not updateable
+deleteFieldByDefinition(metadataEntry, 'CustomerKey', 'isUpdateable');
+```
+
+
+### MetadataType.removeNotCreateableFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not createable
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+
+
+
+### MetadataType.removeNotUpdateableFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not updateable
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+
+
+
+### MetadataType.keepTemplateFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not needed in the template
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+
+
+
+### MetadataType.keepRetrieveFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not needed in the stored metadata
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+
+
+
+### MetadataType.isFiltered(metadataEntry, [include]) ⇒ boolean
+checks if the current metadata entry should be saved on retrieve or not
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true: skip saving == filtered; false: continue with saving
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+| [include] | boolean
| true: use definition.include / options.include; false=exclude: use definition.filter / options.exclude |
+
+
+
+### MetadataType.isFilteredFolder(metadataEntry, [include]) ⇒ boolean
+optionally filter by what folder something is in
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true: filtered == do NOT save; false: not filtered == do save
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | object
| metadata entry |
+| [include] | boolean
| true: use definition.include / options.include; false=exclude: use definition.filter / options.exclude |
+
+
+
+### MetadataType.saveResults(results, retrieveDir, [overrideType], [templateVariables]) ⇒ Promise.<TYPE.MetadataTypeMap>
+Helper for writing Metadata to disk, used for Retrieve and deploy
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of saved metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| results | TYPE.MetadataTypeMap
| metadata results from deploy |
+| retrieveDir | string
| directory where metadata should be stored after deploy/retrieve |
+| [overrideType] | string
| for use when there is a subtype (such as folder-queries) |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### MetadataType.applyTemplateValues(code, templateVariables) ⇒ string
+helper for [buildDefinitionForNested](#MetadataType.buildDefinitionForNested)
+searches extracted file for template variable names and applies the market values
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: string
- code with markets applied
+
+| Param | Type | Description |
+| --- | --- | --- |
+| code | string
| code from extracted code |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### MetadataType.applyTemplateNames(code, templateVariables) ⇒ string
+helper for [buildTemplateForNested](#MetadataType.buildTemplateForNested)
+searches extracted file for template variable values and applies the market variable names
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: string
- code with markets applied
+
+| Param | Type | Description |
+| --- | --- | --- |
+| code | string
| code from extracted code |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### MetadataType.buildDefinitionForNested(templateDir, targetDir, metadata, variables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types (e.g script, asset, query)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
| Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| variables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+
+
+### MetadataType.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildTemplate](#MetadataType.buildTemplate)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+
+
+### MetadataType.findSubType(templateDir, templateName) ⇒ Promise.<string>
+check template directory for complex types that open subfolders for their subtypes
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<string>
- subtype name
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| templateName | string
| name of the metadata file |
+
+
+
+### MetadataType.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName, ex) ⇒ object
+optional method used for some types to try a different folder structure
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: object
- metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| typeDirArr | Array.<string>
| current subdir for this type |
+| templateName | string
| name of the metadata template |
+| fileName | string
| name of the metadata template file w/o extension |
+| ex | Error
| error from first attempt |
+
+
+
+### MetadataType.buildDefinition(templateDir, targetDir, templateName, variables) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Builds definition based on template
+NOTE: Most metadata files should use this generic method, unless custom
+parsing is required (for example scripts & queries)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of item map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| templateName | string
| name of the metadata file |
+| variables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### MetadataType.getErrorsREST(ex) ⇒ Array.<string>
\| void
+Standardizes a check for multiple messages
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Array.<string>
\| void
- formatted Error Message
+
+| Param | Type | Description |
+| --- | --- | --- |
+| ex | object
| response payload from REST API |
+
+
+
+### MetadataType.document([metadata], [isDeploy]) ⇒ void
+Gets metadata cache with limited fields and does not store value to disk
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [metadata] | TYPE.MetadataTypeMap
| a list of type definitions |
+| [isDeploy] | boolean
| used to skip non-supported message during deploy |
+
+
+
+### MetadataType.resolveId(id) ⇒ Promise.<string>
+get name & key for provided id
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<string>
- key of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| id | string
| Identifier of metadata |
+
+
+
+### MetadataType.deleteByKey(customerKey) ⇒ boolean
+Delete a metadata item from the specified business unit
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- deletion success status
+
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of data extension |
+
+
+
+### MetadataType.postDeleteTasks(customerKey, [additionalExtensions]) ⇒ Promise.<void>
+clean up after deleting a metadata item
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<void>
- - Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of metadata item |
+| [additionalExtensions] | Array.<string>
| additional file extensions to delete on top of `${this.definition.type}-meta.json` |
+
+
+
+### MetadataType.deleteByKeySOAP(customerKey, [overrideKeyField], [handleOutside]) ⇒ Promise.<boolean>
+Delete a data extension from the specified business unit
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<boolean>
- deletion success flag
+
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of metadata |
+| [overrideKeyField] | string
| optionally change the name of the key field if the api uses a different name |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
+
+
+
+### MetadataType.deleteByKeyREST(url, key, [handleOutside]) ⇒ Promise.<boolean>
+Delete a data extension from the specified business unit
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<boolean>
- deletion success flag
+
+| Param | Type | Description |
+| --- | --- | --- |
+| url | string
| endpoint |
+| key | string
| Identifier of metadata |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
+
+
+
+### MetadataType.readBUMetadataForType(readDir, [listBadKeys], [buMetadata]) ⇒ object
+Returns metadata of a business unit that is saved locally
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: object
- Metadata of BU in local directory
+
+| Param | Type | Description |
+| --- | --- | --- |
+| readDir | string
| root directory of metadata. |
+| [listBadKeys] | boolean
| do not print errors, used for badKeys() |
+| [buMetadata] | object
| Metadata of BU in local directory |
+
+
+
+### MetadataType.getFilesToCommit(keyArr) ⇒ Promise.<Array.<string>>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<Array.<string>>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+
+| Param | Type | Description |
+| --- | --- | --- |
+| keyArr | Array.<string>
| customerkey of the metadata |
+
+
+
+### MetadataType.getKeysForFixing(metadataMap) ⇒ Array.<string>
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Array.<string>
- list of keys
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataMap | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+
+
+
+### MetadataType.getJsonFromFS(dir, [listBadKeys]) ⇒ TYPE.MetadataTypeMap
+Returns file contents mapped to their filename without '.json' ending
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: TYPE.MetadataTypeMap
- fileName => fileContent map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| dir | string
| directory that contains '.json' files to be read |
+| [listBadKeys] | boolean
| do not print errors, used for badKeys() |
+
+
+
+### MetadataType.getFieldNamesToRetrieve([additionalFields], [isCaching]) ⇒ Array.<string>
+Returns fieldnames of Metadata Type. 'this.definition.fields' variable only set in child classes.
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Array.<string>
- Fieldnames
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [isCaching] | boolean
| if true, then check if field should be skipped for caching |
+
+
+
+### MetadataType.deploy(metadata, deployDir, retrieveDir) ⇒ Promise.<TYPE.MetadataTypeMap>
+Deploys metadata
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of keyField => metadata map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| deployDir | string
| directory where deploy metadata are saved |
+| retrieveDir | string
| directory where metadata after deploy should be saved |
+
+
+
+### MetadataType.postDeployTasks(upsertResults, originalMetadata, createdUpdated) ⇒ void
+Gets executed after deployment of metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| upsertResults | TYPE.MetadataTypeMap
| metadata mapped by their keyField as returned by update/create |
+| originalMetadata | TYPE.MetadataTypeMap
| metadata to be updated (contains additioanl fields) |
+| createdUpdated | Object
| counter representing successful creates/updates |
+
+
+
+### MetadataType.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields) ⇒ void
+helper for [createREST](#MetadataType.createREST)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
+| metadataEntryWithAllFields | TYPE.MetadataTypeItem
| like metadataEntry but before non-creatable fields were stripped |
+
+
+
+### MetadataType.postUpdateTasks(metadataEntry, apiResponse) ⇒ void
+helper for [updateREST](#MetadataType.updateREST)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
+
+
+
+### MetadataType.postDeployTasks\_legacyApi(metadataEntry, apiResponse) ⇒ Promise.<void>
+helper for [createREST](#MetadataType.createREST) when legacy API endpoints as these do not return the created item but only their new id
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
+
+
+
+### MetadataType.postRetrieveTasks(metadata, targetDir, [isTemplating]) ⇒ TYPE.MetadataTypeItem
+Gets executed after retreive of metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: TYPE.MetadataTypeItem
- cloned metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+| targetDir | string
| folder where retrieves should be saved |
+| [isTemplating] | boolean
| signals that we are retrieving templates |
+
+
+
+### MetadataType.setFolderPath(metadata)
+generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### MetadataType.setFolderId(metadata)
+generic script that retrieves the folder ID from cache and updates the given metadata with it before deploy
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### MetadataType.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata from Marketing Cloud
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### MetadataType.retrieveChangelog([additionalFields], [subTypeArr]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata from Marketing Cloud
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+
+
+
+### MetadataType.retrieveForCache([additionalFields], [subTypeArr], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata cache with limited fields and does not store value to disk
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### MetadataType.retrieveAsTemplate(templateDir, name, templateVariables, [subType]) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+Gets metadata cache with limited fields and does not store value to disk
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| name | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| [subType] | string
| optionally limit to a single subtype |
+
+
+
+### MetadataType.retrieveTemplateREST(templateDir, uri, templateVariables, name) ⇒ Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
+Retrieve a specific Script by Name
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| uri | string
| rest endpoint for GET |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| name | string
| name (not key) of the metadata item |
+
+
+
+### MetadataType.buildTemplate(retrieveDir, templateDir, key, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+Gets metadata cache with limited fields and does not store value to disk
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- single metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| templateDir | string
| (List of) Directory where built definitions will be saved |
+| key | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### MetadataType.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.MetadataTypeItem>
+Gets executed before deploying metadata
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeItem>
- Promise of a single metadata item
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single metadata item |
+| deployDir | string
| folder where files for deployment are stored |
+
+
+
+### MetadataType.create(metadata, deployDir) ⇒ void
+Abstract create method that needs to be implemented in child metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| deployDir | string
| directory where deploy metadata are saved |
+
+
+
+### MetadataType.update(metadata, [metadataBefore]) ⇒ void
+Abstract update method that needs to be implemented in child metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| [metadataBefore] | TYPE.MetadataTypeItem
| metadata mapped by their keyField |
+
+
+
+### MetadataType.refresh() ⇒ void
+Abstract refresh method that needs to be implemented in child metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+
+### MetadataType.execute() ⇒ void
+Abstract execute method that needs to be implemented in child metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+
+### MetadataType.pause() ⇒ void
+Abstract pause method that needs to be implemented in child metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+
+### MetadataType.hasChanged(cachedVersion, metadata, [fieldName]) ⇒ boolean
+test if metadata was actually changed or not to potentially skip it during deployment
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true if metadata was changed
+
+| Param | Type | Description |
+| --- | --- | --- |
+| cachedVersion | TYPE.MetadataTypeItem
| cached version from the server |
+| metadata | TYPE.MetadataTypeItem
| item to upload |
+| [fieldName] | string
| optional field name to use for identifying the record in logs |
+
+
+
+### MetadataType.hasChangedGeneric(cachedVersion, metadata, [fieldName], [silent]) ⇒ boolean
+test if metadata was actually changed or not to potentially skip it during deployment
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true on first identified deviation or false if none are found
+
+| Param | Type | Description |
+| --- | --- | --- |
+| cachedVersion | TYPE.MetadataTypeItem
| cached version from the server |
+| metadata | TYPE.MetadataTypeItem
| item to upload |
+| [fieldName] | string
| optional field name to use for identifying the record in logs |
+| [silent] | boolean
| optionally suppress logging |
+
+
+
+### MetadataType.upsert(metadataMap, deployDir) ⇒ Promise.<TYPE.MetadataTypeMap>
+MetadataType upsert, after retrieving from target and comparing to check if create or update operation is needed.
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- keyField => metadata map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataMap | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| deployDir | string
| directory where deploy metadata are saved |
+
+
+
+### MetadataType.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate) ⇒ 'create'
\| 'update'
\| 'skip'
+helper for [upsert](#MetadataType.upsert)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: 'create'
\| 'update'
\| 'skip'
- action to take
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataMap | TYPE.MetadataTypeMap
| list of metadata |
+| metadataKey | string
| key of item we are looking at |
+| hasError | boolean
| error flag from previous code |
+| metadataToUpdate | Array.<TYPE.MetadataTypeItemDiff>
| list of items to update |
+| metadataToCreate | Array.<TYPE.MetadataTypeItem>
| list of items to create |
+
+
+
+### MetadataType.createREST(metadataEntry, uri) ⇒ Promise.<object>
\| null
+Creates a single metadata entry via REST
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| uri | string
| rest endpoint for POST |
+
+
+
+### MetadataType.createSOAP(metadataEntry, [handleOutside]) ⇒ Promise.<object>
\| null
+Creates a single metadata entry via fuel-soap (generic lib not wrapper)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| single metadata entry |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
+
+
+
+### MetadataType.updateREST(metadataEntry, uri, [httpMethod]) ⇒ Promise.<object>
\| null
+Updates a single metadata entry via REST
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| | a single metadata Entry |
+| uri | string
| | rest endpoint for PATCH |
+| [httpMethod] | 'patch'
\| 'post'
\| 'put'
| patch
| defaults to 'patch'; some update requests require PUT instead of PATCH |
+
+
+
+### MetadataType.updateSOAP(metadataEntry, [handleOutside]) ⇒ Promise.<object>
\| null
+Updates a single metadata entry via fuel-soap (generic lib not wrapper)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| single metadata entry |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
+
+
+
+### MetadataType.\_handleSOAPErrors(ex, msg, [metadataEntry], [handleOutside])
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| ex | Error
| error that occured |
+| msg | 'creating'
\| 'updating'
| what to print in the log |
+| [metadataEntry] | TYPE.MetadataTypeItem
| single metadata entry |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
+
+
+
+### MetadataType.getSOAPErrorMsg(ex) ⇒ string
+helper for [_handleSOAPErrors](#MetadataType._handleSOAPErrors)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: string
- error message
+
+| Param | Type | Description |
+| --- | --- | --- |
+| ex | Error
| error that occured |
+
+
+
+### MetadataType.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves SOAP via generic fuel-soap wrapper based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of item map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [requestParams] | TYPE.SoapRequestParams
| required for the specific request (filter for example) |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+
+
+
+### MetadataType.retrieveREST(retrieveDir, uri, [templateVariables], [singleRetrieve]) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+Retrieves Metadata for Rest Types
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
- Promise of item map (single item for templated result)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| uri | string
| rest endpoint for GET |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+
+
+
+### MetadataType.retrieveRESTcollection(urlArray, [concurrentRequests], [logAmountOfUrls]) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
- Promise of item map (single item for templated result)
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| urlArray | Array.<object>
| | {uri: string, id: string} combo of URL and ID/key of metadata |
+| [concurrentRequests] | number
| 10
| optionally set a different amount of concurrent requests |
+| [logAmountOfUrls] | boolean
| true
| if true, prints an info message about to-be loaded amount of metadata |
+
+
+
+### MetadataType.handleRESTErrors(ex, id) ⇒ null
+helper for [this.retrieveRESTcollection](this.retrieveRESTcollection)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: null
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| ex | Error
| exception |
+| id | string
| id or key of item |
+
+
+
+### MetadataType.executeREST(uri, key) ⇒ Promise.<{key:string, response:string}>
+Used to execute a query/automation etc.
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{key:string, response:string}>
- metadata key and API response (OK or error)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| uri | string
| REST endpoint where the POST request should be sent |
+| key | string
| item key |
+
+
+
+### MetadataType.executeSOAP([metadataEntry]) ⇒ Promise.<{key:string, response:object}>
+Used to execute a query/automation etc.
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{key:string, response:object}>
- metadata key and API response
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [metadataEntry] | TYPE.MetadataTypeItem
| single metadata entry |
+
+
+
+### MetadataType.runDocumentOnRetrieve([singleRetrieve], metadataMap) ⇒ Promise.<void>
+helper for [retrieveREST](#MetadataType.retrieveREST) and [retrieveSOAP](#MetadataType.retrieveSOAP)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+| metadataMap | TYPE.MetadataTypeMap
| saved metadata |
+
+
+
+### MetadataType.parseResponseBody(body, [singleRetrieve]) ⇒ TYPE.MetadataTypeMap
+Builds map of metadata entries mapped to their keyfields
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: TYPE.MetadataTypeMap
- keyField => metadata map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| body | object
| json of response body |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+
+
+
+### MetadataType.deleteFieldByDefinition(metadataEntry, fieldPath, definitionProperty, origin) ⇒ void
+Deletes a field in a metadata entry if the selected definition property equals false.
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| One entry of a metadataType |
+| fieldPath | string
| field path to be checked if it conforms to the definition (dot seperated if nested): 'fuu.bar' |
+| definitionProperty | 'isCreateable'
\| 'isUpdateable'
\| 'retrieving'
\| 'templating'
| delete field if definitionProperty equals false for specified field. Options: [isCreateable | isUpdateable] |
+| origin | string
| string of parent object, required when using arrays as these are parsed slightly differently. |
+
+**Example**
+```js
+Removes field (or nested fields childs) that are not updateable
+deleteFieldByDefinition(metadataEntry, 'CustomerKey', 'isUpdateable');
+```
+
+
+### MetadataType.removeNotCreateableFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not createable
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+
+
+
+### MetadataType.removeNotUpdateableFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not updateable
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+
+
+
+### MetadataType.keepTemplateFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not needed in the template
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+
+
+
+### MetadataType.keepRetrieveFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not needed in the stored metadata
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+
+
+
+### MetadataType.isFiltered(metadataEntry, [include]) ⇒ boolean
+checks if the current metadata entry should be saved on retrieve or not
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true: skip saving == filtered; false: continue with saving
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+| [include] | boolean
| true: use definition.include / options.include; false=exclude: use definition.filter / options.exclude |
+
+
+
+### MetadataType.isFilteredFolder(metadataEntry, [include]) ⇒ boolean
+optionally filter by what folder something is in
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true: filtered == do NOT save; false: not filtered == do save
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | object
| metadata entry |
+| [include] | boolean
| true: use definition.include / options.include; false=exclude: use definition.filter / options.exclude |
+
+
+
+### MetadataType.saveResults(results, retrieveDir, [overrideType], [templateVariables]) ⇒ Promise.<TYPE.MetadataTypeMap>
+Helper for writing Metadata to disk, used for Retrieve and deploy
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of saved metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| results | TYPE.MetadataTypeMap
| metadata results from deploy |
+| retrieveDir | string
| directory where metadata should be stored after deploy/retrieve |
+| [overrideType] | string
| for use when there is a subtype (such as folder-queries) |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### MetadataType.applyTemplateValues(code, templateVariables) ⇒ string
+helper for [buildDefinitionForNested](#MetadataType.buildDefinitionForNested)
+searches extracted file for template variable names and applies the market values
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: string
- code with markets applied
+
+| Param | Type | Description |
+| --- | --- | --- |
+| code | string
| code from extracted code |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### MetadataType.applyTemplateNames(code, templateVariables) ⇒ string
+helper for [buildTemplateForNested](#MetadataType.buildTemplateForNested)
+searches extracted file for template variable values and applies the market variable names
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: string
- code with markets applied
+
+| Param | Type | Description |
+| --- | --- | --- |
+| code | string
| code from extracted code |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### MetadataType.buildDefinitionForNested(templateDir, targetDir, metadata, variables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types (e.g script, asset, query)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
| Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| variables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+
+
+### MetadataType.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildTemplate](#MetadataType.buildTemplate)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+
+
+### MetadataType.findSubType(templateDir, templateName) ⇒ Promise.<string>
+check template directory for complex types that open subfolders for their subtypes
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<string>
- subtype name
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| templateName | string
| name of the metadata file |
+
+
+
+### MetadataType.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName, ex) ⇒ object
+optional method used for some types to try a different folder structure
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: object
- metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| typeDirArr | Array.<string>
| current subdir for this type |
+| templateName | string
| name of the metadata template |
+| fileName | string
| name of the metadata template file w/o extension |
+| ex | Error
| error from first attempt |
+
+
+
+### MetadataType.buildDefinition(templateDir, targetDir, templateName, variables) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Builds definition based on template
+NOTE: Most metadata files should use this generic method, unless custom
+parsing is required (for example scripts & queries)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of item map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| templateName | string
| name of the metadata file |
+| variables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### MetadataType.getErrorsREST(ex) ⇒ Array.<string>
\| void
+Standardizes a check for multiple messages
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Array.<string>
\| void
- formatted Error Message
+
+| Param | Type | Description |
+| --- | --- | --- |
+| ex | object
| response payload from REST API |
+
+
+
+### MetadataType.document([metadata], [isDeploy]) ⇒ void
+Gets metadata cache with limited fields and does not store value to disk
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [metadata] | TYPE.MetadataTypeMap
| a list of type definitions |
+| [isDeploy] | boolean
| used to skip non-supported message during deploy |
+
+
+
+### MetadataType.resolveId(id) ⇒ Promise.<string>
+get name & key for provided id
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<string>
- key of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| id | string
| Identifier of metadata |
+
+
+
+### MetadataType.deleteByKey(customerKey) ⇒ boolean
+Delete a metadata item from the specified business unit
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- deletion success status
+
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of data extension |
+
+
+
+### MetadataType.postDeleteTasks(customerKey, [additionalExtensions]) ⇒ Promise.<void>
+clean up after deleting a metadata item
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<void>
- - Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of metadata item |
+| [additionalExtensions] | Array.<string>
| additional file extensions to delete on top of `${this.definition.type}-meta.json` |
+
+
+
+### MetadataType.deleteByKeySOAP(customerKey, [overrideKeyField], [handleOutside]) ⇒ Promise.<boolean>
+Delete a data extension from the specified business unit
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<boolean>
- deletion success flag
+
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of metadata |
+| [overrideKeyField] | string
| optionally change the name of the key field if the api uses a different name |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
+
+
+
+### MetadataType.deleteByKeyREST(url, key, [handleOutside]) ⇒ Promise.<boolean>
+Delete a data extension from the specified business unit
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<boolean>
- deletion success flag
+
+| Param | Type | Description |
+| --- | --- | --- |
+| url | string
| endpoint |
+| key | string
| Identifier of metadata |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
+
+
+
+### MetadataType.readBUMetadataForType(readDir, [listBadKeys], [buMetadata]) ⇒ object
+Returns metadata of a business unit that is saved locally
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: object
- Metadata of BU in local directory
+
+| Param | Type | Description |
+| --- | --- | --- |
+| readDir | string
| root directory of metadata. |
+| [listBadKeys] | boolean
| do not print errors, used for badKeys() |
+| [buMetadata] | object
| Metadata of BU in local directory |
+
+
+
+### MetadataType.getFilesToCommit(keyArr) ⇒ Promise.<Array.<string>>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<Array.<string>>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+
+| Param | Type | Description |
+| --- | --- | --- |
+| keyArr | Array.<string>
| customerkey of the metadata |
+
+
+
+### MetadataType.getKeysForFixing(metadataMap) ⇒ Array.<string>
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Array.<string>
- list of keys
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataMap | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+
+
+
+## MobileCode ⇐ [MetadataType
](#MetadataType)
+MobileCode MetadataType
+
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
+* [MobileCode](#MobileCode) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#MobileCode.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache()](#MobileCode.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+
+
+
+### MobileCode.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of Mobile Keywords
+Endpoint /legacy/v1/beta/mobile/code/ return all Mobile Codes with all details.
+
+**Kind**: static method of [MobileCode
](#MobileCode)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### MobileCode.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves event definition metadata for caching
+
+**Kind**: static method of [MobileCode
](#MobileCode)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+
+## MobileKeyword ⇐ [MetadataType
](#MetadataType)
+MobileKeyword MetadataType
+
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
+* [MobileKeyword](#MobileKeyword) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#MobileKeyword.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
\| void
+ * [.parseResponseBody(body, [singleRetrieve])](#MobileKeyword.parseResponseBody) ⇒ TYPE.MetadataTypeMap
+ * [.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate)](#MobileKeyword.createOrUpdate) ⇒ 'create'
\| 'update'
\| 'skip'
+ * [.retrieveForCache([_], [__], [key])](#MobileKeyword.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveAsTemplate(templateDir, key, templateVariables)](#MobileKeyword.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+ * [.create(metadata)](#MobileKeyword.create) ⇒ Promise
+ * [.update(metadata)](#MobileKeyword.update) ⇒ Promise
+ * [.postRetrieveTasks(metadata)](#MobileKeyword.postRetrieveTasks) ⇒ TYPE.CodeExtractItem
\| TYPE.MetadataTypeItem
\| void
+ * [.prepExtractedCode(metadataScript)](#MobileKeyword.prepExtractedCode) ⇒ Object
+ * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#MobileKeyword.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#MobileKeyword.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#MobileKeyword._buildForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.preDeployTasks(metadata, deployDir)](#MobileKeyword.preDeployTasks) ⇒ Promise.<TYPE.MetadataTypeItem>
+ * [.postCreateTasks(metadataEntry, apiResponse)](#MobileKeyword.postCreateTasks) ⇒ void
+ * [.postUpdateTasks(metadataEntry, apiResponse)](#MobileKeyword.postUpdateTasks) ⇒ void
+ * [._mergeCode(metadata, deployDir, [templateName])](#MobileKeyword._mergeCode) ⇒ Promise.<string>
+ * [.deleteByKey(key)](#MobileKeyword.deleteByKey) ⇒ Promise.<boolean>
+ * [.postDeleteTasks(customerKey)](#MobileKeyword.postDeleteTasks) ⇒ void
+ * [.getFilesToCommit(keyArr)](#MobileKeyword.getFilesToCommit) ⇒ Array.<string>
+
+
+
+### MobileKeyword.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
\| void
+Retrieves Metadata of Mobile Keywords
+Endpoint /legacy/v1/beta/mobile/keyword/ return all Mobile Keywords with all details.
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
\| void
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### MobileKeyword.parseResponseBody(body, [singleRetrieve]) ⇒ TYPE.MetadataTypeMap
+Builds map of metadata entries mapped to their keyfields
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: TYPE.MetadataTypeMap
- keyField => metadata map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| body | object
| json of response body |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+
+
+
+### MobileKeyword.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate) ⇒ 'create'
\| 'update'
\| 'skip'
+helper for [upsert](#MetadataType.upsert)
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: 'create'
\| 'update'
\| 'skip'
- action to take
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataMap | TYPE.MetadataTypeMap
| list of metadata |
+| metadataKey | string
| key of item we are looking at |
+| hasError | boolean
| error flag from previous code |
+| metadataToUpdate | Array.<TYPE.MetadataTypeItemDiff>
| list of items to update |
+| metadataToCreate | Array.<TYPE.MetadataTypeItem>
| list of items to create |
+
+
+
+### MobileKeyword.retrieveForCache([_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves event definition metadata for caching
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [_] | void
| parameter not used |
+| [__] | void
| parameter not used |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### MobileKeyword.retrieveAsTemplate(templateDir, key, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+retrieve an item and create a template from it
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| key | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### MobileKeyword.create(metadata) ⇒ Promise
+Creates a single item
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### MobileKeyword.update(metadata) ⇒ Promise
+Updates a single item
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### MobileKeyword.postRetrieveTasks(metadata) ⇒ TYPE.CodeExtractItem
\| TYPE.MetadataTypeItem
\| void
+manages post retrieve steps
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: TYPE.CodeExtractItem
\| TYPE.MetadataTypeItem
\| void
- Array with one metadata object and one ssjs string; or single metadata object; nothing if filtered
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### MobileKeyword.prepExtractedCode(metadataScript) ⇒ Object
+helper for [postRetrieveTasks](#MobileKeyword.postRetrieveTasks) and [_buildForNested](#MobileKeyword._buildForNested)
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: Object
- returns found extension and file content
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataScript | string
| the code of the file |
+
+
+
+### MobileKeyword.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+
+
+### MobileKeyword.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildTemplate](#MetadataType.buildTemplate)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+**Example**
+```js
+scripts are saved as 1 json and 1 ssjs file. both files need to be run through templating
+```
+
+
+### MobileKeyword.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildTemplateForNested](#MobileKeyword.buildTemplateForNested) / [buildDefinitionForNested](#MobileKeyword.buildDefinitionForNested)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+| mode | 'definition'
\| 'template'
| defines what we use this helper for |
+
+
+
+### MobileKeyword.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.MetadataTypeItem>
+prepares an event definition for deployment
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: Promise.<TYPE.MetadataTypeItem>
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single MobileKeyword |
+| deployDir | string
| directory of deploy files |
+
+
+
+### MobileKeyword.postCreateTasks(metadataEntry, apiResponse) ⇒ void
+helper for [createREST](#MetadataType.createREST)
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
+
+
+
+### MobileKeyword.postUpdateTasks(metadataEntry, apiResponse) ⇒ void
+helper for [updateREST](#MetadataType.updateREST)
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
+
+
+
+### MobileKeyword.\_mergeCode(metadata, deployDir, [templateName]) ⇒ Promise.<string>
+helper for [preDeployTasks](#MobileKeyword.preDeployTasks) that loads extracted code content back into JSON
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: Promise.<string>
- content for metadata.script
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single definition |
+| deployDir | string
| directory of deploy files |
+| [templateName] | string
| name of the template used to built defintion (prior applying templating) |
+
+
+
+### MobileKeyword.deleteByKey(key) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: Promise.<boolean>
- deletion success status
+
+| Param | Type | Description |
+| --- | --- | --- |
+| key | string
| Identifier of item |
+
+
+
+### MobileKeyword.postDeleteTasks(customerKey) ⇒ void
+clean up after deleting a metadata item
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of metadata item |
+
+
+
+### MobileKeyword.getFilesToCommit(keyArr) ⇒ Array.<string>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
+
+**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+
+| Param | Type | Description |
+| --- | --- | --- |
+| keyArr | Array.<string>
| customerkey of the metadata |
+
+
+
+## MobileMessage ⇐ [MetadataType
](#MetadataType)
+MobileMessage MetadataType
+
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
+* [MobileMessage](#MobileMessage) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#MobileMessage.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
\| void
+ * [.retrieveForCache([_], [__], [key])](#MobileMessage.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.update(metadata)](#MobileMessage.update) ⇒ Promise
+ * [.create(metadata)](#MobileMessage.create) ⇒ Promise
+ * [._mergeCode(metadata, deployDir, [templateName])](#MobileMessage._mergeCode) ⇒ Promise.<string>
+ * [.prepExtractedCode(code)](#MobileMessage.prepExtractedCode) ⇒ Object
+ * [.getFilesToCommit(keyArr)](#MobileMessage.getFilesToCommit) ⇒ Array.<string>
+ * [.postRetrieveTasks(metadata)](#MobileMessage.postRetrieveTasks) ⇒ TYPE.CodeExtractItem
+ * [.preDeployTasks(metadata, deployDir)](#MobileMessage.preDeployTasks) ⇒ TYPE.MetadataTypeItem
+ * [.postCreateTasks(metadataEntry, apiResponse)](#MobileMessage.postCreateTasks) ⇒ void
+ * [.postUpdateTasks(metadataEntry, apiResponse)](#MobileMessage.postUpdateTasks) ⇒ void
+ * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#MobileMessage.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#MobileMessage.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#MobileMessage._buildForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.deleteByKey(id)](#MobileMessage.deleteByKey) ⇒ Promise.<boolean>
+
+
+
+### MobileMessage.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
\| void
+Retrieves Metadata of Mobile Keywords
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
\| void
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### MobileMessage.retrieveForCache([_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves event definition metadata for caching
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [_] | void
| parameter not used |
+| [__] | void
| parameter not used |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### MobileMessage.update(metadata) ⇒ Promise
+Updates a single item
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### MobileMessage.create(metadata) ⇒ Promise
+Creates a single item
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### MobileMessage.\_mergeCode(metadata, deployDir, [templateName]) ⇒ Promise.<string>
+helper for [preDeployTasks](#MobileMessage.preDeployTasks) that loads extracted code content back into JSON
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Returns**: Promise.<string>
- code
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single definition |
+| deployDir | string
| directory of deploy files |
+| [templateName] | string
| name of the template used to built defintion (prior applying templating) |
+
+
+
+### MobileMessage.prepExtractedCode(code) ⇒ Object
+helper for [postRetrieveTasks](#MobileMessage.postRetrieveTasks) and [_buildForNested](#MobileMessage._buildForNested)
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Returns**: Object
- returns found extension and file content
+
+| Param | Type | Description |
+| --- | --- | --- |
+| code | string
| the code of the file |
+
+
+
+### MobileMessage.getFilesToCommit(keyArr) ⇒ Array.<string>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+
+| Param | Type | Description |
+| --- | --- | --- |
+| keyArr | Array.<string>
| customerkey of the metadata |
+
+
+
+### MobileMessage.postRetrieveTasks(metadata) ⇒ TYPE.CodeExtractItem
+manages post retrieve steps
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Returns**: TYPE.CodeExtractItem
- Array with one metadata object and one query string
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single query |
+
+
+
+### MobileMessage.preDeployTasks(metadata, deployDir) ⇒ TYPE.MetadataTypeItem
+prepares an event definition for deployment
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Returns**: TYPE.MetadataTypeItem
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single MobileMessage |
+| deployDir | string
| directory of deploy files |
+
+
+
+### MobileMessage.postCreateTasks(metadataEntry, apiResponse) ⇒ void
+helper for [createREST](#MetadataType.createREST)
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
+
+
+
+### MobileMessage.postUpdateTasks(metadataEntry, apiResponse) ⇒ void
+helper for [updateREST](#MetadataType.updateREST)
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
+
+
+
+### MobileMessage.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+
+
+### MobileMessage.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildTemplate](#MetadataType.buildTemplate)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+**Example**
+```js
+scripts are saved as 1 json and 1 ssjs file. both files need to be run through templating
+```
+
+
+### MobileMessage.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildTemplateForNested](#MobileMessage.buildTemplateForNested) / [buildDefinitionForNested](#MobileMessage.buildDefinitionForNested)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+| mode | 'definition'
\| 'template'
| defines what we use this helper for |
+
+
+
+### MobileMessage.deleteByKey(id) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
+! the endpoint expects the ID and not a key but for mcdev in this case key==id
+
+**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Returns**: Promise.<boolean>
- deletion success status
+
+| Param | Type | Description |
+| --- | --- | --- |
+| id | string
| Identifier of item |
+
+
+
+## Query ⇐ [MetadataType
](#MetadataType)
+Query MetadataType
+
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
+* [Query](#Query) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#Query.retrieve) ⇒ Promise.<{metadata: TYPE.QueryMap, type: string}>
+ * [.execute(keyArr)](#Query.execute) ⇒ Promise.<Array.<string>>
+ * [.retrieveForCache()](#Query.retrieveForCache) ⇒ Promise.<{metadata: TYPE.QueryMap, type: string}>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables)](#Query.retrieveAsTemplate) ⇒ Promise.<{metadata: Query, type: string}>
+ * [.postRetrieveTasks(metadata)](#Query.postRetrieveTasks) ⇒ TYPE.CodeExtractItem
+ * [.create(query)](#Query.create) ⇒ Promise
+ * [.update(query)](#Query.update) ⇒ Promise
+ * [.preDeployTasks(metadata, deployDir)](#Query.preDeployTasks) ⇒ Promise.<TYPE.QueryItem>
+ * [.applyTemplateValues(code, templateVariables)](#Query.applyTemplateValues) ⇒ string
+ * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Query.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Query.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.getFilesToCommit(keyArr)](#Query.getFilesToCommit) ⇒ Array.<string>
+ * [.getErrorsREST(ex)](#Query.getErrorsREST) ⇒ Array.<string>
\| void
+ * [.deleteByKey(customerKey)](#Query.deleteByKey) ⇒ Promise.<boolean>
+ * [.postDeleteTasks(customerKey)](#Query.postDeleteTasks) ⇒ void
+ * [.postDeployTasks(upsertResults)](#Query.postDeployTasks)
+
+
+
+### Query.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<{metadata: TYPE.QueryMap, type: string}>
+Retrieves Metadata of queries
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: Promise.<{metadata: TYPE.QueryMap, type: string}>
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### Query.execute(keyArr) ⇒ Promise.<Array.<string>>
+a function to start query execution via API
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: Promise.<Array.<string>>
- Returns list of keys that were executed successfully
+
+| Param | Type | Description |
+| --- | --- | --- |
+| keyArr | Array.<string>
| customerkey of the metadata |
+
+
+
+### Query.retrieveForCache() ⇒ Promise.<{metadata: TYPE.QueryMap, type: string}>
+Retrieves query metadata for caching
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: Promise.<{metadata: TYPE.QueryMap, type: string}>
- Promise of metadata
+
+
+### Query.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<{metadata: Query, type: string}>
+Retrieve a specific Query by Name
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: Promise.<{metadata: Query, type: string}>
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| name | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### Query.postRetrieveTasks(metadata) ⇒ TYPE.CodeExtractItem
+manages post retrieve steps
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: TYPE.CodeExtractItem
- Array with one metadata object and one query string
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.QueryItem
| a single query |
+
+
+
+### Query.create(query) ⇒ Promise
+Creates a single query
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| query | TYPE.QueryItem
| a single query |
+
+
+
+### Query.update(query) ⇒ Promise
+Updates a single query
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| query | TYPE.QueryItem
| a single query |
+
+
+
+### Query.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.QueryItem>
+prepares a Query for deployment
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: Promise.<TYPE.QueryItem>
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.QueryItem
| a single query activity |
+| deployDir | string
| directory of deploy files |
+
+
+
+### Query.applyTemplateValues(code, templateVariables) ⇒ string
+helper for [buildDefinitionForNested](#Query.buildDefinitionForNested)
+searches extracted SQL file for template variables and applies the market values
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: string
- code with markets applied
+
+| Param | Type | Description |
+| --- | --- | --- |
+| code | string
| code from extracted code |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### Query.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.QueryItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+
+
+### Query.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildTemplate](#MetadataType.buildTemplate)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.QueryItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+**Example**
+```js
+queries are saved as 1 json and 1 sql file. both files need to be run through templating
+```
+
+
+### Query.getFilesToCommit(keyArr) ⇒ Array.<string>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+
+| Param | Type | Description |
+| --- | --- | --- |
+| keyArr | Array.<string>
| customerkey of the metadata |
+
+
+
+### Query.getErrorsREST(ex) ⇒ Array.<string>
\| void
+Standardizes a check for multiple messages but adds query specific filters to error texts
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: Array.<string>
\| void
- formatted Error Message
+
+| Param | Type | Description |
+| --- | --- | --- |
+| ex | object
| response payload from REST API |
+
+
+
+### Query.deleteByKey(customerKey) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
+
+**Kind**: static method of [Query
](#Query)
+**Returns**: Promise.<boolean>
- deletion success flag
+
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of data extension |
+
+
+
+### Query.postDeleteTasks(customerKey) ⇒ void
+clean up after deleting a metadata item
+
+**Kind**: static method of [Query
](#Query)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of metadata item |
+
+
+
+### Query.postDeployTasks(upsertResults)
+Gets executed after deployment of metadata type
+
+**Kind**: static method of [Query
](#Query)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| upsertResults | TYPE.MetadataTypeMap
| metadata mapped by their keyField as returned by update/create |
+
+
+
+## Role ⇐ [MetadataType
](#MetadataType)
+ImportFile MetadataType
+
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
+* [Role](#Role) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, _, [___], [key])](#Role.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.preDeployTasks(metadata)](#Role.preDeployTasks) ⇒ TYPE.MetadataTypeItem
+ * [.create(metadata)](#Role.create) ⇒ Promise
+ * [.update(metadata)](#Role.update) ⇒ Promise
+ * [.document([metadata])](#Role.document) ⇒ Promise.<void>
+ * [._traverseRoles(role, element, [permission], [isAllowed])](#Role._traverseRoles) ⇒ void
+
+
+
+### Role.retrieve(retrieveDir, _, [___], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata from Marketing Cloud
+
+**Kind**: static method of [Role
](#Role)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Metadata store object
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| _ | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [___] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### Role.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
+Gets executed before deploying metadata
+
+**Kind**: static method of [Role
](#Role)
+**Returns**: TYPE.MetadataTypeItem
- Promise of a single metadata item
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single metadata item |
+
+
+
+### Role.create(metadata) ⇒ Promise
+Create a single Role.
+
+**Kind**: static method of [Role
](#Role)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+
+
+
+### Role.update(metadata) ⇒ Promise
+Updates a single Role.
+
+**Kind**: static method of [Role
](#Role)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+
+
+
+### Role.document([metadata]) ⇒ Promise.<void>
+Creates markdown documentation of all roles
+
+**Kind**: static method of [Role
](#Role)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [metadata] | TYPE.MetadataTypeMap
| role definitions |
+
+
+
+### Role.\_traverseRoles(role, element, [permission], [isAllowed]) ⇒ void
+iterates through permissions to output proper row-names for nested permissionss
+
+**Kind**: static method of [Role
](#Role)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| role | string
| name of the user role |
+| element | object
| data of the permission |
+| [permission] | string
| name of the permission |
+| [isAllowed] | string
| "true" / "false" from the |
+
+
+
+## Script ⇐ [MetadataType
](#MetadataType)
+Script MetadataType
+
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
+* [Script](#Script) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#Script.retrieve) ⇒ Promise.<{metadata: TYPE.ScriptMap, type: string}>
+ * [.retrieveForCache()](#Script.retrieveForCache) ⇒ Promise.<{metadata: TYPE.ScriptMap, type: string}>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables)](#Script.retrieveAsTemplate) ⇒ Promise.<{metadata: TYPE.Script, type: string}>
+ * [.update(script)](#Script.update) ⇒ Promise
+ * [.create(script)](#Script.create) ⇒ Promise
+ * [._mergeCode(metadata, deployDir, [templateName])](#Script._mergeCode) ⇒ Promise.<string>
+ * [.preDeployTasks(metadata, dir)](#Script.preDeployTasks) ⇒ TYPE.ScriptItem
+ * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Script.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Script.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#Script._buildForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.postRetrieveTasks(metadata)](#Script.postRetrieveTasks) ⇒ TYPE.CodeExtractItem
+ * [.prepExtractedCode(metadataScript, metadataName)](#Script.prepExtractedCode) ⇒ Object
+ * [.getFilesToCommit(keyArr)](#Script.getFilesToCommit) ⇒ Array.<string>
+ * [.deleteByKey(customerKey)](#Script.deleteByKey) ⇒ Promise.<boolean>
+ * [.postDeleteTasks(customerKey)](#Script.postDeleteTasks) ⇒ void
+
+
+
+### Script.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<{metadata: TYPE.ScriptMap, type: string}>
+Retrieves Metadata of Script
+Endpoint /automation/v1/scripts/ return all Scripts with all details.
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: Promise.<{metadata: TYPE.ScriptMap, type: string}>
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### Script.retrieveForCache() ⇒ Promise.<{metadata: TYPE.ScriptMap, type: string}>
+Retrieves script metadata for caching
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: Promise.<{metadata: TYPE.ScriptMap, type: string}>
- Promise
+
+
+### Script.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<{metadata: TYPE.Script, type: string}>
+Retrieve a specific Script by Name
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: Promise.<{metadata: TYPE.Script, type: string}>
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| name | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### Script.update(script) ⇒ Promise
+Updates a single Script
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| script | TYPE.MetadataTypeItem
| a single Script |
+
+
+
+### Script.create(script) ⇒ Promise
+Creates a single Script
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| script | TYPE.MetadataTypeItem
| a single Script |
+
+
+
+### Script.\_mergeCode(metadata, deployDir, [templateName]) ⇒ Promise.<string>
+helper for [preDeployTasks](#Script.preDeployTasks) that loads extracted code content back into JSON
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: Promise.<string>
- content for metadata.script
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.ScriptItem
| a single asset definition |
+| deployDir | string
| directory of deploy files |
+| [templateName] | string
| name of the template used to built defintion (prior applying templating) |
+
+
+
+### Script.preDeployTasks(metadata, dir) ⇒ TYPE.ScriptItem
+prepares a Script for deployment
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: TYPE.ScriptItem
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.ScriptItem
| a single script activity definition |
+| dir | string
| directory of deploy files |
+
+
+
+### Script.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.ScriptItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+
+
+### Script.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildTemplate](#MetadataType.buildTemplate)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.ScriptItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+**Example**
+```js
+scripts are saved as 1 json and 1 ssjs file. both files need to be run through templating
+```
+
+
+### Script.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildTemplateForNested](#Script.buildTemplateForNested) / [buildDefinitionForNested](#Script.buildDefinitionForNested)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.ScriptItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+| mode | 'definition'
\| 'template'
| defines what we use this helper for |
+
+
+
+### Script.postRetrieveTasks(metadata) ⇒ TYPE.CodeExtractItem
+manages post retrieve steps
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: TYPE.CodeExtractItem
- a single item with code parts extracted
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.ScriptItem
| a single item |
+
+
+
+### Script.prepExtractedCode(metadataScript, metadataName) ⇒ Object
+helper for [postRetrieveTasks](#Script.postRetrieveTasks) and [_buildForNested](#Script._buildForNested)
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: Object
- returns found extension and file content
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataScript | string
| the code of the file |
+| metadataName | string
| the name of the metadata |
+
+
+
+### Script.getFilesToCommit(keyArr) ⇒ Array.<string>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+
+| Param | Type | Description |
+| --- | --- | --- |
+| keyArr | Array.<string>
| customerkey of the metadata |
+
+
+
+### Script.deleteByKey(customerKey) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
+
+**Kind**: static method of [Script
](#Script)
+**Returns**: Promise.<boolean>
- deletion success flag
+
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of data extension |
+
+
+
+### Script.postDeleteTasks(customerKey) ⇒ void
+clean up after deleting a metadata item
+
+**Kind**: static method of [Script
](#Script)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of metadata item |
+
+
+
+## SendClassification ⇐ [MetadataType
](#MetadataType)
+SendClassification MetadataType
+
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
+
+### SendClassification.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+
+**Kind**: static method of [SendClassification
](#SendClassification)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+## TransactionalEmail ⇐ [TransactionalMessage
](#TransactionalMessage)
+TransactionalEmail MetadataType
+
+**Kind**: global class
+**Extends**: [TransactionalMessage
](#TransactionalMessage)
+
+* [TransactionalEmail](#TransactionalEmail) ⇐ [TransactionalMessage
](#TransactionalMessage)
+ * [.update(metadata)](#TransactionalEmail.update) ⇒ Promise
+ * [.preDeployTasks(metadata)](#TransactionalEmail.preDeployTasks) ⇒ TYPE.MetadataTypeItem
+ * [.postCreateTasks(_, apiResponse)](#TransactionalEmail.postCreateTasks) ⇒ void
+ * [.postDeployTasks()](#TransactionalEmail.postDeployTasks) ⇒ void
+ * [.postRetrieveTasks(metadata)](#TransactionalEmail.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+ * [.deleteByKey(key)](#TransactionalEmail.deleteByKey) ⇒ Promise.<boolean>
+
+
+
+### TransactionalEmail.update(metadata) ⇒ Promise
+Updates a single item
+
+**Kind**: static method of [TransactionalEmail
](#TransactionalEmail)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| how the item shall look after the update |
+
+
+
+### TransactionalEmail.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
+prepares for deployment
+
+**Kind**: static method of [TransactionalEmail
](#TransactionalEmail)
+**Returns**: TYPE.MetadataTypeItem
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### TransactionalEmail.postCreateTasks(_, apiResponse) ⇒ void
+helper for [TransactionalEmail.createREST](TransactionalEmail.createREST)
+
+**Kind**: static method of [TransactionalEmail
](#TransactionalEmail)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| _ | TYPE.MetadataTypeItem
| not used |
+| apiResponse | object
| varies depending on the API call |
+
+
+
+### TransactionalEmail.postDeployTasks() ⇒ void
+Gets executed after deployment of metadata type
+
+**Kind**: static method of [TransactionalEmail
](#TransactionalEmail)
+
+
+### TransactionalEmail.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
+manages post retrieve steps
+
+**Kind**: static method of [TransactionalEmail
](#TransactionalEmail)
+**Returns**: TYPE.MetadataTypeItem
- a single item
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### TransactionalEmail.deleteByKey(key) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
+
+**Kind**: static method of [TransactionalEmail
](#TransactionalEmail)
+**Returns**: Promise.<boolean>
- deletion success status
+
+| Param | Type | Description |
+| --- | --- | --- |
+| key | string
| Identifier of item |
+
+
+
+## TransactionalMessage ⇐ [MetadataType
](#MetadataType)
+TransactionalMessage MetadataType
+
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
+* [TransactionalMessage](#TransactionalMessage) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#TransactionalMessage.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache([_], [__], [key])](#TransactionalMessage.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.update(metadata)](#TransactionalMessage.update) ⇒ Promise
+ * [.create(metadata)](#TransactionalMessage.create) ⇒ Promise
+ * [.deleteByKey(key)](#TransactionalMessage.deleteByKey) ⇒ Promise.<boolean>
+
+
+
+### TransactionalMessage.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata
+
+**Kind**: static method of [TransactionalMessage
](#TransactionalMessage)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### TransactionalMessage.retrieveForCache([_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves event definition metadata for caching
+
+**Kind**: static method of [TransactionalMessage
](#TransactionalMessage)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [_] | void
| parameter not used |
+| [__] | void
| parameter not used |
+| [key] | string
| customer key of single item to cache |
+
+
+
+### TransactionalMessage.update(metadata) ⇒ Promise
+Updates a single item
+
+**Kind**: static method of [TransactionalMessage
](#TransactionalMessage)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### TransactionalMessage.create(metadata) ⇒ Promise
+Creates a single item
+
+**Kind**: static method of [TransactionalMessage
](#TransactionalMessage)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### TransactionalMessage.deleteByKey(key) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
+
+**Kind**: static method of [TransactionalMessage
](#TransactionalMessage)
+**Returns**: Promise.<boolean>
- deletion success status
+
+| Param | Type | Description |
+| --- | --- | --- |
+| key | string
| Identifier of item |
+
+
+
+## TransactionalPush ⇐ [TransactionalMessage
](#TransactionalMessage)
+TransactionalPush TransactionalMessage
+
+**Kind**: global class
+**Extends**: [TransactionalMessage
](#TransactionalMessage)
+
+* [TransactionalPush](#TransactionalPush) ⇐ [TransactionalMessage
](#TransactionalMessage)
+ * [.preDeployTasks(metadata)](#TransactionalPush.preDeployTasks) ⇒ TYPE.MetadataTypeItem
+ * [.postRetrieveTasks(metadata)](#TransactionalPush.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+
+
+
+### TransactionalPush.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
+prepares for deployment
+
+**Kind**: static method of [TransactionalPush
](#TransactionalPush)
+**Returns**: TYPE.MetadataTypeItem
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### TransactionalPush.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
+manages post retrieve steps
+
+**Kind**: static method of [TransactionalPush
](#TransactionalPush)
+**Returns**: TYPE.MetadataTypeItem
- a single item
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+## TransactionalSMS ⇐ [TransactionalMessage
](#TransactionalMessage)
+TransactionalSMS MetadataType
+
+**Kind**: global class
+**Extends**: [TransactionalMessage
](#TransactionalMessage)
+
+* [TransactionalSMS](#TransactionalSMS) ⇐ [TransactionalMessage
](#TransactionalMessage)
+ * [.postDeleteTasks(customerKey)](#TransactionalSMS.postDeleteTasks) ⇒ void
+ * [.preDeployTasks(metadata, deployDir)](#TransactionalSMS.preDeployTasks) ⇒ Promise.<TYPE.MetadataTypeItem>
+ * [._mergeCode(metadata, deployDir, [templateName])](#TransactionalSMS._mergeCode) ⇒ Promise.<string>
+ * [.postRetrieveTasks(metadata)](#TransactionalSMS.postRetrieveTasks) ⇒ Promise.<TYPE.CodeExtractItem>
+ * [.prepExtractedCode(metadataScript)](#TransactionalSMS.prepExtractedCode) ⇒ Promise.<{fileExt:string, code:string}>
+ * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#TransactionalSMS.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#TransactionalSMS.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#TransactionalSMS._buildForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [._isHTML(code)](#TransactionalSMS._isHTML) ⇒ boolean
+ * [.getFilesToCommit(keyArr)](#TransactionalSMS.getFilesToCommit) ⇒ Array.<string>
+
+
+
+### TransactionalSMS.postDeleteTasks(customerKey) ⇒ void
+clean up after deleting a metadata item
+
+**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of metadata item |
+
+
+
+### TransactionalSMS.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.MetadataTypeItem>
+prepares for deployment
+
+**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
+**Returns**: Promise.<TYPE.MetadataTypeItem>
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+| deployDir | string
| directory of deploy files |
+
+
+
+### TransactionalSMS.\_mergeCode(metadata, deployDir, [templateName]) ⇒ Promise.<string>
+helper for [preDeployTasks](#TransactionalSMS.preDeployTasks) that loads extracted code content back into JSON
+
+**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
+**Returns**: Promise.<string>
- content for metadata.script
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single definition |
+| deployDir | string
| directory of deploy files |
+| [templateName] | string
| name of the template used to built defintion (prior applying templating) |
+
+
+
+### TransactionalSMS.postRetrieveTasks(metadata) ⇒ Promise.<TYPE.CodeExtractItem>
+manages post retrieve steps
+
+**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
+**Returns**: Promise.<TYPE.CodeExtractItem>
- Array with one metadata object and one ssjs string
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### TransactionalSMS.prepExtractedCode(metadataScript) ⇒ Promise.<{fileExt:string, code:string}>
+helper for [postRetrieveTasks](#TransactionalSMS.postRetrieveTasks) and [_buildForNested](#TransactionalSMS._buildForNested)
+
+**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
+**Returns**: Promise.<{fileExt:string, code:string}>
- returns found extension and file content
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataScript | string
| the code of the file |
+
+
+
+### TransactionalSMS.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [TransactionalMessage.buildDefinition](TransactionalMessage.buildDefinition)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+
+
+### TransactionalSMS.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [TransactionalMessage.buildTemplate](TransactionalMessage.buildTemplate)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+**Example**
+```js
+scripts are saved as 1 json and 1 ssjs file. both files need to be run through templating
+```
+
+
+### TransactionalSMS.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildTemplateForNested](#TransactionalSMS.buildTemplateForNested) / [buildDefinitionForNested](#TransactionalSMS.buildDefinitionForNested)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+| mode | 'definition'
\| 'template'
| defines what we use this helper for |
+
+
+
+### TransactionalSMS.\_isHTML(code) ⇒ boolean
+very simplified test for HTML code in our SMS
+
+**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
+**Returns**: boolean
- true if HTML is found
+
+| Param | Type | Description |
+| --- | --- | --- |
+| code | string
| sms source code |
+
+
+
+### TransactionalSMS.getFilesToCommit(keyArr) ⇒ Array.<string>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
+
+**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
+**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+
+| Param | Type | Description |
+| --- | --- | --- |
+| keyArr | Array.<string>
| customerkey of the metadata |
+
+
+
+## TriggeredSend ⇐ [MetadataType
](#MetadataType)
+MessageSendActivity MetadataType
+
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
+* [TriggeredSend](#TriggeredSend) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], [key])](#TriggeredSend.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.create(metadata)](#TriggeredSend.create) ⇒ Promise
+ * [.update(metadata)](#TriggeredSend.update) ⇒ Promise
+ * [.deleteByKey(customerKey)](#TriggeredSend.deleteByKey) ⇒ Promise.<boolean>
+ * [.postRetrieveTasks(metadata)](#TriggeredSend.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
\| void
+ * [.preDeployTasks(metadata)](#TriggeredSend.preDeployTasks) ⇒ TYPE.MetadataTypeItem
+ * [.refresh([keyArr], [checkKey])](#TriggeredSend.refresh) ⇒ Promise.<void>
+ * [.getKeysForValidTSDs(metadata)](#TriggeredSend.getKeysForValidTSDs) ⇒ Promise.<Array.<string>>
+ * [.findRefreshableItems([assetLoaded])](#TriggeredSend.findRefreshableItems) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [._refreshItem(key, checkKey)](#TriggeredSend._refreshItem) ⇒ Promise.<boolean>
+
+
+
+### TriggeredSend.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+
+**Kind**: static method of [TriggeredSend
](#TriggeredSend)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### TriggeredSend.create(metadata) ⇒ Promise
+Create a single TSD.
+
+**Kind**: static method of [TriggeredSend
](#TriggeredSend)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+
+
+
+### TriggeredSend.update(metadata) ⇒ Promise
+Updates a single TSD.
+
+**Kind**: static method of [TriggeredSend
](#TriggeredSend)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+
+
+
+### TriggeredSend.deleteByKey(customerKey) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
+
+**Kind**: static method of [TriggeredSend
](#TriggeredSend)
+**Returns**: Promise.<boolean>
- deletion success status
+
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of data extension |
+
+
+
+### TriggeredSend.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
\| void
+parses retrieved Metadata before saving
+
+**Kind**: static method of [TriggeredSend
](#TriggeredSend)
+**Returns**: TYPE.MetadataTypeItem
\| void
- Array with one metadata object and one sql string
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### TriggeredSend.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
+prepares a TSD for deployment
+
+**Kind**: static method of [TriggeredSend
](#TriggeredSend)
+**Returns**: TYPE.MetadataTypeItem
- metadata object
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| of a single TSD |
+
+
+
+### TriggeredSend.refresh([keyArr], [checkKey]) ⇒ Promise.<void>
+TSD-specific refresh method that finds active TSDs and refreshes them
+
+**Kind**: static method of [TriggeredSend
](#TriggeredSend)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [keyArr] | Array.<string>
| | metadata keys |
+| [checkKey] | boolean
| true
| whether to check if the key is valid |
+
+
+
+### TriggeredSend.getKeysForValidTSDs(metadata) ⇒ Promise.<Array.<string>>
+helper for [refresh](#TriggeredSend.refresh) that extracts the keys from the TSD item map and eli
+
+**Kind**: static method of [TriggeredSend
](#TriggeredSend)
+**Returns**: Promise.<Array.<string>>
- keyArr
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeMapObj
| TSD item map |
+
+
+
+### TriggeredSend.findRefreshableItems([assetLoaded]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+helper for [refresh](#TriggeredSend.refresh) that finds active TSDs on the server and filters it by the same rules that [retrieve](#TriggeredSend.retrieve) is using to avoid refreshing TSDs with broken dependencies
+
+**Kind**: static method of [TriggeredSend
](#TriggeredSend)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of TSD item map
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| [assetLoaded] | boolean
| false
| if run after Asset.deploy via --refresh option this will skip caching assets |
+
+
+
+### TriggeredSend.\_refreshItem(key, checkKey) ⇒ Promise.<boolean>
+helper for [refresh](#TriggeredSend.refresh) that pauses, publishes and starts a triggered send
+
+**Kind**: static method of [TriggeredSend
](#TriggeredSend)
+**Returns**: Promise.<boolean>
- true if refresh was successful
+
+| Param | Type | Description |
+| --- | --- | --- |
+| key | string
| external key of triggered send item |
+| checkKey | boolean
| whether to check if key exists on the server |
+
+
+
+## User ⇐ [MetadataType
](#MetadataType)
+MetadataType
+
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
+* [User](#User) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, _, [__], [key])](#User.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache()](#User.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.create(metadata)](#User.create) ⇒ Promise
+ * [.update(metadata)](#User.update) ⇒ Promise
+ * [.preDeployTasks(metadata)](#User.preDeployTasks) ⇒ TYPE.UserDocument
+ * [.createOrUpdate(metadata, metadataKey, hasError, metadataToUpdate, metadataToCreate)](#User.createOrUpdate) ⇒ void
+ * [.postDeployTasks(upsertResults)](#User.postDeployTasks) ⇒ Promise.<void>
+ * [._getRoleObjectForDeploy(roleId, roleName, userId, assignmentOnly, [isRoleRemovale])](#User._getRoleObjectForDeploy) ⇒ object
+ * [.retrieveChangelog()](#User.retrieveChangelog) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields])](#User.retrieveSOAP) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.document([metadata])](#User.document) ⇒ Promise.<void>
+ * [.postRetrieveTasks(metadata)](#User.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
\| void
+
+
+
+### User.retrieve(retrieveDir, _, [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+
+**Kind**: static method of [User
](#User)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| _ | void
| unused parameter |
+| [__] | void
| unused parameter |
+| [key] | string
| customer key of single item to retrieve |
+
+
+
+### User.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves import definition metadata for caching
+
+**Kind**: static method of [User
](#User)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
+
+
+### User.create(metadata) ⇒ Promise
+Create a single item.
+
+**Kind**: static method of [User
](#User)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+
+
+
+### User.update(metadata) ⇒ Promise
+Updates a single item.
+
+**Kind**: static method of [User
](#User)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+
+
+
+### User.preDeployTasks(metadata) ⇒ TYPE.UserDocument
+prepares a item for deployment
+
+**Kind**: static method of [User
](#User)
+**Returns**: TYPE.UserDocument
- metadata object
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.UserDocument
| of a single item |
+
+
+
+### User.createOrUpdate(metadata, metadataKey, hasError, metadataToUpdate, metadataToCreate) ⇒ void
+helper for [upsert](#MetadataType.upsert)
+
+**Kind**: static method of [User
](#User)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeMap
| list of metadata |
+| metadataKey | string
| key of item we are looking at |
+| hasError | boolean
| error flag from previous code |
+| metadataToUpdate | Array.<TYPE.UserDocumentDiff>
| list of items to update |
+| metadataToCreate | Array.<TYPE.UserDocument>
| list of items to create |
+
+
+
+### User.postDeployTasks(upsertResults) ⇒ Promise.<void>
+Gets executed after deployment of metadata type
+
+**Kind**: static method of [User
](#User)
+**Returns**: Promise.<void>
- promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| upsertResults | TYPE.UserDocumentMap
| metadata mapped by their keyField |
+
+
+
+### User.\_getRoleObjectForDeploy(roleId, roleName, userId, assignmentOnly, [isRoleRemovale]) ⇒ object
+helper for [User._prepareRoleAssignments](User._prepareRoleAssignments)
+
+**Kind**: static method of [User
](#User)
+**Returns**: object
- format needed by API
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| roleId | string
| | role.ObjectID |
+| roleName | string
| | role.Name |
+| userId | number
| | user.AccountUserID |
+| assignmentOnly | boolean
| | if true, only assignment configuration will be returned |
+| [isRoleRemovale] | boolean
| false
| if true, role will be removed from user; otherwise added |
+
+
+
+### User.retrieveChangelog() ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+
+**Kind**: static method of [User
](#User)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+
+### User.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves SOAP via generic fuel-soap wrapper based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+
+**Kind**: static method of [User
](#User)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of item map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [requestParams] | TYPE.SoapRequestParams
| required for the specific request (filter for example) |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+
+
+
+### User.document([metadata]) ⇒ Promise.<void>
+Creates markdown documentation of all roles
+
+**Kind**: static method of [User
](#User)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [metadata] | TYPE.MetadataTypeMap
| user list |
+
+
+
+### User.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
\| void
+manages post retrieve steps
+
+**Kind**: static method of [User
](#User)
+**Returns**: TYPE.MetadataTypeItem
\| void
- a single item
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+## Verification ⇐ [MetadataType
](#MetadataType)
+Verification MetadataType
+
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
+* [Verification](#Verification) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, [_], [__], key)](#Verification.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.handleRESTErrors(ex, id)](#Verification.handleRESTErrors) ⇒ null
+ * [.retrieveForCache()](#Verification.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.create(metadata)](#Verification.create) ⇒ Promise
+ * [.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields)](#Verification.postCreateTasks) ⇒ void
+ * [.update(metadata)](#Verification.update) ⇒ Promise
+ * [.preDeployTasks(metadata)](#Verification.preDeployTasks) ⇒ TYPE.VerificationItem
+ * [.postRetrieveTasks(metadata)](#Verification.postRetrieveTasks) ⇒ TYPE.VerificationItem
+ * [.deleteByKey(key)](#Verification.deleteByKey) ⇒ Promise.<boolean>
+
+
+
+### Verification.retrieve(retrieveDir, [_], [__], key) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of Data Verification Activity.
+
+**Kind**: static method of [Verification
](#Verification)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [_] | void
| unused parameter |
+| [__] | void
| unused parameter |
+| key | string
| customer key of single item to retrieve |
+
+
+
+### Verification.handleRESTErrors(ex, id) ⇒ null
+helper for [this.retrieveRESTcollection](this.retrieveRESTcollection)
+
+**Kind**: static method of [Verification
](#Verification)
+**Returns**: null
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| ex | Error
| exception |
+| id | string
| id or key of item |
+
+
+
+### Verification.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves Metadata of Data Extract Activity for caching
+
+**Kind**: static method of [Verification
](#Verification)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+
+### Verification.create(metadata) ⇒ Promise
+Creates a single Data Extract
+
+**Kind**: static method of [Verification
](#Verification)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.VerificationItem
| a single Data Extract |
+
+
+
+### Verification.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields) ⇒ void
+helper for [createREST](#MetadataType.createREST)
+
+**Kind**: static method of [Verification
](#Verification)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
+| metadataEntryWithAllFields | TYPE.MetadataTypeItem
| like metadataEntry but before non-creatable fields were stripped |
+
+
+
+### Verification.update(metadata) ⇒ Promise
+Updates a single Data Extract
+
+**Kind**: static method of [Verification
](#Verification)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.VerificationItem
| a single Data Extract |
+
+
+
+### Verification.preDeployTasks(metadata) ⇒ TYPE.VerificationItem
+prepares a verification for deployment
+
+**Kind**: static method of [Verification
](#Verification)
+**Returns**: TYPE.VerificationItem
- metadata object
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.VerificationItem
| a single verification activity definition |
+
+
+
+### Verification.postRetrieveTasks(metadata) ⇒ TYPE.VerificationItem
+parses retrieved Metadata before saving
+
+**Kind**: static method of [Verification
](#Verification)
+**Returns**: TYPE.VerificationItem
- Array with one metadata object and one sql string
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.VerificationItem
| a single verification activity definition |
+
+
+
+### Verification.deleteByKey(key) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
+
+**Kind**: static method of [Verification
](#Verification)
+**Returns**: Promise.<boolean>
- deletion success status
+
+| Param | Type | Description |
+| --- | --- | --- |
+| key | string
| Identifier of item |
+
+
+
+## Retriever
+Retrieves metadata from a business unit and saves it to the local filesystem.
+
+**Kind**: global class
+
+* [Retriever](#Retriever)
+ * [new Retriever(properties, buObject)](#new_Retriever_new)
+ * [.retrieve(metadataTypes, [namesOrKeys], [templateVariables], [changelogOnly])](#Retriever+retrieve) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+ * [._getTypeDependencies(metadataTypes)](#Retriever+_getTypeDependencies) ⇒ Array.<TYPE.SupportedMetadataTypes>
+
+
+
+### new Retriever(properties, buObject)
+Creates a Retriever, uses v2 auth if v2AuthOptions are passed.
+
+
+| Param | Type | Description |
+| --- | --- | --- |
+| properties | TYPE.Mcdevrc
| General configuration to be used in retrieve |
+| buObject | TYPE.BuObject
| properties for auth |
+
+
+
+### retriever.retrieve(metadataTypes, [namesOrKeys], [templateVariables], [changelogOnly]) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+Retrieve metadata of specified types into local file system and Retriever.metadata
+
+**Kind**: instance method of [Retriever
](#Retriever)
+**Returns**: Promise.<TYPE.MultiMetadataTypeList>
- Promise of a list of retrieved items grouped by type {automation:[...], query:[...]}
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataTypes | Array.<TYPE.SupportedMetadataTypes>
| list of metadata types to retrieve; can include subtypes! |
+| [namesOrKeys] | Array.<string>
\| TYPE.TypeKeyCombo
| name of Metadata to retrieveAsTemplate or list of keys for normal retrieval |
+| [templateVariables] | TYPE.TemplateMap
| Object of values which can be replaced (in case of templating) |
+| [changelogOnly] | boolean
| skip saving, only create json in memory |
+
+
+
+### retriever.\_getTypeDependencies(metadataTypes) ⇒ Array.<TYPE.SupportedMetadataTypes>
+helper for [Retriever.retrieve](Retriever.retrieve) to get all dependencies of the given types
+
+**Kind**: instance method of [Retriever
](#Retriever)
+**Returns**: Array.<TYPE.SupportedMetadataTypes>
- unique list dependent metadata types
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataTypes | Array.<TYPE.SupportedMetadataTypes>
| list of metadata types to retrieve; can include subtypes! |
+
+
+
+## Mcdev
+main class
+
+**Kind**: global class
+
+* [Mcdev](#Mcdev)
+ * [.version()](#Mcdev.version) ⇒ string
+ * [.setSkipInteraction([skipInteraction])](#Mcdev.setSkipInteraction) ⇒ void
+ * [.setLoggingLevel(argv)](#Mcdev.setLoggingLevel) ⇒ void
+ * [.setOptions(argv)](#Mcdev.setOptions) ⇒ void
+ * [.createDeltaPkg(argv)](#Mcdev.createDeltaPkg) ⇒ Promise.<Array.<TYPE.DeltaPkgItem>>
+ * [.selectTypes()](#Mcdev.selectTypes) ⇒ Promise
+ * [.explainTypes()](#Mcdev.explainTypes) ⇒ Array.<object>
+ * [.upgrade()](#Mcdev.upgrade) ⇒ Promise.<boolean>
+ * [.retrieve(businessUnit, [selectedTypesArr], [keys], [changelogOnly])](#Mcdev.retrieve) ⇒ Promise.<object>
+ * [.deploy(businessUnit, [selectedTypesArr], [keyArr])](#Mcdev.deploy) ⇒ Promise.<Object.<string, TYPE.MultiMetadataTypeMap>>
+ * [.initProject([credentialsName])](#Mcdev.initProject) ⇒ Promise.<void>
+ * [.joinProject()](#Mcdev.joinProject) ⇒ Promise.<void>
+ * [.findBUs(credentialsName)](#Mcdev.findBUs) ⇒ Promise.<void>
+ * [.document(businessUnit, type)](#Mcdev.document) ⇒ Promise.<void>
+ * [.deleteByKey(businessUnit, type, customerKey)](#Mcdev.deleteByKey) ⇒ Promise.<boolean>
+ * [.resolveId(businessUnit, type, id)](#Mcdev.resolveId) ⇒ Promise.<{key:string, name:string, path:string}>
+ * [.refresh(businessUnit, type, [keyArr])](#Mcdev.refresh) ⇒ Promise.<void>
+ * [.badKeys(businessUnit)](#Mcdev.badKeys) ⇒ Promise.<void>
+ * [.retrieveAsTemplate(businessUnit, selectedType, name, market)](#Mcdev.retrieveAsTemplate) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+ * [.buildTemplate(businessUnit, selectedType, keyArr, market)](#Mcdev.buildTemplate) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+ * [.buildDefinition(businessUnit, selectedType, name, market)](#Mcdev.buildDefinition) ⇒ Promise.<void>
+ * [.buildDefinitionBulk(listName, type, name)](#Mcdev.buildDefinitionBulk) ⇒ Promise.<void>
+ * [.getFilesToCommit(businessUnit, selectedType, keyArr)](#Mcdev.getFilesToCommit) ⇒ Promise.<Array.<string>>
+ * [.schedule(businessUnit, [selectedType], [keys])](#Mcdev.schedule) ⇒ Promise.<Object.<string, Array.<string>>>
+ * [.execute(businessUnit, [selectedType], [keys])](#Mcdev.execute) ⇒ Promise.<Object.<string, Array.<string>>>
+ * [.pause(businessUnit, [selectedType], [keys])](#Mcdev.pause) ⇒ Promise.<Object.<string, Array.<string>>>
+ * [.fixKeys(businessUnit, selectedType, [keys])](#Mcdev.fixKeys) ⇒ Promise.<Object.<string, Array.<string>>>
+ * [.version()](#Mcdev.version) ⇒ string
+ * [.setSkipInteraction([skipInteraction])](#Mcdev.setSkipInteraction) ⇒ void
+ * [.setLoggingLevel(argv)](#Mcdev.setLoggingLevel) ⇒ void
+ * [.setOptions(argv)](#Mcdev.setOptions) ⇒ void
+ * [.createDeltaPkg(argv)](#Mcdev.createDeltaPkg) ⇒ Promise.<Array.<TYPE.DeltaPkgItem>>
+ * [.selectTypes()](#Mcdev.selectTypes) ⇒ Promise
+ * [.explainTypes()](#Mcdev.explainTypes) ⇒ Array.<object>
+ * [.upgrade()](#Mcdev.upgrade) ⇒ Promise.<boolean>
+ * [.retrieve(businessUnit, [selectedTypesArr], [keys], [changelogOnly])](#Mcdev.retrieve) ⇒ Promise.<object>
+ * [.deploy(businessUnit, [selectedTypesArr], [keyArr])](#Mcdev.deploy) ⇒ Promise.<Object.<string, TYPE.MultiMetadataTypeMap>>
+ * [.initProject([credentialsName])](#Mcdev.initProject) ⇒ Promise.<void>
+ * [.joinProject()](#Mcdev.joinProject) ⇒ Promise.<void>
+ * [.findBUs(credentialsName)](#Mcdev.findBUs) ⇒ Promise.<void>
+ * [.document(businessUnit, type)](#Mcdev.document) ⇒ Promise.<void>
+ * [.deleteByKey(businessUnit, type, customerKey)](#Mcdev.deleteByKey) ⇒ Promise.<boolean>
+ * [.resolveId(businessUnit, type, id)](#Mcdev.resolveId) ⇒ Promise.<{key:string, name:string, path:string}>
+ * [.refresh(businessUnit, type, [keyArr])](#Mcdev.refresh) ⇒ Promise.<void>
+ * [.badKeys(businessUnit)](#Mcdev.badKeys) ⇒ Promise.<void>
+ * [.retrieveAsTemplate(businessUnit, selectedType, name, market)](#Mcdev.retrieveAsTemplate) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+ * [.buildTemplate(businessUnit, selectedType, keyArr, market)](#Mcdev.buildTemplate) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+ * [.buildDefinition(businessUnit, selectedType, name, market)](#Mcdev.buildDefinition) ⇒ Promise.<void>
+ * [.buildDefinitionBulk(listName, type, name)](#Mcdev.buildDefinitionBulk) ⇒ Promise.<void>
+ * [.getFilesToCommit(businessUnit, selectedType, keyArr)](#Mcdev.getFilesToCommit) ⇒ Promise.<Array.<string>>
+ * [.schedule(businessUnit, [selectedType], [keys])](#Mcdev.schedule) ⇒ Promise.<Object.<string, Array.<string>>>
+ * [.execute(businessUnit, [selectedType], [keys])](#Mcdev.execute) ⇒ Promise.<Object.<string, Array.<string>>>
+ * [.pause(businessUnit, [selectedType], [keys])](#Mcdev.pause) ⇒ Promise.<Object.<string, Array.<string>>>
+ * [.fixKeys(businessUnit, selectedType, [keys])](#Mcdev.fixKeys) ⇒ Promise.<Object.<string, Array.<string>>>
+
+
+
+### Mcdev.version() ⇒ string
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: string
- current version of mcdev
+
+
+### Mcdev.setSkipInteraction([skipInteraction]) ⇒ void
+helper method to use unattended mode when including mcdev as a package
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [skipInteraction] | boolean
\| TYPE.skipInteraction
| signals what to insert automatically for things usually asked via wizard |
+
+
+
+### Mcdev.setLoggingLevel(argv) ⇒ void
+configures what is displayed in the console
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| argv | object
| list of command line parameters given by user |
+| [argv.silent] | boolean
| only errors printed to CLI |
+| [argv.verbose] | boolean
| chatty user CLI output |
+| [argv.debug] | boolean
| enables developer output & features |
+
+
+
+### Mcdev.setOptions(argv) ⇒ void
+allows setting system wide / command related options
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| argv | object
| list of command line parameters given by user |
+
+
+
+### Mcdev.createDeltaPkg(argv) ⇒ Promise.<Array.<TYPE.DeltaPkgItem>>
+handler for 'mcdev createDeltaPkg
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Array.<TYPE.DeltaPkgItem>>
- list of changed items
+
+| Param | Type | Description |
+| --- | --- | --- |
+| argv | object
| yargs parameters |
+| [argv.range] | string
| git commit range into deploy directory |
+| [argv.filter] | string
| filter file paths that start with any |
+| [argv.diffArr] | Array.<TYPE.DeltaPkgItem>
| list of files to include in delta package (skips git diff when provided) |
+
+
+
+### Mcdev.selectTypes() ⇒ Promise
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise
- .
+
+
+### Mcdev.explainTypes() ⇒ Array.<object>
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Array.<object>
- list of supported types with their apiNames
+
+
+### Mcdev.upgrade() ⇒ Promise.<boolean>
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<boolean>
- success flag
+
+
+### Mcdev.retrieve(businessUnit, [selectedTypesArr], [keys], [changelogOnly]) ⇒ Promise.<object>
+Retrieve all metadata from the specified business unit into the local file system.
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<object>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| [selectedTypesArr] | Array.<TYPE.SupportedMetadataTypes>
\| TYPE.TypeKeyCombo
| limit retrieval to given metadata type |
+| [keys] | Array.<string>
| limit retrieval to given metadata key |
+| [changelogOnly] | boolean
| skip saving, only create json in memory |
+
+
+
+### Mcdev.deploy(businessUnit, [selectedTypesArr], [keyArr]) ⇒ Promise.<Object.<string, TYPE.MultiMetadataTypeMap>>
+Deploys all metadata located in the 'deploy' directory to the specified business unit
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, TYPE.MultiMetadataTypeMap>>
- deployed metadata per BU (first key: bu name, second key: metadata type)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| [selectedTypesArr] | Array.<TYPE.SupportedMetadataTypes>
| limit deployment to given metadata type |
+| [keyArr] | Array.<string>
| limit deployment to given metadata keys |
+
+
+
+### Mcdev.initProject([credentialsName]) ⇒ Promise.<void>
+Creates template file for properties.json
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [credentialsName] | string
| identifying name of the installed package / project |
+
+
+
+### Mcdev.joinProject() ⇒ Promise.<void>
+Clones an existing project from git repository and installs it
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+
+### Mcdev.findBUs(credentialsName) ⇒ Promise.<void>
+Refreshes BU names and ID's from MC instance
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| credentialsName | string
| identifying name of the installed package / project |
+
+
+
+### Mcdev.document(businessUnit, type) ⇒ Promise.<void>
+Creates docs for supported metadata types in Markdown and/or HTML format
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| type | string
| metadata type |
+
+
+
+### Mcdev.deleteByKey(businessUnit, type, customerKey) ⇒ Promise.<boolean>
+deletes metadata from MC instance by key
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<boolean>
- true if successful, false otherwise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| type | string
| supported metadata type |
+| customerKey | string
| Identifier of metadata |
+
+
+
+### Mcdev.resolveId(businessUnit, type, id) ⇒ Promise.<{key:string, name:string, path:string}>
+get name & key for provided id
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<{key:string, name:string, path:string}>
- key, name and path of metadata; null if not found
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| type | string
| supported metadata type |
+| id | string
| Identifier of metadata |
+
+
+
+### Mcdev.refresh(businessUnit, type, [keyArr]) ⇒ Promise.<void>
+ensures triggered sends are restarted to ensure they pick up on changes of the underlying emails
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| type | string
| references credentials from properties.json |
+| [keyArr] | Array.<string>
| metadata keys |
+
+
+
+### Mcdev.badKeys(businessUnit) ⇒ Promise.<void>
+Converts metadata to legacy format. Output is saved in 'converted' directory
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+
+
+
+### Mcdev.retrieveAsTemplate(businessUnit, selectedType, name, market) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+Retrieve a specific metadata file and templatise.
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<TYPE.MultiMetadataTypeList>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| selectedType | string
| supported metadata type |
+| name | Array.<string>
| name of the metadata |
+| market | string
| market which should be used to revert template |
+
+
+
+### Mcdev.buildTemplate(businessUnit, selectedType, keyArr, market) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+Build a template based on a list of metadata files in the retrieve folder.
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<TYPE.MultiMetadataTypeList>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| selectedType | string
| supported metadata type |
+| keyArr | Array.<string>
| customerkey of the metadata |
+| market | string
| market localizations |
+
+
+
+### Mcdev.buildDefinition(businessUnit, selectedType, name, market) ⇒ Promise.<void>
+Build a specific metadata file based on a template.
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| selectedType | string
| supported metadata type |
+| name | string
| name of the metadata |
+| market | string
| market localizations |
+
+
+
+### Mcdev.buildDefinitionBulk(listName, type, name) ⇒ Promise.<void>
+Build a specific metadata file based on a template using a list of bu-market combos
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| listName | string
| name of list of BU-market combos |
+| type | string
| supported metadata type |
+| name | string
| name of the metadata |
+
+
+
+### Mcdev.getFilesToCommit(businessUnit, selectedType, keyArr) ⇒ Promise.<Array.<string>>
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Array.<string>>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| selectedType | string
| supported metadata type |
+| keyArr | Array.<string>
| customerkey of the metadata |
+
+
+
+### Mcdev.schedule(businessUnit, [selectedType], [keys]) ⇒ Promise.<Object.<string, Array.<string>>>
+Schedule an item (shortcut for execute --schedule)
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, Array.<string>>>
- key: business unit name, value: list of scheduled item keys
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| name of BU |
+| [selectedType] | TYPE.SupportedMetadataTypes
| limit to given metadata types |
+| [keys] | Array.<string>
| customerkey of the metadata |
+
+
+
+### Mcdev.execute(businessUnit, [selectedType], [keys]) ⇒ Promise.<Object.<string, Array.<string>>>
+Start/execute an item
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, Array.<string>>>
- key: business unit name, value: list of executed item keys
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| name of BU |
+| [selectedType] | TYPE.SupportedMetadataTypes
| limit to given metadata types |
+| [keys] | Array.<string>
| customerkey of the metadata |
+
+
+
+### Mcdev.pause(businessUnit, [selectedType], [keys]) ⇒ Promise.<Object.<string, Array.<string>>>
+pause an item
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, Array.<string>>>
- key: business unit name, value: list of paused item keys
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| name of BU |
+| [selectedType] | TYPE.SupportedMetadataTypes
| limit to given metadata types |
+| [keys] | Array.<string>
| customerkey of the metadata |
+
+
+
+### Mcdev.fixKeys(businessUnit, selectedType, [keys]) ⇒ Promise.<Object.<string, Array.<string>>>
+Updates the key to match the name field
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, Array.<string>>>
- key: business unit name, value: list of paused item keys
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| name of BU |
+| selectedType | TYPE.SupportedMetadataTypes
| limit to given metadata types |
+| [keys] | Array.<string>
| customerkey of the metadata |
+
+
+
+### Mcdev.version() ⇒ string
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: string
- current version of mcdev
+
+
+### Mcdev.setSkipInteraction([skipInteraction]) ⇒ void
+helper method to use unattended mode when including mcdev as a package
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [skipInteraction] | boolean
\| TYPE.skipInteraction
| signals what to insert automatically for things usually asked via wizard |
+
+
+
+### Mcdev.setLoggingLevel(argv) ⇒ void
+configures what is displayed in the console
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| argv | object
| list of command line parameters given by user |
+| [argv.silent] | boolean
| only errors printed to CLI |
+| [argv.verbose] | boolean
| chatty user CLI output |
+| [argv.debug] | boolean
| enables developer output & features |
+
+
+
+### Mcdev.setOptions(argv) ⇒ void
+allows setting system wide / command related options
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| argv | object
| list of command line parameters given by user |
+
+
+
+### Mcdev.createDeltaPkg(argv) ⇒ Promise.<Array.<TYPE.DeltaPkgItem>>
+handler for 'mcdev createDeltaPkg
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Array.<TYPE.DeltaPkgItem>>
- list of changed items
+
+| Param | Type | Description |
+| --- | --- | --- |
+| argv | object
| yargs parameters |
+| [argv.range] | string
| git commit range into deploy directory |
+| [argv.filter] | string
| filter file paths that start with any |
+| [argv.diffArr] | Array.<TYPE.DeltaPkgItem>
| list of files to include in delta package (skips git diff when provided) |
+
+
+
+### Mcdev.selectTypes() ⇒ Promise
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise
- .
+
+
+### Mcdev.explainTypes() ⇒ Array.<object>
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Array.<object>
- list of supported types with their apiNames
+
+
+### Mcdev.upgrade() ⇒ Promise.<boolean>
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<boolean>
- success flag
+
+
+### Mcdev.retrieve(businessUnit, [selectedTypesArr], [keys], [changelogOnly]) ⇒ Promise.<object>
+Retrieve all metadata from the specified business unit into the local file system.
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<object>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| [selectedTypesArr] | Array.<TYPE.SupportedMetadataTypes>
\| TYPE.TypeKeyCombo
| limit retrieval to given metadata type |
+| [keys] | Array.<string>
| limit retrieval to given metadata key |
+| [changelogOnly] | boolean
| skip saving, only create json in memory |
+
+
+
+### Mcdev.deploy(businessUnit, [selectedTypesArr], [keyArr]) ⇒ Promise.<Object.<string, TYPE.MultiMetadataTypeMap>>
+Deploys all metadata located in the 'deploy' directory to the specified business unit
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, TYPE.MultiMetadataTypeMap>>
- deployed metadata per BU (first key: bu name, second key: metadata type)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| [selectedTypesArr] | Array.<TYPE.SupportedMetadataTypes>
| limit deployment to given metadata type |
+| [keyArr] | Array.<string>
| limit deployment to given metadata keys |
+
+
+
+### Mcdev.initProject([credentialsName]) ⇒ Promise.<void>
+Creates template file for properties.json
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [credentialsName] | string
| identifying name of the installed package / project |
+
+
+
+### Mcdev.joinProject() ⇒ Promise.<void>
+Clones an existing project from git repository and installs it
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+
+### Mcdev.findBUs(credentialsName) ⇒ Promise.<void>
+Refreshes BU names and ID's from MC instance
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| credentialsName | string
| identifying name of the installed package / project |
+
+
+
+### Mcdev.document(businessUnit, type) ⇒ Promise.<void>
+Creates docs for supported metadata types in Markdown and/or HTML format
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| type | string
| metadata type |
+
+
+
+### Mcdev.deleteByKey(businessUnit, type, customerKey) ⇒ Promise.<boolean>
+deletes metadata from MC instance by key
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<boolean>
- true if successful, false otherwise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| type | string
| supported metadata type |
+| customerKey | string
| Identifier of metadata |
+
+
+
+### Mcdev.resolveId(businessUnit, type, id) ⇒ Promise.<{key:string, name:string, path:string}>
+get name & key for provided id
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<{key:string, name:string, path:string}>
- key, name and path of metadata; null if not found
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| type | string
| supported metadata type |
+| id | string
| Identifier of metadata |
+
+
+
+### Mcdev.refresh(businessUnit, type, [keyArr]) ⇒ Promise.<void>
+ensures triggered sends are restarted to ensure they pick up on changes of the underlying emails
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| type | string
| references credentials from properties.json |
+| [keyArr] | Array.<string>
| metadata keys |
+
+
+
+### Mcdev.badKeys(businessUnit) ⇒ Promise.<void>
+Converts metadata to legacy format. Output is saved in 'converted' directory
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+
+
+
+### Mcdev.retrieveAsTemplate(businessUnit, selectedType, name, market) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+Retrieve a specific metadata file and templatise.
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<TYPE.MultiMetadataTypeList>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| selectedType | string
| supported metadata type |
+| name | Array.<string>
| name of the metadata |
+| market | string
| market which should be used to revert template |
+
+
+
+### Mcdev.buildTemplate(businessUnit, selectedType, keyArr, market) ⇒ Promise.<TYPE.MultiMetadataTypeList>
+Build a template based on a list of metadata files in the retrieve folder.
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<TYPE.MultiMetadataTypeList>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| selectedType | string
| supported metadata type |
+| keyArr | Array.<string>
| customerkey of the metadata |
+| market | string
| market localizations |
+
+
+
+### Mcdev.buildDefinition(businessUnit, selectedType, name, market) ⇒ Promise.<void>
+Build a specific metadata file based on a template.
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| selectedType | string
| supported metadata type |
+| name | string
| name of the metadata |
+| market | string
| market localizations |
+
+
+
+### Mcdev.buildDefinitionBulk(listName, type, name) ⇒ Promise.<void>
+Build a specific metadata file based on a template using a list of bu-market combos
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| listName | string
| name of list of BU-market combos |
+| type | string
| supported metadata type |
+| name | string
| name of the metadata |
+
+
+
+### Mcdev.getFilesToCommit(businessUnit, selectedType, keyArr) ⇒ Promise.<Array.<string>>
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Array.<string>>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| references credentials from properties.json |
+| selectedType | string
| supported metadata type |
+| keyArr | Array.<string>
| customerkey of the metadata |
+
+
+
+### Mcdev.schedule(businessUnit, [selectedType], [keys]) ⇒ Promise.<Object.<string, Array.<string>>>
+Schedule an item (shortcut for execute --schedule)
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, Array.<string>>>
- key: business unit name, value: list of scheduled item keys
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| name of BU |
+| [selectedType] | TYPE.SupportedMetadataTypes
| limit to given metadata types |
+| [keys] | Array.<string>
| customerkey of the metadata |
+
+
+
+### Mcdev.execute(businessUnit, [selectedType], [keys]) ⇒ Promise.<Object.<string, Array.<string>>>
+Start/execute an item
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, Array.<string>>>
- key: business unit name, value: list of executed item keys
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| name of BU |
+| [selectedType] | TYPE.SupportedMetadataTypes
| limit to given metadata types |
+| [keys] | Array.<string>
| customerkey of the metadata |
+
+
+
+### Mcdev.pause(businessUnit, [selectedType], [keys]) ⇒ Promise.<Object.<string, Array.<string>>>
+pause an item
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, Array.<string>>>
- key: business unit name, value: list of paused item keys
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| name of BU |
+| [selectedType] | TYPE.SupportedMetadataTypes
| limit to given metadata types |
+| [keys] | Array.<string>
| customerkey of the metadata |
+
+
+
+### Mcdev.fixKeys(businessUnit, selectedType, [keys]) ⇒ Promise.<Object.<string, Array.<string>>>
+Updates the key to match the name field
+
+**Kind**: static method of [Mcdev
](#Mcdev)
+**Returns**: Promise.<Object.<string, Array.<string>>>
- key: business unit name, value: list of paused item keys
+
+| Param | Type | Description |
+| --- | --- | --- |
+| businessUnit | string
| name of BU |
+| selectedType | TYPE.SupportedMetadataTypes
| limit to given metadata types |
+| [keys] | Array.<string>
| customerkey of the metadata |
+
+
+
+## Asset ⇐ [MetadataType
](#MetadataType)
+FileTransfer MetadataType
+
+**Kind**: global class
+**Extends**: [MetadataType
](#MetadataType)
+
+* [Asset](#Asset) ⇐ [MetadataType
](#MetadataType)
+ * [.retrieve(retrieveDir, _, [subTypeArr], [key])](#Asset.retrieve) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+ * [.retrieveForCache([_], [subTypeArr])](#Asset.retrieveForCache) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables, [selectedSubType])](#Asset.retrieveAsTemplate) ⇒ Promise.<{metadata: TYPE.AssetItem, type: string}>
+ * [.create(metadata)](#Asset.create) ⇒ Promise
+ * [.update(metadata)](#Asset.update) ⇒ Promise
+ * [.requestSubType(subType, [retrieveDir], [templateName], [templateVariables], key)](#Asset.requestSubType) ⇒ Promise
+ * [.requestAndSaveExtended(items, subType, retrieveDir, [templateVariables])](#Asset.requestAndSaveExtended) ⇒ Promise
+ * [._retrieveExtendedFile(metadata, subType, retrieveDir)](#Asset._retrieveExtendedFile) ⇒ Promise.<void>
+ * [._readExtendedFileFromFS(metadata, subType, deployDir, [pathOnly])](#Asset._readExtendedFileFromFS) ⇒ Promise.<string>
+ * [.postRetrieveTasks(metadata)](#Asset.postRetrieveTasks) ⇒ TYPE.CodeExtractItem
+ * [.postDeployTasks(metadata, _, createdUpdated)](#Asset.postDeployTasks) ⇒ Promise.<void>
+ * [.preDeployTasks(metadata, deployDir)](#Asset.preDeployTasks) ⇒ Promise.<TYPE.AssetItem>
+ * [._getMainSubtype(extendedSubType)](#Asset._getMainSubtype) ⇒ string
+ * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Asset.buildDefinitionForNested) ⇒ Promise.<void>
+ * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Asset.buildTemplateForNested) ⇒ Promise.<void>
+ * [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#Asset._buildForNested) ⇒ Promise.<void>
+ * [.setFolderPath(metadata)](#Asset.setFolderPath)
+ * [.setFolderId(metadata)](#Asset.setFolderId)
+ * [._mergeCode(metadata, deployDir, subType, [templateName], [fileListOnly])](#Asset._mergeCode) ⇒ Promise.<Array.<TYPE.CodeExtract>>
+ * [._mergeCode_slots(prefix, metadataSlots, readDirArr, subtypeExtension, subDirArr, fileList, customerKey, [templateName], [fileListOnly])](#Asset._mergeCode_slots) ⇒ Promise.<void>
+ * [._extractCode(metadata)](#Asset._extractCode) ⇒ TYPE.CodeExtractItem
+ * [._extractCode_slots(prefix, metadataSlots, codeArr)](#Asset._extractCode_slots) ⇒ void
+ * [.getJsonFromFS(dir, [_], selectedSubType)](#Asset.getJsonFromFS) ⇒ TYPE.MetadataTypeMap
+ * [.findSubType(templateDir, templateName)](#Asset.findSubType) ⇒ Promise.<TYPE.AssetSubType>
+ * [.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName)](#Asset.readSecondaryFolder) ⇒ TYPE.AssetItem
+ * [.getFilesToCommit(keyArr)](#Asset.getFilesToCommit) ⇒ Array.<string>
+ * [.deleteByKey(customerKey)](#Asset.deleteByKey) ⇒ Promise.<boolean>
+ * [.postDeleteTasks(customerKey)](#Asset.postDeleteTasks) ⇒ void
+ * [.resolveId(id)](#Asset.resolveId) ⇒ Promise.<{key:string, name:string, path:string}>
+ * [.retrieve(retrieveDir, _, [subTypeArr], [key])](#Asset.retrieve) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+ * [.retrieveForCache([_], [subTypeArr])](#Asset.retrieveForCache) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables, [selectedSubType])](#Asset.retrieveAsTemplate) ⇒ Promise.<{metadata: TYPE.AssetItem, type: string}>
+ * [.create(metadata)](#Asset.create) ⇒ Promise
+ * [.update(metadata)](#Asset.update) ⇒ Promise
+ * [.requestSubType(subType, [retrieveDir], [templateName], [templateVariables], key)](#Asset.requestSubType) ⇒ Promise
+ * [.requestAndSaveExtended(items, subType, retrieveDir, [templateVariables])](#Asset.requestAndSaveExtended) ⇒ Promise
+ * [._retrieveExtendedFile(metadata, subType, retrieveDir)](#Asset._retrieveExtendedFile) ⇒ Promise.<void>
+ * [._readExtendedFileFromFS(metadata, subType, deployDir, [pathOnly])](#Asset._readExtendedFileFromFS) ⇒ Promise.<string>
+ * [.postRetrieveTasks(metadata)](#Asset.postRetrieveTasks) ⇒ TYPE.CodeExtractItem
+ * [.postDeployTasks(metadata, _, createdUpdated)](#Asset.postDeployTasks) ⇒ Promise.<void>
+ * [.preDeployTasks(metadata, deployDir)](#Asset.preDeployTasks) ⇒ Promise.<TYPE.AssetItem>
+ * [._getMainSubtype(extendedSubType)](#Asset._getMainSubtype) ⇒ string
+ * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Asset.buildDefinitionForNested) ⇒ Promise.<void>
+ * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Asset.buildTemplateForNested) ⇒ Promise.<void>
+ * [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#Asset._buildForNested) ⇒ Promise.<void>
+ * [.setFolderPath(metadata)](#Asset.setFolderPath)
+ * [.setFolderId(metadata)](#Asset.setFolderId)
+ * [._mergeCode(metadata, deployDir, subType, [templateName], [fileListOnly])](#Asset._mergeCode) ⇒ Promise.<Array.<TYPE.CodeExtract>>
+ * [._mergeCode_slots(prefix, metadataSlots, readDirArr, subtypeExtension, subDirArr, fileList, customerKey, [templateName], [fileListOnly])](#Asset._mergeCode_slots) ⇒ Promise.<void>
+ * [._extractCode(metadata)](#Asset._extractCode) ⇒ TYPE.CodeExtractItem
+ * [._extractCode_slots(prefix, metadataSlots, codeArr)](#Asset._extractCode_slots) ⇒ void
+ * [.getJsonFromFS(dir, [_], selectedSubType)](#Asset.getJsonFromFS) ⇒ TYPE.MetadataTypeMap
+ * [.findSubType(templateDir, templateName)](#Asset.findSubType) ⇒ Promise.<TYPE.AssetSubType>
+ * [.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName)](#Asset.readSecondaryFolder) ⇒ TYPE.AssetItem
+ * [.getFilesToCommit(keyArr)](#Asset.getFilesToCommit) ⇒ Array.<string>
+ * [.deleteByKey(customerKey)](#Asset.deleteByKey) ⇒ Promise.<boolean>
+ * [.postDeleteTasks(customerKey)](#Asset.postDeleteTasks) ⇒ void
+ * [.resolveId(id)](#Asset.resolveId) ⇒ Promise.<{key:string, name:string, path:string}>
+
+
+
+### Asset.retrieve(retrieveDir, _, [subTypeArr], [key]) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+Retrieves Metadata of Asset
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{metadata: TYPE.AssetMap, type: string}>
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| _ | void
| - |
+| [subTypeArr] | Array.<TYPE.AssetSubType>
| optionally limit to a single subtype |
+| [key] | string
| customer key |
+
+
+
+### Asset.retrieveForCache([_], [subTypeArr]) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+Retrieves asset metadata for caching
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{metadata: TYPE.AssetMap, type: string}>
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| [_] | void
| parameter not used |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+
+
+
+### Asset.retrieveAsTemplate(templateDir, name, templateVariables, [selectedSubType]) ⇒ Promise.<{metadata: TYPE.AssetItem, type: string}>
+Retrieves asset metadata for templating
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{metadata: TYPE.AssetItem, type: string}>
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| name | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| [selectedSubType] | TYPE.AssetSubType
| optionally limit to a single subtype |
+
+
+
+### Asset.create(metadata) ⇒ Promise
+Creates a single asset
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.AssetItem
| a single asset |
+
+
+
+### Asset.update(metadata) ⇒ Promise
+Updates a single asset
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.AssetItem
| a single asset |
+
+
+
+### Asset.requestSubType(subType, [retrieveDir], [templateName], [templateVariables], key) ⇒ Promise
+Retrieves Metadata of a specific asset type
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
+| [retrieveDir] | string
| target directory for saving assets |
+| [templateName] | string
| name of the metadata file |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| key | string
| customer key to filter by |
+
+
+
+### Asset.requestAndSaveExtended(items, subType, retrieveDir, [templateVariables]) ⇒ Promise
+Retrieves extended metadata (files or extended content) of asset
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| items | Array
| array of items to retrieve |
+| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
+| retrieveDir | string
| target directory for saving assets |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### Asset.\_retrieveExtendedFile(metadata, subType, retrieveDir) ⇒ Promise.<void>
+Some metadata types store their actual content as a separate file, e.g. images
+This method retrieves these and saves them alongside the metadata json
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.AssetItem
| a single asset |
+| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
+| retrieveDir | string
| target directory for saving assets |
+
+
+
+### Asset.\_readExtendedFileFromFS(metadata, subType, deployDir, [pathOnly]) ⇒ Promise.<string>
+helper for [preDeployTasks](#Asset.preDeployTasks)
+Some metadata types store their actual content as a separate file, e.g. images
+This method reads these from the local FS stores them in the metadata object allowing to deploy it
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<string>
- if found will return the path of the binary file
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| metadata | TYPE.AssetItem
| | a single asset |
+| subType | TYPE.AssetSubType
| | group of similar assets to put in a folder (ie. images) |
+| deployDir | string
| | directory of deploy files |
+| [pathOnly] | boolean
| false
| used by getFilesToCommit which does not need the binary file to be actually read |
+
+
+
+### Asset.postRetrieveTasks(metadata) ⇒ TYPE.CodeExtractItem
+manages post retrieve steps
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.CodeExtractItem
- metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.AssetItem
| a single asset |
+
+
+
+### Asset.postDeployTasks(metadata, _, createdUpdated) ⇒ Promise.<void>
+Gets executed after deployment of metadata type
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| _ | TYPE.MetadataTypeMap
| originalMetadata to be updated (contains additioanl fields) |
+| createdUpdated | Object
| counter representing successful creates/updates |
+
+
+
+### Asset.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.AssetItem>
+prepares an asset definition for deployment
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<TYPE.AssetItem>
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.AssetItem
| a single asset |
+| deployDir | string
| directory of deploy files |
+
+
+
+### Asset.\_getMainSubtype(extendedSubType) ⇒ string
+find the subType matching the extendedSubType
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: string
- subType: block, message, other, etc
+
+| Param | Type | Description |
+| --- | --- | --- |
+| extendedSubType | string
| webpage, htmlblock, etc |
+
+
+
+### Asset.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<void>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
| Directory where built definitions will be saved |
+| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+
+
+### Asset.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<void>
+helper for [buildTemplate](#MetadataType.buildTemplate)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+
+**Example**
+```js
+assets of type codesnippetblock will result in 1 json and 1 amp/html file. both files need to be run through templating
+```
+
+
+### Asset.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ Promise.<void>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
| Directory where built definitions will be saved |
+| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+| mode | 'definition'
\| 'template'
| defines what we use this helper for |
+
+
+
+### Asset.setFolderPath(metadata)
+generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
+
+**Kind**: static method of [Asset
](#Asset)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single script activity definition |
+
+
+
+### Asset.setFolderId(metadata)
+Asset-specific script that retrieves the folder ID from cache and updates the given metadata with it before deploy
+
+**Kind**: static method of [Asset
](#Asset)
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+
+
+
+### Asset.\_mergeCode(metadata, deployDir, subType, [templateName], [fileListOnly]) ⇒ Promise.<Array.<TYPE.CodeExtract>>
+helper for [preDeployTasks](#Asset.preDeployTasks) that loads extracted code content back into JSON
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<Array.<TYPE.CodeExtract>>
- fileList for templating (disregarded during deployment)
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| metadata | TYPE.AssetItem
| | a single asset definition |
+| deployDir | string
| | directory of deploy files |
+| subType | TYPE.AssetSubType
| | asset-subtype name |
+| [templateName] | string
| | name of the template used to built defintion (prior applying templating) |
+| [fileListOnly] | boolean
| false
| does not read file contents nor update metadata if true |
+
+
+
+### Asset.\_mergeCode\_slots(prefix, metadataSlots, readDirArr, subtypeExtension, subDirArr, fileList, customerKey, [templateName], [fileListOnly]) ⇒ Promise.<void>
+helper for [preDeployTasks](#Asset.preDeployTasks) that loads extracted code content back into JSON
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| prefix | string
| | usually the customerkey |
+| metadataSlots | object
| | metadata.views.html.slots or deeper slots.<>.blocks.<>.slots |
+| readDirArr | Array.<string>
| | directory of deploy files |
+| subtypeExtension | string
| | asset-subtype name ending on -meta |
+| subDirArr | Array.<string>
| | directory of files w/o leading deploy dir |
+| fileList | Array.<object>
| | directory of files w/o leading deploy dir |
+| customerKey | string
| | external key of template (could have been changed if used during templating) |
+| [templateName] | string
| | name of the template used to built defintion (prior applying templating) |
+| [fileListOnly] | boolean
| false
| does not read file contents nor update metadata if true |
+
+
+
+### Asset.\_extractCode(metadata) ⇒ TYPE.CodeExtractItem
+helper for [postRetrieveTasks](#Asset.postRetrieveTasks) that finds code content in JSON and extracts it
+to allow saving that separately and formatted
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.CodeExtractItem
- { json: metadata, codeArr: object[], subFolder: string[] }
| Param | Type | Description |
| --- | --- | --- |
-| url | string
| endpoint |
-| key | string
| Identifier of metadata |
-| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
+| metadata | TYPE.AssetItem
| a single asset definition |
-
+
-### MetadataType.readBUMetadataForType(readDir, [listBadKeys], [buMetadata]) ⇒ object
-Returns metadata of a business unit that is saved locally
+### Asset.\_extractCode\_slots(prefix, metadataSlots, codeArr) ⇒ void
+**Kind**: static method of [Asset
](#Asset)
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: object
- Metadata of BU in local directory
+| Param | Type | Description |
+| --- | --- | --- |
+| prefix | string
| usually the customerkey |
+| metadataSlots | object
| metadata.views.html.slots or deeper slots.<>.blocks.<>.slots |
+| codeArr | Array.<object>
| to be extended array for extracted code |
+
+
+
+### Asset.getJsonFromFS(dir, [_], selectedSubType) ⇒ TYPE.MetadataTypeMap
+Returns file contents mapped to their fileName without '.json' ending
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.MetadataTypeMap
- fileName => fileContent map
| Param | Type | Description |
| --- | --- | --- |
-| readDir | string
| root directory of metadata. |
-| [listBadKeys] | boolean
| do not print errors, used for badKeys() |
-| [buMetadata] | object
| Metadata of BU in local directory |
+| dir | string
| directory that contains '.json' files to be read |
+| [_] | void
| unused parameter |
+| selectedSubType | Array.<string>
| asset, message, ... |
-
+
-### MetadataType.getFilesToCommit(keyArr) ⇒ Promise.<Array.<string>>
+### Asset.findSubType(templateDir, templateName) ⇒ Promise.<TYPE.AssetSubType>
+check template directory for complex types that open subfolders for their subtypes
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<TYPE.AssetSubType>
- subtype name
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| templateName | string
| name of the metadata file |
+
+
+
+### Asset.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName) ⇒ TYPE.AssetItem
+optional method used for some types to try a different folder structure
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.AssetItem
- metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| typeDirArr | Array.<string>
| current subdir for this type |
+| templateName | string
| name of the metadata template |
+| fileName | string
| name of the metadata template file w/o extension |
+
+
+
+### Asset.getFilesToCommit(keyArr) ⇒ Array.<string>
should return only the json for all but asset, query and script that are saved as multiple files
additionally, the documentation for dataExtension and automation should be returned
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Promise.<Array.<string>>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
| Param | Type | Description |
| --- | --- | --- |
| keyArr | Array.<string>
| customerkey of the metadata |
-
+
-### MetadataType.getKeysForFixing(metadataMap) ⇒ Array.<string>
-**Kind**: static method of [MetadataType
](#MetadataType)
-**Returns**: Array.<string>
- list of keys
+### Asset.deleteByKey(customerKey) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<boolean>
- deletion success flag
| Param | Type | Description |
| --- | --- | --- |
-| metadataMap | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| customerKey | string
| Identifier of data extension |
-
+
-## MobileCode ⇐ [MetadataType
](#MetadataType)
-MobileCode MetadataType
+### Asset.postDeleteTasks(customerKey) ⇒ void
+clean up after deleting a metadata item
+cannot use the generic method due to the complexity of how assets are saved to disk
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [Asset
](#Asset)
-* [MobileCode](#MobileCode) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#MobileCode.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache()](#MobileCode.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of metadata item |
-
+
-### MobileCode.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of Mobile Keywords
-Endpoint /legacy/v1/beta/mobile/code/ return all Mobile Codes with all details.
+### Asset.resolveId(id) ⇒ Promise.<{key:string, name:string, path:string}>
+get name & key for provided id
-**Kind**: static method of [MobileCode
](#MobileCode)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{key:string, name:string, path:string}>
- key, name and path of metadata; null if not found
+
+| Param | Type | Description |
+| --- | --- | --- |
+| id | string
| Identifier of metadata |
+
+
+
+### Asset.retrieve(retrieveDir, _, [subTypeArr], [key]) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+Retrieves Metadata of Asset
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{metadata: TYPE.AssetMap, type: string}>
- Promise
| Param | Type | Description |
| --- | --- | --- |
| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| _ | void
| - |
+| [subTypeArr] | Array.<TYPE.AssetSubType>
| optionally limit to a single subtype |
+| [key] | string
| customer key |
-
+
-### MobileCode.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves event definition metadata for caching
+### Asset.retrieveForCache([_], [subTypeArr]) ⇒ Promise.<{metadata: TYPE.AssetMap, type: string}>
+Retrieves asset metadata for caching
-**Kind**: static method of [MobileCode
](#MobileCode)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
-
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{metadata: TYPE.AssetMap, type: string}>
- Promise
-## MobileKeyword ⇐ [MetadataType
](#MetadataType)
-MobileKeyword MetadataType
+| Param | Type | Description |
+| --- | --- | --- |
+| [_] | void
| parameter not used |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+
+
+
+### Asset.retrieveAsTemplate(templateDir, name, templateVariables, [selectedSubType]) ⇒ Promise.<{metadata: TYPE.AssetItem, type: string}>
+Retrieves asset metadata for templating
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{metadata: TYPE.AssetItem, type: string}>
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| name | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| [selectedSubType] | TYPE.AssetSubType
| optionally limit to a single subtype |
+
+
+
+### Asset.create(metadata) ⇒ Promise
+Creates a single asset
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.AssetItem
| a single asset |
+
+
+
+### Asset.update(metadata) ⇒ Promise
+Updates a single asset
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.AssetItem
| a single asset |
+
+
+
+### Asset.requestSubType(subType, [retrieveDir], [templateName], [templateVariables], key) ⇒ Promise
+Retrieves Metadata of a specific asset type
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
+| [retrieveDir] | string
| target directory for saving assets |
+| [templateName] | string
| name of the metadata file |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| key | string
| customer key to filter by |
+
+
+
+### Asset.requestAndSaveExtended(items, subType, retrieveDir, [templateVariables]) ⇒ Promise
+Retrieves extended metadata (files or extended content) of asset
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise
- Promise
+
+| Param | Type | Description |
+| --- | --- | --- |
+| items | Array
| array of items to retrieve |
+| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
+| retrieveDir | string
| target directory for saving assets |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+
+
+
+### Asset.\_retrieveExtendedFile(metadata, subType, retrieveDir) ⇒ Promise.<void>
+Some metadata types store their actual content as a separate file, e.g. images
+This method retrieves these and saves them alongside the metadata json
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.AssetItem
| a single asset |
+| subType | TYPE.AssetSubType
| group of similar assets to put in a folder (ie. images) |
+| retrieveDir | string
| target directory for saving assets |
+
+
+
+### Asset.\_readExtendedFileFromFS(metadata, subType, deployDir, [pathOnly]) ⇒ Promise.<string>
+helper for [preDeployTasks](#Asset.preDeployTasks)
+Some metadata types store their actual content as a separate file, e.g. images
+This method reads these from the local FS stores them in the metadata object allowing to deploy it
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<string>
- if found will return the path of the binary file
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| metadata | TYPE.AssetItem
| | a single asset |
+| subType | TYPE.AssetSubType
| | group of similar assets to put in a folder (ie. images) |
+| deployDir | string
| | directory of deploy files |
+| [pathOnly] | boolean
| false
| used by getFilesToCommit which does not need the binary file to be actually read |
+
+
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+### Asset.postRetrieveTasks(metadata) ⇒ TYPE.CodeExtractItem
+manages post retrieve steps
-* [MobileKeyword](#MobileKeyword) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#MobileKeyword.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
\| void
- * [.parseResponseBody(body, [singleRetrieve])](#MobileKeyword.parseResponseBody) ⇒ TYPE.MetadataTypeMap
- * [.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate)](#MobileKeyword.createOrUpdate) ⇒ 'create'
\| 'update'
\| 'skip'
- * [.retrieveForCache([_], [__], [key])](#MobileKeyword.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveAsTemplate(templateDir, key, templateVariables)](#MobileKeyword.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
- * [.create(metadata)](#MobileKeyword.create) ⇒ Promise
- * [.update(metadata)](#MobileKeyword.update) ⇒ Promise
- * [.postRetrieveTasks(metadata)](#MobileKeyword.postRetrieveTasks) ⇒ TYPE.CodeExtractItem
\| TYPE.MetadataTypeItem
\| void
- * [.prepExtractedCode(metadataScript)](#MobileKeyword.prepExtractedCode) ⇒ Object
- * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#MobileKeyword.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#MobileKeyword.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#MobileKeyword._buildForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [.preDeployTasks(metadata, deployDir)](#MobileKeyword.preDeployTasks) ⇒ Promise.<TYPE.MetadataTypeItem>
- * [.postCreateTasks(metadataEntry, apiResponse)](#MobileKeyword.postCreateTasks) ⇒ void
- * [.postUpdateTasks(metadataEntry, apiResponse)](#MobileKeyword.postUpdateTasks) ⇒ void
- * [._mergeCode(metadata, deployDir, [templateName])](#MobileKeyword._mergeCode) ⇒ Promise.<string>
- * [.deleteByKey(key)](#MobileKeyword.deleteByKey) ⇒ Promise.<boolean>
- * [.postDeleteTasks(customerKey)](#MobileKeyword.postDeleteTasks) ⇒ void
- * [.getFilesToCommit(keyArr)](#MobileKeyword.getFilesToCommit) ⇒ Array.<string>
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.CodeExtractItem
- metadata
-
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.AssetItem
| a single asset |
-### MobileKeyword.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
\| void
-Retrieves Metadata of Mobile Keywords
-Endpoint /legacy/v1/beta/mobile/keyword/ return all Mobile Keywords with all details.
+
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
\| void
- Promise of metadata
+### Asset.postDeployTasks(metadata, _, createdUpdated) ⇒ Promise.<void>
+Gets executed after deployment of metadata type
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| _ | TYPE.MetadataTypeMap
| originalMetadata to be updated (contains additioanl fields) |
+| createdUpdated | Object
| counter representing successful creates/updates |
-
+
-### MobileKeyword.parseResponseBody(body, [singleRetrieve]) ⇒ TYPE.MetadataTypeMap
-Builds map of metadata entries mapped to their keyfields
+### Asset.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.AssetItem>
+prepares an asset definition for deployment
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: TYPE.MetadataTypeMap
- keyField => metadata map
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<TYPE.AssetItem>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| body | object
| json of response body |
-| [singleRetrieve] | string
\| number
| key of single item to filter by |
+| metadata | TYPE.AssetItem
| a single asset |
+| deployDir | string
| directory of deploy files |
-
+
-### MobileKeyword.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate) ⇒ 'create'
\| 'update'
\| 'skip'
-helper for [upsert](#MetadataType.upsert)
+### Asset.\_getMainSubtype(extendedSubType) ⇒ string
+find the subType matching the extendedSubType
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: 'create'
\| 'update'
\| 'skip'
- action to take
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: string
- subType: block, message, other, etc
| Param | Type | Description |
| --- | --- | --- |
-| metadataMap | TYPE.MetadataTypeMap
| list of metadata |
-| metadataKey | string
| key of item we are looking at |
-| hasError | boolean
| error flag from previous code |
-| metadataToUpdate | Array.<TYPE.MetadataTypeItemDiff>
| list of items to update |
-| metadataToCreate | Array.<TYPE.MetadataTypeItem>
| list of items to create |
+| extendedSubType | string
| webpage, htmlblock, etc |
-
+
-### MobileKeyword.retrieveForCache([_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves event definition metadata for caching
+### Asset.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<void>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| [_] | void
| parameter not used |
-| [__] | void
| parameter not used |
-| [key] | string
| customer key of single item to retrieve |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
| Directory where built definitions will be saved |
+| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
-
+
-### MobileKeyword.retrieveAsTemplate(templateDir, key, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
-retrieve an item and create a template from it
+### Asset.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<void>
+helper for [buildTemplate](#MetadataType.buildTemplate)
+handles extracted code if any are found for complex types
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- Promise of metadata
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where retrieved metadata directory will be saved |
-| key | string
| name of the metadata file |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
-
+**Example**
+```js
+assets of type codesnippetblock will result in 1 json and 1 amp/html file. both files need to be run through templating
+```
+
-### MobileKeyword.create(metadata) ⇒ Promise
-Creates a single item
+### Asset.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ Promise.<void>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: Promise
- Promise
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
| Directory where built definitions will be saved |
+| metadata | TYPE.AssetItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
+| mode | 'definition'
\| 'template'
| defines what we use this helper for |
-
+
-### MobileKeyword.update(metadata) ⇒ Promise
-Updates a single item
+### Asset.setFolderPath(metadata)
+generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: Promise
- Promise
+**Kind**: static method of [Asset
](#Asset)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| metadata | TYPE.MetadataTypeItem
| a single script activity definition |
-
+
-### MobileKeyword.postRetrieveTasks(metadata) ⇒ TYPE.CodeExtractItem
\| TYPE.MetadataTypeItem
\| void
-manages post retrieve steps
+### Asset.setFolderId(metadata)
+Asset-specific script that retrieves the folder ID from cache and updates the given metadata with it before deploy
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: TYPE.CodeExtractItem
\| TYPE.MetadataTypeItem
\| void
- Array with one metadata object and one ssjs string; or single metadata object; nothing if filtered
+**Kind**: static method of [Asset
](#Asset)
| Param | Type | Description |
| --- | --- | --- |
| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-### MobileKeyword.prepExtractedCode(metadataScript) ⇒ Object
-helper for [postRetrieveTasks](#MobileKeyword.postRetrieveTasks) and [_buildForNested](#MobileKeyword._buildForNested)
+### Asset.\_mergeCode(metadata, deployDir, subType, [templateName], [fileListOnly]) ⇒ Promise.<Array.<TYPE.CodeExtract>>
+helper for [preDeployTasks](#Asset.preDeployTasks) that loads extracted code content back into JSON
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: Object
- returns found extension and file content
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<Array.<TYPE.CodeExtract>>
- fileList for templating (disregarded during deployment)
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| metadata | TYPE.AssetItem
| | a single asset definition |
+| deployDir | string
| | directory of deploy files |
+| subType | TYPE.AssetSubType
| | asset-subtype name |
+| [templateName] | string
| | name of the template used to built defintion (prior applying templating) |
+| [fileListOnly] | boolean
| false
| does not read file contents nor update metadata if true |
+
+
+
+### Asset.\_mergeCode\_slots(prefix, metadataSlots, readDirArr, subtypeExtension, subDirArr, fileList, customerKey, [templateName], [fileListOnly]) ⇒ Promise.<void>
+helper for [preDeployTasks](#Asset.preDeployTasks) that loads extracted code content back into JSON
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<void>
- -
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| prefix | string
| | usually the customerkey |
+| metadataSlots | object
| | metadata.views.html.slots or deeper slots.<>.blocks.<>.slots |
+| readDirArr | Array.<string>
| | directory of deploy files |
+| subtypeExtension | string
| | asset-subtype name ending on -meta |
+| subDirArr | Array.<string>
| | directory of files w/o leading deploy dir |
+| fileList | Array.<object>
| | directory of files w/o leading deploy dir |
+| customerKey | string
| | external key of template (could have been changed if used during templating) |
+| [templateName] | string
| | name of the template used to built defintion (prior applying templating) |
+| [fileListOnly] | boolean
| false
| does not read file contents nor update metadata if true |
+
+
+
+### Asset.\_extractCode(metadata) ⇒ TYPE.CodeExtractItem
+helper for [postRetrieveTasks](#Asset.postRetrieveTasks) that finds code content in JSON and extracts it
+to allow saving that separately and formatted
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.CodeExtractItem
- { json: metadata, codeArr: object[], subFolder: string[] }
| Param | Type | Description |
| --- | --- | --- |
-| metadataScript | string
| the code of the file |
-
-
+| metadata | TYPE.AssetItem
| a single asset definition |
-### MobileKeyword.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
-helper for [buildDefinition](#MetadataType.buildDefinition)
-handles extracted code if any are found for complex types
+
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+### Asset.\_extractCode\_slots(prefix, metadataSlots, codeArr) ⇒ void
+**Kind**: static method of [Asset
](#Asset)
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
+| prefix | string
| usually the customerkey |
+| metadataSlots | object
| metadata.views.html.slots or deeper slots.<>.blocks.<>.slots |
+| codeArr | Array.<object>
| to be extended array for extracted code |
-
+
-### MobileKeyword.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
-helper for [buildTemplate](#MetadataType.buildTemplate)
-handles extracted code if any are found for complex types
+### Asset.getJsonFromFS(dir, [_], selectedSubType) ⇒ TYPE.MetadataTypeMap
+Returns file contents mapped to their fileName without '.json' ending
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.MetadataTypeMap
- fileName => fileContent map
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
-
-**Example**
-```js
-scripts are saved as 1 json and 1 ssjs file. both files need to be run through templating
-```
-
+| dir | string
| directory that contains '.json' files to be read |
+| [_] | void
| unused parameter |
+| selectedSubType | Array.<string>
| asset, message, ... |
-### MobileKeyword.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ Promise.<Array.<Array.<string>>>
-helper for [buildTemplateForNested](#MobileKeyword.buildTemplateForNested) / [buildDefinitionForNested](#MobileKeyword.buildDefinitionForNested)
-handles extracted code if any are found for complex types
+
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+### Asset.findSubType(templateDir, templateName) ⇒ Promise.<TYPE.AssetSubType>
+check template directory for complex types that open subfolders for their subtypes
+
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<TYPE.AssetSubType>
- subtype name
| Param | Type | Description |
| --- | --- | --- |
| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
-| mode | 'definition'
\| 'template'
| defines what we use this helper for |
+| templateName | string
| name of the metadata file |
-
+
-### MobileKeyword.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.MetadataTypeItem>
-prepares an event definition for deployment
+### Asset.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName) ⇒ TYPE.AssetItem
+optional method used for some types to try a different folder structure
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: Promise.<TYPE.MetadataTypeItem>
- Promise
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: TYPE.AssetItem
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single MobileKeyword |
-| deployDir | string
| directory of deploy files |
+| templateDir | string
| Directory where metadata templates are stored |
+| typeDirArr | Array.<string>
| current subdir for this type |
+| templateName | string
| name of the metadata template |
+| fileName | string
| name of the metadata template file w/o extension |
-
+
-### MobileKeyword.postCreateTasks(metadataEntry, apiResponse) ⇒ void
-helper for [createREST](#MetadataType.createREST)
+### Asset.getFilesToCommit(keyArr) ⇒ Array.<string>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
-| apiResponse | object
| varies depending on the API call |
+| keyArr | Array.<string>
| customerkey of the metadata |
-
+
-### MobileKeyword.postUpdateTasks(metadataEntry, apiResponse) ⇒ void
-helper for [updateREST](#MetadataType.updateREST)
+### Asset.deleteByKey(customerKey) ⇒ Promise.<boolean>
+Delete a metadata item from the specified business unit
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<boolean>
- deletion success flag
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
-| apiResponse | object
| varies depending on the API call |
+| customerKey | string
| Identifier of data extension |
-
+
-### MobileKeyword.\_mergeCode(metadata, deployDir, [templateName]) ⇒ Promise.<string>
-helper for [preDeployTasks](#MobileKeyword.preDeployTasks) that loads extracted code content back into JSON
+### Asset.postDeleteTasks(customerKey) ⇒ void
+clean up after deleting a metadata item
+cannot use the generic method due to the complexity of how assets are saved to disk
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: Promise.<string>
- content for metadata.script
+**Kind**: static method of [Asset
](#Asset)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single definition |
-| deployDir | string
| directory of deploy files |
-| [templateName] | string
| name of the template used to built defintion (prior applying templating) |
+| customerKey | string
| Identifier of metadata item |
-
+
-### MobileKeyword.deleteByKey(key) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
+### Asset.resolveId(id) ⇒ Promise.<{key:string, name:string, path:string}>
+get name & key for provided id
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: Promise.<boolean>
- deletion success status
+**Kind**: static method of [Asset
](#Asset)
+**Returns**: Promise.<{key:string, name:string, path:string}>
- key, name and path of metadata; null if not found
| Param | Type | Description |
| --- | --- | --- |
-| key | string
| Identifier of item |
+| id | string
| Identifier of metadata |
-
+
-### MobileKeyword.postDeleteTasks(customerKey) ⇒ void
-clean up after deleting a metadata item
+## MetadataType
+MetadataType class that gets extended by their specific metadata type class.
+Provides default functionality that can be overwritten by child metadata type classes
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
+**Kind**: global class
-| Param | Type | Description |
-| --- | --- | --- |
-| customerKey | string
| Identifier of metadata item |
+* [MetadataType](#MetadataType)
+ * [.client](#MetadataType.client) : TYPE.SDK
+ * [.properties](#MetadataType.properties) : TYPE.Mcdevrc
+ * [.subType](#MetadataType.subType) : string
+ * [.buObject](#MetadataType.buObject) : TYPE.BuObject
+ * [.client](#MetadataType.client) : TYPE.SDK
+ * [.properties](#MetadataType.properties) : TYPE.Mcdevrc
+ * [.subType](#MetadataType.subType) : string
+ * [.buObject](#MetadataType.buObject) : TYPE.BuObject
+ * [.getJsonFromFS(dir, [listBadKeys])](#MetadataType.getJsonFromFS) ⇒ TYPE.MetadataTypeMap
+ * [.getFieldNamesToRetrieve([additionalFields], [isCaching])](#MetadataType.getFieldNamesToRetrieve) ⇒ Array.<string>
+ * [.deploy(metadata, deployDir, retrieveDir)](#MetadataType.deploy) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.postDeployTasks(upsertResults, originalMetadata, createdUpdated)](#MetadataType.postDeployTasks) ⇒ void
+ * [.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields)](#MetadataType.postCreateTasks) ⇒ void
+ * [.postUpdateTasks(metadataEntry, apiResponse)](#MetadataType.postUpdateTasks) ⇒ void
+ * [.postDeployTasks_legacyApi(metadataEntry, apiResponse)](#MetadataType.postDeployTasks_legacyApi) ⇒ Promise.<void>
+ * [.postRetrieveTasks(metadata, targetDir, [isTemplating])](#MetadataType.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+ * [.setFolderPath(metadata)](#MetadataType.setFolderPath)
+ * [.setFolderId(metadata)](#MetadataType.setFolderId)
+ * [.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key])](#MetadataType.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveChangelog([additionalFields], [subTypeArr])](#MetadataType.retrieveChangelog) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache([additionalFields], [subTypeArr], [key])](#MetadataType.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables, [subType])](#MetadataType.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+ * [.retrieveTemplateREST(templateDir, uri, templateVariables, name)](#MetadataType.retrieveTemplateREST) ⇒ Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
+ * [.buildTemplate(retrieveDir, templateDir, key, templateVariables)](#MetadataType.buildTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+ * [.preDeployTasks(metadata, deployDir)](#MetadataType.preDeployTasks) ⇒ Promise.<TYPE.MetadataTypeItem>
+ * [.create(metadata, deployDir)](#MetadataType.create) ⇒ void
+ * [.update(metadata, [metadataBefore])](#MetadataType.update) ⇒ void
+ * [.refresh()](#MetadataType.refresh) ⇒ void
+ * [.execute()](#MetadataType.execute) ⇒ void
+ * [.pause()](#MetadataType.pause) ⇒ void
+ * [.hasChanged(cachedVersion, metadata, [fieldName])](#MetadataType.hasChanged) ⇒ boolean
+ * [.hasChangedGeneric(cachedVersion, metadata, [fieldName], [silent])](#MetadataType.hasChangedGeneric) ⇒ boolean
+ * [.upsert(metadataMap, deployDir)](#MetadataType.upsert) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate)](#MetadataType.createOrUpdate) ⇒ 'create'
\| 'update'
\| 'skip'
+ * [.createREST(metadataEntry, uri)](#MetadataType.createREST) ⇒ Promise.<object>
\| null
+ * [.createSOAP(metadataEntry, [handleOutside])](#MetadataType.createSOAP) ⇒ Promise.<object>
\| null
+ * [.updateREST(metadataEntry, uri, [httpMethod])](#MetadataType.updateREST) ⇒ Promise.<object>
\| null
+ * [.updateSOAP(metadataEntry, [handleOutside])](#MetadataType.updateSOAP) ⇒ Promise.<object>
\| null
+ * [._handleSOAPErrors(ex, msg, [metadataEntry], [handleOutside])](#MetadataType._handleSOAPErrors)
+ * [.getSOAPErrorMsg(ex)](#MetadataType.getSOAPErrorMsg) ⇒ string
+ * [.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields])](#MetadataType.retrieveSOAP) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveREST(retrieveDir, uri, [templateVariables], [singleRetrieve])](#MetadataType.retrieveREST) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+ * [.retrieveRESTcollection(urlArray, [concurrentRequests], [logAmountOfUrls])](#MetadataType.retrieveRESTcollection) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+ * [.handleRESTErrors(ex, id)](#MetadataType.handleRESTErrors) ⇒ null
+ * [.executeREST(uri, key)](#MetadataType.executeREST) ⇒ Promise.<{key:string, response:string}>
+ * [.executeSOAP([metadataEntry])](#MetadataType.executeSOAP) ⇒ Promise.<{key:string, response:object}>
+ * [.runDocumentOnRetrieve([singleRetrieve], metadataMap)](#MetadataType.runDocumentOnRetrieve) ⇒ Promise.<void>
+ * [.parseResponseBody(body, [singleRetrieve])](#MetadataType.parseResponseBody) ⇒ TYPE.MetadataTypeMap
+ * [.deleteFieldByDefinition(metadataEntry, fieldPath, definitionProperty, origin)](#MetadataType.deleteFieldByDefinition) ⇒ void
+ * [.removeNotCreateableFields(metadataEntry)](#MetadataType.removeNotCreateableFields) ⇒ void
+ * [.removeNotUpdateableFields(metadataEntry)](#MetadataType.removeNotUpdateableFields) ⇒ void
+ * [.keepTemplateFields(metadataEntry)](#MetadataType.keepTemplateFields) ⇒ void
+ * [.keepRetrieveFields(metadataEntry)](#MetadataType.keepRetrieveFields) ⇒ void
+ * [.isFiltered(metadataEntry, [include])](#MetadataType.isFiltered) ⇒ boolean
+ * [.isFilteredFolder(metadataEntry, [include])](#MetadataType.isFilteredFolder) ⇒ boolean
+ * [.saveResults(results, retrieveDir, [overrideType], [templateVariables])](#MetadataType.saveResults) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.applyTemplateValues(code, templateVariables)](#MetadataType.applyTemplateValues) ⇒ string
+ * [.applyTemplateNames(code, templateVariables)](#MetadataType.applyTemplateNames) ⇒ string
+ * [.buildDefinitionForNested(templateDir, targetDir, metadata, variables, templateName)](#MetadataType.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#MetadataType.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.findSubType(templateDir, templateName)](#MetadataType.findSubType) ⇒ Promise.<string>
+ * [.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName, ex)](#MetadataType.readSecondaryFolder) ⇒ object
+ * [.buildDefinition(templateDir, targetDir, templateName, variables)](#MetadataType.buildDefinition) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.getErrorsREST(ex)](#MetadataType.getErrorsREST) ⇒ Array.<string>
\| void
+ * [.document([metadata], [isDeploy])](#MetadataType.document) ⇒ void
+ * [.resolveId(id)](#MetadataType.resolveId) ⇒ Promise.<string>
+ * [.deleteByKey(customerKey)](#MetadataType.deleteByKey) ⇒ boolean
+ * [.postDeleteTasks(customerKey, [additionalExtensions])](#MetadataType.postDeleteTasks) ⇒ Promise.<void>
+ * [.deleteByKeySOAP(customerKey, [overrideKeyField], [handleOutside])](#MetadataType.deleteByKeySOAP) ⇒ Promise.<boolean>
+ * [.deleteByKeyREST(url, key, [handleOutside])](#MetadataType.deleteByKeyREST) ⇒ Promise.<boolean>
+ * [.readBUMetadataForType(readDir, [listBadKeys], [buMetadata])](#MetadataType.readBUMetadataForType) ⇒ object
+ * [.getFilesToCommit(keyArr)](#MetadataType.getFilesToCommit) ⇒ Promise.<Array.<string>>
+ * [.getKeysForFixing(metadataMap)](#MetadataType.getKeysForFixing) ⇒ Array.<string>
+ * [.getJsonFromFS(dir, [listBadKeys])](#MetadataType.getJsonFromFS) ⇒ TYPE.MetadataTypeMap
+ * [.getFieldNamesToRetrieve([additionalFields], [isCaching])](#MetadataType.getFieldNamesToRetrieve) ⇒ Array.<string>
+ * [.deploy(metadata, deployDir, retrieveDir)](#MetadataType.deploy) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.postDeployTasks(upsertResults, originalMetadata, createdUpdated)](#MetadataType.postDeployTasks) ⇒ void
+ * [.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields)](#MetadataType.postCreateTasks) ⇒ void
+ * [.postUpdateTasks(metadataEntry, apiResponse)](#MetadataType.postUpdateTasks) ⇒ void
+ * [.postDeployTasks_legacyApi(metadataEntry, apiResponse)](#MetadataType.postDeployTasks_legacyApi) ⇒ Promise.<void>
+ * [.postRetrieveTasks(metadata, targetDir, [isTemplating])](#MetadataType.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+ * [.setFolderPath(metadata)](#MetadataType.setFolderPath)
+ * [.setFolderId(metadata)](#MetadataType.setFolderId)
+ * [.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key])](#MetadataType.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveChangelog([additionalFields], [subTypeArr])](#MetadataType.retrieveChangelog) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveForCache([additionalFields], [subTypeArr], [key])](#MetadataType.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveAsTemplate(templateDir, name, templateVariables, [subType])](#MetadataType.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+ * [.retrieveTemplateREST(templateDir, uri, templateVariables, name)](#MetadataType.retrieveTemplateREST) ⇒ Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
+ * [.buildTemplate(retrieveDir, templateDir, key, templateVariables)](#MetadataType.buildTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+ * [.preDeployTasks(metadata, deployDir)](#MetadataType.preDeployTasks) ⇒ Promise.<TYPE.MetadataTypeItem>
+ * [.create(metadata, deployDir)](#MetadataType.create) ⇒ void
+ * [.update(metadata, [metadataBefore])](#MetadataType.update) ⇒ void
+ * [.refresh()](#MetadataType.refresh) ⇒ void
+ * [.execute()](#MetadataType.execute) ⇒ void
+ * [.pause()](#MetadataType.pause) ⇒ void
+ * [.hasChanged(cachedVersion, metadata, [fieldName])](#MetadataType.hasChanged) ⇒ boolean
+ * [.hasChangedGeneric(cachedVersion, metadata, [fieldName], [silent])](#MetadataType.hasChangedGeneric) ⇒ boolean
+ * [.upsert(metadataMap, deployDir)](#MetadataType.upsert) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate)](#MetadataType.createOrUpdate) ⇒ 'create'
\| 'update'
\| 'skip'
+ * [.createREST(metadataEntry, uri)](#MetadataType.createREST) ⇒ Promise.<object>
\| null
+ * [.createSOAP(metadataEntry, [handleOutside])](#MetadataType.createSOAP) ⇒ Promise.<object>
\| null
+ * [.updateREST(metadataEntry, uri, [httpMethod])](#MetadataType.updateREST) ⇒ Promise.<object>
\| null
+ * [.updateSOAP(metadataEntry, [handleOutside])](#MetadataType.updateSOAP) ⇒ Promise.<object>
\| null
+ * [._handleSOAPErrors(ex, msg, [metadataEntry], [handleOutside])](#MetadataType._handleSOAPErrors)
+ * [.getSOAPErrorMsg(ex)](#MetadataType.getSOAPErrorMsg) ⇒ string
+ * [.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields])](#MetadataType.retrieveSOAP) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.retrieveREST(retrieveDir, uri, [templateVariables], [singleRetrieve])](#MetadataType.retrieveREST) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+ * [.retrieveRESTcollection(urlArray, [concurrentRequests], [logAmountOfUrls])](#MetadataType.retrieveRESTcollection) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+ * [.handleRESTErrors(ex, id)](#MetadataType.handleRESTErrors) ⇒ null
+ * [.executeREST(uri, key)](#MetadataType.executeREST) ⇒ Promise.<{key:string, response:string}>
+ * [.executeSOAP([metadataEntry])](#MetadataType.executeSOAP) ⇒ Promise.<{key:string, response:object}>
+ * [.runDocumentOnRetrieve([singleRetrieve], metadataMap)](#MetadataType.runDocumentOnRetrieve) ⇒ Promise.<void>
+ * [.parseResponseBody(body, [singleRetrieve])](#MetadataType.parseResponseBody) ⇒ TYPE.MetadataTypeMap
+ * [.deleteFieldByDefinition(metadataEntry, fieldPath, definitionProperty, origin)](#MetadataType.deleteFieldByDefinition) ⇒ void
+ * [.removeNotCreateableFields(metadataEntry)](#MetadataType.removeNotCreateableFields) ⇒ void
+ * [.removeNotUpdateableFields(metadataEntry)](#MetadataType.removeNotUpdateableFields) ⇒ void
+ * [.keepTemplateFields(metadataEntry)](#MetadataType.keepTemplateFields) ⇒ void
+ * [.keepRetrieveFields(metadataEntry)](#MetadataType.keepRetrieveFields) ⇒ void
+ * [.isFiltered(metadataEntry, [include])](#MetadataType.isFiltered) ⇒ boolean
+ * [.isFilteredFolder(metadataEntry, [include])](#MetadataType.isFilteredFolder) ⇒ boolean
+ * [.saveResults(results, retrieveDir, [overrideType], [templateVariables])](#MetadataType.saveResults) ⇒ Promise.<TYPE.MetadataTypeMap>
+ * [.applyTemplateValues(code, templateVariables)](#MetadataType.applyTemplateValues) ⇒ string
+ * [.applyTemplateNames(code, templateVariables)](#MetadataType.applyTemplateNames) ⇒ string
+ * [.buildDefinitionForNested(templateDir, targetDir, metadata, variables, templateName)](#MetadataType.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#MetadataType.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
+ * [.findSubType(templateDir, templateName)](#MetadataType.findSubType) ⇒ Promise.<string>
+ * [.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName, ex)](#MetadataType.readSecondaryFolder) ⇒ object
+ * [.buildDefinition(templateDir, targetDir, templateName, variables)](#MetadataType.buildDefinition) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+ * [.getErrorsREST(ex)](#MetadataType.getErrorsREST) ⇒ Array.<string>
\| void
+ * [.document([metadata], [isDeploy])](#MetadataType.document) ⇒ void
+ * [.resolveId(id)](#MetadataType.resolveId) ⇒ Promise.<string>
+ * [.deleteByKey(customerKey)](#MetadataType.deleteByKey) ⇒ boolean
+ * [.postDeleteTasks(customerKey, [additionalExtensions])](#MetadataType.postDeleteTasks) ⇒ Promise.<void>
+ * [.deleteByKeySOAP(customerKey, [overrideKeyField], [handleOutside])](#MetadataType.deleteByKeySOAP) ⇒ Promise.<boolean>
+ * [.deleteByKeyREST(url, key, [handleOutside])](#MetadataType.deleteByKeyREST) ⇒ Promise.<boolean>
+ * [.readBUMetadataForType(readDir, [listBadKeys], [buMetadata])](#MetadataType.readBUMetadataForType) ⇒ object
+ * [.getFilesToCommit(keyArr)](#MetadataType.getFilesToCommit) ⇒ Promise.<Array.<string>>
+ * [.getKeysForFixing(metadataMap)](#MetadataType.getKeysForFixing) ⇒ Array.<string>
-
+
-### MobileKeyword.getFilesToCommit(keyArr) ⇒ Array.<string>
-should return only the json for all but asset, query and script that are saved as multiple files
-additionally, the documentation for dataExtension and automation should be returned
+### MetadataType.client : TYPE.SDK
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.properties : TYPE.Mcdevrc
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.subType : string
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.buObject : TYPE.BuObject
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.client : TYPE.SDK
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.properties : TYPE.Mcdevrc
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.subType : string
+**Kind**: static property of [MetadataType
](#MetadataType)
+
+
+### MetadataType.buObject : TYPE.BuObject
+**Kind**: static property of [MetadataType
](#MetadataType)
+
-**Kind**: static method of [MobileKeyword
](#MobileKeyword)
-**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+### MetadataType.getJsonFromFS(dir, [listBadKeys]) ⇒ TYPE.MetadataTypeMap
+Returns file contents mapped to their filename without '.json' ending
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: TYPE.MetadataTypeMap
- fileName => fileContent map
| Param | Type | Description |
| --- | --- | --- |
-| keyArr | Array.<string>
| customerkey of the metadata |
+| dir | string
| directory that contains '.json' files to be read |
+| [listBadKeys] | boolean
| do not print errors, used for badKeys() |
-
+
-## MobileMessage ⇐ [MetadataType
](#MetadataType)
-MobileMessage MetadataType
+### MetadataType.getFieldNamesToRetrieve([additionalFields], [isCaching]) ⇒ Array.<string>
+Returns fieldnames of Metadata Type. 'this.definition.fields' variable only set in child classes.
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Array.<string>
- Fieldnames
-* [MobileMessage](#MobileMessage) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#MobileMessage.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
\| void
- * [.retrieveForCache([_], [__], [key])](#MobileMessage.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.update(metadata)](#MobileMessage.update) ⇒ Promise
- * [.create(metadata)](#MobileMessage.create) ⇒ Promise
- * [._mergeCode(metadata, deployDir, [templateName])](#MobileMessage._mergeCode) ⇒ Promise.<string>
- * [.prepExtractedCode(code)](#MobileMessage.prepExtractedCode) ⇒ Object
- * [.getFilesToCommit(keyArr)](#MobileMessage.getFilesToCommit) ⇒ Array.<string>
- * [.postRetrieveTasks(metadata)](#MobileMessage.postRetrieveTasks) ⇒ TYPE.CodeExtractItem
- * [.preDeployTasks(metadata, deployDir)](#MobileMessage.preDeployTasks) ⇒ TYPE.MetadataTypeItem
- * [.postCreateTasks(metadataEntry, apiResponse)](#MobileMessage.postCreateTasks) ⇒ void
- * [.postUpdateTasks(metadataEntry, apiResponse)](#MobileMessage.postUpdateTasks) ⇒ void
- * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#MobileMessage.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#MobileMessage.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#MobileMessage._buildForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [.deleteByKey(id)](#MobileMessage.deleteByKey) ⇒ Promise.<boolean>
+| Param | Type | Description |
+| --- | --- | --- |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [isCaching] | boolean
| if true, then check if field should be skipped for caching |
-
+
-### MobileMessage.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
\| void
-Retrieves Metadata of Mobile Keywords
+### MetadataType.deploy(metadata, deployDir, retrieveDir) ⇒ Promise.<TYPE.MetadataTypeMap>
+Deploys metadata
-**Kind**: static method of [MobileMessage
](#MobileMessage)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
\| void
- Promise of metadata
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of keyField => metadata map
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| deployDir | string
| directory where deploy metadata are saved |
+| retrieveDir | string
| directory where metadata after deploy should be saved |
-
+
-### MobileMessage.retrieveForCache([_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves event definition metadata for caching
+### MetadataType.postDeployTasks(upsertResults, originalMetadata, createdUpdated) ⇒ void
+Gets executed after deployment of metadata type
-**Kind**: static method of [MobileMessage
](#MobileMessage)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| [_] | void
| parameter not used |
-| [__] | void
| parameter not used |
-| [key] | string
| customer key of single item to retrieve |
+| upsertResults | TYPE.MetadataTypeMap
| metadata mapped by their keyField as returned by update/create |
+| originalMetadata | TYPE.MetadataTypeMap
| metadata to be updated (contains additioanl fields) |
+| createdUpdated | Object
| counter representing successful creates/updates |
-
+
-### MobileMessage.update(metadata) ⇒ Promise
-Updates a single item
+### MetadataType.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields) ⇒ void
+helper for [createREST](#MetadataType.createREST)
-**Kind**: static method of [MobileMessage
](#MobileMessage)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
+| metadataEntryWithAllFields | TYPE.MetadataTypeItem
| like metadataEntry but before non-creatable fields were stripped |
-
+
-### MobileMessage.create(metadata) ⇒ Promise
-Creates a single item
+### MetadataType.postUpdateTasks(metadataEntry, apiResponse) ⇒ void
+helper for [updateREST](#MetadataType.updateREST)
-**Kind**: static method of [MobileMessage
](#MobileMessage)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
-
+
-### MobileMessage.\_mergeCode(metadata, deployDir, [templateName]) ⇒ Promise.<string>
-helper for [preDeployTasks](#MobileMessage.preDeployTasks) that loads extracted code content back into JSON
+### MetadataType.postDeployTasks\_legacyApi(metadataEntry, apiResponse) ⇒ Promise.<void>
+helper for [createREST](#MetadataType.createREST) when legacy API endpoints as these do not return the created item but only their new id
-**Kind**: static method of [MobileMessage
](#MobileMessage)
-**Returns**: Promise.<string>
- code
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single definition |
-| deployDir | string
| directory of deploy files |
-| [templateName] | string
| name of the template used to built defintion (prior applying templating) |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
-
+
-### MobileMessage.prepExtractedCode(code) ⇒ Object
-helper for [postRetrieveTasks](#MobileMessage.postRetrieveTasks) and [_buildForNested](#MobileMessage._buildForNested)
+### MetadataType.postRetrieveTasks(metadata, targetDir, [isTemplating]) ⇒ TYPE.MetadataTypeItem
+Gets executed after retreive of metadata type
-**Kind**: static method of [MobileMessage
](#MobileMessage)
-**Returns**: Object
- returns found extension and file content
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: TYPE.MetadataTypeItem
- cloned metadata
| Param | Type | Description |
| --- | --- | --- |
-| code | string
| the code of the file |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+| targetDir | string
| folder where retrieves should be saved |
+| [isTemplating] | boolean
| signals that we are retrieving templates |
-
+
-### MobileMessage.getFilesToCommit(keyArr) ⇒ Array.<string>
-should return only the json for all but asset, query and script that are saved as multiple files
-additionally, the documentation for dataExtension and automation should be returned
+### MetadataType.setFolderPath(metadata)
+generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
-**Kind**: static method of [MobileMessage
](#MobileMessage)
-**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| keyArr | Array.<string>
| customerkey of the metadata |
+| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-### MobileMessage.postRetrieveTasks(metadata) ⇒ TYPE.CodeExtractItem
-manages post retrieve steps
+### MetadataType.setFolderId(metadata)
+generic script that retrieves the folder ID from cache and updates the given metadata with it before deploy
-**Kind**: static method of [MobileMessage
](#MobileMessage)
-**Returns**: TYPE.CodeExtractItem
- Array with one metadata object and one query string
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single query |
+| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-### MobileMessage.preDeployTasks(metadata, deployDir) ⇒ TYPE.MetadataTypeItem
-prepares an event definition for deployment
+### MetadataType.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata from Marketing Cloud
-**Kind**: static method of [MobileMessage
](#MobileMessage)
-**Returns**: TYPE.MetadataTypeItem
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single MobileMessage |
-| deployDir | string
| directory of deploy files |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### MobileMessage.postCreateTasks(metadataEntry, apiResponse) ⇒ void
-helper for [createREST](#MetadataType.createREST)
+### MetadataType.retrieveChangelog([additionalFields], [subTypeArr]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata from Marketing Cloud
-**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
-| apiResponse | object
| varies depending on the API call |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
-
+
-### MobileMessage.postUpdateTasks(metadataEntry, apiResponse) ⇒ void
-helper for [updateREST](#MetadataType.updateREST)
+### MetadataType.retrieveForCache([additionalFields], [subTypeArr], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata cache with limited fields and does not store value to disk
-**Kind**: static method of [MobileMessage
](#MobileMessage)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
-| apiResponse | object
| varies depending on the API call |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### MobileMessage.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
-helper for [buildDefinition](#MetadataType.buildDefinition)
-handles extracted code if any are found for complex types
+### MetadataType.retrieveAsTemplate(templateDir, name, templateVariables, [subType]) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+Gets metadata cache with limited fields and does not store value to disk
-**Kind**: static method of [MobileMessage
](#MobileMessage)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| name | string
| name of the metadata file |
| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
+| [subType] | string
| optionally limit to a single subtype |
-
+
-### MobileMessage.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
-helper for [buildTemplate](#MetadataType.buildTemplate)
-handles extracted code if any are found for complex types
+### MetadataType.retrieveTemplateREST(templateDir, uri, templateVariables, name) ⇒ Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
+Retrieve a specific Script by Name
-**Kind**: static method of [MobileMessage
](#MobileMessage)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
- Promise
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| uri | string
| rest endpoint for GET |
| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
+| name | string
| name (not key) of the metadata item |
-**Example**
-```js
-scripts are saved as 1 json and 1 ssjs file. both files need to be run through templating
-```
-
+
-### MobileMessage.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ Promise.<Array.<Array.<string>>>
-helper for [buildTemplateForNested](#MobileMessage.buildTemplateForNested) / [buildDefinitionForNested](#MobileMessage.buildDefinitionForNested)
-handles extracted code if any are found for complex types
+### MetadataType.buildTemplate(retrieveDir, templateDir, key, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+Gets metadata cache with limited fields and does not store value to disk
-**Kind**: static method of [MobileMessage
](#MobileMessage)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- single metadata
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| templateDir | string
| (List of) Directory where built definitions will be saved |
+| key | string
| name of the metadata file |
| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
-| mode | 'definition'
\| 'template'
| defines what we use this helper for |
-
+
-### MobileMessage.deleteByKey(id) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
-! the endpoint expects the ID and not a key but for mcdev in this case key==id
+### MetadataType.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.MetadataTypeItem>
+Gets executed before deploying metadata
-**Kind**: static method of [MobileMessage
](#MobileMessage)
-**Returns**: Promise.<boolean>
- deletion success status
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeItem>
- Promise of a single metadata item
| Param | Type | Description |
| --- | --- | --- |
-| id | string
| Identifier of item |
+| metadata | TYPE.MetadataTypeItem
| a single metadata item |
+| deployDir | string
| folder where files for deployment are stored |
-
+
-## Query ⇐ [MetadataType
](#MetadataType)
-Query MetadataType
+### MetadataType.create(metadata, deployDir) ⇒ void
+Abstract create method that needs to be implemented in child metadata type
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [MetadataType
](#MetadataType)
-* [Query](#Query) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#Query.retrieve) ⇒ Promise.<{metadata: TYPE.QueryMap, type: string}>
- * [.execute(keyArr)](#Query.execute) ⇒ Promise.<Array.<string>>
- * [.retrieveForCache()](#Query.retrieveForCache) ⇒ Promise.<{metadata: TYPE.QueryMap, type: string}>
- * [.retrieveAsTemplate(templateDir, name, templateVariables)](#Query.retrieveAsTemplate) ⇒ Promise.<{metadata: Query, type: string}>
- * [.postRetrieveTasks(metadata)](#Query.postRetrieveTasks) ⇒ TYPE.CodeExtractItem
- * [.create(query)](#Query.create) ⇒ Promise
- * [.update(query)](#Query.update) ⇒ Promise
- * [.preDeployTasks(metadata, deployDir)](#Query.preDeployTasks) ⇒ Promise.<TYPE.QueryItem>
- * [.applyTemplateValues(code, templateVariables)](#Query.applyTemplateValues) ⇒ string
- * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Query.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Query.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [.getFilesToCommit(keyArr)](#Query.getFilesToCommit) ⇒ Array.<string>
- * [.getErrorsREST(ex)](#Query.getErrorsREST) ⇒ Array.<string>
\| void
- * [.deleteByKey(customerKey)](#Query.deleteByKey) ⇒ Promise.<boolean>
- * [.postDeleteTasks(customerKey)](#Query.postDeleteTasks) ⇒ void
- * [.postDeployTasks(upsertResults)](#Query.postDeployTasks)
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| deployDir | string
| directory where deploy metadata are saved |
-
+
-### Query.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<{metadata: TYPE.QueryMap, type: string}>
-Retrieves Metadata of queries
+### MetadataType.update(metadata, [metadataBefore]) ⇒ void
+Abstract update method that needs to be implemented in child metadata type
-**Kind**: static method of [Query
](#Query)
-**Returns**: Promise.<{metadata: TYPE.QueryMap, type: string}>
- Promise of metadata
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| [metadataBefore] | TYPE.MetadataTypeItem
| metadata mapped by their keyField |
-
+
-### Query.execute(keyArr) ⇒ Promise.<Array.<string>>
-a function to start query execution via API
+### MetadataType.refresh() ⇒ void
+Abstract refresh method that needs to be implemented in child metadata type
-**Kind**: static method of [Query
](#Query)
-**Returns**: Promise.<Array.<string>>
- Returns list of keys that were executed successfully
+**Kind**: static method of [MetadataType
](#MetadataType)
+
-| Param | Type | Description |
-| --- | --- | --- |
-| keyArr | Array.<string>
| customerkey of the metadata |
+### MetadataType.execute() ⇒ void
+Abstract execute method that needs to be implemented in child metadata type
-
+**Kind**: static method of [MetadataType
](#MetadataType)
+
-### Query.retrieveForCache() ⇒ Promise.<{metadata: TYPE.QueryMap, type: string}>
-Retrieves query metadata for caching
+### MetadataType.pause() ⇒ void
+Abstract pause method that needs to be implemented in child metadata type
-**Kind**: static method of [Query
](#Query)
-**Returns**: Promise.<{metadata: TYPE.QueryMap, type: string}>
- Promise of metadata
-
+**Kind**: static method of [MetadataType
](#MetadataType)
+
-### Query.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<{metadata: Query, type: string}>
-Retrieve a specific Query by Name
+### MetadataType.hasChanged(cachedVersion, metadata, [fieldName]) ⇒ boolean
+test if metadata was actually changed or not to potentially skip it during deployment
-**Kind**: static method of [Query
](#Query)
-**Returns**: Promise.<{metadata: Query, type: string}>
- Promise of metadata
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true if metadata was changed
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where retrieved metadata directory will be saved |
-| name | string
| name of the metadata file |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| cachedVersion | TYPE.MetadataTypeItem
| cached version from the server |
+| metadata | TYPE.MetadataTypeItem
| item to upload |
+| [fieldName] | string
| optional field name to use for identifying the record in logs |
-
+
-### Query.postRetrieveTasks(metadata) ⇒ TYPE.CodeExtractItem
-manages post retrieve steps
+### MetadataType.hasChangedGeneric(cachedVersion, metadata, [fieldName], [silent]) ⇒ boolean
+test if metadata was actually changed or not to potentially skip it during deployment
-**Kind**: static method of [Query
](#Query)
-**Returns**: TYPE.CodeExtractItem
- Array with one metadata object and one query string
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true on first identified deviation or false if none are found
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.QueryItem
| a single query |
+| cachedVersion | TYPE.MetadataTypeItem
| cached version from the server |
+| metadata | TYPE.MetadataTypeItem
| item to upload |
+| [fieldName] | string
| optional field name to use for identifying the record in logs |
+| [silent] | boolean
| optionally suppress logging |
-
+
-### Query.create(query) ⇒ Promise
-Creates a single query
+### MetadataType.upsert(metadataMap, deployDir) ⇒ Promise.<TYPE.MetadataTypeMap>
+MetadataType upsert, after retrieving from target and comparing to check if create or update operation is needed.
-**Kind**: static method of [Query
](#Query)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- keyField => metadata map
| Param | Type | Description |
| --- | --- | --- |
-| query | TYPE.QueryItem
| a single query |
+| metadataMap | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| deployDir | string
| directory where deploy metadata are saved |
-
+
-### Query.update(query) ⇒ Promise
-Updates a single query
+### MetadataType.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate) ⇒ 'create'
\| 'update'
\| 'skip'
+helper for [upsert](#MetadataType.upsert)
-**Kind**: static method of [Query
](#Query)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: 'create'
\| 'update'
\| 'skip'
- action to take
| Param | Type | Description |
| --- | --- | --- |
-| query | TYPE.QueryItem
| a single query |
+| metadataMap | TYPE.MetadataTypeMap
| list of metadata |
+| metadataKey | string
| key of item we are looking at |
+| hasError | boolean
| error flag from previous code |
+| metadataToUpdate | Array.<TYPE.MetadataTypeItemDiff>
| list of items to update |
+| metadataToCreate | Array.<TYPE.MetadataTypeItem>
| list of items to create |
-
+
-### Query.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.QueryItem>
-prepares a Query for deployment
+### MetadataType.createREST(metadataEntry, uri) ⇒ Promise.<object>
\| null
+Creates a single metadata entry via REST
-**Kind**: static method of [Query
](#Query)
-**Returns**: Promise.<TYPE.QueryItem>
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.QueryItem
| a single query activity |
-| deployDir | string
| directory of deploy files |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| uri | string
| rest endpoint for POST |
-
+
-### Query.applyTemplateValues(code, templateVariables) ⇒ string
-helper for [buildDefinitionForNested](#Query.buildDefinitionForNested)
-searches extracted SQL file for template variables and applies the market values
+### MetadataType.createSOAP(metadataEntry, [handleOutside]) ⇒ Promise.<object>
\| null
+Creates a single metadata entry via fuel-soap (generic lib not wrapper)
-**Kind**: static method of [Query
](#Query)
-**Returns**: string
- code with markets applied
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
| Param | Type | Description |
| --- | --- | --- |
-| code | string
| code from extracted code |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| metadataEntry | TYPE.MetadataTypeItem
| single metadata entry |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
-
+
-### Query.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
-helper for [buildDefinition](#MetadataType.buildDefinition)
-handles extracted code if any are found for complex types
+### MetadataType.updateREST(metadataEntry, uri, [httpMethod]) ⇒ Promise.<object>
\| null
+Updates a single metadata entry via REST
-**Kind**: static method of [Query
](#Query)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
+
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| | a single metadata Entry |
+| uri | string
| | rest endpoint for PATCH |
+| [httpMethod] | 'patch'
\| 'post'
\| 'put'
| patch
| defaults to 'patch'; some update requests require PUT instead of PATCH |
+
+
+
+### MetadataType.updateSOAP(metadataEntry, [handleOutside]) ⇒ Promise.<object>
\| null
+Updates a single metadata entry via fuel-soap (generic lib not wrapper)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.QueryItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
-
-
+| metadataEntry | TYPE.MetadataTypeItem
| single metadata entry |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
-### Query.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
-helper for [buildTemplate](#MetadataType.buildTemplate)
-handles extracted code if any are found for complex types
+
-**Kind**: static method of [Query
](#Query)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+### MetadataType.\_handleSOAPErrors(ex, msg, [metadataEntry], [handleOutside])
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.QueryItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
+| ex | Error
| error that occured |
+| msg | 'creating'
\| 'updating'
| what to print in the log |
+| [metadataEntry] | TYPE.MetadataTypeItem
| single metadata entry |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
-**Example**
-```js
-queries are saved as 1 json and 1 sql file. both files need to be run through templating
-```
-
+
-### Query.getFilesToCommit(keyArr) ⇒ Array.<string>
-should return only the json for all but asset, query and script that are saved as multiple files
-additionally, the documentation for dataExtension and automation should be returned
+### MetadataType.getSOAPErrorMsg(ex) ⇒ string
+helper for [_handleSOAPErrors](#MetadataType._handleSOAPErrors)
-**Kind**: static method of [Query
](#Query)
-**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: string
- error message
| Param | Type | Description |
| --- | --- | --- |
-| keyArr | Array.<string>
| customerkey of the metadata |
+| ex | Error
| error that occured |
-
+
-### Query.getErrorsREST(ex) ⇒ Array.<string>
\| void
-Standardizes a check for multiple messages but adds query specific filters to error texts
+### MetadataType.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves SOAP via generic fuel-soap wrapper based metadata of metadata type into local filesystem. executes callback with retrieved metadata
-**Kind**: static method of [Query
](#Query)
-**Returns**: Array.<string>
\| void
- formatted Error Message
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of item map
| Param | Type | Description |
| --- | --- | --- |
-| ex | object
| response payload from REST API |
-
-
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [requestParams] | TYPE.SoapRequestParams
| required for the specific request (filter for example) |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-### Query.deleteByKey(customerKey) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
+
-**Kind**: static method of [Query
](#Query)
-**Returns**: Promise.<boolean>
- deletion success flag
+### MetadataType.retrieveREST(retrieveDir, uri, [templateVariables], [singleRetrieve]) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+Retrieves Metadata for Rest Types
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
- Promise of item map (single item for templated result)
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of data extension |
-
-
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| uri | string
| rest endpoint for GET |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
-### Query.postDeleteTasks(customerKey) ⇒ void
-clean up after deleting a metadata item
+
-**Kind**: static method of [Query
](#Query)
+### MetadataType.retrieveRESTcollection(urlArray, [concurrentRequests], [logAmountOfUrls]) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
- Promise of item map (single item for templated result)
-| Param | Type | Description |
-| --- | --- | --- |
-| customerKey | string
| Identifier of metadata item |
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| urlArray | Array.<object>
| | {uri: string, id: string} combo of URL and ID/key of metadata |
+| [concurrentRequests] | number
| 10
| optionally set a different amount of concurrent requests |
+| [logAmountOfUrls] | boolean
| true
| if true, prints an info message about to-be loaded amount of metadata |
-
+
-### Query.postDeployTasks(upsertResults)
-Gets executed after deployment of metadata type
+### MetadataType.handleRESTErrors(ex, id) ⇒ null
+helper for [this.retrieveRESTcollection](this.retrieveRESTcollection)
-**Kind**: static method of [Query
](#Query)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: null
- -
| Param | Type | Description |
| --- | --- | --- |
-| upsertResults | TYPE.MetadataTypeMap
| metadata mapped by their keyField as returned by update/create |
+| ex | Error
| exception |
+| id | string
| id or key of item |
-
+
-## Role ⇐ [MetadataType
](#MetadataType)
-ImportFile MetadataType
+### MetadataType.executeREST(uri, key) ⇒ Promise.<{key:string, response:string}>
+Used to execute a query/automation etc.
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{key:string, response:string}>
- metadata key and API response (OK or error)
-* [Role](#Role) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, _, [___], [key])](#Role.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.preDeployTasks(metadata)](#Role.preDeployTasks) ⇒ TYPE.MetadataTypeItem
- * [.create(metadata)](#Role.create) ⇒ Promise
- * [.update(metadata)](#Role.update) ⇒ Promise
- * [.document([metadata])](#Role.document) ⇒ Promise.<void>
- * [._traverseRoles(role, element, [permission], [isAllowed])](#Role._traverseRoles) ⇒ void
+| Param | Type | Description |
+| --- | --- | --- |
+| uri | string
| REST endpoint where the POST request should be sent |
+| key | string
| item key |
-
+
-### Role.retrieve(retrieveDir, _, [___], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Gets metadata from Marketing Cloud
+### MetadataType.executeSOAP([metadataEntry]) ⇒ Promise.<{key:string, response:object}>
+Used to execute a query/automation etc.
-**Kind**: static method of [Role
](#Role)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Metadata store object
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{key:string, response:object}>
- metadata key and API response
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| _ | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-| [___] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| [metadataEntry] | TYPE.MetadataTypeItem
| single metadata entry |
-
+
-### Role.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
-Gets executed before deploying metadata
+### MetadataType.runDocumentOnRetrieve([singleRetrieve], metadataMap) ⇒ Promise.<void>
+helper for [retrieveREST](#MetadataType.retrieveREST) and [retrieveSOAP](#MetadataType.retrieveSOAP)
-**Kind**: static method of [Role
](#Role)
-**Returns**: TYPE.MetadataTypeItem
- Promise of a single metadata item
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single metadata item |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+| metadataMap | TYPE.MetadataTypeMap
| saved metadata |
-
+
-### Role.create(metadata) ⇒ Promise
-Create a single Role.
+### MetadataType.parseResponseBody(body, [singleRetrieve]) ⇒ TYPE.MetadataTypeMap
+Builds map of metadata entries mapped to their keyfields
-**Kind**: static method of [Role
](#Role)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: TYPE.MetadataTypeMap
- keyField => metadata map
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| body | object
| json of response body |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
-
+
-### Role.update(metadata) ⇒ Promise
-Updates a single Role.
+### MetadataType.deleteFieldByDefinition(metadataEntry, fieldPath, definitionProperty, origin) ⇒ void
+Deletes a field in a metadata entry if the selected definition property equals false.
-**Kind**: static method of [Role
](#Role)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| metadataEntry | TYPE.MetadataTypeItem
| One entry of a metadataType |
+| fieldPath | string
| field path to be checked if it conforms to the definition (dot seperated if nested): 'fuu.bar' |
+| definitionProperty | 'isCreateable'
\| 'isUpdateable'
\| 'retrieving'
\| 'templating'
| delete field if definitionProperty equals false for specified field. Options: [isCreateable | isUpdateable] |
+| origin | string
| string of parent object, required when using arrays as these are parsed slightly differently. |
-
+**Example**
+```js
+Removes field (or nested fields childs) that are not updateable
+deleteFieldByDefinition(metadataEntry, 'CustomerKey', 'isUpdateable');
+```
+
-### Role.document([metadata]) ⇒ Promise.<void>
-Creates markdown documentation of all roles
+### MetadataType.removeNotCreateableFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not createable
-**Kind**: static method of [Role
](#Role)
-**Returns**: Promise.<void>
- -
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| [metadata] | TYPE.MetadataTypeMap
| role definitions |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
-
+
-### Role.\_traverseRoles(role, element, [permission], [isAllowed]) ⇒ void
-iterates through permissions to output proper row-names for nested permissionss
+### MetadataType.removeNotUpdateableFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not updateable
-**Kind**: static method of [Role
](#Role)
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| role | string
| name of the user role |
-| element | object
| data of the permission |
-| [permission] | string
| name of the permission |
-| [isAllowed] | string
| "true" / "false" from the |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
-
+
-## Script ⇐ [MetadataType
](#MetadataType)
-Script MetadataType
+### MetadataType.keepTemplateFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not needed in the template
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [MetadataType
](#MetadataType)
-* [Script](#Script) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#Script.retrieve) ⇒ Promise.<{metadata: TYPE.ScriptMap, type: string}>
- * [.retrieveForCache()](#Script.retrieveForCache) ⇒ Promise.<{metadata: TYPE.ScriptMap, type: string}>
- * [.retrieveAsTemplate(templateDir, name, templateVariables)](#Script.retrieveAsTemplate) ⇒ Promise.<{metadata: TYPE.Script, type: string}>
- * [.update(script)](#Script.update) ⇒ Promise
- * [.create(script)](#Script.create) ⇒ Promise
- * [._mergeCode(metadata, deployDir, [templateName])](#Script._mergeCode) ⇒ Promise.<string>
- * [.preDeployTasks(metadata, dir)](#Script.preDeployTasks) ⇒ TYPE.ScriptItem
- * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Script.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#Script.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#Script._buildForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [.postRetrieveTasks(metadata)](#Script.postRetrieveTasks) ⇒ TYPE.CodeExtractItem
- * [.prepExtractedCode(metadataScript, metadataName)](#Script.prepExtractedCode) ⇒ Object
- * [.getFilesToCommit(keyArr)](#Script.getFilesToCommit) ⇒ Array.<string>
- * [.deleteByKey(customerKey)](#Script.deleteByKey) ⇒ Promise.<boolean>
- * [.postDeleteTasks(customerKey)](#Script.postDeleteTasks) ⇒ void
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
-
+
-### Script.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<{metadata: TYPE.ScriptMap, type: string}>
-Retrieves Metadata of Script
-Endpoint /automation/v1/scripts/ return all Scripts with all details.
+### MetadataType.keepRetrieveFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not needed in the stored metadata
-**Kind**: static method of [Script
](#Script)
-**Returns**: Promise.<{metadata: TYPE.ScriptMap, type: string}>
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
-
-
-
-### Script.retrieveForCache() ⇒ Promise.<{metadata: TYPE.ScriptMap, type: string}>
-Retrieves script metadata for caching
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
-**Kind**: static method of [Script
](#Script)
-**Returns**: Promise.<{metadata: TYPE.ScriptMap, type: string}>
- Promise
-
+
-### Script.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<{metadata: TYPE.Script, type: string}>
-Retrieve a specific Script by Name
+### MetadataType.isFiltered(metadataEntry, [include]) ⇒ boolean
+checks if the current metadata entry should be saved on retrieve or not
-**Kind**: static method of [Script
](#Script)
-**Returns**: Promise.<{metadata: TYPE.Script, type: string}>
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true: skip saving == filtered; false: continue with saving
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where retrieved metadata directory will be saved |
-| name | string
| name of the metadata file |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+| [include] | boolean
| true: use definition.include / options.include; false=exclude: use definition.filter / options.exclude |
-
+
-### Script.update(script) ⇒ Promise
-Updates a single Script
+### MetadataType.isFilteredFolder(metadataEntry, [include]) ⇒ boolean
+optionally filter by what folder something is in
-**Kind**: static method of [Script
](#Script)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true: filtered == do NOT save; false: not filtered == do save
| Param | Type | Description |
| --- | --- | --- |
-| script | TYPE.MetadataTypeItem
| a single Script |
+| metadataEntry | object
| metadata entry |
+| [include] | boolean
| true: use definition.include / options.include; false=exclude: use definition.filter / options.exclude |
-
+
-### Script.create(script) ⇒ Promise
-Creates a single Script
+### MetadataType.saveResults(results, retrieveDir, [overrideType], [templateVariables]) ⇒ Promise.<TYPE.MetadataTypeMap>
+Helper for writing Metadata to disk, used for Retrieve and deploy
-**Kind**: static method of [Script
](#Script)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of saved metadata
| Param | Type | Description |
| --- | --- | --- |
-| script | TYPE.MetadataTypeItem
| a single Script |
+| results | TYPE.MetadataTypeMap
| metadata results from deploy |
+| retrieveDir | string
| directory where metadata should be stored after deploy/retrieve |
+| [overrideType] | string
| for use when there is a subtype (such as folder-queries) |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### Script.\_mergeCode(metadata, deployDir, [templateName]) ⇒ Promise.<string>
-helper for [preDeployTasks](#Script.preDeployTasks) that loads extracted code content back into JSON
+### MetadataType.applyTemplateValues(code, templateVariables) ⇒ string
+helper for [buildDefinitionForNested](#MetadataType.buildDefinitionForNested)
+searches extracted file for template variable names and applies the market values
-**Kind**: static method of [Script
](#Script)
-**Returns**: Promise.<string>
- content for metadata.script
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: string
- code with markets applied
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.ScriptItem
| a single asset definition |
-| deployDir | string
| directory of deploy files |
-| [templateName] | string
| name of the template used to built defintion (prior applying templating) |
+| code | string
| code from extracted code |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### Script.preDeployTasks(metadata, dir) ⇒ TYPE.ScriptItem
-prepares a Script for deployment
+### MetadataType.applyTemplateNames(code, templateVariables) ⇒ string
+helper for [buildTemplateForNested](#MetadataType.buildTemplateForNested)
+searches extracted file for template variable values and applies the market variable names
-**Kind**: static method of [Script
](#Script)
-**Returns**: TYPE.ScriptItem
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: string
- code with markets applied
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.ScriptItem
| a single script activity definition |
-| dir | string
| directory of deploy files |
+| code | string
| code from extracted code |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### Script.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+### MetadataType.buildDefinitionForNested(templateDir, targetDir, metadata, variables, templateName) ⇒ Promise.<Array.<Array.<string>>>
helper for [buildDefinition](#MetadataType.buildDefinition)
-handles extracted code if any are found for complex types
+handles extracted code if any are found for complex types (e.g script, asset, query)
-**Kind**: static method of [Script
](#Script)
+**Kind**: static method of [MetadataType
](#MetadataType)
**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
| Param | Type | Description |
| --- | --- | --- |
| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.ScriptItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| targetDir | string
| Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| variables | TYPE.TemplateMap
| variables to be replaced in the metadata |
| templateName | string
| name of the template to be built |
-
+
-### Script.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+### MetadataType.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
helper for [buildTemplate](#MetadataType.buildTemplate)
handles extracted code if any are found for complex types
-**Kind**: static method of [Script
](#Script)
+**Kind**: static method of [MetadataType
](#MetadataType)
**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
| Param | Type | Description |
| --- | --- | --- |
| templateDir | string
| Directory where metadata templates are stored |
| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.ScriptItem
| main JSON file that was read from file system |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
| templateName | string
| name of the template to be built |
-**Example**
-```js
-scripts are saved as 1 json and 1 ssjs file. both files need to be run through templating
-```
-
+
-### Script.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ Promise.<Array.<Array.<string>>>
-helper for [buildTemplateForNested](#Script.buildTemplateForNested) / [buildDefinitionForNested](#Script.buildDefinitionForNested)
-handles extracted code if any are found for complex types
+### MetadataType.findSubType(templateDir, templateName) ⇒ Promise.<string>
+check template directory for complex types that open subfolders for their subtypes
-**Kind**: static method of [Script
](#Script)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<string>
- subtype name
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| templateName | string
| name of the metadata file |
+
+
+
+### MetadataType.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName, ex) ⇒ object
+optional method used for some types to try a different folder structure
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: object
- metadata
+
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| typeDirArr | Array.<string>
| current subdir for this type |
+| templateName | string
| name of the metadata template |
+| fileName | string
| name of the metadata template file w/o extension |
+| ex | Error
| error from first attempt |
+
+
+
+### MetadataType.buildDefinition(templateDir, targetDir, templateName, variables) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Builds definition based on template
+NOTE: Most metadata files should use this generic method, unless custom
+parsing is required (for example scripts & queries)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of item map
| Param | Type | Description |
| --- | --- | --- |
| templateDir | string
| Directory where metadata templates are stored |
| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.ScriptItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
-| mode | 'definition'
\| 'template'
| defines what we use this helper for |
+| templateName | string
| name of the metadata file |
+| variables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### Script.postRetrieveTasks(metadata) ⇒ TYPE.CodeExtractItem
-manages post retrieve steps
+### MetadataType.getErrorsREST(ex) ⇒ Array.<string>
\| void
+Standardizes a check for multiple messages
-**Kind**: static method of [Script
](#Script)
-**Returns**: TYPE.CodeExtractItem
- a single item with code parts extracted
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Array.<string>
\| void
- formatted Error Message
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.ScriptItem
| a single item |
+| ex | object
| response payload from REST API |
-
+
-### Script.prepExtractedCode(metadataScript, metadataName) ⇒ Object
-helper for [postRetrieveTasks](#Script.postRetrieveTasks) and [_buildForNested](#Script._buildForNested)
+### MetadataType.document([metadata], [isDeploy]) ⇒ void
+Gets metadata cache with limited fields and does not store value to disk
-**Kind**: static method of [Script
](#Script)
-**Returns**: Object
- returns found extension and file content
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| metadataScript | string
| the code of the file |
-| metadataName | string
| the name of the metadata |
+| [metadata] | TYPE.MetadataTypeMap
| a list of type definitions |
+| [isDeploy] | boolean
| used to skip non-supported message during deploy |
-
+
-### Script.getFilesToCommit(keyArr) ⇒ Array.<string>
-should return only the json for all but asset, query and script that are saved as multiple files
-additionally, the documentation for dataExtension and automation should be returned
+### MetadataType.resolveId(id) ⇒ Promise.<string>
+get name & key for provided id
-**Kind**: static method of [Script
](#Script)
-**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<string>
- key of metadata
| Param | Type | Description |
| --- | --- | --- |
-| keyArr | Array.<string>
| customerkey of the metadata |
+| id | string
| Identifier of metadata |
-
+
-### Script.deleteByKey(customerKey) ⇒ Promise.<boolean>
+### MetadataType.deleteByKey(customerKey) ⇒ boolean
Delete a metadata item from the specified business unit
-**Kind**: static method of [Script
](#Script)
-**Returns**: Promise.<boolean>
- deletion success flag
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- deletion success status
| Param | Type | Description |
| --- | --- | --- |
| customerKey | string
| Identifier of data extension |
-
+
-### Script.postDeleteTasks(customerKey) ⇒ void
+### MetadataType.postDeleteTasks(customerKey, [additionalExtensions]) ⇒ Promise.<void>
clean up after deleting a metadata item
-**Kind**: static method of [Script
](#Script)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<void>
- - Promise
| Param | Type | Description |
| --- | --- | --- |
| customerKey | string
| Identifier of metadata item |
+| [additionalExtensions] | Array.<string>
| additional file extensions to delete on top of `${this.definition.type}-meta.json` |
-
+
-## SendClassification ⇐ [MetadataType
](#MetadataType)
-SendClassification MetadataType
+### MetadataType.deleteByKeySOAP(customerKey, [overrideKeyField], [handleOutside]) ⇒ Promise.<boolean>
+Delete a data extension from the specified business unit
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
-
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<boolean>
- deletion success flag
-### SendClassification.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+| Param | Type | Description |
+| --- | --- | --- |
+| customerKey | string
| Identifier of metadata |
+| [overrideKeyField] | string
| optionally change the name of the key field if the api uses a different name |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
-**Kind**: static method of [SendClassification
](#SendClassification)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+
+
+### MetadataType.deleteByKeyREST(url, key, [handleOutside]) ⇒ Promise.<boolean>
+Delete a data extension from the specified business unit
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<boolean>
- deletion success flag
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| url | string
| endpoint |
+| key | string
| Identifier of metadata |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
-
+
-## TransactionalEmail ⇐ [TransactionalMessage
](#TransactionalMessage)
-TransactionalEmail MetadataType
+### MetadataType.readBUMetadataForType(readDir, [listBadKeys], [buMetadata]) ⇒ object
+Returns metadata of a business unit that is saved locally
-**Kind**: global class
-**Extends**: [TransactionalMessage
](#TransactionalMessage)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: object
- Metadata of BU in local directory
-* [TransactionalEmail](#TransactionalEmail) ⇐ [TransactionalMessage
](#TransactionalMessage)
- * [.update(metadata)](#TransactionalEmail.update) ⇒ Promise
- * [.preDeployTasks(metadata)](#TransactionalEmail.preDeployTasks) ⇒ TYPE.MetadataTypeItem
- * [.postCreateTasks(_, apiResponse)](#TransactionalEmail.postCreateTasks) ⇒ void
- * [.postDeployTasks()](#TransactionalEmail.postDeployTasks) ⇒ void
- * [.postRetrieveTasks(metadata)](#TransactionalEmail.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
- * [.deleteByKey(key)](#TransactionalEmail.deleteByKey) ⇒ Promise.<boolean>
+| Param | Type | Description |
+| --- | --- | --- |
+| readDir | string
| root directory of metadata. |
+| [listBadKeys] | boolean
| do not print errors, used for badKeys() |
+| [buMetadata] | object
| Metadata of BU in local directory |
-
+
-### TransactionalEmail.update(metadata) ⇒ Promise
-Updates a single item
+### MetadataType.getFilesToCommit(keyArr) ⇒ Promise.<Array.<string>>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
-**Kind**: static method of [TransactionalEmail
](#TransactionalEmail)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<Array.<string>>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| how the item shall look after the update |
+| keyArr | Array.<string>
| customerkey of the metadata |
-
+
-### TransactionalEmail.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
-prepares for deployment
+### MetadataType.getKeysForFixing(metadataMap) ⇒ Array.<string>
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Array.<string>
- list of keys
-**Kind**: static method of [TransactionalEmail
](#TransactionalEmail)
-**Returns**: TYPE.MetadataTypeItem
- Promise
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataMap | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+
+
+
+### MetadataType.getJsonFromFS(dir, [listBadKeys]) ⇒ TYPE.MetadataTypeMap
+Returns file contents mapped to their filename without '.json' ending
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: TYPE.MetadataTypeMap
- fileName => fileContent map
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| dir | string
| directory that contains '.json' files to be read |
+| [listBadKeys] | boolean
| do not print errors, used for badKeys() |
-
+
-### TransactionalEmail.postCreateTasks(_, apiResponse) ⇒ void
-helper for [TransactionalEmail.createREST](TransactionalEmail.createREST)
+### MetadataType.getFieldNamesToRetrieve([additionalFields], [isCaching]) ⇒ Array.<string>
+Returns fieldnames of Metadata Type. 'this.definition.fields' variable only set in child classes.
-**Kind**: static method of [TransactionalEmail
](#TransactionalEmail)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Array.<string>
- Fieldnames
| Param | Type | Description |
| --- | --- | --- |
-| _ | TYPE.MetadataTypeItem
| not used |
-| apiResponse | object
| varies depending on the API call |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [isCaching] | boolean
| if true, then check if field should be skipped for caching |
-
+
-### TransactionalEmail.postDeployTasks() ⇒ void
-Gets executed after deployment of metadata type
+### MetadataType.deploy(metadata, deployDir, retrieveDir) ⇒ Promise.<TYPE.MetadataTypeMap>
+Deploys metadata
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of keyField => metadata map
+
+| Param | Type | Description |
+| --- | --- | --- |
+| metadata | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| deployDir | string
| directory where deploy metadata are saved |
+| retrieveDir | string
| directory where metadata after deploy should be saved |
-**Kind**: static method of [TransactionalEmail
](#TransactionalEmail)
-
+
-### TransactionalEmail.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
-manages post retrieve steps
+### MetadataType.postDeployTasks(upsertResults, originalMetadata, createdUpdated) ⇒ void
+Gets executed after deployment of metadata type
-**Kind**: static method of [TransactionalEmail
](#TransactionalEmail)
-**Returns**: TYPE.MetadataTypeItem
- a single item
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| upsertResults | TYPE.MetadataTypeMap
| metadata mapped by their keyField as returned by update/create |
+| originalMetadata | TYPE.MetadataTypeMap
| metadata to be updated (contains additioanl fields) |
+| createdUpdated | Object
| counter representing successful creates/updates |
-
+
-### TransactionalEmail.deleteByKey(key) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
+### MetadataType.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields) ⇒ void
+helper for [createREST](#MetadataType.createREST)
-**Kind**: static method of [TransactionalEmail
](#TransactionalEmail)
-**Returns**: Promise.<boolean>
- deletion success status
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| key | string
| Identifier of item |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
+| metadataEntryWithAllFields | TYPE.MetadataTypeItem
| like metadataEntry but before non-creatable fields were stripped |
-
+
-## TransactionalMessage ⇐ [MetadataType
](#MetadataType)
-TransactionalMessage MetadataType
+### MetadataType.postUpdateTasks(metadataEntry, apiResponse) ⇒ void
+helper for [updateREST](#MetadataType.updateREST)
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [MetadataType
](#MetadataType)
-* [TransactionalMessage](#TransactionalMessage) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#TransactionalMessage.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache([_], [__], [key])](#TransactionalMessage.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.update(metadata)](#TransactionalMessage.update) ⇒ Promise
- * [.create(metadata)](#TransactionalMessage.create) ⇒ Promise
- * [.deleteByKey(key)](#TransactionalMessage.deleteByKey) ⇒ Promise.<boolean>
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
-
+
-### TransactionalMessage.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata
+### MetadataType.postDeployTasks\_legacyApi(metadataEntry, apiResponse) ⇒ Promise.<void>
+helper for [createREST](#MetadataType.createREST) when legacy API endpoints as these do not return the created item but only their new id
-**Kind**: static method of [TransactionalMessage
](#TransactionalMessage)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<void>
- -
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| apiResponse | object
| varies depending on the API call |
-
+
-### TransactionalMessage.retrieveForCache([_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves event definition metadata for caching
+### MetadataType.postRetrieveTasks(metadata, targetDir, [isTemplating]) ⇒ TYPE.MetadataTypeItem
+Gets executed after retreive of metadata type
-**Kind**: static method of [TransactionalMessage
](#TransactionalMessage)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: TYPE.MetadataTypeItem
- cloned metadata
| Param | Type | Description |
| --- | --- | --- |
-| [_] | void
| parameter not used |
-| [__] | void
| parameter not used |
-| [key] | string
| customer key of single item to cache |
+| metadata | TYPE.MetadataTypeItem
| a single item |
+| targetDir | string
| folder where retrieves should be saved |
+| [isTemplating] | boolean
| signals that we are retrieving templates |
-
+
-### TransactionalMessage.update(metadata) ⇒ Promise
-Updates a single item
+### MetadataType.setFolderPath(metadata)
+generic script that retrieves the folder path from cache and updates the given metadata with it after retrieve
-**Kind**: static method of [TransactionalMessage
](#TransactionalMessage)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-### TransactionalMessage.create(metadata) ⇒ Promise
-Creates a single item
+### MetadataType.setFolderId(metadata)
+generic script that retrieves the folder ID from cache and updates the given metadata with it before deploy
-**Kind**: static method of [TransactionalMessage
](#TransactionalMessage)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
| metadata | TYPE.MetadataTypeItem
| a single item |
-
+
-### TransactionalMessage.deleteByKey(key) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
+### MetadataType.retrieve(retrieveDir, [additionalFields], [subTypeArr], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata from Marketing Cloud
-**Kind**: static method of [TransactionalMessage
](#TransactionalMessage)
-**Returns**: Promise.<boolean>
- deletion success status
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| key | string
| Identifier of item |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+| [key] | string
| customer key of single item to retrieve |
-
+
-## TransactionalPush ⇐ [TransactionalMessage
](#TransactionalMessage)
-TransactionalPush TransactionalMessage
+### MetadataType.retrieveChangelog([additionalFields], [subTypeArr]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata from Marketing Cloud
-**Kind**: global class
-**Extends**: [TransactionalMessage
](#TransactionalMessage)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
-* [TransactionalPush](#TransactionalPush) ⇐ [TransactionalMessage
](#TransactionalMessage)
- * [.preDeployTasks(metadata)](#TransactionalPush.preDeployTasks) ⇒ TYPE.MetadataTypeItem
- * [.postRetrieveTasks(metadata)](#TransactionalPush.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
+| Param | Type | Description |
+| --- | --- | --- |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
-
+
-### TransactionalPush.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
-prepares for deployment
+### MetadataType.retrieveForCache([additionalFields], [subTypeArr], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Gets metadata cache with limited fields and does not store value to disk
-**Kind**: static method of [TransactionalPush
](#TransactionalPush)
-**Returns**: TYPE.MetadataTypeItem
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| [subTypeArr] | Array.<string>
| optionally limit to a single subtype |
+| [key] | string
| customer key of single item to retrieve |
-
+
-### TransactionalPush.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
-manages post retrieve steps
+### MetadataType.retrieveAsTemplate(templateDir, name, templateVariables, [subType]) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+Gets metadata cache with limited fields and does not store value to disk
-**Kind**: static method of [TransactionalPush
](#TransactionalPush)
-**Returns**: TYPE.MetadataTypeItem
- a single item
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| name | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| [subType] | string
| optionally limit to a single subtype |
-
+
-## TransactionalSMS ⇐ [TransactionalMessage
](#TransactionalMessage)
-TransactionalSMS MetadataType
+### MetadataType.retrieveTemplateREST(templateDir, uri, templateVariables, name) ⇒ Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
+Retrieve a specific Script by Name
-**Kind**: global class
-**Extends**: [TransactionalMessage
](#TransactionalMessage)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{metadata: TYPE.MetadataTypeItem, type: string}>
- Promise
-* [TransactionalSMS](#TransactionalSMS) ⇐ [TransactionalMessage
](#TransactionalMessage)
- * [.postDeleteTasks(customerKey)](#TransactionalSMS.postDeleteTasks) ⇒ void
- * [.preDeployTasks(metadata, deployDir)](#TransactionalSMS.preDeployTasks) ⇒ Promise.<TYPE.MetadataTypeItem>
- * [._mergeCode(metadata, deployDir, [templateName])](#TransactionalSMS._mergeCode) ⇒ Promise.<string>
- * [.postRetrieveTasks(metadata)](#TransactionalSMS.postRetrieveTasks) ⇒ Promise.<TYPE.CodeExtractItem>
- * [.prepExtractedCode(metadataScript)](#TransactionalSMS.prepExtractedCode) ⇒ Promise.<{fileExt:string, code:string}>
- * [.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#TransactionalSMS.buildDefinitionForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName)](#TransactionalSMS.buildTemplateForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [._buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode)](#TransactionalSMS._buildForNested) ⇒ Promise.<Array.<Array.<string>>>
- * [._isHTML(code)](#TransactionalSMS._isHTML) ⇒ boolean
- * [.getFilesToCommit(keyArr)](#TransactionalSMS.getFilesToCommit) ⇒ Array.<string>
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where retrieved metadata directory will be saved |
+| uri | string
| rest endpoint for GET |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| name | string
| name (not key) of the metadata item |
-
+
-### TransactionalSMS.postDeleteTasks(customerKey) ⇒ void
-clean up after deleting a metadata item
+### MetadataType.buildTemplate(retrieveDir, templateDir, key, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj>
+Gets metadata cache with limited fields and does not store value to disk
-**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeItemObj>
- single metadata
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of metadata item |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| templateDir | string
| (List of) Directory where built definitions will be saved |
+| key | string
| name of the metadata file |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### TransactionalSMS.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.MetadataTypeItem>
-prepares for deployment
+### MetadataType.preDeployTasks(metadata, deployDir) ⇒ Promise.<TYPE.MetadataTypeItem>
+Gets executed before deploying metadata
-**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
-**Returns**: Promise.<TYPE.MetadataTypeItem>
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeItem>
- Promise of a single metadata item
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
-| deployDir | string
| directory of deploy files |
+| metadata | TYPE.MetadataTypeItem
| a single metadata item |
+| deployDir | string
| folder where files for deployment are stored |
-
+
-### TransactionalSMS.\_mergeCode(metadata, deployDir, [templateName]) ⇒ Promise.<string>
-helper for [preDeployTasks](#TransactionalSMS.preDeployTasks) that loads extracted code content back into JSON
+### MetadataType.create(metadata, deployDir) ⇒ void
+Abstract create method that needs to be implemented in child metadata type
-**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
-**Returns**: Promise.<string>
- content for metadata.script
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single definition |
-| deployDir | string
| directory of deploy files |
-| [templateName] | string
| name of the template used to built defintion (prior applying templating) |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| deployDir | string
| directory where deploy metadata are saved |
-
+
-### TransactionalSMS.postRetrieveTasks(metadata) ⇒ Promise.<TYPE.CodeExtractItem>
-manages post retrieve steps
+### MetadataType.update(metadata, [metadataBefore]) ⇒ void
+Abstract update method that needs to be implemented in child metadata type
-**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
-**Returns**: Promise.<TYPE.CodeExtractItem>
- Array with one metadata object and one ssjs string
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| [metadataBefore] | TYPE.MetadataTypeItem
| metadata mapped by their keyField |
+
+
+
+### MetadataType.refresh() ⇒ void
+Abstract refresh method that needs to be implemented in child metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+
+### MetadataType.execute() ⇒ void
+Abstract execute method that needs to be implemented in child metadata type
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+
+
+### MetadataType.pause() ⇒ void
+Abstract pause method that needs to be implemented in child metadata type
-
+**Kind**: static method of [MetadataType
](#MetadataType)
+
-### TransactionalSMS.prepExtractedCode(metadataScript) ⇒ Promise.<{fileExt:string, code:string}>
-helper for [postRetrieveTasks](#TransactionalSMS.postRetrieveTasks) and [_buildForNested](#TransactionalSMS._buildForNested)
+### MetadataType.hasChanged(cachedVersion, metadata, [fieldName]) ⇒ boolean
+test if metadata was actually changed or not to potentially skip it during deployment
-**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
-**Returns**: Promise.<{fileExt:string, code:string}>
- returns found extension and file content
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true if metadata was changed
| Param | Type | Description |
| --- | --- | --- |
-| metadataScript | string
| the code of the file |
+| cachedVersion | TYPE.MetadataTypeItem
| cached version from the server |
+| metadata | TYPE.MetadataTypeItem
| item to upload |
+| [fieldName] | string
| optional field name to use for identifying the record in logs |
-
+
-### TransactionalSMS.buildDefinitionForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
-helper for [TransactionalMessage.buildDefinition](TransactionalMessage.buildDefinition)
-handles extracted code if any are found for complex types
+### MetadataType.hasChangedGeneric(cachedVersion, metadata, [fieldName], [silent]) ⇒ boolean
+test if metadata was actually changed or not to potentially skip it during deployment
-**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true on first identified deviation or false if none are found
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
+| cachedVersion | TYPE.MetadataTypeItem
| cached version from the server |
+| metadata | TYPE.MetadataTypeItem
| item to upload |
+| [fieldName] | string
| optional field name to use for identifying the record in logs |
+| [silent] | boolean
| optionally suppress logging |
-
+
-### TransactionalSMS.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
-helper for [TransactionalMessage.buildTemplate](TransactionalMessage.buildTemplate)
-handles extracted code if any are found for complex types
+### MetadataType.upsert(metadataMap, deployDir) ⇒ Promise.<TYPE.MetadataTypeMap>
+MetadataType upsert, after retrieving from target and comparing to check if create or update operation is needed.
-**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- keyField => metadata map
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
+| metadataMap | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
+| deployDir | string
| directory where deploy metadata are saved |
-**Example**
-```js
-scripts are saved as 1 json and 1 ssjs file. both files need to be run through templating
-```
-
+
-### TransactionalSMS.\_buildForNested(templateDir, targetDir, metadata, templateVariables, templateName, mode) ⇒ Promise.<Array.<Array.<string>>>
-helper for [buildTemplateForNested](#TransactionalSMS.buildTemplateForNested) / [buildDefinitionForNested](#TransactionalSMS.buildDefinitionForNested)
-handles extracted code if any are found for complex types
+### MetadataType.createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate) ⇒ 'create'
\| 'update'
\| 'skip'
+helper for [upsert](#MetadataType.upsert)
-**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
-**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: 'create'
\| 'update'
\| 'skip'
- action to take
| Param | Type | Description |
| --- | --- | --- |
-| templateDir | string
| Directory where metadata templates are stored |
-| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
-| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
-| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-| templateName | string
| name of the template to be built |
-| mode | 'definition'
\| 'template'
| defines what we use this helper for |
+| metadataMap | TYPE.MetadataTypeMap
| list of metadata |
+| metadataKey | string
| key of item we are looking at |
+| hasError | boolean
| error flag from previous code |
+| metadataToUpdate | Array.<TYPE.MetadataTypeItemDiff>
| list of items to update |
+| metadataToCreate | Array.<TYPE.MetadataTypeItem>
| list of items to create |
-
+
-### TransactionalSMS.\_isHTML(code) ⇒ boolean
-very simplified test for HTML code in our SMS
+### MetadataType.createREST(metadataEntry, uri) ⇒ Promise.<object>
\| null
+Creates a single metadata entry via REST
-**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
-**Returns**: boolean
- true if HTML is found
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
| Param | Type | Description |
| --- | --- | --- |
-| code | string
| sms source code |
+| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
+| uri | string
| rest endpoint for POST |
-
+
-### TransactionalSMS.getFilesToCommit(keyArr) ⇒ Array.<string>
-should return only the json for all but asset, query and script that are saved as multiple files
-additionally, the documentation for dataExtension and automation should be returned
+### MetadataType.createSOAP(metadataEntry, [handleOutside]) ⇒ Promise.<object>
\| null
+Creates a single metadata entry via fuel-soap (generic lib not wrapper)
-**Kind**: static method of [TransactionalSMS
](#TransactionalSMS)
-**Returns**: Array.<string>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
| Param | Type | Description |
| --- | --- | --- |
-| keyArr | Array.<string>
| customerkey of the metadata |
+| metadataEntry | TYPE.MetadataTypeItem
| single metadata entry |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
-
+
-## TriggeredSend ⇐ [MetadataType
](#MetadataType)
-MessageSendActivity MetadataType
+### MetadataType.updateREST(metadataEntry, uri, [httpMethod]) ⇒ Promise.<object>
\| null
+Updates a single metadata entry via REST
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
-* [TriggeredSend](#TriggeredSend) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], [key])](#TriggeredSend.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.create(metadata)](#TriggeredSend.create) ⇒ Promise
- * [.update(metadata)](#TriggeredSend.update) ⇒ Promise
- * [.deleteByKey(customerKey)](#TriggeredSend.deleteByKey) ⇒ Promise.<boolean>
- * [.postRetrieveTasks(metadata)](#TriggeredSend.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
\| void
- * [.preDeployTasks(metadata)](#TriggeredSend.preDeployTasks) ⇒ TYPE.MetadataTypeItem
- * [.refresh([keyArr], [checkKey])](#TriggeredSend.refresh) ⇒ Promise.<void>
- * [.getKeysForValidTSDs(metadata)](#TriggeredSend.getKeysForValidTSDs) ⇒ Promise.<Array.<string>>
- * [.findRefreshableItems([assetLoaded])](#TriggeredSend.findRefreshableItems) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [._refreshItem(key, checkKey)](#TriggeredSend._refreshItem) ⇒ Promise.<boolean>
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| | a single metadata Entry |
+| uri | string
| | rest endpoint for PATCH |
+| [httpMethod] | 'patch'
\| 'post'
\| 'put'
| patch
| defaults to 'patch'; some update requests require PUT instead of PATCH |
-
+
-### TriggeredSend.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+### MetadataType.updateSOAP(metadataEntry, [handleOutside]) ⇒ Promise.<object>
\| null
+Updates a single metadata entry via fuel-soap (generic lib not wrapper)
-**Kind**: static method of [TriggeredSend
](#TriggeredSend)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<object>
\| null
- Promise of API response or null in case of an error
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
-
-
+| metadataEntry | TYPE.MetadataTypeItem
| single metadata entry |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
-### TriggeredSend.create(metadata) ⇒ Promise
-Create a single TSD.
+
-**Kind**: static method of [TriggeredSend
](#TriggeredSend)
-**Returns**: Promise
- Promise
+### MetadataType.\_handleSOAPErrors(ex, msg, [metadataEntry], [handleOutside])
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| ex | Error
| error that occured |
+| msg | 'creating'
\| 'updating'
| what to print in the log |
+| [metadataEntry] | TYPE.MetadataTypeItem
| single metadata entry |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
-
+
-### TriggeredSend.update(metadata) ⇒ Promise
-Updates a single TSD.
+### MetadataType.getSOAPErrorMsg(ex) ⇒ string
+helper for [_handleSOAPErrors](#MetadataType._handleSOAPErrors)
-**Kind**: static method of [TriggeredSend
](#TriggeredSend)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: string
- error message
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| ex | Error
| error that occured |
-
+
-### TriggeredSend.deleteByKey(customerKey) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
+### MetadataType.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Retrieves SOAP via generic fuel-soap wrapper based metadata of metadata type into local filesystem. executes callback with retrieved metadata
-**Kind**: static method of [TriggeredSend
](#TriggeredSend)
-**Returns**: Promise.<boolean>
- deletion success status
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of item map
| Param | Type | Description |
| --- | --- | --- |
-| customerKey | string
| Identifier of data extension |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| [requestParams] | TYPE.SoapRequestParams
| required for the specific request (filter for example) |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
-
+
-### TriggeredSend.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
\| void
-parses retrieved Metadata before saving
+### MetadataType.retrieveREST(retrieveDir, uri, [templateVariables], [singleRetrieve]) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+Retrieves Metadata for Rest Types
-**Kind**: static method of [TriggeredSend
](#TriggeredSend)
-**Returns**: TYPE.MetadataTypeItem
\| void
- Array with one metadata object and one sql string
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
- Promise of item map (single item for templated result)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
+| uri | string
| rest endpoint for GET |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
-
+
-### TriggeredSend.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem
-prepares a TSD for deployment
+### MetadataType.retrieveRESTcollection(urlArray, [concurrentRequests], [logAmountOfUrls]) ⇒ Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{metadata: (TYPE.MetadataTypeMap\|TYPE.MetadataTypeItem), type: string}>
- Promise of item map (single item for templated result)
-**Kind**: static method of [TriggeredSend
](#TriggeredSend)
-**Returns**: TYPE.MetadataTypeItem
- metadata object
+| Param | Type | Default | Description |
+| --- | --- | --- | --- |
+| urlArray | Array.<object>
| | {uri: string, id: string} combo of URL and ID/key of metadata |
+| [concurrentRequests] | number
| 10
| optionally set a different amount of concurrent requests |
+| [logAmountOfUrls] | boolean
| true
| if true, prints an info message about to-be loaded amount of metadata |
+
+
+
+### MetadataType.handleRESTErrors(ex, id) ⇒ null
+helper for [this.retrieveRESTcollection](this.retrieveRESTcollection)
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: null
- -
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| of a single TSD |
-
-
+| ex | Error
| exception |
+| id | string
| id or key of item |
-### TriggeredSend.refresh([keyArr], [checkKey]) ⇒ Promise.<void>
-TSD-specific refresh method that finds active TSDs and refreshes them
+
-**Kind**: static method of [TriggeredSend
](#TriggeredSend)
-**Returns**: Promise.<void>
- -
+### MetadataType.executeREST(uri, key) ⇒ Promise.<{key:string, response:string}>
+Used to execute a query/automation etc.
-| Param | Type | Default | Description |
-| --- | --- | --- | --- |
-| [keyArr] | Array.<string>
| | metadata keys |
-| [checkKey] | boolean
| true
| whether to check if the key is valid |
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{key:string, response:string}>
- metadata key and API response (OK or error)
-
+| Param | Type | Description |
+| --- | --- | --- |
+| uri | string
| REST endpoint where the POST request should be sent |
+| key | string
| item key |
-### TriggeredSend.getKeysForValidTSDs(metadata) ⇒ Promise.<Array.<string>>
-helper for [refresh](#TriggeredSend.refresh) that extracts the keys from the TSD item map and eli
+
-**Kind**: static method of [TriggeredSend
](#TriggeredSend)
-**Returns**: Promise.<Array.<string>>
- keyArr
+### MetadataType.executeSOAP([metadataEntry]) ⇒ Promise.<{key:string, response:object}>
+Used to execute a query/automation etc.
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<{key:string, response:object}>
- metadata key and API response
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeMapObj
| TSD item map |
+| [metadataEntry] | TYPE.MetadataTypeItem
| single metadata entry |
-
+
-### TriggeredSend.findRefreshableItems([assetLoaded]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-helper for [refresh](#TriggeredSend.refresh) that finds active TSDs on the server and filters it by the same rules that [retrieve](#TriggeredSend.retrieve) is using to avoid refreshing TSDs with broken dependencies
+### MetadataType.runDocumentOnRetrieve([singleRetrieve], metadataMap) ⇒ Promise.<void>
+helper for [retrieveREST](#MetadataType.retrieveREST) and [retrieveSOAP](#MetadataType.retrieveSOAP)
-**Kind**: static method of [TriggeredSend
](#TriggeredSend)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of TSD item map
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<void>
- -
-| Param | Type | Default | Description |
-| --- | --- | --- | --- |
-| [assetLoaded] | boolean
| false
| if run after Asset.deploy via --refresh option this will skip caching assets |
+| Param | Type | Description |
+| --- | --- | --- |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
+| metadataMap | TYPE.MetadataTypeMap
| saved metadata |
-
+
-### TriggeredSend.\_refreshItem(key, checkKey) ⇒ Promise.<boolean>
-helper for [refresh](#TriggeredSend.refresh) that pauses, publishes and starts a triggered send
+### MetadataType.parseResponseBody(body, [singleRetrieve]) ⇒ TYPE.MetadataTypeMap
+Builds map of metadata entries mapped to their keyfields
-**Kind**: static method of [TriggeredSend
](#TriggeredSend)
-**Returns**: Promise.<boolean>
- true if refresh was successful
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: TYPE.MetadataTypeMap
- keyField => metadata map
| Param | Type | Description |
| --- | --- | --- |
-| key | string
| external key of triggered send item |
-| checkKey | boolean
| whether to check if key exists on the server |
+| body | object
| json of response body |
+| [singleRetrieve] | string
\| number
| key of single item to filter by |
-
+
-## User ⇐ [MetadataType
](#MetadataType)
-MetadataType
+### MetadataType.deleteFieldByDefinition(metadataEntry, fieldPath, definitionProperty, origin) ⇒ void
+Deletes a field in a metadata entry if the selected definition property equals false.
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [MetadataType
](#MetadataType)
-* [User](#User) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, _, [__], [key])](#User.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveForCache()](#User.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.create(metadata)](#User.create) ⇒ Promise
- * [.update(metadata)](#User.update) ⇒ Promise
- * [.preDeployTasks(metadata)](#User.preDeployTasks) ⇒ TYPE.UserDocument
- * [.createOrUpdate(metadata, metadataKey, hasError, metadataToUpdate, metadataToCreate)](#User.createOrUpdate) ⇒ void
- * [.postDeployTasks(upsertResults)](#User.postDeployTasks) ⇒ Promise.<void>
- * [._getRoleObjectForDeploy(roleId, roleName, userId, assignmentOnly, [isRoleRemovale])](#User._getRoleObjectForDeploy) ⇒ object
- * [.retrieveChangelog()](#User.retrieveChangelog) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields])](#User.retrieveSOAP) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.document([metadata])](#User.document) ⇒ Promise.<void>
- * [.postRetrieveTasks(metadata)](#User.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem
\| void
+| Param | Type | Description |
+| --- | --- | --- |
+| metadataEntry | TYPE.MetadataTypeItem
| One entry of a metadataType |
+| fieldPath | string
| field path to be checked if it conforms to the definition (dot seperated if nested): 'fuu.bar' |
+| definitionProperty | 'isCreateable'
\| 'isUpdateable'
\| 'retrieving'
\| 'templating'
| delete field if definitionProperty equals false for specified field. Options: [isCreateable | isUpdateable] |
+| origin | string
| string of parent object, required when using arrays as these are parsed slightly differently. |
-
+**Example**
+```js
+Removes field (or nested fields childs) that are not updateable
+deleteFieldByDefinition(metadataEntry, 'CustomerKey', 'isUpdateable');
+```
+
-### User.retrieve(retrieveDir, _, [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+### MetadataType.removeNotCreateableFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not createable
-**Kind**: static method of [User
](#User)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| _ | void
| unused parameter |
-| [__] | void
| unused parameter |
-| [key] | string
| customer key of single item to retrieve |
-
-
-
-### User.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves import definition metadata for caching
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
-**Kind**: static method of [User
](#User)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise
-
+
-### User.create(metadata) ⇒ Promise
-Create a single item.
+### MetadataType.removeNotUpdateableFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not updateable
-**Kind**: static method of [User
](#User)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
-
+
-### User.update(metadata) ⇒ Promise
-Updates a single item.
+### MetadataType.keepTemplateFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not needed in the template
-**Kind**: static method of [User
](#User)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| single metadata entry |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
-
+
-### User.preDeployTasks(metadata) ⇒ TYPE.UserDocument
-prepares a item for deployment
+### MetadataType.keepRetrieveFields(metadataEntry) ⇒ void
+Remove fields from metadata entry that are not needed in the stored metadata
-**Kind**: static method of [User
](#User)
-**Returns**: TYPE.UserDocument
- metadata object
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.UserDocument
| of a single item |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
-
+
-### User.createOrUpdate(metadata, metadataKey, hasError, metadataToUpdate, metadataToCreate) ⇒ void
-helper for [upsert](#MetadataType.upsert)
+### MetadataType.isFiltered(metadataEntry, [include]) ⇒ boolean
+checks if the current metadata entry should be saved on retrieve or not
-**Kind**: static method of [User
](#User)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true: skip saving == filtered; false: continue with saving
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeMap
| list of metadata |
-| metadataKey | string
| key of item we are looking at |
-| hasError | boolean
| error flag from previous code |
-| metadataToUpdate | Array.<TYPE.UserDocumentDiff>
| list of items to update |
-| metadataToCreate | Array.<TYPE.UserDocument>
| list of items to create |
+| metadataEntry | TYPE.MetadataTypeItem
| metadata entry |
+| [include] | boolean
| true: use definition.include / options.include; false=exclude: use definition.filter / options.exclude |
-
+
-### User.postDeployTasks(upsertResults) ⇒ Promise.<void>
-Gets executed after deployment of metadata type
+### MetadataType.isFilteredFolder(metadataEntry, [include]) ⇒ boolean
+optionally filter by what folder something is in
-**Kind**: static method of [User
](#User)
-**Returns**: Promise.<void>
- promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- true: filtered == do NOT save; false: not filtered == do save
| Param | Type | Description |
| --- | --- | --- |
-| upsertResults | TYPE.UserDocumentMap
| metadata mapped by their keyField |
-
-
-
-### User.\_getRoleObjectForDeploy(roleId, roleName, userId, assignmentOnly, [isRoleRemovale]) ⇒ object
-helper for [User._prepareRoleAssignments](User._prepareRoleAssignments)
+| metadataEntry | object
| metadata entry |
+| [include] | boolean
| true: use definition.include / options.include; false=exclude: use definition.filter / options.exclude |
-**Kind**: static method of [User
](#User)
-**Returns**: object
- format needed by API
+
-| Param | Type | Default | Description |
-| --- | --- | --- | --- |
-| roleId | string
| | role.ObjectID |
-| roleName | string
| | role.Name |
-| userId | number
| | user.AccountUserID |
-| assignmentOnly | boolean
| | if true, only assignment configuration will be returned |
-| [isRoleRemovale] | boolean
| false
| if true, role will be removed from user; otherwise added |
+### MetadataType.saveResults(results, retrieveDir, [overrideType], [templateVariables]) ⇒ Promise.<TYPE.MetadataTypeMap>
+Helper for writing Metadata to disk, used for Retrieve and deploy
-
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMap>
- Promise of saved metadata
-### User.retrieveChangelog() ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+| Param | Type | Description |
+| --- | --- | --- |
+| results | TYPE.MetadataTypeMap
| metadata results from deploy |
+| retrieveDir | string
| directory where metadata should be stored after deploy/retrieve |
+| [overrideType] | string
| for use when there is a subtype (such as folder-queries) |
+| [templateVariables] | TYPE.TemplateMap
| variables to be replaced in the metadata |
-**Kind**: static method of [User
](#User)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
-
+
-### User.retrieveSOAP(retrieveDir, [requestParams], [singleRetrieve], [additionalFields]) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves SOAP via generic fuel-soap wrapper based metadata of metadata type into local filesystem. executes callback with retrieved metadata
+### MetadataType.applyTemplateValues(code, templateVariables) ⇒ string
+helper for [buildDefinitionForNested](#MetadataType.buildDefinitionForNested)
+searches extracted file for template variable names and applies the market values
-**Kind**: static method of [User
](#User)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of item map
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: string
- code with markets applied
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [requestParams] | TYPE.SoapRequestParams
| required for the specific request (filter for example) |
-| [singleRetrieve] | string
\| number
| key of single item to filter by |
-| [additionalFields] | Array.<string>
| Returns specified fields even if their retrieve definition is not set to true |
+| code | string
| code from extracted code |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### User.document([metadata]) ⇒ Promise.<void>
-Creates markdown documentation of all roles
+### MetadataType.applyTemplateNames(code, templateVariables) ⇒ string
+helper for [buildTemplateForNested](#MetadataType.buildTemplateForNested)
+searches extracted file for template variable values and applies the market variable names
-**Kind**: static method of [User
](#User)
-**Returns**: Promise.<void>
- -
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: string
- code with markets applied
| Param | Type | Description |
| --- | --- | --- |
-| [metadata] | TYPE.MetadataTypeMap
| user list |
+| code | string
| code from extracted code |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-
+
-### User.postRetrieveTasks(metadata) ⇒ TYPE.MetadataTypeItem
\| void
-manages post retrieve steps
+### MetadataType.buildDefinitionForNested(templateDir, targetDir, metadata, variables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildDefinition](#MetadataType.buildDefinition)
+handles extracted code if any are found for complex types (e.g script, asset, query)
-**Kind**: static method of [User
](#User)
-**Returns**: TYPE.MetadataTypeItem
\| void
- a single item
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.MetadataTypeItem
| a single item |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
| Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| variables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
-
+
-## Verification ⇐ [MetadataType
](#MetadataType)
-Verification MetadataType
+### MetadataType.buildTemplateForNested(templateDir, targetDir, metadata, templateVariables, templateName) ⇒ Promise.<Array.<Array.<string>>>
+helper for [buildTemplate](#MetadataType.buildTemplate)
+handles extracted code if any are found for complex types
-**Kind**: global class
-**Extends**: [MetadataType
](#MetadataType)
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<Array.<Array.<string>>>
- list of extracted files with path-parts provided as an array
-* [Verification](#Verification) ⇐ [MetadataType
](#MetadataType)
- * [.retrieve(retrieveDir, [_], [__], key)](#Verification.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.handleRESTErrors(ex, id)](#Verification.handleRESTErrors) ⇒ null
- * [.retrieveForCache()](#Verification.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj>
- * [.create(metadata)](#Verification.create) ⇒ Promise
- * [.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields)](#Verification.postCreateTasks) ⇒ void
- * [.update(metadata)](#Verification.update) ⇒ Promise
- * [.preDeployTasks(metadata)](#Verification.preDeployTasks) ⇒ TYPE.VerificationItem
- * [.postRetrieveTasks(metadata)](#Verification.postRetrieveTasks) ⇒ TYPE.VerificationItem
- * [.deleteByKey(key)](#Verification.deleteByKey) ⇒ Promise.<boolean>
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| metadata | TYPE.MetadataTypeItem
| main JSON file that was read from file system |
+| templateVariables | TYPE.TemplateMap
| variables to be replaced in the metadata |
+| templateName | string
| name of the template to be built |
-
+
-### Verification.retrieve(retrieveDir, [_], [__], key) ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of Data Verification Activity.
+### MetadataType.findSubType(templateDir, templateName) ⇒ Promise.<string>
+check template directory for complex types that open subfolders for their subtypes
-**Kind**: static method of [Verification
](#Verification)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<string>
- subtype name
| Param | Type | Description |
| --- | --- | --- |
-| retrieveDir | string
| Directory where retrieved metadata directory will be saved |
-| [_] | void
| unused parameter |
-| [__] | void
| unused parameter |
-| key | string
| customer key of single item to retrieve |
+| templateDir | string
| Directory where metadata templates are stored |
+| templateName | string
| name of the metadata file |
-
+
-### Verification.handleRESTErrors(ex, id) ⇒ null
-helper for [this.retrieveRESTcollection](this.retrieveRESTcollection)
+### MetadataType.readSecondaryFolder(templateDir, typeDirArr, templateName, fileName, ex) ⇒ object
+optional method used for some types to try a different folder structure
-**Kind**: static method of [Verification
](#Verification)
-**Returns**: null
- -
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: object
- metadata
| Param | Type | Description |
| --- | --- | --- |
-| ex | Error
| exception |
-| id | string
| id or key of item |
+| templateDir | string
| Directory where metadata templates are stored |
+| typeDirArr | Array.<string>
| current subdir for this type |
+| templateName | string
| name of the metadata template |
+| fileName | string
| name of the metadata template file w/o extension |
+| ex | Error
| error from first attempt |
-
+
-### Verification.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj>
-Retrieves Metadata of Data Extract Activity for caching
+### MetadataType.buildDefinition(templateDir, targetDir, templateName, variables) ⇒ Promise.<TYPE.MetadataTypeMapObj>
+Builds definition based on template
+NOTE: Most metadata files should use this generic method, unless custom
+parsing is required (for example scripts & queries)
-**Kind**: static method of [Verification
](#Verification)
-**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of metadata
-
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<TYPE.MetadataTypeMapObj>
- Promise of item map
-### Verification.create(metadata) ⇒ Promise
-Creates a single Data Extract
+| Param | Type | Description |
+| --- | --- | --- |
+| templateDir | string
| Directory where metadata templates are stored |
+| targetDir | string
\| Array.<string>
| (List of) Directory where built definitions will be saved |
+| templateName | string
| name of the metadata file |
+| variables | TYPE.TemplateMap
| variables to be replaced in the metadata |
-**Kind**: static method of [Verification
](#Verification)
-**Returns**: Promise
- Promise
+
+
+### MetadataType.getErrorsREST(ex) ⇒ Array.<string>
\| void
+Standardizes a check for multiple messages
+
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Array.<string>
\| void
- formatted Error Message
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.VerificationItem
| a single Data Extract |
+| ex | object
| response payload from REST API |
-
+
-### Verification.postCreateTasks(metadataEntry, apiResponse, metadataEntryWithAllFields) ⇒ void
-helper for [createREST](#MetadataType.createREST)
+### MetadataType.document([metadata], [isDeploy]) ⇒ void
+Gets metadata cache with limited fields and does not store value to disk
-**Kind**: static method of [Verification
](#Verification)
+**Kind**: static method of [MetadataType
](#MetadataType)
| Param | Type | Description |
| --- | --- | --- |
-| metadataEntry | TYPE.MetadataTypeItem
| a single metadata Entry |
-| apiResponse | object
| varies depending on the API call |
-| metadataEntryWithAllFields | TYPE.MetadataTypeItem
| like metadataEntry but before non-creatable fields were stripped |
+| [metadata] | TYPE.MetadataTypeMap
| a list of type definitions |
+| [isDeploy] | boolean
| used to skip non-supported message during deploy |
-
+
-### Verification.update(metadata) ⇒ Promise
-Updates a single Data Extract
+### MetadataType.resolveId(id) ⇒ Promise.<string>
+get name & key for provided id
-**Kind**: static method of [Verification
](#Verification)
-**Returns**: Promise
- Promise
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<string>
- key of metadata
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.VerificationItem
| a single Data Extract |
+| id | string
| Identifier of metadata |
-
+
-### Verification.preDeployTasks(metadata) ⇒ TYPE.VerificationItem
-prepares a verification for deployment
+### MetadataType.deleteByKey(customerKey) ⇒ boolean
+Delete a metadata item from the specified business unit
-**Kind**: static method of [Verification
](#Verification)
-**Returns**: TYPE.VerificationItem
- metadata object
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: boolean
- deletion success status
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.VerificationItem
| a single verification activity definition |
+| customerKey | string
| Identifier of data extension |
-
+
-### Verification.postRetrieveTasks(metadata) ⇒ TYPE.VerificationItem
-parses retrieved Metadata before saving
+### MetadataType.postDeleteTasks(customerKey, [additionalExtensions]) ⇒ Promise.<void>
+clean up after deleting a metadata item
-**Kind**: static method of [Verification
](#Verification)
-**Returns**: TYPE.VerificationItem
- Array with one metadata object and one sql string
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<void>
- - Promise
| Param | Type | Description |
| --- | --- | --- |
-| metadata | TYPE.VerificationItem
| a single verification activity definition |
+| customerKey | string
| Identifier of metadata item |
+| [additionalExtensions] | Array.<string>
| additional file extensions to delete on top of `${this.definition.type}-meta.json` |
-
+
-### Verification.deleteByKey(key) ⇒ Promise.<boolean>
-Delete a metadata item from the specified business unit
+### MetadataType.deleteByKeySOAP(customerKey, [overrideKeyField], [handleOutside]) ⇒ Promise.<boolean>
+Delete a data extension from the specified business unit
-**Kind**: static method of [Verification
](#Verification)
-**Returns**: Promise.<boolean>
- deletion success status
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<boolean>
- deletion success flag
| Param | Type | Description |
| --- | --- | --- |
-| key | string
| Identifier of item |
+| customerKey | string
| Identifier of metadata |
+| [overrideKeyField] | string
| optionally change the name of the key field if the api uses a different name |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
-
+
-## Retriever
-Retrieves metadata from a business unit and saves it to the local filesystem.
+### MetadataType.deleteByKeyREST(url, key, [handleOutside]) ⇒ Promise.<boolean>
+Delete a data extension from the specified business unit
-**Kind**: global class
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<boolean>
- deletion success flag
-* [Retriever](#Retriever)
- * [new Retriever(properties, buObject)](#new_Retriever_new)
- * [.retrieve(metadataTypes, [namesOrKeys], [templateVariables], [changelogOnly])](#Retriever+retrieve) ⇒ Promise.<TYPE.MultiMetadataTypeList>
- * [._getTypeDependencies(metadataTypes)](#Retriever+_getTypeDependencies) ⇒ Array.<TYPE.SupportedMetadataTypes>
+| Param | Type | Description |
+| --- | --- | --- |
+| url | string
| endpoint |
+| key | string
| Identifier of metadata |
+| [handleOutside] | boolean
| if the API reponse is irregular this allows you to handle it outside of this generic method |
-
+
-### new Retriever(properties, buObject)
-Creates a Retriever, uses v2 auth if v2AuthOptions are passed.
+### MetadataType.readBUMetadataForType(readDir, [listBadKeys], [buMetadata]) ⇒ object
+Returns metadata of a business unit that is saved locally
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: object
- Metadata of BU in local directory
| Param | Type | Description |
| --- | --- | --- |
-| properties | TYPE.Mcdevrc
| General configuration to be used in retrieve |
-| buObject | TYPE.BuObject
| properties for auth |
+| readDir | string
| root directory of metadata. |
+| [listBadKeys] | boolean
| do not print errors, used for badKeys() |
+| [buMetadata] | object
| Metadata of BU in local directory |
-
+
-### retriever.retrieve(metadataTypes, [namesOrKeys], [templateVariables], [changelogOnly]) ⇒ Promise.<TYPE.MultiMetadataTypeList>
-Retrieve metadata of specified types into local file system and Retriever.metadata
+### MetadataType.getFilesToCommit(keyArr) ⇒ Promise.<Array.<string>>
+should return only the json for all but asset, query and script that are saved as multiple files
+additionally, the documentation for dataExtension and automation should be returned
-**Kind**: instance method of [Retriever
](#Retriever)
-**Returns**: Promise.<TYPE.MultiMetadataTypeList>
- Promise of a list of retrieved items grouped by type {automation:[...], query:[...]}
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Promise.<Array.<string>>
- list of all files that need to be committed in a flat array ['path/file1.ext', 'path/file2.ext']
| Param | Type | Description |
| --- | --- | --- |
-| metadataTypes | Array.<TYPE.SupportedMetadataTypes>
| list of metadata types to retrieve; can include subtypes! |
-| [namesOrKeys] | Array.<string>
\| TYPE.TypeKeyCombo
| name of Metadata to retrieveAsTemplate or list of keys for normal retrieval |
-| [templateVariables] | TYPE.TemplateMap
| Object of values which can be replaced (in case of templating) |
-| [changelogOnly] | boolean
| skip saving, only create json in memory |
-
-
+| keyArr | Array.<string>
| customerkey of the metadata |
-### retriever.\_getTypeDependencies(metadataTypes) ⇒ Array.<TYPE.SupportedMetadataTypes>
-helper for [Retriever.retrieve](Retriever.retrieve) to get all dependencies of the given types
+
-**Kind**: instance method of [Retriever
](#Retriever)
-**Returns**: Array.<TYPE.SupportedMetadataTypes>
- unique list dependent metadata types
+### MetadataType.getKeysForFixing(metadataMap) ⇒ Array.<string>
+**Kind**: static method of [MetadataType
](#MetadataType)
+**Returns**: Array.<string>
- list of keys
| Param | Type | Description |
| --- | --- | --- |
-| metadataTypes | Array.<TYPE.SupportedMetadataTypes>
| list of metadata types to retrieve; can include subtypes! |
+| metadataMap | TYPE.MetadataTypeMap
| metadata mapped by their keyField |
@@ -8476,6 +13743,77 @@ Returns an SDK instance to be used for API calls
| sessionKey | string
| key for specific BU |
| authObject | TYPE.AuthObject
| credentials for specific BU |
+
+
+## csvToArray(csv) ⇒ Array.<string>
+helper to convert CSVs into an array. if only one value was given, it's also returned as an array
+
+**Kind**: global function
+**Returns**: Array.<string>
- values split into an array.
+
+| Param | Type | Description |
+| --- | --- | --- |
+| csv | string
| potentially comma-separated value or null |
+
+
+
+## Mcdev.(methodName, businessUnit, [selectedType], [keys]) ⇒ Promise.<Object.<string, Array.<string>>>
+run a method across BUs
+
+**Kind**: global function
+**Returns**: Promise.<Object.<string, Array.<string>>>
- key: business unit name, value: list of affected item keys
+
+| Param | Type | Description |
+| --- | --- | --- |
+| methodName | 'execute'
\| 'pause'
\| 'fixKeys'
| what to run |
+| businessUnit | string
| name of BU |
+| [selectedType] | TYPE.SupportedMetadataTypes
| limit to given metadata types |
+| [keys] | Array.<string>
| customerkey of the metadata |
+
+
+
+## Mcdev.(methodName, cred, bu, [type], keyArr) ⇒ Promise.<Array.<string>>
+helper for [Mcdev.#runMethod](Mcdev.#runMethod)
+
+**Kind**: global function
+**Returns**: Promise.<Array.<string>>
- list of keys that were affected
+
+| Param | Type | Description |
+| --- | --- | --- |
+| methodName | 'execute'
\| 'pause'
\| 'fixKeys'
| what to run |
+| cred | string
| name of Credential |
+| bu | string
| name of BU |
+| [type] | TYPE.SupportedMetadataTypes
| limit execution to given metadata type |
+| keyArr | Array.<string>
| customerkey of the metadata |
+
+
+
+## Mcdev.(selectedType, buObject) ⇒ Array.<string>
+helper for [Mcdev.#runOnBU](Mcdev.#runOnBU)
+
+**Kind**: global function
+**Returns**: Array.<string>
- keyArr
+
+| Param | Type | Description |
+| --- | --- | --- |
+| selectedType | TYPE.SupportedMetadataTypes
| limit execution to given metadata type |
+| buObject | TYPE.BuObject
| properties for auth |
+
+
+
+## Mcdev.(cred, bu, type, [keyArr]) ⇒ Promise.<Array.<string>>
+Updates the key to match the name field
+
+**Kind**: global function
+**Returns**: Promise.<Array.<string>>
- list of keys that were affected
+
+| Param | Type | Description |
+| --- | --- | --- |
+| cred | string
| name of Credential |
+| bu | string
| name of BU |
+| type | TYPE.SupportedMetadataTypes
| limit execution to given metadata type |
+| [keyArr] | Array.<string>
| customerkey of the metadata |
+
## TypeKeyCombo : Object.<string, string>
diff --git a/lib/cli.js b/lib/cli.js
index 1e5229744..c03ce8a65 100644
--- a/lib/cli.js
+++ b/lib/cli.js
@@ -196,7 +196,7 @@ yargs(hideBin(process.argv))
})
.positional('TYPE', {
type: 'string',
- describe: 'metadata type to delete from; currently supported: dataExtension',
+ describe: 'metadata type to delete from;',
})
.positional('EXTERNALKEY', {
type: 'string',
@@ -208,6 +208,36 @@ yargs(hideBin(process.argv))
Mcdev.deleteByKey(argv.BU, argv.TYPE, argv.EXTERNALKEY);
},
})
+ .command({
+ command: 'resolveId