mcdev 5.3.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +1 -1
- package/.github/ISSUE_TEMPLATE/bug.yml +2 -0
- package/.github/workflows/code-test.yml +2 -2
- package/.github/workflows/coverage-base-update.yml +3 -3
- package/.github/workflows/coverage-develop-branch.yml +3 -3
- package/.github/workflows/coverage-main-branch.yml +3 -3
- package/.github/workflows/coverage.yml +4 -4
- package/.github/workflows/npm-publish.yml +4 -4
- package/.prettierrc +7 -0
- package/docs/dist/documentation.md +9 -494
- package/jsconfig.json +5 -1
- package/lib/Builder.js +8 -8
- package/lib/Deployer.js +10 -10
- package/lib/MetadataTypeDefinitions.js +73 -39
- package/lib/MetadataTypeInfo.js +72 -38
- package/lib/Retriever.js +8 -8
- package/lib/cli.js +15 -15
- package/lib/index.js +24 -17
- package/lib/metadataTypes/Asset.js +12 -10
- package/lib/metadataTypes/AttributeGroup.js +7 -6
- package/lib/metadataTypes/AttributeSet.js +8 -7
- package/lib/metadataTypes/Automation.js +16 -16
- package/lib/metadataTypes/Campaign.js +7 -6
- package/lib/metadataTypes/ContentArea.js +7 -6
- package/lib/metadataTypes/DataExtension.js +16 -16
- package/lib/metadataTypes/DataExtensionField.js +6 -5
- package/lib/metadataTypes/DataExtensionTemplate.js +5 -4
- package/lib/metadataTypes/DataExtract.js +8 -7
- package/lib/metadataTypes/DataExtractType.js +5 -4
- package/lib/metadataTypes/Discovery.js +6 -5
- package/lib/metadataTypes/Email.js +6 -5
- package/lib/metadataTypes/EmailSend.js +7 -6
- package/lib/metadataTypes/Event.js +8 -7
- package/lib/metadataTypes/FileLocation.js +5 -4
- package/lib/metadataTypes/FileTransfer.js +8 -7
- package/lib/metadataTypes/Filter.js +5 -4
- package/lib/metadataTypes/Folder.js +9 -8
- package/lib/metadataTypes/ImportFile.js +8 -7
- package/lib/metadataTypes/Journey.js +9 -8
- package/lib/metadataTypes/List.js +9 -8
- package/lib/metadataTypes/MetadataType.js +37 -29
- package/lib/metadataTypes/MobileCode.js +5 -4
- package/lib/metadataTypes/MobileKeyword.js +8 -7
- package/lib/metadataTypes/MobileMessage.js +8 -7
- package/lib/metadataTypes/Query.js +9 -8
- package/lib/metadataTypes/Role.js +8 -7
- package/lib/metadataTypes/Script.js +7 -6
- package/lib/metadataTypes/SendClassification.js +5 -4
- package/lib/metadataTypes/TransactionalEmail.js +8 -7
- package/lib/metadataTypes/TransactionalMessage.js +6 -5
- package/lib/metadataTypes/TransactionalPush.js +7 -6
- package/lib/metadataTypes/TransactionalSMS.js +9 -8
- package/lib/metadataTypes/TriggeredSend.js +15 -12
- package/lib/metadataTypes/User.js +8 -7
- package/lib/metadataTypes/Verification.js +8 -8
- package/lib/metadataTypes/definitions/Asset.definition.js +1 -1
- package/lib/metadataTypes/definitions/AttributeGroup.definition.js +1 -1
- package/lib/metadataTypes/definitions/AttributeSet.definition.js +1 -1
- package/lib/metadataTypes/definitions/Automation.definition.js +1 -1
- package/lib/metadataTypes/definitions/Campaign.definition.js +1 -1
- package/lib/metadataTypes/definitions/ContentArea.definition.js +1 -1
- package/lib/metadataTypes/definitions/DataExtension.definition.js +1 -1
- package/lib/metadataTypes/definitions/DataExtensionField.definition.js +1 -1
- package/lib/metadataTypes/definitions/DataExtensionTemplate.definition.js +1 -1
- package/lib/metadataTypes/definitions/DataExtract.definition.js +1 -1
- package/lib/metadataTypes/definitions/DataExtractType.definition.js +1 -1
- package/lib/metadataTypes/definitions/Discovery.definition.js +1 -1
- package/lib/metadataTypes/definitions/Email.definition.js +1 -1
- package/lib/metadataTypes/definitions/EmailSend.definition.js +1 -1
- package/lib/metadataTypes/definitions/Event.definition.js +1 -1
- package/lib/metadataTypes/definitions/FileLocation.definition.js +1 -1
- package/lib/metadataTypes/definitions/FileTransfer.definition.js +1 -1
- package/lib/metadataTypes/definitions/Filter.definition.js +1 -1
- package/lib/metadataTypes/definitions/Folder.definition.js +1 -1
- package/lib/metadataTypes/definitions/ImportFile.definition.js +1 -1
- package/lib/metadataTypes/definitions/Journey.definition.js +1 -1
- package/lib/metadataTypes/definitions/List.definition.js +1 -1
- package/lib/metadataTypes/definitions/MobileCode.definition.js +1 -1
- package/lib/metadataTypes/definitions/MobileKeyword.definition.js +1 -1
- package/lib/metadataTypes/definitions/MobileMessage.definition.js +1 -1
- package/lib/metadataTypes/definitions/Query.definition.js +1 -1
- package/lib/metadataTypes/definitions/Role.definition.js +1 -1
- package/lib/metadataTypes/definitions/Script.definition.js +1 -1
- package/lib/metadataTypes/definitions/SendClassification.definition.js +1 -1
- package/lib/metadataTypes/definitions/TransactionalEmail.definition.js +1 -1
- package/lib/metadataTypes/definitions/TransactionalPush.definition.js +1 -1
- package/lib/metadataTypes/definitions/TransactionalSMS.definition.js +1 -1
- package/lib/metadataTypes/definitions/TriggeredSend.definition.js +1 -1
- package/lib/metadataTypes/definitions/User.definition.js +1 -1
- package/lib/metadataTypes/definitions/Verification.definition.js +1 -1
- package/lib/retrieveChangelog.js +4 -3
- package/lib/util/auth.js +11 -8
- package/lib/util/businessUnit.js +5 -5
- package/lib/util/cache.js +3 -3
- package/lib/util/cli.js +15 -13
- package/lib/util/config.js +10 -7
- package/lib/util/devops.js +12 -11
- package/lib/util/file.js +15 -14
- package/lib/util/init.config.js +11 -9
- package/lib/util/init.git.js +8 -7
- package/lib/util/init.js +12 -12
- package/lib/util/init.npm.js +11 -9
- package/lib/util/util.js +16 -14
- package/package.json +35 -30
- package/test/general.test.js +4 -6
- package/test/mockRoot/.mcdevrc.json +1 -1
- package/test/resourceFactory.js +55 -27
- package/test/resources/9999999/asset/block-1157-retrieve-expected.html +13 -0
- package/test/resources/9999999/asset/block-1157-retrieve-expected.json +41 -0
- package/test/resources/9999999/asset/v1/content/assets/1209971/get-response.json +61 -0
- package/test/resources/9999999/asset/v1/content/assets/1295064/get-response.json +60 -0
- package/test/resources/9999999/asset/v1/content/assets/808714/get-response.json +184 -0
- package/test/resources/9999999/asset/v1/content/assets/query/post-response.json +40 -2
- package/test/resources/9999999/dataFolder/retrieve-ContentType=asset-sharedORContentType=asset-response.xml +70 -0
- package/test/type.asset.test.js +84 -0
- package/test/type.attributeGroup.test.js +5 -8
- package/test/type.attributeSet.test.js +5 -8
- package/test/type.automation.test.js +5 -10
- package/test/type.dataExtension.test.js +5 -9
- package/test/type.dataExtract.test.js +5 -6
- package/test/type.fileTransfer.test.js +5 -6
- package/test/type.importFile.test.js +5 -6
- package/test/type.journey.test.js +5 -6
- package/test/type.mobileKeyword.test.js +5 -7
- package/test/type.mobileMessage.test.js +5 -7
- package/test/type.query.test.js +5 -8
- package/test/type.script.test.js +5 -8
- package/test/type.transactionalEmail.test.js +5 -6
- package/test/type.transactionalPush.test.js +5 -6
- package/test/type.transactionalSMS.test.js +5 -7
- package/test/type.triggeredSend.test.js +5 -6
- package/test/type.user.test.js +6 -8
- package/test/type.verification.test.js +5 -6
- package/test/utils.js +61 -47
- package/types/mcdev.d.js +2 -2
|
@@ -137,18 +137,6 @@ Provides default functionality that can be overwritten by child metadata type cl
|
|
|
137
137
|
## Constants
|
|
138
138
|
|
|
139
139
|
<dl>
|
|
140
|
-
<dt><a href="#Util">Util</a></dt>
|
|
141
|
-
<dd><p>CLI entry for SFMC DevTools</p>
|
|
142
|
-
</dd>
|
|
143
|
-
<dt><a href="#MetadataTypeDefinitions">MetadataTypeDefinitions</a></dt>
|
|
144
|
-
<dd><p>Provides access to all metadataType classes</p>
|
|
145
|
-
</dd>
|
|
146
|
-
<dt><a href="#MetadataTypeInfo">MetadataTypeInfo</a></dt>
|
|
147
|
-
<dd><p>Provides access to all metadataType classes</p>
|
|
148
|
-
</dd>
|
|
149
|
-
<dt><a href="#mcdev">mcdev</a></dt>
|
|
150
|
-
<dd><p>sample file on how to retrieve a simple changelog to use in GUIs or automated processing of any kind</p>
|
|
151
|
-
</dd>
|
|
152
140
|
<dt><a href="#BusinessUnit">BusinessUnit</a></dt>
|
|
153
141
|
<dd><p>Helper that handles retrieval of BU info</p>
|
|
154
142
|
</dd>
|
|
@@ -530,6 +518,7 @@ main class
|
|
|
530
518
|
**Kind**: global class
|
|
531
519
|
|
|
532
520
|
* [Mcdev](#Mcdev)
|
|
521
|
+
* [.version()](#Mcdev.version) ⇒ <code>string</code>
|
|
533
522
|
* [.setSkipInteraction([skipInteraction])](#Mcdev.setSkipInteraction) ⇒ <code>void</code>
|
|
534
523
|
* [.setLoggingLevel(argv)](#Mcdev.setLoggingLevel) ⇒ <code>void</code>
|
|
535
524
|
* [.setOptions(argv)](#Mcdev.setOptions) ⇒ <code>void</code>
|
|
@@ -556,6 +545,11 @@ main class
|
|
|
556
545
|
* [.pause(businessUnit, [selectedType], [keys])](#Mcdev.pause) ⇒ <code>Promise.<Object.<string, Array.<string>>></code>
|
|
557
546
|
* [.fixKeys(businessUnit, selectedType, [keys])](#Mcdev.fixKeys) ⇒ <code>Promise.<Object.<string, Array.<string>>></code>
|
|
558
547
|
|
|
548
|
+
<a name="Mcdev.version"></a>
|
|
549
|
+
|
|
550
|
+
### Mcdev.version() ⇒ <code>string</code>
|
|
551
|
+
**Kind**: static method of [<code>Mcdev</code>](#Mcdev)
|
|
552
|
+
**Returns**: <code>string</code> - current version of mcdev
|
|
559
553
|
<a name="Mcdev.setSkipInteraction"></a>
|
|
560
554
|
|
|
561
555
|
### Mcdev.setSkipInteraction([skipInteraction]) ⇒ <code>void</code>
|
|
@@ -6293,485 +6287,6 @@ helper for [Retriever.retrieve](Retriever.retrieve) to get all dependencies of t
|
|
|
6293
6287
|
| --- | --- | --- |
|
|
6294
6288
|
| metadataTypes | <code>Array.<TYPE.SupportedMetadataTypes></code> | list of metadata types to retrieve; can include subtypes! |
|
|
6295
6289
|
|
|
6296
|
-
<a name="Util"></a>
|
|
6297
|
-
|
|
6298
|
-
## Util
|
|
6299
|
-
CLI entry for SFMC DevTools
|
|
6300
|
-
|
|
6301
|
-
**Kind**: global constant
|
|
6302
|
-
|
|
6303
|
-
* [Util](#Util)
|
|
6304
|
-
* [.skipInteraction](#Util.skipInteraction) : <code>TYPE.skipInteraction</code>
|
|
6305
|
-
* [.logger](#Util.logger) : <code>TYPE.Logger</code>
|
|
6306
|
-
* [.filterObjByKeys(originalObj, [whitelistArr])](#Util.filterObjByKeys) ⇒ <code>Object.<string, \*></code>
|
|
6307
|
-
* [.includesStartsWith(arr, search)](#Util.includesStartsWith) ⇒ <code>boolean</code>
|
|
6308
|
-
* [.includesStartsWithIndex(arr, search)](#Util.includesStartsWithIndex) ⇒ <code>number</code>
|
|
6309
|
-
* [.checkMarket(market, properties)](#Util.checkMarket) ⇒ <code>boolean</code>
|
|
6310
|
-
* [.verifyMarketList(mlName, properties)](#Util.verifyMarketList)
|
|
6311
|
-
* [.signalFatalError()](#Util.signalFatalError) ⇒ <code>void</code>
|
|
6312
|
-
* [.isTrue(attrValue)](#Util.isTrue) ⇒ <code>boolean</code>
|
|
6313
|
-
* [.isFalse(attrValue)](#Util.isFalse) ⇒ <code>boolean</code>
|
|
6314
|
-
* [._isValidType(selectedType, [handleOutside])](#Util._isValidType) ⇒ <code>boolean</code>
|
|
6315
|
-
* [.getTypeAndSubType(selectedType)](#Util.getTypeAndSubType) ⇒ <code>Array.<string></code>
|
|
6316
|
-
* [.getRetrieveTypeChoices()](#Util.getRetrieveTypeChoices) ⇒ <code>Array.<TYPE.SupportedMetadataTypes></code>
|
|
6317
|
-
* [._createNewLoggerTransport([noLogFile])](#Util._createNewLoggerTransport) ⇒ <code>object</code>
|
|
6318
|
-
* [.startLogger([restart], [noLogFile])](#Util.startLogger) ⇒ <code>void</code>
|
|
6319
|
-
* [.metadataLogger(level, type, method, payload, [source])](#Util.metadataLogger) ⇒ <code>void</code>
|
|
6320
|
-
* [.replaceByObject(str, obj)](#Util.replaceByObject) ⇒ <code>string</code> \| <code>object</code>
|
|
6321
|
-
* [.inverseGet(objs, val)](#Util.inverseGet) ⇒ <code>string</code>
|
|
6322
|
-
* [.getDependentMetadata(fixedType)](#Util.getDependentMetadata) ⇒ <code>Array.<string></code>
|
|
6323
|
-
* [.getMetadataHierachy(metadataTypes)](#Util.getMetadataHierachy) ⇒ <code>Object.<string, Array.<string>></code>
|
|
6324
|
-
* [.resolveObjPath(path, obj)](#Util.resolveObjPath) ⇒ <code>any</code>
|
|
6325
|
-
* [.execSync(cmd, [args], [hideOutput])](#Util.execSync) ⇒ <code>string</code> \| <code>void</code>
|
|
6326
|
-
* [.templateSearchResult(results, keyToSearch, searchValue)](#Util.templateSearchResult) ⇒ <code>TYPE.MetadataTypeItem</code>
|
|
6327
|
-
* [.setLoggingLevel(argv)](#Util.setLoggingLevel) ⇒ <code>void</code>
|
|
6328
|
-
* [.logBeta(type)](#Util.logBeta)
|
|
6329
|
-
* [.getGrayMsg(msg)](#Util.getGrayMsg) ⇒ <code>string</code>
|
|
6330
|
-
* [.logSubtypes(subTypeArr)](#Util.logSubtypes) ⇒ <code>void</code>
|
|
6331
|
-
* [.getKeysString(keyArr, [isId])](#Util.getKeysString) ⇒ <code>string</code>
|
|
6332
|
-
* [.sleep(ms)](#Util.sleep) ⇒ <code>Promise.<void></code>
|
|
6333
|
-
* [.getSsjs(code)](#Util.getSsjs) ⇒ <code>string</code>
|
|
6334
|
-
* [.stringLike(testString, search)](#Util.stringLike) ⇒ <code>boolean</code>
|
|
6335
|
-
* [.fieldsLike(metadata, [filters])](#Util.fieldsLike) ⇒ <code>boolean</code>
|
|
6336
|
-
* [.capitalizeFirstLetter(str)](#Util.capitalizeFirstLetter) ⇒ <code>string</code>
|
|
6337
|
-
|
|
6338
|
-
<a name="Util.skipInteraction"></a>
|
|
6339
|
-
|
|
6340
|
-
### Util.skipInteraction : <code>TYPE.skipInteraction</code>
|
|
6341
|
-
**Kind**: static property of [<code>Util</code>](#Util)
|
|
6342
|
-
<a name="Util.logger"></a>
|
|
6343
|
-
|
|
6344
|
-
### Util.logger : <code>TYPE.Logger</code>
|
|
6345
|
-
Logger that creates timestamped log file in 'logs/' directory
|
|
6346
|
-
|
|
6347
|
-
**Kind**: static property of [<code>Util</code>](#Util)
|
|
6348
|
-
<a name="Util.filterObjByKeys"></a>
|
|
6349
|
-
|
|
6350
|
-
### Util.filterObjByKeys(originalObj, [whitelistArr]) ⇒ <code>Object.<string, \*></code>
|
|
6351
|
-
helper that allows filtering an object by its keys
|
|
6352
|
-
|
|
6353
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6354
|
-
**Returns**: <code>Object.<string, \*></code> - filtered object that only contains keys you provided
|
|
6355
|
-
|
|
6356
|
-
| Param | Type | Description |
|
|
6357
|
-
| --- | --- | --- |
|
|
6358
|
-
| originalObj | <code>Object.<string, \*></code> | object that you want to filter |
|
|
6359
|
-
| [whitelistArr] | <code>Array.<string></code> | positive filter. if not provided, returns originalObj without filter |
|
|
6360
|
-
|
|
6361
|
-
<a name="Util.includesStartsWith"></a>
|
|
6362
|
-
|
|
6363
|
-
### Util.includesStartsWith(arr, search) ⇒ <code>boolean</code>
|
|
6364
|
-
extended Array.includes method that allows check if an array-element starts with a certain string
|
|
6365
|
-
|
|
6366
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6367
|
-
**Returns**: <code>boolean</code> - found / not found
|
|
6368
|
-
|
|
6369
|
-
| Param | Type | Description |
|
|
6370
|
-
| --- | --- | --- |
|
|
6371
|
-
| arr | <code>Array.<string></code> | your array of strigns |
|
|
6372
|
-
| search | <code>string</code> | the string you are looking for |
|
|
6373
|
-
|
|
6374
|
-
<a name="Util.includesStartsWithIndex"></a>
|
|
6375
|
-
|
|
6376
|
-
### Util.includesStartsWithIndex(arr, search) ⇒ <code>number</code>
|
|
6377
|
-
extended Array.includes method that allows check if an array-element starts with a certain string
|
|
6378
|
-
|
|
6379
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6380
|
-
**Returns**: <code>number</code> - array index 0..n or -1 of not found
|
|
6381
|
-
|
|
6382
|
-
| Param | Type | Description |
|
|
6383
|
-
| --- | --- | --- |
|
|
6384
|
-
| arr | <code>Array.<string></code> | your array of strigns |
|
|
6385
|
-
| search | <code>string</code> | the string you are looking for |
|
|
6386
|
-
|
|
6387
|
-
<a name="Util.checkMarket"></a>
|
|
6388
|
-
|
|
6389
|
-
### Util.checkMarket(market, properties) ⇒ <code>boolean</code>
|
|
6390
|
-
check if a market name exists in current mcdev config
|
|
6391
|
-
|
|
6392
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6393
|
-
**Returns**: <code>boolean</code> - found market or not
|
|
6394
|
-
|
|
6395
|
-
| Param | Type | Description |
|
|
6396
|
-
| --- | --- | --- |
|
|
6397
|
-
| market | <code>string</code> | market localizations |
|
|
6398
|
-
| properties | <code>TYPE.Mcdevrc</code> | local mcdev config |
|
|
6399
|
-
|
|
6400
|
-
<a name="Util.verifyMarketList"></a>
|
|
6401
|
-
|
|
6402
|
-
### Util.verifyMarketList(mlName, properties)
|
|
6403
|
-
ensure provided MarketList exists and it's content including markets and BUs checks out
|
|
6404
|
-
|
|
6405
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6406
|
-
|
|
6407
|
-
| Param | Type | Description |
|
|
6408
|
-
| --- | --- | --- |
|
|
6409
|
-
| mlName | <code>string</code> | name of marketList |
|
|
6410
|
-
| properties | <code>TYPE.Mcdevrc</code> | General configuration to be used in retrieve |
|
|
6411
|
-
|
|
6412
|
-
<a name="Util.signalFatalError"></a>
|
|
6413
|
-
|
|
6414
|
-
### Util.signalFatalError() ⇒ <code>void</code>
|
|
6415
|
-
used to ensure the program tells surrounding software that an unrecoverable error occured
|
|
6416
|
-
|
|
6417
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6418
|
-
<a name="Util.isTrue"></a>
|
|
6419
|
-
|
|
6420
|
-
### Util.isTrue(attrValue) ⇒ <code>boolean</code>
|
|
6421
|
-
SFMC accepts multiple true values for Boolean attributes for which we are checking here.
|
|
6422
|
-
The same problem occurs when evaluating boolean CLI flags
|
|
6423
|
-
|
|
6424
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6425
|
-
**Returns**: <code>boolean</code> - attribute value == true ? true : false
|
|
6426
|
-
|
|
6427
|
-
| Param | Type | Description |
|
|
6428
|
-
| --- | --- | --- |
|
|
6429
|
-
| attrValue | <code>\*</code> | value |
|
|
6430
|
-
|
|
6431
|
-
<a name="Util.isFalse"></a>
|
|
6432
|
-
|
|
6433
|
-
### Util.isFalse(attrValue) ⇒ <code>boolean</code>
|
|
6434
|
-
SFMC accepts multiple false values for Boolean attributes for which we are checking here.
|
|
6435
|
-
The same problem occurs when evaluating boolean CLI flags
|
|
6436
|
-
|
|
6437
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6438
|
-
**Returns**: <code>boolean</code> - attribute value == false ? true : false
|
|
6439
|
-
|
|
6440
|
-
| Param | Type | Description |
|
|
6441
|
-
| --- | --- | --- |
|
|
6442
|
-
| attrValue | <code>\*</code> | value |
|
|
6443
|
-
|
|
6444
|
-
<a name="Util._isValidType"></a>
|
|
6445
|
-
|
|
6446
|
-
### Util.\_isValidType(selectedType, [handleOutside]) ⇒ <code>boolean</code>
|
|
6447
|
-
helper for Mcdev.retrieve, Mcdev.retrieveAsTemplate and Mcdev.deploy
|
|
6448
|
-
|
|
6449
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6450
|
-
**Returns**: <code>boolean</code> - type ok or not
|
|
6451
|
-
|
|
6452
|
-
| Param | Type | Description |
|
|
6453
|
-
| --- | --- | --- |
|
|
6454
|
-
| selectedType | <code>TYPE.SupportedMetadataTypes</code> | type or type-subtype |
|
|
6455
|
-
| [handleOutside] | <code>boolean</code> | if the API reponse is irregular this allows you to handle it outside of this generic method |
|
|
6456
|
-
|
|
6457
|
-
<a name="Util.getTypeAndSubType"></a>
|
|
6458
|
-
|
|
6459
|
-
### Util.getTypeAndSubType(selectedType) ⇒ <code>Array.<string></code>
|
|
6460
|
-
helper that deals with extracting type and subtype
|
|
6461
|
-
|
|
6462
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6463
|
-
**Returns**: <code>Array.<string></code> - first elem is type, second elem is subType
|
|
6464
|
-
|
|
6465
|
-
| Param | Type | Description |
|
|
6466
|
-
| --- | --- | --- |
|
|
6467
|
-
| selectedType | <code>string</code> | "type" or "type-subtype" |
|
|
6468
|
-
|
|
6469
|
-
<a name="Util.getRetrieveTypeChoices"></a>
|
|
6470
|
-
|
|
6471
|
-
### Util.getRetrieveTypeChoices() ⇒ <code>Array.<TYPE.SupportedMetadataTypes></code>
|
|
6472
|
-
helper for getDefaultProperties()
|
|
6473
|
-
|
|
6474
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6475
|
-
**Returns**: <code>Array.<TYPE.SupportedMetadataTypes></code> - type choices
|
|
6476
|
-
<a name="Util._createNewLoggerTransport"></a>
|
|
6477
|
-
|
|
6478
|
-
### Util.\_createNewLoggerTransport([noLogFile]) ⇒ <code>object</code>
|
|
6479
|
-
wrapper around our standard winston logging to console and logfile
|
|
6480
|
-
|
|
6481
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6482
|
-
**Returns**: <code>object</code> - initiated logger for console and file
|
|
6483
|
-
|
|
6484
|
-
| Param | Type | Description |
|
|
6485
|
-
| --- | --- | --- |
|
|
6486
|
-
| [noLogFile] | <code>boolean</code> | optional flag to indicate if we should log to file; CLI logs are always on |
|
|
6487
|
-
|
|
6488
|
-
<a name="Util.startLogger"></a>
|
|
6489
|
-
|
|
6490
|
-
### Util.startLogger([restart], [noLogFile]) ⇒ <code>void</code>
|
|
6491
|
-
initiate winston logger
|
|
6492
|
-
|
|
6493
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6494
|
-
|
|
6495
|
-
| Param | Type | Description |
|
|
6496
|
-
| --- | --- | --- |
|
|
6497
|
-
| [restart] | <code>boolean</code> | if true, logger will be restarted; otherwise, an existing logger will be used |
|
|
6498
|
-
| [noLogFile] | <code>boolean</code> | if false, logger will log to file; otherwise, only to console |
|
|
6499
|
-
|
|
6500
|
-
<a name="Util.metadataLogger"></a>
|
|
6501
|
-
|
|
6502
|
-
### Util.metadataLogger(level, type, method, payload, [source]) ⇒ <code>void</code>
|
|
6503
|
-
Logger helper for Metadata functions
|
|
6504
|
-
|
|
6505
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6506
|
-
|
|
6507
|
-
| Param | Type | Description |
|
|
6508
|
-
| --- | --- | --- |
|
|
6509
|
-
| level | <code>string</code> | of log (error, info, warn) |
|
|
6510
|
-
| type | <code>string</code> | of metadata being referenced |
|
|
6511
|
-
| method | <code>string</code> | name which log was called from |
|
|
6512
|
-
| payload | <code>\*</code> | generic object which details the error |
|
|
6513
|
-
| [source] | <code>string</code> | key/id of metadata which relates to error |
|
|
6514
|
-
|
|
6515
|
-
<a name="Util.replaceByObject"></a>
|
|
6516
|
-
|
|
6517
|
-
### Util.replaceByObject(str, obj) ⇒ <code>string</code> \| <code>object</code>
|
|
6518
|
-
replaces values in a JSON object string, based on a series of
|
|
6519
|
-
key-value pairs (obj)
|
|
6520
|
-
|
|
6521
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6522
|
-
**Returns**: <code>string</code> \| <code>object</code> - replaced version of str
|
|
6523
|
-
|
|
6524
|
-
| Param | Type | Description |
|
|
6525
|
-
| --- | --- | --- |
|
|
6526
|
-
| str | <code>string</code> \| <code>object</code> | JSON object or its stringified version, which has values to be replaced |
|
|
6527
|
-
| obj | <code>TYPE.TemplateMap</code> | key value object which contains keys to be replaced and values to be replaced with |
|
|
6528
|
-
|
|
6529
|
-
<a name="Util.inverseGet"></a>
|
|
6530
|
-
|
|
6531
|
-
### Util.inverseGet(objs, val) ⇒ <code>string</code>
|
|
6532
|
-
get key of an object based on the first matching value
|
|
6533
|
-
|
|
6534
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6535
|
-
**Returns**: <code>string</code> - key
|
|
6536
|
-
|
|
6537
|
-
| Param | Type | Description |
|
|
6538
|
-
| --- | --- | --- |
|
|
6539
|
-
| objs | <code>object</code> | object of objects to be searched |
|
|
6540
|
-
| val | <code>string</code> | value to be searched for |
|
|
6541
|
-
|
|
6542
|
-
<a name="Util.getDependentMetadata"></a>
|
|
6543
|
-
|
|
6544
|
-
### Util.getDependentMetadata(fixedType) ⇒ <code>Array.<string></code>
|
|
6545
|
-
helper for Mcdev.fixKeys. Retrieve dependent metadata
|
|
6546
|
-
|
|
6547
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6548
|
-
**Returns**: <code>Array.<string></code> - array of types that depend on the given type
|
|
6549
|
-
|
|
6550
|
-
| Param | Type | Description |
|
|
6551
|
-
| --- | --- | --- |
|
|
6552
|
-
| fixedType | <code>string</code> | type of the metadata passed as a parameter to fixKeys function |
|
|
6553
|
-
|
|
6554
|
-
<a name="Util.getMetadataHierachy"></a>
|
|
6555
|
-
|
|
6556
|
-
### Util.getMetadataHierachy(metadataTypes) ⇒ <code>Object.<string, Array.<string>></code>
|
|
6557
|
-
Returns Order in which metadata needs to be retrieved/deployed
|
|
6558
|
-
|
|
6559
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6560
|
-
**Returns**: <code>Object.<string, Array.<string>></code> - retrieve/deploy order as array
|
|
6561
|
-
|
|
6562
|
-
| Param | Type | Description |
|
|
6563
|
-
| --- | --- | --- |
|
|
6564
|
-
| metadataTypes | <code>Array.<string></code> | which should be retrieved/deployed |
|
|
6565
|
-
|
|
6566
|
-
<a name="Util.resolveObjPath"></a>
|
|
6567
|
-
|
|
6568
|
-
### Util.resolveObjPath(path, obj) ⇒ <code>any</code>
|
|
6569
|
-
let's you dynamically walk down an object and get a value
|
|
6570
|
-
|
|
6571
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6572
|
-
**Returns**: <code>any</code> - value of obj.path
|
|
6573
|
-
|
|
6574
|
-
| Param | Type | Description |
|
|
6575
|
-
| --- | --- | --- |
|
|
6576
|
-
| path | <code>string</code> | 'fieldA.fieldB.fieldC' |
|
|
6577
|
-
| obj | <code>object</code> | some parent object |
|
|
6578
|
-
|
|
6579
|
-
<a name="Util.execSync"></a>
|
|
6580
|
-
|
|
6581
|
-
### Util.execSync(cmd, [args], [hideOutput]) ⇒ <code>string</code> \| <code>void</code>
|
|
6582
|
-
helper to run other commands as if run manually by user
|
|
6583
|
-
|
|
6584
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6585
|
-
**Returns**: <code>string</code> \| <code>void</code> - output of command if hideOutput is true
|
|
6586
|
-
|
|
6587
|
-
| Param | Type | Description |
|
|
6588
|
-
| --- | --- | --- |
|
|
6589
|
-
| cmd | <code>string</code> | to be executed command |
|
|
6590
|
-
| [args] | <code>Array.<string></code> | list of arguments |
|
|
6591
|
-
| [hideOutput] | <code>boolean</code> | if true, output of command will be hidden from CLI |
|
|
6592
|
-
|
|
6593
|
-
<a name="Util.templateSearchResult"></a>
|
|
6594
|
-
|
|
6595
|
-
### Util.templateSearchResult(results, keyToSearch, searchValue) ⇒ <code>TYPE.MetadataTypeItem</code>
|
|
6596
|
-
standardize check to ensure only one result is returned from template search
|
|
6597
|
-
|
|
6598
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6599
|
-
**Returns**: <code>TYPE.MetadataTypeItem</code> - metadata to be used in building template
|
|
6600
|
-
|
|
6601
|
-
| Param | Type | Description |
|
|
6602
|
-
| --- | --- | --- |
|
|
6603
|
-
| results | <code>Array.<TYPE.MetadataTypeItem></code> | array of metadata |
|
|
6604
|
-
| keyToSearch | <code>string</code> | the field which contains the searched value |
|
|
6605
|
-
| searchValue | <code>string</code> | the value which is being looked for |
|
|
6606
|
-
|
|
6607
|
-
<a name="Util.setLoggingLevel"></a>
|
|
6608
|
-
|
|
6609
|
-
### Util.setLoggingLevel(argv) ⇒ <code>void</code>
|
|
6610
|
-
configures what is displayed in the console
|
|
6611
|
-
|
|
6612
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6613
|
-
|
|
6614
|
-
| Param | Type | Description |
|
|
6615
|
-
| --- | --- | --- |
|
|
6616
|
-
| argv | <code>object</code> | list of command line parameters given by user |
|
|
6617
|
-
| [argv.silent] | <code>boolean</code> | only errors printed to CLI |
|
|
6618
|
-
| [argv.verbose] | <code>boolean</code> | chatty user CLI output |
|
|
6619
|
-
| [argv.debug] | <code>boolean</code> | enables developer output & features |
|
|
6620
|
-
|
|
6621
|
-
<a name="Util.logBeta"></a>
|
|
6622
|
-
|
|
6623
|
-
### Util.logBeta(type)
|
|
6624
|
-
outputs a warning that the given type is still in beta
|
|
6625
|
-
|
|
6626
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6627
|
-
|
|
6628
|
-
| Param | Type | Description |
|
|
6629
|
-
| --- | --- | --- |
|
|
6630
|
-
| type | <code>string</code> | api name of the type thats in beta |
|
|
6631
|
-
|
|
6632
|
-
<a name="Util.getGrayMsg"></a>
|
|
6633
|
-
|
|
6634
|
-
### Util.getGrayMsg(msg) ⇒ <code>string</code>
|
|
6635
|
-
helper that wraps a message in the correct color codes to have them printed gray
|
|
6636
|
-
|
|
6637
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6638
|
-
**Returns**: <code>string</code> - gray msg
|
|
6639
|
-
|
|
6640
|
-
| Param | Type | Description |
|
|
6641
|
-
| --- | --- | --- |
|
|
6642
|
-
| msg | <code>string</code> | log message that should be wrapped with color codes |
|
|
6643
|
-
|
|
6644
|
-
<a name="Util.logSubtypes"></a>
|
|
6645
|
-
|
|
6646
|
-
### Util.logSubtypes(subTypeArr) ⇒ <code>void</code>
|
|
6647
|
-
helper to print the subtypes we filtered by
|
|
6648
|
-
|
|
6649
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6650
|
-
|
|
6651
|
-
| Param | Type | Description |
|
|
6652
|
-
| --- | --- | --- |
|
|
6653
|
-
| subTypeArr | <code>Array.<string></code> | list of subtypes to be printed |
|
|
6654
|
-
|
|
6655
|
-
<a name="Util.getKeysString"></a>
|
|
6656
|
-
|
|
6657
|
-
### Util.getKeysString(keyArr, [isId]) ⇒ <code>string</code>
|
|
6658
|
-
helper to print the subtypes we filtered by
|
|
6659
|
-
|
|
6660
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6661
|
-
**Returns**: <code>string</code> - string to be appended to log message
|
|
6662
|
-
|
|
6663
|
-
| Param | Type | Description |
|
|
6664
|
-
| --- | --- | --- |
|
|
6665
|
-
| keyArr | <code>Array.<string></code> \| <code>string</code> | list of subtypes to be printed |
|
|
6666
|
-
| [isId] | <code>boolean</code> | optional flag to indicate if key is an id |
|
|
6667
|
-
|
|
6668
|
-
<a name="Util.sleep"></a>
|
|
6669
|
-
|
|
6670
|
-
### Util.sleep(ms) ⇒ <code>Promise.<void></code>
|
|
6671
|
-
pause execution of code; useful when multiple server calls are dependent on each other and might not be executed right away
|
|
6672
|
-
|
|
6673
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6674
|
-
**Returns**: <code>Promise.<void></code> - - promise to wait for
|
|
6675
|
-
|
|
6676
|
-
| Param | Type | Description |
|
|
6677
|
-
| --- | --- | --- |
|
|
6678
|
-
| ms | <code>number</code> | time in miliseconds to wait |
|
|
6679
|
-
|
|
6680
|
-
<a name="Util.getSsjs"></a>
|
|
6681
|
-
|
|
6682
|
-
### Util.getSsjs(code) ⇒ <code>string</code>
|
|
6683
|
-
helper for Asset.extractCode and Script.prepExtractedCode to determine if a code block is a valid SSJS block
|
|
6684
|
-
|
|
6685
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6686
|
-
**Returns**: <code>string</code> - the SSJS code if code block is a valid SSJS block, otherwise null
|
|
6687
|
-
|
|
6688
|
-
| Param | Type | Description |
|
|
6689
|
-
| --- | --- | --- |
|
|
6690
|
-
| code | <code>string</code> | code block to check |
|
|
6691
|
-
|
|
6692
|
-
**Example**
|
|
6693
|
-
```js
|
|
6694
|
-
the following is invalid:
|
|
6695
|
-
<script runat="server">
|
|
6696
|
-
// 1
|
|
6697
|
-
</script>
|
|
6698
|
-
<script runat="server">
|
|
6699
|
-
// 2
|
|
6700
|
-
</script>
|
|
6701
|
-
|
|
6702
|
-
the following is valid:
|
|
6703
|
-
<script runat="server">
|
|
6704
|
-
// 3
|
|
6705
|
-
</script>
|
|
6706
|
-
```
|
|
6707
|
-
<a name="Util.stringLike"></a>
|
|
6708
|
-
|
|
6709
|
-
### Util.stringLike(testString, search) ⇒ <code>boolean</code>
|
|
6710
|
-
allows us to filter just like with SQL's LIKE operator
|
|
6711
|
-
|
|
6712
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6713
|
-
**Returns**: <code>boolean</code> - true if testString matches search
|
|
6714
|
-
|
|
6715
|
-
| Param | Type | Description |
|
|
6716
|
-
| --- | --- | --- |
|
|
6717
|
-
| testString | <code>string</code> | field value to test |
|
|
6718
|
-
| search | <code>string</code> | search string in SQL LIKE format |
|
|
6719
|
-
|
|
6720
|
-
<a name="Util.fieldsLike"></a>
|
|
6721
|
-
|
|
6722
|
-
### Util.fieldsLike(metadata, [filters]) ⇒ <code>boolean</code>
|
|
6723
|
-
returns true if no LIKE filter is defined or if all filters match
|
|
6724
|
-
|
|
6725
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6726
|
-
**Returns**: <code>boolean</code> - true if no LIKE filter is defined or if all filters match
|
|
6727
|
-
|
|
6728
|
-
| Param | Type | Description |
|
|
6729
|
-
| --- | --- | --- |
|
|
6730
|
-
| metadata | <code>TYPE.MetadataTypeItem</code> | a single metadata item |
|
|
6731
|
-
| [filters] | <code>object</code> | only used in recursive calls |
|
|
6732
|
-
|
|
6733
|
-
<a name="Util.capitalizeFirstLetter"></a>
|
|
6734
|
-
|
|
6735
|
-
### Util.capitalizeFirstLetter(str) ⇒ <code>string</code>
|
|
6736
|
-
helper used by SOAP methods to ensure the type always uses an upper-cased first letter
|
|
6737
|
-
|
|
6738
|
-
**Kind**: static method of [<code>Util</code>](#Util)
|
|
6739
|
-
**Returns**: <code>string</code> - str with first letter capitalized
|
|
6740
|
-
|
|
6741
|
-
| Param | Type | Description |
|
|
6742
|
-
| --- | --- | --- |
|
|
6743
|
-
| str | <code>string</code> | string to capitalize |
|
|
6744
|
-
|
|
6745
|
-
<a name="MetadataTypeDefinitions"></a>
|
|
6746
|
-
|
|
6747
|
-
## MetadataTypeDefinitions
|
|
6748
|
-
Provides access to all metadataType classes
|
|
6749
|
-
|
|
6750
|
-
**Kind**: global constant
|
|
6751
|
-
<a name="MetadataTypeInfo"></a>
|
|
6752
|
-
|
|
6753
|
-
## MetadataTypeInfo
|
|
6754
|
-
Provides access to all metadataType classes
|
|
6755
|
-
|
|
6756
|
-
**Kind**: global constant
|
|
6757
|
-
<a name="mcdev"></a>
|
|
6758
|
-
|
|
6759
|
-
## mcdev
|
|
6760
|
-
sample file on how to retrieve a simple changelog to use in GUIs or automated processing of any kind
|
|
6761
|
-
|
|
6762
|
-
**Kind**: global constant
|
|
6763
|
-
**Example**
|
|
6764
|
-
```js
|
|
6765
|
-
[{
|
|
6766
|
-
name: 'deName',
|
|
6767
|
-
key: 'deKey',
|
|
6768
|
-
t: 'dataExtension',
|
|
6769
|
-
cd: '2020-05-06T00:16:00.737',
|
|
6770
|
-
cb: 'name of creator',
|
|
6771
|
-
ld: '2020-05-06T00:16:00.737',
|
|
6772
|
-
lb: 'name of lastmodified'
|
|
6773
|
-
}]
|
|
6774
|
-
```
|
|
6775
6290
|
<a name="BusinessUnit"></a>
|
|
6776
6291
|
|
|
6777
6292
|
## BusinessUnit
|
|
@@ -7123,7 +6638,7 @@ File extends fs-extra. It adds logger and util methods for file handling
|
|
|
7123
6638
|
* [.writeJSONToFile(directory, filename, content)](#File.writeJSONToFile) ⇒ <code>Promise</code>
|
|
7124
6639
|
* [.writePrettyToFile(directory, filename, filetype, content, [templateVariables])](#File.writePrettyToFile) ⇒ <code>Promise.<boolean></code>
|
|
7125
6640
|
* [._beautify_beautyAmp(content)](#File._beautify_beautyAmp) ⇒ <code>string</code>
|
|
7126
|
-
* [._beautify_prettier(directory, filename, filetype, content)](#File._beautify_prettier) ⇒ <code>string
|
|
6641
|
+
* [._beautify_prettier(directory, filename, filetype, content)](#File._beautify_prettier) ⇒ <code>Promise.<string></code>
|
|
7127
6642
|
* [.writeToFile(directory, filename, filetype, content, [encoding])](#File.writeToFile) ⇒ <code>Promise.<boolean></code>
|
|
7128
6643
|
* [.readJSONFile(directory, filename, sync, cleanPath)](#File.readJSONFile) ⇒ <code>Promise.<object></code> \| <code>object</code> \| <code>void</code>
|
|
7129
6644
|
* [.readFilteredFilename(directory, filename, filetype, [encoding])](#File.readFilteredFilename) ⇒ <code>Promise.<string></code> \| <code>void</code>
|
|
@@ -7238,12 +6753,12 @@ helper for [writePrettyToFile](#File.writePrettyToFile), applying beautyAmp onto
|
|
|
7238
6753
|
|
|
7239
6754
|
<a name="File._beautify_prettier"></a>
|
|
7240
6755
|
|
|
7241
|
-
### File.\_beautify\_prettier(directory, filename, filetype, content) ⇒ <code>string
|
|
6756
|
+
### File.\_beautify\_prettier(directory, filename, filetype, content) ⇒ <code>Promise.<string></code>
|
|
7242
6757
|
helper for [writePrettyToFile](#File.writePrettyToFile), applying prettier onto given stringified content
|
|
7243
6758
|
! Important: run 'await File.initPrettier()' in your MetadataType.retrieve() once before hitting this
|
|
7244
6759
|
|
|
7245
6760
|
**Kind**: static method of [<code>File</code>](#File)
|
|
7246
|
-
**Returns**: <code>string
|
|
6761
|
+
**Returns**: <code>Promise.<string></code> - original string on error; formatted string on success
|
|
7247
6762
|
|
|
7248
6763
|
| Param | Type | Description |
|
|
7249
6764
|
| --- | --- | --- |
|
package/jsconfig.json
CHANGED
package/lib/Builder.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
import TYPE from '../types/mcdev.d.js';
|
|
4
|
+
import { Util } from './util/util.js';
|
|
5
|
+
import File from './util/file.js';
|
|
6
|
+
import config from './util/config.js';
|
|
7
|
+
import Cli from './util/cli.js';
|
|
8
|
+
import auth from './util/auth.js';
|
|
9
|
+
import MetadataTypeInfo from './MetadataTypeInfo.js';
|
|
10
10
|
// @ts-ignore
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -249,4 +249,4 @@ saved
|
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
|
|
252
|
+
export default Builder;
|
package/lib/Deployer.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import TYPE from '../types/mcdev.d.js';
|
|
4
|
+
import MetadataTypeInfo from './MetadataTypeInfo.js';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import Cli from './util/cli.js';
|
|
7
|
+
import { Util } from './util/util.js';
|
|
8
|
+
import File from './util/file.js';
|
|
9
|
+
import config from './util/config.js';
|
|
10
|
+
import cache from './util/cache.js';
|
|
11
|
+
import auth from './util/auth.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Reads metadata from local directory and deploys it to specified target business unit.
|
|
@@ -455,4 +455,4 @@ class Deployer {
|
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
-
|
|
458
|
+
export default Deployer;
|