From 289455b5b1751fad69135ec281d908bfdc9e243f Mon Sep 17 00:00:00 2001 From: Douglas Midgley Date: Wed, 3 May 2023 23:07:50 +0200 Subject: [PATCH 01/48] es6 Module - migration just script cjs-to-es6 lib/ --- lib/Builder.js | 16 +-- lib/Deployer.js | 20 ++-- lib/MetadataTypeDefinitions.js | 105 ++++++++++++------ lib/MetadataTypeInfo.js | 105 ++++++++++++------ lib/Retriever.js | 16 +-- lib/cli.js | 10 +- lib/index.js | 34 +++--- lib/metadataTypes/Asset.js | 16 +-- lib/metadataTypes/AttributeGroup.js | 6 +- lib/metadataTypes/Automation.js | 14 +-- lib/metadataTypes/Campaign.js | 10 +- lib/metadataTypes/ContentArea.js | 10 +- lib/metadataTypes/DataExtension.js | 20 ++-- lib/metadataTypes/DataExtensionField.js | 8 +- lib/metadataTypes/DataExtensionTemplate.js | 6 +- lib/metadataTypes/DataExtract.js | 12 +- lib/metadataTypes/DataExtractType.js | 6 +- lib/metadataTypes/Discovery.js | 8 +- lib/metadataTypes/Email.js | 8 +- lib/metadataTypes/EmailSend.js | 10 +- lib/metadataTypes/Event.js | 12 +- lib/metadataTypes/FileLocation.js | 6 +- lib/metadataTypes/FileTransfer.js | 12 +- lib/metadataTypes/Filter.js | 6 +- lib/metadataTypes/Folder.js | 14 +-- lib/metadataTypes/ImportFile.js | 12 +- lib/metadataTypes/Journey.js | 14 +-- lib/metadataTypes/List.js | 14 +-- lib/metadataTypes/MetadataType.js | 18 +-- lib/metadataTypes/MobileCode.js | 6 +- lib/metadataTypes/MobileKeyword.js | 12 +- lib/metadataTypes/MobileMessage.js | 12 +- lib/metadataTypes/Query.js | 14 +-- lib/metadataTypes/Role.js | 12 +- lib/metadataTypes/Script.js | 10 +- lib/metadataTypes/SendClassification.js | 6 +- lib/metadataTypes/SetDefinition.js | 6 +- lib/metadataTypes/TransactionalEmail.js | 10 +- lib/metadataTypes/TransactionalMessage.js | 8 +- lib/metadataTypes/TransactionalPush.js | 10 +- lib/metadataTypes/TransactionalSMS.js | 14 +-- lib/metadataTypes/TriggeredSend.js | 19 ++-- lib/metadataTypes/User.js | 12 +- .../definitions/Asset.definition.js | 2 +- .../definitions/AttributeGroup.definition.js | 2 +- .../definitions/Automation.definition.js | 2 +- .../definitions/Campaign.definition.js | 2 +- .../definitions/ContentArea.definition.js | 2 +- .../definitions/DataExtension.definition.js | 2 +- .../DataExtensionField.definition.js | 2 +- .../DataExtensionTemplate.definition.js | 2 +- .../definitions/DataExtract.definition.js | 2 +- .../definitions/DataExtractType.definition.js | 2 +- .../definitions/Discovery.definition.js | 2 +- .../definitions/Email.definition.js | 2 +- .../definitions/EmailSend.definition.js | 2 +- .../definitions/Event.definition.js | 2 +- .../definitions/FileLocation.definition.js | 2 +- .../definitions/FileTransfer.definition.js | 2 +- .../definitions/Filter.definition.js | 2 +- .../definitions/Folder.definition.js | 2 +- .../definitions/ImportFile.definition.js | 2 +- .../definitions/Journey.definition.js | 2 +- .../definitions/List.definition.js | 2 +- .../definitions/MobileCode.definition.js | 2 +- .../definitions/MobileKeyword.definition.js | 2 +- .../definitions/MobileMessage.definition.js | 2 +- .../definitions/Query.definition.js | 2 +- .../definitions/Role.definition.js | 2 +- .../definitions/Script.definition.js | 2 +- .../SendClassification.definition.js | 2 +- .../definitions/SetDefinition.definition.js | 2 +- .../TransactionalEmail.definition.js | 2 +- .../TransactionalPush.definition.js | 2 +- .../TransactionalSMS.definition.js | 2 +- .../definitions/TriggeredSend.definition.js | 2 +- .../definitions/User.definition.js | 2 +- lib/retrieveChangelog.js | 11 +- lib/util/auth.js | 12 +- lib/util/businessUnit.js | 10 +- lib/util/cache.js | 6 +- lib/util/cli.js | 20 ++-- lib/util/config.js | 14 +-- lib/util/devops.js | 23 ++-- lib/util/file.js | 18 +-- lib/util/init.config.js | 18 +-- lib/util/init.git.js | 15 ++- lib/util/init.js | 20 ++-- lib/util/init.npm.js | 10 +- lib/util/util.js | 16 +-- 90 files changed, 519 insertions(+), 441 deletions(-) diff --git a/lib/Builder.js b/lib/Builder.js index d3479a782..b0f8e39b3 100644 --- a/lib/Builder.js +++ b/lib/Builder.js @@ -1,12 +1,12 @@ 'use strict'; -const TYPE = require('../types/mcdev.d'); -const Util = require('./util/util'); -const File = require('./util/file'); -const config = require('./util/config'); -const Cli = require('./util/cli'); -const auth = require('./util/auth'); -const MetadataTypeInfo = require('./MetadataTypeInfo'); +import TYPE from '../types/mcdev.d'; +import Util from './util/util'; +import File from './util/file'; +import config from './util/config'; +import Cli from './util/cli'; +import auth from './util/auth'; +import MetadataTypeInfo from './MetadataTypeInfo'; // @ts-ignore /** @@ -244,4 +244,4 @@ saved } } -module.exports = Builder; +export default Builder; diff --git a/lib/Deployer.js b/lib/Deployer.js index b81448374..3b553c32f 100644 --- a/lib/Deployer.js +++ b/lib/Deployer.js @@ -1,14 +1,14 @@ 'use strict'; -const TYPE = require('../types/mcdev.d'); -const MetadataTypeInfo = require('./MetadataTypeInfo'); -const path = require('node:path'); -const Cli = require('./util/cli'); -const Util = require('./util/util'); -const File = require('./util/file'); -const config = require('./util/config'); -const cache = require('./util/cache'); -const auth = require('./util/auth'); +import TYPE from '../types/mcdev.d'; +import MetadataTypeInfo from './MetadataTypeInfo'; +import path from 'node:path'; +import Cli from './util/cli'; +import Util from './util/util'; +import File from './util/file'; +import config from './util/config'; +import cache from './util/cache'; +import auth from './util/auth'; /** * Reads metadata from local directory and deploys it to specified target business unit. @@ -433,4 +433,4 @@ class Deployer { } } -module.exports = Deployer; +export default Deployer; diff --git a/lib/MetadataTypeDefinitions.js b/lib/MetadataTypeDefinitions.js index 2e55ea5c4..b808cf8c4 100644 --- a/lib/MetadataTypeDefinitions.js +++ b/lib/MetadataTypeDefinitions.js @@ -1,43 +1,78 @@ 'use strict'; +import asset from './metadataTypes/definitions/Asset.definition'; +import attributeGroup from './metadataTypes/definitions/AttributeGroup.definition'; +import automation from './metadataTypes/definitions/Automation.definition'; +import campaign from './metadataTypes/definitions/Campaign.definition'; +import contentArea from './metadataTypes/definitions/ContentArea.definition'; +import dataExtension from './metadataTypes/definitions/DataExtension.definition'; +import dataExtensionField from './metadataTypes/definitions/DataExtensionField.definition'; +import dataExtensionTemplate from './metadataTypes/definitions/DataExtensionTemplate.definition'; +import dataExtract from './metadataTypes/definitions/DataExtract.definition'; +import dataExtractType from './metadataTypes/definitions/DataExtractType.definition'; +import discovery from './metadataTypes/definitions/Discovery.definition'; +import email from './metadataTypes/definitions/Email.definition'; +import emailSend from './metadataTypes/definitions/EmailSend.definition'; +import event from './metadataTypes/definitions/Event.definition'; +import fileLocation from './metadataTypes/definitions/FileLocation.definition'; +import fileTransfer from './metadataTypes/definitions/FileTransfer.definition'; +import filter from './metadataTypes/definitions/Filter.definition'; +import folder from './metadataTypes/definitions/Folder.definition'; +import importFile from './metadataTypes/definitions/ImportFile.definition'; +import journey from './metadataTypes/definitions/Journey.definition'; +import list from './metadataTypes/definitions/List.definition'; +import mobileCode from './metadataTypes/definitions/MobileCode.definition'; +import mobileKeyword from './metadataTypes/definitions/MobileKeyword.definition'; +import mobileMessage from './metadataTypes/definitions/MobileMessage.definition'; +import query from './metadataTypes/definitions/Query.definition'; +import role from './metadataTypes/definitions/Role.definition'; +import script from './metadataTypes/definitions/Script.definition'; +import sendClassification from './metadataTypes/definitions/SendClassification.definition'; +import setDefinition from './metadataTypes/definitions/SetDefinition.definition'; +import transactionalEmail from './metadataTypes/definitions/TransactionalEmail.definition'; +import transactionalPush from './metadataTypes/definitions/TransactionalPush.definition'; +import transactionalSMS from './metadataTypes/definitions/TransactionalSMS.definition'; +import triggeredSend from './metadataTypes/definitions/TriggeredSend.definition'; +import user from './metadataTypes/definitions/User.definition'; + /** * Provides access to all metadataType classes */ const MetadataTypeDefinitions = { - asset: require('./metadataTypes/definitions/Asset.definition'), - attributeGroup: require('./metadataTypes/definitions/AttributeGroup.definition'), - automation: require('./metadataTypes/definitions/Automation.definition'), - campaign: require('./metadataTypes/definitions/Campaign.definition'), - contentArea: require('./metadataTypes/definitions/ContentArea.definition'), - dataExtension: require('./metadataTypes/definitions/DataExtension.definition'), - dataExtensionField: require('./metadataTypes/definitions/DataExtensionField.definition'), - dataExtensionTemplate: require('./metadataTypes/definitions/DataExtensionTemplate.definition'), - dataExtract: require('./metadataTypes/definitions/DataExtract.definition'), - dataExtractType: require('./metadataTypes/definitions/DataExtractType.definition'), - discovery: require('./metadataTypes/definitions/Discovery.definition'), - email: require('./metadataTypes/definitions/Email.definition'), - emailSend: require('./metadataTypes/definitions/EmailSend.definition'), - event: require('./metadataTypes/definitions/Event.definition'), - fileLocation: require('./metadataTypes/definitions/FileLocation.definition'), - fileTransfer: require('./metadataTypes/definitions/FileTransfer.definition'), - filter: require('./metadataTypes/definitions/Filter.definition'), - folder: require('./metadataTypes/definitions/Folder.definition'), - importFile: require('./metadataTypes/definitions/ImportFile.definition'), - journey: require('./metadataTypes/definitions/Journey.definition'), - list: require('./metadataTypes/definitions/List.definition'), - mobileCode: require('./metadataTypes/definitions/MobileCode.definition'), - mobileKeyword: require('./metadataTypes/definitions/MobileKeyword.definition'), - mobileMessage: require('./metadataTypes/definitions/MobileMessage.definition'), - query: require('./metadataTypes/definitions/Query.definition'), - role: require('./metadataTypes/definitions/Role.definition'), - script: require('./metadataTypes/definitions/Script.definition'), - sendClassification: require('./metadataTypes/definitions/SendClassification.definition'), - setDefinition: require('./metadataTypes/definitions/SetDefinition.definition'), - transactionalEmail: require('./metadataTypes/definitions/TransactionalEmail.definition'), - transactionalPush: require('./metadataTypes/definitions/TransactionalPush.definition'), - transactionalSMS: require('./metadataTypes/definitions/TransactionalSMS.definition'), - triggeredSend: require('./metadataTypes/definitions/TriggeredSend.definition'), - user: require('./metadataTypes/definitions/User.definition'), + asset, + attributeGroup, + automation, + campaign, + contentArea, + dataExtension, + dataExtensionField, + dataExtensionTemplate, + dataExtract, + dataExtractType, + discovery, + email, + emailSend, + event, + fileLocation, + fileTransfer, + filter, + folder, + importFile, + journey, + list, + mobileCode, + mobileKeyword, + mobileMessage, + query, + role, + script, + sendClassification, + setDefinition, + transactionalEmail, + transactionalPush, + transactionalSMS, + triggeredSend, + user, }; -module.exports = MetadataTypeDefinitions; +export default MetadataTypeDefinitions; diff --git a/lib/MetadataTypeInfo.js b/lib/MetadataTypeInfo.js index 9b77ba266..38e1a5307 100644 --- a/lib/MetadataTypeInfo.js +++ b/lib/MetadataTypeInfo.js @@ -1,43 +1,78 @@ 'use strict'; +import asset from './metadataTypes/Asset'; +import attributeGroup from './metadataTypes/AttributeGroup'; +import automation from './metadataTypes/Automation'; +import campaign from './metadataTypes/Campaign'; +import contentArea from './metadataTypes/ContentArea'; +import dataExtension from './metadataTypes/DataExtension'; +import dataExtensionField from './metadataTypes/DataExtensionField'; +import dataExtensionTemplate from './metadataTypes/DataExtensionTemplate'; +import dataExtract from './metadataTypes/DataExtract'; +import dataExtractType from './metadataTypes/DataExtractType'; +import discovery from './metadataTypes/Discovery'; +import email from './metadataTypes/Email'; +import emailSend from './metadataTypes/EmailSend'; +import event from './metadataTypes/Event'; +import fileLocation from './metadataTypes/FileLocation'; +import fileTransfer from './metadataTypes/FileTransfer'; +import filter from './metadataTypes/Filter'; +import folder from './metadataTypes/Folder'; +import importFile from './metadataTypes/ImportFile'; +import journey from './metadataTypes/Journey'; +import list from './metadataTypes/List'; +import mobileCode from './metadataTypes/MobileCode'; +import mobileKeyword from './metadataTypes/MobileKeyword'; +import mobileMessage from './metadataTypes/MobileMessage'; +import query from './metadataTypes/Query'; +import role from './metadataTypes/Role'; +import script from './metadataTypes/Script'; +import sendClassification from './metadataTypes/SendClassification'; +import setDefinition from './metadataTypes/SetDefinition'; +import transactionalEmail from './metadataTypes/TransactionalEmail'; +import transactionalPush from './metadataTypes/TransactionalPush'; +import transactionalSMS from './metadataTypes/TransactionalSMS'; +import triggeredSend from './metadataTypes/TriggeredSend'; +import user from './metadataTypes/User'; + /** * Provides access to all metadataType classes */ const MetadataTypeInfo = { - asset: require('./metadataTypes/Asset'), - attributeGroup: require('./metadataTypes/AttributeGroup'), - automation: require('./metadataTypes/Automation'), - campaign: require('./metadataTypes/Campaign'), - contentArea: require('./metadataTypes/ContentArea'), - dataExtension: require('./metadataTypes/DataExtension'), - dataExtensionField: require('./metadataTypes/DataExtensionField'), - dataExtensionTemplate: require('./metadataTypes/DataExtensionTemplate'), - dataExtract: require('./metadataTypes/DataExtract'), - dataExtractType: require('./metadataTypes/DataExtractType'), - discovery: require('./metadataTypes/Discovery'), - email: require('./metadataTypes/Email'), - emailSend: require('./metadataTypes/EmailSend'), - event: require('./metadataTypes/Event'), - fileLocation: require('./metadataTypes/FileLocation'), - fileTransfer: require('./metadataTypes/FileTransfer'), - filter: require('./metadataTypes/Filter'), - folder: require('./metadataTypes/Folder'), - importFile: require('./metadataTypes/ImportFile'), - journey: require('./metadataTypes/Journey'), - list: require('./metadataTypes/List'), - mobileCode: require('./metadataTypes/MobileCode'), - mobileKeyword: require('./metadataTypes/MobileKeyword'), - mobileMessage: require('./metadataTypes/MobileMessage'), - query: require('./metadataTypes/Query'), - role: require('./metadataTypes/Role'), - script: require('./metadataTypes/Script'), - sendClassification: require('./metadataTypes/SendClassification'), - setDefinition: require('./metadataTypes/SetDefinition'), - transactionalEmail: require('./metadataTypes/TransactionalEmail'), - transactionalPush: require('./metadataTypes/TransactionalPush'), - transactionalSMS: require('./metadataTypes/TransactionalSMS'), - triggeredSend: require('./metadataTypes/TriggeredSend'), - user: require('./metadataTypes/User'), + asset, + attributeGroup, + automation, + campaign, + contentArea, + dataExtension, + dataExtensionField, + dataExtensionTemplate, + dataExtract, + dataExtractType, + discovery, + email, + emailSend, + event, + fileLocation, + fileTransfer, + filter, + folder, + importFile, + journey, + list, + mobileCode, + mobileKeyword, + mobileMessage, + query, + role, + script, + sendClassification, + setDefinition, + transactionalEmail, + transactionalPush, + transactionalSMS, + triggeredSend, + user, }; -module.exports = MetadataTypeInfo; +export default MetadataTypeInfo; diff --git a/lib/Retriever.js b/lib/Retriever.js index 86ecf781e..ea1955ca3 100644 --- a/lib/Retriever.js +++ b/lib/Retriever.js @@ -1,12 +1,12 @@ 'use strict'; -const TYPE = require('../types/mcdev.d'); -const MetadataTypeInfo = require('./MetadataTypeInfo'); -const MetadataDefinitions = require('./MetadataTypeDefinitions'); -const Util = require('./util/util'); -const File = require('./util/file'); -const cache = require('./util/cache'); -const auth = require('./util/auth'); +import TYPE from '../types/mcdev.d'; +import MetadataTypeInfo from './MetadataTypeInfo'; +import MetadataDefinitions from './MetadataTypeDefinitions'; +import Util from './util/util'; +import File from './util/file'; +import cache from './util/cache'; +import auth from './util/auth'; /** * Retrieves metadata from a business unit and saves it to the local filesystem. */ @@ -210,4 +210,4 @@ class Retriever { } } -module.exports = Retriever; +export default Retriever; diff --git a/lib/cli.js b/lib/cli.js index 7efceb3ff..8ad6310f6 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -1,13 +1,13 @@ -#!/usr/bin/env node -'use strict'; +#!/usr/bin/env node'use strict'; /** * CLI entry for SFMC DevTools */ -const Util = require('./util/util'); -const yargs = require('yargs'); -const Mcdev = require('./index'); +import Util from './util/util'; + +import yargs from 'yargs'; +import Mcdev from './index'; yargs .scriptName('mcdev') diff --git a/lib/index.js b/lib/index.js index 476528856..ab120cd6b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,21 +1,21 @@ 'use strict'; -const TYPE = require('../types/mcdev.d'); -const Util = require('./util/util'); -const auth = require('./util/auth'); -const File = require('./util/file'); -const config = require('./util/config'); -const Init = require('./util/init'); -const InitGit = require('./util/init.git'); -const Cli = require('./util/cli'); -const DevOps = require('./util/devops'); -const BuHelper = require('./util/businessUnit'); -const Builder = require('./Builder'); -const Deployer = require('./Deployer'); -const MetadataTypeInfo = require('./MetadataTypeInfo'); -const MetadataTypeDefinitions = require('./MetadataTypeDefinitions'); -const Retriever = require('./Retriever'); -const cache = require('./util/cache'); +import TYPE from '../types/mcdev.d'; +import Util from './util/util'; +import auth from './util/auth'; +import File from './util/file'; +import config from './util/config'; +import Init from './util/init'; +import InitGit from './util/init.git'; +import Cli from './util/cli'; +import DevOps from './util/devops'; +import BuHelper from './util/businessUnit'; +import Builder from './Builder'; +import Deployer from './Deployer'; +import MetadataTypeInfo from './MetadataTypeInfo'; +import MetadataTypeDefinitions from './MetadataTypeDefinitions'; +import Retriever from './Retriever'; +import cache from './util/cache'; /** * main class @@ -672,4 +672,4 @@ class Mcdev { } } -module.exports = Mcdev; +export default Mcdev; diff --git a/lib/metadataTypes/Asset.js b/lib/metadataTypes/Asset.js index c4c370167..a9fa9a39f 100644 --- a/lib/metadataTypes/Asset.js +++ b/lib/metadataTypes/Asset.js @@ -1,12 +1,12 @@ 'use strict'; -const MetadataType = require('./MetadataType'); -const TYPE = require('../../types/mcdev.d'); -const Util = require('../util/util'); -const File = require('../util/file'); -const pLimit = require('p-limit'); -const cliProgress = require('cli-progress'); -const cache = require('../util/cache'); +import MetadataType from './MetadataType'; +import TYPE from '../../types/mcdev.d'; +import Util from '../util/util'; +import File from '../util/file'; +import pLimit from 'p-limit'; +import cliProgress from 'cli-progress'; +import cache from '../util/cache'; /** * FileTransfer MetadataType @@ -1633,4 +1633,4 @@ class Asset extends MetadataType { // Assign definition to static attributes Asset.definition = require('../MetadataTypeDefinitions').asset; -module.exports = Asset; +export default Asset; diff --git a/lib/metadataTypes/AttributeGroup.js b/lib/metadataTypes/AttributeGroup.js index cf84ede2a..ebe9b3183 100644 --- a/lib/metadataTypes/AttributeGroup.js +++ b/lib/metadataTypes/AttributeGroup.js @@ -1,7 +1,7 @@ 'use strict'; -const MetadataType = require('./MetadataType'); -const TYPE = require('../../types/mcdev.d'); +import MetadataType from './MetadataType'; +import TYPE from '../../types/mcdev.d'; /** * AttributeGroup MetadataType @@ -39,4 +39,4 @@ class AttributeGroup extends MetadataType { // Assign definition to static attributes AttributeGroup.definition = require('../MetadataTypeDefinitions').attributeGroup; -module.exports = AttributeGroup; +export default AttributeGroup; diff --git a/lib/metadataTypes/Automation.js b/lib/metadataTypes/Automation.js index 83d6b54d3..8c601c5da 100644 --- a/lib/metadataTypes/Automation.js +++ b/lib/metadataTypes/Automation.js @@ -1,11 +1,11 @@ 'use strict'; -const MetadataType = require('./MetadataType'); -const TYPE = require('../../types/mcdev.d'); -const Util = require('../util/util'); -const File = require('../util/file'); -const Definitions = require('../MetadataTypeDefinitions'); -const cache = require('../util/cache'); +import MetadataType from './MetadataType'; +import TYPE from '../../types/mcdev.d'; +import Util from '../util/util'; +import File from '../util/file'; +import Definitions from '../MetadataTypeDefinitions'; +import cache from '../util/cache'; /** * Automation MetadataType @@ -1048,4 +1048,4 @@ class Automation extends MetadataType { // Assign definition to static attributes Automation.definition = Definitions.automation; -module.exports = Automation; +export default Automation; diff --git a/lib/metadataTypes/Campaign.js b/lib/metadataTypes/Campaign.js index 251fa5a3e..a907f3b2e 100644 --- a/lib/metadataTypes/Campaign.js +++ b/lib/metadataTypes/Campaign.js @@ -1,9 +1,9 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); -const File = require('../util/file'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; +import File from '../util/file'; /** * Campaign MetadataType @@ -73,4 +73,4 @@ class Campaign extends MetadataType { // Assign definition to static attributes Campaign.definition = require('../MetadataTypeDefinitions').campaign; -module.exports = Campaign; +export default Campaign; diff --git a/lib/metadataTypes/ContentArea.js b/lib/metadataTypes/ContentArea.js index f6e4a2493..f08ccd16c 100644 --- a/lib/metadataTypes/ContentArea.js +++ b/lib/metadataTypes/ContentArea.js @@ -1,9 +1,9 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; +import cache from '../util/cache'; /** * ContentArea MetadataType @@ -101,4 +101,4 @@ class ContentArea extends MetadataType { // Assign definition to static attributes ContentArea.definition = require('../MetadataTypeDefinitions').contentArea; -module.exports = ContentArea; +export default ContentArea; diff --git a/lib/metadataTypes/DataExtension.js b/lib/metadataTypes/DataExtension.js index daca42809..f2734a972 100644 --- a/lib/metadataTypes/DataExtension.js +++ b/lib/metadataTypes/DataExtension.js @@ -1,14 +1,14 @@ 'use strict'; -const jsonToTable = require('json-to-table'); -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const DataExtensionField = require('./DataExtensionField'); -const Folder = require('./Folder'); -const Util = require('../util/util'); -const File = require('../util/file'); -const auth = require('../util/auth'); -const cache = require('../util/cache'); +import jsonToTable from 'json-to-table'; +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import DataExtensionField from './DataExtensionField'; +import Folder from './Folder'; +import Util from '../util/util'; +import File from '../util/file'; +import auth from '../util/auth'; +import cache from '../util/cache'; /** * DataExtension MetadataType @@ -1074,4 +1074,4 @@ class DataExtension extends MetadataType { // Assign definition to static attributes DataExtension.definition = require('../MetadataTypeDefinitions').dataExtension; -module.exports = DataExtension; +export default DataExtension; diff --git a/lib/metadataTypes/DataExtensionField.js b/lib/metadataTypes/DataExtensionField.js index 43ec0e190..cced28c96 100644 --- a/lib/metadataTypes/DataExtensionField.js +++ b/lib/metadataTypes/DataExtensionField.js @@ -1,8 +1,8 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; /** * DataExtensionField MetadataType @@ -335,4 +335,4 @@ class DataExtensionField extends MetadataType { // Assign definition to static attributes DataExtensionField.definition = require('../MetadataTypeDefinitions').dataExtensionField; -module.exports = DataExtensionField; +export default DataExtensionField; diff --git a/lib/metadataTypes/DataExtensionTemplate.js b/lib/metadataTypes/DataExtensionTemplate.js index 021dc554b..928e40b4f 100644 --- a/lib/metadataTypes/DataExtensionTemplate.js +++ b/lib/metadataTypes/DataExtensionTemplate.js @@ -1,7 +1,7 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; /** * DataExtensionTemplate MetadataType @@ -37,4 +37,4 @@ class DataExtensionTemplate extends MetadataType { // Assign definition to static attributes DataExtensionTemplate.definition = require('../MetadataTypeDefinitions').dataExtensionTemplate; -module.exports = DataExtensionTemplate; +export default DataExtensionTemplate; diff --git a/lib/metadataTypes/DataExtract.js b/lib/metadataTypes/DataExtract.js index 077f724c4..94f7f85af 100644 --- a/lib/metadataTypes/DataExtract.js +++ b/lib/metadataTypes/DataExtract.js @@ -1,10 +1,10 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); -const File = require('../util/file'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; +import File from '../util/file'; +import cache from '../util/cache'; /** * DataExtract MetadataType @@ -162,4 +162,4 @@ class DataExtract extends MetadataType { // Assign definition to static attributes DataExtract.definition = require('../MetadataTypeDefinitions').dataExtract; -module.exports = DataExtract; +export default DataExtract; diff --git a/lib/metadataTypes/DataExtractType.js b/lib/metadataTypes/DataExtractType.js index 1b1ea6f28..a056a8eaa 100644 --- a/lib/metadataTypes/DataExtractType.js +++ b/lib/metadataTypes/DataExtractType.js @@ -1,7 +1,7 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; /** * DataExtractType MetadataType @@ -36,4 +36,4 @@ class DataExtractType extends MetadataType { // Assign definition to static attributes DataExtractType.definition = require('../MetadataTypeDefinitions').dataExtractType; -module.exports = DataExtractType; +export default DataExtractType; diff --git a/lib/metadataTypes/Discovery.js b/lib/metadataTypes/Discovery.js index 8f6191e71..a8de9678d 100644 --- a/lib/metadataTypes/Discovery.js +++ b/lib/metadataTypes/Discovery.js @@ -1,8 +1,8 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; /** * ImportFile MetadataType @@ -50,4 +50,4 @@ class Discovery extends MetadataType { // Assign definition to static attributes Discovery.definition = require('../MetadataTypeDefinitions').discovery; -module.exports = Discovery; +export default Discovery; diff --git a/lib/metadataTypes/Email.js b/lib/metadataTypes/Email.js index 57cf606e8..3354bf2a7 100644 --- a/lib/metadataTypes/Email.js +++ b/lib/metadataTypes/Email.js @@ -1,8 +1,8 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; /** * Email MetadataType @@ -89,4 +89,4 @@ class Email extends MetadataType { // Assign definition to static attributes Email.definition = require('../MetadataTypeDefinitions').email; -module.exports = Email; +export default Email; diff --git a/lib/metadataTypes/EmailSend.js b/lib/metadataTypes/EmailSend.js index 7084805f9..d492ae01c 100644 --- a/lib/metadataTypes/EmailSend.js +++ b/lib/metadataTypes/EmailSend.js @@ -1,9 +1,9 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; +import cache from '../util/cache'; /** * MessageSendActivity MetadataType @@ -294,4 +294,4 @@ class EmailSend extends MetadataType { // Assign definition to static attributes EmailSend.definition = require('../MetadataTypeDefinitions').emailSend; -module.exports = EmailSend; +export default EmailSend; diff --git a/lib/metadataTypes/Event.js b/lib/metadataTypes/Event.js index 3062acfd4..49322f1e5 100644 --- a/lib/metadataTypes/Event.js +++ b/lib/metadataTypes/Event.js @@ -1,10 +1,10 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); -const File = require('../util/file'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; +import File from '../util/file'; +import cache from '../util/cache'; /** * Event MetadataType @@ -216,4 +216,4 @@ class Event extends MetadataType { // Assign definition to static attributes Event.definition = require('../MetadataTypeDefinitions').event; -module.exports = Event; +export default Event; diff --git a/lib/metadataTypes/FileLocation.js b/lib/metadataTypes/FileLocation.js index 849df3b68..8d5c36f6d 100644 --- a/lib/metadataTypes/FileLocation.js +++ b/lib/metadataTypes/FileLocation.js @@ -1,7 +1,7 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; /** * ImportFile MetadataType @@ -36,4 +36,4 @@ class FtpLocation extends MetadataType { // Assign definition to static attributes FtpLocation.definition = require('../MetadataTypeDefinitions').fileLocation; -module.exports = FtpLocation; +export default FtpLocation; diff --git a/lib/metadataTypes/FileTransfer.js b/lib/metadataTypes/FileTransfer.js index 7cdd2a577..4c89e924c 100644 --- a/lib/metadataTypes/FileTransfer.js +++ b/lib/metadataTypes/FileTransfer.js @@ -1,10 +1,10 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); -const File = require('../util/file'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; +import File from '../util/file'; +import cache from '../util/cache'; /** * FileTransfer MetadataType @@ -167,4 +167,4 @@ class FileTransfer extends MetadataType { // Assign definition to static attributes FileTransfer.definition = require('../MetadataTypeDefinitions').fileTransfer; -module.exports = FileTransfer; +export default FileTransfer; diff --git a/lib/metadataTypes/Filter.js b/lib/metadataTypes/Filter.js index dafa8691f..9a09a0e2c 100644 --- a/lib/metadataTypes/Filter.js +++ b/lib/metadataTypes/Filter.js @@ -1,7 +1,7 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; /** * Filter MetadataType @@ -29,4 +29,4 @@ class Filter extends MetadataType { // Assign definition to static attributes Filter.definition = require('../MetadataTypeDefinitions').filter; -module.exports = Filter; +export default Filter; diff --git a/lib/metadataTypes/Folder.js b/lib/metadataTypes/Folder.js index e1f691873..01d48e21b 100644 --- a/lib/metadataTypes/Folder.js +++ b/lib/metadataTypes/Folder.js @@ -1,11 +1,11 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const toposort = require('toposort'); -const Util = require('../util/util'); -const File = require('../util/file'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import toposort from 'toposort'; +import Util from '../util/util'; +import File from '../util/file'; +import cache from '../util/cache'; /** * Folder MetadataType @@ -631,4 +631,4 @@ class Folder extends MetadataType { // Assign definition to static attributes Folder.definition = require('../MetadataTypeDefinitions').folder; -module.exports = Folder; +export default Folder; diff --git a/lib/metadataTypes/ImportFile.js b/lib/metadataTypes/ImportFile.js index 1aef70c7e..e298213f3 100644 --- a/lib/metadataTypes/ImportFile.js +++ b/lib/metadataTypes/ImportFile.js @@ -1,10 +1,10 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); -const File = require('../util/file'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; +import File from '../util/file'; +import cache from '../util/cache'; /** * ImportFile MetadataType @@ -234,4 +234,4 @@ class ImportFile extends MetadataType { // Assign definition to static attributes ImportFile.definition = require('../MetadataTypeDefinitions').importFile; -module.exports = ImportFile; +export default ImportFile; diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index ae4d4fb24..34226c94f 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -1,11 +1,11 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const TransactionalEmail = require('./TransactionalEmail'); -const Util = require('../util/util'); -const cache = require('../util/cache'); -const File = require('../util/file'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import TransactionalEmail from './TransactionalEmail'; +import Util from '../util/util'; +import cache from '../util/cache'; +import File from '../util/file'; /** * Journey MetadataType @@ -959,4 +959,4 @@ class Journey extends MetadataType { // Assign definition to static attributes Journey.definition = require('../MetadataTypeDefinitions').journey; -module.exports = Journey; +export default Journey; diff --git a/lib/metadataTypes/List.js b/lib/metadataTypes/List.js index 4b0ed2d11..a51f93169 100644 --- a/lib/metadataTypes/List.js +++ b/lib/metadataTypes/List.js @@ -1,11 +1,11 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Folder = require('./Folder'); -const Util = require('../util/util'); -const cache = require('../util/cache'); -const auth = require('../util/auth'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Folder from './Folder'; +import Util from '../util/util'; +import cache from '../util/cache'; +import auth from '../util/auth'; /** * List MetadataType @@ -207,4 +207,4 @@ class List extends MetadataType { // Assign definition to static attributes List.definition = require('../MetadataTypeDefinitions').list; -module.exports = List; +export default List; diff --git a/lib/metadataTypes/MetadataType.js b/lib/metadataTypes/MetadataType.js index 5b09b345c..044795c41 100644 --- a/lib/metadataTypes/MetadataType.js +++ b/lib/metadataTypes/MetadataType.js @@ -7,14 +7,14 @@ * in the generic version of the method */ -const TYPE = require('../../types/mcdev.d'); -const Util = require('../util/util'); -const File = require('../util/file'); -const cache = require('../util/cache'); - -const deepEqual = require('deep-equal'); -const pLimit = require('p-limit'); -const Mustache = require('mustache'); +import TYPE from '../../types/mcdev.d'; + +import Util from '../util/util'; +import File from '../util/file'; +import cache from '../util/cache'; +import deepEqual from 'deep-equal'; +import pLimit from 'p-limit'; +import Mustache from 'mustache'; /** * ensure that Mustache does not escape any characters * @@ -1846,4 +1846,4 @@ MetadataType.subType = null; */ MetadataType.buObject = null; -module.exports = MetadataType; +export default MetadataType; diff --git a/lib/metadataTypes/MobileCode.js b/lib/metadataTypes/MobileCode.js index 661ad2420..fce938f55 100644 --- a/lib/metadataTypes/MobileCode.js +++ b/lib/metadataTypes/MobileCode.js @@ -1,7 +1,7 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; /** * MobileCode MetadataType @@ -41,4 +41,4 @@ class MobileCode extends MetadataType { // Assign definition to static attributes MobileCode.definition = require('../MetadataTypeDefinitions').mobileCode; -module.exports = MobileCode; +export default MobileCode; diff --git a/lib/metadataTypes/MobileKeyword.js b/lib/metadataTypes/MobileKeyword.js index 2466c60af..c32e2bcd2 100644 --- a/lib/metadataTypes/MobileKeyword.js +++ b/lib/metadataTypes/MobileKeyword.js @@ -1,10 +1,10 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); -const File = require('../util/file'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; +import File from '../util/file'; +import cache from '../util/cache'; /** * MobileKeyword MetadataType @@ -382,4 +382,4 @@ class MobileKeyword extends MetadataType { // Assign definition to static attributes MobileKeyword.definition = require('../MetadataTypeDefinitions').mobileKeyword; -module.exports = MobileKeyword; +export default MobileKeyword; diff --git a/lib/metadataTypes/MobileMessage.js b/lib/metadataTypes/MobileMessage.js index c26ed3056..de52c4b1e 100644 --- a/lib/metadataTypes/MobileMessage.js +++ b/lib/metadataTypes/MobileMessage.js @@ -1,10 +1,10 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); -const File = require('../util/file'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; +import File from '../util/file'; +import cache from '../util/cache'; /** * MobileMessage MetadataType @@ -460,4 +460,4 @@ class MobileMessage extends MetadataType { // Assign definition to static attributes MobileMessage.definition = require('../MetadataTypeDefinitions').mobileMessage; -module.exports = MobileMessage; +export default MobileMessage; diff --git a/lib/metadataTypes/Query.js b/lib/metadataTypes/Query.js index 1b3d331d3..03e29a575 100644 --- a/lib/metadataTypes/Query.js +++ b/lib/metadataTypes/Query.js @@ -1,11 +1,11 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const Util = require('../util/util'); -const MetadataType = require('./MetadataType'); -const File = require('../util/file'); -const cache = require('../util/cache'); -const Mustache = require('mustache'); +import TYPE from '../../types/mcdev.d'; +import Util from '../util/util'; +import MetadataType from './MetadataType'; +import File from '../util/file'; +import cache from '../util/cache'; +import Mustache from 'mustache'; /** * ensure that Mustache does not escape any characters * @@ -431,4 +431,4 @@ class Query extends MetadataType { // Assign definition & cache to static attributes Query.definition = require('../MetadataTypeDefinitions').query; -module.exports = Query; +export default Query; diff --git a/lib/metadataTypes/Role.js b/lib/metadataTypes/Role.js index d6d4d7c85..76425307a 100644 --- a/lib/metadataTypes/Role.js +++ b/lib/metadataTypes/Role.js @@ -1,10 +1,10 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); -const File = require('../util/file'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; +import File from '../util/file'; +import cache from '../util/cache'; /** * ImportFile MetadataType @@ -328,4 +328,4 @@ class Role extends MetadataType { // Assign definition to static attributes Role.definition = require('../MetadataTypeDefinitions').role; -module.exports = Role; +export default Role; diff --git a/lib/metadataTypes/Script.js b/lib/metadataTypes/Script.js index aec027bfb..fc66986c0 100644 --- a/lib/metadataTypes/Script.js +++ b/lib/metadataTypes/Script.js @@ -1,9 +1,9 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); -const File = require('../util/file'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; +import File from '../util/file'; /** * Script MetadataType @@ -329,4 +329,4 @@ class Script extends MetadataType { // Assign definition & cache to static attributes Script.definition = require('../MetadataTypeDefinitions').script; -module.exports = Script; +export default Script; diff --git a/lib/metadataTypes/SendClassification.js b/lib/metadataTypes/SendClassification.js index 8a10becb5..20c39ea59 100644 --- a/lib/metadataTypes/SendClassification.js +++ b/lib/metadataTypes/SendClassification.js @@ -1,7 +1,7 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; /** * SendClassification MetadataType @@ -37,4 +37,4 @@ class SendClassification extends MetadataType { // Assign definition to static attributes SendClassification.definition = require('../MetadataTypeDefinitions').sendClassification; -module.exports = SendClassification; +export default SendClassification; diff --git a/lib/metadataTypes/SetDefinition.js b/lib/metadataTypes/SetDefinition.js index 551320874..bb8b1a75e 100644 --- a/lib/metadataTypes/SetDefinition.js +++ b/lib/metadataTypes/SetDefinition.js @@ -1,7 +1,7 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; /** * SetDefinition MetadataType @@ -34,4 +34,4 @@ class SetDefinition extends MetadataType { // Assign definition to static attributes SetDefinition.definition = require('../MetadataTypeDefinitions').setDefinition; -module.exports = SetDefinition; +export default SetDefinition; diff --git a/lib/metadataTypes/TransactionalEmail.js b/lib/metadataTypes/TransactionalEmail.js index 560bfdc61..c33e64bf2 100644 --- a/lib/metadataTypes/TransactionalEmail.js +++ b/lib/metadataTypes/TransactionalEmail.js @@ -1,9 +1,9 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const TransactionalMessage = require('./TransactionalMessage'); -const Util = require('../util/util'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import TransactionalMessage from './TransactionalMessage'; +import Util from '../util/util'; +import cache from '../util/cache'; /** * TransactionalEmail MetadataType @@ -159,4 +159,4 @@ class TransactionalEmail extends TransactionalMessage { // Assign definition to static attributes TransactionalEmail.definition = require('../MetadataTypeDefinitions').transactionalEmail; -module.exports = TransactionalEmail; +export default TransactionalEmail; diff --git a/lib/metadataTypes/TransactionalMessage.js b/lib/metadataTypes/TransactionalMessage.js index 58587d7db..63e6d316c 100644 --- a/lib/metadataTypes/TransactionalMessage.js +++ b/lib/metadataTypes/TransactionalMessage.js @@ -1,8 +1,8 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; /** * TransactionalMessage MetadataType @@ -116,4 +116,4 @@ class TransactionalMessage extends MetadataType { // ! using SMS definitions here as placeholder to have auto completion TransactionalMessage.definition = require('../MetadataTypeDefinitions').transactionalSMS; -module.exports = TransactionalMessage; +export default TransactionalMessage; diff --git a/lib/metadataTypes/TransactionalPush.js b/lib/metadataTypes/TransactionalPush.js index 1b97b6922..978037867 100644 --- a/lib/metadataTypes/TransactionalPush.js +++ b/lib/metadataTypes/TransactionalPush.js @@ -1,9 +1,9 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const TransactionalMessage = require('./TransactionalMessage'); -const Util = require('../util/util'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import TransactionalMessage from './TransactionalMessage'; +import Util from '../util/util'; +import cache from '../util/cache'; /** * TransactionalPush TransactionalMessage @@ -74,4 +74,4 @@ class TransactionalPush extends TransactionalMessage { // Assign definition to static attributes TransactionalPush.definition = require('../MetadataTypeDefinitions').transactionalPush; -module.exports = TransactionalPush; +export default TransactionalPush; diff --git a/lib/metadataTypes/TransactionalSMS.js b/lib/metadataTypes/TransactionalSMS.js index 5b429c491..00569c3fd 100644 --- a/lib/metadataTypes/TransactionalSMS.js +++ b/lib/metadataTypes/TransactionalSMS.js @@ -1,11 +1,11 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const TransactionalMessage = require('./TransactionalMessage'); -const Util = require('../util/util'); -const File = require('../util/file'); -const beautifier = require('beauty-amp-core'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import TransactionalMessage from './TransactionalMessage'; +import Util from '../util/util'; +import File from '../util/file'; +import beautifier from 'beauty-amp-core'; +import cache from '../util/cache'; /** * TransactionalSMS MetadataType @@ -343,4 +343,4 @@ class TransactionalSMS extends TransactionalMessage { // Assign definition to static attributes TransactionalSMS.definition = require('../MetadataTypeDefinitions').transactionalSMS; -module.exports = TransactionalSMS; +export default TransactionalSMS; diff --git a/lib/metadataTypes/TriggeredSend.js b/lib/metadataTypes/TriggeredSend.js index 26b3ca33d..0d150418d 100644 --- a/lib/metadataTypes/TriggeredSend.js +++ b/lib/metadataTypes/TriggeredSend.js @@ -1,14 +1,17 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; +import cache from '../util/cache'; +import asset from './Asset'; +import folder from './Folder'; +import list from './List'; const cacheTypes = { - asset: require('./Asset'), - folder: require('./Folder'), - list: require('./List'), + asset, + folder, + list, }; /** @@ -433,4 +436,4 @@ class TriggeredSend extends MetadataType { // Assign definition to static attributes TriggeredSend.definition = require('../MetadataTypeDefinitions').triggeredSend; -module.exports = TriggeredSend; +export default TriggeredSend; diff --git a/lib/metadataTypes/User.js b/lib/metadataTypes/User.js index 6e30896d0..07494afa2 100644 --- a/lib/metadataTypes/User.js +++ b/lib/metadataTypes/User.js @@ -1,10 +1,10 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataType = require('./MetadataType'); -const Util = require('../util/util'); -const File = require('../util/file'); -const cache = require('../util/cache'); +import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType'; +import Util from '../util/util'; +import File from '../util/file'; +import cache from '../util/cache'; /** * MetadataType @@ -1174,4 +1174,4 @@ class User extends MetadataType { // Assign definition to static attributes User.definition = require('../MetadataTypeDefinitions').user; -module.exports = User; +export default User; diff --git a/lib/metadataTypes/definitions/Asset.definition.js b/lib/metadataTypes/definitions/Asset.definition.js index 1d695ba9a..35491d89c 100644 --- a/lib/metadataTypes/definitions/Asset.definition.js +++ b/lib/metadataTypes/definitions/Asset.definition.js @@ -1,5 +1,5 @@ // asset types https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/base-asset-types.htm -module.exports = { +export default { bodyIteratorField: 'items', dependencies: ['folder-asset', 'folder-asset-shared'], folderType: 'asset', diff --git a/lib/metadataTypes/definitions/AttributeGroup.definition.js b/lib/metadataTypes/definitions/AttributeGroup.definition.js index cc6048fd8..ec8593215 100644 --- a/lib/metadataTypes/definitions/AttributeGroup.definition.js +++ b/lib/metadataTypes/definitions/AttributeGroup.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'attributeGroupDefinitions', dependencies: [], // future may have dependency on Data Extensions hasExtended: false, diff --git a/lib/metadataTypes/definitions/Automation.definition.js b/lib/metadataTypes/definitions/Automation.definition.js index d07b4bab0..caf412432 100644 --- a/lib/metadataTypes/definitions/Automation.definition.js +++ b/lib/metadataTypes/definitions/Automation.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { activityTypeMapping: { dataExtract: 73, dataFactoryUtility: 425, diff --git a/lib/metadataTypes/definitions/Campaign.definition.js b/lib/metadataTypes/definitions/Campaign.definition.js index cd8893b31..93644cb2a 100644 --- a/lib/metadataTypes/definitions/Campaign.definition.js +++ b/lib/metadataTypes/definitions/Campaign.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'entry', dependencies: [], hasExtended: false, diff --git a/lib/metadataTypes/definitions/ContentArea.definition.js b/lib/metadataTypes/definitions/ContentArea.definition.js index a0b9c61be..7ce7b43bb 100644 --- a/lib/metadataTypes/definitions/ContentArea.definition.js +++ b/lib/metadataTypes/definitions/ContentArea.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'Results', dependencies: ['folder'], hasExtended: false, diff --git a/lib/metadataTypes/definitions/DataExtension.definition.js b/lib/metadataTypes/definitions/DataExtension.definition.js index ca22f8f21..db5f21e1e 100644 --- a/lib/metadataTypes/definitions/DataExtension.definition.js +++ b/lib/metadataTypes/definitions/DataExtension.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'Results', dependencies: [ 'folder-hidden', diff --git a/lib/metadataTypes/definitions/DataExtensionField.definition.js b/lib/metadataTypes/definitions/DataExtensionField.definition.js index 196a1162a..0ae65b759 100644 --- a/lib/metadataTypes/definitions/DataExtensionField.definition.js +++ b/lib/metadataTypes/definitions/DataExtensionField.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'Results', dependencies: [], filter: {}, diff --git a/lib/metadataTypes/definitions/DataExtensionTemplate.definition.js b/lib/metadataTypes/definitions/DataExtensionTemplate.definition.js index c6fa9463d..6586b2a5f 100644 --- a/lib/metadataTypes/definitions/DataExtensionTemplate.definition.js +++ b/lib/metadataTypes/definitions/DataExtensionTemplate.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'Results', dependencies: [], filter: {}, diff --git a/lib/metadataTypes/definitions/DataExtract.definition.js b/lib/metadataTypes/definitions/DataExtract.definition.js index bf9b69893..10e9493c6 100644 --- a/lib/metadataTypes/definitions/DataExtract.definition.js +++ b/lib/metadataTypes/definitions/DataExtract.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'items', dependencies: ['dataExtension', 'dataExtractType'], hasExtended: true, diff --git a/lib/metadataTypes/definitions/DataExtractType.definition.js b/lib/metadataTypes/definitions/DataExtractType.definition.js index 86fae7628..785ddbb0c 100644 --- a/lib/metadataTypes/definitions/DataExtractType.definition.js +++ b/lib/metadataTypes/definitions/DataExtractType.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: [], dependencies: [], hasExtended: false, diff --git a/lib/metadataTypes/definitions/Discovery.definition.js b/lib/metadataTypes/definitions/Discovery.definition.js index eae40b7f3..483b37612 100644 --- a/lib/metadataTypes/definitions/Discovery.definition.js +++ b/lib/metadataTypes/definitions/Discovery.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: null, dependencies: [], endPointMapping: { diff --git a/lib/metadataTypes/definitions/Email.definition.js b/lib/metadataTypes/definitions/Email.definition.js index 92c47638d..c448aaed7 100644 --- a/lib/metadataTypes/definitions/Email.definition.js +++ b/lib/metadataTypes/definitions/Email.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'Results', dependencies: ['folder-hidden', 'folder-email', 'folder-shared_email_default'], hasExtended: false, diff --git a/lib/metadataTypes/definitions/EmailSend.definition.js b/lib/metadataTypes/definitions/EmailSend.definition.js index 2e750d44c..1cfe40674 100644 --- a/lib/metadataTypes/definitions/EmailSend.definition.js +++ b/lib/metadataTypes/definitions/EmailSend.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'Results', dependencies: ['folder-userinitiatedsends', 'email', 'asset-message', 'dataExtension', 'list'], // filter(+), sendClassification(+), SenderProfile(n/a), DeliveryProfile(n/a) folderType: 'userinitiatedsends', diff --git a/lib/metadataTypes/definitions/Event.definition.js b/lib/metadataTypes/definitions/Event.definition.js index 99711d510..e1854d97e 100644 --- a/lib/metadataTypes/definitions/Event.definition.js +++ b/lib/metadataTypes/definitions/Event.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'items', dependencies: ['dataExtension'], hasExtended: false, diff --git a/lib/metadataTypes/definitions/FileLocation.definition.js b/lib/metadataTypes/definitions/FileLocation.definition.js index 69a9dfd16..44b418cc6 100644 --- a/lib/metadataTypes/definitions/FileLocation.definition.js +++ b/lib/metadataTypes/definitions/FileLocation.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'items', dependencies: [], hasExtended: false, diff --git a/lib/metadataTypes/definitions/FileTransfer.definition.js b/lib/metadataTypes/definitions/FileTransfer.definition.js index d22a9c05b..c097e9017 100644 --- a/lib/metadataTypes/definitions/FileTransfer.definition.js +++ b/lib/metadataTypes/definitions/FileTransfer.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'items', dependencies: ['fileLocation'], hasExtended: true, diff --git a/lib/metadataTypes/definitions/Filter.definition.js b/lib/metadataTypes/definitions/Filter.definition.js index 317a1bad1..deef1dbfe 100644 --- a/lib/metadataTypes/definitions/Filter.definition.js +++ b/lib/metadataTypes/definitions/Filter.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'items', dependencies: [], hasExtended: false, diff --git a/lib/metadataTypes/definitions/Folder.definition.js b/lib/metadataTypes/definitions/Folder.definition.js index fd3024cac..f6f72215f 100644 --- a/lib/metadataTypes/definitions/Folder.definition.js +++ b/lib/metadataTypes/definitions/Folder.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'Results', dependencies: [], subTypes: [ diff --git a/lib/metadataTypes/definitions/ImportFile.definition.js b/lib/metadataTypes/definitions/ImportFile.definition.js index 62cb45a8e..f7681976e 100644 --- a/lib/metadataTypes/definitions/ImportFile.definition.js +++ b/lib/metadataTypes/definitions/ImportFile.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'items', dependencies: ['fileLocation', 'dataExtension', 'list'], destinationObjectTypeMapping: { diff --git a/lib/metadataTypes/definitions/Journey.definition.js b/lib/metadataTypes/definitions/Journey.definition.js index a9322b5b1..c935c96e3 100644 --- a/lib/metadataTypes/definitions/Journey.definition.js +++ b/lib/metadataTypes/definitions/Journey.definition.js @@ -2,7 +2,7 @@ // obj definition: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/getting-started-spec.html // insert: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/postCreateInteraction.html // update: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/putUpdateInteraction.html -module.exports = { +export default { bodyIteratorField: 'items', dependencies: [ 'folder-journey', diff --git a/lib/metadataTypes/definitions/List.definition.js b/lib/metadataTypes/definitions/List.definition.js index 867a2c64b..7fa728837 100644 --- a/lib/metadataTypes/definitions/List.definition.js +++ b/lib/metadataTypes/definitions/List.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'Results', dependencies: ['folder-mysubs', 'folder-list', 'folder-publication'], folderType: 'list', diff --git a/lib/metadataTypes/definitions/MobileCode.definition.js b/lib/metadataTypes/definitions/MobileCode.definition.js index 2ebc5ebab..e047790a0 100644 --- a/lib/metadataTypes/definitions/MobileCode.definition.js +++ b/lib/metadataTypes/definitions/MobileCode.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'entry', dependencies: [], hasExtended: false, diff --git a/lib/metadataTypes/definitions/MobileKeyword.definition.js b/lib/metadataTypes/definitions/MobileKeyword.definition.js index b474c75cf..ff6868343 100644 --- a/lib/metadataTypes/definitions/MobileKeyword.definition.js +++ b/lib/metadataTypes/definitions/MobileKeyword.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'entry', dependencies: ['mobileCode'], hasExtended: false, diff --git a/lib/metadataTypes/definitions/MobileMessage.definition.js b/lib/metadataTypes/definitions/MobileMessage.definition.js index 9feec0a56..73e25cfb4 100644 --- a/lib/metadataTypes/definitions/MobileMessage.definition.js +++ b/lib/metadataTypes/definitions/MobileMessage.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'entry', dependencies: ['mobileCode', 'mobileKeyword', 'campaign'], hasExtended: false, diff --git a/lib/metadataTypes/definitions/Query.definition.js b/lib/metadataTypes/definitions/Query.definition.js index 8ed76bdd6..2851462ea 100644 --- a/lib/metadataTypes/definitions/Query.definition.js +++ b/lib/metadataTypes/definitions/Query.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'items', dependencies: ['folder-queryactivity', 'dataExtension'], folderType: 'queryactivity', diff --git a/lib/metadataTypes/definitions/Role.definition.js b/lib/metadataTypes/definitions/Role.definition.js index ec00780b3..5827387b5 100644 --- a/lib/metadataTypes/definitions/Role.definition.js +++ b/lib/metadataTypes/definitions/Role.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'Results', dependencies: [], deployBlacklist: [ diff --git a/lib/metadataTypes/definitions/Script.definition.js b/lib/metadataTypes/definitions/Script.definition.js index 0c38bd745..00e06ff22 100644 --- a/lib/metadataTypes/definitions/Script.definition.js +++ b/lib/metadataTypes/definitions/Script.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'items', dependencies: ['folder-ssjsactivity'], folderType: 'ssjsactivity', diff --git a/lib/metadataTypes/definitions/SendClassification.definition.js b/lib/metadataTypes/definitions/SendClassification.definition.js index cc794b222..2807ce43d 100644 --- a/lib/metadataTypes/definitions/SendClassification.definition.js +++ b/lib/metadataTypes/definitions/SendClassification.definition.js @@ -1,5 +1,5 @@ // https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/sendclassification.html -module.exports = { +export default { bodyIteratorField: 'Results', dependencies: [], filter: {}, diff --git a/lib/metadataTypes/definitions/SetDefinition.definition.js b/lib/metadataTypes/definitions/SetDefinition.definition.js index e5b7f9176..67ddea49d 100644 --- a/lib/metadataTypes/definitions/SetDefinition.definition.js +++ b/lib/metadataTypes/definitions/SetDefinition.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'setDefinition', dependencies: [], // future may have dependency on Data Extensions hasExtended: false, diff --git a/lib/metadataTypes/definitions/TransactionalEmail.definition.js b/lib/metadataTypes/definitions/TransactionalEmail.definition.js index 96a2f457f..27f8cd277 100644 --- a/lib/metadataTypes/definitions/TransactionalEmail.definition.js +++ b/lib/metadataTypes/definitions/TransactionalEmail.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'definitions', dependencies: ['asset-message', 'dataExtension', 'list', 'journey'], hasExtended: false, diff --git a/lib/metadataTypes/definitions/TransactionalPush.definition.js b/lib/metadataTypes/definitions/TransactionalPush.definition.js index 66e663375..bb3bb9743 100644 --- a/lib/metadataTypes/definitions/TransactionalPush.definition.js +++ b/lib/metadataTypes/definitions/TransactionalPush.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'definitions', dependencies: ['asset-asset'], hasExtended: false, diff --git a/lib/metadataTypes/definitions/TransactionalSMS.definition.js b/lib/metadataTypes/definitions/TransactionalSMS.definition.js index 2cb1c7af7..743a62d99 100644 --- a/lib/metadataTypes/definitions/TransactionalSMS.definition.js +++ b/lib/metadataTypes/definitions/TransactionalSMS.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'definitions', dependencies: ['mobileCode', 'mobileKeyword'], hasExtended: false, diff --git a/lib/metadataTypes/definitions/TriggeredSend.definition.js b/lib/metadataTypes/definitions/TriggeredSend.definition.js index adee58ee4..0c6e30499 100644 --- a/lib/metadataTypes/definitions/TriggeredSend.definition.js +++ b/lib/metadataTypes/definitions/TriggeredSend.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'Results', dependencies: [ 'folder-hidden', diff --git a/lib/metadataTypes/definitions/User.definition.js b/lib/metadataTypes/definitions/User.definition.js index 5e8481c59..759856345 100644 --- a/lib/metadataTypes/definitions/User.definition.js +++ b/lib/metadataTypes/definitions/User.definition.js @@ -1,4 +1,4 @@ -module.exports = { +export default { bodyIteratorField: 'Results', dependencies: ['role'], folderType: null, diff --git a/lib/retrieveChangelog.js b/lib/retrieveChangelog.js index 3d42e6592..0b9d8ac89 100644 --- a/lib/retrieveChangelog.js +++ b/lib/retrieveChangelog.js @@ -1,5 +1,5 @@ -#!/usr/bin/env node -'use strict'; +#!/usr/bin/env node'use strict'; + /* eslint-disable unicorn/prefer-top-level-await */ /** * sample file on how to retrieve a simple changelog to use in GUIs or automated processing of any kind @@ -16,9 +16,10 @@ }] */ -const mcdev = require('./index'); -const Definition = require('./MetadataTypeDefinitions'); -const MetadataType = require('./MetadataTypeInfo'); +import mcdev from './index'; + +import Definition from './MetadataTypeDefinitions'; +import MetadataType from './MetadataTypeInfo'; // disable cli logs // mcdev._setLoggingLevel({ silent: true }); diff --git a/lib/util/auth.js b/lib/util/auth.js index 74080b0ba..8cdb9ed3b 100644 --- a/lib/util/auth.js +++ b/lib/util/auth.js @@ -1,8 +1,8 @@ -const TYPE = require('../../types/mcdev.d'); -const Util = require('./util'); -const File = require('./file'); -const SDK = require('sfmc-sdk'); -const Conf = require('conf'); +import TYPE from '../../types/mcdev.d'; +import Util from './util'; +import File from './file'; +import SDK from 'sfmc-sdk'; +import Conf from 'conf'; const credentialStore = new Conf({ configName: 'sessions', clearInvalidConfig: true }); // const currentMID = null; const initializedSDKs = {}; @@ -147,4 +147,4 @@ function setupSDK(sessionKey, authObject) { }); } -module.exports = Auth; +export default Auth; diff --git a/lib/util/businessUnit.js b/lib/util/businessUnit.js index f9b6b3ef6..c58170fc9 100644 --- a/lib/util/businessUnit.js +++ b/lib/util/businessUnit.js @@ -1,9 +1,9 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const Util = require('./util'); -const File = require('./file'); -const auth = require('./auth'); +import TYPE from '../../types/mcdev.d'; +import Util from './util'; +import File from './file'; +import auth from './auth'; /** * Helper that handles retrieval of BU info @@ -104,4 +104,4 @@ const BusinessUnit = { }, }; -module.exports = BusinessUnit; +export default BusinessUnit; diff --git a/lib/util/cache.js b/lib/util/cache.js index bcea3a35d..d1cdba36b 100644 --- a/lib/util/cache.js +++ b/lib/util/cache.js @@ -1,11 +1,11 @@ -const TYPE = require('../../types/mcdev.d'); -const Util = require('./util'); +import TYPE from '../../types/mcdev.d'; +import Util from './util'; /** @type {TYPE.Cache} */ const dataStore = {}; let currentMID = null; -module.exports = { +export default { /** * Method to setup buObject * NOTE: in future this may need to restore, rather than wipe the cache diff --git a/lib/util/cli.js b/lib/util/cli.js index 5ebc5ccb7..d748f7a24 100644 --- a/lib/util/cli.js +++ b/lib/util/cli.js @@ -1,14 +1,14 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const BuHelper = require('./businessUnit'); -const File = require('./file'); -const config = require('./config'); -const inquirer = require('inquirer'); -const MetadataDefinitions = require('./../MetadataTypeDefinitions'); -const Util = require('./util'); -const auth = require('./auth'); -require('console.table'); +import TYPE from '../../types/mcdev.d'; +import BuHelper from './businessUnit'; +import File from './file'; +import config from './config'; +import inquirer from 'inquirer'; +import MetadataDefinitions from './../MetadataTypeDefinitions'; +import Util from './util'; +import auth from './auth'; +import 'console.table'; /** * CLI helper class @@ -614,4 +614,4 @@ const Cli = { }, }; -module.exports = Cli; +export default Cli; diff --git a/lib/util/config.js b/lib/util/config.js index cab81b61c..375fab40a 100644 --- a/lib/util/config.js +++ b/lib/util/config.js @@ -1,9 +1,9 @@ -const TYPE = require('../../types/mcdev.d'); -const Util = require('./util'); -const File = require('./file'); -const inquirer = require('inquirer'); -const semver = require('semver'); -const path = require('node:path'); +import TYPE from '../../types/mcdev.d'; +import Util from './util'; +import File from './file'; +import inquirer from 'inquirer'; +import semver from 'semver'; +import path from 'node:path'; /** * Central class for loading and validating properties from config and auth */ @@ -300,4 +300,4 @@ const config = { return defaultProperties; }, }; -module.exports = config; +export default config; diff --git a/lib/util/devops.js b/lib/util/devops.js index 208e838a0..82641ca92 100644 --- a/lib/util/devops.js +++ b/lib/util/devops.js @@ -1,13 +1,14 @@ -const TYPE = require('../../types/mcdev.d'); -const File = require('./file'); -const path = require('node:path'); -const inquirer = require('inquirer'); -const Util = require('./util'); -const Cli = require('./cli'); -const git = require('simple-git')(); -const Builder = require('../Builder'); -const MetadataType = require('../MetadataTypeInfo'); -const jsonToTable = require('json-to-table'); +import TYPE from '../../types/mcdev.d'; +import File from './file'; +import path from 'node:path'; +import inquirer from 'inquirer'; +import Util from './util'; +import Cli from './cli'; +import gitFactory from 'simple-git'; +const git = gitFactory(); +import Builder from '../Builder'; +import MetadataType from '../MetadataTypeInfo'; +import jsonToTable from 'json-to-table'; /** * DevOps helper class */ @@ -568,4 +569,4 @@ const DevOps = { }, }; -module.exports = DevOps; +export default DevOps; diff --git a/lib/util/file.js b/lib/util/file.js index d4d9c6946..173fce1de 100644 --- a/lib/util/file.js +++ b/lib/util/file.js @@ -1,14 +1,14 @@ /* eslint-disable no-control-regex */ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const fs = require('fs-extra'); -const packageJson = require('../../package.json'); -const path = require('node:path'); -const prettier = require('prettier'); -const beautyAmp = require('beauty-amp-core'); -const Util = require('./util'); -const updateNotifier = require('update-notifier'); +import TYPE from '../../types/mcdev.d'; +import fs from 'fs-extra'; +import packageJson from '../../package.json'; +import path from 'node:path'; +import prettier from 'prettier'; +import beautyAmp from 'beauty-amp-core'; +import Util from './util'; +import updateNotifier from 'update-notifier'; // inform user when there is an update const notifier = updateNotifier({ @@ -548,4 +548,4 @@ const File = { const FileFs = { ...fs, ...File }; FileFs.prettierConfig = null; -module.exports = FileFs; +export default FileFs; diff --git a/lib/util/init.config.js b/lib/util/init.config.js index 4d6e3eab6..860e5756b 100644 --- a/lib/util/init.config.js +++ b/lib/util/init.config.js @@ -1,13 +1,13 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const Cli = require('./cli'); -const File = require('./file'); -const config = require('./config'); -const Util = require('./util'); -const inquirer = require('inquirer'); -const path = require('node:path'); -const semver = require('semver'); +import TYPE from '../../types/mcdev.d'; +import Cli from './cli'; +import File from './file'; +import config from './config'; +import Util from './util'; +import inquirer from 'inquirer'; +import path from 'node:path'; +import semver from 'semver'; /** * CLI helper class @@ -425,4 +425,4 @@ const Init = { }, }; -module.exports = Init; +export default Init; diff --git a/lib/util/init.git.js b/lib/util/init.git.js index e91de4b58..fc4d9d5ab 100644 --- a/lib/util/init.git.js +++ b/lib/util/init.git.js @@ -1,10 +1,13 @@ 'use strict'; + // const TYPE = require('../../types/mcdev.d'); -const File = require('./file'); -const inquirer = require('inquirer'); -const Util = require('./util'); -const commandExists = require('command-exists'); -const git = require('simple-git')(); +import File from './file'; + +import inquirer from 'inquirer'; +import Util from './util'; +import commandExists from 'command-exists'; +import gitFactory from 'simple-git'; +const git = gitFactory(); /** * CLI helper class @@ -259,4 +262,4 @@ const Init = { }, }; -module.exports = Init; +export default Init; diff --git a/lib/util/init.js b/lib/util/init.js index 22aa7b966..7ecc6b409 100644 --- a/lib/util/init.js +++ b/lib/util/init.js @@ -1,13 +1,13 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const Cli = require('./cli'); -const File = require('./file'); -const config = require('./config'); -const InitGit = require('./init.git'); -const InitNpm = require('./init.npm'); -const InitConfig = require('./init.config'); -const inquirer = require('inquirer'); -const Util = require('./util'); +import TYPE from '../../types/mcdev.d'; +import Cli from './cli'; +import File from './file'; +import config from './config'; +import InitGit from './init.git'; +import InitNpm from './init.npm'; +import InitConfig from './init.config'; +import inquirer from 'inquirer'; +import Util from './util'; /** * CLI helper class @@ -422,4 +422,4 @@ const Init = { }, }; -module.exports = Init; +export default Init; diff --git a/lib/util/init.npm.js b/lib/util/init.npm.js index 29fd7d7d2..fe7f4f488 100644 --- a/lib/util/init.npm.js +++ b/lib/util/init.npm.js @@ -1,9 +1,9 @@ 'use strict'; -const File = require('./file'); -const path = require('node:path'); -const Util = require('./util'); -const semver = require('semver'); +import File from './file'; +import path from 'node:path'; +import Util from './util'; +import semver from 'semver'; /** * CLI helper class @@ -154,4 +154,4 @@ const Init = { }, }; -module.exports = Init; +export default Init; diff --git a/lib/util/util.js b/lib/util/util.js index 62711cc9c..8d101baeb 100644 --- a/lib/util/util.js +++ b/lib/util/util.js @@ -1,12 +1,12 @@ 'use strict'; -const TYPE = require('../../types/mcdev.d'); -const MetadataDefinitions = require('./../MetadataTypeDefinitions'); -const packageJsonMcdev = require('../../package.json'); -const process = require('node:process'); -const toposort = require('toposort'); -const winston = require('winston'); -const child_process = require('node:child_process'); +import TYPE from '../../types/mcdev.d'; +import MetadataDefinitions from './../MetadataTypeDefinitions'; +import packageJsonMcdev from '../../package.json'; +import process from 'node:process'; +import toposort from 'toposort'; +import winston from 'winston'; +import child_process from 'node:child_process'; /** * Util that contains logger and simple util methods @@ -755,4 +755,4 @@ function startLogger() { } startLogger(); -module.exports = Util; +export default Util; From d7f4015cefc07d03442956d751bc4a70e49b3488 Mon Sep 17 00:00:00 2001 From: Douglas Midgley Date: Thu, 4 May 2023 00:12:25 +0200 Subject: [PATCH 02/48] removing requires https://vscode.dev/github/Accenture/sfmc-devtools/blob/289455b5b1751fad69135ec281d908bfdc9e243f/lib/metadataTypes/DataExtension.js#L1076-L1077 --- lib/Builder.js | 14 ++--- lib/Deployer.js | 16 ++--- lib/MetadataTypeDefinitions.js | 72 +++++++++++----------- lib/MetadataTypeInfo.js | 68 ++++++++++---------- lib/Retriever.js | 14 ++--- lib/cli.js | 6 +- lib/index.js | 32 +++++----- lib/metadataTypes/Asset.js | 14 +++-- lib/metadataTypes/AttributeGroup.js | 7 ++- lib/metadataTypes/Automation.js | 12 ++-- lib/metadataTypes/Campaign.js | 11 ++-- lib/metadataTypes/ContentArea.js | 11 ++-- lib/metadataTypes/DataExtension.js | 21 ++++--- lib/metadataTypes/DataExtensionField.js | 8 +-- lib/metadataTypes/DataExtensionTemplate.js | 6 +- lib/metadataTypes/DataExtract.js | 12 ++-- lib/metadataTypes/DataExtractType.js | 6 +- lib/metadataTypes/Discovery.js | 8 +-- lib/metadataTypes/Email.js | 8 +-- lib/metadataTypes/EmailSend.js | 10 +-- lib/metadataTypes/Event.js | 12 ++-- lib/metadataTypes/FileLocation.js | 6 +- lib/metadataTypes/FileTransfer.js | 12 ++-- lib/metadataTypes/Filter.js | 6 +- lib/metadataTypes/Folder.js | 12 ++-- lib/metadataTypes/ImportFile.js | 12 ++-- lib/metadataTypes/Journey.js | 14 ++--- lib/metadataTypes/List.js | 14 ++--- lib/metadataTypes/MetadataType.js | 8 +-- lib/metadataTypes/MobileCode.js | 6 +- lib/metadataTypes/MobileKeyword.js | 12 ++-- lib/metadataTypes/MobileMessage.js | 12 ++-- lib/metadataTypes/Query.js | 12 ++-- lib/metadataTypes/Role.js | 12 ++-- lib/metadataTypes/Script.js | 10 +-- lib/metadataTypes/SendClassification.js | 6 +- lib/metadataTypes/SetDefinition.js | 6 +- lib/metadataTypes/TransactionalEmail.js | 10 +-- lib/metadataTypes/TransactionalMessage.js | 8 +-- lib/metadataTypes/TransactionalPush.js | 10 +-- lib/metadataTypes/TransactionalSMS.js | 12 ++-- lib/metadataTypes/TriggeredSend.js | 16 ++--- lib/metadataTypes/User.js | 12 ++-- lib/retrieveChangelog.js | 6 +- lib/util/auth.js | 6 +- lib/util/businessUnit.js | 8 +-- lib/util/cache.js | 4 +- lib/util/cli.js | 14 ++--- lib/util/config.js | 6 +- lib/util/devops.js | 12 ++-- lib/util/file.js | 6 +- lib/util/init.config.js | 10 +-- lib/util/init.git.js | 4 +- lib/util/init.js | 16 ++--- lib/util/init.npm.js | 4 +- lib/util/util.js | 10 ++- package.json | 7 +-- 57 files changed, 355 insertions(+), 354 deletions(-) diff --git a/lib/Builder.js b/lib/Builder.js index b0f8e39b3..1d655808a 100644 --- a/lib/Builder.js +++ b/lib/Builder.js @@ -1,12 +1,12 @@ 'use strict'; -import TYPE from '../types/mcdev.d'; -import Util from './util/util'; -import File from './util/file'; -import config from './util/config'; -import Cli from './util/cli'; -import auth from './util/auth'; -import MetadataTypeInfo from './MetadataTypeInfo'; +// import TYPE from '../types/mcdev.d.js'; +import { Util } from './util/util.js'; +import File from './util/file.js'; +import config from './util/config.js'; +import Cli from './util/cli.js'; +import auth from './util/auth.js'; +import MetadataTypeInfo from './MetadataTypeInfo.js'; // @ts-ignore /** diff --git a/lib/Deployer.js b/lib/Deployer.js index 3b553c32f..818a5c910 100644 --- a/lib/Deployer.js +++ b/lib/Deployer.js @@ -1,14 +1,14 @@ 'use strict'; -import TYPE from '../types/mcdev.d'; -import MetadataTypeInfo from './MetadataTypeInfo'; +// import TYPE from '../types/mcdev.d.js'; +import MetadataTypeInfo from './MetadataTypeInfo.js'; import path from 'node:path'; -import Cli from './util/cli'; -import Util from './util/util'; -import File from './util/file'; -import config from './util/config'; -import cache from './util/cache'; -import auth from './util/auth'; +import Cli from './util/cli.js'; +import { Util } from './util/util.js'; +import File from './util/file.js'; +import config from './util/config.js'; +import cache from './util/cache.js'; +import auth from './util/auth.js'; /** * Reads metadata from local directory and deploys it to specified target business unit. diff --git a/lib/MetadataTypeDefinitions.js b/lib/MetadataTypeDefinitions.js index b808cf8c4..648408b3b 100644 --- a/lib/MetadataTypeDefinitions.js +++ b/lib/MetadataTypeDefinitions.js @@ -1,44 +1,44 @@ 'use strict'; -import asset from './metadataTypes/definitions/Asset.definition'; -import attributeGroup from './metadataTypes/definitions/AttributeGroup.definition'; -import automation from './metadataTypes/definitions/Automation.definition'; -import campaign from './metadataTypes/definitions/Campaign.definition'; -import contentArea from './metadataTypes/definitions/ContentArea.definition'; -import dataExtension from './metadataTypes/definitions/DataExtension.definition'; -import dataExtensionField from './metadataTypes/definitions/DataExtensionField.definition'; -import dataExtensionTemplate from './metadataTypes/definitions/DataExtensionTemplate.definition'; -import dataExtract from './metadataTypes/definitions/DataExtract.definition'; -import dataExtractType from './metadataTypes/definitions/DataExtractType.definition'; -import discovery from './metadataTypes/definitions/Discovery.definition'; -import email from './metadataTypes/definitions/Email.definition'; -import emailSend from './metadataTypes/definitions/EmailSend.definition'; -import event from './metadataTypes/definitions/Event.definition'; -import fileLocation from './metadataTypes/definitions/FileLocation.definition'; -import fileTransfer from './metadataTypes/definitions/FileTransfer.definition'; -import filter from './metadataTypes/definitions/Filter.definition'; -import folder from './metadataTypes/definitions/Folder.definition'; -import importFile from './metadataTypes/definitions/ImportFile.definition'; -import journey from './metadataTypes/definitions/Journey.definition'; -import list from './metadataTypes/definitions/List.definition'; -import mobileCode from './metadataTypes/definitions/MobileCode.definition'; -import mobileKeyword from './metadataTypes/definitions/MobileKeyword.definition'; -import mobileMessage from './metadataTypes/definitions/MobileMessage.definition'; -import query from './metadataTypes/definitions/Query.definition'; -import role from './metadataTypes/definitions/Role.definition'; -import script from './metadataTypes/definitions/Script.definition'; -import sendClassification from './metadataTypes/definitions/SendClassification.definition'; -import setDefinition from './metadataTypes/definitions/SetDefinition.definition'; -import transactionalEmail from './metadataTypes/definitions/TransactionalEmail.definition'; -import transactionalPush from './metadataTypes/definitions/TransactionalPush.definition'; -import transactionalSMS from './metadataTypes/definitions/TransactionalSMS.definition'; -import triggeredSend from './metadataTypes/definitions/TriggeredSend.definition'; -import user from './metadataTypes/definitions/User.definition'; +import asset from './metadataTypes/definitions/Asset.definition.js'; +import attributeGroup from './metadataTypes/definitions/AttributeGroup.definition.js'; +import automation from './metadataTypes/definitions/Automation.definition.js'; +import campaign from './metadataTypes/definitions/Campaign.definition.js'; +import contentArea from './metadataTypes/definitions/ContentArea.definition.js'; +import dataExtension from './metadataTypes/definitions/DataExtension.definition.js'; +import dataExtensionField from './metadataTypes/definitions/DataExtensionField.definition.js'; +import dataExtensionTemplate from './metadataTypes/definitions/DataExtensionTemplate.definition.js'; +import dataExtract from './metadataTypes/definitions/DataExtract.definition.js'; +import dataExtractType from './metadataTypes/definitions/DataExtractType.definition.js'; +import discovery from './metadataTypes/definitions/Discovery.definition.js'; +import email from './metadataTypes/definitions/Email.definition.js'; +import emailSend from './metadataTypes/definitions/EmailSend.definition.js'; +import event from './metadataTypes/definitions/Event.definition.js'; +import fileLocation from './metadataTypes/definitions/FileLocation.definition.js'; +import fileTransfer from './metadataTypes/definitions/FileTransfer.definition.js'; +import filter from './metadataTypes/definitions/Filter.definition.js'; +import folder from './metadataTypes/definitions/Folder.definition.js'; +import importFile from './metadataTypes/definitions/ImportFile.definition.js'; +import journey from './metadataTypes/definitions/Journey.definition.js'; +import list from './metadataTypes/definitions/List.definition.js'; +import mobileCode from './metadataTypes/definitions/MobileCode.definition.js'; +import mobileKeyword from './metadataTypes/definitions/MobileKeyword.definition.js'; +import mobileMessage from './metadataTypes/definitions/MobileMessage.definition.js'; +import query from './metadataTypes/definitions/Query.definition.js'; +import role from './metadataTypes/definitions/Role.definition.js'; +import script from './metadataTypes/definitions/Script.definition.js'; +import sendClassification from './metadataTypes/definitions/SendClassification.definition.js'; +import setDefinition from './metadataTypes/definitions/SetDefinition.definition.js'; +import transactionalEmail from './metadataTypes/definitions/TransactionalEmail.definition.js'; +import transactionalPush from './metadataTypes/definitions/TransactionalPush.definition.js'; +import transactionalSMS from './metadataTypes/definitions/TransactionalSMS.definition.js'; +import triggeredSend from './metadataTypes/definitions/TriggeredSend.definition.js'; +import user from './metadataTypes/definitions/User.definition.js'; /** * Provides access to all metadataType classes */ -const MetadataTypeDefinitions = { +export default { asset, attributeGroup, automation, @@ -74,5 +74,3 @@ const MetadataTypeDefinitions = { triggeredSend, user, }; - -export default MetadataTypeDefinitions; diff --git a/lib/MetadataTypeInfo.js b/lib/MetadataTypeInfo.js index 38e1a5307..5f0bfefbb 100644 --- a/lib/MetadataTypeInfo.js +++ b/lib/MetadataTypeInfo.js @@ -1,39 +1,39 @@ 'use strict'; -import asset from './metadataTypes/Asset'; -import attributeGroup from './metadataTypes/AttributeGroup'; -import automation from './metadataTypes/Automation'; -import campaign from './metadataTypes/Campaign'; -import contentArea from './metadataTypes/ContentArea'; -import dataExtension from './metadataTypes/DataExtension'; -import dataExtensionField from './metadataTypes/DataExtensionField'; -import dataExtensionTemplate from './metadataTypes/DataExtensionTemplate'; -import dataExtract from './metadataTypes/DataExtract'; -import dataExtractType from './metadataTypes/DataExtractType'; -import discovery from './metadataTypes/Discovery'; -import email from './metadataTypes/Email'; -import emailSend from './metadataTypes/EmailSend'; -import event from './metadataTypes/Event'; -import fileLocation from './metadataTypes/FileLocation'; -import fileTransfer from './metadataTypes/FileTransfer'; -import filter from './metadataTypes/Filter'; -import folder from './metadataTypes/Folder'; -import importFile from './metadataTypes/ImportFile'; -import journey from './metadataTypes/Journey'; -import list from './metadataTypes/List'; -import mobileCode from './metadataTypes/MobileCode'; -import mobileKeyword from './metadataTypes/MobileKeyword'; -import mobileMessage from './metadataTypes/MobileMessage'; -import query from './metadataTypes/Query'; -import role from './metadataTypes/Role'; -import script from './metadataTypes/Script'; -import sendClassification from './metadataTypes/SendClassification'; -import setDefinition from './metadataTypes/SetDefinition'; -import transactionalEmail from './metadataTypes/TransactionalEmail'; -import transactionalPush from './metadataTypes/TransactionalPush'; -import transactionalSMS from './metadataTypes/TransactionalSMS'; -import triggeredSend from './metadataTypes/TriggeredSend'; -import user from './metadataTypes/User'; +import asset from './metadataTypes/Asset.js'; +import attributeGroup from './metadataTypes/AttributeGroup.js'; +import automation from './metadataTypes/Automation.js'; +import campaign from './metadataTypes/Campaign.js'; +import contentArea from './metadataTypes/ContentArea.js'; +import dataExtension from './metadataTypes/DataExtension.js'; +import dataExtensionField from './metadataTypes/DataExtensionField.js'; +import dataExtensionTemplate from './metadataTypes/DataExtensionTemplate.js'; +import dataExtract from './metadataTypes/DataExtract.js'; +import dataExtractType from './metadataTypes/DataExtractType.js'; +import discovery from './metadataTypes/Discovery.js'; +import email from './metadataTypes/Email.js'; +import emailSend from './metadataTypes/EmailSend.js'; +import event from './metadataTypes/Event.js'; +import fileLocation from './metadataTypes/FileLocation.js'; +import fileTransfer from './metadataTypes/FileTransfer.js'; +import filter from './metadataTypes/Filter.js'; +import folder from './metadataTypes/Folder.js'; +import importFile from './metadataTypes/ImportFile.js'; +import journey from './metadataTypes/Journey.js'; +import list from './metadataTypes/List.js'; +import mobileCode from './metadataTypes/MobileCode.js'; +import mobileKeyword from './metadataTypes/MobileKeyword.js'; +import mobileMessage from './metadataTypes/MobileMessage.js'; +import query from './metadataTypes/Query.js'; +import role from './metadataTypes/Role.js'; +import script from './metadataTypes/Script.js'; +import sendClassification from './metadataTypes/SendClassification.js'; +import setDefinition from './metadataTypes/SetDefinition.js'; +import transactionalEmail from './metadataTypes/TransactionalEmail.js'; +import transactionalPush from './metadataTypes/TransactionalPush.js'; +import transactionalSMS from './metadataTypes/TransactionalSMS.js'; +import triggeredSend from './metadataTypes/TriggeredSend.js'; +import user from './metadataTypes/User.js'; /** * Provides access to all metadataType classes diff --git a/lib/Retriever.js b/lib/Retriever.js index ea1955ca3..a9040a073 100644 --- a/lib/Retriever.js +++ b/lib/Retriever.js @@ -1,12 +1,12 @@ 'use strict'; -import TYPE from '../types/mcdev.d'; -import MetadataTypeInfo from './MetadataTypeInfo'; -import MetadataDefinitions from './MetadataTypeDefinitions'; -import Util from './util/util'; -import File from './util/file'; -import cache from './util/cache'; -import auth from './util/auth'; +// import TYPE from '../types/mcdev.d.js'; +import MetadataTypeInfo from './MetadataTypeInfo.js'; +import MetadataDefinitions from './MetadataTypeDefinitions.js'; +import { Util } from './util/util.js'; +import File from './util/file.js'; +import cache from './util/cache.js'; +import auth from './util/auth.js'; /** * Retrieves metadata from a business unit and saves it to the local filesystem. */ diff --git a/lib/cli.js b/lib/cli.js index 8ad6310f6..567e0abf2 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -1,13 +1,13 @@ -#!/usr/bin/env node'use strict'; +#!/usr/bin/env node /** * CLI entry for SFMC DevTools */ -import Util from './util/util'; +import { Util } from './util/util.js'; import yargs from 'yargs'; -import Mcdev from './index'; +import Mcdev from './index.js'; yargs .scriptName('mcdev') diff --git a/lib/index.js b/lib/index.js index ab120cd6b..4ebc1f416 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,21 +1,21 @@ 'use strict'; -import TYPE from '../types/mcdev.d'; -import Util from './util/util'; -import auth from './util/auth'; -import File from './util/file'; -import config from './util/config'; -import Init from './util/init'; -import InitGit from './util/init.git'; -import Cli from './util/cli'; -import DevOps from './util/devops'; -import BuHelper from './util/businessUnit'; -import Builder from './Builder'; -import Deployer from './Deployer'; -import MetadataTypeInfo from './MetadataTypeInfo'; -import MetadataTypeDefinitions from './MetadataTypeDefinitions'; -import Retriever from './Retriever'; -import cache from './util/cache'; +// import TYPE from '../types/mcdev.d.js'; +import { Util } from './util/util.js'; +import auth from './util/auth.js'; +import File from './util/file.js'; +import config from './util/config.js'; +import Init from './util/init.js'; +import InitGit from './util/init.git.js'; +import Cli from './util/cli.js'; +import DevOps from './util/devops.js'; +import BuHelper from './util/businessUnit.js'; +import Builder from './Builder.js'; +import Deployer from './Deployer.js'; +import MetadataTypeInfo from './MetadataTypeInfo.js'; +import MetadataTypeDefinitions from './MetadataTypeDefinitions.js'; +import Retriever from './Retriever.js'; +import cache from './util/cache.js'; /** * main class diff --git a/lib/metadataTypes/Asset.js b/lib/metadataTypes/Asset.js index a9fa9a39f..88e3172ee 100644 --- a/lib/metadataTypes/Asset.js +++ b/lib/metadataTypes/Asset.js @@ -1,12 +1,12 @@ 'use strict'; -import MetadataType from './MetadataType'; -import TYPE from '../../types/mcdev.d'; -import Util from '../util/util'; -import File from '../util/file'; +import MetadataType from './MetadataType.js'; +// import TYPE from '../../types/mcdev.d.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; import pLimit from 'p-limit'; import cliProgress from 'cli-progress'; -import cache from '../util/cache'; +import cache from '../util/cache.js'; /** * FileTransfer MetadataType @@ -1631,6 +1631,8 @@ class Asset extends MetadataType { } // Assign definition to static attributes -Asset.definition = require('../MetadataTypeDefinitions').asset; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; + +Asset.definition = MetadataTypeDefinitions.asset; export default Asset; diff --git a/lib/metadataTypes/AttributeGroup.js b/lib/metadataTypes/AttributeGroup.js index ebe9b3183..7219ff8dc 100644 --- a/lib/metadataTypes/AttributeGroup.js +++ b/lib/metadataTypes/AttributeGroup.js @@ -1,7 +1,7 @@ 'use strict'; -import MetadataType from './MetadataType'; -import TYPE from '../../types/mcdev.d'; +import MetadataType from './MetadataType.js'; +// import TYPE from '../../types/mcdev.d.js'; /** * AttributeGroup MetadataType @@ -37,6 +37,7 @@ class AttributeGroup extends MetadataType { } // Assign definition to static attributes -AttributeGroup.definition = require('../MetadataTypeDefinitions').attributeGroup; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +AttributeGroup.definition = MetadataTypeDefinitions.attributeGroup; export default AttributeGroup; diff --git a/lib/metadataTypes/Automation.js b/lib/metadataTypes/Automation.js index 8c601c5da..7b8c5f16d 100644 --- a/lib/metadataTypes/Automation.js +++ b/lib/metadataTypes/Automation.js @@ -1,11 +1,11 @@ 'use strict'; -import MetadataType from './MetadataType'; -import TYPE from '../../types/mcdev.d'; -import Util from '../util/util'; -import File from '../util/file'; -import Definitions from '../MetadataTypeDefinitions'; -import cache from '../util/cache'; +import MetadataType from './MetadataType.js'; +// import TYPE from '../../types/mcdev.d.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; +import Definitions from '../MetadataTypeDefinitions.js'; +import cache from '../util/cache.js'; /** * Automation MetadataType diff --git a/lib/metadataTypes/Campaign.js b/lib/metadataTypes/Campaign.js index a907f3b2e..e0f01fb64 100644 --- a/lib/metadataTypes/Campaign.js +++ b/lib/metadataTypes/Campaign.js @@ -1,9 +1,9 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; -import File from '../util/file'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; /** * Campaign MetadataType @@ -71,6 +71,7 @@ class Campaign extends MetadataType { } } // Assign definition to static attributes -Campaign.definition = require('../MetadataTypeDefinitions').campaign; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +Campaign.definition = MetadataTypeDefinitions.campaign; export default Campaign; diff --git a/lib/metadataTypes/ContentArea.js b/lib/metadataTypes/ContentArea.js index f08ccd16c..35c3bc6e8 100644 --- a/lib/metadataTypes/ContentArea.js +++ b/lib/metadataTypes/ContentArea.js @@ -1,9 +1,9 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; +import cache from '../util/cache.js'; /** * ContentArea MetadataType @@ -99,6 +99,7 @@ class ContentArea extends MetadataType { } // Assign definition to static attributes -ContentArea.definition = require('../MetadataTypeDefinitions').contentArea; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +ContentArea.definition = MetadataTypeDefinitions.contentArea; export default ContentArea; diff --git a/lib/metadataTypes/DataExtension.js b/lib/metadataTypes/DataExtension.js index f2734a972..b4c9f5447 100644 --- a/lib/metadataTypes/DataExtension.js +++ b/lib/metadataTypes/DataExtension.js @@ -1,14 +1,14 @@ 'use strict'; import jsonToTable from 'json-to-table'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import DataExtensionField from './DataExtensionField'; -import Folder from './Folder'; -import Util from '../util/util'; -import File from '../util/file'; -import auth from '../util/auth'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import DataExtensionField from './DataExtensionField.js'; +import Folder from './Folder.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; +import auth from '../util/auth.js'; +import cache from '../util/cache.js'; /** * DataExtension MetadataType @@ -394,7 +394,7 @@ class DataExtension extends MetadataType { cache.mergeMetadata('folder', result.metadata, this.buObject.eid); // get the types and clean out non-shared ones - const folderTypesFromParent = require('../MetadataTypeDefinitions').folder + const folderTypesFromParent = require('../MetadataTypeDefinitions.js').folder .folderTypesFromParent; for (const metadataEntry in metadataParentBu) { try { @@ -1072,6 +1072,7 @@ class DataExtension extends MetadataType { } // Assign definition to static attributes -DataExtension.definition = require('../MetadataTypeDefinitions').dataExtension; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +DataExtension.definition = MetadataTypeDefinitions.dataExtension; export default DataExtension; diff --git a/lib/metadataTypes/DataExtensionField.js b/lib/metadataTypes/DataExtensionField.js index cced28c96..73ac2db67 100644 --- a/lib/metadataTypes/DataExtensionField.js +++ b/lib/metadataTypes/DataExtensionField.js @@ -1,8 +1,8 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; /** * DataExtensionField MetadataType @@ -333,6 +333,6 @@ class DataExtensionField extends MetadataType { } // Assign definition to static attributes -DataExtensionField.definition = require('../MetadataTypeDefinitions').dataExtensionField; +DataExtensionField.definition = require('../MetadataTypeDefinitions.js').dataExtensionField; export default DataExtensionField; diff --git a/lib/metadataTypes/DataExtensionTemplate.js b/lib/metadataTypes/DataExtensionTemplate.js index 928e40b4f..ec0b8fe84 100644 --- a/lib/metadataTypes/DataExtensionTemplate.js +++ b/lib/metadataTypes/DataExtensionTemplate.js @@ -1,7 +1,7 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; /** * DataExtensionTemplate MetadataType @@ -35,6 +35,6 @@ class DataExtensionTemplate extends MetadataType { } // Assign definition to static attributes -DataExtensionTemplate.definition = require('../MetadataTypeDefinitions').dataExtensionTemplate; +DataExtensionTemplate.definition = require('../MetadataTypeDefinitions.js').dataExtensionTemplate; export default DataExtensionTemplate; diff --git a/lib/metadataTypes/DataExtract.js b/lib/metadataTypes/DataExtract.js index 94f7f85af..b545f1131 100644 --- a/lib/metadataTypes/DataExtract.js +++ b/lib/metadataTypes/DataExtract.js @@ -1,10 +1,10 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; -import File from '../util/file'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; +import cache from '../util/cache.js'; /** * DataExtract MetadataType @@ -160,6 +160,6 @@ class DataExtract extends MetadataType { } // Assign definition to static attributes -DataExtract.definition = require('../MetadataTypeDefinitions').dataExtract; +DataExtract.definition = require('../MetadataTypeDefinitions.js').dataExtract; export default DataExtract; diff --git a/lib/metadataTypes/DataExtractType.js b/lib/metadataTypes/DataExtractType.js index a056a8eaa..112b591a6 100644 --- a/lib/metadataTypes/DataExtractType.js +++ b/lib/metadataTypes/DataExtractType.js @@ -1,7 +1,7 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; /** * DataExtractType MetadataType @@ -34,6 +34,6 @@ class DataExtractType extends MetadataType { } // Assign definition to static attributes -DataExtractType.definition = require('../MetadataTypeDefinitions').dataExtractType; +DataExtractType.definition = require('../MetadataTypeDefinitions.js').dataExtractType; export default DataExtractType; diff --git a/lib/metadataTypes/Discovery.js b/lib/metadataTypes/Discovery.js index a8de9678d..e94d3e06e 100644 --- a/lib/metadataTypes/Discovery.js +++ b/lib/metadataTypes/Discovery.js @@ -1,8 +1,8 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; /** * ImportFile MetadataType @@ -48,6 +48,6 @@ class Discovery extends MetadataType { } // Assign definition to static attributes -Discovery.definition = require('../MetadataTypeDefinitions').discovery; +Discovery.definition = require('../MetadataTypeDefinitions.js').discovery; export default Discovery; diff --git a/lib/metadataTypes/Email.js b/lib/metadataTypes/Email.js index 3354bf2a7..612920812 100644 --- a/lib/metadataTypes/Email.js +++ b/lib/metadataTypes/Email.js @@ -1,8 +1,8 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; /** * Email MetadataType @@ -87,6 +87,6 @@ class Email extends MetadataType { } // Assign definition to static attributes -Email.definition = require('../MetadataTypeDefinitions').email; +Email.definition = require('../MetadataTypeDefinitions.js').email; export default Email; diff --git a/lib/metadataTypes/EmailSend.js b/lib/metadataTypes/EmailSend.js index d492ae01c..231a69c69 100644 --- a/lib/metadataTypes/EmailSend.js +++ b/lib/metadataTypes/EmailSend.js @@ -1,9 +1,9 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; +import cache from '../util/cache.js'; /** * MessageSendActivity MetadataType @@ -292,6 +292,6 @@ class EmailSend extends MetadataType { } // Assign definition to static attributes -EmailSend.definition = require('../MetadataTypeDefinitions').emailSend; +EmailSend.definition = require('../MetadataTypeDefinitions.js').emailSend; export default EmailSend; diff --git a/lib/metadataTypes/Event.js b/lib/metadataTypes/Event.js index 49322f1e5..4eac34dbb 100644 --- a/lib/metadataTypes/Event.js +++ b/lib/metadataTypes/Event.js @@ -1,10 +1,10 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; -import File from '../util/file'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; +import cache from '../util/cache.js'; /** * Event MetadataType @@ -214,6 +214,6 @@ class Event extends MetadataType { } // Assign definition to static attributes -Event.definition = require('../MetadataTypeDefinitions').event; +Event.definition = require('../MetadataTypeDefinitions.js').event; export default Event; diff --git a/lib/metadataTypes/FileLocation.js b/lib/metadataTypes/FileLocation.js index 8d5c36f6d..397557568 100644 --- a/lib/metadataTypes/FileLocation.js +++ b/lib/metadataTypes/FileLocation.js @@ -1,7 +1,7 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; /** * ImportFile MetadataType @@ -34,6 +34,6 @@ class FtpLocation extends MetadataType { } // Assign definition to static attributes -FtpLocation.definition = require('../MetadataTypeDefinitions').fileLocation; +FtpLocation.definition = require('../MetadataTypeDefinitions.js').fileLocation; export default FtpLocation; diff --git a/lib/metadataTypes/FileTransfer.js b/lib/metadataTypes/FileTransfer.js index 4c89e924c..a6cfd49b7 100644 --- a/lib/metadataTypes/FileTransfer.js +++ b/lib/metadataTypes/FileTransfer.js @@ -1,10 +1,10 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; -import File from '../util/file'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; +import cache from '../util/cache.js'; /** * FileTransfer MetadataType @@ -165,6 +165,6 @@ class FileTransfer extends MetadataType { } // Assign definition to static attributes -FileTransfer.definition = require('../MetadataTypeDefinitions').fileTransfer; +FileTransfer.definition = require('../MetadataTypeDefinitions.js').fileTransfer; export default FileTransfer; diff --git a/lib/metadataTypes/Filter.js b/lib/metadataTypes/Filter.js index 9a09a0e2c..978a930bf 100644 --- a/lib/metadataTypes/Filter.js +++ b/lib/metadataTypes/Filter.js @@ -1,7 +1,7 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; /** * Filter MetadataType @@ -27,6 +27,6 @@ class Filter extends MetadataType { } // Assign definition to static attributes -Filter.definition = require('../MetadataTypeDefinitions').filter; +Filter.definition = require('../MetadataTypeDefinitions.js').filter; export default Filter; diff --git a/lib/metadataTypes/Folder.js b/lib/metadataTypes/Folder.js index 01d48e21b..709ca4063 100644 --- a/lib/metadataTypes/Folder.js +++ b/lib/metadataTypes/Folder.js @@ -1,11 +1,11 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; import toposort from 'toposort'; -import Util from '../util/util'; -import File from '../util/file'; -import cache from '../util/cache'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; +import cache from '../util/cache.js'; /** * Folder MetadataType @@ -629,6 +629,6 @@ class Folder extends MetadataType { } // Assign definition to static attributes -Folder.definition = require('../MetadataTypeDefinitions').folder; +Folder.definition = require('../MetadataTypeDefinitions.js').folder; export default Folder; diff --git a/lib/metadataTypes/ImportFile.js b/lib/metadataTypes/ImportFile.js index e298213f3..8f1c347dd 100644 --- a/lib/metadataTypes/ImportFile.js +++ b/lib/metadataTypes/ImportFile.js @@ -1,10 +1,10 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; -import File from '../util/file'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; +import cache from '../util/cache.js'; /** * ImportFile MetadataType @@ -232,6 +232,6 @@ class ImportFile extends MetadataType { } // Assign definition to static attributes -ImportFile.definition = require('../MetadataTypeDefinitions').importFile; +ImportFile.definition = require('../MetadataTypeDefinitions.js').importFile; export default ImportFile; diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index 34226c94f..159cc0bac 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -1,11 +1,11 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import TransactionalEmail from './TransactionalEmail'; -import Util from '../util/util'; -import cache from '../util/cache'; -import File from '../util/file'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import TransactionalEmail from './TransactionalEmail.js'; +import { Util } from '../util/util.js'; +import cache from '../util/cache.js'; +import File from '../util/file.js'; /** * Journey MetadataType @@ -957,6 +957,6 @@ class Journey extends MetadataType { } // Assign definition to static attributes -Journey.definition = require('../MetadataTypeDefinitions').journey; +Journey.definition = require('../MetadataTypeDefinitions.js').journey; export default Journey; diff --git a/lib/metadataTypes/List.js b/lib/metadataTypes/List.js index a51f93169..fb5e2842f 100644 --- a/lib/metadataTypes/List.js +++ b/lib/metadataTypes/List.js @@ -1,11 +1,11 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Folder from './Folder'; -import Util from '../util/util'; -import cache from '../util/cache'; -import auth from '../util/auth'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import Folder from './Folder.js'; +import { Util } from '../util/util.js'; +import cache from '../util/cache.js'; +import auth from '../util/auth.js'; /** * List MetadataType @@ -205,6 +205,6 @@ class List extends MetadataType { } } // Assign definition to static attributes -List.definition = require('../MetadataTypeDefinitions').list; +List.definition = require('../MetadataTypeDefinitions.js').list; export default List; diff --git a/lib/metadataTypes/MetadataType.js b/lib/metadataTypes/MetadataType.js index 044795c41..5ecf5c06f 100644 --- a/lib/metadataTypes/MetadataType.js +++ b/lib/metadataTypes/MetadataType.js @@ -7,11 +7,11 @@ * in the generic version of the method */ -import TYPE from '../../types/mcdev.d'; +// import TYPE from '../../types/mcdev.d.js'; -import Util from '../util/util'; -import File from '../util/file'; -import cache from '../util/cache'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; +import cache from '../util/cache.js'; import deepEqual from 'deep-equal'; import pLimit from 'p-limit'; import Mustache from 'mustache'; diff --git a/lib/metadataTypes/MobileCode.js b/lib/metadataTypes/MobileCode.js index fce938f55..af755f369 100644 --- a/lib/metadataTypes/MobileCode.js +++ b/lib/metadataTypes/MobileCode.js @@ -1,7 +1,7 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; /** * MobileCode MetadataType @@ -39,6 +39,6 @@ class MobileCode extends MetadataType { } // Assign definition to static attributes -MobileCode.definition = require('../MetadataTypeDefinitions').mobileCode; +MobileCode.definition = require('../MetadataTypeDefinitions.js').mobileCode; export default MobileCode; diff --git a/lib/metadataTypes/MobileKeyword.js b/lib/metadataTypes/MobileKeyword.js index c32e2bcd2..a18ac03c1 100644 --- a/lib/metadataTypes/MobileKeyword.js +++ b/lib/metadataTypes/MobileKeyword.js @@ -1,10 +1,10 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; -import File from '../util/file'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; +import cache from '../util/cache.js'; /** * MobileKeyword MetadataType @@ -380,6 +380,6 @@ class MobileKeyword extends MetadataType { } // Assign definition to static attributes -MobileKeyword.definition = require('../MetadataTypeDefinitions').mobileKeyword; +MobileKeyword.definition = require('../MetadataTypeDefinitions.js').mobileKeyword; export default MobileKeyword; diff --git a/lib/metadataTypes/MobileMessage.js b/lib/metadataTypes/MobileMessage.js index de52c4b1e..256545f6e 100644 --- a/lib/metadataTypes/MobileMessage.js +++ b/lib/metadataTypes/MobileMessage.js @@ -1,10 +1,10 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; -import File from '../util/file'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; +import cache from '../util/cache.js'; /** * MobileMessage MetadataType @@ -458,6 +458,6 @@ class MobileMessage extends MetadataType { } // Assign definition to static attributes -MobileMessage.definition = require('../MetadataTypeDefinitions').mobileMessage; +MobileMessage.definition = require('../MetadataTypeDefinitions.js').mobileMessage; export default MobileMessage; diff --git a/lib/metadataTypes/Query.js b/lib/metadataTypes/Query.js index 03e29a575..028c86c87 100644 --- a/lib/metadataTypes/Query.js +++ b/lib/metadataTypes/Query.js @@ -1,10 +1,10 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import Util from '../util/util'; -import MetadataType from './MetadataType'; -import File from '../util/file'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import { Util } from '../util/util.js'; +import MetadataType from './MetadataType.js'; +import File from '../util/file.js'; +import cache from '../util/cache.js'; import Mustache from 'mustache'; /** * ensure that Mustache does not escape any characters @@ -429,6 +429,6 @@ class Query extends MetadataType { } // Assign definition & cache to static attributes -Query.definition = require('../MetadataTypeDefinitions').query; +Query.definition = require('../MetadataTypeDefinitions.js').query; export default Query; diff --git a/lib/metadataTypes/Role.js b/lib/metadataTypes/Role.js index 76425307a..97b996ef6 100644 --- a/lib/metadataTypes/Role.js +++ b/lib/metadataTypes/Role.js @@ -1,10 +1,10 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; -import File from '../util/file'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; +import cache from '../util/cache.js'; /** * ImportFile MetadataType @@ -326,6 +326,6 @@ class Role extends MetadataType { } // Assign definition to static attributes -Role.definition = require('../MetadataTypeDefinitions').role; +Role.definition = require('../MetadataTypeDefinitions.js').role; export default Role; diff --git a/lib/metadataTypes/Script.js b/lib/metadataTypes/Script.js index fc66986c0..9927d2234 100644 --- a/lib/metadataTypes/Script.js +++ b/lib/metadataTypes/Script.js @@ -1,9 +1,9 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; -import File from '../util/file'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; /** * Script MetadataType @@ -327,6 +327,6 @@ class Script extends MetadataType { } // Assign definition & cache to static attributes -Script.definition = require('../MetadataTypeDefinitions').script; +Script.definition = require('../MetadataTypeDefinitions.js').script; export default Script; diff --git a/lib/metadataTypes/SendClassification.js b/lib/metadataTypes/SendClassification.js index 20c39ea59..d67833506 100644 --- a/lib/metadataTypes/SendClassification.js +++ b/lib/metadataTypes/SendClassification.js @@ -1,7 +1,7 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; /** * SendClassification MetadataType @@ -35,6 +35,6 @@ class SendClassification extends MetadataType { } // Assign definition to static attributes -SendClassification.definition = require('../MetadataTypeDefinitions').sendClassification; +SendClassification.definition = require('../MetadataTypeDefinitions.js').sendClassification; export default SendClassification; diff --git a/lib/metadataTypes/SetDefinition.js b/lib/metadataTypes/SetDefinition.js index bb8b1a75e..765ab66db 100644 --- a/lib/metadataTypes/SetDefinition.js +++ b/lib/metadataTypes/SetDefinition.js @@ -1,7 +1,7 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; /** * SetDefinition MetadataType @@ -32,6 +32,6 @@ class SetDefinition extends MetadataType { } // Assign definition to static attributes -SetDefinition.definition = require('../MetadataTypeDefinitions').setDefinition; +SetDefinition.definition = require('../MetadataTypeDefinitions.js').setDefinition; export default SetDefinition; diff --git a/lib/metadataTypes/TransactionalEmail.js b/lib/metadataTypes/TransactionalEmail.js index c33e64bf2..86aece928 100644 --- a/lib/metadataTypes/TransactionalEmail.js +++ b/lib/metadataTypes/TransactionalEmail.js @@ -1,9 +1,9 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import TransactionalMessage from './TransactionalMessage'; -import Util from '../util/util'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import TransactionalMessage from './TransactionalMessage.js'; +import { Util } from '../util/util.js'; +import cache from '../util/cache.js'; /** * TransactionalEmail MetadataType @@ -157,6 +157,6 @@ class TransactionalEmail extends TransactionalMessage { } // Assign definition to static attributes -TransactionalEmail.definition = require('../MetadataTypeDefinitions').transactionalEmail; +TransactionalEmail.definition = require('../MetadataTypeDefinitions.js').transactionalEmail; export default TransactionalEmail; diff --git a/lib/metadataTypes/TransactionalMessage.js b/lib/metadataTypes/TransactionalMessage.js index 63e6d316c..b7ce79d9b 100644 --- a/lib/metadataTypes/TransactionalMessage.js +++ b/lib/metadataTypes/TransactionalMessage.js @@ -1,8 +1,8 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; /** * TransactionalMessage MetadataType @@ -114,6 +114,6 @@ class TransactionalMessage extends MetadataType { // Assign definition to static attributes // ! using SMS definitions here as placeholder to have auto completion -TransactionalMessage.definition = require('../MetadataTypeDefinitions').transactionalSMS; +TransactionalMessage.definition = require('../MetadataTypeDefinitions.js').transactionalSMS; export default TransactionalMessage; diff --git a/lib/metadataTypes/TransactionalPush.js b/lib/metadataTypes/TransactionalPush.js index 978037867..120e4b5ae 100644 --- a/lib/metadataTypes/TransactionalPush.js +++ b/lib/metadataTypes/TransactionalPush.js @@ -1,9 +1,9 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import TransactionalMessage from './TransactionalMessage'; -import Util from '../util/util'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import TransactionalMessage from './TransactionalMessage.js'; +import { Util } from '../util/util.js'; +import cache from '../util/cache.js'; /** * TransactionalPush TransactionalMessage @@ -72,6 +72,6 @@ class TransactionalPush extends TransactionalMessage { } // Assign definition to static attributes -TransactionalPush.definition = require('../MetadataTypeDefinitions').transactionalPush; +TransactionalPush.definition = require('../MetadataTypeDefinitions.js').transactionalPush; export default TransactionalPush; diff --git a/lib/metadataTypes/TransactionalSMS.js b/lib/metadataTypes/TransactionalSMS.js index 00569c3fd..bda5b4084 100644 --- a/lib/metadataTypes/TransactionalSMS.js +++ b/lib/metadataTypes/TransactionalSMS.js @@ -1,11 +1,11 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import TransactionalMessage from './TransactionalMessage'; -import Util from '../util/util'; -import File from '../util/file'; +// import TYPE from '../../types/mcdev.d.js'; +import TransactionalMessage from './TransactionalMessage.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; import beautifier from 'beauty-amp-core'; -import cache from '../util/cache'; +import cache from '../util/cache.js'; /** * TransactionalSMS MetadataType @@ -341,6 +341,6 @@ class TransactionalSMS extends TransactionalMessage { } // Assign definition to static attributes -TransactionalSMS.definition = require('../MetadataTypeDefinitions').transactionalSMS; +TransactionalSMS.definition = require('../MetadataTypeDefinitions.js').transactionalSMS; export default TransactionalSMS; diff --git a/lib/metadataTypes/TriggeredSend.js b/lib/metadataTypes/TriggeredSend.js index 0d150418d..5ea408c5f 100644 --- a/lib/metadataTypes/TriggeredSend.js +++ b/lib/metadataTypes/TriggeredSend.js @@ -1,12 +1,12 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; -import cache from '../util/cache'; -import asset from './Asset'; -import folder from './Folder'; -import list from './List'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; +import cache from '../util/cache.js'; +import asset from './Asset.js'; +import folder from './Folder.js'; +import list from './List.js'; const cacheTypes = { asset, @@ -434,6 +434,6 @@ class TriggeredSend extends MetadataType { } // Assign definition to static attributes -TriggeredSend.definition = require('../MetadataTypeDefinitions').triggeredSend; +TriggeredSend.definition = require('../MetadataTypeDefinitions.js').triggeredSend; export default TriggeredSend; diff --git a/lib/metadataTypes/User.js b/lib/metadataTypes/User.js index 07494afa2..8f0cfeb58 100644 --- a/lib/metadataTypes/User.js +++ b/lib/metadataTypes/User.js @@ -1,10 +1,10 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataType from './MetadataType'; -import Util from '../util/util'; -import File from '../util/file'; -import cache from '../util/cache'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataType from './MetadataType.js'; +import { Util } from '../util/util.js'; +import File from '../util/file.js'; +import cache from '../util/cache.js'; /** * MetadataType @@ -1172,6 +1172,6 @@ class User extends MetadataType { } // Assign definition to static attributes -User.definition = require('../MetadataTypeDefinitions').user; +User.definition = require('../MetadataTypeDefinitions.js').user; export default User; diff --git a/lib/retrieveChangelog.js b/lib/retrieveChangelog.js index 0b9d8ac89..e0fe55ad3 100644 --- a/lib/retrieveChangelog.js +++ b/lib/retrieveChangelog.js @@ -16,10 +16,10 @@ }] */ -import mcdev from './index'; +import mcdev from './index.js'; -import Definition from './MetadataTypeDefinitions'; -import MetadataType from './MetadataTypeInfo'; +import Definition from './MetadataTypeDefinitions.js'; +import MetadataType from './MetadataTypeInfo.js'; // disable cli logs // mcdev._setLoggingLevel({ silent: true }); diff --git a/lib/util/auth.js b/lib/util/auth.js index 8cdb9ed3b..e33fbc472 100644 --- a/lib/util/auth.js +++ b/lib/util/auth.js @@ -1,6 +1,6 @@ -import TYPE from '../../types/mcdev.d'; -import Util from './util'; -import File from './file'; +// import TYPE from '../../types/mcdev.d.js'; +import { Util } from './util.js'; +import File from './file.js'; import SDK from 'sfmc-sdk'; import Conf from 'conf'; const credentialStore = new Conf({ configName: 'sessions', clearInvalidConfig: true }); diff --git a/lib/util/businessUnit.js b/lib/util/businessUnit.js index c58170fc9..7489ae1ac 100644 --- a/lib/util/businessUnit.js +++ b/lib/util/businessUnit.js @@ -1,9 +1,9 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import Util from './util'; -import File from './file'; -import auth from './auth'; +// import TYPE from '../../types/mcdev.d.js'; +import { Util } from './util.js'; +import File from './file.js'; +import auth from './auth.js'; /** * Helper that handles retrieval of BU info diff --git a/lib/util/cache.js b/lib/util/cache.js index d1cdba36b..52046cf27 100644 --- a/lib/util/cache.js +++ b/lib/util/cache.js @@ -1,5 +1,5 @@ -import TYPE from '../../types/mcdev.d'; -import Util from './util'; +// import TYPE from '../../types/mcdev.d.js'; +import { Util } from './util.js'; /** @type {TYPE.Cache} */ const dataStore = {}; diff --git a/lib/util/cli.js b/lib/util/cli.js index d748f7a24..572728698 100644 --- a/lib/util/cli.js +++ b/lib/util/cli.js @@ -1,13 +1,13 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import BuHelper from './businessUnit'; -import File from './file'; -import config from './config'; +// import TYPE from '../../types/mcdev.d.js'; +import BuHelper from './businessUnit.js'; +import File from './file.js'; +import config from './config.js'; import inquirer from 'inquirer'; -import MetadataDefinitions from './../MetadataTypeDefinitions'; -import Util from './util'; -import auth from './auth'; +import MetadataDefinitions from './../MetadataTypeDefinitions.js'; +import { Util } from './util.js'; +import auth from './auth.js'; import 'console.table'; /** diff --git a/lib/util/config.js b/lib/util/config.js index 375fab40a..03245403e 100644 --- a/lib/util/config.js +++ b/lib/util/config.js @@ -1,6 +1,6 @@ -import TYPE from '../../types/mcdev.d'; -import Util from './util'; -import File from './file'; +// import TYPE from '../../types/mcdev.d.js'; +import { Util } from './util.js'; +import File from './file.js'; import inquirer from 'inquirer'; import semver from 'semver'; import path from 'node:path'; diff --git a/lib/util/devops.js b/lib/util/devops.js index 82641ca92..582353b56 100644 --- a/lib/util/devops.js +++ b/lib/util/devops.js @@ -1,13 +1,13 @@ -import TYPE from '../../types/mcdev.d'; -import File from './file'; +// import TYPE from '../../types/mcdev.d.js'; +import File from './file.js'; import path from 'node:path'; import inquirer from 'inquirer'; -import Util from './util'; -import Cli from './cli'; +import { Util } from './util.js'; +import Cli from './cli.js'; import gitFactory from 'simple-git'; const git = gitFactory(); -import Builder from '../Builder'; -import MetadataType from '../MetadataTypeInfo'; +import Builder from '../Builder.js'; +import MetadataType from '../MetadataTypeInfo.js'; import jsonToTable from 'json-to-table'; /** * DevOps helper class diff --git a/lib/util/file.js b/lib/util/file.js index 173fce1de..c9dabd2bb 100644 --- a/lib/util/file.js +++ b/lib/util/file.js @@ -1,13 +1,13 @@ /* eslint-disable no-control-regex */ 'use strict'; -import TYPE from '../../types/mcdev.d'; +// import TYPE from '../../types/mcdev.d.js'; import fs from 'fs-extra'; -import packageJson from '../../package.json'; +import packageJson from '../../package.json' assert { type: 'json' }; import path from 'node:path'; import prettier from 'prettier'; import beautyAmp from 'beauty-amp-core'; -import Util from './util'; +import { Util } from './util.js'; import updateNotifier from 'update-notifier'; // inform user when there is an update diff --git a/lib/util/init.config.js b/lib/util/init.config.js index 860e5756b..12c723726 100644 --- a/lib/util/init.config.js +++ b/lib/util/init.config.js @@ -1,10 +1,10 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import Cli from './cli'; -import File from './file'; -import config from './config'; -import Util from './util'; +// import TYPE from '../../types/mcdev.d.js'; +import Cli from './cli.js'; +import File from './file.js'; +import config from './config.js'; +import { Util } from './util.js'; import inquirer from 'inquirer'; import path from 'node:path'; import semver from 'semver'; diff --git a/lib/util/init.git.js b/lib/util/init.git.js index fc4d9d5ab..b72ae7fde 100644 --- a/lib/util/init.git.js +++ b/lib/util/init.git.js @@ -1,10 +1,10 @@ 'use strict'; // const TYPE = require('../../types/mcdev.d'); -import File from './file'; +import File from './file.js'; import inquirer from 'inquirer'; -import Util from './util'; +import { Util } from './util.js'; import commandExists from 'command-exists'; import gitFactory from 'simple-git'; const git = gitFactory(); diff --git a/lib/util/init.js b/lib/util/init.js index 7ecc6b409..e4c64d6b0 100644 --- a/lib/util/init.js +++ b/lib/util/init.js @@ -1,13 +1,13 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import Cli from './cli'; -import File from './file'; -import config from './config'; -import InitGit from './init.git'; -import InitNpm from './init.npm'; -import InitConfig from './init.config'; +// import TYPE from '../../types/mcdev.d.js'; +import Cli from './cli.js'; +import File from './file.js'; +import config from './config.js'; +import InitGit from './init.git.js'; +import InitNpm from './init.npm.js'; +import InitConfig from './init.config.js'; import inquirer from 'inquirer'; -import Util from './util'; +import { Util } from './util.js'; /** * CLI helper class diff --git a/lib/util/init.npm.js b/lib/util/init.npm.js index fe7f4f488..db1fed5f8 100644 --- a/lib/util/init.npm.js +++ b/lib/util/init.npm.js @@ -1,8 +1,8 @@ 'use strict'; -import File from './file'; +import File from './file.js'; import path from 'node:path'; -import Util from './util'; +import { Util } from './util.js'; import semver from 'semver'; /** diff --git a/lib/util/util.js b/lib/util/util.js index 8d101baeb..5c03cbccf 100644 --- a/lib/util/util.js +++ b/lib/util/util.js @@ -1,8 +1,8 @@ 'use strict'; -import TYPE from '../../types/mcdev.d'; -import MetadataDefinitions from './../MetadataTypeDefinitions'; -import packageJsonMcdev from '../../package.json'; +// import TYPE from '../../types/mcdev.d.js'; +import MetadataDefinitions from './../MetadataTypeDefinitions.js'; +import packageJsonMcdev from '../../package.json' assert { type: 'json' }; import process from 'node:process'; import toposort from 'toposort'; import winston from 'winston'; @@ -11,7 +11,7 @@ import child_process from 'node:child_process'; /** * Util that contains logger and simple util methods */ -const Util = { +export const Util = { authFileName: '.mcdev-auth.json', boilerplateDirectory: '../../boilerplate', configFileName: '.mcdevrc.json', @@ -754,5 +754,3 @@ function startLogger() { Util.logger.debug(`:: mcdev ${packageJsonMcdev.version} ::`); } startLogger(); - -export default Util; diff --git a/package.json b/package.json index 443cda6b7..caa8c2915 100644 --- a/package.json +++ b/package.json @@ -106,8 +106,7 @@ "fsevents": "*" }, "lint-staged": { - "*.{js,jsx,ts,tsx}": [ - "eslint --fix" - ] - } + "*.{js,jsx,ts,tsx}": ["eslint --fix"] + }, + "type": "module" } From deedd2a15004a4d43136950400b860b78c47f0b5 Mon Sep 17 00:00:00 2001 From: Douglas Midgley Date: Mon, 8 May 2023 23:22:47 +0200 Subject: [PATCH 03/48] #354: removed all require() and yargs runs --- lib/cli.js | 6 +++--- lib/metadataTypes/DataExtensionField.js | 3 ++- lib/metadataTypes/DataExtensionTemplate.js | 3 ++- lib/metadataTypes/DataExtract.js | 3 ++- lib/metadataTypes/DataExtractType.js | 3 ++- lib/metadataTypes/Discovery.js | 3 ++- lib/metadataTypes/Email.js | 3 ++- lib/metadataTypes/EmailSend.js | 3 ++- lib/metadataTypes/Event.js | 3 ++- lib/metadataTypes/FileLocation.js | 3 ++- lib/metadataTypes/FileTransfer.js | 3 ++- lib/metadataTypes/Filter.js | 3 ++- lib/metadataTypes/Folder.js | 3 ++- lib/metadataTypes/ImportFile.js | 3 ++- lib/metadataTypes/Journey.js | 3 ++- lib/metadataTypes/List.js | 3 ++- lib/metadataTypes/MobileCode.js | 3 ++- lib/metadataTypes/MobileKeyword.js | 3 ++- lib/metadataTypes/MobileMessage.js | 3 ++- lib/metadataTypes/Query.js | 3 ++- lib/metadataTypes/Role.js | 3 ++- lib/metadataTypes/Script.js | 3 ++- lib/metadataTypes/SendClassification.js | 3 ++- lib/metadataTypes/SetDefinition.js | 3 ++- lib/metadataTypes/TransactionalEmail.js | 3 ++- lib/metadataTypes/TransactionalMessage.js | 3 ++- lib/metadataTypes/TransactionalPush.js | 3 ++- lib/metadataTypes/TransactionalSMS.js | 3 ++- lib/metadataTypes/TriggeredSend.js | 3 ++- lib/metadataTypes/User.js | 3 ++- 30 files changed, 61 insertions(+), 32 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index 567e0abf2..c3eecd568 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -7,9 +7,9 @@ import { Util } from './util/util.js'; import yargs from 'yargs'; +import { hideBin } from 'yargs/helpers'; import Mcdev from './index.js'; - -yargs +yargs(hideBin(process.argv)) .scriptName('mcdev') .usage('$0 [options]') .command({ @@ -411,7 +411,7 @@ yargs .demandCommand(1, 'Please enter a valid command') .strict() .recommendCommands() - .wrap(yargs.terminalWidth()) + .wrap(yargs(hideBin(process.argv)).terminalWidth()) .epilog( 'Copyright 2023. Accenture. Get support at https://github.com/Accenture/sfmc-devtools/issues' ) diff --git a/lib/metadataTypes/DataExtensionField.js b/lib/metadataTypes/DataExtensionField.js index 73ac2db67..5a72076de 100644 --- a/lib/metadataTypes/DataExtensionField.js +++ b/lib/metadataTypes/DataExtensionField.js @@ -333,6 +333,7 @@ class DataExtensionField extends MetadataType { } // Assign definition to static attributes -DataExtensionField.definition = require('../MetadataTypeDefinitions.js').dataExtensionField; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +DataExtensionField.definition = MetadataTypeDefinitions.dataExtensionField; export default DataExtensionField; diff --git a/lib/metadataTypes/DataExtensionTemplate.js b/lib/metadataTypes/DataExtensionTemplate.js index ec0b8fe84..7175a28df 100644 --- a/lib/metadataTypes/DataExtensionTemplate.js +++ b/lib/metadataTypes/DataExtensionTemplate.js @@ -35,6 +35,7 @@ class DataExtensionTemplate extends MetadataType { } // Assign definition to static attributes -DataExtensionTemplate.definition = require('../MetadataTypeDefinitions.js').dataExtensionTemplate; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +DataExtensionTemplate.definition = MetadataTypeDefinitions.dataExtensionTemplate; export default DataExtensionTemplate; diff --git a/lib/metadataTypes/DataExtract.js b/lib/metadataTypes/DataExtract.js index b545f1131..17cf4e4a0 100644 --- a/lib/metadataTypes/DataExtract.js +++ b/lib/metadataTypes/DataExtract.js @@ -160,6 +160,7 @@ class DataExtract extends MetadataType { } // Assign definition to static attributes -DataExtract.definition = require('../MetadataTypeDefinitions.js').dataExtract; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +DataExtract.definition = MetadataTypeDefinitions.dataExtract; export default DataExtract; diff --git a/lib/metadataTypes/DataExtractType.js b/lib/metadataTypes/DataExtractType.js index 112b591a6..ef0150e2b 100644 --- a/lib/metadataTypes/DataExtractType.js +++ b/lib/metadataTypes/DataExtractType.js @@ -34,6 +34,7 @@ class DataExtractType extends MetadataType { } // Assign definition to static attributes -DataExtractType.definition = require('../MetadataTypeDefinitions.js').dataExtractType; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +DataExtractType.definition = MetadataTypeDefinitions.dataExtractType; export default DataExtractType; diff --git a/lib/metadataTypes/Discovery.js b/lib/metadataTypes/Discovery.js index e94d3e06e..251054125 100644 --- a/lib/metadataTypes/Discovery.js +++ b/lib/metadataTypes/Discovery.js @@ -48,6 +48,7 @@ class Discovery extends MetadataType { } // Assign definition to static attributes -Discovery.definition = require('../MetadataTypeDefinitions.js').discovery; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +Discovery.definition = MetadataTypeDefinitions.discovery; export default Discovery; diff --git a/lib/metadataTypes/Email.js b/lib/metadataTypes/Email.js index 612920812..6c25efa92 100644 --- a/lib/metadataTypes/Email.js +++ b/lib/metadataTypes/Email.js @@ -87,6 +87,7 @@ class Email extends MetadataType { } // Assign definition to static attributes -Email.definition = require('../MetadataTypeDefinitions.js').email; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +Email.definition = MetadataTypeDefinitions.email; export default Email; diff --git a/lib/metadataTypes/EmailSend.js b/lib/metadataTypes/EmailSend.js index 231a69c69..df95bea5b 100644 --- a/lib/metadataTypes/EmailSend.js +++ b/lib/metadataTypes/EmailSend.js @@ -292,6 +292,7 @@ class EmailSend extends MetadataType { } // Assign definition to static attributes -EmailSend.definition = require('../MetadataTypeDefinitions.js').emailSend; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +EmailSend.definition = MetadataTypeDefinitions.emailSend; export default EmailSend; diff --git a/lib/metadataTypes/Event.js b/lib/metadataTypes/Event.js index 4eac34dbb..8483fcf96 100644 --- a/lib/metadataTypes/Event.js +++ b/lib/metadataTypes/Event.js @@ -214,6 +214,7 @@ class Event extends MetadataType { } // Assign definition to static attributes -Event.definition = require('../MetadataTypeDefinitions.js').event; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +Event.definition = MetadataTypeDefinitions.event; export default Event; diff --git a/lib/metadataTypes/FileLocation.js b/lib/metadataTypes/FileLocation.js index 397557568..2bb4eaa3e 100644 --- a/lib/metadataTypes/FileLocation.js +++ b/lib/metadataTypes/FileLocation.js @@ -34,6 +34,7 @@ class FtpLocation extends MetadataType { } // Assign definition to static attributes -FtpLocation.definition = require('../MetadataTypeDefinitions.js').fileLocation; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +FtpLocation.definition = MetadataTypeDefinitions.fileLocation; export default FtpLocation; diff --git a/lib/metadataTypes/FileTransfer.js b/lib/metadataTypes/FileTransfer.js index a6cfd49b7..e7de714ea 100644 --- a/lib/metadataTypes/FileTransfer.js +++ b/lib/metadataTypes/FileTransfer.js @@ -165,6 +165,7 @@ class FileTransfer extends MetadataType { } // Assign definition to static attributes -FileTransfer.definition = require('../MetadataTypeDefinitions.js').fileTransfer; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +FileTransfer.definition = MetadataTypeDefinitions.fileTransfer; export default FileTransfer; diff --git a/lib/metadataTypes/Filter.js b/lib/metadataTypes/Filter.js index 978a930bf..2d7f60999 100644 --- a/lib/metadataTypes/Filter.js +++ b/lib/metadataTypes/Filter.js @@ -27,6 +27,7 @@ class Filter extends MetadataType { } // Assign definition to static attributes -Filter.definition = require('../MetadataTypeDefinitions.js').filter; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +Filter.definition = MetadataTypeDefinitions.filter; export default Filter; diff --git a/lib/metadataTypes/Folder.js b/lib/metadataTypes/Folder.js index 709ca4063..d3f0b4488 100644 --- a/lib/metadataTypes/Folder.js +++ b/lib/metadataTypes/Folder.js @@ -629,6 +629,7 @@ class Folder extends MetadataType { } // Assign definition to static attributes -Folder.definition = require('../MetadataTypeDefinitions.js').folder; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +Folder.definition = MetadataTypeDefinitions.folder; export default Folder; diff --git a/lib/metadataTypes/ImportFile.js b/lib/metadataTypes/ImportFile.js index 8f1c347dd..c75abfab2 100644 --- a/lib/metadataTypes/ImportFile.js +++ b/lib/metadataTypes/ImportFile.js @@ -232,6 +232,7 @@ class ImportFile extends MetadataType { } // Assign definition to static attributes -ImportFile.definition = require('../MetadataTypeDefinitions.js').importFile; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +ImportFile.definition = MetadataTypeDefinitions.importFile; export default ImportFile; diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index 159cc0bac..ebc151b40 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -957,6 +957,7 @@ class Journey extends MetadataType { } // Assign definition to static attributes -Journey.definition = require('../MetadataTypeDefinitions.js').journey; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +Journey.definition = MetadataTypeDefinitions.journey; export default Journey; diff --git a/lib/metadataTypes/List.js b/lib/metadataTypes/List.js index fb5e2842f..cd5135c2c 100644 --- a/lib/metadataTypes/List.js +++ b/lib/metadataTypes/List.js @@ -205,6 +205,7 @@ class List extends MetadataType { } } // Assign definition to static attributes -List.definition = require('../MetadataTypeDefinitions.js').list; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +List.definition = MetadataTypeDefinitions.list; export default List; diff --git a/lib/metadataTypes/MobileCode.js b/lib/metadataTypes/MobileCode.js index af755f369..59c193029 100644 --- a/lib/metadataTypes/MobileCode.js +++ b/lib/metadataTypes/MobileCode.js @@ -39,6 +39,7 @@ class MobileCode extends MetadataType { } // Assign definition to static attributes -MobileCode.definition = require('../MetadataTypeDefinitions.js').mobileCode; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +MobileCode.definition = MetadataTypeDefinitions.mobileCode; export default MobileCode; diff --git a/lib/metadataTypes/MobileKeyword.js b/lib/metadataTypes/MobileKeyword.js index a18ac03c1..ff61697fb 100644 --- a/lib/metadataTypes/MobileKeyword.js +++ b/lib/metadataTypes/MobileKeyword.js @@ -380,6 +380,7 @@ class MobileKeyword extends MetadataType { } // Assign definition to static attributes -MobileKeyword.definition = require('../MetadataTypeDefinitions.js').mobileKeyword; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +MobileKeyword.definition = MetadataTypeDefinitions.mobileKeyword; export default MobileKeyword; diff --git a/lib/metadataTypes/MobileMessage.js b/lib/metadataTypes/MobileMessage.js index 256545f6e..291f821cd 100644 --- a/lib/metadataTypes/MobileMessage.js +++ b/lib/metadataTypes/MobileMessage.js @@ -458,6 +458,7 @@ class MobileMessage extends MetadataType { } // Assign definition to static attributes -MobileMessage.definition = require('../MetadataTypeDefinitions.js').mobileMessage; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +MobileMessage.definition = MetadataTypeDefinitions.mobileMessage; export default MobileMessage; diff --git a/lib/metadataTypes/Query.js b/lib/metadataTypes/Query.js index 028c86c87..ed8e45f97 100644 --- a/lib/metadataTypes/Query.js +++ b/lib/metadataTypes/Query.js @@ -429,6 +429,7 @@ class Query extends MetadataType { } // Assign definition & cache to static attributes -Query.definition = require('../MetadataTypeDefinitions.js').query; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +Query.definition = MetadataTypeDefinitions.query; export default Query; diff --git a/lib/metadataTypes/Role.js b/lib/metadataTypes/Role.js index 97b996ef6..9f6775654 100644 --- a/lib/metadataTypes/Role.js +++ b/lib/metadataTypes/Role.js @@ -326,6 +326,7 @@ class Role extends MetadataType { } // Assign definition to static attributes -Role.definition = require('../MetadataTypeDefinitions.js').role; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +Role.definition = MetadataTypeDefinitions.role; export default Role; diff --git a/lib/metadataTypes/Script.js b/lib/metadataTypes/Script.js index 9927d2234..2983e3532 100644 --- a/lib/metadataTypes/Script.js +++ b/lib/metadataTypes/Script.js @@ -327,6 +327,7 @@ class Script extends MetadataType { } // Assign definition & cache to static attributes -Script.definition = require('../MetadataTypeDefinitions.js').script; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +Script.definition = MetadataTypeDefinitions.script; export default Script; diff --git a/lib/metadataTypes/SendClassification.js b/lib/metadataTypes/SendClassification.js index d67833506..9408d62ef 100644 --- a/lib/metadataTypes/SendClassification.js +++ b/lib/metadataTypes/SendClassification.js @@ -35,6 +35,7 @@ class SendClassification extends MetadataType { } // Assign definition to static attributes -SendClassification.definition = require('../MetadataTypeDefinitions.js').sendClassification; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +SendClassification.definition = MetadataTypeDefinitions.sendClassification; export default SendClassification; diff --git a/lib/metadataTypes/SetDefinition.js b/lib/metadataTypes/SetDefinition.js index 765ab66db..87401077f 100644 --- a/lib/metadataTypes/SetDefinition.js +++ b/lib/metadataTypes/SetDefinition.js @@ -32,6 +32,7 @@ class SetDefinition extends MetadataType { } // Assign definition to static attributes -SetDefinition.definition = require('../MetadataTypeDefinitions.js').setDefinition; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +SetDefinition.definition = MetadataTypeDefinitions.setDefinition; export default SetDefinition; diff --git a/lib/metadataTypes/TransactionalEmail.js b/lib/metadataTypes/TransactionalEmail.js index 86aece928..07462af6a 100644 --- a/lib/metadataTypes/TransactionalEmail.js +++ b/lib/metadataTypes/TransactionalEmail.js @@ -157,6 +157,7 @@ class TransactionalEmail extends TransactionalMessage { } // Assign definition to static attributes -TransactionalEmail.definition = require('../MetadataTypeDefinitions.js').transactionalEmail; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +TransactionalEmail.definition = MetadataTypeDefinitions.transactionalEmail; export default TransactionalEmail; diff --git a/lib/metadataTypes/TransactionalMessage.js b/lib/metadataTypes/TransactionalMessage.js index b7ce79d9b..e1821fe0e 100644 --- a/lib/metadataTypes/TransactionalMessage.js +++ b/lib/metadataTypes/TransactionalMessage.js @@ -114,6 +114,7 @@ class TransactionalMessage extends MetadataType { // Assign definition to static attributes // ! using SMS definitions here as placeholder to have auto completion -TransactionalMessage.definition = require('../MetadataTypeDefinitions.js').transactionalSMS; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +TransactionalMessage.definition = MetadataTypeDefinitions.transactionalSMS; export default TransactionalMessage; diff --git a/lib/metadataTypes/TransactionalPush.js b/lib/metadataTypes/TransactionalPush.js index 120e4b5ae..820fb96fc 100644 --- a/lib/metadataTypes/TransactionalPush.js +++ b/lib/metadataTypes/TransactionalPush.js @@ -72,6 +72,7 @@ class TransactionalPush extends TransactionalMessage { } // Assign definition to static attributes -TransactionalPush.definition = require('../MetadataTypeDefinitions.js').transactionalPush; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +TransactionalPush.definition = MetadataTypeDefinitions.transactionalPush; export default TransactionalPush; diff --git a/lib/metadataTypes/TransactionalSMS.js b/lib/metadataTypes/TransactionalSMS.js index bda5b4084..10a4346cc 100644 --- a/lib/metadataTypes/TransactionalSMS.js +++ b/lib/metadataTypes/TransactionalSMS.js @@ -341,6 +341,7 @@ class TransactionalSMS extends TransactionalMessage { } // Assign definition to static attributes -TransactionalSMS.definition = require('../MetadataTypeDefinitions.js').transactionalSMS; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +TransactionalSMS.definition = MetadataTypeDefinitions.transactionalSMS; export default TransactionalSMS; diff --git a/lib/metadataTypes/TriggeredSend.js b/lib/metadataTypes/TriggeredSend.js index 5ea408c5f..3c659d68f 100644 --- a/lib/metadataTypes/TriggeredSend.js +++ b/lib/metadataTypes/TriggeredSend.js @@ -434,6 +434,7 @@ class TriggeredSend extends MetadataType { } // Assign definition to static attributes -TriggeredSend.definition = require('../MetadataTypeDefinitions.js').triggeredSend; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +TriggeredSend.definition = MetadataTypeDefinitions.triggeredSend; export default TriggeredSend; diff --git a/lib/metadataTypes/User.js b/lib/metadataTypes/User.js index 8f0cfeb58..d7c5afc74 100644 --- a/lib/metadataTypes/User.js +++ b/lib/metadataTypes/User.js @@ -1172,6 +1172,7 @@ class User extends MetadataType { } // Assign definition to static attributes -User.definition = require('../MetadataTypeDefinitions.js').user; +import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; +User.definition = MetadataTypeDefinitions.user; export default User; From f889c275394a7ad55ac6a691533d54dddc5d8a56 Mon Sep 17 00:00:00 2001 From: Douglas Midgley Date: Mon, 8 May 2023 23:24:15 +0200 Subject: [PATCH 04/48] #354: Test class bulk convert --- test/dataExtension.test.js | 8 ++++---- test/general.test.js | 8 ++++---- test/journey.test.js | 10 +++++----- test/mobileKeyword.test.js | 10 +++++----- test/mobileMessage.test.js | 10 +++++----- test/query.test.js | 12 +++++++----- test/resourceFactory.js | 22 +++++++++++++--------- test/transactionalEmail.test.js | 10 +++++----- test/transactionalPush.test.js | 10 +++++----- test/transactionalSMS.test.js | 10 +++++----- test/user.test.js | 8 ++++---- test/utils.js | 21 ++++++++++++--------- 12 files changed, 74 insertions(+), 65 deletions(-) diff --git a/test/dataExtension.test.js b/test/dataExtension.test.js index d6a0ae56a..081f018a0 100644 --- a/test/dataExtension.test.js +++ b/test/dataExtension.test.js @@ -1,7 +1,7 @@ -const assert = require('chai').assert; -const cache = require('../lib/util/cache'); -const testUtils = require('./utils'); -const handler = require('../lib/index'); +import { assert } from 'chai'; +import cache from '../lib/util/cache'; +import testUtils from './utils'; +import handler from '../lib/index'; describe('dataExtension', () => { beforeEach(() => { diff --git a/test/general.test.js b/test/general.test.js index 387c31050..6a049e19a 100644 --- a/test/general.test.js +++ b/test/general.test.js @@ -1,10 +1,10 @@ -const chai = require('chai'); -const chaiFiles = require('chai-files'); +import chai from 'chai'; +import chaiFiles from 'chai-files'; const assert = chai.assert; const expect = chai.expect; chai.use(chaiFiles); -const testUtils = require('./utils'); -const handler = require('../lib/index'); +import testUtils from './utils'; +import handler from '../lib/index'; describe('GENERAL', () => { beforeEach(() => { diff --git a/test/journey.test.js b/test/journey.test.js index b1be94bd6..c8be8df46 100644 --- a/test/journey.test.js +++ b/test/journey.test.js @@ -1,10 +1,10 @@ -const chai = require('chai'); -const chaiFiles = require('chai-files'); +import chai from 'chai'; +import chaiFiles from 'chai-files'; const assert = chai.assert; chai.use(chaiFiles); -const cache = require('../lib/util/cache'); -const testUtils = require('./utils'); -const handler = require('../lib/index'); +import cache from '../lib/util/cache'; +import testUtils from './utils'; +import handler from '../lib/index'; describe('journey', () => { beforeEach(() => { diff --git a/test/mobileKeyword.test.js b/test/mobileKeyword.test.js index 7b4a18277..837ba16ef 100644 --- a/test/mobileKeyword.test.js +++ b/test/mobileKeyword.test.js @@ -1,12 +1,12 @@ -const chai = require('chai'); -const chaiFiles = require('chai-files'); +import chai from 'chai'; +import chaiFiles from 'chai-files'; const assert = chai.assert; chai.use(chaiFiles); const expect = chai.expect; const file = chaiFiles.file; -const cache = require('../lib/util/cache'); -const testUtils = require('./utils'); -const handler = require('../lib/index'); +import cache from '../lib/util/cache'; +import testUtils from './utils'; +import handler from '../lib/index'; describe('mobileKeyword', () => { beforeEach(() => { diff --git a/test/mobileMessage.test.js b/test/mobileMessage.test.js index 70dc347cd..d44120a60 100644 --- a/test/mobileMessage.test.js +++ b/test/mobileMessage.test.js @@ -1,12 +1,12 @@ -const chai = require('chai'); -const chaiFiles = require('chai-files'); +import chai from 'chai'; +import chaiFiles from 'chai-files'; const assert = chai.assert; chai.use(chaiFiles); const expect = chai.expect; const file = chaiFiles.file; -const cache = require('../lib/util/cache'); -const testUtils = require('./utils'); -const handler = require('../lib/index'); +import cache from '../lib/util/cache'; +import testUtils from './utils'; +import handler from '../lib/index'; describe('mobileMessage', () => { beforeEach(() => { diff --git a/test/query.test.js b/test/query.test.js index 3fa8471a1..f4c504bb9 100644 --- a/test/query.test.js +++ b/test/query.test.js @@ -1,13 +1,15 @@ -const chai = require('chai'); -const chaiFiles = require('chai-files'); +import chai from 'chai'; +import chaiFiles from 'chai-files'; const assert = chai.assert; chai.use(chaiFiles); const expect = chai.expect; const file = chaiFiles.file; + // const dir = chaiFiles.dir; -const cache = require('../lib/util/cache'); -const testUtils = require('./utils'); -const handler = require('../lib/index'); +import cache from '../lib/util/cache'; + +import testUtils from './utils'; +import handler from '../lib/index'; describe('query', () => { beforeEach(() => { diff --git a/test/resourceFactory.js b/test/resourceFactory.js index b422ad79b..aabcb90b7 100644 --- a/test/resourceFactory.js +++ b/test/resourceFactory.js @@ -1,9 +1,10 @@ -const fs = require('fs-extra'); -const path = require('node:path'); -const { XMLParser } = require('fast-xml-parser'); -const { color } = require('../lib/util/util'); +import fs from 'fs-extra'; +import path from 'node:path'; +import { XMLParser } from 'fast-xml-parser'; +import { color } from '../lib/util/util'; const parser = new XMLParser(); const attributeParser = new XMLParser({ ignoreAttributes: false }); + /** * gets mock SOAP metadata for responding * @@ -12,7 +13,7 @@ const attributeParser = new XMLParser({ ignoreAttributes: false }); * @param {string} mid of Business Unit * @returns {string} relevant metadata stringified */ -exports.loadSOAPRecords = async (mcdevAction, type, mid) => { +export const loadSOAPRecords = async (mcdevAction, type, mid) => { type = type[0].toLowerCase() + type.slice(1); const testPath = path.join( 'test', @@ -36,13 +37,14 @@ exports.loadSOAPRecords = async (mcdevAction, type, mid) => { encoding: 'utf8', }); }; + /** * based on request, respond with different soap data * * @param {object} config mock api request object * @returns {Promise.} status code plus response in string form */ -exports.handleSOAPRequest = async (config) => { +export const handleSOAPRequest = async (config) => { const jObj = parser.parse(config.data); const fullObj = attributeParser.parse(config.data); let responseXML; @@ -93,12 +95,13 @@ exports.handleSOAPRequest = async (config) => { return [200, responseXML]; }; + /** * helper to return soap base URL * * @returns {string} soap URL */ -exports.soapUrl = 'https://mct0l7nxfq2r988t1kxfy8sc4xxx.soap.marketingcloudapis.com/Service.asmx'; +export const soapUrl = 'https://mct0l7nxfq2r988t1kxfy8sc4xxx.soap.marketingcloudapis.com/Service.asmx'; /** * based on request, respond with different soap data @@ -106,7 +109,7 @@ exports.soapUrl = 'https://mct0l7nxfq2r988t1kxfy8sc4xxx.soap.marketingcloudapis. * @param {object} config mock api request object * @returns {Promise.} status code plus response in string form */ -exports.handleRESTRequest = async (config) => { +export const handleRESTRequest = async (config) => { try { // check if filtered const urlObj = new URL(config.baseURL + config.url.slice(1)); @@ -161,9 +164,10 @@ exports.handleRESTRequest = async (config) => { return [500, {}]; } }; + /** * helper to return rest base URL * * @returns {string} test URL */ -exports.restUrl = 'https://mct0l7nxfq2r988t1kxfy8sc4xxx.rest.marketingcloudapis.com/'; +export const restUrl = 'https://mct0l7nxfq2r988t1kxfy8sc4xxx.rest.marketingcloudapis.com/'; diff --git a/test/transactionalEmail.test.js b/test/transactionalEmail.test.js index 2385b9d68..ee5fcf81d 100644 --- a/test/transactionalEmail.test.js +++ b/test/transactionalEmail.test.js @@ -1,10 +1,10 @@ -const chai = require('chai'); -const chaiFiles = require('chai-files'); +import chai from 'chai'; +import chaiFiles from 'chai-files'; const assert = chai.assert; chai.use(chaiFiles); -const cache = require('../lib/util/cache'); -const testUtils = require('./utils'); -const handler = require('../lib/index'); +import cache from '../lib/util/cache'; +import testUtils from './utils'; +import handler from '../lib/index'; describe('transactionalEmail', () => { beforeEach(() => { diff --git a/test/transactionalPush.test.js b/test/transactionalPush.test.js index 0c5b00b3d..0ab641203 100644 --- a/test/transactionalPush.test.js +++ b/test/transactionalPush.test.js @@ -1,10 +1,10 @@ -const chai = require('chai'); -const chaiFiles = require('chai-files'); +import chai from 'chai'; +import chaiFiles from 'chai-files'; const assert = chai.assert; chai.use(chaiFiles); -const cache = require('../lib/util/cache'); -const testUtils = require('./utils'); -const handler = require('../lib/index'); +import cache from '../lib/util/cache'; +import testUtils from './utils'; +import handler from '../lib/index'; describe('transactionalPush', () => { beforeEach(() => { diff --git a/test/transactionalSMS.test.js b/test/transactionalSMS.test.js index d95f5b7b5..6ba8b33e2 100644 --- a/test/transactionalSMS.test.js +++ b/test/transactionalSMS.test.js @@ -1,12 +1,12 @@ -const chai = require('chai'); -const chaiFiles = require('chai-files'); +import chai from 'chai'; +import chaiFiles from 'chai-files'; const assert = chai.assert; chai.use(chaiFiles); const expect = chai.expect; const file = chaiFiles.file; -const cache = require('../lib/util/cache'); -const testUtils = require('./utils'); -const handler = require('../lib/index'); +import cache from '../lib/util/cache'; +import testUtils from './utils'; +import handler from '../lib/index'; describe('transactionalSMS', () => { beforeEach(() => { diff --git a/test/user.test.js b/test/user.test.js index 339d4975b..9f69bc0ef 100644 --- a/test/user.test.js +++ b/test/user.test.js @@ -1,7 +1,7 @@ -const assert = require('chai').assert; -const cache = require('../lib/util/cache'); -const testUtils = require('./utils'); -const handler = require('../lib/index'); +import { assert } from 'chai'; +import cache from '../lib/util/cache'; +import testUtils from './utils'; +import handler from '../lib/index'; describe('user', () => { beforeEach(() => { diff --git a/test/utils.js b/test/utils.js index 095b28846..141c56379 100644 --- a/test/utils.js +++ b/test/utils.js @@ -1,16 +1,19 @@ -const File = require('../lib/util/file'); -const path = require('node:path'); -const axios = require('axios'); -const MockAdapter = require('axios-mock-adapter'); -const auth = require('../lib/util/auth'); -const Util = require('../lib/util/util'); +import File from '../lib/util/file'; +import path from 'node:path'; +import axios from 'axios'; +import MockAdapter from 'axios-mock-adapter'; +import auth from '../lib/util/auth'; +import Util from '../lib/util/util'; +import { fileURLToPath } from 'node:url'; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); // for some reason doesnt realize below reference // eslint-disable-next-line no-unused-vars -const fsmock = require('mock-fs'); +import fsmock from 'mock-fs'; + let apimock; -const authResources = require('./resources/auth.json'); -const resourceFactory = require('./resourceFactory'); +import authResources from './resources/auth.json'; +import resourceFactory from './resourceFactory'; /** * gets file from Retrieve folder From d712d9559a4ae09fefd140046cb7c9d8954e8052 Mon Sep 17 00:00:00 2001 From: Douglas Midgley Date: Mon, 8 May 2023 23:32:13 +0200 Subject: [PATCH 05/48] #354: dirname migration & endings --- lib/util/config.js | 3 +++ lib/util/init.config.js | 2 ++ lib/util/init.npm.js | 2 ++ 3 files changed, 7 insertions(+) diff --git a/lib/util/config.js b/lib/util/config.js index 03245403e..9a9e49ac5 100644 --- a/lib/util/config.js +++ b/lib/util/config.js @@ -4,6 +4,9 @@ import File from './file.js'; import inquirer from 'inquirer'; import semver from 'semver'; import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + /** * Central class for loading and validating properties from config and auth */ diff --git a/lib/util/init.config.js b/lib/util/init.config.js index 12c723726..cabe491f8 100644 --- a/lib/util/init.config.js +++ b/lib/util/init.config.js @@ -8,6 +8,8 @@ import { Util } from './util.js'; import inquirer from 'inquirer'; import path from 'node:path'; import semver from 'semver'; +import { fileURLToPath } from 'node:url'; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); /** * CLI helper class diff --git a/lib/util/init.npm.js b/lib/util/init.npm.js index db1fed5f8..6b7ff27e2 100644 --- a/lib/util/init.npm.js +++ b/lib/util/init.npm.js @@ -4,6 +4,8 @@ import File from './file.js'; import path from 'node:path'; import { Util } from './util.js'; import semver from 'semver'; +import { fileURLToPath } from 'node:url'; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); /** * CLI helper class From 12659632b952c18eaa14a667fa224d48c1c5c02e Mon Sep 17 00:00:00 2001 From: Douglas Midgley Date: Mon, 8 May 2023 23:33:46 +0200 Subject: [PATCH 06/48] #354: types reenabled --- lib/metadataTypes/Asset.js | 2 +- lib/metadataTypes/AttributeGroup.js | 2 +- lib/metadataTypes/Automation.js | 2 +- lib/metadataTypes/Campaign.js | 2 +- lib/metadataTypes/ContentArea.js | 2 +- lib/metadataTypes/DataExtension.js | 2 +- lib/metadataTypes/DataExtensionField.js | 2 +- lib/metadataTypes/DataExtensionTemplate.js | 2 +- lib/metadataTypes/DataExtract.js | 2 +- lib/metadataTypes/DataExtractType.js | 2 +- lib/metadataTypes/Discovery.js | 2 +- lib/metadataTypes/Email.js | 2 +- lib/metadataTypes/EmailSend.js | 2 +- lib/metadataTypes/Event.js | 2 +- lib/metadataTypes/FileLocation.js | 2 +- lib/metadataTypes/FileTransfer.js | 2 +- lib/metadataTypes/Filter.js | 2 +- lib/metadataTypes/Folder.js | 2 +- lib/metadataTypes/ImportFile.js | 2 +- lib/metadataTypes/Journey.js | 2 +- lib/metadataTypes/List.js | 2 +- lib/metadataTypes/MetadataType.js | 2 +- lib/metadataTypes/MobileCode.js | 2 +- lib/metadataTypes/MobileKeyword.js | 2 +- lib/metadataTypes/MobileMessage.js | 2 +- lib/metadataTypes/Query.js | 2 +- lib/metadataTypes/Role.js | 2 +- lib/metadataTypes/Script.js | 2 +- lib/metadataTypes/SendClassification.js | 2 +- lib/metadataTypes/SetDefinition.js | 2 +- lib/metadataTypes/TransactionalEmail.js | 2 +- lib/metadataTypes/TransactionalMessage.js | 2 +- lib/metadataTypes/TransactionalPush.js | 2 +- lib/metadataTypes/TransactionalSMS.js | 2 +- lib/metadataTypes/TriggeredSend.js | 2 +- lib/metadataTypes/User.js | 2 +- lib/util/auth.js | 2 +- lib/util/businessUnit.js | 2 +- lib/util/cache.js | 2 +- lib/util/cli.js | 2 +- lib/util/config.js | 2 +- lib/util/devops.js | 2 +- lib/util/file.js | 2 +- lib/util/init.config.js | 2 +- lib/util/init.js | 2 +- lib/util/util.js | 2 +- 46 files changed, 46 insertions(+), 46 deletions(-) diff --git a/lib/metadataTypes/Asset.js b/lib/metadataTypes/Asset.js index 88e3172ee..1e5fe83e0 100644 --- a/lib/metadataTypes/Asset.js +++ b/lib/metadataTypes/Asset.js @@ -1,7 +1,7 @@ 'use strict'; import MetadataType from './MetadataType.js'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; import pLimit from 'p-limit'; diff --git a/lib/metadataTypes/AttributeGroup.js b/lib/metadataTypes/AttributeGroup.js index 7219ff8dc..7a5c3e891 100644 --- a/lib/metadataTypes/AttributeGroup.js +++ b/lib/metadataTypes/AttributeGroup.js @@ -1,7 +1,7 @@ 'use strict'; import MetadataType from './MetadataType.js'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; /** * AttributeGroup MetadataType diff --git a/lib/metadataTypes/Automation.js b/lib/metadataTypes/Automation.js index 7b8c5f16d..7d94f4370 100644 --- a/lib/metadataTypes/Automation.js +++ b/lib/metadataTypes/Automation.js @@ -1,7 +1,7 @@ 'use strict'; import MetadataType from './MetadataType.js'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; import Definitions from '../MetadataTypeDefinitions.js'; diff --git a/lib/metadataTypes/Campaign.js b/lib/metadataTypes/Campaign.js index e0f01fb64..00032f1d7 100644 --- a/lib/metadataTypes/Campaign.js +++ b/lib/metadataTypes/Campaign.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; diff --git a/lib/metadataTypes/ContentArea.js b/lib/metadataTypes/ContentArea.js index 35c3bc6e8..a67049c92 100644 --- a/lib/metadataTypes/ContentArea.js +++ b/lib/metadataTypes/ContentArea.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; import cache from '../util/cache.js'; diff --git a/lib/metadataTypes/DataExtension.js b/lib/metadataTypes/DataExtension.js index b4c9f5447..18f073d8e 100644 --- a/lib/metadataTypes/DataExtension.js +++ b/lib/metadataTypes/DataExtension.js @@ -1,7 +1,7 @@ 'use strict'; import jsonToTable from 'json-to-table'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import DataExtensionField from './DataExtensionField.js'; import Folder from './Folder.js'; diff --git a/lib/metadataTypes/DataExtensionField.js b/lib/metadataTypes/DataExtensionField.js index 5a72076de..d597417f6 100644 --- a/lib/metadataTypes/DataExtensionField.js +++ b/lib/metadataTypes/DataExtensionField.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; diff --git a/lib/metadataTypes/DataExtensionTemplate.js b/lib/metadataTypes/DataExtensionTemplate.js index 7175a28df..edff5cb33 100644 --- a/lib/metadataTypes/DataExtensionTemplate.js +++ b/lib/metadataTypes/DataExtensionTemplate.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; /** diff --git a/lib/metadataTypes/DataExtract.js b/lib/metadataTypes/DataExtract.js index 17cf4e4a0..c6cdf0168 100644 --- a/lib/metadataTypes/DataExtract.js +++ b/lib/metadataTypes/DataExtract.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; diff --git a/lib/metadataTypes/DataExtractType.js b/lib/metadataTypes/DataExtractType.js index ef0150e2b..5f6185686 100644 --- a/lib/metadataTypes/DataExtractType.js +++ b/lib/metadataTypes/DataExtractType.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; /** diff --git a/lib/metadataTypes/Discovery.js b/lib/metadataTypes/Discovery.js index 251054125..803c96e14 100644 --- a/lib/metadataTypes/Discovery.js +++ b/lib/metadataTypes/Discovery.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; diff --git a/lib/metadataTypes/Email.js b/lib/metadataTypes/Email.js index 6c25efa92..f4b3c0d4c 100644 --- a/lib/metadataTypes/Email.js +++ b/lib/metadataTypes/Email.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; diff --git a/lib/metadataTypes/EmailSend.js b/lib/metadataTypes/EmailSend.js index df95bea5b..38474bd56 100644 --- a/lib/metadataTypes/EmailSend.js +++ b/lib/metadataTypes/EmailSend.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; import cache from '../util/cache.js'; diff --git a/lib/metadataTypes/Event.js b/lib/metadataTypes/Event.js index 8483fcf96..1fa3da5f3 100644 --- a/lib/metadataTypes/Event.js +++ b/lib/metadataTypes/Event.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; diff --git a/lib/metadataTypes/FileLocation.js b/lib/metadataTypes/FileLocation.js index 2bb4eaa3e..2b5927ba6 100644 --- a/lib/metadataTypes/FileLocation.js +++ b/lib/metadataTypes/FileLocation.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; /** diff --git a/lib/metadataTypes/FileTransfer.js b/lib/metadataTypes/FileTransfer.js index e7de714ea..35067f816 100644 --- a/lib/metadataTypes/FileTransfer.js +++ b/lib/metadataTypes/FileTransfer.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; diff --git a/lib/metadataTypes/Filter.js b/lib/metadataTypes/Filter.js index 2d7f60999..6fc64079f 100644 --- a/lib/metadataTypes/Filter.js +++ b/lib/metadataTypes/Filter.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; /** diff --git a/lib/metadataTypes/Folder.js b/lib/metadataTypes/Folder.js index d3f0b4488..52742ab9a 100644 --- a/lib/metadataTypes/Folder.js +++ b/lib/metadataTypes/Folder.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import toposort from 'toposort'; import { Util } from '../util/util.js'; diff --git a/lib/metadataTypes/ImportFile.js b/lib/metadataTypes/ImportFile.js index c75abfab2..5348a4909 100644 --- a/lib/metadataTypes/ImportFile.js +++ b/lib/metadataTypes/ImportFile.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index ebc151b40..1e373d6a7 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import TransactionalEmail from './TransactionalEmail.js'; import { Util } from '../util/util.js'; diff --git a/lib/metadataTypes/List.js b/lib/metadataTypes/List.js index cd5135c2c..2c57375f7 100644 --- a/lib/metadataTypes/List.js +++ b/lib/metadataTypes/List.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import Folder from './Folder.js'; import { Util } from '../util/util.js'; diff --git a/lib/metadataTypes/MetadataType.js b/lib/metadataTypes/MetadataType.js index 5ecf5c06f..86e01b58a 100644 --- a/lib/metadataTypes/MetadataType.js +++ b/lib/metadataTypes/MetadataType.js @@ -7,7 +7,7 @@ * in the generic version of the method */ -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; diff --git a/lib/metadataTypes/MobileCode.js b/lib/metadataTypes/MobileCode.js index 59c193029..5101af3f8 100644 --- a/lib/metadataTypes/MobileCode.js +++ b/lib/metadataTypes/MobileCode.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; /** diff --git a/lib/metadataTypes/MobileKeyword.js b/lib/metadataTypes/MobileKeyword.js index ff61697fb..90d2d0f2c 100644 --- a/lib/metadataTypes/MobileKeyword.js +++ b/lib/metadataTypes/MobileKeyword.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; diff --git a/lib/metadataTypes/MobileMessage.js b/lib/metadataTypes/MobileMessage.js index 291f821cd..c9f093aad 100644 --- a/lib/metadataTypes/MobileMessage.js +++ b/lib/metadataTypes/MobileMessage.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; diff --git a/lib/metadataTypes/Query.js b/lib/metadataTypes/Query.js index ed8e45f97..649540dd6 100644 --- a/lib/metadataTypes/Query.js +++ b/lib/metadataTypes/Query.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import { Util } from '../util/util.js'; import MetadataType from './MetadataType.js'; import File from '../util/file.js'; diff --git a/lib/metadataTypes/Role.js b/lib/metadataTypes/Role.js index 9f6775654..f209bcd55 100644 --- a/lib/metadataTypes/Role.js +++ b/lib/metadataTypes/Role.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; diff --git a/lib/metadataTypes/Script.js b/lib/metadataTypes/Script.js index 2983e3532..a64901408 100644 --- a/lib/metadataTypes/Script.js +++ b/lib/metadataTypes/Script.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; diff --git a/lib/metadataTypes/SendClassification.js b/lib/metadataTypes/SendClassification.js index 9408d62ef..d71c450e3 100644 --- a/lib/metadataTypes/SendClassification.js +++ b/lib/metadataTypes/SendClassification.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; /** diff --git a/lib/metadataTypes/SetDefinition.js b/lib/metadataTypes/SetDefinition.js index 87401077f..747014726 100644 --- a/lib/metadataTypes/SetDefinition.js +++ b/lib/metadataTypes/SetDefinition.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; /** diff --git a/lib/metadataTypes/TransactionalEmail.js b/lib/metadataTypes/TransactionalEmail.js index 07462af6a..88b9ad3cc 100644 --- a/lib/metadataTypes/TransactionalEmail.js +++ b/lib/metadataTypes/TransactionalEmail.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import TransactionalMessage from './TransactionalMessage.js'; import { Util } from '../util/util.js'; import cache from '../util/cache.js'; diff --git a/lib/metadataTypes/TransactionalMessage.js b/lib/metadataTypes/TransactionalMessage.js index e1821fe0e..5fe2c0df2 100644 --- a/lib/metadataTypes/TransactionalMessage.js +++ b/lib/metadataTypes/TransactionalMessage.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; diff --git a/lib/metadataTypes/TransactionalPush.js b/lib/metadataTypes/TransactionalPush.js index 820fb96fc..90930c6c5 100644 --- a/lib/metadataTypes/TransactionalPush.js +++ b/lib/metadataTypes/TransactionalPush.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import TransactionalMessage from './TransactionalMessage.js'; import { Util } from '../util/util.js'; import cache from '../util/cache.js'; diff --git a/lib/metadataTypes/TransactionalSMS.js b/lib/metadataTypes/TransactionalSMS.js index 10a4346cc..b2ea8c891 100644 --- a/lib/metadataTypes/TransactionalSMS.js +++ b/lib/metadataTypes/TransactionalSMS.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import TransactionalMessage from './TransactionalMessage.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; diff --git a/lib/metadataTypes/TriggeredSend.js b/lib/metadataTypes/TriggeredSend.js index 3c659d68f..c48cd5fcf 100644 --- a/lib/metadataTypes/TriggeredSend.js +++ b/lib/metadataTypes/TriggeredSend.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; import cache from '../util/cache.js'; diff --git a/lib/metadataTypes/User.js b/lib/metadataTypes/User.js index d7c5afc74..8bee608cc 100644 --- a/lib/metadataTypes/User.js +++ b/lib/metadataTypes/User.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataType from './MetadataType.js'; import { Util } from '../util/util.js'; import File from '../util/file.js'; diff --git a/lib/util/auth.js b/lib/util/auth.js index e33fbc472..3b82744cf 100644 --- a/lib/util/auth.js +++ b/lib/util/auth.js @@ -1,4 +1,4 @@ -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import { Util } from './util.js'; import File from './file.js'; import SDK from 'sfmc-sdk'; diff --git a/lib/util/businessUnit.js b/lib/util/businessUnit.js index 7489ae1ac..b26e010fc 100644 --- a/lib/util/businessUnit.js +++ b/lib/util/businessUnit.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import { Util } from './util.js'; import File from './file.js'; import auth from './auth.js'; diff --git a/lib/util/cache.js b/lib/util/cache.js index 52046cf27..31feb0d19 100644 --- a/lib/util/cache.js +++ b/lib/util/cache.js @@ -1,4 +1,4 @@ -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import { Util } from './util.js'; /** @type {TYPE.Cache} */ diff --git a/lib/util/cli.js b/lib/util/cli.js index 572728698..12c888de9 100644 --- a/lib/util/cli.js +++ b/lib/util/cli.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import BuHelper from './businessUnit.js'; import File from './file.js'; import config from './config.js'; diff --git a/lib/util/config.js b/lib/util/config.js index 9a9e49ac5..b5a33918d 100644 --- a/lib/util/config.js +++ b/lib/util/config.js @@ -1,4 +1,4 @@ -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import { Util } from './util.js'; import File from './file.js'; import inquirer from 'inquirer'; diff --git a/lib/util/devops.js b/lib/util/devops.js index 582353b56..2523e51ba 100644 --- a/lib/util/devops.js +++ b/lib/util/devops.js @@ -1,4 +1,4 @@ -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import File from './file.js'; import path from 'node:path'; import inquirer from 'inquirer'; diff --git a/lib/util/file.js b/lib/util/file.js index c9dabd2bb..9a6e75012 100644 --- a/lib/util/file.js +++ b/lib/util/file.js @@ -1,7 +1,7 @@ /* eslint-disable no-control-regex */ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import fs from 'fs-extra'; import packageJson from '../../package.json' assert { type: 'json' }; import path from 'node:path'; diff --git a/lib/util/init.config.js b/lib/util/init.config.js index cabe491f8..a8309d4d1 100644 --- a/lib/util/init.config.js +++ b/lib/util/init.config.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import Cli from './cli.js'; import File from './file.js'; import config from './config.js'; diff --git a/lib/util/init.js b/lib/util/init.js index e4c64d6b0..a5889070d 100644 --- a/lib/util/init.js +++ b/lib/util/init.js @@ -1,5 +1,5 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import Cli from './cli.js'; import File from './file.js'; import config from './config.js'; diff --git a/lib/util/util.js b/lib/util/util.js index 5c03cbccf..75347530e 100644 --- a/lib/util/util.js +++ b/lib/util/util.js @@ -1,6 +1,6 @@ 'use strict'; -// import TYPE from '../../types/mcdev.d.js'; +import TYPE from '../../types/mcdev.d.js'; import MetadataDefinitions from './../MetadataTypeDefinitions.js'; import packageJsonMcdev from '../../package.json' assert { type: 'json' }; import process from 'node:process'; From 1110982fd947458c6afdfcc389224fbe86627229 Mon Sep 17 00:00:00 2001 From: Douglas Midgley Date: Mon, 15 May 2023 23:51:03 +0200 Subject: [PATCH 07/48] #354: Run, but test failure --- docs/dist/documentation.md | 414 +---------------- jsconfig.json | 6 +- lib/util/file.js | 22 +- lib/util/util.js | 40 +- package-lock.json | 793 +++++++++++++++++++------------- package.json | 30 +- test/dataExtension.test.js | 6 +- test/general.test.js | 4 +- test/journey.test.js | 6 +- test/mobileKeyword.test.js | 6 +- test/mobileMessage.test.js | 6 +- test/query.test.js | 6 +- test/resourceFactory.js | 12 +- test/transactionalEmail.test.js | 6 +- test/transactionalPush.test.js | 6 +- test/transactionalSMS.test.js | 6 +- test/user.test.js | 6 +- test/utils.js | 104 ++--- types/mcdev.d.js | 4 +- 19 files changed, 589 insertions(+), 894 deletions(-) diff --git a/docs/dist/documentation.md b/docs/dist/documentation.md index d3943772c..6d8617642 100644 --- a/docs/dist/documentation.md +++ b/docs/dist/documentation.md @@ -134,18 +134,9 @@ Provides default functionality that can be overwritten by child metadata type cl ## Constants
-
Util
-

CLI entry for SFMC DevTools

-
-
MetadataTypeDefinitions
-

Provides access to all metadataType classes

-
MetadataTypeInfo

Provides access to all metadataType classes

-
mcdev
-

sample file on how to retrieve a simple changelog to use in GUIs or automated processing of any kind

-
BusinessUnit

Helper that handles retrieval of BU info

@@ -5728,404 +5719,12 @@ helper for [retrieve](retrieve) to get all dependencies of the given types | --- | --- | --- | | metadataTypes | Array.<TYPE.SupportedMetadataTypes> | list of metadata types to retrieve; can include subtypes! | - - -## Util -CLI entry for SFMC DevTools - -**Kind**: global constant - -* [Util](#Util) - * [.skipInteraction](#Util.skipInteraction) : TYPE.skipInteraction - * [.logger](#Util.logger) : TYPE.Logger - * [.filterObjByKeys(originalObj, [whitelistArr])](#Util.filterObjByKeys) ⇒ Object.<string, \*> - * [.includesStartsWith(arr, search)](#Util.includesStartsWith) ⇒ boolean - * [.includesStartsWithIndex(arr, search)](#Util.includesStartsWithIndex) ⇒ number - * [.checkMarket(market, properties)](#Util.checkMarket) ⇒ boolean - * [.verifyMarketList(mlName, properties)](#Util.verifyMarketList) ⇒ void - * [.signalFatalError()](#Util.signalFatalError) ⇒ void - * [.isTrue(attrValue)](#Util.isTrue) ⇒ boolean - * [.isFalse(attrValue)](#Util.isFalse) ⇒ boolean - * [._isValidType(selectedType, [handleOutside])](#Util._isValidType) ⇒ boolean - * [.getTypeAndSubType(selectedType)](#Util.getTypeAndSubType) ⇒ Array.<string> - * [.getRetrieveTypeChoices()](#Util.getRetrieveTypeChoices) ⇒ Array.<TYPE.SupportedMetadataTypes> - * [.metadataLogger(level, type, method, payload, [source])](#Util.metadataLogger) ⇒ void - * [.replaceByObject(str, obj)](#Util.replaceByObject) ⇒ string \| object - * [.inverseGet(objs, val)](#Util.inverseGet) ⇒ string - * [.getMetadataHierachy(metadataTypes)](#Util.getMetadataHierachy) ⇒ Object.<string, Array.<string>> - * [.resolveObjPath(path, obj)](#Util.resolveObjPath) ⇒ any - * [.execSync(cmd, [args], [hideOutput])](#Util.execSync) ⇒ string - * [.templateSearchResult(results, keyToSearch, searchValue)](#Util.templateSearchResult) ⇒ TYPE.MetadataTypeItem - * [.setLoggingLevel(argv)](#Util.setLoggingLevel) ⇒ void - * [.logBeta(type)](#Util.logBeta) - * [.getGrayMsg(msg)](#Util.getGrayMsg) ⇒ string - * [.logSubtypes(subTypeArr)](#Util.logSubtypes) ⇒ void - * [.getKeysString(keyArr, [isId])](#Util.getKeysString) ⇒ string - * [.sleep(ms)](#Util.sleep) ⇒ Promise.<void> - * [.getSsjs(code)](#Util.getSsjs) ⇒ string - - - -### Util.skipInteraction : TYPE.skipInteraction -**Kind**: static property of [Util](#Util) - - -### Util.logger : TYPE.Logger -Logger that creates timestamped log file in 'logs/' directory - -**Kind**: static property of [Util](#Util) - - -### Util.filterObjByKeys(originalObj, [whitelistArr]) ⇒ Object.<string, \*> -helper that allows filtering an object by its keys - -**Kind**: static method of [Util](#Util) -**Returns**: Object.<string, \*> - filtered object that only contains keys you provided - -| Param | Type | Description | -| --- | --- | --- | -| originalObj | Object.<string, \*> | object that you want to filter | -| [whitelistArr] | Array.<string> | positive filter. if not provided, returns originalObj without filter | - - - -### Util.includesStartsWith(arr, search) ⇒ boolean -extended Array.includes method that allows check if an array-element starts with a certain string - -**Kind**: static method of [Util](#Util) -**Returns**: boolean - found / not found - -| Param | Type | Description | -| --- | --- | --- | -| arr | Array.<string> | your array of strigns | -| search | string | the string you are looking for | - - - -### Util.includesStartsWithIndex(arr, search) ⇒ number -extended Array.includes method that allows check if an array-element starts with a certain string - -**Kind**: static method of [Util](#Util) -**Returns**: number - array index 0..n or -1 of not found - -| Param | Type | Description | -| --- | --- | --- | -| arr | Array.<string> | your array of strigns | -| search | string | the string you are looking for | - - - -### Util.checkMarket(market, properties) ⇒ boolean -check if a market name exists in current mcdev config - -**Kind**: static method of [Util](#Util) -**Returns**: boolean - found market or not - -| Param | Type | Description | -| --- | --- | --- | -| market | string | market localizations | -| properties | TYPE.Mcdevrc | local mcdev config | - - - -### Util.verifyMarketList(mlName, properties) ⇒ void -ensure provided MarketList exists and it's content including markets and BUs checks out - -**Kind**: static method of [Util](#Util) -**Returns**: void - throws errors if problems were found - -| Param | Type | Description | -| --- | --- | --- | -| mlName | string | name of marketList | -| properties | TYPE.Mcdevrc | General configuration to be used in retrieve | - - - -### Util.signalFatalError() ⇒ void -used to ensure the program tells surrounding software that an unrecoverable error occured - -**Kind**: static method of [Util](#Util) - - -### Util.isTrue(attrValue) ⇒ boolean -SFMC accepts multiple true values for Boolean attributes for which we are checking here - -**Kind**: static method of [Util](#Util) -**Returns**: boolean - attribute value == true ? true : false - -| Param | Type | Description | -| --- | --- | --- | -| attrValue | \* | value | - - - -### Util.isFalse(attrValue) ⇒ boolean -SFMC accepts multiple false values for Boolean attributes for which we are checking here - -**Kind**: static method of [Util](#Util) -**Returns**: boolean - attribute value == false ? true : false - -| Param | Type | Description | -| --- | --- | --- | -| attrValue | \* | value | - - - -### Util.\_isValidType(selectedType, [handleOutside]) ⇒ boolean -helper for [retrieve](#Mcdev.retrieve), [retrieveAsTemplate](#Mcdev.retrieveAsTemplate) and [deploy](#Mcdev.deploy) - -**Kind**: static method of [Util](#Util) -**Returns**: boolean - type ok or not - -| Param | Type | Description | -| --- | --- | --- | -| selectedType | TYPE.SupportedMetadataTypes | type or type-subtype | -| [handleOutside] | boolean | if the API reponse is irregular this allows you to handle it outside of this generic method | - - - -### Util.getTypeAndSubType(selectedType) ⇒ Array.<string> -helper that deals with extracting type and subtype - -**Kind**: static method of [Util](#Util) -**Returns**: Array.<string> - first elem is type, second elem is subType - -| Param | Type | Description | -| --- | --- | --- | -| selectedType | string | "type" or "type-subtype" | - - - -### Util.getRetrieveTypeChoices() ⇒ Array.<TYPE.SupportedMetadataTypes> -helper for getDefaultProperties() - -**Kind**: static method of [Util](#Util) -**Returns**: Array.<TYPE.SupportedMetadataTypes> - type choices - - -### Util.metadataLogger(level, type, method, payload, [source]) ⇒ void -Logger helper for Metadata functions - -**Kind**: static method of [Util](#Util) - -| Param | Type | Description | -| --- | --- | --- | -| level | string | of log (error, info, warn) | -| type | string | of metadata being referenced | -| method | string | name which log was called from | -| payload | \* | generic object which details the error | -| [source] | string | key/id of metadata which relates to error | - - - -### Util.replaceByObject(str, obj) ⇒ string \| object -replaces values in a JSON object string, based on a series of -key-value pairs (obj) - -**Kind**: static method of [Util](#Util) -**Returns**: string \| object - replaced version of str - -| Param | Type | Description | -| --- | --- | --- | -| str | string \| object | JSON object or its stringified version, which has values to be replaced | -| obj | TYPE.TemplateMap | key value object which contains keys to be replaced and values to be replaced with | - - - -### Util.inverseGet(objs, val) ⇒ string -get key of an object based on the first matching value - -**Kind**: static method of [Util](#Util) -**Returns**: string - key - -| Param | Type | Description | -| --- | --- | --- | -| objs | object | object of objects to be searched | -| val | string | value to be searched for | - - - -### Util.getMetadataHierachy(metadataTypes) ⇒ Object.<string, Array.<string>> -Returns Order in which metadata needs to be retrieved/deployed - -**Kind**: static method of [Util](#Util) -**Returns**: Object.<string, Array.<string>> - retrieve/deploy order as array - -| Param | Type | Description | -| --- | --- | --- | -| metadataTypes | Array.<string> | which should be retrieved/deployed | - - - -### Util.resolveObjPath(path, obj) ⇒ any -let's you dynamically walk down an object and get a value - -**Kind**: static method of [Util](#Util) -**Returns**: any - value of obj.path - -| Param | Type | Description | -| --- | --- | --- | -| path | string | 'fieldA.fieldB.fieldC' | -| obj | object | some parent object | - - - -### Util.execSync(cmd, [args], [hideOutput]) ⇒ string -helper to run other commands as if run manually by user - -**Kind**: static method of [Util](#Util) -**Returns**: string - output of command if hideOutput is true - -| Param | Type | Description | -| --- | --- | --- | -| cmd | string | to be executed command | -| [args] | Array.<string> | list of arguments | -| [hideOutput] | boolean | if true, output of command will be hidden from CLI | - - - -### Util.templateSearchResult(results, keyToSearch, searchValue) ⇒ TYPE.MetadataTypeItem -standardize check to ensure only one result is returned from template search - -**Kind**: static method of [Util](#Util) -**Returns**: TYPE.MetadataTypeItem - metadata to be used in building template - -| Param | Type | Description | -| --- | --- | --- | -| results | Array.<TYPE.MetadataTypeItem> | array of metadata | -| keyToSearch | string | the field which contains the searched value | -| searchValue | string | the value which is being looked for | - - - -### Util.setLoggingLevel(argv) ⇒ void -configures what is displayed in the console - -**Kind**: static method of [Util](#Util) - -| 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 | - - - -### Util.logBeta(type) -outputs a warning that the given type is still in beta - -**Kind**: static method of [Util](#Util) - -| Param | Type | Description | -| --- | --- | --- | -| type | string | api name of the type thats in beta | - - - -### Util.getGrayMsg(msg) ⇒ string -helper that wraps a message in the correct color codes to have them printed gray - -**Kind**: static method of [Util](#Util) -**Returns**: string - gray msg - -| Param | Type | Description | -| --- | --- | --- | -| msg | string | log message that should be wrapped with color codes | - - - -### Util.logSubtypes(subTypeArr) ⇒ void -helper to print the subtypes we filtered by - -**Kind**: static method of [Util](#Util) - -| Param | Type | Description | -| --- | --- | --- | -| subTypeArr | Array.<string> | list of subtypes to be printed | - - - -### Util.getKeysString(keyArr, [isId]) ⇒ string -helper to print the subtypes we filtered by - -**Kind**: static method of [Util](#Util) -**Returns**: string - string to be appended to log message - -| Param | Type | Description | -| --- | --- | --- | -| keyArr | Array.<string> \| string | list of subtypes to be printed | -| [isId] | boolean | optional flag to indicate if key is an id | - - - -### Util.sleep(ms) ⇒ Promise.<void> -pause execution of code; useful when multiple server calls are dependent on each other and might not be executed right away - -**Kind**: static method of [Util](#Util) -**Returns**: Promise.<void> - - promise to wait for - -| Param | Type | Description | -| --- | --- | --- | -| ms | number | time in miliseconds to wait | - - - -### Util.getSsjs(code) ⇒ string -helper for [_extractCode](#Asset._extractCode) and [prepExtractedCode](#Script.prepExtractedCode) to determine if a code block is a valid SSJS block - -**Kind**: static method of [Util](#Util) -**Returns**: string - the SSJS code if code block is a valid SSJS block, otherwise null - -| Param | Type | Description | -| --- | --- | --- | -| code | string | code block to check | - -**Example** -```js -the following is invalid: - - - - the following is valid: - -``` - - -## MetadataTypeDefinitions -Provides access to all metadataType classes - -**Kind**: global constant ## MetadataTypeInfo Provides access to all metadataType classes **Kind**: global constant - - -## mcdev -sample file on how to retrieve a simple changelog to use in GUIs or automated processing of any kind - -**Kind**: global constant -**Example** -```js -[{ - name: 'deName', - key: 'deKey', - t: 'dataExtension', - cd: '2020-05-06T00:16:00.737', - cb: 'name of creator', - ld: '2020-05-06T00:16:00.737', - lb: 'name of lastmodified' - }] -``` ## BusinessUnit @@ -6552,8 +6151,7 @@ Saves json content to a file in the local file system. Will create the parent di ### File.writePrettyToFile(directory, filename, filetype, content, [templateVariables]) ⇒ Promise.<boolean> -Saves beautified files in the local file system. Will create the parent directory if it does not exist -! Important: run 'await File.initPrettier()' in your MetadataType.retrieve() once before hitting this +Saves beautified files in the local file system. Will create the parent directory if it does not exist ! Important: run 'await File.initPrettier()' in your MetadataType.retrieve() once before hitting this **Kind**: static method of [File](#File) **Returns**: Promise.<boolean> - Promise @@ -6581,8 +6179,7 @@ helper for [writePrettyToFile](#File.writePrettyToFile), applying beautyAmp onto ### File.\_beautify\_prettier(directory, filename, filetype, content) ⇒ string -helper for [writePrettyToFile](#File.writePrettyToFile), applying prettier onto given stringified content -! Important: run 'await File.initPrettier()' in your MetadataType.retrieve() once before hitting this +helper for [writePrettyToFile](#File.writePrettyToFile), applying prettier onto given stringified content ! Important: run 'await File.initPrettier()' in your MetadataType.retrieve() once before hitting this **Kind**: static method of [File](#File) **Returns**: string - original string on error; formatted string on success @@ -6643,8 +6240,7 @@ reads file from local file system. ### File.readDirectories(directory, depth, [includeStem], [_stemLength]) ⇒ Promise.<Array.<string>> -reads directories to a specific depth returning an array -of file paths to be iterated over +reads directories to a specific depth returning an array of file paths to be iterated over **Kind**: static method of [File](#File) **Returns**: Promise.<Array.<string>> - array of fully defined file paths @@ -6663,9 +6259,7 @@ of file paths to be iterated over ### File.readDirectoriesSync(directory, [depth], [includeStem], [_stemLength]) ⇒ Array.<string> \| void -reads directories to a specific depth returning an array -of file paths to be iterated over using sync api (required in constructors) -TODO - merge with readDirectories. so far the logic is really different +reads directories to a specific depth returning an array of file paths to be iterated over using sync api (required in constructors) TODO - merge with readDirectories. so far the logic is really different **Kind**: static method of [File](#File) **Returns**: Array.<string> \| void - array of fully defined file paths; void on error diff --git a/jsconfig.json b/jsconfig.json index fa25a623b..55b6aa9c4 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -1,3 +1,7 @@ { - "include": ["lib/**/*.js", "types/**/*.js"] + "include": ["lib/**/*.js", "types/**/*.js", "test/**/*.js"], + "compilerOptions": { + "module": "es6", + "target": "esnext" + } } diff --git a/lib/util/file.js b/lib/util/file.js index 9a6e75012..2b90dd9cd 100644 --- a/lib/util/file.js +++ b/lib/util/file.js @@ -3,7 +3,7 @@ import TYPE from '../../types/mcdev.d.js'; import fs from 'fs-extra'; -import packageJson from '../../package.json' assert { type: 'json' }; + import path from 'node:path'; import prettier from 'prettier'; import beautyAmp from 'beauty-amp-core'; @@ -12,7 +12,7 @@ import updateNotifier from 'update-notifier'; // inform user when there is an update const notifier = updateNotifier({ - pkg: packageJson, + pkg: Util.packageJsonMcdev, updateCheckInterval: 1000 * 3600 * 24, // once per day }); // Notify using the built-in convenience method @@ -24,7 +24,6 @@ notifier.notify(); const File = { /** * copies a file from one path to another - * * @param {string} from - full filepath including name of existing file * @param {string} to - full filepath including name where file should go * @returns {object} - results object @@ -46,7 +45,6 @@ const File = { }, /** * makes sure Windows accepts path names - * * @param {string} path - filename or path * @returns {string} - corrected string */ @@ -83,7 +81,6 @@ const File = { /** * makes sure Windows accepts file names - * * @param {string} filename - filename or path * @returns {string} - corrected string */ @@ -114,7 +111,6 @@ const File = { /** * makes sure Windows accepts file names - * * @param {string} filename - filename or path * @returns {string} - corrected string */ @@ -124,7 +120,6 @@ const File = { /** * Takes various types of path strings and formats into a platform specific path - * * @param {string|string[]} denormalizedPath directory the file will be written to * @returns {string} Path strings */ @@ -141,7 +136,6 @@ const File = { }, /** * Saves json content to a file in the local file system. Will create the parent directory if it does not exist - * * @param {string|string[]} directory directory the file will be written to * @param {string} filename name of the file without '.json' ending * @param {object} content filecontent @@ -160,7 +154,6 @@ const File = { /** * Saves beautified files in the local file system. Will create the parent directory if it does not exist * ! Important: run 'await File.initPrettier()' in your MetadataType.retrieve() once before hitting this - * * @param {string|string[]} directory directory the file will be written to * @param {string} filename name of the file without suffix * @param {string} filetype filetype ie. JSON or SSJS @@ -180,7 +173,6 @@ const File = { }, /** * helper for {@link File.writePrettyToFile}, applying beautyAmp onto given stringified content - * * @param {string} content filecontent * @returns {string} original string on error; formatted string on success */ @@ -213,7 +205,6 @@ const File = { /** * helper for {@link File.writePrettyToFile}, applying prettier onto given stringified content * ! Important: run 'await File.initPrettier()' in your MetadataType.retrieve() once before hitting this - * * @param {string|string[]} directory directory the file will be written to * @param {string} filename name of the file without suffix * @param {string} filetype filetype ie. JSON or SSJS @@ -313,7 +304,6 @@ const File = { }, /** * Saves text content to a file in the local file system. Will create the parent directory if it does not exist - * * @param {string|string[]} directory directory the file will be written to * @param {string} filename name of the file without '.json' ending * @param {string} filetype filetype suffix @@ -341,7 +331,6 @@ const File = { /** * Saves json content to a file in the local file system. Will create the parent directory if it does not exist - * * @param {string | string[]} directory directory where the file is stored * @param {string} filename name of the file without '.json' ending * @param {boolean} sync should execute sync (default is async) @@ -377,7 +366,6 @@ const File = { }, /** * reads file from local file system. - * * @param {string | string[]} directory directory where the file is stored * @param {string} filename name of the file without '.json' ending * @param {string} filetype filetype suffix @@ -396,7 +384,6 @@ const File = { /** * reads directories to a specific depth returning an array * of file paths to be iterated over - * * @example ['deploy/mcdev/bu1'] * @param {string} directory directory to checkin * @param {number} depth how many levels to check (1 base) @@ -451,7 +438,6 @@ const File = { * reads directories to a specific depth returning an array * of file paths to be iterated over using sync api (required in constructors) * TODO - merge with readDirectories. so far the logic is really different - * * @example ['deploy/mcdev/bu1'] * @param {string} directory directory to checkin * @param {number} [depth] how many levels to check (1 base) @@ -500,20 +486,18 @@ const File = { }, /** * helper that splits the config back into auth & config parts to save them separately - * * @param {TYPE.Mcdevrc} properties central properties object * @returns {Promise.} - */ async saveConfigFile(properties) { // we want to save to save the full version here to allow us to upgrade configs properly in the future - properties.version = packageJson.version; + properties.version = Util.packageJsonMcdev.version; await this.writeJSONToFile('', Util.configFileName.split('.json')[0], properties); Util.logger.info(`✔️ ${Util.configFileName} and ${Util.authFileName} saved successfully`); }, /** * Initalises Prettier formatting lib async. - * * @param {string} [filetype='html'] filetype ie. JSON or SSJS * @returns {Promise.} success of config load */ diff --git a/lib/util/util.js b/lib/util/util.js index 75347530e..d8da403ce 100644 --- a/lib/util/util.js +++ b/lib/util/util.js @@ -2,11 +2,15 @@ import TYPE from '../../types/mcdev.d.js'; import MetadataDefinitions from './../MetadataTypeDefinitions.js'; -import packageJsonMcdev from '../../package.json' assert { type: 'json' }; import process from 'node:process'; import toposort from 'toposort'; import winston from 'winston'; import child_process from 'node:child_process'; +import path from 'node:path'; +// import just to resolve cyclical - TO DO consider if could move to file or context +import { readJsonSync } from 'fs-extra/esm'; +import { fileURLToPath } from 'node:url'; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); /** * Util that contains logger and simple util methods @@ -19,11 +23,10 @@ export const Util = { standardizedSplitChar: '/', /** @type {TYPE.skipInteraction} */ skipInteraction: false, - packageJsonMcdev: packageJsonMcdev, + packageJsonMcdev: readJsonSync(path.join(__dirname, '../../package.json')), OPTIONS: {}, /** * helper that allows filtering an object by its keys - * * @param {Object.} originalObj object that you want to filter * @param {string[]} [whitelistArr] positive filter. if not provided, returns originalObj without filter * @returns {Object.} filtered object that only contains keys you provided @@ -41,7 +44,6 @@ export const Util = { }, /** * extended Array.includes method that allows check if an array-element starts with a certain string - * * @param {string[]} arr your array of strigns * @param {string} search the string you are looking for * @returns {boolean} found / not found @@ -51,7 +53,6 @@ export const Util = { }, /** * extended Array.includes method that allows check if an array-element starts with a certain string - * * @param {string[]} arr your array of strigns * @param {string} search the string you are looking for * @returns {number} array index 0..n or -1 of not found @@ -61,7 +62,6 @@ export const Util = { }, /** * check if a market name exists in current mcdev config - * * @param {string} market market localizations * @param {TYPE.Mcdevrc} properties local mcdev config * @returns {boolean} found market or not @@ -81,7 +81,6 @@ export const Util = { }, /** * ensure provided MarketList exists and it's content including markets and BUs checks out - * * @param {string} mlName name of marketList * @param {TYPE.Mcdevrc} properties General configuration to be used in retrieve * @returns {void} throws errors if problems were found @@ -126,7 +125,6 @@ export const Util = { }, /** * used to ensure the program tells surrounding software that an unrecoverable error occured - * * @returns {void} */ signalFatalError() { @@ -135,7 +133,6 @@ export const Util = { }, /** * SFMC accepts multiple true values for Boolean attributes for which we are checking here - * * @param {*} attrValue value * @returns {boolean} attribute value == true ? true : false */ @@ -144,7 +141,6 @@ export const Util = { }, /** * SFMC accepts multiple false values for Boolean attributes for which we are checking here - * * @param {*} attrValue value * @returns {boolean} attribute value == false ? true : false */ @@ -153,7 +149,6 @@ export const Util = { }, /** * helper for {@link Mcdev.retrieve}, {@link Mcdev.retrieveAsTemplate} and {@link Mcdev.deploy} - * * @param {TYPE.SupportedMetadataTypes} selectedType type or type-subtype * @param {boolean} [handleOutside] if the API reponse is irregular this allows you to handle it outside of this generic method * @returns {boolean} type ok or not @@ -180,7 +175,6 @@ export const Util = { /** * helper that deals with extracting type and subtype - * * @param {string} selectedType "type" or "type-subtype" * @returns {string[]} first elem is type, second elem is subType */ @@ -197,7 +191,6 @@ export const Util = { /** * helper for getDefaultProperties() - * * @returns {TYPE.SupportedMetadataTypes[]} type choices */ getRetrieveTypeChoices() { @@ -230,14 +223,12 @@ export const Util = { loggerTransports: null, /** * Logger that creates timestamped log file in 'logs/' directory - * * @type {TYPE.Logger} */ logger: null, restartLogger: startLogger, /** * Logger helper for Metadata functions - * * @param {string} level of log (error, info, warn) * @param {string} type of metadata being referenced * @param {string} method name which log was called from @@ -264,7 +255,6 @@ export const Util = { /** * replaces values in a JSON object string, based on a series of * key-value pairs (obj) - * * @param {string | object} str JSON object or its stringified version, which has values to be replaced * @param {TYPE.TemplateMap} obj key value object which contains keys to be replaced and values to be replaced with * @returns {string | object} replaced version of str @@ -297,7 +287,6 @@ export const Util = { }, /** * get key of an object based on the first matching value - * * @param {object} objs object of objects to be searched * @param {string} val value to be searched for * @returns {string} key @@ -313,7 +302,6 @@ export const Util = { /** * Returns Order in which metadata needs to be retrieved/deployed - * * @param {string[]} metadataTypes which should be retrieved/deployed * @returns {Object.} retrieve/deploy order as array */ @@ -401,7 +389,6 @@ export const Util = { /** * let's you dynamically walk down an object and get a value - * * @param {string} path 'fieldA.fieldB.fieldC' * @param {object} obj some parent object * @returns {any} value of obj.path @@ -411,7 +398,6 @@ export const Util = { }, /** * helper to run other commands as if run manually by user - * * @param {string} cmd to be executed command * @param {string[]} [args] list of arguments * @param {boolean} [hideOutput] if true, output of command will be hidden from CLI @@ -436,7 +422,6 @@ export const Util = { }, /** * standardize check to ensure only one result is returned from template search - * * @param {TYPE.MetadataTypeItem[]} results array of metadata * @param {string} keyToSearch the field which contains the searched value * @param {string} searchValue the value which is being looked for @@ -457,7 +442,6 @@ export const Util = { }, /** * configures what is displayed in the console - * * @param {object} argv list of command line parameters given by user * @param {boolean} [argv.silent] only errors printed to CLI * @param {boolean} [argv.verbose] chatty user CLI output @@ -496,7 +480,6 @@ export const Util = { }, /** * outputs a warning that the given type is still in beta - * * @param {string} type api name of the type thats in beta */ logBeta(type) { @@ -536,7 +519,6 @@ export const Util = { }, /** * helper that wraps a message in the correct color codes to have them printed gray - * * @param {string} msg log message that should be wrapped with color codes * @returns {string} gray msg */ @@ -545,7 +527,6 @@ export const Util = { }, /** * helper to print the subtypes we filtered by - * * @param {string[]} subTypeArr list of subtypes to be printed * @returns {void} */ @@ -560,7 +541,6 @@ export const Util = { }, /** * helper to print the subtypes we filtered by - * * @param {string[] | string} keyArr list of subtypes to be printed * @param {boolean} [isId] optional flag to indicate if key is an id * @returns {string} string to be appended to log message @@ -582,7 +562,6 @@ export const Util = { }, /** * pause execution of code; useful when multiple server calls are dependent on each other and might not be executed right away - * * @param {number} ms time in miliseconds to wait * @returns {Promise.} - promise to wait for */ @@ -593,7 +572,6 @@ export const Util = { }, /** * helper for {@link Asset._extractCode} and {@link Script.prepExtractedCode} to determine if a code block is a valid SSJS block - * * @example the following is invalid: * `; @@ -1172,7 +1172,7 @@ class Asset extends MetadataType { fileList, customerKey, templateName, - fileListOnly = false + fileListOnly = false, ) { for (const slot in metadataSlots) { if (Object.prototype.hasOwnProperty.call(metadataSlots, slot)) { @@ -1188,7 +1188,7 @@ class Asset extends MetadataType { ...readDirArr, 'blocks', `${fileName}.html`, - ]) + ]), ) ) { // the main content can be empty (=not set up yet) hence check if we did extract sth or else readFile() will print error msgs @@ -1197,7 +1197,7 @@ class Asset extends MetadataType { slotObj.blocks[block].content = await File.readFilteredFilename( [...readDirArr, 'blocks'], fileName, - 'html' + 'html', ); } if (templateName) { @@ -1220,7 +1220,7 @@ class Asset extends MetadataType { subDirArr, fileList, customerKey, - templateName + templateName, ); } } @@ -1381,7 +1381,7 @@ class Asset extends MetadataType { subType = this._getSubtype(metadata); if (!this.definition.binarySubtypes.includes(subType)) { Util.logger.debug( - 'not processed metadata.assetType.name: ' + metadata.assetType.name + 'not processed metadata.assetType.name: ' + metadata.assetType.name, ); } return { json: metadata, codeArr: codeArr, subFolder: null }; @@ -1417,7 +1417,7 @@ class Asset extends MetadataType { this._extractCode_slots( `${prefix}.[${slot}-${block}]`, slotObj.blocks[block].slots, - codeArr + codeArr, ); } } @@ -1457,7 +1457,7 @@ class Asset extends MetadataType { // own subfolder (with folder name = CustomerKey) // this section aims to find that json in the subfolder const subfolderFiles = File.readdirSync( - File.normalizePath([currentdir, dirent.name]) + File.normalizePath([currentdir, dirent.name]), ); for (const subFileName of subfolderFiles) { if (subFileName.endsWith('-meta.json')) { @@ -1471,12 +1471,12 @@ class Asset extends MetadataType { thisDir, fileName, true, - false + false, ); // subtype will change the metadata suffix length const fileNameWithoutEnding = fileName.slice( 0, - -17 - subtype.length + -17 - subtype.length, ); fileName2FileContent[fileNameWithoutEnding] = fileContent; } @@ -1508,10 +1508,16 @@ class Asset extends MetadataType { const fileNameFull = templateName + '.' + this.definition.type + `-${st}-meta.json`; if ( (await File.pathExists( - File.normalizePath([templateDir, ...typeDirArr, st, fileNameFull]) + File.normalizePath([templateDir, ...typeDirArr, st, fileNameFull]), )) || (await File.pathExists( - File.normalizePath([templateDir, ...typeDirArr, st, templateName, fileNameFull]) + File.normalizePath([ + templateDir, + ...typeDirArr, + st, + templateName, + fileNameFull, + ]), )) ) { subType = st; @@ -1523,7 +1529,7 @@ class Asset extends MetadataType { `Could not find asset with name ${templateName} in ${File.normalizePath([ templateDir, ...typeDirArr, - ])}` + ])}`, ); } return subType; @@ -1567,7 +1573,7 @@ class Asset extends MetadataType { fileName = `${key}.${this.definition.type}-${st}-meta.json`; if ( await File.pathExists( - File.normalizePath([basePath, this.definition.type, st, fileName]) + File.normalizePath([basePath, this.definition.type, st, fileName]), ) ) { subType = st; @@ -1581,7 +1587,7 @@ class Asset extends MetadataType { st, key, fileName, - ]) + ]), ) ) { subType = st; @@ -1603,7 +1609,7 @@ class Asset extends MetadataType { basePath, ...item.subFolder, `${item.fileName}.${item.fileExt}`, - ]) + ]), ); const response = [ File.normalizePath([...filePath, fileName]), @@ -1614,7 +1620,7 @@ class Asset extends MetadataType { metadata, subType, basePath, - false + false, ); if (binaryFilePath) { response.push(binaryFilePath); @@ -1624,7 +1630,7 @@ class Asset extends MetadataType { } else { return []; } - }) + }), ) ).flat(); return fileList; diff --git a/lib/metadataTypes/AttributeGroup.js b/lib/metadataTypes/AttributeGroup.js index bf17d44c7..7e97a4f7d 100644 --- a/lib/metadataTypes/AttributeGroup.js +++ b/lib/metadataTypes/AttributeGroup.js @@ -25,7 +25,7 @@ class AttributeGroup extends MetadataType { retrieveDir, '/hub/v1/contacts/schema/attributeGroups', null, - key + key, ); } /** @@ -54,11 +54,11 @@ class AttributeGroup extends MetadataType { 'attributeSet', attributeSet.definitionID, 'definitionID', - 'definitionKey' + 'definitionKey', ); if (key !== attributeSet.definitionKey) { throw new Error( - `AttributeSet key mismatch. Found ${key} instead of ${attributeSet.definitionKey}` + `AttributeSet key mismatch. Found ${key} instead of ${attributeSet.definitionKey}`, ); } return key; @@ -66,7 +66,7 @@ class AttributeGroup extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.keyField]} (for ${ attributeSet.definitionKey - }): ${ex.message}` + }): ${ex.message}`, ); return attributeSet; } diff --git a/lib/metadataTypes/AttributeSet.js b/lib/metadataTypes/AttributeSet.js index edd131c92..bf8a8dcdd 100644 --- a/lib/metadataTypes/AttributeSet.js +++ b/lib/metadataTypes/AttributeSet.js @@ -60,13 +60,13 @@ class AttributeSet extends MetadataType { .filter( (asKey) => metadataMap[asKey].storageLogicalType === 'ExactTargetSchema' || - metadataMap[asKey].storageLogicalType === 'DataExtension' + metadataMap[asKey].storageLogicalType === 'DataExtension', ) .filter((asKey) => { // check if dataExtension ID is found on any attributeSet of this BU if (sharedDataExtensionMap[metadataMap[asKey].storageReferenceID.value]) { Util.logger.debug( - ` shared dataExtension ID ${metadataMap[asKey].storageReferenceID.value} found in attributeSet ${asKey}` + ` shared dataExtension ID ${metadataMap[asKey].storageReferenceID.value} found in attributeSet ${asKey}`, ); return true; } else { @@ -84,8 +84,8 @@ class AttributeSet extends MetadataType { if (!search.length) { Util.logger.debug( Util.getGrayMsg( - ` - Field ${deField.Name} not found in attributeSet; Note: only first recognized difference is printed to log` - ) + ` - Field ${deField.Name} not found in attributeSet; Note: only first recognized difference is printed to log`, + ), ); return true; } @@ -93,8 +93,8 @@ class AttributeSet extends MetadataType { if (asField.dataType !== deField.FieldType) { Util.logger.debug( Util.getGrayMsg( - ` - Field ${deField.Name} FieldType changed (old: ${asField.dataType}; new: ${deField.FieldType}); Note: only first recognized difference is printed to log` - ) + ` - Field ${deField.Name} FieldType changed (old: ${asField.dataType}; new: ${deField.FieldType}); Note: only first recognized difference is printed to log`, + ), ); return true; } @@ -110,7 +110,7 @@ class AttributeSet extends MetadataType { deField.DefaultValue !== asField.defaultValue) ) { Util.logger.debug( - ` - Field ${deField.Name} DefaultValue changed (old: ${asField.defaultValue}; new: ${deField.DefaultValue}); Note: only first recognized difference is printed to log` + ` - Field ${deField.Name} DefaultValue changed (old: ${asField.defaultValue}; new: ${deField.DefaultValue}); Note: only first recognized difference is printed to log`, ); return true; } @@ -118,19 +118,19 @@ class AttributeSet extends MetadataType { asField.length ||= 0; if (asField.length !== deField.MaxLength) { Util.logger.debug( - ` - Field ${deField.Name} MaxLength changed (old: ${asField.length}; new: ${deField.MaxLength}); Note: only first recognized difference is printed to log` + ` - Field ${deField.Name} MaxLength changed (old: ${asField.length}; new: ${deField.MaxLength}); Note: only first recognized difference is printed to log`, ); return true; } if (asField.isNullable !== deField.IsRequired) { Util.logger.debug( - ` - Field ${deField.Name} IsRequired changed (old: ${asField.isNullable}; new: ${deField.IsRequired}); Note: only first recognized difference is printed to log` + ` - Field ${deField.Name} IsRequired changed (old: ${asField.isNullable}; new: ${deField.IsRequired}); Note: only first recognized difference is printed to log`, ); return true; } if (asField.isPrimaryKey !== deField.IsPrimaryKey) { Util.logger.debug( - ` - Field ${deField.Name} IsPrimaryKey changed (old: ${asField.isPrimaryKey}; new: ${deField.IsPrimaryKey}); Note: only first recognized difference is printed to log` + ` - Field ${deField.Name} IsPrimaryKey changed (old: ${asField.isPrimaryKey}; new: ${deField.IsPrimaryKey}); Note: only first recognized difference is printed to log`, ); return true; } @@ -187,7 +187,7 @@ class AttributeSet extends MetadataType { 'dataExtension', metadata.storageReferenceID.value, 'ObjectID', - 'CustomerKey' + 'CustomerKey', ); // TODO: check if fields in metadata.sendAttributeStorageName exist in data extension --> error // TODO: check if fields in data extension exist in metadata.sendAttributeStorageName --> warn @@ -199,7 +199,7 @@ class AttributeSet extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.keyField]}: ${ ex.message - }` + }`, ); } break; @@ -243,14 +243,14 @@ class AttributeSet extends MetadataType { 'attributeGroup', relationship[type + 'Item']?.identifier, 'definitionID', - 'definitionKey' + 'definitionKey', ); delete relationship[type + 'Item']?.identifier; } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${ metadata[this.definition.keyField] - }: ${ex.message}` + }: ${ex.message}`, ); } // get relationship fieldnames @@ -266,7 +266,7 @@ class AttributeSet extends MetadataType { 'attributeSet', relationship[type + 'Item']?.identifier, 'definitionID', - 'definitionKey' + 'definitionKey', ); delete relationship[type + 'Item']?.identifier; @@ -279,13 +279,13 @@ class AttributeSet extends MetadataType { : cache.getByKey( 'attributeSet', relationship[type + 'Item'] - .r__attributeSet_definitionKey + .r__attributeSet_definitionKey, ); } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${ metadata[this.definition.keyField] - }: ${ex.message}` + }: ${ex.message}`, ); } break; @@ -297,7 +297,7 @@ class AttributeSet extends MetadataType { for (const attr of relationship.relationshipAttributes) { const id = attr[type + 'AttributeID']; const valueDefinition = relationshipObj.valueDefinitions.find( - (item) => item.valueDefinitionID === id + (item) => item.valueDefinitionID === id, ); if (valueDefinition) { attr['c__' + type + 'FullyQualifiedName'] = @@ -306,7 +306,7 @@ class AttributeSet extends MetadataType { delete attr[type + 'ConnectingID']; } else { throw new Error( - `Could not find ${type}AttributeID ${id} of relationship ${relationship.relationshipID}` + `Could not find ${type}AttributeID ${id} of relationship ${relationship.relationshipID}`, ); } } @@ -314,7 +314,7 @@ class AttributeSet extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} / ${ metadata[this.definition.keyField] - }: ${ex.message}` + }: ${ex.message}`, ); } } @@ -348,7 +348,7 @@ class AttributeSet extends MetadataType { this.systemValueDefinitions ||= {}; if (!this.systemValueDefinitions[this.buObject.mid]) { this.systemValueDefinitions[this.buObject.mid] = Object.values( - cache.getCache()['attributeSet'] + cache.getCache()['attributeSet'], ) .flatMap((item) => { if (item.isSystemDefined) { diff --git a/lib/metadataTypes/Automation.js b/lib/metadataTypes/Automation.js index e6f05f76f..0b014b117 100644 --- a/lib/metadataTypes/Automation.js +++ b/lib/metadataTypes/Automation.js @@ -48,7 +48,7 @@ class Automation extends MetadataType { const results = await this.client.soap.retrieveBulk( 'Program', ['ObjectID'], - requestParams + requestParams, ); // the API seems to handle 50 concurrent requests nicely const response = results?.Results?.length @@ -58,7 +58,7 @@ class Automation extends MetadataType { uri: '/automation/v1/automations/' + item.ObjectID, })), 50, - !key + !key, ) : null; metadataMap = response?.metadata || {}; @@ -75,7 +75,7 @@ class Automation extends MetadataType { metadataMap = await this.saveResults(metadataMap, retrieveDir, null, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(metadataMap).length})` + - Util.getKeysString(key) + Util.getKeysString(key), ); await this.runDocumentOnRetrieve(key, metadataMap); @@ -122,7 +122,7 @@ class Automation extends MetadataType { this.definition.bodyIteratorField = 'entry'; const automationLegacyMapObj = await super.retrieveREST( undefined, - `/legacy/v1/beta/bulk/automations/automation/definition/` + `/legacy/v1/beta/bulk/automations/automation/definition/`, ); this.definition.bodyIteratorField = iteratorBackup; const automationLegacyMap = Object.keys(automationLegacyMapObj.metadata) @@ -143,7 +143,7 @@ class Automation extends MetadataType { // this is a file so extended is at another endpoint try { const notificationsResult = await this.client.rest.get( - '/legacy/v1/beta/automations/notifications/' + automationLegacy.id + '/legacy/v1/beta/automations/notifications/' + automationLegacy.id, ); if (Array.isArray(notificationsResult?.workers)) { metadataMap[automationLegacy.key].notifications = @@ -166,18 +166,20 @@ class Automation extends MetadataType { } } catch (ex) { Util.logger.debug( - ` ☇ issue retrieving Notifications for automation ${automationLegacy.key}: ${ex.message} ${ex.code}` + ` ☇ issue retrieving Notifications for automation ${automationLegacy.key}: ${ex.message} ${ex.code}`, ); skipped++; } - }) - ) + }), + ), ); Util.logger.info( - Util.getGrayMsg(` Notifications found for ${found} automation${found === 1 ? '' : 's'}`) + Util.getGrayMsg( + ` Notifications found for ${found} automation${found === 1 ? '' : 's'}`, + ), ); Util.logger.debug( - `Notifications not found for ${skipped} automation${skipped === 1 ? '' : 's'}` + `Notifications not found for ${skipped} automation${skipped === 1 ? '' : 's'}`, ); return promiseMap; } @@ -211,9 +213,9 @@ class Automation extends MetadataType { operator: 'equals', rightOperand: a.ObjectID, }, - } - ) - ) + }, + ), + ), ) : []) { details.push(...item.Results); @@ -254,7 +256,7 @@ class Automation extends MetadataType { this.definition.bodyIteratorField = 'entry'; const automationsLegacy = await super.retrieveREST( undefined, - `/legacy/v1/beta/bulk/automations/automation/definition/` + `/legacy/v1/beta/bulk/automations/automation/definition/`, ); this.definition.keyField = keyBackup; this.definition.bodyIteratorField = iteratorBackup; @@ -298,7 +300,7 @@ class Automation extends MetadataType { return; } let details = await this.client.rest.get( - '/automation/v1/automations/' + metadata.ObjectID + '/automation/v1/automations/' + metadata.ObjectID, ); const metadataMap = this.parseResponseBody({ items: [details] }); if (Object.keys(metadataMap).length) { @@ -315,7 +317,7 @@ class Automation extends MetadataType { originalKey = parsedDetails[this.definition.keyField]; if (parsedDetails !== null) { val = JSON.parse( - Util.replaceByObject(JSON.stringify(parsedDetails), templateVariables) + Util.replaceByObject(JSON.stringify(parsedDetails), templateVariables), ); } } catch { @@ -323,7 +325,7 @@ class Automation extends MetadataType { } if (val === null) { throw new Error( - `Automations '${name}' was skipped and hence cannot be used for templating.` + `Automations '${name}' was skipped and hence cannot be used for templating.`, ); } // remove all fields not listed in Definition for templating @@ -331,7 +333,7 @@ class Automation extends MetadataType { await File.writeJSONToFile( [templateDir, this.definition.type].join('/'), originalKey + '.' + this.definition.type + '-meta', - val + val, ); Util.logger.info(`- templated ${this.definition.type}: ${name}`); return { metadata: val, type: this.definition.type }; @@ -358,7 +360,7 @@ class Automation extends MetadataType { } } catch { Util.logger.debug( - `- Schedule name '${metadata.schedule.timezoneName}' not found in definition.timeZoneMapping` + `- Schedule name '${metadata.schedule.timezoneName}' not found in definition.timeZoneMapping`, ); } return true; @@ -406,14 +408,14 @@ class Automation extends MetadataType { // get metadata type of activity activity.r__type = Util.inverseGet( this.definition.activityTypeMapping, - activity.objectTypeId + activity.objectTypeId, ); delete activity.objectTypeId; } catch { Util.logger.warn( ` - Unknown activity type '${activity.objectTypeId}'` + ` in step ${stepNumber}.${activity.displayOrder}` + - ` of Automation '${metadata.name}'` + ` of Automation '${metadata.name}'`, ); continue; } @@ -429,7 +431,7 @@ class Automation extends MetadataType { metadata[this.definition.keyField] } activity ${stepNumber}.${ activity.displayOrder - } due to missing activityObjectId: ${JSON.stringify(activity)}` + } due to missing activityObjectId: ${JSON.stringify(activity)}`, ); // empty if block continue; @@ -441,7 +443,7 @@ class Automation extends MetadataType { activity.displayOrder } because the type ${ activity.r__type - } is not set up as a dependency for ${this.definition.type}` + } is not set up as a dependency for ${this.definition.type}`, ); continue; } @@ -456,12 +458,12 @@ class Automation extends MetadataType { activity.r__type, activity.activityObjectId, Definitions[activity.r__type].idField, - Definitions[activity.r__type].nameField + Definitions[activity.r__type].nameField, ); if (name !== activity.name) { Util.logger.debug( ` - updated name of step ${stepNumber}.${activity.displayOrder}` + - ` in Automation '${metadata.name}' from ${activity.name} to ${name}` + ` in Automation '${metadata.name}' from ${activity.name} to ${name}`, ); activity.name = name; } @@ -470,14 +472,14 @@ class Automation extends MetadataType { Util.logger.warn( ` - Missing ${activity.r__type} activity '${activity.name}'` + ` in step ${stepNumber}.${activity.displayOrder}` + - ` of Automation '${metadata.name}' (${ex.message})` + ` of Automation '${metadata.name}' (${ex.message})`, ); } } else { Util.logger.warn( ` - Missing ${activity.r__type} activity '${activity.name}'` + ` in step ${stepNumber}.${activity.displayOrder}` + - ` of Automation '${metadata.name}' (Not Found in Cache)` + ` of Automation '${metadata.name}' (Not Found in Cache)`, ); } } @@ -488,7 +490,7 @@ class Automation extends MetadataType { Util.logger.warn( ` - ${this.definition.typeName} '${metadata[this.definition.nameField]}': ${ ex.message - }` + }`, ); return null; } @@ -511,7 +513,7 @@ class Automation extends MetadataType { metadataMap[resultKey] = results.metadata[resultKey]; } else { Util.logger.error( - ` - skipping ${this.definition.type} ${results.metadata[resultKey].name}: no valid schedule settings found.` + ` - skipping ${this.definition.type} ${results.metadata[resultKey].name}: no valid schedule settings found.`, ); } } @@ -533,14 +535,14 @@ class Automation extends MetadataType { Util.OPTIONS.schedule ? 'according to schedule' : 'to run once (use --schedule or --execute=schedule to schedule instead)' - }: ${Object.keys(metadataMap).length}` + }: ${Object.keys(metadataMap).length}`, ); const promiseResults = []; for (const key of Object.keys(metadataMap)) { if (Util.OPTIONS.schedule && metadataMap[key].status === 'Scheduled') { // schedule Util.logger.info( - ` - skipping ${this.definition.type} ${metadataMap[key].name}: already scheduled.` + ` - skipping ${this.definition.type} ${metadataMap[key].name}: already scheduled.`, ); } else { // schedule + runOnce @@ -594,7 +596,7 @@ class Automation extends MetadataType { return errors.map((msg) => msg .split('403 Forbidden') - .join('403 Forbidden: Please check if the automation is currently running.') + .join('403 Forbidden: Please check if the automation is currently running.'), ); } return errors; @@ -617,7 +619,7 @@ class Automation extends MetadataType { metadataMap[key] = results.metadata[key]; } else { Util.logger.error( - ` - skipping ${this.definition.type} ${results.metadata[key].name}: no valid schedule settings found.` + ` - skipping ${this.definition.type} ${results.metadata[key].name}: no valid schedule settings found.`, ); } } @@ -632,7 +634,7 @@ class Automation extends MetadataType { promiseResults.push(this.#pauseItem(metadataMap[key])); } else if (metadataMap[key].status === 'PausedSchedule') { Util.logger.info( - ` - skipping ${this.definition.type} ${metadataMap[key].name}: already paused.` + ` - skipping ${this.definition.type} ${metadataMap[key].name}: already paused.`, ); } else { Util.logger.error( @@ -640,7 +642,7 @@ class Automation extends MetadataType { metadataMap[key].name }: currently ${metadataMap[ key - ].status.toLowerCase()}. Please try again in a few minutes.` + ].status.toLowerCase()}. Please try again in a few minutes.`, ); } } @@ -671,12 +673,12 @@ class Automation extends MetadataType { }, }, 'pause', - {} + {}, ); Util.logger.info( ` - paused ${this.definition.type}: ${metadata[this.definition.keyField]} / ${ metadata[this.definition.nameField] - }` + }`, ); return { key: metadata[this.definition.keyField], response }; } catch (ex) { @@ -732,7 +734,7 @@ class Automation extends MetadataType { metadata[this.definition.keyField] || metadata[this.definition.nameField] } / ${ metadata[this.definition.nameField] - }: You cannot update an automation that's currently running. Please wait a bit and retry.` + }: You cannot update an automation that's currently running. Please wait a bit and retry.`, ); return null; } @@ -755,7 +757,7 @@ class Automation extends MetadataType { this.definition.timeZoneMapping[metadata.schedule.timezoneName]; } else { Util.logger.error( - `Could not find timezone ${metadata.schedule.timezoneName} in definition.timeZoneMapping` + `Could not find timezone ${metadata.schedule.timezoneName} in definition.timeZoneMapping`, ); } @@ -834,8 +836,8 @@ class Automation extends MetadataType { activity.name } to ${ this.createdKeyMap[buName].verification[activity.name] - }` - ) + }`, + ), ); // map structure: cred/bu --> type --> old key --> new key activity.name = @@ -846,7 +848,7 @@ class Automation extends MetadataType { activity.r__type, activity.name, Definitions[activity.r__type].nameField, - Definitions[activity.r__type].idField + Definitions[activity.r__type].idField, ); } activity.objectTypeId = @@ -886,13 +888,13 @@ class Automation extends MetadataType { // check if manual deploy required. if so then log warning if (this.definition.manualDeployTypes.includes(activity.r__type)) { Util.logger.warn( - `- ${this.definition.type} '${metadata.name}' requires additional manual configuration: '${activity.name}' in step ${stepNumber}.${displayOrder}` + `- ${this.definition.type} '${metadata.name}' requires additional manual configuration: '${activity.name}' in step ${stepNumber}.${displayOrder}`, ); } // cannot deploy because it is not supported else if (!this.definition.dependencies.includes(activity.r__type)) { errors.push( - ` • not supported ${activity.r__type} activity '${activity.name}' in step ${stepNumber}.${displayOrder}` + ` • not supported ${activity.r__type} activity '${activity.name}' in step ${stepNumber}.${displayOrder}`, ); deployable = false; } @@ -903,7 +905,7 @@ class Automation extends MetadataType { Util.logger.error( ` ☇ skipping ${this.definition.type} ${metadata[this.definition.keyField]} / ${ metadata[this.definition.nameField] - }:` + }:`, ); for (const error of errors) { Util.logger.error(error); @@ -953,7 +955,7 @@ class Automation extends MetadataType { // not existing for triggered automations scheduleHelper.timezoneName ||= Util.inverseGet( this.definition.timeZoneMapping, - scheduleHelper.timezoneId + scheduleHelper.timezoneId, ); } @@ -1006,7 +1008,7 @@ class Automation extends MetadataType { try { const result = await this.client.rest.post( '/legacy/v1/beta/automations/notifications/' + programId, - notificationBody + notificationBody, ); if (result) { // should be empty if all OK @@ -1014,13 +1016,13 @@ class Automation extends MetadataType { } } catch (ex) { Util.logger.error( - `Error updating notifications for automation '${metadataMap[key].name}': ${ex.message} (${ex.code}))` + `Error updating notifications for automation '${metadataMap[key].name}': ${ex.message} (${ex.code}))`, ); } Util.logger.info( Util.getGrayMsg( - ` - updated notifications for automation '${metadataMap[key].name}'` - ) + ` - updated notifications for automation '${metadataMap[key].name}'`, + ), ); } } @@ -1046,7 +1048,7 @@ class Automation extends MetadataType { schedule = this._buildSchedule(originalMetadataMap[oldKey].schedule); } catch (ex) { Util.logger.error( - `- Could not create schedule for automation '${originalMetadataMap[oldKey].name}' to start it: ${ex.message}` + `- Could not create schedule for automation '${originalMetadataMap[oldKey].name}' to start it: ${ex.message}`, ); } if (schedule !== null) { @@ -1068,7 +1070,7 @@ class Automation extends MetadataType { }, }, 'start', - {} + {}, ); const intervalString = (schedule_interval > 1 ? `${schedule_interval} ` : '') + @@ -1081,20 +1083,20 @@ class Automation extends MetadataType { originalMetadataMap[oldKey].name }' deployed as Active: runs every ${intervalString} starting ${ schedule_StartDateTime.split('T').join(' ').split('.')[0] - } ${schedule_timezoneString}` + } ${schedule_timezoneString}`, ); } catch { // API does not return anything usefull here. We have to know the rules instead Util.logger.error( - ` ☇ error starting scheduled ${this.definition.type}${key}: Please check schedule settings` + ` ☇ error starting scheduled ${this.definition.type}${key}: Please check schedule settings`, ); } } } else { Util.logger.info( Util.getGrayMsg( - ` - scheduled automation '${originalMetadataMap[oldKey].name}' deployed as Paused` - ) + ` - scheduled automation '${originalMetadataMap[oldKey].name}' deployed as Paused`, + ), ); } } @@ -1124,7 +1126,7 @@ class Automation extends MetadataType { 'folder', metadata[folderIdField], 'ID', - 'Path' + 'Path', ); delete metadata[folderIdField]; if (metadata.r__folder_Path !== 'my automations') { @@ -1133,14 +1135,14 @@ class Automation extends MetadataType { metadata[this.definition.nameField] }' is located in subfolder ${ metadata.r__folder_Path - }. Please note that creating automation folders is not supported via API and hence you will have to create it manually in the GUI if you choose to deploy this automation.` + }. Please note that creating automation folders is not supported via API and hence you will have to create it manually in the GUI if you choose to deploy this automation.`, ); } } catch (ex) { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }): Could not find folder (${ex.message})` + }): Could not find folder (${ex.message})`, ); } } @@ -1156,7 +1158,7 @@ class Automation extends MetadataType { 'folder', metadata.r__folder_Path, 'Path', - 'ID' + 'ID', ); if (metadata.r__folder_Path !== 'my automations') { Util.logger.warn( @@ -1164,13 +1166,13 @@ class Automation extends MetadataType { metadata[this.definition.nameField] }' is located in subfolder ${ metadata.r__folder_Path - }. Please note that creating automation folders is not supported via API and hence you will have to create it manually in the GUI if you choose to deploy this automation.` + }. Please note that creating automation folders is not supported via API and hence you will have to create it manually in the GUI if you choose to deploy this automation.`, ); } delete metadata.r__folder_Path; } catch { throw new Error( - `Folder '${metadata.r__folder_Path}' was not found on the server. Please create this manually in the GUI. Automation-folders cannot be deployed automatically.` + `Folder '${metadata.r__folder_Path}' was not found on the server. Please create this manually in the GUI. Automation-folders cannot be deployed automatically.`, ); } } @@ -1222,12 +1224,12 @@ class Automation extends MetadataType { // todo: add support for monthly // todo: add support for yearly throw new Error( - 'Scheduling automatically not supported for Weekly, Monthly and Yearly, please configure manually.' + 'Scheduling automatically not supported for Weekly, Monthly and Yearly, please configure manually.', ); } if (recurHelper.FREQ === 'MINUTELY' && recurHelper.INTERVAL && recurHelper.INTERVAL < 5) { throw new Error( - 'The smallest interval you can configure is 5 minutes. Please adjust your schedule.' + 'The smallest interval you can configure is 5 minutes. Please adjust your schedule.', ); } @@ -1236,7 +1238,7 @@ class Automation extends MetadataType { this.definition.timeZoneMapping[scheduleObject.timezoneName]; } else { throw new Error( - `Could not find timezone ${scheduleObject.timezoneName} in definition.timeZoneMapping` + `Could not find timezone ${scheduleObject.timezoneName} in definition.timeZoneMapping`, ); } schedule.TimeZone.ID = scheduleObject.timezoneId; @@ -1280,7 +1282,7 @@ class Automation extends MetadataType { // earliest start 1 minute from now // the same time which would slow performance futureDate.setMinutes( - futureDate.getMinutes() + 1 + Math.ceil(Math.random() * 15) + futureDate.getMinutes() + 1 + Math.ceil(Math.random() * 15), ); break; @@ -1298,7 +1300,7 @@ class Automation extends MetadataType { schedule.StartDateTime = this._calcTime( this.properties.options.serverTimeOffset, schedule.StartDateTime, - schedule._timezoneString + schedule._timezoneString, ); if (recurHelper.UNTIL) { @@ -1434,7 +1436,7 @@ class Automation extends MetadataType { column.description ? `
_${column.description.replaceAll('\n', '
')}
_` : '' - } ` + } `, ); tableSeparator += '| --- '; } @@ -1468,7 +1470,7 @@ class Automation extends MetadataType { json.steps.map((step, index) => ({ title: `Step ${index + 1}`, description: step.name || '-', - })) + })), ); let maxActivities = 0; for (const step of json.steps) { @@ -1485,8 +1487,8 @@ class Automation extends MetadataType { name: step.activities[activityIndex].name, type: step.activities[activityIndex].r__type, } - : null - ) + : null, + ), ); } } @@ -1516,7 +1518,7 @@ class Automation extends MetadataType { this.buObject.credential, this.buObject.businessUnit, ]), - true + true, ).automation; } const docPath = File.normalizePath([ @@ -1531,8 +1533,8 @@ class Automation extends MetadataType { } return await Promise.all( Object.keys(metadata).map((key) => - this._writeDoc(docPath + '/', key, metadata[key], 'md') - ) + this._writeDoc(docPath + '/', key, metadata[key], 'md'), + ), ); } } diff --git a/lib/metadataTypes/Campaign.js b/lib/metadataTypes/Campaign.js index 00032f1d7..98326dc08 100644 --- a/lib/metadataTypes/Campaign.js +++ b/lib/metadataTypes/Campaign.js @@ -25,17 +25,17 @@ class Campaign extends MetadataType { retrieveDir, '/legacy/v1/beta2/data/campaign/', null, - key + key, ); // get assignments Util.logger.info(`Retrieving: campaignAsset`); const campaignAssets = await Promise.all( Object.keys(res.metadata).map((key) => - this.getAssetTags(retrieveDir, res.metadata[key].campaignId, key) - ) + this.getAssetTags(retrieveDir, res.metadata[key].campaignId, key), + ), ); Util.logger.info( - `Downloaded: campaignAsset (${campaignAssets.flat().length})` + Util.getKeysString(key) + `Downloaded: campaignAsset (${campaignAssets.flat().length})` + Util.getKeysString(key), ); return res; @@ -64,7 +64,7 @@ class Campaign extends MetadataType { await File.writeJSONToFile( `${retrieveDir}/campaign/${name}/assets/`, asset.id + '.campaignAsset-meta', - asset + asset, ); } return res.items; diff --git a/lib/metadataTypes/ContentArea.js b/lib/metadataTypes/ContentArea.js index a67049c92..6bb18163f 100644 --- a/lib/metadataTypes/ContentArea.js +++ b/lib/metadataTypes/ContentArea.js @@ -22,7 +22,7 @@ class ContentArea extends MetadataType { */ static retrieve(retrieveDir, _, __, key) { Util.logger.warn( - ' - Classic Content Areas are deprecated and will be discontinued by SFMC in the near future. Ensure that you migrate any existing Content Areas to Content Builder as soon as possible.' + ' - Classic Content Areas are deprecated and will be discontinued by SFMC in the near future. Ensure that you migrate any existing Content Areas to Content Builder as soon as possible.', ); /** @type {TYPE.SoapRequestParams} */ let requestParams = null; @@ -58,14 +58,14 @@ class ContentArea extends MetadataType { 'folder', metadata[this.definition.folderIdField], 'ID', - 'Path' + 'Path', ); delete metadata[this.definition.folderIdField]; } catch (ex) { Util.logger.debug( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }): Could not find folder (${ex.message})` + }): Could not find folder (${ex.message})`, ); // classic content blocks that reside in the main folder are // saved with CategoryID=0, instead of to the actual ID of diff --git a/lib/metadataTypes/DataExtension.js b/lib/metadataTypes/DataExtension.js index 5e4a8cad5..10a9d349f 100644 --- a/lib/metadataTypes/DataExtension.js +++ b/lib/metadataTypes/DataExtension.js @@ -62,7 +62,7 @@ class DataExtension extends MetadataType { Util.logger.error( ` ☇ skipping ${this.definition.type} ${ metadataMap[metadataKey][this.definition.keyField] - } / ${metadataMap[metadataKey][this.definition.nameField]}: ${ex.message}` + } / ${metadataMap[metadataKey][this.definition.nameField]}: ${ex.message}`, ); delete metadataMap[metadataKey]; // skip rest of handling for this DE @@ -74,12 +74,12 @@ class DataExtension extends MetadataType { metadataKey, false, metadataToUpdate, - metadataToCreate + metadataToCreate, ); } if (metadataToUpdate.length) { Util.logger.info( - ' - Please note that Data Retention Policies can only be set during creation, not during update.' + ' - Please note that Data Retention Policies can only be set during creation, not during update.', ); } const createLimit = pLimit(10); @@ -87,7 +87,7 @@ class DataExtension extends MetadataType { await Promise.allSettled( metadataToCreate .filter((r) => r !== undefined && r !== null) - .map((metadataEntry) => createLimit(() => this.create(metadataEntry))) + .map((metadataEntry) => createLimit(() => this.create(metadataEntry))), ) ) .filter((r) => r !== undefined && r !== null) @@ -99,8 +99,8 @@ class DataExtension extends MetadataType { metadataToUpdate .filter((r) => r !== undefined && r !== null) .map((metadataEntry) => - updateLimit(() => this.update(metadataEntry.after, metadataEntry.before)) - ) + updateLimit(() => this.update(metadataEntry.after, metadataEntry.before)), + ), ) ) .filter((r) => r !== undefined && r !== null) @@ -109,7 +109,7 @@ class DataExtension extends MetadataType { const successfulResults = [...createResults, ...updateResults]; Util.logger.info( `${this.definition.type} upsert: ${createResults.length} of ${metadataToCreate.length} created / ${updateResults.length} of ${metadataToUpdate.length} updated` + - (filteredByPreDeploy > 0 ? ` / ${filteredByPreDeploy} filtered` : '') + (filteredByPreDeploy > 0 ? ` / ${filteredByPreDeploy} filtered` : ''), ); let upsertResults; if (successfulResults.length > 0) { @@ -150,14 +150,14 @@ class DataExtension extends MetadataType { metadataKey, hasError, metadataToUpdate, - metadataToCreate + metadataToCreate, ) { const action = await super.createOrUpdate( metadataMap, metadataKey, hasError, metadataToUpdate, - metadataToCreate + metadataToCreate, ); if (action === 'update') { @@ -169,7 +169,7 @@ class DataExtension extends MetadataType { DataExtension.oldFields[metadataMap[metadataKey][this.definition.keyField]] = await DataExtensionField.prepareDeployColumnsOnUpdate( metadataMap[metadataKey].Fields, - metadataKey + metadataKey, ); if ( @@ -178,7 +178,7 @@ class DataExtension extends MetadataType { ) { // changeKeyValue / changeKeyField used Util.logger.warn( - ` - ${this.definition.type} ${metadataKey}: Cannot change fields while updating the key. Skipping field update in favor of key update.` + ` - ${this.definition.type} ${metadataKey}: Cannot change fields while updating the key. Skipping field update in favor of key update.`, ); metadataMap[metadataKey].Fields.length = 0; } @@ -225,7 +225,7 @@ class DataExtension extends MetadataType { '- error upserting dataExtension: ' + (res.value.Results[0].Object ? res.value.Results[0].Object.Name : '') + '. ' + - res.value.Results[0].StatusMessage + res.value.Results[0].StatusMessage, ); return false; } else if (res.status === 'fulfilled' && res?.value?.faultstring) { @@ -264,7 +264,7 @@ class DataExtension extends MetadataType { ) { metadata.RetainUntil = ''; Util.logger.warn( - ` - RetainUntil date was reset automatically because RetentionPeriod info was found in: ${metadata.CustomerKey}` + ` - RetainUntil date was reset automatically because RetentionPeriod info was found in: ${metadata.CustomerKey}`, ); } } @@ -315,7 +315,7 @@ class DataExtension extends MetadataType { // get list of updated fields /** @type {TYPE.DataExtensionFieldItem[]} */ const updatedFieldsArr = originalMetadata[oldKey].Fields.Field.filter( - (field) => field.ObjectID && field.ObjectID !== '' + (field) => field.ObjectID && field.ObjectID !== '', ); // convert existing fields obj into array and sort /** @type {TYPE.DataExtensionFieldItem[]} */ @@ -326,7 +326,7 @@ class DataExtension extends MetadataType { // check if the current field was updated and then override with it. otherwise use existing value const field = updatedFieldsArr.find( - (field) => field.ObjectID === existingField.ObjectID + (field) => field.ObjectID === existingField.ObjectID, ) || existingField; // field does not have a ordinal value because we rely on array order field.Ordinal = existingField.Ordinal; @@ -339,7 +339,7 @@ class DataExtension extends MetadataType { // get list of new fields /** @type {TYPE.DataExtensionFieldItem[]} */ const newFieldsArr = originalMetadata[oldKey].Fields.Field.filter( - (field) => !field.ObjectID + (field) => !field.ObjectID, ); // push new fields to end of list if (newFieldsArr.length) { @@ -384,7 +384,7 @@ class DataExtension extends MetadataType { // find all shared data extensions if (!this.deployedSharedKeys.length) { Util.logger.debug( - `Skipping fixShared logic because no Shared Data Extensions were updated` + `Skipping fixShared logic because no Shared Data Extensions were updated`, ); return; } @@ -409,7 +409,7 @@ class DataExtension extends MetadataType { key, 'CustomerKey', 'ObjectID', - this.buObject.eid + this.buObject.eid, ); sharedDataExtensionMap[id] = key; } catch { @@ -420,7 +420,7 @@ class DataExtension extends MetadataType { // run the fix-data-model logic Util.logger.info( `Fixing Shared Data Extensions details in data models of child BUs` + - Util.getKeysString(sharedDataExtensionsKeys) + Util.getKeysString(sharedDataExtensionsKeys), ); for (const buName of selectedBuNames) { @@ -433,10 +433,10 @@ class DataExtension extends MetadataType { this.client = clientBak; } else { Util.logger.warn( - 'Shared Data Extensions were updated but --fixShared option is not set. This can result in your changes not being visible in attribute groups on child BUs.' + 'Shared Data Extensions were updated but --fixShared option is not set. This can result in your changes not being visible in attribute groups on child BUs.', ); Util.logger.info( - 'We recommend to re-run your deployment with the --fixShared option unless you are sure your Shared Data Extension is not used in attribute groups on any child BU.' + 'We recommend to re-run your deployment with the --fixShared option unless you are sure your Shared Data Extension is not used in attribute groups on any child BU.', ); } } @@ -450,7 +450,7 @@ class DataExtension extends MetadataType { const buListObj = this.properties.credentials[this.buObject.credential].businessUnits; const fixBuPreselected = []; const availableBuNames = Object.keys(buListObj).filter( - (buName) => buName !== Util.parentBuName + (buName) => buName !== Util.parentBuName, ); if (typeof Util.OPTIONS.fixShared === 'string') { if (Util.OPTIONS.fixShared === '*') { @@ -463,7 +463,7 @@ class DataExtension extends MetadataType { .split(',') .filter(Boolean) .map((bu) => bu.trim()) - .filter((bu) => availableBuNames.includes(bu)) + .filter((bu) => availableBuNames.includes(bu)), ); } } @@ -507,7 +507,7 @@ class DataExtension extends MetadataType { childBuName, buObjectParent, clientParent, - sharedDataExtensionMap + sharedDataExtensionMap, ) { /** @type {TYPE.BuObject} */ const buObjectChildBu = { @@ -525,15 +525,15 @@ class DataExtension extends MetadataType { AttributeSet.client = clientChildBu; const sharedDeIdsUsedOnBU = await AttributeSet.fixShared_retrieve( sharedDataExtensionMap, - DataExtensionField.fixShared_fields + DataExtensionField.fixShared_fields, ); if (sharedDeIdsUsedOnBU.length) { let sharedDataExtensionsKeys = sharedDeIdsUsedOnBU.map( - (deId) => sharedDataExtensionMap[deId] + (deId) => sharedDataExtensionMap[deId], ); Util.logger.info( ` - Fixing dataExtensions on BU ${childBuName} ` + - Util.getKeysString(sharedDataExtensionsKeys) + Util.getKeysString(sharedDataExtensionsKeys), ); for (const deId of sharedDeIdsUsedOnBU) { @@ -544,12 +544,12 @@ class DataExtension extends MetadataType { buObjectChildBu, clientChildBu, buObjectParent, - clientParent + clientParent, ); if (!fixed) { // remove from list of shared DEs that were fixed sharedDataExtensionsKeys = sharedDataExtensionsKeys.filter( - (key) => key !== sharedDataExtensionMap[deId] + (key) => key !== sharedDataExtensionMap[deId], ); } } @@ -557,15 +557,15 @@ class DataExtension extends MetadataType { Util.logger.debug( ` - Fixed ${sharedDataExtensionsKeys.length}/${ sharedDeIdsUsedOnBU.length - }: ${sharedDataExtensionsKeys.join(', ')}` + }: ${sharedDataExtensionsKeys.join(', ')}`, ); } return sharedDataExtensionsKeys; } else { Util.logger.info( Util.getGrayMsg( - ` - No matching attributeSet found for given Shared Data Extensions keys found on BU ${childBuName}` - ) + ` - No matching attributeSet found for given Shared Data Extensions keys found on BU ${childBuName}`, + ), ); return []; } @@ -593,7 +593,7 @@ class DataExtension extends MetadataType { buObjectChildBu, clientChildBu, buObjectParent, - clientParent + clientParent, ) { try { // add field via child BU @@ -601,7 +601,7 @@ class DataExtension extends MetadataType { buObjectChildBu, clientChildBu, deKey, - deId + deId, ); // get field ID from parent BU (it is not returned on child BU) @@ -609,7 +609,7 @@ class DataExtension extends MetadataType { randomSuffix, buObjectParent, clientParent, - deKey + deKey, ); // delete field via child BU @@ -618,17 +618,17 @@ class DataExtension extends MetadataType { buObjectChildBu, clientChildBu, deKey, - fieldObjectID + fieldObjectID, ); Util.logger.info( - ` - Fixed dataExtension ${deKey} on BU ${buObjectChildBu.businessUnit}` + ` - Fixed dataExtension ${deKey} on BU ${buObjectChildBu.businessUnit}`, ); return true; } catch (ex) { Util.logger.error( - `- error fixing dataExtension ${deKey} on BU ${buObjectChildBu.businessUnit}: ${ex.message}` + `- error fixing dataExtension ${deKey} on BU ${buObjectChildBu.businessUnit}: ${ex.message}`, ); return false; } @@ -669,7 +669,7 @@ class DataExtension extends MetadataType { ], }, }, - null + null, ); return randomSuffix; } @@ -696,7 +696,7 @@ class DataExtension extends MetadataType { rightOperand: fieldKey, }, }, - ['Name', 'ObjectID'] + ['Name', 'ObjectID'], ); const fieldObjectID = fieldResponse.metadata[fieldKey]?.ObjectID; return fieldObjectID; @@ -718,13 +718,13 @@ class DataExtension extends MetadataType { buObjectChildBu, clientChildBu, deKey, - fieldObjectID + fieldObjectID, ) { DataExtensionField.buObject = buObjectChildBu; DataExtensionField.client = clientChildBu; await DataExtensionField.deleteByKeySOAP( deKey + '.TriggerUpdate' + randomSuffix, - fieldObjectID + fieldObjectID, ); } @@ -774,7 +774,7 @@ class DataExtension extends MetadataType { const savedMetadata = await super.saveResults(metadata, retrieveDir, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(key) + Util.getKeysString(key), ); await this.runDocumentOnRetrieve(key, savedMetadata); } @@ -831,7 +831,7 @@ class DataExtension extends MetadataType { metadataParentBu[metadataEntry].CategoryID, 'ID', 'ContentType', - this.buObject.eid + this.buObject.eid, ); if (!folderTypesFromParent.includes(folderContentType)) { // Util.logger.verbose( @@ -841,7 +841,7 @@ class DataExtension extends MetadataType { } } catch (ex) { Util.logger.debug( - `removing ${metadataEntry} because of error while retrieving r__folder_ContentType: ${ex.message}` + `removing ${metadataEntry} because of error while retrieving r__folder_ContentType: ${ex.message}`, ); delete metadataParentBu[metadataEntry]; } @@ -921,7 +921,7 @@ class DataExtension extends MetadataType { 'dataExtensionTemplate', metadata.Template.CustomerKey, 'CustomerKey', - 'Name' + 'Name', ); delete metadata.Template; } catch (ex) { @@ -933,7 +933,7 @@ class DataExtension extends MetadataType { Util.logger.warn( ` - Issue with dataExtension '${ metadata[this.definition.nameField] - }': Could not find specified DataExtension Template. Please note that DataExtensions based on SMSMessageTracking and SMSSubscriptionLog cannot be deployed automatically across BUs at this point.` + }': Could not find specified DataExtension Template. Please note that DataExtensions based on SMSMessageTracking and SMSSubscriptionLog cannot be deployed automatically across BUs at this point.`, ); } } @@ -1027,7 +1027,7 @@ class DataExtension extends MetadataType { } if (metadata.r__folder_Path?.startsWith('Synchronized Data Extensions')) { throw new Error( - `Cannot Create/Update a Synchronized Data Extension. Please use Contact Builder to maintain these` + `Cannot Create/Update a Synchronized Data Extension. Please use Contact Builder to maintain these`, ); } @@ -1057,7 +1057,7 @@ class DataExtension extends MetadataType { 'dataExtensionTemplate', metadata.r__dataExtensionTemplate_Name, 'Name', - 'CustomerKey' + 'CustomerKey', ), }; delete metadata.r__dataExtensionTemplate_Name; @@ -1068,7 +1068,7 @@ class DataExtension extends MetadataType { // A workaround for cross-BU deploy exists but it's likely not beneficial to explain to users: // Create a DE based on the not-supported template on the target BU, retrieve it, copy the Template.CustomerKey into the to-be-deployed DE (or use mcdev-templating), done throw new Error( - `Could not find specified DataExtension Template. Please note that DataExtensions based on SMSMessageTracking and SMSSubscriptionLog cannot be deployed automatically across BUs at this point.` + `Could not find specified DataExtension Template. Please note that DataExtensions based on SMSMessageTracking and SMSSubscriptionLog cannot be deployed automatically across BUs at this point.`, ); } } @@ -1253,7 +1253,7 @@ class DataExtension extends MetadataType { this.buObject.credential, this.buObject.businessUnit, ]), - true + true, ).dataExtension; } } catch (ex) { @@ -1299,7 +1299,7 @@ class DataExtension extends MetadataType { key, metadataMap[key], 'html', - columnsToPrint + columnsToPrint, ); } if (['md', 'both'].includes(this.properties.options.documentType)) { @@ -1308,11 +1308,11 @@ class DataExtension extends MetadataType { key, metadataMap[key], 'md', - columnsToPrint + columnsToPrint, ); } } - }) + }), ); } @@ -1380,17 +1380,17 @@ class DataExtension extends MetadataType { const originalKey = key; const metadataCleaned = JSON.parse( - JSON.stringify(await this.postRetrieveTasks(metadata[key])) + JSON.stringify(await this.postRetrieveTasks(metadata[key])), ); this.keepTemplateFields(metadataCleaned); const metadataTemplated = JSON.parse( - Util.replaceByObject(JSON.stringify(metadataCleaned), templateVariables) + Util.replaceByObject(JSON.stringify(metadataCleaned), templateVariables), ); await File.writeJSONToFile( [templateDir, this.definition.type].join('/'), originalKey + '.' + this.definition.type + '-meta', - metadataTemplated + metadataTemplated, ); } catch (ex) { Util.metadataLogger('error', this.definition.type, 'retrieve', ex, key); @@ -1415,7 +1415,7 @@ class DataExtension extends MetadataType { 'folder', metadata[this.definition.folderIdField], 'ID', - 'ContentType' + 'ContentType', ); } catch (ex) { if (/(_Salesforce)(_\d\d?\d?)?$/.test(metadata.Name)) { @@ -1426,7 +1426,7 @@ class DataExtension extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }): Could not find folder (${ex.message})` + }): Could not find folder (${ex.message})`, ); } } @@ -1436,7 +1436,7 @@ class DataExtension extends MetadataType { 'folder', metadata[this.definition.folderIdField], 'ID', - 'Path' + 'Path', ); delete metadata[this.definition.folderIdField]; } catch (ex) { @@ -1446,14 +1446,14 @@ class DataExtension extends MetadataType { if (!verbose) { Util.logger.verbose( - `Synchronized Data Extension of other BU found: '${metadata.Name}'. Setting folder to 'Synchronized Data Extensions'` + `Synchronized Data Extension of other BU found: '${metadata.Name}'. Setting folder to 'Synchronized Data Extensions'`, ); } } else if (!error) { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }): ${ex.message}` + }): ${ex.message}`, ); } } diff --git a/lib/metadataTypes/DataExtensionField.js b/lib/metadataTypes/DataExtensionField.js index ec0eeb329..9dd06de1d 100644 --- a/lib/metadataTypes/DataExtensionField.js +++ b/lib/metadataTypes/DataExtensionField.js @@ -107,7 +107,7 @@ class DataExtensionField extends MetadataType { let hasData = false; try { const rowset = await this.client.rest.get( - `/data/v1/customobjectdata/key/${deKey}/rowset?$page=1&$pagesize=1` + `/data/v1/customobjectdata/key/${deKey}/rowset?$page=1&$pagesize=1`, ); const rowCount = rowset.count; hasData = rowCount > 0; @@ -125,7 +125,7 @@ class DataExtensionField extends MetadataType { rightOperand: deKey, }, }, - ['Name', 'ObjectID'] + ['Name', 'ObjectID'], ); const fieldsObj = response.metadata; @@ -147,7 +147,7 @@ class DataExtensionField extends MetadataType { if (itemOld.FieldType !== item.FieldType) { // applicable: with or without data but simply ignored by API Util.logger.warn( - ` - The Field Type of an existing field cannot be changed. Keeping the original value for [${deKey}].[${item.Name}]: '${itemOld.FieldType}'` + ` - The Field Type of an existing field cannot be changed. Keeping the original value for [${deKey}].[${item.Name}]: '${itemOld.FieldType}'`, ); item.FieldType = itemOld.FieldType; } @@ -160,14 +160,14 @@ class DataExtensionField extends MetadataType { if (itemOld.MaxLength > item.MaxLength) { // applicable: with or without data (Code 310007) Util.logger.warn( - ` - The length of an existing field cannot be decreased. Keeping the original value for [${deKey}].[${item.Name}]: '${itemOld.MaxLength}'` + ` - The length of an existing field cannot be decreased. Keeping the original value for [${deKey}].[${item.Name}]: '${itemOld.MaxLength}'`, ); item.MaxLength = itemOld.MaxLength; } if (Util.isFalse(itemOld.IsRequired) && Util.isTrue(item.IsRequired)) { // applicable: with or without data (Code 310007) Util.logger.warn( - ` - A field cannot be changed to be required on update after it was created to allow nulls. Resetting to not equired: [${deKey}].[${item.Name}]` + ` - A field cannot be changed to be required on update after it was created to allow nulls. Resetting to not equired: [${deKey}].[${item.Name}]`, ); item.IsRequired = itemOld.IsRequired; } @@ -175,7 +175,7 @@ class DataExtensionField extends MetadataType { // enable renaming if (item.Name_new) { Util.logger.info( - ` - Found Name_new='${item.Name_new}' for field ${deKey}.${item.Name} - trying to rename.` + ` - Found Name_new='${item.Name_new}' for field ${deKey}.${item.Name} - trying to rename.`, ); item.Name = item.Name_new; delete item.Name_new; @@ -207,19 +207,19 @@ class DataExtensionField extends MetadataType { // applicable: with data only if (Util.isFalse(item.IsPrimaryKey)) { Util.logger.warn( - ` - Adding new fields to an existing table requires that these fields are either not-required (nullable) or have a default value set. Changing [${deKey}].[${item.Name}] to be not-required` + ` - Adding new fields to an existing table requires that these fields are either not-required (nullable) or have a default value set. Changing [${deKey}].[${item.Name}] to be not-required`, ); item.IsRequired = false; } else { Util.logger.error( - `- You cannot add a new primary key field to an existing table that has data. Removing [${deKey}].[${item.Name}] from deployment` + `- You cannot add a new primary key field to an existing table that has data. Removing [${deKey}].[${item.Name}] from deployment`, ); deployColumns.splice(i, 1); } } if (item.Name_new) { Util.logger.info( - ` - Found Name_new='${item.Name_new}' for field ${deKey}.${item.Name} but could not find a corresponding DE field on the server - adding new field instead of updating.` + ` - Found Name_new='${item.Name_new}' for field ${deKey}.${item.Name} but could not find a corresponding DE field on the server - adding new field instead of updating.`, ); delete item.Name_new; } @@ -231,7 +231,7 @@ class DataExtensionField extends MetadataType { if (Util.isTrue(item.IsPrimaryKey) && Util.isFalse(item.IsRequired)) { // applicable: with or without data Util.logger.warn( - `- Primary Key field [${deKey}].[${item.Name}] cannot be not-required (nullable). Changing field to be required!` + `- Primary Key field [${deKey}].[${item.Name}] cannot be not-required (nullable). Changing field to be required!`, ); item.IsRequired = true; } @@ -239,13 +239,13 @@ class DataExtensionField extends MetadataType { // filter bad manual changes to the json if (!Util.isTrue(item.IsRequired) && !Util.isFalse(item.IsRequired)) { Util.logger.error( - `- Invalid value for 'IsRequired' of [${deKey}].[${item.Name}]. Found '${item.IsRequired}' instead of 'true'/'false'. Removing field from deploy!` + `- Invalid value for 'IsRequired' of [${deKey}].[${item.Name}]. Found '${item.IsRequired}' instead of 'true'/'false'. Removing field from deploy!`, ); deployColumns.splice(i, 1); } if (!Util.isTrue(item.IsPrimaryKey) && !Util.isFalse(item.IsPrimaryKey)) { Util.logger.error( - `- Invalid value for 'IsPrimaryKey' of [${deKey}].[${item.Name}]. Found '${item.IsPrimaryKey}' instead of 'true'/'false'. Removing field from deploy!` + `- Invalid value for 'IsPrimaryKey' of [${deKey}].[${item.Name}]. Found '${item.IsPrimaryKey}' instead of 'true'/'false'. Removing field from deploy!`, ); deployColumns.splice(i, 1); } @@ -255,8 +255,8 @@ class DataExtensionField extends MetadataType { Util.getGrayMsg( ` - Found ${deployColumns.length} added/updated Fields for ${deKey}${ deployColumns.length ? ': ' : '' - }` + deployColumns.map((item) => item.Name).join(', ') - ) + }` + deployColumns.map((item) => item.Name).join(', '), + ), ); return existingFieldByName; @@ -294,7 +294,7 @@ class DataExtensionField extends MetadataType { rightOperand: customerKey, }, }, - ['Name', 'ObjectID'] + ['Name', 'ObjectID'], ); fieldObjectID = response.metadata[customerKey]?.ObjectID; } @@ -316,7 +316,7 @@ class DataExtensionField extends MetadataType { this.client.soap.delete( 'DataExtension', // yes, not DataExtensionField keyObj, - null + null, ); if (!fieldId) { @@ -329,7 +329,7 @@ class DataExtensionField extends MetadataType { ? `${ex.results[0].StatusMessage} (Code ${ex.results[0].ErrorCode})` : ex.message; Util.logger.error( - `- error deleting ${this.definition.type} '${customerKey}': ${errorMsg}` + `- error deleting ${this.definition.type} '${customerKey}': ${errorMsg}`, ); return false; @@ -344,7 +344,7 @@ class DataExtensionField extends MetadataType { static async postDeleteTasks(customerKey) { // TODO actually clean up local dataextension json Util.logger.warn( - ` - The dataExtension for ${customerKey} wasn't updated locally yet after removing this field.` + ` - The dataExtension for ${customerKey} wasn't updated locally yet after removing this field.`, ); } } diff --git a/lib/metadataTypes/DataExtract.js b/lib/metadataTypes/DataExtract.js index c6cdf0168..6e2b6f1c3 100644 --- a/lib/metadataTypes/DataExtract.js +++ b/lib/metadataTypes/DataExtract.js @@ -44,7 +44,7 @@ class DataExtract extends MetadataType { */ static async retrieveAsTemplate(templateDir, name, templateVariables) { const res = await this.client.rest.get( - '/automation/v1/dataextracts/?$filter=name%20eq%20' + encodeURIComponent(name) + '/automation/v1/dataextracts/?$filter=name%20eq%20' + encodeURIComponent(name), ); if (Array.isArray(res.items) && res.items.length) { // eq-operator returns a similar, not exact match and hence might return more than 1 entry @@ -56,14 +56,14 @@ class DataExtract extends MetadataType { // get full definition const extended = await this.client.rest.get( - '/automation/v1/dataextracts/' + metadata[this.definition.idField] + '/automation/v1/dataextracts/' + metadata[this.definition.idField], ); const originalKey = extended[this.definition.keyField]; const val = JSON.parse( Util.replaceByObject( JSON.stringify(this.parseMetadata(extended)), - templateVariables - ) + templateVariables, + ), ); // remove all fields listed in Definition for templating @@ -71,7 +71,7 @@ class DataExtract extends MetadataType { await File.writeJSONToFile( [templateDir, this.definition.type].join('/'), originalKey + '.' + this.definition.type + '-meta', - JSON.parse(Util.replaceByObject(JSON.stringify(val), templateVariables)) + JSON.parse(Util.replaceByObject(JSON.stringify(val), templateVariables)), ); Util.logger.info(`- templated ${this.definition.type}: ${name}`); return { metadata: val, type: this.definition.type }; @@ -81,7 +81,7 @@ class DataExtract extends MetadataType { throw new Error( `Encountered unknown error when retrieveing ${ this.definition.typeName - } "${name}": ${JSON.stringify(res)}` + } "${name}": ${JSON.stringify(res)}`, ); } } @@ -115,7 +115,7 @@ class DataExtract extends MetadataType { static update(dataExtract) { return super.updateREST( dataExtract, - '/automation/v1/dataextracts/' + dataExtract.dataExtractDefinitionId + '/automation/v1/dataextracts/' + dataExtract.dataExtractDefinitionId, ); } @@ -130,7 +130,7 @@ class DataExtract extends MetadataType { 'dataExtractType', metadata.r__dataExtractType_name, 'name', - 'extractId' + 'extractId', ); delete metadata.r__dataExtractType_name; return metadata; @@ -147,12 +147,12 @@ class DataExtract extends MetadataType { 'dataExtractType', metadata.dataExtractTypeId, 'extractId', - 'name' + 'name', ); delete metadata.dataExtractTypeId; } catch (ex) { Util.logger.warn( - ` - ${this.definition.type} ${metadata[this.definition.keyField]}: ${ex.message}` + ` - ${this.definition.type} ${metadata[this.definition.keyField]}: ${ex.message}`, ); } return JSON.parse(JSON.stringify(metadata)); diff --git a/lib/metadataTypes/Discovery.js b/lib/metadataTypes/Discovery.js index 803c96e14..d8e431f79 100644 --- a/lib/metadataTypes/Discovery.js +++ b/lib/metadataTypes/Discovery.js @@ -27,8 +27,8 @@ class Discovery extends MetadataType { if (this.buObject.eid === this.buObject.mid) { const res = await this.client.rest.getCollection( Object.keys(this.definition.endPointMapping).map( - (endpoint) => this.definition.endPointMapping[endpoint] - ) + (endpoint) => this.definition.endPointMapping[endpoint], + ), ); const metadataStructure = {}; diff --git a/lib/metadataTypes/Email.js b/lib/metadataTypes/Email.js index f4b3c0d4c..47bea9d6e 100644 --- a/lib/metadataTypes/Email.js +++ b/lib/metadataTypes/Email.js @@ -47,7 +47,7 @@ class Email extends MetadataType { if (Object.keys(results).length) { // only execute the following if records were found Util.logger.warn( - ' - Classic E-Mails are deprecated and will be discontinued by SFMC in the near future. Ensure that you migrate any existing E-Mails to Content Builder as soon as possible.' + ' - Classic E-Mails are deprecated and will be discontinued by SFMC in the near future. Ensure that you migrate any existing E-Mails to Content Builder as soon as possible.', ); } return super.saveResults(results, retrieveDir, overrideType, templateVariables); diff --git a/lib/metadataTypes/EmailSend.js b/lib/metadataTypes/EmailSend.js index 38474bd56..f97d44891 100644 --- a/lib/metadataTypes/EmailSend.js +++ b/lib/metadataTypes/EmailSend.js @@ -112,7 +112,7 @@ class EmailSend extends MetadataType { 'asset', metadata.r__assetMessage_Key, 'customerKey', - 'legacyData.legacyId' + 'legacyData.legacyId', ); delete metadata.r__assetMessage_Key; delete metadata.r__assetMessage_Name; @@ -126,7 +126,7 @@ class EmailSend extends MetadataType { 'asset', metadata.r__assetMessage_Key.slice(0, Math.max(0, 36 - suffix.length)) + suffix, 'customerKey', - 'legacyData.legacyId' + 'legacyData.legacyId', ); delete metadata.r__assetMessage_Key; delete metadata.r__assetMessage_Name; @@ -147,19 +147,19 @@ class EmailSend extends MetadataType { if (sdl.r__dataExtension_Key) { if (sdl.DataSourceTypeID !== 'CustomObject') { throw new Error( - ` ☇ skipping ${this.definition.type} ${metadata.Name} (${metadata.CustomerKey}): Expecting DataSourceTypeID to equal 'CustomObject' when r__dataExtension_Key is defined; Found '${sdl.DataSourceTypeID}'` + ` ☇ skipping ${this.definition.type} ${metadata.Name} (${metadata.CustomerKey}): Expecting DataSourceTypeID to equal 'CustomObject' when r__dataExtension_Key is defined; Found '${sdl.DataSourceTypeID}'`, ); } sdl.CustomObjectID = cache.searchForField( 'dataExtension', sdl.r__dataExtension_Key, 'CustomerKey', - 'ObjectID' + 'ObjectID', ); delete sdl.r__dataExtension_Key; } else if (sdl.DataSourceTypeID === 'CustomObject') { throw new Error( - ` ☇ skipping ${this.definition.type} ${metadata.Name} (${metadata.CustomerKey}): Expecting r__dataExtension_Key to be defined if DataSourceTypeID='CustomObject'` + ` ☇ skipping ${this.definition.type} ${metadata.Name} (${metadata.CustomerKey}): Expecting r__dataExtension_Key to be defined if DataSourceTypeID='CustomObject'`, ); } if (!sdl.SalesForceObjectID || sdl.SalesForceObjectID === '') { @@ -174,7 +174,7 @@ class EmailSend extends MetadataType { delete sdl.r__list_PathName; } else { throw new Error( - ` ☇ skipping ${this.definition.type} ${metadata.Name} (${metadata.CustomerKey}) Field SendDefinitionList.r__list_PathName was not defined. Please try re-retrieving this ESD from your source BU.` + ` ☇ skipping ${this.definition.type} ${metadata.Name} (${metadata.CustomerKey}) Field SendDefinitionList.r__list_PathName was not defined. Please try re-retrieving this ESD from your source BU.`, ); } } @@ -217,14 +217,14 @@ class EmailSend extends MetadataType { 'asset', metadata.Email.ID, 'legacyData.legacyId', - 'name' + 'name', ); metadata.r__assetMessage_Name = contentBuilderEmailName; const contentBuilderEmailKey = cache.searchForField( 'asset', metadata.Email.ID, 'legacyData.legacyId', - 'customerKey' + 'customerKey', ); metadata.r__assetMessage_Key = contentBuilderEmailKey; delete metadata.Email; @@ -234,7 +234,7 @@ class EmailSend extends MetadataType { metadata[this.definition.keyField] }): Could not find email with ID ${ metadata.Email.ID - } in Classic nor in Content Builder.` + } in Classic nor in Content Builder.`, ); } } @@ -255,7 +255,7 @@ class EmailSend extends MetadataType { 'dataExtension', sdl.CustomObjectID, 'ObjectID', - 'CustomerKey' + 'CustomerKey', ); delete sdl.CustomObjectID; } catch { @@ -264,7 +264,7 @@ class EmailSend extends MetadataType { metadata[this.definition.keyField] }): Could not find Target Audience (DataExtension) with ObjectID ${ sdl.CustomObjectID - }.` + }.`, ); } } @@ -277,7 +277,7 @@ class EmailSend extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}` + }): ${ex.message}`, ); } } diff --git a/lib/metadataTypes/Event.js b/lib/metadataTypes/Event.js index 8b4bd129d..9ccf959f9 100644 --- a/lib/metadataTypes/Event.js +++ b/lib/metadataTypes/Event.js @@ -31,7 +31,7 @@ class Event extends MetadataType { key ? '/key:' + encodeURIComponent(key) : '' }?extras=all`, null, - key + key, ); } @@ -55,7 +55,7 @@ class Event extends MetadataType { static async retrieveAsTemplate(templateDir, name, templateVariables) { Util.logBeta(this.definition.type); const res = await this.client.rest.get( - '/interaction/v1/EventDefinitions?name=' + encodeURIComponent(name) + '/interaction/v1/EventDefinitions?name=' + encodeURIComponent(name), ); const event = res.items.filter((item) => item.name === name); try { @@ -64,22 +64,22 @@ class Event extends MetadataType { } else if (event.length > 1) { throw new Error( `Multiple Event Definitions with name "${name}"` + - `please rename to be unique to avoid issues` + `please rename to be unique to avoid issues`, ); } else if (event?.length === 1) { const originalKey = event[0][this.definition.keyField]; const eventDef = JSON.parse( Util.replaceByObject( JSON.stringify(this.parseMetadata(event[0])), - templateVariables - ) + templateVariables, + ), ); if (!eventDef.dataExtensionId) { throw new Error( `Event.parseMetadata:: ` + `No Data Extension found for ` + `event: ${eventDef.name}. ` + - `This cannot be templated` + `This cannot be templated`, ); } @@ -88,7 +88,7 @@ class Event extends MetadataType { await File.writeJSONToFile( [templateDir, this.definition.type].join('/'), originalKey + '.' + this.definition.type + '-meta', - JSON.parse(Util.replaceByObject(JSON.stringify(eventDef), templateVariables)) + JSON.parse(Util.replaceByObject(JSON.stringify(eventDef), templateVariables)), ); Util.logger.info(`- templated ${this.definition.type}: ${name}`); return { metadata: eventDef, type: this.definition.type }; @@ -96,7 +96,7 @@ class Event extends MetadataType { throw new Error( `Encountered unknown error when retrieveing ${ this.definition.typeName - } "${name}": ${JSON.stringify(res.body)}` + } "${name}": ${JSON.stringify(res.body)}`, ); } } catch (ex) { @@ -127,7 +127,7 @@ class Event extends MetadataType { return super.deleteByKeyREST( '/interaction/v1/eventDefinitions/key:' + encodeURIComponent(key), key, - false + false, ); } /** @@ -163,7 +163,7 @@ class Event extends MetadataType { return super.updateREST( metadataEntry, '/interaction/v1/EventDefinitions/' + metadataEntry.id, - 'put' + 'put', ); } @@ -178,7 +178,7 @@ class Event extends MetadataType { 'dataExtension', metadata.dataExtensionName, 'Name', - 'ObjectID' + 'ObjectID', ); metadata.arguments.dataExtensionId = metadata.dataExtensionId; return metadata; @@ -196,7 +196,7 @@ class Event extends MetadataType { 'dataExtension', metadata.dataExtensionId, 'ObjectID', - 'CustomerKey' + 'CustomerKey', ); metadata.arguments.dataExtensionId = metadata.dataExtensionId; return JSON.parse(JSON.stringify(metadata)); @@ -205,7 +205,7 @@ class Event extends MetadataType { 'verbose', this.definition.type, 'parseMetadata', - `No related Data Extension found for Event '${metadata.name}'. Consider deleting the event definition` + `No related Data Extension found for Event '${metadata.name}'. Consider deleting the event definition`, ); return metadata; } diff --git a/lib/metadataTypes/FileTransfer.js b/lib/metadataTypes/FileTransfer.js index 35067f816..f7ce38807 100644 --- a/lib/metadataTypes/FileTransfer.js +++ b/lib/metadataTypes/FileTransfer.js @@ -44,7 +44,7 @@ class FileTransfer extends MetadataType { */ static async retrieveAsTemplate(templateDir, name, templateVariables) { const res = await this.client.rest.get( - '/automation/v1/filetransfers/?$filter=name%20eq%20' + encodeURIComponent(name) + '/automation/v1/filetransfers/?$filter=name%20eq%20' + encodeURIComponent(name), ); if (Array.isArray(res?.items) && res?.items?.length) { // eq-operator returns a similar, not exact match and hence might return more than 1 entry @@ -56,14 +56,14 @@ class FileTransfer extends MetadataType { // get full definition const extended = await this.client.rest.get( - '/automation/v1/filetransfers/' + metadata[this.definition.idField] + '/automation/v1/filetransfers/' + metadata[this.definition.idField], ); const originalKey = extended[this.definition.keyField]; const val = JSON.parse( Util.replaceByObject( JSON.stringify(this.parseMetadata(extended)), - templateVariables - ) + templateVariables, + ), ); // remove all fields listed in Definition for templating @@ -71,7 +71,7 @@ class FileTransfer extends MetadataType { await File.writeJSONToFile( [templateDir, this.definition.type].join('/'), originalKey + '.' + this.definition.type + '-meta', - JSON.parse(Util.replaceByObject(JSON.stringify(val), templateVariables)) + JSON.parse(Util.replaceByObject(JSON.stringify(val), templateVariables)), ); Util.logger.info(`- templated ${this.definition.type}: ${name}`); return { metadata: val, type: this.definition.type }; @@ -81,7 +81,7 @@ class FileTransfer extends MetadataType { throw new Error( `Encountered unknown error when retrieveing ${ this.definition.typeName - } "${name}": ${JSON.stringify(res)}` + } "${name}": ${JSON.stringify(res)}`, ); } } @@ -129,12 +129,12 @@ class FileTransfer extends MetadataType { 'fileLocation', metadata.r__fileLocation_name, 'name', - 'id' + 'id', ); delete metadata.r__fileLocation_name; } else { throw new Error( - 'r__fileLocation_name not set. Please ensure the source is properly set up and re-retrieve it first.' + 'r__fileLocation_name not set. Please ensure the source is properly set up and re-retrieve it first.', ); } return metadata; @@ -151,12 +151,12 @@ class FileTransfer extends MetadataType { 'fileLocation', metadata.fileTransferLocationId, 'id', - 'name' + 'name', ); delete metadata.fileTransferLocationId; } catch (ex) { Util.logger.warn( - ` - FileTransfer '${metadata[this.definition.keyField]}': ${ex.message}` + ` - FileTransfer '${metadata[this.definition.keyField]}': ${ex.message}`, ); } diff --git a/lib/metadataTypes/Folder.js b/lib/metadataTypes/Folder.js index b4b2b6ae7..afcdc5ecb 100644 --- a/lib/metadataTypes/Folder.js +++ b/lib/metadataTypes/Folder.js @@ -30,7 +30,7 @@ class Folder extends MetadataType { if (this.buObject.eid !== this.buObject.mid) { queryAllFolders.push( - ...(await this.retrieveHelper(additionalFields, false, subTypeArr)) + ...(await this.retrieveHelper(additionalFields, false, subTypeArr)), ); } const sortPairs = toposort(queryAllFolders.map((a) => [a.ParentFolder.ID, a.ID])); @@ -70,7 +70,7 @@ class Folder extends MetadataType { const parent = idMap[idMap[id].ParentFolder.ID]; // we use / here not system separator as it is important to keep metadata consistent idMap[id].Path = [parent.Path, idMap[id].Name].join( - Util.standardizedSplitChar + Util.standardizedSplitChar, ); idMap[id].ParentFolder.Path = parent.Path; } else { @@ -78,7 +78,7 @@ class Folder extends MetadataType { } } else { Util.logger.warn( - ` - Skipping folder ${idMap[id].Name} (${id}, type: ${idMap[id].ContentType}): Cannot find parent folder (${idMap[id].ParentFolder.ID})` + ` - Skipping folder ${idMap[id].Name} (${id}, type: ${idMap[id].ContentType}): Cannot find parent folder (${idMap[id].ParentFolder.ID})`, ); } } @@ -86,7 +86,7 @@ class Folder extends MetadataType { else if (idMap[id].Name !== '') { idMap[id].Path = ''; Util.logger.warn( - ` - Skipping folder ${idMap[id].Name} (${id}, type: ${idMap[id].ContentType}): Does not have a parent folder` + ` - Skipping folder ${idMap[id].Name} (${id}, type: ${idMap[id].ContentType}): Does not have a parent folder`, ); } } @@ -108,7 +108,7 @@ class Folder extends MetadataType { idMap[id].Client?.ID && (this.buObject.mid == idMap[id].Client.ID || this.definition.folderTypesFromParent.includes( - idMap[id].ContentType.toLowerCase() + idMap[id].ContentType.toLowerCase(), )) ) { if (metadata[idMap[id].CustomerKey]) { @@ -119,7 +119,7 @@ class Folder extends MetadataType { idMap[id].ContentType }].retrieve:: Duplicate CustomerKey on Folder. Keeping: ${ idMap[id].Path - }, Overwriting: ${metadata[idMap[id].CustomerKey].Path}` + }, Overwriting: ${metadata[idMap[id].CustomerKey].Path}`, ); metadata[idMap[id].CustomerKey] = idMap[id]; } else { @@ -128,7 +128,7 @@ class Folder extends MetadataType { idMap[id].ContentType }].retrieve:: Duplicate CustomerKey on Folder. Keeping: ${ metadata[idMap[id].CustomerKey].Path - }, Ignoring: ${idMap[id].Path}` + }, Ignoring: ${idMap[id].Path}`, ); } } else { @@ -141,7 +141,7 @@ class Folder extends MetadataType { if (retrieveDir) { const savedMetadata = await this.saveResults(metadata, retrieveDir, this.buObject.mid); Util.logger.info( - `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})`, ); } return { metadata: metadata, type: this.definition.type }; @@ -178,7 +178,7 @@ class Folder extends MetadataType { Object.keys(metadata).map((customerKey) => [ metadata[customerKey].ParentFolder.Path, metadata[customerKey].Path, - ]) + ]), ); // loop of loops to find a match between two arrays for (const folderPath of sortPairs) { @@ -198,7 +198,7 @@ class Folder extends MetadataType { 'folder', deployableMetadata.Path, 'Path', - 'ID' + 'ID', ); const cachedVersion = cache.getByKey( 'folder', @@ -206,8 +206,8 @@ class Folder extends MetadataType { 'folder', deployableMetadata.Path, 'Path', - this.definition.keyField - ) + this.definition.keyField, + ), ); if ( existingId && @@ -216,14 +216,14 @@ class Folder extends MetadataType { cachedVersion, metadata[metadataKey], 'Path', - true + true, )) ) { Util.logger.verbose( ` - skipping ${this.definition.type} ${ cachedVersion?.Path || metadata[metadataKey][this.definition.nameField] - }: no change detected` + }: no change detected`, ); filteredByPreDeploy++; continue; @@ -239,14 +239,14 @@ class Folder extends MetadataType { cachedVersion, metadata[metadataKey], 'Path', - true + true, )) ) { Util.logger.verbose( ` - skipping ${this.definition.type} ${ cachedVersion?.Path || metadata[metadataKey][this.definition.nameField] - }: no change detected` + }: no change detected`, ); filteredByPreDeploy++; continue; @@ -285,7 +285,7 @@ class Folder extends MetadataType { const newObject = {}; newObject[normalizedKey] = Object.assign( beforeMetadata, - parsed[normalizedKey] + parsed[normalizedKey], ); cache.mergeMetadata('folder', newObject); @@ -293,14 +293,14 @@ class Folder extends MetadataType { } else { Util.logger.debug(result); throw new Error( - `'${beforeMetadata.Path}' was not deployed correctly` + `'${beforeMetadata.Path}' was not deployed correctly`, ); } } } catch (ex) { Util.logger.errorStack( ex, - `Upserting ${this.definition.type} failed: ${ex.message}` + `Upserting ${this.definition.type} failed: ${ex.message}`, ); } } @@ -311,12 +311,12 @@ class Folder extends MetadataType { `${this.definition.type} upsert: ${createCount} of ${ createCount + createFailedCount } created / ${updateCount} of ${updateCount + updateFailedCount} updated` + - (filteredByPreDeploy > 0 ? ` / ${filteredByPreDeploy} filtered` : '') + (filteredByPreDeploy > 0 ? ` / ${filteredByPreDeploy} filtered` : ''), ); if (updateCount) { Util.logger.warn( - ` - Folders are recognized for updates based on their CustomerKey or, if that is not given, their folder-path.` + ` - Folders are recognized for updates based on their CustomerKey or, if that is not given, their folder-path.`, ); } await this.postDeployTasks(upsertResults, orignalMetadata, { @@ -335,7 +335,7 @@ class Folder extends MetadataType { static async create(metadataEntry) { if (metadataEntry?.Parent?.ID === 0) { Util.logger.error( - `${this.definition.type}-${metadataEntry.ContentType}.create:: Cannot create Root Folder: ${metadataEntry.Name}` + `${this.definition.type}-${metadataEntry.ContentType}.create:: Cannot create Root Folder: ${metadataEntry.Name}`, ); return {}; } @@ -354,11 +354,11 @@ class Folder extends MetadataType { } catch (ex) { if (ex?.results) { Util.logger.error( - `${this.definition.type}-${metadataEntry.ContentType}.create:: error creating: '${path}'. ${ex.results[0].StatusMessage}` + `${this.definition.type}-${metadataEntry.ContentType}.create:: error creating: '${path}'. ${ex.results[0].StatusMessage}`, ); } else if (ex) { Util.logger.error( - `${this.definition.type}-${metadataEntry.ContentType}.create:: error creating: '${path}'. ${ex.message}` + `${this.definition.type}-${metadataEntry.ContentType}.create:: error creating: '${path}'. ${ex.message}`, ); } } @@ -384,11 +384,11 @@ class Folder extends MetadataType { } catch (ex) { if (ex?.results) { Util.logger.error( - `${this.definition.type}-${metadataEntry.ContentType}.update:: error updating: '${path}'. ${ex.results[0].StatusMessage}` + `${this.definition.type}-${metadataEntry.ContentType}.update:: error updating: '${path}'. ${ex.results[0].StatusMessage}`, ); } else if (ex) { Util.logger.error( - `${this.definition.type}-${metadataEntry.ContentType}.update:: error updating: '${path}'. ${ex.message}` + `${this.definition.type}-${metadataEntry.ContentType}.update:: error updating: '${path}'. ${ex.message}`, ); } } @@ -403,7 +403,7 @@ class Folder extends MetadataType { static async preDeployTasks(metadata) { if (!this.definition.deployFolderTypes.includes(metadata.ContentType.toLowerCase())) { Util.logger.warn( - ` - Folder ${metadata.Name} is of a type which does not support deployment (Type: ${metadata.ContentType}). Please create this manually in the Web-Interface.` + ` - Folder ${metadata.Name} is of a type which does not support deployment (Type: ${metadata.ContentType}). Please create this manually in the Web-Interface.`, ); return; } @@ -413,7 +413,7 @@ class Folder extends MetadataType { 'debug', 'folder', 'preDeployTasks', - `Folder ${metadata.Name} is blacklisted for deployment due to it being a reserved name or that folder cannot be deployed` + `Folder ${metadata.Name} is blacklisted for deployment due to it being a reserved name or that folder cannot be deployed`, ); return; } @@ -424,7 +424,7 @@ class Folder extends MetadataType { 'warn', 'folder', 'preDeployTasks', - `Folders with IsEditable (such as ${metadata.Name}) are skipped in deployment to avoid overwriting system folder` + `Folders with IsEditable (such as ${metadata.Name}) are skipped in deployment to avoid overwriting system folder`, ); return; } @@ -434,7 +434,7 @@ class Folder extends MetadataType { 'folder', metadata.ParentFolder.Path, 'Path', - 'ID' + 'ID', ); return metadata; } else { @@ -442,7 +442,7 @@ class Folder extends MetadataType { 'warn', 'folder', 'preDeployTasks', - `skipping root folder '${metadata.Name}' (no need to include this in deployment)` + `skipping root folder '${metadata.Name}' (no need to include this in deployment)`, ); return; } @@ -465,7 +465,7 @@ class Folder extends MetadataType { // should not be in the path for the metadata. In case no split then return empty as this is root const standardSubDir = File.reverseFilterIllegalFilenames( - subdir.replaceAll('\\', '/').split(/folder\//)[1] || '' + subdir.replaceAll('\\', '/').split(/folder\//)[1] || '', ); for (const fileName of File.readdirSync(subdir)) { try { @@ -473,7 +473,7 @@ class Folder extends MetadataType { const fileContent = File.readJSONFile(subdir, fileName, true, false); const fileNameWithoutEnding = File.reverseFilterIllegalFilenames( - fileName.split(/\.(\w|-)+-meta.json/)[0] + fileName.split(/\.(\w|-)+-meta.json/)[0], ); if (fileContent.Name === fileNameWithoutEnding) { @@ -486,7 +486,7 @@ class Folder extends MetadataType { const key = fileContent.CustomerKey || `new-${++newCounter}`; if (fileName2FileContent[key]) { Util.logger.error( - `Your have multiple folder-JSONs with the same CustomerKey '${key}' - skipping ${fileName}` + `Your have multiple folder-JSONs with the same CustomerKey '${key}' - skipping ${fileName}`, ); } else { fileName2FileContent[key] = fileContent; @@ -500,7 +500,7 @@ class Folder extends MetadataType { JSON.stringify({ Filename: fileNameWithoutEnding, MetadataName: fileContent.Name, - }) + }), ); } } @@ -549,9 +549,9 @@ class Folder extends MetadataType { const response = await this.client.soap.retrieveBulk( 'DataFolder', this.getFieldNamesToRetrieve(additionalFields).filter( - (field) => !field.includes('Path') + (field) => !field.includes('Path'), ), - options + options, ); return response.Results; } @@ -592,7 +592,7 @@ class Folder extends MetadataType { // * cannot use split('/') here due to the "A/B Testing" folder const stem = results[metadataEntry].Path.slice( 0, - -results[metadataEntry].Name.length + -results[metadataEntry].Name.length, ); // we dont store Id on local disk, but we need it for caching logic, @@ -612,7 +612,7 @@ class Folder extends MetadataType { // manage subtypes [retrieveDir, 'folder', stem], tempHolder.Name + '.folder-meta', - tempHolder + tempHolder, ); } catch (ex) { Util.metadataLogger( @@ -620,7 +620,7 @@ class Folder extends MetadataType { this.definition.type, 'saveResults', ex, - metadataEntry + metadataEntry, ); } } diff --git a/lib/metadataTypes/ImportFile.js b/lib/metadataTypes/ImportFile.js index 5348a4909..091cacd3c 100644 --- a/lib/metadataTypes/ImportFile.js +++ b/lib/metadataTypes/ImportFile.js @@ -46,7 +46,7 @@ class ImportFile extends MetadataType { */ static async retrieveAsTemplate(templateDir, name, templateVariables) { const res = await this.client.rest.get( - '/automation/v1/imports/?$filter=name%20eq%20' + encodeURIComponent(name) + '/automation/v1/imports/?$filter=name%20eq%20' + encodeURIComponent(name), ); if (Array.isArray(res?.items) && res?.items.length) { // eq-operator returns a similar, not exact match and hence might return more than 1 entry @@ -59,8 +59,8 @@ class ImportFile extends MetadataType { const val = JSON.parse( Util.replaceByObject( JSON.stringify(this.parseMetadata(metadata)), - templateVariables - ) + templateVariables, + ), ); // remove all fields listed in Definition for templating @@ -68,7 +68,7 @@ class ImportFile extends MetadataType { await File.writeJSONToFile( [templateDir, this.definition.type].join('/'), originalKey + '.' + this.definition.type + '-meta', - JSON.parse(Util.replaceByObject(JSON.stringify(val), templateVariables)) + JSON.parse(Util.replaceByObject(JSON.stringify(val), templateVariables)), ); Util.logger.info(`- templated ${this.definition.type}: ${name}`); return { metadata: val, type: this.definition.type }; @@ -78,7 +78,7 @@ class ImportFile extends MetadataType { throw new Error( `Encountered unknown error when retrieveing ${ this.definition.typeName - } "${name}": ${JSON.stringify(res)}` + } "${name}": ${JSON.stringify(res)}`, ); } } @@ -113,7 +113,7 @@ class ImportFile extends MetadataType { static update(importFile) { return super.updateREST( importFile, - '/automation/v1/imports/' + importFile.importDefinitionId + '/automation/v1/imports/' + importFile.importDefinitionId, ); } @@ -128,7 +128,7 @@ class ImportFile extends MetadataType { 'fileLocation', metadata.r__fileLocation_name, 'name', - 'id' + 'id', ); delete metadata.r__fileLocation_name; @@ -138,7 +138,7 @@ class ImportFile extends MetadataType { 'dataExtension', metadata.r__dataExtension_CustomerKey, 'CustomerKey', - 'ObjectID' + 'ObjectID', ); delete metadata.r__dataExtension_CustomerKey; } else { @@ -148,7 +148,7 @@ class ImportFile extends MetadataType { if (metadata.r__list_PathName) { metadata.destinationObjectId = cache.getListObjectId( metadata.r__list_PathName, - 'ObjectID' + 'ObjectID', ); // destinationId is also needed for List types metadata.destinationId = cache.getListObjectId(metadata.r__list_PathName, 'ID'); @@ -160,7 +160,7 @@ class ImportFile extends MetadataType { Util.logger.debug( ` - importFile ${metadata[this.definition.keyField]}: Import Destination Type ${ metadata.c__destinationType - } not fully supported. Deploy might fail.` + } not fully supported. Deploy might fail.`, ); } // When the destinationObjectTypeId is 584 it refers to Mobile Connect which is not supported as an Import Type @@ -183,14 +183,14 @@ class ImportFile extends MetadataType { 'fileLocation', metadata.fileTransferLocationId, 'id', - 'name' + 'name', ); delete metadata.fileTransferLocationId; // * When the destinationObjectTypeId is 584 it refers to Mobile Connect which is not supported as an Import Type metadata.c__destinationType = Util.inverseGet( this.definition.destinationObjectTypeMapping, - metadata.destinationObjectTypeId + metadata.destinationObjectTypeId, ); delete metadata.destinationObjectTypeId; if (metadata.c__destinationType === 'DataExtension') { @@ -199,7 +199,7 @@ class ImportFile extends MetadataType { 'dataExtension', metadata.destinationObjectId, 'ObjectID', - 'CustomerKey' + 'CustomerKey', ); delete metadata.destinationObjectId; } catch (ex) { @@ -209,7 +209,7 @@ class ImportFile extends MetadataType { try { metadata.r__list_PathName = cache.getListPathName( metadata.destinationObjectId, - 'ObjectID' + 'ObjectID', ); delete metadata.destinationObjectId; } catch (ex) { @@ -219,12 +219,12 @@ class ImportFile extends MetadataType { metadata.c__subscriberImportType = Util.inverseGet( this.definition.subscriberImportTypeMapping, - metadata.subscriberImportTypeId + metadata.subscriberImportTypeId, ); delete metadata.subscriberImportTypeId; metadata.c__dataAction = Util.inverseGet( this.definition.updateTypeMapping, - metadata.updateTypeId + metadata.updateTypeId, ); delete metadata.updateTypeId; return metadata; diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index 599b4cd58..38009cc46 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -72,7 +72,7 @@ class Journey extends MetadataType { retrieveDir, `${uri}${singleKey}?extras=${extras}`, null, - key + key, ); } else { // retrieve all @@ -84,8 +84,8 @@ class Journey extends MetadataType { // empty results will come back without "items" defined Util.logger.info( Util.getGrayMsg( - ` - ${results.items?.length} ${this.definition.type}s found. Retrieving details...` - ) + ` - ${results.items?.length} ${this.definition.type}s found. Retrieving details...`, + ), ); } // full details for retrieve @@ -97,7 +97,7 @@ class Journey extends MetadataType { try { return await this.client.rest.get( `${uri}key:${a[this.definition.keyField]}?extras=${extras}` + - `&versionNumber=${a.version}` + `&versionNumber=${a.version}`, ); } catch (ex) { // if we do get here, we should log the error and continue instead of failing to download all automations @@ -111,15 +111,15 @@ class Journey extends MetadataType { ? Util.getGrayMsg( ' - ' + ex.endpoint.split( - 'rest.marketingcloudapis.com' - )[1] + 'rest.marketingcloudapis.com', + )[1], ) : '' - }` + }`, ); return null; } - }) + }), ) : []; const parsed = this.parseResponseBody({ items: details.filter(Boolean) }); @@ -128,7 +128,7 @@ class Journey extends MetadataType { const savedMetadata = await this.saveResults(parsed, retrieveDir, null, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(key) + Util.getKeysString(key), ); return { metadata: parsed, @@ -146,8 +146,8 @@ class Journey extends MetadataType { Util.logger.info( `Downloaded: ${this.definition.type} (0)${Util.getKeysString( mode === 'id' ? singleKey : key, - mode === 'id' - )}` + mode === 'id', + )}`, ); } else { throw ex; @@ -187,13 +187,13 @@ class Journey extends MetadataType { // delete by key with specified version does not work, therefore we need to get the ID first const response = await this.client.rest.get( - `/interaction/v1/interactions/key:${encodeURIComponent(key)}?extras=` + `/interaction/v1/interactions/key:${encodeURIComponent(key)}?extras=`, ); const results = this.parseResponseBody(response, key); singleKey = results[key].id; if (version && version > results[key].version) { Util.logger.error( - `The chosen version (${version}) is higher than the latest known version (${results[key].version}). Please choose a lower version.` + `The chosen version (${version}) is higher than the latest known version (${results[key].version}). Please choose a lower version.`, ); return false; } @@ -203,18 +203,18 @@ class Journey extends MetadataType { Util.logger.error( 'Version is required for deleting interactions to avoid accidental deletion of the wrong item. Please append it at the end of the key or id, separated by forward-slash. Example for deleting version 4: ' + key + - '/4' + '/4', ); return false; } Util.logger.warn( - `Deleting Journeys via this command breaks following retrieve-by-key/id requests until you've deployed/created a new draft version! You can get still get the latest available version of your journey by retrieving all interactions on this BU.` + `Deleting Journeys via this command breaks following retrieve-by-key/id requests until you've deployed/created a new draft version! You can get still get the latest available version of your journey by retrieving all interactions on this BU.`, ); /* eslint-enable unicorn/prefer-ternary */ return super.deleteByKeyREST( '/interaction/v1/interactions/' + singleKey + `?versionNumber=${version}`, key, - false + false, ); } /** @@ -240,7 +240,7 @@ class Journey extends MetadataType { return super.updateREST( metadata, '/interaction/v1/interactions/key:' + metadata.key, - 'put' + 'put', ); } @@ -320,11 +320,11 @@ class Journey extends MetadataType { 'event', metadata.triggers[0].metaData.eventDefinitionKey, 'eventDefinitionKey', - 'id' + 'id', ); if (metadata.triggers[0].metaData.eventDefinitionId !== edId) { throw new Error( - `eventDefinitionId not matching Id found on event with key in eventDefinitionKey` + `eventDefinitionId not matching Id found on event with key in eventDefinitionKey`, ); } delete metadata.triggers[0].metaData.eventDefinitionId; @@ -332,7 +332,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } } @@ -349,7 +349,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): definitionType Quicksend is not fully supported yet.` + }): definitionType Quicksend is not fully supported yet.`, ); // ~~~ TRIGGERS ~~~~ // event && triggers[].type === 'ContactAudience' @@ -363,7 +363,7 @@ class Journey extends MetadataType { 'event', metadata.triggers[0].metaData.eventDefinitionKey, 'eventDefinitionKey', - 'id' + 'id', ); if (metadata.triggers[0].metaData.eventDefinitionId !== edId) { throw new Error( @@ -371,7 +371,7 @@ class Journey extends MetadataType { metadata[this.definition.nameField] } (${ metadata[this.definition.keyField] - }): eventDefinitionId not matching Id found on event with key in eventDefinitionKey` + }): eventDefinitionId not matching Id found on event with key in eventDefinitionKey`, ); } delete metadata.triggers[0].metaData.eventDefinitionId; @@ -379,7 +379,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } } @@ -393,7 +393,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } break; @@ -421,7 +421,7 @@ class Journey extends MetadataType { 'transactionalEmail', activity.configurationArguments?.triggeredSendKey, 'definitionKey', - 'definitionId' + 'definitionId', ); if (tEmailId != activity.configurationArguments?.triggeredSendId) { throw new Error( @@ -429,7 +429,7 @@ class Journey extends MetadataType { metadata[this.definition.nameField] } (${ metadata[this.definition.keyField] - }): transactionalEmailId not matching Id found on transactionalEmail with key in transactionalEmailKey` + }): transactionalEmailId not matching Id found on transactionalEmail with key in transactionalEmailKey`, ); } if ( @@ -442,14 +442,14 @@ class Journey extends MetadataType { metadata[this.definition.nameField] } (${ metadata[this.definition.keyField] - }): metaData.highThroughput.definitionKey not matching key in configurationArguments.transactionalEmailKey` + }): metaData.highThroughput.definitionKey not matching key in configurationArguments.transactionalEmailKey`, ); } } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${ metadata[this.definition.nameField] - } (${metadata[this.definition.keyField]}): ${ex.message}.` + } (${metadata[this.definition.keyField]}): ${ex.message}.`, ); } } @@ -463,7 +463,7 @@ class Journey extends MetadataType { metadata[this.definition.keyField] }): channel ${ metadata.channel - } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it` + } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it`, ); } } @@ -476,7 +476,7 @@ class Journey extends MetadataType { metadata[this.definition.keyField] }): definitionType ${ metadata.definitionType - } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it` + } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it`, ); } } @@ -502,7 +502,7 @@ class Journey extends MetadataType { 'triggeredSend', activity.configurationArguments.triggeredSendKey, 'CustomerKey', - 'CustomerKey' + 'CustomerKey', ); delete activity.configurationArguments.triggeredSendId; } else if (activity.configurationArguments?.triggeredSendId) { @@ -511,7 +511,7 @@ class Journey extends MetadataType { 'triggeredSend', activity.configurationArguments.triggeredSendId, 'ObjectID', - 'CustomerKey' + 'CustomerKey', ); delete activity.configurationArguments.triggeredSendId; } @@ -519,7 +519,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }) activity-key=${activity.key}: ${ex.message}` + }) activity-key=${activity.key}: ${ex.message}`, ); } @@ -534,7 +534,7 @@ class Journey extends MetadataType { 'mobileMessage', activity.configurationArguments.messageId, 'id', - 'id' + 'id', ); delete activity.configurationArguments.messageId; } @@ -542,7 +542,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }) activity-key=${activity.key}: ${ex.message}` + }) activity-key=${activity.key}: ${ex.message}`, ); } try { @@ -553,7 +553,7 @@ class Journey extends MetadataType { 'mobileKeyword', activity.configurationArguments.keywordId, 'id', - 'c__codeKeyword' + 'c__codeKeyword', ); delete activity.configurationArguments.keywordId; } @@ -561,7 +561,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }) activity-key=${activity.key}: ${ex.message}` + }) activity-key=${activity.key}: ${ex.message}`, ); } try { @@ -571,7 +571,7 @@ class Journey extends MetadataType { 'mobileKeyword', activity.configurationArguments.nextKeywordId, 'id', - 'keyword' + 'keyword', ); delete activity.configurationArguments.nextKeywordId; } @@ -579,7 +579,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }) activity-key=${activity.key}: ${ex.message}` + }) activity-key=${activity.key}: ${ex.message}`, ); } try { @@ -589,7 +589,7 @@ class Journey extends MetadataType { 'mobileCode', activity.configurationArguments.codeId, 'id', - 'code' + 'code', ); delete activity.configurationArguments.codeId; } @@ -597,7 +597,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }) activity-key=${activity.key}: ${ex.message}` + }) activity-key=${activity.key}: ${ex.message}`, ); } @@ -609,7 +609,7 @@ class Journey extends MetadataType { 'asset', activity.configurationArguments.assetId, 'id', - 'name' + 'name', ); activity.configurationArguments.r__assetMessage_Key = @@ -617,7 +617,7 @@ class Journey extends MetadataType { 'asset', activity.configurationArguments.assetId, 'id', - 'customerKey' + 'customerKey', ); delete activity.configurationArguments.assetId; } @@ -625,7 +625,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }) activity-key=${activity.key}: ${ex.message}` + }) activity-key=${activity.key}: ${ex.message}`, ); } @@ -673,7 +673,7 @@ class Journey extends MetadataType { 'event', metadata.triggers[0].metaData.eventDefinitionKey, 'eventDefinitionKey', - 'id' + 'id', ); } @@ -697,7 +697,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): definitionType Quicksend is not supported yet and might fail to deploy.` + }): definitionType Quicksend is not supported yet and might fail to deploy.`, ); // ~~~ TRIGGERS ~~~~ // event && triggers[].type === 'ContactAudience' @@ -711,13 +711,13 @@ class Journey extends MetadataType { 'event', metadata.triggers[0].metaData?.eventDefinitionKey, 'eventDefinitionKey', - 'id' + 'id', ); } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } } @@ -731,7 +731,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } break; @@ -759,7 +759,7 @@ class Journey extends MetadataType { 'transactionalEmail', metadata.activities[0].configurationArguments?.triggeredSendKey, 'definitionKey', - 'definitionId' + 'definitionId', ); if ( metadata.activities[0].metaData?.highThroughput?.definitionKey && @@ -771,7 +771,7 @@ class Journey extends MetadataType { metadata[this.definition.nameField] } (${ metadata[this.definition.keyField] - }): metaData.highThroughput.definitionKey not matching key in configurationArguments.transactionalEmailKey` + }): metaData.highThroughput.definitionKey not matching key in configurationArguments.transactionalEmailKey`, ); } } @@ -785,7 +785,7 @@ class Journey extends MetadataType { metadata[this.definition.keyField] }): channel ${ metadata.channel - } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it` + } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it`, ); } } @@ -798,7 +798,7 @@ class Journey extends MetadataType { metadata[this.definition.keyField] }): definitionType ${ metadata.definitionType - } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it` + } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it`, ); } } @@ -823,7 +823,7 @@ class Journey extends MetadataType { 'triggeredSend', activity.configurationArguments.triggeredSendKey, 'CustomerKey', - 'ObjectID' + 'ObjectID', ); } break; @@ -835,7 +835,7 @@ class Journey extends MetadataType { 'mobileMessage', activity.configurationArguments.c__mobileMessage_id, 'id', - 'id' + 'id', ); delete activity.configurationArguments.c__mobileMessage_id; } @@ -845,7 +845,7 @@ class Journey extends MetadataType { 'mobileKeyword', activity.r__mobileKeyword_codeKeyword, 'c__codeKeyword', - 'id' + 'id', ); delete activity.configurationArguments.r__mobileKeyword_codeKeyword; } @@ -854,7 +854,7 @@ class Journey extends MetadataType { 'mobileKeyword', activity.configurationArguments.c__next_mobileKeyword, 'keyword', - 'id' + 'id', ); delete activity.configurationArguments.c__next_mobileKeyword; } @@ -864,7 +864,7 @@ class Journey extends MetadataType { 'mobileCode', activity.configurationArguments.c__mobileCode, 'code', - 'id' + 'id', ); delete activity.configurationArguments.c__mobileCode; } @@ -874,7 +874,7 @@ class Journey extends MetadataType { 'asset', activity.configurationArguments.r__assetMessage_Key, 'customerKey', - 'id' + 'id', ); delete activity.configurationArguments.r__assetMessage_Key; delete activity.configurationArguments.r__assetMessage_Name_readOnly; @@ -905,11 +905,11 @@ class Journey extends MetadataType { metadataKey, hasError, metadataToUpdate, - metadataToCreate + metadataToCreate, ); if (action === 'update') { const normalizedKey = File.reverseFilterIllegalFilenames( - metadataMap[metadataKey][this.definition.keyField] + metadataMap[metadataKey][this.definition.keyField], ); const cachedVersion = cache.getByKey(this.definition.type, normalizedKey); if (cachedVersion) { @@ -924,7 +924,7 @@ class Journey extends MetadataType { metadataMap[metadataKey][this.definition.nameField] } (${ metadataMap[metadataKey][this.definition.keyField] - }) on BU, but it is not in Draft status. Will create new version.` + }) on BU, but it is not in Draft status. Will create new version.`, ); metadataToCreate.push(metadataMap[metadataKey]); return 'create'; diff --git a/lib/metadataTypes/List.js b/lib/metadataTypes/List.js index 2c57375f7..561eee427 100644 --- a/lib/metadataTypes/List.js +++ b/lib/metadataTypes/List.js @@ -115,13 +115,13 @@ class List extends MetadataType { operator: 'equals', rightOperand: this.properties.credentials[this.buObject.credential].eid, }, - } + }, ); const masterUnsubscribeBehavior = buResult.Results[0]?.MasterUnsubscribeBehavior; if (masterUnsubscribeBehavior === 'ENTIRE_ENTERPRISE') { Util.logger.debug(` - BU uses ParentBU's All Subscriber List`); Util.logger.info( - ' - Caching dependent Metadata: All Subscriber list (on _ParentBU_)' + ' - Caching dependent Metadata: All Subscriber list (on _ParentBU_)', ); // do not use retrieveForCache here because (a) it does not support key-filtering and (b) it would cache folders on top which we do not need for the global all subscriber list const metadataParentBu = await this.retrieve(null, null, null, 'All Subscribers'); @@ -190,14 +190,14 @@ class List extends MetadataType { 'folder', metadata.Category, 'ID', - 'Path' + 'Path', ); if (!parseForCache) { delete metadata.Category; } } catch (ex) { Util.logger.warn( - ` - List ${metadata.ID}: '${metadata.CustomerKey}': ${ex.message}` + ` - List ${metadata.ID}: '${metadata.CustomerKey}': ${ex.message}`, ); } } diff --git a/lib/metadataTypes/MetadataType.js b/lib/metadataTypes/MetadataType.js index 4a7806794..954d716dd 100644 --- a/lib/metadataTypes/MetadataType.js +++ b/lib/metadataTypes/MetadataType.js @@ -47,7 +47,7 @@ class MetadataType { if (fileName.endsWith('.json')) { const fileContent = File.readJSONFile(dir, fileName, true, false); const fileNameWithoutEnding = File.reverseFilterIllegalFilenames( - fileName.split(/\.(\w|-)+-meta.json/)[0] + fileName.split(/\.(\w|-)+-meta.json/)[0], ); // We always store the filename using the External Key (CustomerKey or key) to avoid duplicate names. // to ensure any changes are done to both the filename and external key do a check here @@ -60,7 +60,7 @@ class MetadataType { } else { Util.logger.error( ` ${this.definition.type} ${key}: Name of the metadata file and the JSON-key (${this.definition.keyField}) must match` + - Util.getGrayMsg(` - ${dir}/${fileName}`) + Util.getGrayMsg(` - ${dir}/${fileName}`), ); } } @@ -177,7 +177,7 @@ class MetadataType { // postRetrieveTasks will be run automatically on this via super.saveResult } catch (ex) { throw new Error( - `Could not get details for new ${this.definition.type} ${id} from server (${ex.message})` + `Could not get details for new ${this.definition.type} ${id} from server (${ex.message})`, ); } } @@ -207,14 +207,14 @@ class MetadataType { 'folder', metadata[this.definition.folderIdField], 'ID', - 'Path' + 'Path', ); delete metadata[this.definition.folderIdField]; } catch (ex) { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }): Could not find folder (${ex.message})` + }): Could not find folder (${ex.message})`, ); } } @@ -231,7 +231,7 @@ class MetadataType { 'folder', metadata.r__folder_Path, 'Path', - 'ID' + 'ID', ); delete metadata.r__folder_Path; } @@ -286,7 +286,7 @@ class MetadataType { 'debug', this.definition.type, 'retrieveAsTemplate', - `(${templateDir}, ${name}, ${templateVariables}) no templating function` + `(${templateDir}, ${name}, ${templateVariables}) no templating function`, ); return { metadata: null, type: this.definition.type }; } @@ -328,7 +328,7 @@ class MetadataType { metadataStr = await File.readFilteredFilename( [retrieveDir, ...typeDirArr], fileName, - 'json' + 'json', ); } catch (ex) { try { @@ -337,7 +337,7 @@ class MetadataType { typeDirArr, key, fileName, - ex + ex, ); } catch { throw new Error( @@ -345,7 +345,7 @@ class MetadataType { retrieveDir, ...typeDirArr, fileName + '.json', - ])}.` + ])}.`, ); } // return; @@ -380,7 +380,7 @@ class MetadataType { templateDir, metadata, templateVariables, - key + key, ); try { @@ -389,7 +389,7 @@ class MetadataType { Util.logger.info( `- templated ${this.definition.type}: ${key} (${ metadata[this.definition.nameField] - })` + })`, ); return { metadata: metadata, type: this.definition.type }; @@ -420,7 +420,7 @@ class MetadataType { Util.logger.error( ` ☇ skipping ${this.definition.type} ${metadata[this.definition.keyField]} / ${ metadata[this.definition.nameField] - }: create is not supported yet for ${this.definition.type}` + }: create is not supported yet for ${this.definition.type}`, ); return; } @@ -436,7 +436,7 @@ class MetadataType { Util.logger.error( ` ☇ skipping ${this.definition.type} ${metadata[this.definition.keyField]} / ${ metadata[this.definition.nameField] - }: update is not supported yet for ${this.definition.type}` + }: update is not supported yet for ${this.definition.type}`, ); return; } @@ -447,7 +447,7 @@ class MetadataType { */ static refresh() { Util.logger.error( - ` ☇ skipping ${this.definition.type}: refresh is not supported yet for ${this.definition.type}` + ` ☇ skipping ${this.definition.type}: refresh is not supported yet for ${this.definition.type}`, ); return; } @@ -459,7 +459,7 @@ class MetadataType { */ static execute() { Util.logger.error( - ` ☇ skipping ${this.definition.type}: execute is not supported yet for ${this.definition.type}` + ` ☇ skipping ${this.definition.type}: execute is not supported yet for ${this.definition.type}`, ); return []; } @@ -470,7 +470,7 @@ class MetadataType { */ static pause() { Util.logger.error( - ` ☇ skipping ${this.definition.type}: pause is not supported yet for ${this.definition.type}` + ` ☇ skipping ${this.definition.type}: pause is not supported yet for ${this.definition.type}`, ); return []; } @@ -518,7 +518,7 @@ class MetadataType { Util.logger.debug( `${this.definition.type}:: ${ clonedMetada[fieldName || this.definition.keyField] - }.${prop} changed: '${cachedVersion[prop]}' to '${clonedMetada[prop]}'` + }.${prop} changed: '${cachedVersion[prop]}' to '${clonedMetada[prop]}'`, ); return true; } @@ -527,7 +527,7 @@ class MetadataType { Util.logger.debug( `${this.definition.type}:: ${ clonedMetada[fieldName || this.definition.keyField] - }.${prop} changed: '${cachedVersion[prop]}' to '${clonedMetada[prop]}'` + }.${prop} changed: '${cachedVersion[prop]}' to '${clonedMetada[prop]}'`, ); return true; } @@ -536,7 +536,7 @@ class MetadataType { Util.logger.verbose( ` ☇ skipping ${this.definition.type} ${clonedMetada[this.definition.keyField]} / ${ clonedMetada[fieldName || this.definition.nameField] - }: no change detected` + }: no change detected`, ); } return false; @@ -561,7 +561,7 @@ class MetadataType { try { deployableMetadata = await this.preDeployTasks( metadataMap[metadataKey], - deployDir + deployDir, ); } catch (ex) { // do this in case something went wrong during pre-deploy steps to ensure the total counter is correct @@ -570,7 +570,7 @@ class MetadataType { Util.logger.error( ` ☇ skipping ${this.definition.type} ${ deployableMetadata[this.definition.keyField] - } / ${deployableMetadata[this.definition.nameField]}: ${ex.message}` + } / ${deployableMetadata[this.definition.nameField]}: ${ex.message}`, ); } // if preDeploy returns nothing then it cannot be deployed so skip deployment @@ -582,7 +582,7 @@ class MetadataType { metadataKey, hasError, metadataToUpdate, - metadataToCreate + metadataToCreate, ); } else { filteredByPreDeploy++; @@ -590,7 +590,7 @@ class MetadataType { } catch (ex) { Util.logger.errorStack( ex, - `Upserting ${this.definition.type} failed: ${ex.message}` + `Upserting ${this.definition.type} failed: ${ex.message}`, ); } } @@ -600,8 +600,8 @@ class MetadataType { metadataToCreate .filter((r) => r !== undefined && r !== null) .map((metadataEntry) => - createLimit(() => this.create(metadataEntry, deployDir)) - ) + createLimit(() => this.create(metadataEntry, deployDir)), + ), ) ).filter((r) => r !== undefined && r !== null); const updateLimit = pLimit(10); @@ -610,14 +610,14 @@ class MetadataType { metadataToUpdate .filter((r) => r !== undefined && r !== null) .map((metadataEntry) => - updateLimit(() => this.update(metadataEntry.after, metadataEntry.before)) - ) + updateLimit(() => this.update(metadataEntry.after, metadataEntry.before)), + ), ) ).filter((r) => r !== undefined && r !== null); // Logging Util.logger.info( `${this.definition.type} upsert: ${createResults.length} of ${metadataToCreate.length} created / ${updateResults.length} of ${metadataToUpdate.length} updated` + - (filteredByPreDeploy > 0 ? ` / ${filteredByPreDeploy} filtered` : '') + (filteredByPreDeploy > 0 ? ` / ${filteredByPreDeploy} filtered` : ''), ); let upsertResults; if (this.definition.bodyIteratorField === 'Results') { @@ -659,7 +659,7 @@ class MetadataType { */ static createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate) { const normalizedKey = File.reverseFilterIllegalFilenames( - metadataMap[metadataKey][this.definition.keyField] + metadataMap[metadataKey][this.definition.keyField], ); // Update if it already exists; Create it if not const maxKeyLength = this.definition.maxKeyLength || 36; @@ -672,7 +672,7 @@ class MetadataType { // only used if resource is excluded from cache and we still want to update it // needed e.g. to rewire lost folders Util.logger.warn( - ' - Hotfix for non-cachable resource found in deploy folder. Trying update:' + ' - Hotfix for non-cachable resource found in deploy folder. Trying update:', ); Util.logger.warn(JSON.stringify(metadataMap[metadataKey])); if (hasError) { @@ -694,23 +694,23 @@ class MetadataType { if (Util.OPTIONS.changeKeyField) { if (this.definition.keyField == this.definition.idField) { Util.logger.error( - ` - --changeKeyField cannot be used for types that use their ID as key. Skipping change.` + ` - --changeKeyField cannot be used for types that use their ID as key. Skipping change.`, ); hasError = true; } else if (this.definition.keyIsFixed) { Util.logger.error( - ` - type ${this.definition.type} does not support --changeKeyField and --changeKeyValue. Skipping change.` + ` - type ${this.definition.type} does not support --changeKeyField and --changeKeyValue. Skipping change.`, ); hasError = true; } else if (!metadataMap[metadataKey][Util.OPTIONS.changeKeyField]) { Util.logger.error( - ` - --changeKeyField is set to ${Util.OPTIONS.changeKeyField} but no value was found in the metadata. Skipping change.` + ` - --changeKeyField is set to ${Util.OPTIONS.changeKeyField} but no value was found in the metadata. Skipping change.`, ); hasError = true; } else if (Util.OPTIONS.changeKeyField === this.definition.keyField) { // simple issue, used WARN to avoid signaling a problem to ci/cd and don't fail deploy Util.logger.warn( - ` - --changeKeyField is set to the same value as the keyField for ${this.definition.type}. Skipping change.` + ` - --changeKeyField is set to the same value as the keyField for ${this.definition.type}. Skipping change.`, ); } else if (metadataMap[metadataKey][Util.OPTIONS.changeKeyField]) { // NOTE: trim twice while getting the newKey value to remove leading spaces before limiting the length @@ -720,16 +720,16 @@ class MetadataType { .trim(); if (metadataMap[metadataKey][Util.OPTIONS.changeKeyField] + '' > maxKeyLength) { Util.logger.warn( - `${this.definition.type} ${this.definition.keyField} may not exceed ${maxKeyLength} characters. Truncated the value in field ${Util.OPTIONS.changeKeyField} to ${newKey}` + `${this.definition.type} ${this.definition.keyField} may not exceed ${maxKeyLength} characters. Truncated the value in field ${Util.OPTIONS.changeKeyField} to ${newKey}`, ); } if (metadataKey == newKey) { Util.logger.warn( - ` - --changeKeyField(${Util.OPTIONS.changeKeyField}) is providing the current value of the key (${metadataKey}). Skipping change.` + ` - --changeKeyField(${Util.OPTIONS.changeKeyField}) is providing the current value of the key (${metadataKey}). Skipping change.`, ); } else { Util.logger.info( - ` - Changing ${this.definition.type} key from ${metadataKey} to ${newKey} via --changeKeyField=${Util.OPTIONS.changeKeyField}` + ` - Changing ${this.definition.type} key from ${metadataKey} to ${newKey} via --changeKeyField=${Util.OPTIONS.changeKeyField}`, ); metadataMap[metadataKey][this.definition.keyField] = newKey; @@ -743,26 +743,26 @@ class MetadataType { const newKey = Util.OPTIONS.changeKeyValue.trim().slice(0, maxKeyLength).trim(); if (Util.OPTIONS.changeKeyValue.trim().length > maxKeyLength) { Util.logger.warn( - `${this.definition.type} ${this.definition.keyField} may not exceed ${maxKeyLength} characters. Truncated your value to ${newKey}` + `${this.definition.type} ${this.definition.keyField} may not exceed ${maxKeyLength} characters. Truncated your value to ${newKey}`, ); } if (this.definition.keyField == this.definition.idField) { Util.logger.error( - ` - --changeKeyValue cannot be used for types that use their ID as key. Skipping change.` + ` - --changeKeyValue cannot be used for types that use their ID as key. Skipping change.`, ); hasError = true; } else if (this.definition.keyIsFixed) { Util.logger.error( - ` - type ${this.definition.type} does not support --changeKeyField and --changeKeyValue. Skipping change.` + ` - type ${this.definition.type} does not support --changeKeyField and --changeKeyValue. Skipping change.`, ); hasError = true; } else if (metadataKey == newKey) { Util.logger.warn( - ` - --changeKeyValue is providing the current value of the key (${metadataKey}). Skipping change.` + ` - --changeKeyValue is providing the current value of the key (${metadataKey}). Skipping change.`, ); } else { Util.logger.info( - ` - Changing ${this.definition.type} key from ${metadataKey} to ${newKey} via --changeKeyValue` + ` - Changing ${this.definition.type} key from ${metadataKey} to ${newKey} via --changeKeyValue`, ); metadataMap[metadataKey][this.definition.keyField] = newKey; @@ -818,7 +818,7 @@ class MetadataType { ` - created ${this.definition.type}: ${ metadataEntry[this.definition.keyField] || metadataEntry[this.definition.nameField] - } / ${metadataEntry[this.definition.nameField]}` + } / ${metadataEntry[this.definition.nameField]}`, ); return response; } catch (ex) { @@ -827,7 +827,7 @@ class MetadataType { ` ☇ error creating ${this.definition.type} ${ metadataEntry[this.definition.keyField] || metadataEntry[this.definition.nameField] - } / ${metadataEntry[this.definition.nameField]}:` + } / ${metadataEntry[this.definition.nameField]}:`, ); if (parsedErrors.length) { for (const msg of parsedErrors) { @@ -854,14 +854,14 @@ class MetadataType { const response = await this.client.soap.create( Util.capitalizeFirstLetter(soapType), metadataEntry, - null + null, ); if (!handleOutside) { Util.logger.info( ` - created ${this.definition.type}: ${ metadataEntry[this.definition.keyField] - } / ${metadataEntry[this.definition.nameField]}` + } / ${metadataEntry[this.definition.nameField]}`, ); } return response; @@ -892,7 +892,7 @@ class MetadataType { ` - updated ${this.definition.type}: ${ metadataEntry[this.definition.keyField] || metadataEntry[this.definition.nameField] - } / ${metadataEntry[this.definition.nameField]}` + } / ${metadataEntry[this.definition.nameField]}`, ); return response; } catch (ex) { @@ -901,7 +901,7 @@ class MetadataType { ` ☇ error updating ${this.definition.type} ${ metadataEntry[this.definition.keyField] || metadataEntry[this.definition.nameField] - } / ${metadataEntry[this.definition.nameField]}:` + } / ${metadataEntry[this.definition.nameField]}:`, ); for (const msg of parsedErrors) { Util.logger.error(' • ' + msg); @@ -959,13 +959,13 @@ class MetadataType { const response = await this.client.soap.update( Util.capitalizeFirstLetter(soapType), metadataEntry, - null + null, ); if (!handleOutside) { Util.logger.info( ` - updated ${this.definition.type}: ${ metadataEntry[this.definition.keyField] - } / ${metadataEntry[this.definition.nameField]}` + } / ${metadataEntry[this.definition.nameField]}`, ); } await this._postChangeKeyTasks(metadataEntry); @@ -1025,7 +1025,7 @@ class MetadataType { response = await this.client.soap.retrieveBulk( Util.capitalizeFirstLetter(soapType), fields, - requestParams + requestParams, ); } catch (ex) { this._handleSOAPErrors(ex, 'retrieving'); @@ -1037,7 +1037,7 @@ class MetadataType { const savedMetadata = await this.saveResults(metadata, retrieveDir, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(singleRetrieve) + Util.getKeysString(singleRetrieve), ); await this.runDocumentOnRetrieve(singleRetrieve, savedMetadata); } @@ -1063,7 +1063,7 @@ class MetadataType { if (this.definition.hasExtended) { Util.logger.debug(' - retrieving extended metadata'); const extended = await this.client.rest.getCollection( - Object.keys(results).map((key) => uri + results[key][this.definition.idField]) + Object.keys(results).map((key) => uri + results[key][this.definition.idField]), ); for (const ext of extended) { const key = ext[this.definition.keyField]; @@ -1076,11 +1076,11 @@ class MetadataType { results, retrieveDir, null, - templateVariables + templateVariables, ); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(singleRetrieve) + Util.getKeysString(singleRetrieve), ); await this.runDocumentOnRetrieve(singleRetrieve, savedMetadata); } @@ -1103,8 +1103,8 @@ class MetadataType { Util.getGrayMsg( ` - ${urlArray?.length} ${this.definition.type}${ urlArray?.length === 1 ? '' : 's' - } found. Retrieving details...` - ) + } found. Retrieving details...`, + ), ); } const rateLimit = pLimit(concurrentRequests); @@ -1118,8 +1118,8 @@ class MetadataType { } catch (ex) { return this.handleRESTErrors(ex, item.id); } - }) - ) + }), + ), ) : []; const results = {}; @@ -1181,13 +1181,13 @@ class MetadataType { 'start', { ObjectID: metadataEntry[this.definition.idField], - } + }, ); if (response?.OverallStatus === 'OK') { Util.logger.info( ` - executed ${this.definition.type}: ${ metadataEntry[this.definition.keyField] - }` + }`, ); } else { throw new Error(response?.OverallStatus); @@ -1214,14 +1214,14 @@ class MetadataType { if (!singleRetrieve || (singleRetrieve && !this.definition.documentInOneFile)) { const count = Object.keys(metadataMap).length; Util.logger.debug( - ` - Running document for ${count} record${count === 1 ? '' : 's'}` + ` - Running document for ${count} record${count === 1 ? '' : 's'}`, ); await this.document(metadataMap); } else { Util.logger.info( Util.getGrayMsg( - ` - Skipped running document because you supplied keys and ${this.definition.type} is documented in a single file for all.` - ) + ` - Skipped running document because you supplied keys and ${this.definition.type} is documented in a single file for all.`, + ), ); } } @@ -1314,7 +1314,7 @@ class MetadataType { subObject, subField, definitionProperty, - originHelper + '[]' + originHelper + '[]', ); } } @@ -1331,13 +1331,13 @@ class MetadataType { metadataEntry, originHelper + '.' + subField, definitionProperty, - null + null, ); } } else if (!this.definition.fields[originHelper]) { // Display warining if there is no definition for the current field Util.logger.verbose( - `MetadataType[${this.definition.type}].deleteFieldByDefinition[${definitionProperty}]:: Field ${originHelper} not in metadata info` + `MetadataType[${this.definition.type}].deleteFieldByDefinition[${definitionProperty}]:: Field ${originHelper} not in metadata info`, ); } else if (this.definition.fields[originHelper][definitionProperty] === false) { // Check if field/nested field should be deleted depending on the definitionProperty @@ -1413,13 +1413,13 @@ class MetadataType { const includeByDefinition = this._filterOther(this.definition.include, metadataEntry); const includeByConfig = this._filterOther( this.properties.options.include[this.definition.type], - metadataEntry + metadataEntry, ); if (includeByDefinition === false || includeByConfig === false) { Util.logger.debug( `Filtered ${this.definition.type} '${ metadataEntry[this.definition.nameField] - }' (${metadataEntry[this.definition.keyField]}): not matching include filter` + }' (${metadataEntry[this.definition.keyField]}): not matching include filter`, ); return true; @@ -1429,13 +1429,13 @@ class MetadataType { const excludeByDefinition = this._filterOther(this.definition.filter, metadataEntry); const excludeByConfig = this._filterOther( this.properties.options.exclude[this.definition.type], - metadataEntry + metadataEntry, ); if (excludeByDefinition || excludeByConfig) { Util.logger.debug( `Filtered ${this.definition.type} '${ metadataEntry[this.definition.nameField] - }' (${metadataEntry[this.definition.keyField]}): matching exclude filter` + }' (${metadataEntry[this.definition.keyField]}): matching exclude filter`, ); return true; } @@ -1471,7 +1471,7 @@ class MetadataType { // check include-only filters (== discard rest) const includeByDefinition = this._filterFolder( this.definition.include, - metadataEntry.r__folder_Path + metadataEntry.r__folder_Path, ); if (includeByDefinition === false) { Util.logger.debug(errorMsg + ' (Accenture SFMC DevTools default)'); @@ -1480,7 +1480,7 @@ class MetadataType { const includeByConfig = this._filterFolder( this.properties.options.include[this.definition.type], - metadataEntry.r__folder_Path + metadataEntry.r__folder_Path, ); if (includeByConfig === false) { Util.logger.debug(errorMsg + ' (project config)'); @@ -1493,7 +1493,7 @@ class MetadataType { // check exclude-only filters (== keep rest) const excludeByDefinition = this._filterFolder( this.definition.filter, - metadataEntry.r__folder_Path + metadataEntry.r__folder_Path, ); if (excludeByDefinition) { Util.logger.debug(errorMsg + ' (Accenture SFMC DevTools default)'); @@ -1502,7 +1502,7 @@ class MetadataType { const excludeByConfig = this._filterFolder( this.properties.options.exclude[this.definition.type], - metadataEntry.r__folder_Path + metadataEntry.r__folder_Path, ); if (excludeByConfig) { Util.logger.debug(errorMsg + ' (project config)'); @@ -1594,8 +1594,8 @@ class MetadataType { '-' + Object.keys(this.definition.extendedSubTypes).find((type) => this.definition.extendedSubTypes[type].includes( - results[originalKey].assetType.name - ) + results[originalKey].assetType.name, + ), ); } subtypeExtension = '.' + (overrideType || this.definition.type) + '-meta'; @@ -1615,7 +1615,7 @@ class MetadataType { results[originalKey] = await this.postRetrieveTasks( results[originalKey], retrieveDir, - templateVariables ? true : false + templateVariables ? true : false, ); if (!results[originalKey] || results[originalKey] === null) { // we encountered a situation in our postRetrieveTasks that made us want to filter this record @@ -1639,11 +1639,11 @@ class MetadataType { if (templateVariables) { results[originalKey].json = Util.replaceByObject( results[originalKey].json, - templateVariables + templateVariables, ); results[originalKey].subFolder = Util.replaceByObject( results[originalKey].subFolder, - templateVariables + templateVariables, ); } @@ -1664,7 +1664,7 @@ class MetadataType { script.fileName + subtypeExtension, script.fileExt, script.content, - templateVariables + templateVariables, ); } // normalize results[metadataEntry] @@ -1675,7 +1675,7 @@ class MetadataType { if (templateVariables) { results[originalKey] = Util.replaceByObject( results[originalKey], - templateVariables + templateVariables, ); } } @@ -1705,26 +1705,26 @@ class MetadataType { // manage subtypes baseDir, originalKey + subtypeExtension, - saveClone + saveClone, ); if (templateVariables) { Util.logger.info( `- templated ${this.definition.type}: ${ saveClone[this.definition.nameField] - }` + }`, ); } } catch (ex) { Util.logger.errorStack( ex, - ` - Saving ${this.definition.type} ${originalKey} failed` + ` - Saving ${this.definition.type} ${originalKey} failed`, ); } } if (filterCounter && this.definition.type !== 'asset') { // interferes with progress bar in assets and is printed 1-by-1 otherwise Util.logger.info( - ` - Filtered ${this.definition.type}: ${filterCounter} (downloaded but not saved to disk)` + ` - Filtered ${this.definition.type}: ${filterCounter} (downloaded but not saved to disk)`, ); } return savedResults; @@ -1769,7 +1769,7 @@ class MetadataType { targetDir, metadata, variables, - templateName + templateName, ) { // generic version here does nothing. actual cases handled in type classes return null; @@ -1790,7 +1790,7 @@ class MetadataType { targetDir, metadata, templateVariables, - templateName + templateName, ) { // generic version here does nothing. actual cases handled in type classes return null; @@ -1846,7 +1846,7 @@ class MetadataType { metadataStr = await File.readFilteredFilename( [templateDir, ...typeDirArr], fileName, - 'json' + 'json', ); } catch (ex) { try { @@ -1855,7 +1855,7 @@ class MetadataType { typeDirArr, templateName, fileName, - ex + ex, ); } catch { throw new Error( @@ -1863,7 +1863,7 @@ class MetadataType { templateDir, ...typeDirArr, fileName + '.json', - ])}.` + ])}.`, ); } // return; @@ -1878,7 +1878,7 @@ class MetadataType { throw new Error( `${this.definition.type}:: Error applying template variables on ${ templateName + '.' + this.definition.type - }${suffix}.json. Please check if your replacement values will result in valid json.` + }${suffix}.json. Please check if your replacement values will result in valid json.`, ); } @@ -1890,7 +1890,7 @@ class MetadataType { targetDir, metadata, variables, - templateName + templateName, ); try { @@ -1901,13 +1901,13 @@ class MetadataType { await File.writeJSONToFile( [targetDir, ...typeDirArr], metadata[this.definition.keyField] + '.' + this.definition.type + suffix, - metadata + metadata, ); } Util.logger.info( `- prepared deployment definition of ${this.definition.type}: ${ metadata[this.definition.keyField] - }` + }`, ); return { metadata: metadata, type: this.definition.type }; @@ -1930,7 +1930,7 @@ class MetadataType { ...errMsg.message .split('
') .map((el) => el.trim()) - .filter(Boolean) + .filter(Boolean), ); } } else if (ex.response.data.validationErrors) { @@ -1939,7 +1939,7 @@ class MetadataType { ...errMsg.message .split('
') .map((el) => el.trim()) - .filter(Boolean) + .filter(Boolean), ); } } else if (ex.response.data.message) { @@ -2028,7 +2028,7 @@ class MetadataType { ? `${ex.results[0].StatusMessage} (Code ${ex.results[0].ErrorCode})` : ex.message; Util.logger.error( - `- error deleting ${this.definition.type} '${customerKey}': ${errorMsg}` + `- error deleting ${this.definition.type} '${customerKey}': ${errorMsg}`, ); } @@ -2114,7 +2114,7 @@ class MetadataType { const keysForDeploy = []; if (Object.keys(metadataMap).length) { Util.logger.info( - `Searching for ${this.definition.type} keys among downloaded items that need fixing:` + `Searching for ${this.definition.type} keys among downloaded items that need fixing:`, ); for (const item of Object.values(metadataMap)) { if (item[this.definition.nameField].length > this.definition.maxKeyLength) { @@ -2123,11 +2123,11 @@ class MetadataType { item[this.definition.keyField] } is too long for a key. Consider renaming your item. Key will be equal first ${ this.definition.maxKeyLength - } characters of the name` + } characters of the name`, ); item[this.definition.nameField] = item[this.definition.nameField].slice( 0, - this.definition.maxKeyLength + this.definition.maxKeyLength, ); } @@ -2139,15 +2139,15 @@ class MetadataType { Util.logger.info( ` - added ${this.definition.type} to fixKey queue: ${ item[this.definition.keyField] - }` + }`, ); } else { Util.logger.info( Util.getGrayMsg( ` ☇ skipping ${this.definition.type} ${ item[this.definition.keyField] - }: key does not need to be updated` - ) + }: key does not need to be updated`, + ), ); } } diff --git a/lib/metadataTypes/MobileCode.js b/lib/metadataTypes/MobileCode.js index 5101af3f8..d9e2f27e5 100644 --- a/lib/metadataTypes/MobileCode.js +++ b/lib/metadataTypes/MobileCode.js @@ -24,7 +24,7 @@ class MobileCode extends MetadataType { retrieveDir, '/legacy/v1/beta/mobile/code/' + (key ? `?$where=keyword%20eq%20%27${key}%27%20` : ''), null, - key + key, ); } diff --git a/lib/metadataTypes/MobileKeyword.js b/lib/metadataTypes/MobileKeyword.js index 23f753cbb..c6e9fd40d 100644 --- a/lib/metadataTypes/MobileKeyword.js +++ b/lib/metadataTypes/MobileKeyword.js @@ -31,13 +31,13 @@ class MobileKeyword extends MetadataType { retrieveDir, '/legacy/v1/beta/mobile/keyword/' + queryParams, null, - key + key, ); } catch (ex) { // if the mobileMessage does not exist, the API returns the error "Request failed with status code 400 (ERR_BAD_REQUEST)" which would otherwise bring execution to a hold if (key && ex.code === 'ERR_BAD_REQUEST') { Util.logger.info( - `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}` + `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}`, ); } else { throw ex; @@ -139,7 +139,7 @@ class MobileKeyword extends MetadataType { metadataKey, hasError, metadataToUpdate, - metadataToCreate + metadataToCreate, ); if (createOrUpdateAction === 'update') { // in case --changeKeyField or --changeKeyValue was used, let's ensure we set code & keyword here again @@ -177,13 +177,13 @@ class MobileKeyword extends MetadataType { templateDir, `/legacy/v1/beta/mobile/keyword/` + queryParams, templateVariables, - key + key, ); } catch (ex) { // if the mobileMessage does not exist, the API returns the error "Request failed with status code 400 (ERR_BAD_REQUEST)" which would otherwise bring execution to a hold if (key && ex.code === 'ERR_BAD_REQUEST') { Util.logger.info( - `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}` + `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}`, ); } else { throw ex; @@ -212,7 +212,7 @@ class MobileKeyword extends MetadataType { queryParams = `?view=simple&$where=keyword%20eq%20%27${keyword}%27%20and%code%20eq%20%27${code}%27%20`; } else { throw new Error( - `key ${key} has unexpected format. Expected 'code.keyword' or 'id:yourId'` + `key ${key} has unexpected format. Expected 'code.keyword' or 'id:yourId'`, ); } } else { @@ -240,7 +240,7 @@ class MobileKeyword extends MetadataType { return super.updateREST( metadata, '/legacy/v1/beta/mobile/keyword/' + metadata[this.definition.idField], - 'post' // upsert API, post for insert and update! + 'post', // upsert API, post for insert and update! ); } @@ -258,7 +258,7 @@ class MobileKeyword extends MetadataType { Util.logger.debug( ` - skipping ${this.definition.type} ${ metadata[this.definition.keyField] - }. Could not find parent mobileCode ${metadata.code.code}` + }. Could not find parent mobileCode ${metadata.code.code}`, ); return; } @@ -308,7 +308,7 @@ class MobileKeyword extends MetadataType { targetDir, metadata, templateVariables, - templateName + templateName, ) { return this._buildForNested( templateDir, @@ -316,7 +316,7 @@ class MobileKeyword extends MetadataType { metadata, templateVariables, templateName, - 'definition' + 'definition', ); } /** @@ -336,7 +336,7 @@ class MobileKeyword extends MetadataType { targetDir, metadata, templateVariables, - templateName + templateName, ) { return this._buildForNested( templateDir, @@ -344,7 +344,7 @@ class MobileKeyword extends MetadataType { metadata, templateVariables, templateName, - 'template' + 'template', ); } @@ -366,7 +366,7 @@ class MobileKeyword extends MetadataType { metadata, templateVariables, templateName, - mode + mode, ) { // get code from filesystem let code = await this._mergeCode(metadata, templateDir, templateName); @@ -389,7 +389,7 @@ class MobileKeyword extends MetadataType { throw new Error( `${this.definition.type}:: Error applying template variables on ${ templateName + '.' + this.definition.type - }-meta.${fileExt}.` + }-meta.${fileExt}.`, ); } @@ -405,7 +405,7 @@ class MobileKeyword extends MetadataType { [targetDir, this.definition.type], fileName + '.' + this.definition.type + '-meta', fileExt, - code + code, ); nestedFilePaths.push([ targetDir, @@ -429,7 +429,7 @@ class MobileKeyword extends MetadataType { if (metadata.responseMessage && metadata.keywordType === 'NORMAL') { throw new Error( - `Custom Response Text is not supported for keywords of type 'NORMAL'. Please remove the .amp file or change the keywordType to 'STOP' or 'INFO'.` + `Custom Response Text is not supported for keywords of type 'NORMAL'. Please remove the .amp file or change the keywordType to 'STOP' or 'INFO'.`, ); } if (!metadata.companyName && metadata.keywordType !== 'NORMAL') { @@ -437,7 +437,7 @@ class MobileKeyword extends MetadataType { Util.logger.debug( ` - No companyName found for keyword ${ metadata[this.definition.keyField] - }. Setting to IGNORED.` + }. Setting to IGNORED.`, ); } @@ -485,7 +485,7 @@ class MobileKeyword extends MetadataType { return await File.readFilteredFilename( [deployDir, this.definition.type], templateName + '.' + this.definition.type + '-meta', - 'amp' + 'amp', ); } else { // keeep this as a debug message, as it is optional and hence not an error @@ -509,7 +509,7 @@ class MobileKeyword extends MetadataType { const id = metadata[key][this.definition.idField]; // execute delete Util.logger.info( - ' - Note: As long as the provided API key once existed, you will not see an error even if the mobileKeyword is already deleted.' + ' - Note: As long as the provided API key once existed, you will not see an error even if the mobileKeyword is already deleted.', ); return super.deleteByKeyREST('/legacy/v1/beta/mobile/keyword/' + id, key, false); } diff --git a/lib/metadataTypes/MobileMessage.js b/lib/metadataTypes/MobileMessage.js index 756d8175b..a94aee78a 100644 --- a/lib/metadataTypes/MobileMessage.js +++ b/lib/metadataTypes/MobileMessage.js @@ -33,13 +33,13 @@ class MobileMessage extends MetadataType { (key || '?view=details&version=3&$sort=lastUpdated%20DESC&$where=isTest%20eq%200%20and%20status%20neq%20%27Archive%27'), null, - key + key, ); } catch (ex) { // if the mobileMessage does not exist, the API returns the error "Request failed with status code 400 (ERR_BAD_REQUEST)" which would otherwise bring execution to a hold if (key && ex.code === 'ERR_BAD_REQUEST') { Util.logger.info( - `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}` + `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}`, ); } else { throw ex; @@ -69,7 +69,7 @@ class MobileMessage extends MetadataType { return super.updateREST( metadata, '/legacy/v1/beta/mobile/message/' + metadata[this.definition.idField], - 'post' // upsert API, post for insert and update! + 'post', // upsert API, post for insert and update! ); } @@ -103,7 +103,7 @@ class MobileMessage extends MetadataType { return await File.readFilteredFilename( [deployDir, this.definition.type], templateName + '.' + this.definition.type + '-meta', - fileExtension + fileExtension, ); } else { throw new Error(`Could not find ${codePath}.${fileExtension}`); @@ -157,7 +157,7 @@ class MobileMessage extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } @@ -170,7 +170,7 @@ class MobileMessage extends MetadataType { 'mobileKeyword', metadata[attr].id, 'id', - 'c__codeKeyword' + 'c__codeKeyword', ), }; } @@ -179,7 +179,7 @@ class MobileMessage extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } // campaign @@ -200,7 +200,7 @@ class MobileMessage extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]}: ${ ex.message - }` + }`, ); } } @@ -210,7 +210,7 @@ class MobileMessage extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } @@ -266,7 +266,7 @@ class MobileMessage extends MetadataType { const keywordObj = cache.getByKey('mobileKeyword', metadata[attr].c__codeKeyword); if (!keywordObj) { throw new Error( - `mobileKeyword ${metadata[attr].c__codeKeyword} not found in cache` + `mobileKeyword ${metadata[attr].c__codeKeyword} not found in cache`, ); } metadata[attr] = keywordObj; @@ -339,7 +339,7 @@ class MobileMessage extends MetadataType { targetDir, metadata, templateVariables, - templateName + templateName, ) { return this._buildForNested( templateDir, @@ -347,7 +347,7 @@ class MobileMessage extends MetadataType { metadata, templateVariables, templateName, - 'definition' + 'definition', ); } /** @@ -367,7 +367,7 @@ class MobileMessage extends MetadataType { targetDir, metadata, templateVariables, - templateName + templateName, ) { return this._buildForNested( templateDir, @@ -375,7 +375,7 @@ class MobileMessage extends MetadataType { metadata, templateVariables, templateName, - 'template' + 'template', ); } @@ -397,7 +397,7 @@ class MobileMessage extends MetadataType { metadata, templateVariables, templateName, - mode + mode, ) { // get code from filesystem let code = await this._mergeCode(metadata, templateDir, templateName); @@ -418,7 +418,7 @@ class MobileMessage extends MetadataType { throw new Error( `${this.definition.type}:: Error applying template variables on ${ templateName + '.' + this.definition.type - }-meta.amp.` + }-meta.amp.`, ); } @@ -434,7 +434,7 @@ class MobileMessage extends MetadataType { [targetDir, this.definition.type], fileName + '.' + this.definition.type + '-meta', fileExt, - code + code, ); nestedFilePaths.push([ targetDir, @@ -453,7 +453,7 @@ class MobileMessage extends MetadataType { */ static deleteByKey(id) { Util.logger.info( - ' - Note: As long as the provided API key once existed, you will not see an error even if the mobileMessage is already deleted.' + ' - Note: As long as the provided API key once existed, you will not see an error even if the mobileMessage is already deleted.', ); return super.deleteByKeyREST('/legacy/v1/beta/mobile/message/' + id, id, false); } diff --git a/lib/metadataTypes/Query.js b/lib/metadataTypes/Query.js index a7cd501a7..e0d5c9016 100644 --- a/lib/metadataTypes/Query.js +++ b/lib/metadataTypes/Query.js @@ -39,7 +39,7 @@ class Query extends MetadataType { if (!objectId) { // avoid running the rest request below by returning early Util.logger.info( - `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}` + `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}`, ); return { metadata: {}, type: this.definition.type }; } @@ -49,7 +49,7 @@ class Query extends MetadataType { retrieveDir, '/automation/v1/queries/' + (objectId || ''), null, - key + key, ); } /** @@ -71,7 +71,7 @@ class Query extends MetadataType { } } results.push( - super.executeREST(`/automation/v1/queries/${objectId}/actions/start/`, key) + super.executeREST(`/automation/v1/queries/${objectId}/actions/start/`, key), ); } const executedKeyArr = (await Promise.all(results)) @@ -128,7 +128,7 @@ class Query extends MetadataType { return super.retrieveREST( templateDir, '/automation/v1/queries/?$filter=Name%20eq%20' + encodeURIComponent(name), - templateVariables + templateVariables, ); } @@ -160,7 +160,7 @@ class Query extends MetadataType { 'dataExtension', metadata.targetId, 'ObjectID', - 'CustomerKey' + 'CustomerKey', ); if (targetKey !== metadata.targetKey) { Util.logger.debug( @@ -168,7 +168,7 @@ class Query extends MetadataType { metadata[this.definition.keyField] }): Replacing targetKey value in saved JSON '${ metadata.targetKey - }' --> '${targetKey}'. Acquired new value from looking up the DE's ObjectID in targetId.` + }' --> '${targetKey}'. Acquired new value from looking up the DE's ObjectID in targetId.`, ); metadata.targetKey = targetKey; } @@ -178,14 +178,14 @@ class Query extends MetadataType { 'dataExtension', metadata.targetKey, 'CustomerKey', - 'CustomerKey' + 'CustomerKey', ); } } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } delete metadata.targetId; @@ -230,7 +230,7 @@ class Query extends MetadataType { metadata.queryText = await File.readFilteredFilename( deployDir + '/' + this.definition.type, metadata[this.definition.keyField] + '.' + this.definition.type + '-meta', - 'sql' + 'sql', ); // dataExtension @@ -238,14 +238,14 @@ class Query extends MetadataType { 'dataExtension', metadata.targetKey, 'CustomerKey', - 'CustomerKey' + 'CustomerKey', ); // we've seen queries without this ID set - crucial in case the DE ever gets renamed to ensure the query keeps working metadata.targetId = cache.searchForField( 'dataExtension', metadata.targetKey, 'CustomerKey', - 'ObjectID' + 'ObjectID', ); // set ID for Append / Overwrite/ Update action @@ -292,7 +292,7 @@ class Query extends MetadataType { targetDir, metadata, templateVariables, - templateName + templateName, ) { return this._buildForNested( templateDir, @@ -300,7 +300,7 @@ class Query extends MetadataType { metadata, templateVariables, templateName, - 'definition' + 'definition', ); } /** @@ -320,7 +320,7 @@ class Query extends MetadataType { targetDir, metadata, templateVariables, - templateName + templateName, ) { return this._buildForNested( templateDir, @@ -328,7 +328,7 @@ class Query extends MetadataType { metadata, templateVariables, templateName, - 'template' + 'template', ); } /** @@ -350,13 +350,13 @@ class Query extends MetadataType { metadata, templateVariables, templateName, - mode + mode, ) { // get SQL from filesystem let code = await File.readFilteredFilename( [templateDir, this.definition.type], templateName + '.' + this.definition.type + '-meta', - 'sql' + 'sql', ); try { @@ -369,7 +369,7 @@ class Query extends MetadataType { throw new Error( `${this.definition.type}:: Error applying template variables on ${ templateName + '.' + this.definition.type - }-meta.sql.` + }-meta.sql.`, ); } @@ -385,7 +385,7 @@ class Query extends MetadataType { [targetDir, this.definition.type], fileName + '.' + this.definition.type + '-meta', 'sql', - code + code, ); nestedFilePaths.push([ targetDir, diff --git a/lib/metadataTypes/Role.js b/lib/metadataTypes/Role.js index effa95d40..28fa23fcc 100644 --- a/lib/metadataTypes/Role.js +++ b/lib/metadataTypes/Role.js @@ -64,7 +64,7 @@ class Role extends MetadataType { if (!retrieveDir) { // retrieve "Marketing Cloud%" roles not returned by SOAP API const { roles, timeZones } = await this.client.rest.get( - '/platform/v1/setup/quickflow/data' + '/platform/v1/setup/quickflow/data', ); // this endpoint does not provide keys const roleNameKeyMap = { @@ -100,7 +100,7 @@ class Role extends MetadataType { const savedMetadata = await super.saveResults(parsed, retrieveDir, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(key) + Util.getKeysString(key), ); await this.runDocumentOnRetrieve(key, savedMetadata); @@ -116,7 +116,7 @@ class Role extends MetadataType { static preDeployTasks(metadata) { if (this.definition.deployBlacklist.includes(metadata.CustomerKey)) { throw new Error( - `Skipped ${metadata.Name} (${metadata.CustomerKey}) because its CustomerKey is reserved for a default system role.` + `Skipped ${metadata.Name} (${metadata.CustomerKey}) because its CustomerKey is reserved for a default system role.`, ); } return metadata; @@ -151,7 +151,7 @@ class Role extends MetadataType { static async document(metadata) { if (this.buObject.eid !== this.buObject.mid) { Util.logger.error( - `Roles can only be retrieved & documented for the ${Util.parentBuName}` + `Roles can only be retrieved & documented for the ${Util.parentBuName}`, ); return; } @@ -163,7 +163,7 @@ class Role extends MetadataType { this.buObject.credential, Util.parentBuName, ]), - true + true, ).role; } catch (ex) { Util.logger.error(ex.message); @@ -276,7 +276,7 @@ class Role extends MetadataType { basePermission = 'Salesforce Marketing Cloud'; } const permissionName = `${permSplit.join( - ' > ' + ' > ', )} > ${permOperation}`; if (!this.allPermissions[basePermission]) { this.allPermissions[basePermission] = {}; @@ -298,7 +298,7 @@ class Role extends MetadataType { element.PermissionSets.PermissionSet, _permission, element.IsAllowed, - isAllowed + isAllowed, ); } // Not at end: Traverse more @@ -309,7 +309,7 @@ class Role extends MetadataType { role, nextElement, _permission, - element.IsAllowed || isAllowed + element.IsAllowed || isAllowed, ); } } else { @@ -317,7 +317,7 @@ class Role extends MetadataType { role, element.Permissions.Permission, _permission, - element.IsAllowed || isAllowed + element.IsAllowed || isAllowed, ); } } diff --git a/lib/metadataTypes/Script.js b/lib/metadataTypes/Script.js index e84ea214d..92b7c49d4 100644 --- a/lib/metadataTypes/Script.js +++ b/lib/metadataTypes/Script.js @@ -47,7 +47,7 @@ class Script extends MetadataType { return super.retrieveREST( templateDir, '/automation/v1/scripts/?$filter=name%20eq%20' + encodeURIComponent(name), - templateVariables + templateVariables, ); } @@ -102,14 +102,14 @@ class Script extends MetadataType { code = await File.readFilteredFilename( [deployDir, this.definition.type], templateName + '.' + this.definition.type + '-meta', - 'ssjs' + 'ssjs', ); code = ``; } else if (await File.pathExists(codePath + '.html')) { code = await File.readFilteredFilename( [deployDir, this.definition.type], templateName + '.' + this.definition.type + '-meta', - 'html' + 'html', ); } else { throw new Error(`Could not find ${codePath}.ssjs (or html)`); @@ -148,7 +148,7 @@ class Script extends MetadataType { targetDir, metadata, templateVariables, - templateName + templateName, ) { return this._buildForNested( templateDir, @@ -156,7 +156,7 @@ class Script extends MetadataType { metadata, templateVariables, templateName, - 'definition' + 'definition', ); } /** @@ -176,7 +176,7 @@ class Script extends MetadataType { targetDir, metadata, templateVariables, - templateName + templateName, ) { return this._buildForNested( templateDir, @@ -184,7 +184,7 @@ class Script extends MetadataType { metadata, templateVariables, templateName, - 'template' + 'template', ); } @@ -206,7 +206,7 @@ class Script extends MetadataType { metadata, templateVariables, templateName, - mode + mode, ) { // get SSJS from filesystem let code = await this._mergeCode(metadata, templateDir, templateName); @@ -227,7 +227,7 @@ class Script extends MetadataType { throw new Error( `${this.definition.type}:: Error applying template variables on ${ templateName + '.' + this.definition.type - }-meta.ssjs.` + }-meta.ssjs.`, ); } @@ -243,7 +243,7 @@ class Script extends MetadataType { [targetDir, this.definition.type], fileName + '.' + this.definition.type + '-meta', fileExt, - code + code, ); nestedFilePaths.push([ targetDir, @@ -296,7 +296,7 @@ class Script extends MetadataType { code = metadataScript; fileExt = 'html'; Util.logger.warn( - ` - Could not find script tags, saving code in ${metadataName}.script-meta.html instead of as SSJS file.` + ` - Could not find script tags, saving code in ${metadataName}.script-meta.html instead of as SSJS file.`, ); } return { fileExt, code }; diff --git a/lib/metadataTypes/TransactionalEmail.js b/lib/metadataTypes/TransactionalEmail.js index 35ad0cf13..de1328a25 100644 --- a/lib/metadataTypes/TransactionalEmail.js +++ b/lib/metadataTypes/TransactionalEmail.js @@ -26,7 +26,7 @@ class TransactionalEmail extends TransactionalMessage { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): Cannot update journey link during update. If you need to relink this item to a new journey please delete and recreate it.` + }): Cannot update journey link during update. If you need to relink this item to a new journey please delete and recreate it.`, ); delete metadata.options.createJourney; } @@ -48,7 +48,7 @@ class TransactionalEmail extends TransactionalMessage { 'asset', metadata.r__asset_customerKey, 'customerKey', - 'customerKey' + 'customerKey', ), }; delete metadata.r__asset_customerKey; @@ -60,14 +60,14 @@ class TransactionalEmail extends TransactionalMessage { 'dataExtension', metadata.subscriptions.r__dataExtension_CustomerKey, 'CustomerKey', - 'CustomerKey' + 'CustomerKey', ); } // subscriptions: list if (metadata.subscriptions?.r__list_PathName) { metadata.subscriptions.list = cache.getListObjectId( metadata.subscriptions.r__list_PathName, - 'CustomerKey' + 'CustomerKey', ); delete metadata.subscriptions.r__list_PathName; } @@ -89,7 +89,7 @@ class TransactionalEmail extends TransactionalMessage { static async postCreateTasks(_, apiResponse) { if (apiResponse.journey?.interactionKey) { Util.logger.warn( - ` - created journey: ${apiResponse.journey.interactionKey} (auto-created when ${this.definition.type} ${apiResponse.definitionKey} was created)` + ` - created journey: ${apiResponse.journey.interactionKey} (auto-created when ${this.definition.type} ${apiResponse.definitionKey} was created)`, ); // when we create new transactionalEmails, we should also download the new journey that was created with it this._createdJourneyKeys ||= []; @@ -110,7 +110,7 @@ class TransactionalEmail extends TransactionalMessage { Util.logger.warn( `Please download related journeys via: mcdev r ${this.buObject.credential}/${ this.buObject.businessUnit - } journey "${this._createdJourneyKeys.join(',')}"` + } journey "${this._createdJourneyKeys.join(',')}"`, ); } delete this._createdJourneyKeys; @@ -132,13 +132,13 @@ class TransactionalEmail extends TransactionalMessage { 'asset', metadata.content.customerKey, 'customerKey', - 'customerKey' + 'customerKey', ); } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } delete metadata.content; @@ -154,13 +154,13 @@ class TransactionalEmail extends TransactionalMessage { 'dataExtension', metadata.subscriptions.dataExtension, 'CustomerKey', - 'CustomerKey' + 'CustomerKey', ); } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } delete metadata.subscriptions.dataExtension; @@ -171,14 +171,14 @@ class TransactionalEmail extends TransactionalMessage { // List metadata.subscriptions.r__list_PathName = cache.getListPathName( metadata.subscriptions.list, - 'CustomerKey' + 'CustomerKey', ); delete metadata.subscriptions.list; } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } } @@ -191,13 +191,13 @@ class TransactionalEmail extends TransactionalMessage { 'journey', metadata.journey.interactionKey, 'key', - 'key' + 'key', ); } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } delete metadata.journey; @@ -218,11 +218,11 @@ class TransactionalEmail extends TransactionalMessage { const isDeleted = await super.deleteByKeyREST( '/messaging/v1/' + this.subType + '/definitions/' + key, key, - false + false, ); if (isDeleted && journeyKey) { Util.logger.info( - ` - deleted ${Journey.definition.type}: ${journeyKey} (SFMC auto-deletes the related journey of ${this.definition.type} ${key})` + ` - deleted ${Journey.definition.type}: ${journeyKey} (SFMC auto-deletes the related journey of ${this.definition.type} ${key})`, ); Journey.buObject = this.buObject; Journey.properties = this.properties; diff --git a/lib/metadataTypes/TransactionalMessage.js b/lib/metadataTypes/TransactionalMessage.js index 523c6ac27..f8db52328 100644 --- a/lib/metadataTypes/TransactionalMessage.js +++ b/lib/metadataTypes/TransactionalMessage.js @@ -33,7 +33,7 @@ class TransactionalMessage extends MetadataType { const parsed = ( await this.retrieveREST( null, - baseUri + (retrieveDir ? '?$filter=status%20neq%20deleted' : '') + baseUri + (retrieveDir ? '?$filter=status%20neq%20deleted' : ''), ) ).metadata; keyList = Object.keys(parsed); @@ -47,7 +47,7 @@ class TransactionalMessage extends MetadataType { } catch { return null; } - }) + }), ) ).filter(Boolean); const parsed = this.parseResponseBody({ definitions: details }); @@ -57,7 +57,7 @@ class TransactionalMessage extends MetadataType { savedMetadata = await this.saveResults(parsed, retrieveDir, null, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(key) + Util.getKeysString(key), ); } @@ -85,7 +85,7 @@ class TransactionalMessage extends MetadataType { static update(metadata) { return super.updateREST( metadata, - '/messaging/v1/' + this.subType + '/definitions/' + metadata[this.definition.keyField] + '/messaging/v1/' + this.subType + '/definitions/' + metadata[this.definition.keyField], ); } @@ -108,7 +108,7 @@ class TransactionalMessage extends MetadataType { return super.deleteByKeyREST( '/messaging/v1/' + this.subType + '/definitions/' + key, key, - false + false, ); } } diff --git a/lib/metadataTypes/TransactionalPush.js b/lib/metadataTypes/TransactionalPush.js index 90930c6c5..65a8adec7 100644 --- a/lib/metadataTypes/TransactionalPush.js +++ b/lib/metadataTypes/TransactionalPush.js @@ -27,7 +27,7 @@ class TransactionalPush extends TransactionalMessage { 'asset', metadata.content.customerKey, 'customerKey', - 'customerKey' + 'customerKey', ); } if (metadata.options?.badge && typeof metadata.options?.badge !== 'string') { @@ -52,13 +52,13 @@ class TransactionalPush extends TransactionalMessage { 'asset', metadata.content.customerKey, 'customerKey', - 'customerKey' + 'customerKey', ); } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.` + }): ${ex.message}.`, ); } } diff --git a/lib/metadataTypes/TransactionalSMS.js b/lib/metadataTypes/TransactionalSMS.js index 8aff9a02d..6baae5131 100644 --- a/lib/metadataTypes/TransactionalSMS.js +++ b/lib/metadataTypes/TransactionalSMS.js @@ -44,7 +44,7 @@ class TransactionalSMS extends TransactionalMessage { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): HTML detected` + }): HTML detected`, ); } @@ -60,7 +60,7 @@ class TransactionalSMS extends TransactionalMessage { 'mobileKeyword', metadata.subscriptions.shortCode + '.' + metadata.subscriptions.keyword, 'c__codeKeyword', - 'id' + 'id', ); } return metadata; @@ -85,7 +85,7 @@ class TransactionalSMS extends TransactionalMessage { return await File.readFilteredFilename( [deployDir, this.definition.type], templateName + '.' + this.definition.type + '-meta', - 'amp' + 'amp', ); } else { throw new Error(`Could not find ${codePath}.amp`); @@ -114,7 +114,7 @@ class TransactionalSMS extends TransactionalMessage { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): HTML detected` + }): HTML detected`, ); } @@ -126,13 +126,13 @@ class TransactionalSMS extends TransactionalMessage { 'mobileCode', metadata.subscriptions.shortCode, 'code', - 'code' + 'code', ); } catch { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): Could not find mobileCode ${metadata.subscriptions.shortCode}.` + }): Could not find mobileCode ${metadata.subscriptions.shortCode}.`, ); } } @@ -144,13 +144,13 @@ class TransactionalSMS extends TransactionalMessage { 'mobileKeyword', metadata.subscriptions.shortCode + '.' + metadata.subscriptions.keyword, 'keyword', - 'id' + 'id', ); } catch { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): Could not find mobileKeyword ${metadata.subscriptions.keyword}.` + }): Could not find mobileKeyword ${metadata.subscriptions.keyword}.`, ); } } @@ -204,7 +204,7 @@ class TransactionalSMS extends TransactionalMessage { targetDir, metadata, templateVariables, - templateName + templateName, ) { return this._buildForNested( templateDir, @@ -212,7 +212,7 @@ class TransactionalSMS extends TransactionalMessage { metadata, templateVariables, templateName, - 'definition' + 'definition', ); } /** @@ -232,7 +232,7 @@ class TransactionalSMS extends TransactionalMessage { targetDir, metadata, templateVariables, - templateName + templateName, ) { return this._buildForNested( templateDir, @@ -240,7 +240,7 @@ class TransactionalSMS extends TransactionalMessage { metadata, templateVariables, templateName, - 'template' + 'template', ); } @@ -262,7 +262,7 @@ class TransactionalSMS extends TransactionalMessage { metadata, templateVariables, templateName, - mode + mode, ) { // get code from filesystem let code = await this._mergeCode(metadata, templateDir, templateName); @@ -282,7 +282,7 @@ class TransactionalSMS extends TransactionalMessage { throw new Error( `${this.definition.type}:: Error applying template variables on ${ templateName + '.' + this.definition.type - }-meta.${fileExt}.` + }-meta.${fileExt}.`, ); } @@ -298,7 +298,7 @@ class TransactionalSMS extends TransactionalMessage { [targetDir, this.definition.type], fileName + '.' + this.definition.type + '-meta', fileExt, - code + code, ); nestedFilePaths.push([ targetDir, diff --git a/lib/metadataTypes/TriggeredSend.js b/lib/metadataTypes/TriggeredSend.js index 737360703..f6670ed79 100644 --- a/lib/metadataTypes/TriggeredSend.js +++ b/lib/metadataTypes/TriggeredSend.js @@ -96,7 +96,7 @@ class TriggeredSend extends MetadataType { this.setFolderPath(metadata); if (!metadata.r__folder_Path) { Util.logger.verbose( - ` ☇ skipping ${this.definition.typeName} '${metadata.Name}'/'${metadata.CustomerKey}': Could not find folder.` + ` ☇ skipping ${this.definition.typeName} '${metadata.Name}'/'${metadata.CustomerKey}': Could not find folder.`, ); // do not save this TSD because it would not be visible in the user interface return; @@ -115,20 +115,20 @@ class TriggeredSend extends MetadataType { 'asset', metadata.Email.ID, 'legacyData.legacyId', - 'name' + 'name', ); metadata.r__assetMessage_Name_readOnly = contentBuilderEmailName; const contentBuilderEmailKey = cache.searchForField( 'asset', metadata.Email.ID, 'legacyData.legacyId', - 'customerKey' + 'customerKey', ); metadata.r__assetMessage_Key = contentBuilderEmailKey; delete metadata.Email; } catch { Util.logger.verbose( - ` - ${this.definition.typeName} '${metadata.Name}'/'${metadata.CustomerKey}': Could not find email with ID ${metadata.Email.ID} in Classic nor in Content Builder. This TSD cannot be republished but potentially restarted with its cached version of the email.` + ` - ${this.definition.typeName} '${metadata.Name}'/'${metadata.CustomerKey}': Could not find email with ID ${metadata.Email.ID} in Classic nor in Content Builder. This TSD cannot be republished but potentially restarted with its cached version of the email.`, ); // save this TSD because it could be fixed by the user or potentially restarted without a fix; also, it might be used by a journey } @@ -140,7 +140,7 @@ class TriggeredSend extends MetadataType { delete metadata.List; } catch (ex) { Util.logger.verbose( - ` - ${this.definition.typeName} '${metadata.Name}'/'${metadata.CustomerKey}': ${ex.message}` + ` - ${this.definition.typeName} '${metadata.Name}'/'${metadata.CustomerKey}': ${ex.message}`, ); // save this TSD because it could be fixed by the user } @@ -161,7 +161,7 @@ class TriggeredSend extends MetadataType { cachedVersion?.TriggeredSendStatus === metadata.TriggeredSendStatus ) { throw new Error( - `Please pause the Triggered Send '${metadata.Name}' before updating it. You may do so via GUI; or via Accenture SFMC DevTools by setting TriggeredSendStatus to 'Inactive'.` + `Please pause the Triggered Send '${metadata.Name}' before updating it. You may do so via GUI; or via Accenture SFMC DevTools by setting TriggeredSendStatus to 'Inactive'.`, ); } // re-add IsPlatformObject, required for visibility @@ -183,14 +183,14 @@ class TriggeredSend extends MetadataType { 'asset', metadata.r__assetMessage_Key, 'customerKey', - 'legacyData.legacyId' + 'legacyData.legacyId', ), }; delete metadata.r__assetMessage_Key; delete metadata.r__assetMessage_Name_readOnly; } else if (metadata?.Email?.ID) { throw new Error( - `r__assetMessage_Key / r__email_Name not defined but instead found Email.ID. Please try re-retrieving this TSD from your BU.` + `r__assetMessage_Key / r__email_Name not defined but instead found Email.ID. Please try re-retrieving this TSD from your BU.`, ); } // get List (optional) @@ -201,7 +201,7 @@ class TriggeredSend extends MetadataType { delete metadata.r__list_PathName; } else if (metadata?.List?.ID) { throw new Error( - `r__list_PathName not defined but instead found List.ID. Please try re-retrieving this TSD from your BU.` + `r__list_PathName not defined but instead found List.ID. Please try re-retrieving this TSD from your BU.`, ); } @@ -340,13 +340,13 @@ class TriggeredSend extends MetadataType { } if (!test[key]) { Util.logger.error( - ` ☇ skipping ${this.definition.typeName}: ${key} - not found on server` + ` ☇ skipping ${this.definition.typeName}: ${key} - not found on server`, ); return false; } if (test[key].TriggeredSendStatus !== 'Active') { Util.logger.error( - ` ☇ skipping ${this.definition.typeName}: ${key} - refresh only needed for running entries (TriggeredSendStatus=Active)` + ` ☇ skipping ${this.definition.typeName}: ${key} - refresh only needed for running entries (TriggeredSendStatus=Active)`, ); return false; } @@ -365,7 +365,7 @@ class TriggeredSend extends MetadataType { const errorMsg = super.getSOAPErrorMsg(ex); Util.logger.error( - ` - failed to pause ${this.definition.typeName}: ${key} - ${errorMsg}` + ` - failed to pause ${this.definition.typeName}: ${key} - ${errorMsg}`, ); return false; } @@ -382,7 +382,7 @@ class TriggeredSend extends MetadataType { } catch (ex) { const errorMsg = super.getSOAPErrorMsg(ex); Util.logger.error( - ` - failed to publish ${this.definition.typeName}: ${key} - ${errorMsg}` + ` - failed to publish ${this.definition.typeName}: ${key} - ${errorMsg}`, ); return false; } @@ -399,7 +399,7 @@ class TriggeredSend extends MetadataType { } catch (ex) { const errorMsg = super.getSOAPErrorMsg(ex); Util.logger.error( - ` - failed to publish ${this.definition.typeName}: ${key} - ${errorMsg}` + ` - failed to publish ${this.definition.typeName}: ${key} - ${errorMsg}`, ); return false; } diff --git a/lib/metadataTypes/User.js b/lib/metadataTypes/User.js index 7674b2484..86af53085 100644 --- a/lib/metadataTypes/User.js +++ b/lib/metadataTypes/User.js @@ -81,7 +81,7 @@ class User extends MetadataType { Role: metadata.c__RoleNamesGlobal .filter( // individual role (which are not manageable nor visible in the GUI) - (roleName) => !roleName.startsWith('Individual role for ') + (roleName) => !roleName.startsWith('Individual role for '), ) .map((roleName) => { let roleCache; @@ -90,7 +90,7 @@ class User extends MetadataType { 'role', roleName, 'Name', - 'CustomerKey' + 'CustomerKey', ); roleCache = cache.getByKey('role', roleKey); } catch { @@ -99,7 +99,7 @@ class User extends MetadataType { } if (roleCache?.c__notAssignable) { throw new Error( - `Default roles starting on 'Marketing Cloud' are not assignable via API and get removed upon update. Please create/update the user manually in the GUI or remove that role.` + `Default roles starting on 'Marketing Cloud' are not assignable via API and get removed upon update. Please create/update the user manually in the GUI or remove that role.`, ); } return { @@ -117,8 +117,8 @@ class User extends MetadataType { metadata.c__AssociatedBusinessUnits.push(metadata.DefaultBusinessUnit); Util.logger.info( Util.getGrayMsg( - ` - adding DefaultBusinessUnit to list of associated Business Units (${metadata.CustomerKey} / ${metadata.Name}): ${metadata.DefaultBusinessUnit}` - ) + ` - adding DefaultBusinessUnit to list of associated Business Units (${metadata.CustomerKey} / ${metadata.Name}): ${metadata.DefaultBusinessUnit}`, + ), ); } if (metadata.c__AssociatedBusinessUnits.length) { @@ -134,7 +134,7 @@ class User extends MetadataType { '_timezone', metadata.c__TimeZoneName, 'description', - 'id' + 'id', ); delete metadata.c__TimeZoneName; } @@ -175,7 +175,7 @@ class User extends MetadataType { error ) { throw new TypeError( - 'SsoIdentity should be an object with IsActive and FederatedID properties.' + 'SsoIdentity should be an object with IsActive and FederatedID properties.', ); } // if SsoIdentity is set, assume this was on purpose and bring it @@ -211,7 +211,7 @@ class User extends MetadataType { metadataKey, hasError, metadataToUpdate, - metadataToCreate + metadataToCreate, ); if (action === 'create') { @@ -308,7 +308,7 @@ class User extends MetadataType { BusinessUnitIds: { BusinessUnitId: buIds }, IsDelete: action === 'delete', }, - } + }, ); } } @@ -327,7 +327,8 @@ class User extends MetadataType { let configureResults = buResponse.Results?.[0]?.Result; if (!configureResults) { Util.logger.debug( - 'buResponse.Results?.[0]?.Result not defined: ' + JSON.stringify(buResponse) + 'buResponse.Results?.[0]?.Result not defined: ' + + JSON.stringify(buResponse), ); return; } @@ -352,8 +353,8 @@ class User extends MetadataType { } else { Util.logger.debug( `Unknown error occured during processing of BU assignment reponse: ${JSON.stringify( - result - )}` + result, + )}`, ); } } @@ -376,14 +377,14 @@ class User extends MetadataType { this.userIdBuMap[userId] ||= []; this.userIdBuMap[userId].push( ...buResult['add'].filter( - (item) => !this.userIdBuMap[userId].includes(item) - ) + (item) => !this.userIdBuMap[userId].includes(item), + ), ); } if (buResult['delete']?.length) { this.userIdBuMap[userId] ||= []; this.userIdBuMap[userId] = this.userIdBuMap[userId].filter( - (item) => !buResult['delete'].includes(item) + (item) => !buResult['delete'].includes(item), ); } } @@ -404,7 +405,7 @@ class User extends MetadataType { if (!metadata.Password) { metadata.Password = this._generatePassword(); Util.logger.info( - ` - Password for ${metadata.UserID} was not given. Generated password:` + ` - Password for ${metadata.UserID} was not given. Generated password:`, ); // use console.log here to print the generated password to bypass the logfile // eslint-disable-next-line no-console @@ -473,8 +474,8 @@ class User extends MetadataType { Util.getGrayMsg( ` - adding role-assignment (${item.after.CustomerKey} / ${ item.after.Name - }): ${addedRoleNames.join(', ')}` - ) + }): ${addedRoleNames.join(', ')}`, + ), ); } } @@ -483,8 +484,8 @@ class User extends MetadataType { Util.getGrayMsg( ` - removing role-assignment (${item.after.CustomerKey} / ${ item.after.Name - }): ${deletedRoleNames.join(', ')}` - ) + }): ${deletedRoleNames.join(', ')}`, + ), ); // add deleted roles to payload with IsDelete=true if (!item.after.Roles) { @@ -499,9 +500,9 @@ class User extends MetadataType { role.Name, item.after.AccountUserID, false, - true - ) - ) + true, + ), + ), ); } } @@ -521,7 +522,7 @@ class User extends MetadataType { roleName, userId, assignmentOnly, - isRoleRemovale = false + isRoleRemovale = false, ) { const assignmentConfigurations = { AssignmentConfiguration: [ @@ -623,15 +624,15 @@ class User extends MetadataType { const resultsBatch = await this.client.soap.retrieveBulk( soapType, fields, - requestParamsUser + requestParamsUser, ); if (Array.isArray(resultsBatch?.Results)) { Util.logger.debug( Util.getGrayMsg( ` - found ${resultsBatch?.Results.length} ${ active ? 'active' : 'inactive' - } ${this.definition.type}s` - ) + } ${this.definition.type}s`, + ), ); if (resultsBulk) { // once first batch is done, the follow just add to result payload @@ -655,7 +656,7 @@ class User extends MetadataType { requestParams, soapType, fields, - resultsBulk + resultsBulk, )) ) { return {}; @@ -666,7 +667,7 @@ class User extends MetadataType { if (resultsBulk?.Results?.length > 0) { if (!singleRetrieve) { Util.logger.info( - Util.getGrayMsg(` - found ${resultsBulk?.Results.length} users`) + Util.getGrayMsg(` - found ${resultsBulk?.Results.length} users`), ); } // split array resultsBulk?.Results into chunks to avoid not getting all roles @@ -676,7 +677,9 @@ class User extends MetadataType { for (let i = 0; i < resultsBulk?.Results?.length; i += chunkSize) { if (i > 0) { Util.logger.info( - Util.getGrayMsg(` - Requesting next batch (retrieved BUs for ${i} users)`) + Util.getGrayMsg( + ` - Requesting next batch (retrieved BUs for ${i} users)`, + ), ); } const chunk = resultsBulk?.Results?.slice(i, i + chunkSize); @@ -690,7 +693,7 @@ class User extends MetadataType { operator: chunk.length > 1 ? 'IN' : 'equals', // API does not allow IN for single item rightOperand: chunk.map((item) => item.AccountUserID), }, - } + }, ) ).Results; for (const item of resultsBatch) { @@ -709,7 +712,7 @@ class User extends MetadataType { const savedMetadata = await this.saveResults(metadata, retrieveDir, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(singleRetrieve) + Util.getKeysString(singleRetrieve), ); if (!singleRetrieve) { // print summary to cli @@ -730,8 +733,8 @@ class User extends MetadataType { } Util.logger.info( Util.getGrayMsg( - `Found ${counter.userActive} active users / ${counter.userInactive} inactive users / ${counter.installedPackage} installed packages` - ) + `Found ${counter.userActive} active users / ${counter.userInactive} inactive users / ${counter.installedPackage} installed packages`, + ), ); } await this.runDocumentOnRetrieve(singleRetrieve, savedMetadata); @@ -796,11 +799,13 @@ class User extends MetadataType { const resultsBatch = await this.client.soap.retrieveBulk( soapType, fields, - requestParamsInstalledPackage + requestParamsInstalledPackage, ); if (Array.isArray(resultsBatch?.Results)) { Util.logger.debug( - Util.getGrayMsg(` - found ${resultsBatch?.Results.length} installed packages`) + Util.getGrayMsg( + ` - found ${resultsBatch?.Results.length} installed packages`, + ), ); if (resultsBulk) { // once first batch is done, the follow just add to result payload @@ -936,7 +941,7 @@ class User extends MetadataType { static async document(metadata) { if (this.buObject.eid !== this.buObject.mid) { Util.logger.error( - `Users can only be retrieved & documented for the ${Util.parentBuName}` + `Users can only be retrieved & documented for the ${Util.parentBuName}`, ); return; } @@ -950,7 +955,7 @@ class User extends MetadataType { this.buObject.credential, Util.parentBuName, ]), - true + true, ).user; } catch (ex) { Util.logger.error(ex.message); @@ -1042,17 +1047,17 @@ class User extends MetadataType { output += this._generateDocMd( users.filter((user) => user.TYPE === 'User' && user.ActiveFlag === '✓'), 'User', - columnsToPrint + columnsToPrint, ); output += this._generateDocMd( users.filter((user) => user.TYPE === 'User' && user.ActiveFlag === '-'), 'Inactivated User', - columnsToPrint + columnsToPrint, ); output += this._generateDocMd( users.filter((user) => user.TYPE === 'Installed Package'), 'Installed Package', - columnsToPrint + columnsToPrint, ); const docPath = File.normalizePath([this.properties.directories.docs, 'user']); @@ -1137,7 +1142,7 @@ class User extends MetadataType { .filter(Boolean) .filter( // individual role (which are not manageable nor visible in the GUI) - (roleName) => !roleName.startsWith('Individual role for ') + (roleName) => !roleName.startsWith('Individual role for '), ) .sort((a, b) => (a < b ? -1 : a > b ? 1 : 0)); } else { @@ -1153,7 +1158,7 @@ class User extends MetadataType { '_timezone', metadata.TimeZone.ID, 'id', - 'description' + 'description', ); delete metadata.TimeZone; } diff --git a/lib/metadataTypes/Verification.js b/lib/metadataTypes/Verification.js index 28cfc5ab3..e004803ef 100644 --- a/lib/metadataTypes/Verification.js +++ b/lib/metadataTypes/Verification.js @@ -70,7 +70,7 @@ class Verification extends MetadataType { const response = await this.retrieveRESTcollection( paramArr.map((id) => ({ id, uri: '/automation/v1/dataverifications/' + id })), undefined, - !key + !key, ); if (response?.metadata) { Object.assign(results, response.metadata); @@ -80,7 +80,7 @@ class Verification extends MetadataType { const savedMetadata = await this.saveResults(results, retrieveDir, null, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(key) + Util.getKeysString(key), ); } @@ -100,12 +100,12 @@ class Verification extends MetadataType { if (ex.message === 'Not Found' || ex.message === 'Request failed with status code 400') { // if the ID is too short, the system will throw the 400 error Util.logger.debug( - ` ☇ skipping ${this.definition.type} ${id}: ${ex.message} ${ex.code}` + ` ☇ skipping ${this.definition.type} ${id}: ${ex.message} ${ex.code}`, ); } else { // if we do get here, we should log the error and continue instead of failing to download all automations Util.logger.error( - ` ☇ skipping ${this.definition.type} ${id}: ${ex.message} ${ex.code}` + ` ☇ skipping ${this.definition.type} ${id}: ${ex.message} ${ex.code}`, ); } return null; @@ -147,7 +147,7 @@ class Verification extends MetadataType { metadataEntryWithAllFields?.[this.definition.idField] }: new key ${ apiResponse?.[this.definition.idField] - } automatically assigned during creation` + } automatically assigned during creation`, ); metadataEntry[this.definition.idField] = apiResponse?.[this.definition.idField]; @@ -170,7 +170,7 @@ class Verification extends MetadataType { static update(metadata) { return super.updateREST( metadata, - '/automation/v1/dataverifications/' + metadata.dataVerificationDefinitionId + '/automation/v1/dataverifications/' + metadata.dataVerificationDefinitionId, ); } @@ -185,7 +185,7 @@ class Verification extends MetadataType { 'dataExtension', metadata.r__dataExtension_CustomerKey, 'CustomerKey', - 'ObjectID' + 'ObjectID', ); delete metadata.r__dataExtension_CustomerKey; return metadata; @@ -202,12 +202,12 @@ class Verification extends MetadataType { 'dataExtension', metadata.targetObjectId, 'ObjectID', - 'CustomerKey' + 'CustomerKey', ); delete metadata.targetObjectId; } catch (ex) { Util.logger.warn( - ` - ${this.definition.type} ${metadata[this.definition.keyField]}: ${ex.message}` + ` - ${this.definition.type} ${metadata[this.definition.keyField]}: ${ex.message}`, ); } return metadata; diff --git a/lib/retrieveChangelog.js b/lib/retrieveChangelog.js index c6130ad7e..2e7ad1f8f 100644 --- a/lib/retrieveChangelog.js +++ b/lib/retrieveChangelog.js @@ -77,7 +77,7 @@ const customDefinition = { lb: getUserName(userList, item, def.lastmodNameField), }; return listEntry; - }) + }), ); } }); diff --git a/lib/util/auth.js b/lib/util/auth.js index 3bf665138..daa55d843 100644 --- a/lib/util/auth.js +++ b/lib/util/auth.js @@ -34,7 +34,7 @@ const Auth = { if (missingAccess.length) { Util.logger.warn( - 'Installed package has insufficient access. You might encounter malfunctions!' + 'Installed package has insufficient access. You might encounter malfunctions!', ); Util.logger.warn('Missing scope: ' + missingAccess.join(', ')); } @@ -97,8 +97,8 @@ function setupSDK(sessionKey, authObject) { onLoop: (type, accumulator) => { Util.logger.info( Util.getGrayMsg( - ` - Requesting next batch (currently ${accumulator?.length} records)` - ) + ` - Requesting next batch (currently ${accumulator?.length} records)`, + ), ); }, onRefresh: (authObject) => { @@ -112,10 +112,10 @@ function setupSDK(sessionKey, authObject) { }${ ex.endpoint ? Util.getGrayMsg( - ' - ' + ex.endpoint.split('rest.marketingcloudapis.com')[1] + ' - ' + ex.endpoint.split('rest.marketingcloudapis.com')[1], ) : '' - }` + }`, ); Util.logger.errorStack(ex); }, @@ -124,7 +124,7 @@ function setupSDK(sessionKey, authObject) { if (msg.url === '/Service.asmx') { msg.data = msg.data.replaceAll( //gim, - '*** TOKEN REMOVED ***' + '*** TOKEN REMOVED ***', ); } else if (msg.headers?.Authorization) { msg.headers.Authorization = 'Bearer *** TOKEN REMOVED ***'; @@ -142,7 +142,7 @@ function setupSDK(sessionKey, authObject) { // printing it separately leads to better formatting Util.logger.debug( 'API REQUEST body >> \n ' + - (typeof data === 'string' ? data : JSON.stringify(data, null, 2)) + (typeof data === 'string' ? data : JSON.stringify(data, null, 2)), ); } } diff --git a/lib/util/businessUnit.js b/lib/util/businessUnit.js index b26e010fc..ad925a628 100644 --- a/lib/util/businessUnit.js +++ b/lib/util/businessUnit.js @@ -29,7 +29,7 @@ const BusinessUnit = { const buResult = await client.soap.retrieve( 'BusinessUnit', ['Name', 'ID', 'ParentName', 'ParentID', 'IsActive'], - { QueryAllAccounts: true } + { QueryAllAccounts: true }, ); if (buResult !== null && !buResult.Results) { Util.logger.error(`Credentials worked but no BUs found. Check access rights!`); @@ -69,20 +69,20 @@ const BusinessUnit = { Util.logger.info( ` - ${element.Name} ${ element.Name === equalizedName ? '' : `(${equalizedName})` - }` + }`, ); } } Util.logger.debug(`EID: ${currentCredentials.eid}`); if (currentCredentials.eid === null) { Util.logger.warn( - `It seems your 'installed package' was not created on the Parent BU of your instance.` + `It seems your 'installed package' was not created on the Parent BU of your instance.`, ); Util.logger.warn( - `While basic functionality will work, it is strongly recommended that you create a new 'installed package' there to enable support for shared Data Extensions and automatic retrieval of the BU list.` + `While basic functionality will work, it is strongly recommended that you create a new 'installed package' there to enable support for shared Data Extensions and automatic retrieval of the BU list.`, ); Util.logger.warn( - `If you cannot create a package on the Parent BU, please open your ./.mcdevrc.json and update the list of BUs and their MIDs manually.` + `If you cannot create a package on the Parent BU, please open your ./.mcdevrc.json and update the list of BUs and their MIDs manually.`, ); // allow user to work by setting this to an obviously false value which nonetheless doesn't block execution currentCredentials.eid = -1; @@ -91,7 +91,7 @@ const BusinessUnit = { await File.writeJSONToFile( properties.directories.businessUnits, File.filterIllegalFilenames(credentialsName + '.businessUnits'), - buResult.Results + buResult.Results, ); // update config await File.saveConfigFile(properties); diff --git a/lib/util/cache.js b/lib/util/cache.js index f7a133f5b..e4b571cf4 100644 --- a/lib/util/cache.js +++ b/lib/util/cache.js @@ -97,32 +97,32 @@ export default { if ( Util.resolveObjPath( searchField, - dataStore[overrideMID || currentMID][metadataType][key] + dataStore[overrideMID || currentMID][metadataType][key], ) == searchValue ) { try { if ( Util.resolveObjPath( returnField, - dataStore[overrideMID || currentMID][metadataType][key] + dataStore[overrideMID || currentMID][metadataType][key], ) ) { return Util.resolveObjPath( returnField, - dataStore[overrideMID || currentMID][metadataType][key] + dataStore[overrideMID || currentMID][metadataType][key], ); } else { throw new Error(); // eslint-disable-line unicorn/error-message } } catch { throw new Error( - `${metadataType} with ${searchField} '${searchValue}' does not have field '${returnField}'` + `${metadataType} with ${searchField} '${searchValue}' does not have field '${returnField}'`, ); } } } throw new Error( - `Dependent ${metadataType} with ${searchField}='${searchValue}' was not found on your BU` + `Dependent ${metadataType} with ${searchField}='${searchValue}' was not found on your BU`, ); }, /** @@ -153,13 +153,13 @@ export default { } } catch { throw new Error( - `${'list'} with ${searchField}='${searchValue}' does not have the fields ${returnField1} and ${returnField2}` + `${'list'} with ${searchField}='${searchValue}' does not have the fields ${returnField1} and ${returnField2}`, ); } } } throw new Error( - `Dependent list with ${searchField}='${searchValue}' was not found on your BU` + `Dependent list with ${searchField}='${searchValue}' was not found on your BU`, ); }, /** @@ -187,13 +187,13 @@ export default { } } catch { throw new Error( - `${'list'} with ListName='${listName}' and r__folder_Path='${folderPath}' does not have field '${returnField}'` + `${'list'} with ListName='${listName}' and r__folder_Path='${folderPath}' does not have field '${returnField}'`, ); } } } throw new Error( - `Dependent list with ListName='${listName}' and r__folder_Path='${folderPath}' was not found on your BU` + `Dependent list with ListName='${listName}' and r__folder_Path='${folderPath}' was not found on your BU`, ); }, }; diff --git a/lib/util/cli.js b/lib/util/cli.js index c35aa453a..31dfc05e9 100644 --- a/lib/util/cli.js +++ b/lib/util/cli.js @@ -45,7 +45,7 @@ const Cli = { Util.logger.info('\nPlease enter your new credentials'); if (skipInteraction && properties.credentials[skipInteraction.credentialName]) { Util.logger.error( - `Credential '${skipInteraction.credentialName}' already existing. If you tried updating please provide run 'mcdev init ${skipInteraction.credentialName}'` + `Credential '${skipInteraction.credentialName}' already existing. If you tried updating please provide run 'mcdev init ${skipInteraction.credentialName}'`, ); return null; } @@ -73,7 +73,7 @@ const Cli = { type: 'confirm', name: 'fixKeysReretrieve', message: `Do you want to re-retrieve dependent types (${dependentTypes.join( - ', ' + ', ', )}) now?`, default: true, }, @@ -160,7 +160,7 @@ const Cli = { businessUnit = response.businessUnit; if (!isCredentialOnly) { Util.logger.info( - `You could directly pass in this info with '${credential}/${businessUnit}'` + `You could directly pass in this info with '${credential}/${businessUnit}'`, ); } else if (credential && !businessUnit && 'string' === typeof isCredentialOnly) { // BU pre-selected @@ -173,13 +173,13 @@ const Cli = { // correct credential provided but BU still needed if (businessUnit && businessUnit !== 'undefined') { Util.logger.warn( - `Business Unit '${businessUnit}' not found for credential '${credential}'` + `Business Unit '${businessUnit}' not found for credential '${credential}'`, ); } const response = await this._selectBU(properties, credential, null, allowAll); businessUnit = response.businessUnit; Util.logger.info( - `You could directly pass in this info with '${credential}/${businessUnit}'` + `You could directly pass in this info with '${credential}/${businessUnit}'`, ); } return { @@ -298,7 +298,7 @@ const Cli = { inputData = skipInteraction; } else { throw new Error( - '--skipInteraction flag found but not defined for all required inputs: client_id,client_secret,auth_url,account_id,credentialName' + '--skipInteraction flag found but not defined for all required inputs: client_id,client_secret,auth_url,account_id,credentialName', ); } } else { @@ -314,7 +314,7 @@ const Cli = { auth_url: inputData.auth_url, account_id: Number.parseInt(inputData.account_id), }, - inputData.credentialName + inputData.credentialName, ); credentialsGood = true; // update central config now that the credentials are verified @@ -412,7 +412,7 @@ const Cli = { type: 'number', name: 'account_id', message: 'MID of Parent Business Unit', - } + }, ); const responses = await inquirer.prompt(questions); // remove extra white space @@ -443,11 +443,11 @@ const Cli = { } else { if (Util.logger.level === 'debug') { Util.logger.warn( - 'Debug mode enabled. Allowing selection of "disabled" types. Please be aware that these might be unstable.' + 'Debug mode enabled. Allowing selection of "disabled" types. Please be aware that these might be unstable.', ); } else { Util.logger.info( - 'Run mcdev selectTypes --debug if you need to use "disabled" types.' + 'Run mcdev selectTypes --debug if you need to use "disabled" types.', ); } const flattenedDefinitions = []; @@ -544,7 +544,7 @@ const Cli = { */ _summarizeSubtypes(responses, type) { const selectedAssetSubtypes = responses.selectedTypes.filter((str) => - str.includes(type + '-') + str.includes(type + '-'), ); if ( selectedAssetSubtypes.length === MetadataDefinitions[type].typeRetrieveByDefault.length @@ -552,12 +552,12 @@ const Cli = { const nonDefaultSelectedAssetSubtypes = selectedAssetSubtypes .map((subtype) => subtype.replace(type + '-', '')) .filter( - (subtype) => !MetadataDefinitions[type].typeRetrieveByDefault.includes(subtype) + (subtype) => !MetadataDefinitions[type].typeRetrieveByDefault.includes(subtype), ); if (!nonDefaultSelectedAssetSubtypes.length) { // found all defaults and nothing else. replace with main type responses.selectedTypes = responses.selectedTypes.filter( - (str) => !str.includes(type + '-') + (str) => !str.includes(type + '-'), ); responses.selectedTypes.push(type); @@ -598,11 +598,11 @@ const Cli = { Object.prototype.hasOwnProperty.call(supportCheckClass, 'update'), buildTemplate: Object.prototype.hasOwnProperty.call( supportCheckClass, - 'create' + 'create', ), // supported for all types that can be created retrieveAsTemplate: Object.prototype.hasOwnProperty.call( supportCheckClass, - 'retrieveAsTemplate' + 'retrieveAsTemplate', ), }, description: details.typeDescription, diff --git a/lib/util/config.js b/lib/util/config.js index b5a33918d..33229d6e7 100644 --- a/lib/util/config.js +++ b/lib/util/config.js @@ -57,21 +57,21 @@ const config = { config.properties.credentials[cred].eid }) and ${Util.authFileName} (${typeof auth[cred].account_id} ${ auth[cred].account_id - }) have a Enterprise ID mismatch. Please check.` + }) have a Enterprise ID mismatch. Please check.`, ); return; } // TODO add auth checks #294 } else if (!silent) { Util.logger.error( - `'${cred}' found in ${Util.configFileName} but not in ${Util.authFileName}. Please run 'mcdev init' to provide the missing credential details.` + `'${cred}' found in ${Util.configFileName} but not in ${Util.authFileName}. Please run 'mcdev init' to provide the missing credential details.`, ); return; } } } else if (!silent && !isInit) { Util.logger.error( - `${Util.authFileName} not found. Please run 'mcdev init' to provide the missing credential details.` + `${Util.authFileName} not found. Please run 'mcdev init' to provide the missing credential details.`, ); return; } @@ -104,7 +104,7 @@ const config = { // check if user is running older (ignores patches) mcdev version than whats saved to the config if (properties.version && semver.gt(properties.version, Util.packageJsonMcdev.version)) { Util.logger.error( - `Your Accenture SFMC DevTools version ${Util.packageJsonMcdev.version} is lower than your project's config version ${properties.version}` + `Your Accenture SFMC DevTools version ${Util.packageJsonMcdev.version} is lower than your project's config version ${properties.version}`, ); if (Util.skipInteraction) { return false; @@ -138,7 +138,7 @@ const config = { for (const cred in properties.credentials) { if (cred.includes('/') || cred.includes('\\')) { errorMsgs.push( - `Credential names may not includes slashes: ${cred}` + `Credential names may not includes slashes: ${cred}`, ); solutionSet.add('Apply manual fix in your config.'); } @@ -153,14 +153,14 @@ const config = { for (const buName in properties.credentials[cred].businessUnits) { if (buName.includes('/') || buName.includes('\\')) { errorMsgs.push( - `Business Unit names may not includes slashes: ${cred}: ${buName}` + `Business Unit names may not includes slashes: ${cred}: ${buName}`, ); solutionSet.add(`Run 'mcdev reloadBUs ${cred}'`); } if ( Object.prototype.hasOwnProperty.call( properties.credentials[cred].businessUnits, - buName + buName, ) && properties.credentials[cred].businessUnits[buName] !== 0 ) { @@ -186,10 +186,10 @@ const config = { Array.isArray(defaultProps[key][subkey]) ? 'Array' : typeof defaultProps[key][subkey] - }): ${defaultProps[key][subkey]}` + }): ${defaultProps[key][subkey]}`, ); solutionSet.add( - `Run 'mcdev upgrade' to fix missing or changed configuration options` + `Run 'mcdev upgrade' to fix missing or changed configuration options`, ); missingFields.push(`${key}.${subkey}`); } else if (subkey === 'deployment') { @@ -197,11 +197,11 @@ const config = { if ( Object.prototype.hasOwnProperty.call( defaultProps[key][subkey], - dkey + dkey, ) && !Object.prototype.hasOwnProperty.call( properties[key][subkey], - dkey + dkey, ) ) { errorMsgs.push( @@ -209,10 +209,10 @@ const config = { Array.isArray(defaultProps[key][subkey][dkey]) ? 'Array' : typeof defaultProps[key][subkey][dkey] - }): ${defaultProps[key][subkey][dkey]}` + }): ${defaultProps[key][subkey][dkey]}`, ); solutionSet.add( - `Run 'mcdev upgrade' to fix missing or changed configuration options` + `Run 'mcdev upgrade' to fix missing or changed configuration options`, ); missingFields.push(`${key}.${subkey}.${dkey}`); } @@ -223,7 +223,7 @@ const config = { } else { errorMsgs.push(`${key}{} missing`); solutionSet.add( - `Run 'mcdev upgrade' to fix missing or changed configuration options` + `Run 'mcdev upgrade' to fix missing or changed configuration options`, ); missingFields.push(key); } @@ -233,12 +233,12 @@ const config = { if ( !properties.version || (![null, 'patch'].includes( - semver.diff(Util.packageJsonMcdev.version, properties.version) + semver.diff(Util.packageJsonMcdev.version, properties.version), ) && semver.gt(Util.packageJsonMcdev.version, properties.version)) ) { errorMsgs.push( - `Your project's config version ${properties.version} is lower than your Accenture SFMC DevTools version ${Util.packageJsonMcdev.version}` + `Your project's config version ${properties.version} is lower than your Accenture SFMC DevTools version ${Util.packageJsonMcdev.version}`, ); solutionSet.add(`Run 'mcdev upgrade' to ensure optimal performance`); missingFields.push('version'); @@ -261,7 +261,7 @@ const config = { [ 'Here is what you can do to fix these issues:', ...Array.from(solutionSet), - ].join('\n- ') + ].join('\n- '), ); const responses = await inquirer.prompt([ { diff --git a/lib/util/devops.js b/lib/util/devops.js index 7589ad05b..5ebd08082 100644 --- a/lib/util/devops.js +++ b/lib/util/devops.js @@ -32,7 +32,7 @@ const DevOps = { path .normalize(properties.directories.retrieve + filePath) .split('\\') - .join('/') + .join('/'), ) : [properties.directories.retrieve]; if (range) { @@ -42,7 +42,7 @@ const DevOps = { range = range + '..HEAD'; } Util.logger.info( - `Analyzing changes in directories: ${filterPaths} based on commit range: ${range}` + `Analyzing changes in directories: ${filterPaths} based on commit range: ${range}`, ); } else { // get the last 10 commits by default to choose from. Default can be changed in mcdev config. @@ -122,7 +122,7 @@ const DevOps = { return true; } else { Util.logger.debug( - `Unknown metadata-type found for (${file.file}): ` + file.type + `Unknown metadata-type found for (${file.file}): ` + file.type, ); return false; } @@ -172,7 +172,7 @@ const DevOps = { MetadataType[file.type].readBUMetadataForType( buPath, false, - metadata[file._credential][file._businessUnit] + metadata[file._credential][file._businessUnit], ); } catch (ex) { // silently catch directory-not-found errors here @@ -195,7 +195,7 @@ const DevOps = { Util.logger.warn( `- ❌ No changes found. Check what branch you are currently on and if the target branch name (${rangeUserInput}${ range === rangeUserInput ? '' : ' converted to ' + range - }) was correct` + }) was correct`, ); return []; } @@ -207,11 +207,11 @@ const DevOps = { await File.writeJSONToFile(directoryDeltaPkg, 'delta_package', delta); this.document(directoryDeltaPkg, delta); Util.logger.info( - `- ✔️ Identified changes: Add/Update=${gitActionsCounter['add/update']}, Move=${gitActionsCounter['move']}, Delete=${gitActionsCounter['delete']}` + `- ✔️ Identified changes: Add/Update=${gitActionsCounter['add/update']}, Move=${gitActionsCounter['move']}, Delete=${gitActionsCounter['delete']}`, ); if (gitActionsCounter.delete > 0) { Util.logger.warn( - 'Please note that deletions have to be done manually on the SFMC website.' + 'Please note that deletions have to be done manually on the SFMC website.', ); } Util.logger.info(`Saved report in ${path.join(directoryDeltaPkg, 'delta_package.md')}`); @@ -236,7 +236,7 @@ const DevOps = { buObjects[`${file._credential}/${file._businessUnit}`] = await Cli.getCredentialObject( properties, - `${file._credential}/${file._businessUnit}` + `${file._credential}/${file._businessUnit}`, ); } } @@ -246,7 +246,7 @@ const DevOps = { MetadataType[type].buObject = buObject; MetadataType[type].properties = properties; const additionalFiles = await MetadataType[type].getFilesToCommit( - typeKeysMap[type] + typeKeysMap[type], ); if (additionalFiles?.length) { delta.push( @@ -259,8 +259,8 @@ const DevOps = { .filter( // avoid adding files that we already have in the list (addFile) => - !delta.find((existFile) => existFile.file === addFile.file) - ) + !delta.find((existFile) => existFile.file === addFile.file), + ), ); } } @@ -288,7 +288,7 @@ const DevOps = { properties.directories.deploy, buObject.credential, buObject.businessUnit, - ]) + ]), ); } } @@ -303,9 +303,9 @@ const DevOps = { .normalize(file.file) .replace( path.normalize(properties.directories.retrieve), - path.normalize(properties.directories.deploy) - ) - ) + path.normalize(properties.directories.deploy), + ), + ), ); const results = await Promise.all(copied); const failed = results.filter((result) => result.status === 'failed'); @@ -314,12 +314,12 @@ const DevOps = { Util.logger.info( `Copied changes to deploy directory (${ results.length - skipped.length - failed.length - } copied)` + } copied)`, ); Util.logger.debug( `Copied changes to deploy directory (${ results.length - skipped.length - failed.length - } copied, ${skipped.length} skipped, ${failed.length} failed)` + } copied, ${skipped.length} skipped, ${failed.length} failed)`, ); if (skipped.length > 0) { for (const file of skipped) { @@ -381,7 +381,7 @@ const DevOps = { targetML = properties.options.deployment.sourceTargetMapping[sourceML]; if ('string' !== typeof targetML) { throw new TypeError( - 'Please define one target marketList per source in deployment.sourceTargetMapping (No arrays allowed)' + 'Please define one target marketList per source in deployment.sourceTargetMapping (No arrays allowed)', ); } Util.verifyMarketList(targetML, properties); @@ -438,7 +438,7 @@ const DevOps = { // get unique list (original search might include more than one entry for types with docs or extracted code) const keyArr = [...new Set(buTypeDelta[bu][type])]; Util.logger.info( - `⚡ mcdev bt ${bu} ${type} "${keyArr.join(',')}" ${sourceMarket}` + `⚡ mcdev bt ${bu} ${type} "${keyArr.join(',')}" ${sourceMarket}`, ); await Builder.buildTemplate(bu, type, keyArr, sourceMarket); // ensure we have the right key for bd/bdb that matches the name used for rt @@ -456,7 +456,7 @@ const DevOps = { Util.logger.info(`- ✔️ Templates created: ${deltaCounter}`); } else { Util.logger.warn( - `- No Templates or Deploy Definitions created for ${sourceMlName}` + `- No Templates or Deploy Definitions created for ${sourceMlName}`, ); continue; } @@ -491,11 +491,11 @@ const DevOps = { const bdPromises = []; for (const type in typeDelta) { Util.logger.info( - `⚡ mcdev bdb ${targetMlName} ${type} "${typeDelta[type].join(',')}"` + `⚡ mcdev bdb ${targetMlName} ${type} "${typeDelta[type].join(',')}"`, ); // omitting "await" to speed up creation bdPromises.push( - Builder.buildDefinitionBulk(targetMlName, type, typeDelta[type].join(',')) + Builder.buildDefinitionBulk(targetMlName, type, typeDelta[type].join(',')), ); } await Promise.all(bdPromises); @@ -508,13 +508,13 @@ const DevOps = { Util.logger.info(`You can now run deploy on the prepared BUs`); } else { Util.logger.info( - `Your templated defintions are now ready to be copied into the deploy folder. Hint: You can have this auto-copied if you adjust directories.templateBuilds in your config.` + `Your templated defintions are now ready to be copied into the deploy folder. Hint: You can have this auto-copied if you adjust directories.templateBuilds in your config.`, ); } } if (!deltaDeployAll.length) { Util.logger.error( - '- ❌ No Templates or Deploy Definitions created. Check if you expected no changes.' + '- ❌ No Templates or Deploy Definitions created. Check if you expected no changes.', ); } return deltaDeployAll; diff --git a/lib/util/file.js b/lib/util/file.js index 6149d3fca..9b0b775c7 100644 --- a/lib/util/file.js +++ b/lib/util/file.js @@ -302,8 +302,8 @@ const File = { `Error Log\nParser: ${FileFs.prettierConfig.parser}\n${ex.message.replaceAll( /[\u001B\u009B][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, - '' - )}` + '', + )}`, ); formatted = content; @@ -423,7 +423,7 @@ const File = { direntPath, depth - 1, includeStem, - _stemLength + _stemLength, ); children = children.concat(nestedChildren); } @@ -487,7 +487,7 @@ const File = { path.join(directory, dirent.name), depth - 1, includeStem, - _stemLength + _stemLength, ); children.push(...nestedChildren); } @@ -526,12 +526,12 @@ const File = { // by using process.cwd we are limiting ourselves to a config in the project root // note: overrides will be ignored unless they are for *.html if hand in an html file here. This method includes the overrides corresponding to the file we pass in FileFs.prettierConfig = await prettier.resolveConfig( - path.join(process.cwd(), 'index.' + filetype) + path.join(process.cwd(), 'index.' + filetype), ); if (FileFs.prettierConfig === null) { // set to false to avoid re-running this after an initial failure throw new Error( - `No .prettierrc found in your project directory. Please run 'mcdev upgrade' to create it` + `No .prettierrc found in your project directory. Please run 'mcdev upgrade' to create it`, ); } diff --git a/lib/util/init.config.js b/lib/util/init.config.js index a8309d4d1..cf7c5473e 100644 --- a/lib/util/init.config.js +++ b/lib/util/init.config.js @@ -87,14 +87,14 @@ const Init = { } delete properties.options.documentOnRetrieve; upgradeMsgs.push( - `- ✔️ converted 'options.documentOnRetrieve' to '${fieldName}'` + `- ✔️ converted 'options.documentOnRetrieve' to '${fieldName}'`, ); break; } case 'options.deployment.commitHistory': { if (properties.options.commitHistory) { upgradeMsgs.push( - `- ✔️ converted 'options.commitHistory' to '${fieldName}'` + `- ✔️ converted 'options.commitHistory' to '${fieldName}'`, ); properties.options.deployment.commitHistory = properties.options.commitHistory; @@ -133,17 +133,17 @@ const Init = { // ensure we document dataExtensions and automations on retrieve as they should now be in the retrieve folder this._updateLeaf(properties, defaultProps, 'metaDataTypes.documentOnRetrieve'); upgradeMsgs.push( - `- ✔️ updated 'metaDataTypes.documentOnRetrieve' to include all available types` + `- ✔️ updated 'metaDataTypes.documentOnRetrieve' to include all available types`, ); // check if metaDataTypes.retrieve is set to default values and if not, launch selectTypes const defaultRetrieveArr = Util.getRetrieveTypeChoices(); let reselectDefaultRetrieve = false; const toBeRemovedTypes = properties.metaDataTypes.retrieve.filter( - (type) => !defaultRetrieveArr.includes(type) + (type) => !defaultRetrieveArr.includes(type), ); const toBeAddedTypes = defaultRetrieveArr.filter( - (type) => !properties.metaDataTypes.retrieve.includes(type) + (type) => !properties.metaDataTypes.retrieve.includes(type), ); if (toBeRemovedTypes.length || toBeAddedTypes.length) { @@ -156,7 +156,7 @@ const Init = { properties.credentials[cred].eid = Number.parseInt(properties.credentials[cred].eid); for (const bu in properties.credentials[cred].businessUnits) { properties.credentials[cred].businessUnits[bu] = Number.parseInt( - properties.credentials[cred].businessUnits[bu] + properties.credentials[cred].businessUnits[bu], ); } updateConfigNeeded = true; @@ -171,7 +171,7 @@ const Init = { if (reselectDefaultRetrieve) { // run selectTypes here as it _also_ runs File.saveConfigFile() Util.logger.warn( - 'Your metaDataTypes.retrieve list is not set to standard values. Resetting config.' + 'Your metaDataTypes.retrieve list is not set to standard values. Resetting config.', ); Util.logger.warn(''); if (toBeAddedTypes.length) { @@ -217,7 +217,7 @@ const Init = { const gitignoreFileName = path.resolve( __dirname, Util.boilerplateDirectory, - 'gitignore-template' + 'gitignore-template', ); if (await File.pathExists(gitignoreFileName)) { const fileContent = await File.readFile(gitignoreFileName, 'utf8'); @@ -225,8 +225,8 @@ const Init = { await this._createIdeConfigFile( ['.' + path.sep, '', '.gitignore'], relevantForcedUpdates, - fileContent - ) + fileContent, + ), ); } else { Util.logger.debug(`Dependency file not found in ${gitignoreFileName}`); @@ -250,8 +250,8 @@ const Init = { creationLog.push( await this._createIdeConfigFile( [subdir + path.sep, fileArr.join('.'), ext], - relevantForcedUpdates - ) + relevantForcedUpdates, + ), ); } } @@ -287,7 +287,7 @@ const Init = { this._updateLeaf( propertiersCur[curKey], defaultPropsCur[curKey], - fieldNameArr.join('.') + fieldNameArr.join('.'), ); } else { propertiersCur[fieldName] = defaultPropsCur[fieldName]; @@ -305,14 +305,14 @@ const Init = { const relevantForcedUpdates = []; if (await File.pathExists(Util.configFileName)) { forceIdeConfigUpdate = File.readJsonSync( - path.resolve(__dirname, Util.boilerplateDirectory, 'forcedUpdates.json') + path.resolve(__dirname, Util.boilerplateDirectory, 'forcedUpdates.json'), ); // return all if no project version was found or only changes from "newer" versions otherwise for (const element of forceIdeConfigUpdate) { if (!projectVersion || semver.gt(element.version, projectVersion)) { relevantForcedUpdates.push( // adapt it for local file systems - ...element.files.map((item) => path.normalize(item)) + ...element.files.map((item) => path.normalize(item)), ); } else { continue; @@ -337,7 +337,7 @@ const Init = { __dirname, Util.boilerplateDirectory, 'files', - fileName + fileName, ); boilerplateFileContent ||= await File.readFile(boilerplateFileName, 'utf8'); @@ -349,11 +349,11 @@ const Init = { } if (relevantForcedUpdates.includes(path.normalize(fileName))) { Util.logger.info( - `- ✋ ${fileName} found but an update is required. Commencing with override:` + `- ✋ ${fileName} found but an update is required. Commencing with override:`, ); } else { Util.logger.info( - `- ✋ ${fileName} found with differences to the new standard version. We recommend updating it.` + `- ✋ ${fileName} found with differences to the new standard version. We recommend updating it.`, ); if (!Util.skipInteraction) { const responses = await inquirer.prompt([ @@ -379,7 +379,7 @@ const Init = { fileNameArr[0], fileNameArr[1], fileNameArr[2].slice(1), - boilerplateFileContent + boilerplateFileContent, ); if (saveStatus) { @@ -388,7 +388,7 @@ const Init = { update ? `updated (we created a backup of the old file under ${fileName + '.BAK'})` : 'created' - }` + }`, ); return true; } else { @@ -418,7 +418,7 @@ const Init = { await File.writeJSONToFile( './', Util.authFileName.replace(/(.json)+$/, ''), - newAuth + newAuth, ); Util.logger.info(`- ✔️ upgraded credential file`); } diff --git a/lib/util/init.git.js b/lib/util/init.git.js index b6525d1a6..2c777cd61 100644 --- a/lib/util/init.git.js +++ b/lib/util/init.git.js @@ -23,7 +23,7 @@ const Init = { if (!commandExists.sync('git')) { Util.logger.error('Git installation not found.'); Util.logger.error( - 'Please follow our tutorial on installing Git: https://github.com/Accenture/sfmc-devtools#212-install-the-git-command-line' + 'Please follow our tutorial on installing Git: https://github.com/Accenture/sfmc-devtools#212-install-the-git-command-line', ); result.status = 'error'; return result; @@ -41,7 +41,7 @@ const Init = { newRepoInitialized = true; } else { Util.logger.error( - 'We detected a problem initializing your Git repository. Please run "git init" manually' + 'We detected a problem initializing your Git repository. Please run "git init" manually', ); result.status = 'error'; return result; @@ -52,7 +52,7 @@ const Init = { Util.execSync('git', ['config', '--local', 'core.longpaths', 'true']); } catch { Util.logger.warn( - `Updating your git config failed. We recommend running the above command manually yourself to avoid issues.` + `Updating your git config failed. We recommend running the above command manually yourself to avoid issues.`, ); } Util.logger.info('Ensuring checkout (git pull) as-is and commit Unix-style line endings:'); @@ -60,7 +60,7 @@ const Init = { Util.execSync('git', ['config', '--local', 'core.autocrlf', 'input']); } catch { Util.logger.warn( - `Updating your git config failed. We recommend running the above command manually yourself to avoid issues.` + `Updating your git config failed. We recommend running the above command manually yourself to avoid issues.`, ); } @@ -98,7 +98,7 @@ const Init = { if (remoteBranchesExist === false) { // offer git push if no remote branches found Util.logger.info( - `Your remote Git repository is still empty and ready to store your initial backup. Hint: This is the server version of the repo which you share with your team.` + `Your remote Git repository is still empty and ready to store your initial backup. Hint: This is the server version of the repo which you share with your team.`, ); let responses; if (!skipInteraction) { @@ -116,7 +116,7 @@ const Init = { } } else if (remoteBranchesExist === true) { Util.logger.info( - 'Your remote Git repository already contains data. Please execute a git push manually.' + 'Your remote Git repository already contains data. Please execute a git push manually.', ); } } @@ -184,7 +184,7 @@ const Init = { const skipInteraction = Util.skipInteraction; const gitUser = (await this._getGitConfigUser()) || {}; Util.logger.info( - `Please confirm your Git user name & email. It should be in the format 'FirstName LastName' and 'your.email@accenture.com'. The current (potentially wrong) values are provided as default. If correct, confirm with ENTER, otherwise please update:` + `Please confirm your Git user name & email. It should be in the format 'FirstName LastName' and 'your.email@accenture.com'. The current (potentially wrong) values are provided as default. If correct, confirm with ENTER, otherwise please update:`, ); let responses; /* eslint-disable unicorn/prefer-ternary */ diff --git a/lib/util/init.js b/lib/util/init.js index 6ee716537..bc1e68310 100644 --- a/lib/util/init.js +++ b/lib/util/init.js @@ -40,7 +40,7 @@ const Init = { // update-credential mode if (!properties.credentials[credentialName]) { Util.logger.error( - `Could not update credential '${credentialName}' because it was not found in your config. Please check your spelling and try again.` + `Could not update credential '${credentialName}' because it was not found in your config. Please check your spelling and try again.`, ); Cli.logExistingCredentials(properties); if (skipInteraction) { @@ -79,7 +79,7 @@ const Init = { missingCredentials.length > 1 ? 's' : '' } in your ${Util.configFileName} that ${ missingCredentials.length > 1 ? 'are' : 'is' - } missing details.` + } missing details.`, ); for (const badCredName of missingCredentials) { let error; @@ -123,7 +123,7 @@ const Init = { Util.logger.info('Adding another credential'); } else { throw new Error( - '--skipInteraction flag found but missing required input for client_id,client_secret,auth_url,account_id,credentialName' + '--skipInteraction flag found but missing required input for client_id,client_secret,auth_url,account_id,credentialName', ); } } else { @@ -187,7 +187,7 @@ const Init = { // all done Util.logger.info('You are now ready to work with Accenture SFMC DevTools!'); Util.logger.warn( - 'If you use VSCode, please restart it now to install recommended extensions.' + 'If you use VSCode, please restart it now to install recommended extensions.', ); } }, @@ -228,7 +228,7 @@ const Init = { const repoName = gitRepoQs.gitRepoUrl.split('/').pop().replace('.git', ''); // clone repo into current folder Util.logger.info( - 'Cloning initiated. You might be asked for your Git credentials in a pop-up window in a few seconds.' + 'Cloning initiated. You might be asked for your Git credentials in a pop-up window in a few seconds.', ); Util.execSync( 'git', @@ -238,15 +238,15 @@ const Init = { '--config core.longpaths=true', '--config core.autocrlf=input', gitRepoQs.gitRepoUrl, - ].filter(Boolean) + ].filter(Boolean), ); if (!fs.existsSync(repoName)) { Util.logger.error( - 'Could not clone repository. Please check your Git-Repository URL as well as your credentials and try again.' + 'Could not clone repository. Please check your Git-Repository URL as well as your credentials and try again.', ); Util.logger.info( - 'Check if you need an "API-Token" instead of your normal user password to authenticate' + 'Check if you need an "API-Token" instead of your normal user password to authenticate', ); return; } @@ -257,7 +257,7 @@ const Init = { const properties = await config.getProperties(true, true); if (!properties) { Util.logger.error( - 'Could not find .mcdevrc.json file in project folder. Please check your Git repository and branch.' + 'Could not find .mcdevrc.json file in project folder. Please check your Git repository and branch.', ); return; } @@ -281,7 +281,7 @@ const Init = { // get list of business units const firstCredentialName = Object.keys(properties.credentials)[0]; const businessUnits = Object.keys( - properties.credentials[firstCredentialName].businessUnits + properties.credentials[firstCredentialName].businessUnits, ); // set up empty markets for them @@ -297,14 +297,14 @@ const Init = { // don't ask, list all BUs in deployment-target and set deployment-source to ??? if (!businessUnits.includes(skipInteraction.developmentBu)) { Util.logger.warn( - `Could not find developmentBu=${skipInteraction.developmentBu} in business units. Skipping.` + `Could not find developmentBu=${skipInteraction.developmentBu} in business units. Skipping.`, ); delete skipInteraction.developmentBu; } sourceBuName = skipInteraction.developmentBu || '???'; if (!skipInteraction.developmentBu) { Util.logger.info( - 'Market List "deployment-source" will need to be set up manually. Marking all BUs as target BUs in "deployment-target".' + 'Market List "deployment-source" will need to be set up manually. Marking all BUs as target BUs in "deployment-target".', ); } } else { @@ -361,7 +361,7 @@ const Init = { Util.logger.info(`✔️ SFMC instance backed up`); } else if (gitStatus === 'update') { Util.logger.warn( - 'Please manually commit this backup according to your projects guidelines.' + 'Please manually commit this backup according to your projects guidelines.', ); // TODO create guided commit: // 1. ask if commit with all changes shall be created @@ -388,7 +388,7 @@ const Init = { const versionBeforeUpgrade = properties?.version || '0.0.0'; if (!initial) { Util.logger.info( - 'Upgrading project with newest configuration, npm dependencies & other project configurations:' + 'Upgrading project with newest configuration, npm dependencies & other project configurations:', ); // ensure an existing config is up to current specs @@ -434,12 +434,12 @@ const Init = { Util.logger.warn( `It seems your project folder will be synchronized via '${ cloudServices[variable] === 'CloudDocs' ? 'iCloud' : cloudServices[variable] - }'. This can reduce the overall performance of your computer due to conflicts with Git.` + }'. This can reduce the overall performance of your computer due to conflicts with Git.`, ); Util.logger.warn( `We strongly recommend moving your project folder outside of the '${ cloudServices[variable] === 'CloudDocs' ? 'iCloud' : cloudServices[variable] - }' folder.` + }' folder.`, ); cloudServiceFound = true; } @@ -448,11 +448,11 @@ const Init = { // warn user to not place project folder into user profile folder Util.logger.warn( `It seems your project folder is located in your user profile's default folder which is often synchronized to webservices like ${cloudServices.join( - ', ' - )}. This can reduce the overall performance of your computer due to conflicts between with Git.` + ', ', + )}. This can reduce the overall performance of your computer due to conflicts between with Git.`, ); Util.logger.warn( - `We strongly recommend moving your project folder outside of this folder.` + `We strongly recommend moving your project folder outside of this folder.`, ); cloudServiceFound = true; } @@ -499,7 +499,7 @@ const Init = { properties.credentials[cred].eid != auth[cred].account_id || !auth[cred].client_id || !auth[cred].client_secret || - !auth[cred].auth_url + !auth[cred].auth_url, ); } return missingCredentials || []; diff --git a/lib/util/init.npm.js b/lib/util/init.npm.js index 6b7ff27e2..131e4443b 100644 --- a/lib/util/init.npm.js +++ b/lib/util/init.npm.js @@ -28,7 +28,7 @@ const Init = { fileContent = await File.readFile('package.json', 'utf8'); } catch (ex) { Util.logger.error( - 'Your package.json was found but seems to be corrupted: ' + ex.message + 'Your package.json was found but seems to be corrupted: ' + ex.message, ); } if (fileContent) { @@ -68,7 +68,7 @@ const Init = { const dependencyFile = path.resolve( __dirname, Util.boilerplateDirectory, - 'npm-dependencies.json' + 'npm-dependencies.json', ); if (!(await File.pathExists(dependencyFile))) { Util.logger.debug(`Dependency file not found in ${dependencyFile}`); @@ -92,7 +92,7 @@ const Init = { for (const name of defaultDependencies) { // check project.devDependencies versionsProject[name] = Object.keys(projectPackageJson.devDependencies).includes( - name + name, ) ? projectPackageJson.devDependencies[name].replace(/^[\^~]/, '') : // fallback to invalid version if not found @@ -105,12 +105,12 @@ const Init = { !projectPackageJson.devDependencies || !projectPackageJson.devDependencies[name] || versionsDefault[name] == 'latest' || - semver.gt(versionsDefault[name], versionsProject[name]) + semver.gt(versionsDefault[name], versionsProject[name]), ); if (loadDependencies.length) { Util.logger.info('Installing/Updating Dependencies:'); const args = ['install', '--save-dev'].concat( - loadDependencies.map((name) => `${name}@${versionsDefault[name]}`) + loadDependencies.map((name) => `${name}@${versionsDefault[name]}`), ); Util.execSync('npm', args); @@ -118,7 +118,9 @@ const Init = { } else { Util.logger.info( `✔️ All default dependencies are already installed: ` + - defaultDependencies.map((name) => `${name}@${versionsProject[name]}`).join(', ') + defaultDependencies + .map((name) => `${name}@${versionsProject[name]}`) + .join(', '), ); } return true; diff --git a/lib/util/util.js b/lib/util/util.js index 80d9ffcb5..92d8279f8 100644 --- a/lib/util/util.js +++ b/lib/util/util.js @@ -268,8 +268,8 @@ export const Util = { winston.format.timestamp({ format: 'HH:mm:ss' }), winston.format.simple(), winston.format.printf( - (info) => `${info.timestamp} ${info.level}: ${info.message}` - ) + (info) => `${info.timestamp} ${info.level}: ${info.message}`, + ), ), }), }; @@ -283,8 +283,8 @@ export const Util = { winston.format.timestamp({ format: 'HH:mm:ss.SSS' }), winston.format.simple(), winston.format.printf( - (info) => `${info.timestamp} ${info.level}: ${info.message}` - ) + (info) => `${info.timestamp} ${info.level}: ${info.message}`, + ), ), }); transports.fileError = new winston.transports.File({ @@ -297,8 +297,8 @@ export const Util = { winston.format.timestamp({ format: 'HH:mm:ss.SSS' }), winston.format.simple(), winston.format.printf( - (info) => `${info.timestamp} ${info.level}: ${info.message}` - ) + (info) => `${info.timestamp} ${info.level}: ${info.message}`, + ), ), }); } @@ -331,7 +331,7 @@ export const Util = { return; } Util.loggerTransports = this._createNewLoggerTransport( - noLogFile || Util.OPTIONS?.noLogFile + noLogFile || Util.OPTIONS?.noLogFile, ); const myWinston = winston.createLogger({ level: Util.OPTIONS.loggerLevel, @@ -394,7 +394,7 @@ export const Util = { const processArgv = process.argv.slice(2); Util.logger.debug( - `:: mcdev ${Util.packageJsonMcdev.version} :: ⚡ mcdev ${processArgv.join(' ')}` + `:: mcdev ${Util.packageJsonMcdev.version} :: ⚡ mcdev ${processArgv.join(' ')}`, ); }, /** @@ -489,7 +489,7 @@ export const Util = { dependencies.add(dependentType); } else if ( MetadataDefinitions[dependentType].dependencies.some((dependency) => - dependency.startsWith(fixedType + '-') + dependency.startsWith(fixedType + '-'), ) ) { // if MetadataTypeDefinitions[dependentType].dependencies start with type then also add dependentType to the set; use some to check if any of the dependencies start with type @@ -522,7 +522,7 @@ export const Util = { subTypeDeps[dep.split('-')[0]].add(dep); } return [dep, metadataType]; - }) + }), ); } // if they have no dependencies then just add them with undefined. @@ -642,7 +642,7 @@ export const Util = { throw new Error(`No metadata found with name "${searchValue}"`); } else if (matching.length > 1) { throw new Error( - `Multiple metadata with name "${searchValue}" please rename to be unique to avoid issues` + `Multiple metadata with name "${searchValue}" please rename to be unique to avoid issues`, ); } else { return matching[0]; @@ -690,7 +690,7 @@ export const Util = { */ logBeta(type) { Util.logger.warn( - ` - ${type} support is currently still in beta. Please report any issues here: https://github.com/Accenture/sfmc-devtools/issues/new/choose` + ` - ${type} support is currently still in beta. Please report any issues here: https://github.com/Accenture/sfmc-devtools/issues/new/choose`, ); }, // defined colors for logging things in different colors @@ -742,8 +742,8 @@ export const Util = { if (subTypeArr && subTypeArr.length > 0) { Util.logger.info( Util.getGrayMsg( - ` - Subtype${subTypeArr.length > 1 ? 's' : ''}: ${subTypeArr.join(', ')}` - ) + ` - Subtype${subTypeArr.length > 1 ? 's' : ''}: ${subTypeArr.join(', ')}`, + ), ); } }, @@ -764,7 +764,7 @@ export const Util = { } if (keyArr.length > 0) { return Util.getGrayMsg( - ` - ${isId ? 'ID' : 'Key'}${keyArr.length > 1 ? 's' : ''}: ${keyArr.join(', ')}` + ` - ${isId ? 'ID' : 'Key'}${keyArr.length > 1 ? 's' : ''}: ${keyArr.join(', ')}`, ); } return ''; @@ -839,7 +839,7 @@ export const Util = { // Remove special chars search = search.replaceAll( new RegExp('([\\.\\\\\\+\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:\\-])', 'g'), - '\\$1' + '\\$1', ); // Replace % and _ with equivalent regex search = search.replaceAll('%', '.*').replaceAll('_', '.'); diff --git a/test/general.test.js b/test/general.test.js index 9497b7e22..a710b9f37 100644 --- a/test/general.test.js +++ b/test/general.test.js @@ -42,7 +42,7 @@ describe('GENERAL', () => { assert.equal( process.exitCode, false, - 'explainTypes --json should not have thrown an error' + 'explainTypes --json should not have thrown an error', ); // check if properties are all there @@ -51,7 +51,7 @@ describe('GENERAL', () => { 'apiName', 'retrieveByDefault', 'description', - 'supports' + 'supports', ); expect(typeArr[0].supports).to.have.all.keys( 'retrieve', @@ -60,14 +60,14 @@ describe('GENERAL', () => { 'delete', 'changeKey', 'buildTemplate', - 'retrieveAsTemplate' + 'retrieveAsTemplate', ); // check if certain types were returned assert.equal( typeArr.find((type) => type.apiName === 'dataExtension').apiName, 'dataExtension', - 'Expected to find dataExtension type' + 'Expected to find dataExtension type', ); return; @@ -79,7 +79,7 @@ describe('GENERAL', () => { it('should show diff between master and develop branch'); // mcdev createDeltaPkg master..develop it( - 'should show diff between master and develop branch and filter the results to only show MyProject/BU1' + 'should show diff between master and develop branch and filter the results to only show MyProject/BU1', ); // mcdev createDeltaPkg master..develop --filter 'MyProject/BU1' }); diff --git a/test/resourceFactory.js b/test/resourceFactory.js index 7ef2fec66..089f68df7 100644 --- a/test/resourceFactory.js +++ b/test/resourceFactory.js @@ -23,7 +23,7 @@ if ( get() { return ''; }, - } + }, ); } else { // test is executed directly in a command prompt. Use colors. @@ -58,7 +58,7 @@ async function loadSOAPRecords(mcdevAction, type, mid, filter) { testPath + '-response.xml' } instead of the more specific ${ testPath + filterPath + '-response.xml' - }. Make sure this is intended` + }. Make sure this is intended`, ); /* eslint-enable no-console */ } @@ -70,7 +70,7 @@ async function loadSOAPRecords(mcdevAction, type, mid, filter) { console.log( `${color.bgRed}${color.fgBlack}TEST-ERROR${color.reset}: Please create file ${ filterPath ? testPath + filterPath + '-response.xml or ' : '' - }${testPath + '-response.xml'}` + }${testPath + '-response.xml'}`, ); /* eslint-enable no-console */ @@ -142,7 +142,7 @@ export const handleSOAPRequest = async (config) => { config.headers.SOAPAction.toLocaleLowerCase(), jObj.Envelope.Body.RetrieveRequestMsg.RetrieveRequest.ObjectType, jObj.Envelope.Header.fueloauth, - jObj.Envelope.Body.RetrieveRequestMsg.RetrieveRequest.Filter + jObj.Envelope.Body.RetrieveRequestMsg.RetrieveRequest.Filter, ); break; @@ -152,7 +152,7 @@ export const handleSOAPRequest = async (config) => { config.headers.SOAPAction.toLocaleLowerCase(), fullObj.Envelope.Body.CreateRequest.Objects['@_xsi:type'], jObj.Envelope.Header.fueloauth, - null + null, ); break; @@ -162,7 +162,7 @@ export const handleSOAPRequest = async (config) => { config.headers.SOAPAction.toLocaleLowerCase(), fullObj.Envelope.Body.UpdateRequest.Objects['@_xsi:type'], jObj.Envelope.Header.fueloauth, - null + null, ); break; @@ -174,7 +174,7 @@ export const handleSOAPRequest = async (config) => { '@_xsi:type' ], jObj.Envelope.Header.fueloauth, - null + null, ); break; @@ -184,7 +184,7 @@ export const handleSOAPRequest = async (config) => { config.headers.SOAPAction.toLocaleLowerCase(), fullObj.Envelope.Body.DeleteRequest.Objects['@_xsi:type'], jObj.Envelope.Header.fueloauth, - null + null, ); break; @@ -194,7 +194,7 @@ export const handleSOAPRequest = async (config) => { config.headers.SOAPAction.toLocaleLowerCase(), fullObj.Envelope.Body.ScheduleRequestMsg.Interactions.Interaction['@_xsi:type'], jObj.Envelope.Header.fueloauth, - fullObj.Envelope.Body.ScheduleRequestMsg.Interactions.Interaction.ObjectID + fullObj.Envelope.Body.ScheduleRequestMsg.Interactions.Interaction.ObjectID, ); break; @@ -204,14 +204,14 @@ export const handleSOAPRequest = async (config) => { config.headers.SOAPAction.toLocaleLowerCase(), fullObj.Envelope.Body.PerformRequestMsg.Definitions.Definition['@_xsi:type'], jObj.Envelope.Header.fueloauth, - fullObj.Envelope.Body.PerformRequestMsg.Definitions.Definition.ObjectID + fullObj.Envelope.Body.PerformRequestMsg.Definitions.Definition.ObjectID, ); break; } default: { throw new Error( - `The SOAP Action ${config.headers.SOAPAction} is not supported by test handler` + `The SOAP Action ${config.headers.SOAPAction} is not supported by test handler`, ); } } @@ -247,7 +247,7 @@ export const handleRESTRequest = async (config) => { 'resources', config.headers.Authorization.replace('Bearer ', ''), urlObj.pathname, - config.method + '-response' + config.method + '-response', ) .replace(':', '_'); // replace : with _ for Windows @@ -257,7 +257,7 @@ export const handleRESTRequest = async (config) => { const response = JSON.parse( await fs.readFile(testPath + '.json', { encoding: 'utf8', - }) + }), ); response.items = response.items.filter((def) => def.name == filterName); response.count = response.items.length; @@ -280,7 +280,7 @@ export const handleRESTRequest = async (config) => { } else { /* eslint-disable no-console */ console.log( - `${color.bgRed}${color.fgBlack}TEST-ERROR${color.reset}: Please create file ${testPath}.json/.txt` + `${color.bgRed}${color.fgBlack}TEST-ERROR${color.reset}: Please create file ${testPath}.json/.txt`, ); /* eslint-enable no-console */ process.exitCode = 404; diff --git a/test/type.attributeGroup.test.js b/test/type.attributeGroup.test.js index da3698f8c..05994089f 100644 --- a/test/type.attributeGroup.test.js +++ b/test/type.attributeGroup.test.js @@ -24,7 +24,7 @@ describe('type: attributeGroup', () => { ? Object.keys(retrieve['testInstance/testBU'].attributeGroup).length : 0, 8, - 'only 8 attributeGroups expected in retrieve response' + 'only 8 attributeGroups expected in retrieve response', ); // get results from cache @@ -32,19 +32,19 @@ describe('type: attributeGroup', () => { assert.equal( result.attributeGroup ? Object.keys(result.attributeGroup).length : 0, 8, - 'only 8 attributeGroups expected in cache' + 'only 8 attributeGroups expected in cache', ); assert.deepEqual( await testUtils.getActualJson('ETMobileConnect', 'attributeGroup'), await testUtils.getExpectedJson('9999999', 'attributeGroup', 'retrieve'), - 'returned metadata was not equal expected' + 'returned metadata was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 2, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); diff --git a/test/type.attributeSet.test.js b/test/type.attributeSet.test.js index a4e44e3aa..d9c9a1c6e 100644 --- a/test/type.attributeSet.test.js +++ b/test/type.attributeSet.test.js @@ -24,27 +24,27 @@ describe('type: attributeSet', () => { ? Object.keys(retrieve['testInstance/testBU'].attributeSet).length : 0, 28, - 'only 28 attributeSets expected in retrieve response' + 'only 28 attributeSets expected in retrieve response', ); // get results from cache const result = cache.getCache(); assert.equal( result.attributeSet ? Object.keys(result.attributeSet).length : 0, 28, - 'only 28 attributeSets expected in cache' + 'only 28 attributeSets expected in cache', ); assert.deepEqual( await testUtils.getActualJson('testExisting_dataExtensionShared', 'attributeSet'), await testUtils.getExpectedJson('9999999', 'attributeSet', 'retrieve'), - 'returned metadata was not equal expected' + 'returned metadata was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 7, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); diff --git a/test/type.automation.test.js b/test/type.automation.test.js index d2ebd629c..01bcaeba4 100644 --- a/test/type.automation.test.js +++ b/test/type.automation.test.js @@ -24,13 +24,13 @@ describe('type: automation', () => { assert.equal( result.automation ? Object.keys(result.automation).length : 0, 4, - 'only four automations expected' + 'only four automations expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'retrieve'), - 'returned metadata was not equal expected' + 'returned metadata was not equal expected', ); // check if MD file was created and equals expectations expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal( @@ -39,14 +39,14 @@ describe('type: automation', () => { '9999999', 'automation', 'retrieve-testExisting_automation', - 'md' - ) - ) + 'md', + ), + ), ); assert.equal( testUtils.getAPIHistoryLength(), 18, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -60,7 +60,11 @@ describe('type: automation', () => { const deployResult = await handler.deploy( 'testInstance/testBU', ['automation', 'verification'], - ['testExisting_automation', 'testNew_automation', 'testNew_39f6a488-20eb-4ba0-b0b9'] + [ + 'testExisting_automation', + 'testNew_automation', + 'testNew_39f6a488-20eb-4ba0-b0b9', + ], ); // THEN assert.equal(process.exitCode, false, 'deploy should not have thrown an error'); @@ -71,7 +75,7 @@ describe('type: automation', () => { ? Object.keys(deployResult['testInstance/testBU']?.automation).length : 0, 2, - 'two automations to be deployed' + 'two automations to be deployed', ); // get results from cache @@ -79,19 +83,19 @@ describe('type: automation', () => { assert.equal( cacheResult.automation ? Object.keys(cacheResult.automation).length : 0, 5, - 'three automations expected' + 'three automations expected', ); // insert assert.deepEqual( await testUtils.getActualJson('testNew_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'create'), - 'returned metadata was not equal expected for create' + 'returned metadata was not equal expected for create', ); // update assert.deepEqual( await testUtils.getActualJson('testExisting_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'update'), - 'returned metadata was not equal expected for update' + 'returned metadata was not equal expected for update', ); // check if MD file was created and equals expectations expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal( @@ -100,9 +104,9 @@ describe('type: automation', () => { '9999999', 'automation', 'update-testExisting_automation', - 'md' - ) - ) + 'md', + ), + ), ); // check if MD file was created and equals expectations @@ -112,15 +116,15 @@ describe('type: automation', () => { '9999999', 'automation', 'create-testNew_automation', - 'md' - ) - ) + 'md', + ), + ), ); assert.equal( testUtils.getAPIHistoryLength(), 25, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -130,13 +134,17 @@ describe('type: automation', () => { const deployed = await handler.deploy( 'testInstance/testBU', ['automation', 'verification'], - ['testExisting_automation', 'testNew_automation', 'testNew_39f6a488-20eb-4ba0-b0b9'] + [ + 'testExisting_automation', + 'testNew_automation', + 'testNew_39f6a488-20eb-4ba0-b0b9', + ], ); // THEN assert.equal( process.exitCode, false, - 'deploy with --execute should not have thrown an error' + 'deploy with --execute should not have thrown an error', ); // get results from cache @@ -144,35 +152,35 @@ describe('type: automation', () => { assert.equal( cached.automation ? Object.keys(cached.automation).length : 0, 5, - 'five cached automation expected' + 'five cached automation expected', ); assert.equal( deployed['testInstance/testBU'].automation ? Object.keys(deployed['testInstance/testBU'].automation).length : 0, 2, - 'two deployed automation expected' + 'two deployed automation expected', ); assert.equal( deployed['testInstance/testBU'].automation ? Object.keys(deployed['testInstance/testBU'].automation)[0] : null, 'testNew_automation', - 'expected specific automation to have been deployed' + 'expected specific automation to have been deployed', ); assert.equal( deployed['testInstance/testBU'].automation ? Object.keys(deployed['testInstance/testBU'].automation)[1] : null, 'testExisting_automation', - 'expected specific automation to have been deployed' + 'expected specific automation to have been deployed', ); // update assert.deepEqual( await testUtils.getActualJson('testExisting_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'update'), - 'returned metadata was not equal expected for update' + 'returned metadata was not equal expected for update', ); // check if MD file was created and equals expectations expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal( @@ -181,15 +189,15 @@ describe('type: automation', () => { '9999999', 'automation', 'update-testExisting_automation', - 'md' - ) - ) + 'md', + ), + ), ); assert.equal( testUtils.getAPIHistoryLength(), 33, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -199,13 +207,17 @@ describe('type: automation', () => { const deployed = await handler.deploy( 'testInstance/testBU', ['automation', 'verification'], - ['testExisting_automation', 'testNew_automation', 'testNew_39f6a488-20eb-4ba0-b0b9'] + [ + 'testExisting_automation', + 'testNew_automation', + 'testNew_39f6a488-20eb-4ba0-b0b9', + ], ); // THEN assert.equal( process.exitCode, false, - 'deploy with --execute should not have thrown an error' + 'deploy with --execute should not have thrown an error', ); // get results from cache @@ -213,34 +225,34 @@ describe('type: automation', () => { assert.equal( cached.automation ? Object.keys(cached.automation).length : 0, 5, - 'five cached automation expected' + 'five cached automation expected', ); assert.equal( deployed['testInstance/testBU'].automation ? Object.keys(deployed['testInstance/testBU'].automation).length : 0, 2, - 'two deployed automation expected' + 'two deployed automation expected', ); assert.equal( deployed['testInstance/testBU'].automation ? Object.keys(deployed['testInstance/testBU'].automation)[0] : null, 'testNew_automation', - 'expected specific automation to have been deployed' + 'expected specific automation to have been deployed', ); assert.equal( deployed['testInstance/testBU'].automation ? Object.keys(deployed['testInstance/testBU'].automation)[1] : null, 'testExisting_automation', - 'expected specific automation to have been deployed' + 'expected specific automation to have been deployed', ); // update assert.deepEqual( await testUtils.getActualJson('testExisting_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'update'), - 'returned metadata was not equal expected for update' + 'returned metadata was not equal expected for update', ); // check if MD file was created and equals expectations expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal( @@ -249,15 +261,15 @@ describe('type: automation', () => { '9999999', 'automation', 'update-testExisting_automation', - 'md' - ) - ) + 'md', + ), + ), ); assert.equal( testUtils.getAPIHistoryLength(), 29, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -278,7 +290,7 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 0, - 'expected to find no keys to be fixed' + 'expected to find no keys to be fixed', ); // get results from cache @@ -286,14 +298,14 @@ describe('type: automation', () => { assert.equal( result.automation ? Object.keys(result.automation).length : 0, 1, - 'one automation expected' + 'one automation expected', ); testUtils.logAPIHistoryDebug(); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 18, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -307,12 +319,12 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_automation_fixedKey_scheduled', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -320,24 +332,24 @@ describe('type: automation', () => { assert.deepEqual( await testUtils.getActualJson( 'testExisting_automation_fixedKey_scheduled', - 'automation' + 'automation', ), await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-schedule'), - 'returned metadata was not equal expected for update automation' + 'returned metadata was not equal expected for update automation', ); expect( file( testUtils.getActualDoc( 'testExisting_automation_fixedKey_scheduled', - 'automation' - ) - ) + 'automation', + ), + ), ).to.exist; // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 40, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -351,12 +363,12 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_automation_fixedKey_scheduled', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -364,24 +376,24 @@ describe('type: automation', () => { assert.deepEqual( await testUtils.getActualJson( 'testExisting_automation_fixedKey_scheduled', - 'automation' + 'automation', ), await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-schedule'), - 'returned metadata was not equal expected for update automation' + 'returned metadata was not equal expected for update automation', ); expect( file( testUtils.getActualDoc( 'testExisting_automation_fixedKey_scheduled', - 'automation' - ) - ) + 'automation', + ), + ), ).to.exist; // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 42, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -395,12 +407,12 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_automation_fixedKey_scheduled', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -408,24 +420,24 @@ describe('type: automation', () => { assert.deepEqual( await testUtils.getActualJson( 'testExisting_automation_fixedKey_scheduled', - 'automation' + 'automation', ), await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-schedule'), - 'returned metadata was not equal expected for update automation' + 'returned metadata was not equal expected for update automation', ); expect( file( testUtils.getActualDoc( 'testExisting_automation_fixedKey_scheduled', - 'automation' - ) - ) + 'automation', + ), + ), ).to.exist; // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 43, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -438,12 +450,12 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_automation_fixedKey_paused', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -451,21 +463,21 @@ describe('type: automation', () => { assert.deepEqual( await testUtils.getActualJson( 'testExisting_automation_fixedKey_paused', - 'automation' + 'automation', ), await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-pause'), - 'returned metadata was not equal expected for update automation' + 'returned metadata was not equal expected for update automation', ); expect( file( - testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation') - ) + testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation'), + ), ).to.exist; // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 35, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -479,12 +491,12 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_automation_fixedKey_paused', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -492,21 +504,21 @@ describe('type: automation', () => { assert.deepEqual( await testUtils.getActualJson( 'testExisting_automation_fixedKey_paused', - 'automation' + 'automation', ), await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-pause'), - 'returned metadata was not equal expected for update automation' + 'returned metadata was not equal expected for update automation', ); expect( file( - testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation') - ) + testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation'), + ), ).to.exist; // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 41, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -520,12 +532,12 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_automation_fixedKey_paused', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -533,21 +545,21 @@ describe('type: automation', () => { assert.deepEqual( await testUtils.getActualJson( 'testExisting_automation_fixedKey_paused', - 'automation' + 'automation', ), await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-pause'), - 'returned metadata was not equal expected for update automation' + 'returned metadata was not equal expected for update automation', ); expect( file( - testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation') - ) + testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation'), + ), ).to.exist; // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 43, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -559,46 +571,46 @@ describe('type: automation', () => { 'testInstance/testBU', 'automation', ['testExisting_automation'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal( process.exitCode, false, - 'retrieveAsTemplate should not have thrown an error' + 'retrieveAsTemplate should not have thrown an error', ); // WHEN assert.equal( result.automation ? Object.keys(result.automation).length : 0, 1, - 'only one automation expected' + 'only one automation expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'template'), - 'returned template was not equal expected' + 'returned template was not equal expected', ); // THEN await handler.buildDefinition( 'testInstance/testBU', 'automation', 'testExisting_automation', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'build'), - 'returned deployment file was not equal expected' + 'returned deployment file was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 20, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -610,42 +622,42 @@ describe('type: automation', () => { 'testInstance/testBU', 'automation', ['testExisting_automation'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); // WHEN assert.equal( result.automation ? Object.keys(result.automation).length : 0, 1, - 'only one automation expected' + 'only one automation expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'template'), - 'returned template was not equal expected' + 'returned template was not equal expected', ); // THEN await handler.buildDefinition( 'testInstance/testBU', 'automation', 'testExisting_automation', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'build'), - 'returned deployment file was not equal expected' + 'returned deployment file was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 18, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -656,7 +668,7 @@ describe('type: automation', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'automation', - 'testExisting_automation' + 'testExisting_automation', ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); @@ -675,19 +687,19 @@ describe('type: automation', () => { assert.equal( process.exitCode, false, - 'getFilesToCommit should not have thrown an error' + 'getFilesToCommit should not have thrown an error', ); assert.equal(fileList.length, 2, 'expected only 2 file paths'); assert.equal( fileList[0].split('\\').join('/'), 'retrieve/testInstance/testBU/automation/testExisting_automation.automation-meta.json', - 'wrong JSON path' + 'wrong JSON path', ); assert.equal( fileList[1].split('\\').join('/'), 'retrieve/testInstance/testBU/automation/testExisting_automation.automation-doc.md', - 'wrong MD path' + 'wrong MD path', ); return; }); @@ -701,12 +713,12 @@ describe('type: automation', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_automation', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); return; }); @@ -717,12 +729,12 @@ describe('type: automation', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_automation', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); return; }); @@ -735,7 +747,7 @@ describe('type: automation', () => { assert.equal( Object.keys(executedKeys).length, 0, - 'automation was not supposed to be executed' + 'automation was not supposed to be executed', ); return; }); @@ -750,12 +762,12 @@ describe('type: automation', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_automation', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); return; }); @@ -766,12 +778,12 @@ describe('type: automation', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_automation', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); return; }); @@ -784,7 +796,7 @@ describe('type: automation', () => { assert.equal( Object.keys(executedKeys).length, 0, - 'automation was not supposed to be executed' + 'automation was not supposed to be executed', ); return; }); @@ -796,12 +808,12 @@ describe('type: automation', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'automation was supposed to be executed' + 'automation was supposed to be executed', ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_automation', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); return; }); @@ -812,12 +824,12 @@ describe('type: automation', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'automation was supposed to be executed' + 'automation was supposed to be executed', ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_automation', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); return; @@ -831,7 +843,7 @@ describe('type: automation', () => { assert.equal( Object.keys(executedKeys).length, 0, - 'automation was not supposed to be executed' + 'automation was not supposed to be executed', ); return; @@ -846,12 +858,12 @@ describe('type: automation', () => { assert.equal( pausedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( pausedKeys['testInstance/testBU'][0], 'testExisting_automation_pause', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); return; }); @@ -862,12 +874,12 @@ describe('type: automation', () => { assert.equal( pausedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( pausedKeys['testInstance/testBU'][0], 'testExisting_automation_pause', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); return; }); @@ -880,7 +892,7 @@ describe('type: automation', () => { assert.equal( Object.keys(pausedKeys).length, 0, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); return; }); diff --git a/test/type.dataExtension.test.js b/test/type.dataExtension.test.js index 55a116c07..04d593717 100644 --- a/test/type.dataExtension.test.js +++ b/test/type.dataExtension.test.js @@ -24,25 +24,25 @@ describe('type: dataExtension', () => { assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 1, - 'only one dataExtension expected' + 'only one dataExtension expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_dataExtension', 'dataExtension'), await testUtils.getExpectedJson('9999999', 'dataExtension', 'retrieve'), - 'returned metadata was not equal expected' + 'returned metadata was not equal expected', ); // check if MD file was created and equals expectations expect( - file(testUtils.getActualDoc('testExisting_dataExtension', 'dataExtension')) + file(testUtils.getActualDoc('testExisting_dataExtension', 'dataExtension')), ).to.equal( - file(testUtils.getExpectedFile('9999999', 'dataExtension', 'retrieve', 'md')) + file(testUtils.getExpectedFile('9999999', 'dataExtension', 'retrieve', 'md')), ); assert.equal( testUtils.getAPIHistoryLength(), 5, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -56,17 +56,17 @@ describe('type: dataExtension', () => { assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 1, - 'only one dataExtension expected' + 'only one dataExtension expected', ); assert.deepEqual( await testUtils.getActualJson( 'testExisting_dataExtensionShared', 'dataExtension', - '_ParentBU_' + '_ParentBU_', ), await testUtils.getExpectedJson('1111111', 'dataExtension', 'retrieve'), - 'returned metadata was not equal expected' + 'returned metadata was not equal expected', ); // check if MD file was created and equals expectations expect( @@ -74,17 +74,17 @@ describe('type: dataExtension', () => { testUtils.getActualDoc( 'testExisting_dataExtensionShared', 'dataExtension', - '_ParentBU_' - ) - ) + '_ParentBU_', + ), + ), ).to.equal( - file(testUtils.getExpectedFile('1111111', 'dataExtension', 'retrieve', 'md')) + file(testUtils.getExpectedFile('1111111', 'dataExtension', 'retrieve', 'md')), ); assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -104,7 +104,7 @@ describe('type: dataExtension', () => { ? Object.keys(deployResult['testInstance/testBU']?.dataExtension).length : 0, 2, - 'two dataExtensions to be deployed' + 'two dataExtensions to be deployed', ); // get results from cache @@ -112,24 +112,24 @@ describe('type: dataExtension', () => { assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 3, - 'three dataExtensions expected' + 'three dataExtensions expected', ); // insert assert.deepEqual( await testUtils.getActualJson('testNew_dataExtension', 'dataExtension'), await testUtils.getExpectedJson('9999999', 'dataExtension', 'create'), - 'returned metadata was not equal expected for create' + 'returned metadata was not equal expected for create', ); // update assert.deepEqual( await testUtils.getActualJson('testExisting_dataExtension', 'dataExtension'), await testUtils.getExpectedJson('9999999', 'dataExtension', 'update'), - 'returned metadata was not equal expected for update' + 'returned metadata was not equal expected for update', ); assert.equal( testUtils.getAPIHistoryLength(), 11, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -144,7 +144,7 @@ describe('type: dataExtension', () => { ? Object.keys(deployResult['testInstance/_ParentBU_']?.dataExtension).length : 0, 2, - 'two dataExtensions to be deployed' + 'two dataExtensions to be deployed', ); // get results from cache @@ -152,32 +152,32 @@ describe('type: dataExtension', () => { assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 2, - 'two dataExtensions expected' + 'two dataExtensions expected', ); // insert assert.deepEqual( await testUtils.getActualJson( 'testNew_dataExtensionShared', 'dataExtension', - '_ParentBU_' + '_ParentBU_', ), await testUtils.getExpectedJson('1111111', 'dataExtension', 'create'), - 'returned metadata was not equal expected for create' + 'returned metadata was not equal expected for create', ); // update assert.deepEqual( await testUtils.getActualJson( 'testExisting_dataExtensionShared', 'dataExtension', - '_ParentBU_' + '_ParentBU_', ), await testUtils.getExpectedJson('1111111', 'dataExtension', 'update'), - 'returned metadata was not equal expected for update' + 'returned metadata was not equal expected for update', ); assert.equal( testUtils.getAPIHistoryLength(), 8, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -194,7 +194,7 @@ describe('type: dataExtension', () => { ? Object.keys(deployResult['testInstance/_ParentBU_']?.dataExtension).length : 0, 2, - 'two dataExtensions to be deployed' + 'two dataExtensions to be deployed', ); // get results from cache @@ -202,32 +202,32 @@ describe('type: dataExtension', () => { assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 2, - 'two dataExtensions expected' + 'two dataExtensions expected', ); // insert assert.deepEqual( await testUtils.getActualJson( 'testNew_dataExtensionShared', 'dataExtension', - '_ParentBU_' + '_ParentBU_', ), await testUtils.getExpectedJson('1111111', 'dataExtension', 'create'), - 'returned metadata was not equal expected for create' + 'returned metadata was not equal expected for create', ); // update assert.deepEqual( await testUtils.getActualJson( 'testExisting_dataExtensionShared', 'dataExtension', - '_ParentBU_' + '_ParentBU_', ), await testUtils.getExpectedJson('1111111', 'dataExtension', 'update'), - 'returned metadata was not equal expected for update' + 'returned metadata was not equal expected for update', ); assert.equal( testUtils.getAPIHistoryLength(), 12, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -239,49 +239,49 @@ describe('type: dataExtension', () => { 'testInstance/testBU', 'dataExtension', ['testExisting_dataExtension'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal( process.exitCode, false, - 'retrieveAsTemplate should not have thrown an error' + 'retrieveAsTemplate should not have thrown an error', ); // WHEN assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 1, - 'only one dataExtension expected' + 'only one dataExtension expected', ); assert.deepEqual( await testUtils.getActualTemplateJson( 'testExisting_dataExtension', - 'dataExtension' + 'dataExtension', ), await testUtils.getExpectedJson('9999999', 'dataExtension', 'template'), - 'returned template was not equal expected' + 'returned template was not equal expected', ); // THEN await handler.buildDefinition( 'testInstance/testBU', 'dataExtension', 'testExisting_dataExtension', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_dataExtension', 'dataExtension'), await testUtils.getExpectedJson('9999999', 'dataExtension', 'build'), - 'returned deployment file was not equal expected' + 'returned deployment file was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 5, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -293,45 +293,45 @@ describe('type: dataExtension', () => { 'testInstance/testBU', 'dataExtension', ['testExisting_dataExtension'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); // WHEN assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 1, - 'only one dataExtension expected' + 'only one dataExtension expected', ); assert.deepEqual( await testUtils.getActualTemplateJson( 'testExisting_dataExtension', - 'dataExtension' + 'dataExtension', ), await testUtils.getExpectedJson('9999999', 'dataExtension', 'template'), - 'returned template was not equal expected' + 'returned template was not equal expected', ); // THEN await handler.buildDefinition( 'testInstance/testBU', 'dataExtension', 'testExisting_dataExtension', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_dataExtension', 'dataExtension'), await testUtils.getExpectedJson('9999999', 'dataExtension', 'build'), - 'returned deployment file was not equal expected' + 'returned deployment file was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 5, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -342,7 +342,7 @@ describe('type: dataExtension', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'dataExtension', - 'testExisting_dataExtension' + 'testExisting_dataExtension', ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); @@ -355,7 +355,7 @@ describe('type: dataExtension', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'dataExtensionField', - 'testExisting_dataExtension.LastName' + 'testExisting_dataExtension.LastName', ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); @@ -370,25 +370,25 @@ describe('type: dataExtension', () => { const fileList = await handler.getFilesToCommit( 'testInstance/testBU', 'dataExtension', - ['testExisting_dataExtension'] + ['testExisting_dataExtension'], ); // THEN assert.equal( process.exitCode, false, - 'getFilesToCommit should not have thrown an error' + 'getFilesToCommit should not have thrown an error', ); assert.equal(fileList.length, 2, 'expected only 2 file paths (json, md)'); assert.equal( fileList[0].split('\\').join('/'), 'retrieve/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-meta.json', - 'wrong JSON path' + 'wrong JSON path', ); assert.equal( fileList[1].split('\\').join('/'), 'retrieve/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-doc.md', - 'wrong MD path' + 'wrong MD path', ); return; }); diff --git a/test/type.dataExtract.test.js b/test/type.dataExtract.test.js index 12cde0fb5..8f6b7c6f2 100644 --- a/test/type.dataExtract.test.js +++ b/test/type.dataExtract.test.js @@ -24,17 +24,17 @@ describe('type: dataExtract', () => { assert.equal( result.dataExtract ? Object.keys(result.dataExtract).length : 0, 1, - 'only one dataExtract expected' + 'only one dataExtract expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'get'), - 'returned JSON was not equal expected' + 'returned JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -54,25 +54,25 @@ describe('type: dataExtract', () => { assert.equal( result.dataExtract ? Object.keys(result.dataExtract).length : 0, 2, - 'two dataExtracts expected' + 'two dataExtracts expected', ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'post'), - 'returned new-JSON was not equal expected for insert dataExtract' + 'returned new-JSON was not equal expected for insert dataExtract', ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'patch'), - 'returned existing-JSON was not equal expected for update dataExtract' + 'returned existing-JSON was not equal expected for update dataExtract', ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 8, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -85,40 +85,40 @@ describe('type: dataExtract', () => { 'testInstance/testBU', 'dataExtract', ['testExisting_dataExtract'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.dataExtract ? Object.keys(result.dataExtract).length : 0, 1, - 'only one dataExtract expected' + 'only one dataExtract expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'dataExtract', 'testExisting_dataExtract', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -130,40 +130,40 @@ describe('type: dataExtract', () => { 'testInstance/testBU', 'dataExtract', ['testExisting_dataExtract'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.dataExtract ? Object.keys(result.dataExtract).length : 0, 1, - 'only one dataExtract expected' + 'only one dataExtract expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'dataExtract', 'testExisting_dataExtract', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -174,18 +174,18 @@ describe('type: dataExtract', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'dataExtract', - 'testExisting_fileTranfer' + 'testExisting_fileTranfer', ); // THEN assert.equal( process.exitCode, 1, - 'deleteByKey should have thrown an error due to lack of support' + 'deleteByKey should have thrown an error due to lack of support', ); assert.equal( isDeleted, false, - 'deleteByKey should have returned false due to lack of support' + 'deleteByKey should have returned false due to lack of support', ); return; }); diff --git a/test/type.fileTransfer.test.js b/test/type.fileTransfer.test.js index 1bb0f10e0..14db1d6dc 100644 --- a/test/type.fileTransfer.test.js +++ b/test/type.fileTransfer.test.js @@ -24,17 +24,17 @@ describe('type: fileTransfer', () => { assert.equal( result.fileTransfer ? Object.keys(result.fileTransfer).length : 0, 1, - 'only one fileTransfer expected' + 'only one fileTransfer expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'get'), - 'returned JSON was not equal expected' + 'returned JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -53,25 +53,25 @@ describe('type: fileTransfer', () => { assert.equal( result.fileTransfer ? Object.keys(result.fileTransfer).length : 0, 2, - 'two fileTransfers expected' + 'two fileTransfers expected', ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'post'), - 'returned JSON was not equal expected for insert fileTransfer' + 'returned JSON was not equal expected for insert fileTransfer', ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'patch'), - 'returned JSON was not equal expected for update fileTransfer' + 'returned JSON was not equal expected for update fileTransfer', ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 5, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -83,40 +83,40 @@ describe('type: fileTransfer', () => { 'testInstance/testBU', 'fileTransfer', ['testExisting_fileTransfer'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.fileTransfer ? Object.keys(result.fileTransfer).length : 0, 1, - 'only one fileTransfer expected' + 'only one fileTransfer expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'fileTransfer', 'testExisting_fileTransfer', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -128,40 +128,40 @@ describe('type: fileTransfer', () => { 'testInstance/testBU', 'fileTransfer', ['testExisting_fileTransfer'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.fileTransfer ? Object.keys(result.fileTransfer).length : 0, 1, - 'only one fileTransfer expected' + 'only one fileTransfer expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'fileTransfer', 'testExisting_fileTransfer', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -172,18 +172,18 @@ describe('type: fileTransfer', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'fileTransfer', - 'testExisting_fileTranfer' + 'testExisting_fileTranfer', ); // THEN assert.equal( process.exitCode, 1, - 'deleteByKey should have thrown an error due to lack of support' + 'deleteByKey should have thrown an error due to lack of support', ); assert.equal( isDeleted, false, - 'deleteByKey should have returned false due to lack of support' + 'deleteByKey should have returned false due to lack of support', ); return; }); diff --git a/test/type.importFile.test.js b/test/type.importFile.test.js index 06ca6c009..dd52a9acb 100644 --- a/test/type.importFile.test.js +++ b/test/type.importFile.test.js @@ -24,17 +24,17 @@ describe('type: importFile', () => { assert.equal( result.importFile ? Object.keys(result.importFile).length : 0, 1, - 'only one importFile expected' + 'only one importFile expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'get'), - 'returned JSON was not equal expected' + 'returned JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 10, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -54,25 +54,25 @@ describe('type: importFile', () => { assert.equal( result.importFile ? Object.keys(result.importFile).length : 0, 2, - 'two importFiles expected' + 'two importFiles expected', ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'post'), - 'returned new-JSON was not equal expected for insert importFile' + 'returned new-JSON was not equal expected for insert importFile', ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'patch'), - 'returned existing-JSON was not equal expected for update importFile' + 'returned existing-JSON was not equal expected for update importFile', ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 12, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -84,40 +84,40 @@ describe('type: importFile', () => { 'testInstance/testBU', 'importFile', ['testExisting_importFile'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.importFile ? Object.keys(result.importFile).length : 0, 1, - 'only one importFile expected' + 'only one importFile expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'importFile', 'testExisting_importFile', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 10, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -129,40 +129,40 @@ describe('type: importFile', () => { 'testInstance/testBU', 'importFile', ['testExisting_importFile'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.importFile ? Object.keys(result.importFile).length : 0, 1, - 'only one importFile expected' + 'only one importFile expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'importFile', 'testExisting_importFile', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 10, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -173,18 +173,18 @@ describe('type: importFile', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'importFile', - 'testExisting_fileTranfer' + 'testExisting_fileTranfer', ); // THEN assert.equal( process.exitCode, 1, - 'deleteByKey should have thrown an error due to lack of support' + 'deleteByKey should have thrown an error due to lack of support', ); assert.equal( isDeleted, false, - 'deleteByKey should have returned false due to lack of support' + 'deleteByKey should have returned false due to lack of support', ); return; }); diff --git a/test/type.journey.test.js b/test/type.journey.test.js index aaf43e923..351f59b59 100644 --- a/test/type.journey.test.js +++ b/test/type.journey.test.js @@ -24,17 +24,17 @@ describe('type: journey', () => { assert.equal( result.journey ? Object.keys(result.journey).length : 0, 2, - 'only 2 journeys expected' + 'only 2 journeys expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_interaction', 'journey'), await testUtils.getExpectedJson('9999999', 'journey', 'get'), - 'returned JSON was not equal expected' + 'returned JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 13, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -53,27 +53,27 @@ describe('type: journey', () => { assert.equal( result.journey ? Object.keys(result.journey).length : 0, 3, - '3 journeys expected' + '3 journeys expected', ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_interaction', 'journey'), await testUtils.getExpectedJson('9999999', 'journey', 'post'), - 'returned JSON was not equal expected for insert journey' + 'returned JSON was not equal expected for insert journey', ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_interaction', 'journey'), await testUtils.getExpectedJson('9999999', 'journey', 'put'), // watch out - journey api wants put instead of patch for updates - 'returned JSON was not equal expected for update journey' + 'returned JSON was not equal expected for update journey', ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 11, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -85,7 +85,7 @@ describe('type: journey', () => { assert.equal( process.exitCode, 1, - 'deploy should have thrown an error due to lack of support' + 'deploy should have thrown an error due to lack of support', ); return; }); @@ -99,18 +99,18 @@ describe('type: journey', () => { 'testInstance/testBU', 'journey', ['testExisting_interaction'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.journey ? Object.keys(result.journey).length : 0, 1, - 'only one journey expected' + 'only one journey expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_interaction', 'journey'), await testUtils.getExpectedJson('9999999', 'journey', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); // buildDefinition @@ -118,23 +118,23 @@ describe('type: journey', () => { 'testInstance/testBU', 'journey', 'testExisting_interaction', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_interaction', 'journey'), await testUtils.getExpectedJson('9999999', 'journey', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 13, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -145,7 +145,7 @@ describe('type: journey', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'journey', - 'testExisting_interaction' + 'testExisting_interaction', ); // THEN assert.equal(process.exitCode, true, 'delete should have thrown an error'); @@ -158,7 +158,7 @@ describe('type: journey', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'journey', - 'testExisting_interaction/2' + 'testExisting_interaction/2', ); // THEN assert.equal(process.exitCode, true, 'delete should have thrown an error'); @@ -171,7 +171,7 @@ describe('type: journey', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'journey', - 'testExisting_interaction/1' + 'testExisting_interaction/1', ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); diff --git a/test/type.mobileKeyword.test.js b/test/type.mobileKeyword.test.js index 7ecb99b89..fe64f758c 100644 --- a/test/type.mobileKeyword.test.js +++ b/test/type.mobileKeyword.test.js @@ -25,29 +25,29 @@ describe('type: mobileKeyword', () => { assert.equal( result.mobileKeyword ? Object.keys(result.mobileKeyword).length : 0, 1, - 'only 1 mobileKeywords expected' + 'only 1 mobileKeywords expected', ); assert.deepEqual( await testUtils.getActualJson( '4912312345678.TESTEXISTING_KEYWORD', - 'mobileKeyword' + 'mobileKeyword', ), await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'get'), - 'saved JSON was not equal expected' + 'saved JSON was not equal expected', ); expect( file( testUtils.getActualFile( '4912312345678.TESTEXISTING_KEYWORD', 'mobileKeyword', - 'amp' - ) - ) + 'amp', + ), + ), ).to.equal(file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'get', 'amp'))); assert.equal( testUtils.getAPIHistoryLength(), 2, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -61,7 +61,7 @@ describe('type: mobileKeyword', () => { await handler.deploy( 'testInstance/testBU', ['mobileKeyword'], - ['4912312345678.TESTNEW_KEYWORD'] + ['4912312345678.TESTNEW_KEYWORD'], ); // THEN assert.equal(process.exitCode, false, 'deploy should not have thrown an error'); @@ -70,33 +70,37 @@ describe('type: mobileKeyword', () => { assert.equal( result.mobileKeyword ? Object.keys(result.mobileKeyword).length : 0, 2, - '2 mobileKeywords expected' + '2 mobileKeywords expected', ); // confirm created item assert.deepEqual( await testUtils.getActualJson('4912312345678.TESTNEW_KEYWORD', 'mobileKeyword'), await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'post-create'), - 'returned JSON was not equal expected for insert mobileKeyword' + 'returned JSON was not equal expected for insert mobileKeyword', ); expect( file( - testUtils.getActualFile('4912312345678.TESTNEW_KEYWORD', 'mobileKeyword', 'amp') - ) + testUtils.getActualFile( + '4912312345678.TESTNEW_KEYWORD', + 'mobileKeyword', + 'amp', + ), + ), ).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'post-create', 'amp')) + file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'post-create', 'amp')), ); // confirm updated item // eslint-disable-next-line no-console console.log( - 'Not testing UPDATE because the API only responds with an empty body unless there are errors in the request body' + 'Not testing UPDATE because the API only responds with an empty body unless there are errors in the request body', ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -105,7 +109,7 @@ describe('type: mobileKeyword', () => { await handler.deploy( 'testInstance/testBU', ['mobileKeyword'], - ['4912312345678.TESTNEW_KEYWORD_BLOCKED'] + ['4912312345678.TESTNEW_KEYWORD_BLOCKED'], ); // THEN assert.equal(process.exitCode, true, 'deploy should have thrown an error'); @@ -114,7 +118,7 @@ describe('type: mobileKeyword', () => { assert.equal( testUtils.getAPIHistoryLength(), 2, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -126,42 +130,42 @@ describe('type: mobileKeyword', () => { 'testInstance/testBU', 'mobileKeyword', ['4912312345678.TESTEXISTING_KEYWORD'], - 'testSourceMarket' + 'testSourceMarket', ); // WHEN assert.equal( process.exitCode, false, - 'retrieveAsTemplate should not have thrown an error' + 'retrieveAsTemplate should not have thrown an error', ); assert.equal( result.mobileKeyword ? Object.keys(result.mobileKeyword).length : 0, 1, - 'only one item expected' + 'only one item expected', ); assert.deepEqual( await testUtils.getActualTemplateJson( '4912312345678.TESTEXISTING_KEYWORD', - 'mobileKeyword' + 'mobileKeyword', ), await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); expect( file( testUtils.getActualTemplateFile( '4912312345678.TESTEXISTING_KEYWORD', 'mobileKeyword', - 'amp' - ) - ) + 'amp', + ), + ), ).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'template', 'amp')) + file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'template', 'amp')), ); assert.equal( testUtils.getAPIHistoryLength(), 2, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -173,33 +177,33 @@ describe('type: mobileKeyword', () => { 'testInstance/testBU', 'mobileKeyword', ['4912312345678.TESTEXISTING_KEYWORD'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.mobileKeyword ? Object.keys(result.mobileKeyword).length : 0, 1, - 'only one mobileKeyword expected' + 'only one mobileKeyword expected', ); assert.deepEqual( await testUtils.getActualTemplateJson( '4912312345678.TESTEXISTING_KEYWORD', - 'mobileKeyword' + 'mobileKeyword', ), await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); expect( file( testUtils.getActualTemplateFile( '4912312345678.TESTEXISTING_KEYWORD', 'mobileKeyword', - 'amp' - ) - ) + 'amp', + ), + ), ).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'template', 'amp')) + file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'template', 'amp')), ); // buildDefinition @@ -207,35 +211,35 @@ describe('type: mobileKeyword', () => { 'testInstance/testBU', 'mobileKeyword', '4912312345678.TESTEXISTING_KEYWORD', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson( '4912312345678.TESTTEMPLATED_KEYWORD', - 'mobileKeyword' + 'mobileKeyword', ), await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); expect( file( testUtils.getActualDeployFile( '4912312345678.TESTTEMPLATED_KEYWORD', 'mobileKeyword', - 'amp' - ) - ) + 'amp', + ), + ), ).to.equal(file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'build', 'amp'))); assert.equal( testUtils.getAPIHistoryLength(), 2, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -246,7 +250,7 @@ describe('type: mobileKeyword', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'mobileKeyword', - '4912312345678.TESTEXISTING_KEYWORD' + '4912312345678.TESTEXISTING_KEYWORD', ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); @@ -261,25 +265,25 @@ describe('type: mobileKeyword', () => { const fileList = await handler.getFilesToCommit( 'testInstance/testBU', 'mobileKeyword', - ['4912312345678.TESTEXISTING_KEYWORD'] + ['4912312345678.TESTEXISTING_KEYWORD'], ); // THEN assert.equal( process.exitCode, false, - 'getFilesToCommit should not have thrown an error' + 'getFilesToCommit should not have thrown an error', ); assert.equal(fileList.length, 2, 'expected only 2 file paths'); assert.equal( fileList[0].split('\\').join('/'), 'retrieve/testInstance/testBU/mobileKeyword/4912312345678.TESTEXISTING_KEYWORD.mobileKeyword-meta.json', - 'wrong JSON path' + 'wrong JSON path', ); assert.equal( fileList[1].split('\\').join('/'), 'retrieve/testInstance/testBU/mobileKeyword/4912312345678.TESTEXISTING_KEYWORD.mobileKeyword-meta.amp', - 'wrong AMP path' + 'wrong AMP path', ); return; }); diff --git a/test/type.mobileMessage.test.js b/test/type.mobileMessage.test.js index 9e8cc1d16..ffd0e09db 100644 --- a/test/type.mobileMessage.test.js +++ b/test/type.mobileMessage.test.js @@ -25,20 +25,20 @@ describe('type: mobileMessage', () => { assert.equal( result.mobileMessage ? Object.keys(result.mobileMessage).length : 0, 1, - 'only 1 mobileMessages expected' + 'only 1 mobileMessages expected', ); assert.deepEqual( await testUtils.getActualJson('NTIzOjc4OjA', 'mobileMessage'), await testUtils.getExpectedJson('9999999', 'mobileMessage', 'get'), - 'saved JSON was not equal expected' + 'saved JSON was not equal expected', ); expect(file(testUtils.getActualFile('NTIzOjc4OjA', 'mobileMessage', 'amp'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'get', 'amp')) + file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'get', 'amp')), ); assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -57,33 +57,33 @@ describe('type: mobileMessage', () => { assert.equal( result.mobileMessage ? Object.keys(result.mobileMessage).length : 0, 2, - '2 mobileMessages expected' + '2 mobileMessages expected', ); // confirm created item assert.deepEqual( await testUtils.getActualJson('NTQ3Ojc4OjA', 'mobileMessage'), await testUtils.getExpectedJson('9999999', 'mobileMessage', 'post-create'), - 'returned JSON was not equal expected for insert mobileMessage' + 'returned JSON was not equal expected for insert mobileMessage', ); expect(file(testUtils.getActualFile('NTQ3Ojc4OjA', 'mobileMessage', 'amp'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'post-create', 'amp')) + file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'post-create', 'amp')), ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('NTIzOjc4OjA', 'mobileMessage'), await testUtils.getExpectedJson('9999999', 'mobileMessage', 'post-update'), // watch out - mobileMessage api wants put instead of patch for updates - 'returned JSON was not equal expected for update mobileMessage' + 'returned JSON was not equal expected for update mobileMessage', ); expect(file(testUtils.getActualFile('NTIzOjc4OjA', 'mobileMessage', 'amp'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'post-update', 'amp')) + file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'post-update', 'amp')), ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 8, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -95,7 +95,7 @@ describe('type: mobileMessage', () => { assert.equal( process.exitCode, 1, - 'deploy should have thrown an error due to lack of support' + 'deploy should have thrown an error due to lack of support', ); return; }); @@ -109,24 +109,24 @@ describe('type: mobileMessage', () => { 'testInstance/testBU', 'mobileMessage', ['NTIzOjc4OjA'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.mobileMessage ? Object.keys(result.mobileMessage).length : 0, 1, - 'only one mobileMessage expected' + 'only one mobileMessage expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('NTIzOjc4OjA', 'mobileMessage'), await testUtils.getExpectedJson('9999999', 'mobileMessage', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); expect( - file(testUtils.getActualTemplateFile('NTIzOjc4OjA', 'mobileMessage', 'amp')) + file(testUtils.getActualTemplateFile('NTIzOjc4OjA', 'mobileMessage', 'amp')), ).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'template', 'amp')) + file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'template', 'amp')), ); // buildDefinition @@ -134,26 +134,26 @@ describe('type: mobileMessage', () => { 'testInstance/testBU', 'mobileMessage', 'NTIzOjc4OjA', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('NTIzOjc4OjA', 'mobileMessage'), await testUtils.getExpectedJson('9999999', 'mobileMessage', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); expect( - file(testUtils.getActualDeployFile('NTIzOjc4OjA', 'mobileMessage', 'amp')) + file(testUtils.getActualDeployFile('NTIzOjc4OjA', 'mobileMessage', 'amp')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'build', 'amp'))); assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -164,7 +164,7 @@ describe('type: mobileMessage', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'mobileMessage', - 'NTIzOjc4OjA' + 'NTIzOjc4OjA', ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); @@ -179,25 +179,25 @@ describe('type: mobileMessage', () => { const fileList = await handler.getFilesToCommit( 'testInstance/testBU', 'mobileMessage', - ['NTIzOjc4OjA'] + ['NTIzOjc4OjA'], ); // THEN assert.equal( process.exitCode, false, - 'getFilesToCommit should not have thrown an error' + 'getFilesToCommit should not have thrown an error', ); assert.equal(fileList.length, 2, 'expected only 2 file paths'); assert.equal( fileList[0].split('\\').join('/'), 'retrieve/testInstance/testBU/mobileMessage/NTIzOjc4OjA.mobileMessage-meta.json', - 'wrong JSON path' + 'wrong JSON path', ); assert.equal( fileList[1].split('\\').join('/'), 'retrieve/testInstance/testBU/mobileMessage/NTIzOjc4OjA.mobileMessage-meta.amp', - 'wrong AMP path' + 'wrong AMP path', ); return; }); diff --git a/test/type.query.test.js b/test/type.query.test.js index 57c16d8f3..fc542f54f 100644 --- a/test/type.query.test.js +++ b/test/type.query.test.js @@ -25,28 +25,28 @@ describe('type: query', () => { assert.equal( result.query ? Object.keys(result.query).length : 0, 3, - 'only three queries expected' + 'only three queries expected', ); // normal test assert.deepEqual( await testUtils.getActualJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'get'), - 'returned metadata with correct key was not equal expected' + 'returned metadata with correct key was not equal expected', ); expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'query', 'get', 'sql')) + file(testUtils.getExpectedFile('9999999', 'query', 'get', 'sql')), ); // check if targetKey was overwritten assert.deepEqual( await testUtils.getActualJson('testExisting_query2', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'get2'), - 'returned metadata with wrong key was not equal expected' + 'returned metadata with wrong key was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -60,20 +60,20 @@ describe('type: query', () => { assert.equal( result.query ? Object.keys(result.query).length : 0, 1, - 'only one query expected' + 'only one query expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'get'), - 'returned metadata was not equal expected' + 'returned metadata was not equal expected', ); expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'query', 'get', 'sql')) + file(testUtils.getExpectedFile('9999999', 'query', 'get', 'sql')), ); assert.equal( testUtils.getAPIHistoryLength(), 7, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -88,22 +88,22 @@ describe('type: query', () => { assert.equal( result.query ? Object.keys(result.query).length : 0, 3, - 'three queries in cache expected' + 'three queries in cache expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'get'), - 'returned metadata was not equal expected' + 'returned metadata was not equal expected', ); expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'query', 'get', 'sql')) + file(testUtils.getExpectedFile('9999999', 'query', 'get', 'sql')), ); expect(file(testUtils.getActualFile('testExisting_query2', 'query', 'sql'))).to.not .exist; assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -118,7 +118,7 @@ describe('type: query', () => { assert.equal( result.query ? Object.keys(result.query).length : 0, 3, - 'three queries in cache expected' + 'three queries in cache expected', ); expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.not @@ -128,7 +128,7 @@ describe('type: query', () => { assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -142,7 +142,7 @@ describe('type: query', () => { const resultDeploy = await handler.deploy( 'testInstance/testBU', ['query'], - ['testNew_query', 'testExisting_query'] + ['testNew_query', 'testExisting_query'], ); // THEN assert.equal(process.exitCode, false, 'deploy should not have thrown an error'); @@ -151,38 +151,38 @@ describe('type: query', () => { ? Object.keys(resultDeploy['testInstance/testBU']?.query).length : 0, 2, - 'two queries to be deployed' + 'two queries to be deployed', ); // get results from cache const result = cache.getCache(); assert.equal( result.query ? Object.keys(result.query).length : 0, 4, - 'four queries expected in cache' + 'four queries expected in cache', ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'post'), - 'returned metadata was not equal expected for insert query' + 'returned metadata was not equal expected for insert query', ); expect(file(testUtils.getActualFile('testNew_query', 'query', 'sql'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'query', 'post', 'sql')) + file(testUtils.getExpectedFile('9999999', 'query', 'post', 'sql')), ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch'), - 'returned metadata was not equal expected for insert query' + 'returned metadata was not equal expected for insert query', ); expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'query', 'patch', 'sql')) + file(testUtils.getExpectedFile('9999999', 'query', 'patch', 'sql')), ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 8, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -192,28 +192,28 @@ describe('type: query', () => { await handler.deploy( 'testInstance/testBU', ['query'], - ['testExisting_query', 'testNew_query'] + ['testExisting_query', 'testNew_query'], ); // THEN assert.equal( process.exitCode, false, - 'deploy with --execute should not have thrown an error' + 'deploy with --execute should not have thrown an error', ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch'), - 'returned metadata was not equal expected for insert query' + 'returned metadata was not equal expected for insert query', ); expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'query', 'patch', 'sql')) + file(testUtils.getExpectedFile('9999999', 'query', 'patch', 'sql')), ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 12, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -227,7 +227,7 @@ describe('type: query', () => { await handler.retrieve( 'testInstance/testBU', ['query'], - ['testExisting_query_fixKeys'] + ['testExisting_query_fixKeys'], ); handler.setOptions({ changeKeyValue: 'testExisting_query_fixedKeys', @@ -236,39 +236,39 @@ describe('type: query', () => { const deployed = await handler.deploy( 'testInstance/testBU', ['query'], - ['testExisting_query_fixKeys'] + ['testExisting_query_fixKeys'], ); // THEN assert.equal( process.exitCode, false, - 'deploy --changeKeyValue should not have thrown an error' + 'deploy --changeKeyValue should not have thrown an error', ); assert.equal( Object.keys(deployed['testInstance/testBU'].query).length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( Object.keys(deployed['testInstance/testBU'].query)[0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query' + 'returned metadata was not equal expected for update query', ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 14, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -277,44 +277,44 @@ describe('type: query', () => { await handler.retrieve( 'testInstance/testBU', ['query'], - ['testExisting_query_fixKeys'] + ['testExisting_query_fixKeys'], ); handler.setOptions({ changeKeyField: 'name', fromRetrieve: true }); const deployed = await handler.deploy( 'testInstance/testBU', ['query'], - ['testExisting_query_fixKeys'] + ['testExisting_query_fixKeys'], ); // THEN assert.equal( process.exitCode, false, - 'deploy --changeKeyValue should not have thrown an error' + 'deploy --changeKeyValue should not have thrown an error', ); assert.equal( Object.keys(deployed['testInstance/testBU'].query).length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( Object.keys(deployed['testInstance/testBU'].query)[0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query' + 'returned metadata was not equal expected for update query', ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 14, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -330,7 +330,7 @@ describe('type: query', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 0, - 'expected to find no keys to be fixed' + 'expected to find no keys to be fixed', ); // get results from cache @@ -338,13 +338,13 @@ describe('type: query', () => { assert.equal( result.query ? Object.keys(result.query).length : 0, 1, - 'one query expected' + 'one query expected', ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 7, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -358,12 +358,12 @@ describe('type: query', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -371,16 +371,16 @@ describe('type: query', () => { assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query' + 'returned metadata was not equal expected for update query', ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 16, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -394,33 +394,33 @@ describe('type: query', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); // THEN assert.equal( process.exitCode, false, - 'fixKeys with --execute should not have thrown an error' + 'fixKeys with --execute should not have thrown an error', ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query' + 'returned metadata was not equal expected for update query', ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 18, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -434,12 +434,12 @@ describe('type: query', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -447,16 +447,16 @@ describe('type: query', () => { assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query' + 'returned metadata was not equal expected for update query', ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 34, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -470,33 +470,33 @@ describe('type: query', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); // THEN assert.equal( process.exitCode, false, - 'fixKeys with --execute should not have thrown an error' + 'fixKeys with --execute should not have thrown an error', ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query' + 'returned metadata was not equal expected for update query', ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 36, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -510,12 +510,12 @@ describe('type: query', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -523,16 +523,16 @@ describe('type: query', () => { assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query' + 'returned metadata was not equal expected for update query', ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 13, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -544,53 +544,53 @@ describe('type: query', () => { 'testInstance/testBU', 'query', ['testExisting_query'], - 'testSourceMarket' + 'testSourceMarket', ); // WHEN assert.equal( process.exitCode, false, - 'retrieveAsTemplate should not have thrown an error' + 'retrieveAsTemplate should not have thrown an error', ); assert.equal( result.query ? Object.keys(result.query).length : 0, 1, - 'only one query expected' + 'only one query expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'template'), - 'returned template JSON of retrieveAsTemplate was not equal expected' + 'returned template JSON of retrieveAsTemplate was not equal expected', ); expect( - file(testUtils.getActualTemplateFile('testExisting_query', 'query', 'sql')) + file(testUtils.getActualTemplateFile('testExisting_query', 'query', 'sql')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'template', 'sql'))); // THEN await handler.buildDefinition( 'testInstance/testBU', 'query', 'testExisting_query', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); expect( - file(testUtils.getActualDeployFile('testTemplated_query', 'query', 'sql')) + file(testUtils.getActualDeployFile('testTemplated_query', 'query', 'sql')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'build', 'sql'))); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -602,7 +602,7 @@ describe('type: query', () => { 'testInstance/testBU', 'query', ['testExisting_query'], - 'testSourceMarket' + 'testSourceMarket', ); // WHEN assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); @@ -610,42 +610,42 @@ describe('type: query', () => { assert.equal( result.query ? Object.keys(result.query).length : 0, 1, - 'only one query expected' + 'only one query expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'template'), - 'returned template JSON of buildTemplate was not equal expected' + 'returned template JSON of buildTemplate was not equal expected', ); expect( - file(testUtils.getActualTemplateFile('testExisting_query', 'query', 'sql')) + file(testUtils.getActualTemplateFile('testExisting_query', 'query', 'sql')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'template', 'sql'))); // THEN await handler.buildDefinition( 'testInstance/testBU', 'query', 'testExisting_query', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); expect( - file(testUtils.getActualDeployFile('testTemplated_query', 'query', 'sql')) + file(testUtils.getActualDeployFile('testTemplated_query', 'query', 'sql')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'build', 'sql'))); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -656,7 +656,7 @@ describe('type: query', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'query', - 'testExisting_query' + 'testExisting_query', ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); @@ -675,19 +675,19 @@ describe('type: query', () => { assert.equal( process.exitCode, false, - 'getFilesToCommit should not have thrown an error' + 'getFilesToCommit should not have thrown an error', ); assert.equal(fileList.length, 2, 'expected only 2 file paths'); assert.equal( fileList[0].split('\\').join('/'), 'retrieve/testInstance/testBU/query/testExisting_query.query-meta.json', - 'wrong JSON path' + 'wrong JSON path', ); assert.equal( fileList[1].split('\\').join('/'), 'retrieve/testInstance/testBU/query/testExisting_query.query-meta.sql', - 'wrong JSON path' + 'wrong JSON path', ); return; }); @@ -701,12 +701,12 @@ describe('type: query', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_query', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); return; }); @@ -717,12 +717,12 @@ describe('type: query', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys' + 'returned number of keys does not correspond to number of expected fixed keys', ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_query', - 'returned keys do not correspond to expected fixed keys' + 'returned keys do not correspond to expected fixed keys', ); return; }); @@ -735,7 +735,7 @@ describe('type: query', () => { assert.equal( Object.keys(executedKeys).length, 0, - 'query was not supposed to be executed' + 'query was not supposed to be executed', ); return; }); diff --git a/test/type.script.test.js b/test/type.script.test.js index d50fda9a1..e4ba85b63 100644 --- a/test/type.script.test.js +++ b/test/type.script.test.js @@ -27,7 +27,7 @@ describe('type: script', () => { ? Object.keys(retrieve['testInstance/testBU'].script).length : 0, 2, - 'only 2 scripts expected in retrieve response' + 'only 2 scripts expected in retrieve response', ); // get results from cache @@ -35,38 +35,38 @@ describe('type: script', () => { assert.equal( result.script ? Object.keys(result.script).length : 0, 2, - 'only 2 scripts expected' + 'only 2 scripts expected', ); // normal test assert.deepEqual( await testUtils.getActualJson('testExisting_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'get'), - 'returned metadata with correct key was not equal expected' + 'returned metadata with correct key was not equal expected', ); expect(file(testUtils.getActualFile('testExisting_script', 'script', 'html'))).to.not .exist; expect(file(testUtils.getActualFile('testExisting_script', 'script', 'ssjs'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'script', 'get', 'ssjs')) + file(testUtils.getExpectedFile('9999999', 'script', 'get', 'ssjs')), ); assert.deepEqual( await testUtils.getActualJson('testExisting_script_noScriptTag', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'get_noScriptTag'), - 'returned metadata was not equal expected' + 'returned metadata was not equal expected', ); expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'html')) + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'html')), ).to.equal( - file(testUtils.getExpectedFile('9999999', 'script', 'get_noScriptTag', 'html')) + file(testUtils.getExpectedFile('9999999', 'script', 'get_noScriptTag', 'html')), ); expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'ssjs')) + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'ssjs')), ).to.not.exist; assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -80,33 +80,33 @@ describe('type: script', () => { assert.equal( result.script ? Object.keys(result.script).length : 0, 1, - 'only one script expected' + 'only one script expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'get'), - 'returned metadata was not equal expected' + 'returned metadata was not equal expected', ); expect(file(testUtils.getActualFile('testExisting_script', 'script', 'html'))).to.not .exist; expect(file(testUtils.getActualFile('testExisting_script', 'script', 'ssjs'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'script', 'get', 'ssjs')) + file(testUtils.getExpectedFile('9999999', 'script', 'get', 'ssjs')), ); expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'json')) + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'json')), ).to.not.exist; expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'ssjs')) + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'ssjs')), ).to.not.exist; expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'html')) + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'html')), ).to.not.exist; assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -123,31 +123,31 @@ describe('type: script', () => { assert.equal( result.script ? Object.keys(result.script).length : 0, 2, - 'two scripts in cache expected' + 'two scripts in cache expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'get'), - 'returned metadata was not equal expected' + 'returned metadata was not equal expected', ); expect(file(testUtils.getActualFile('testExisting_script', 'script', 'ssjs'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'script', 'get', 'ssjs')) + file(testUtils.getExpectedFile('9999999', 'script', 'get', 'ssjs')), ); expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'json')) + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'json')), ).to.not.exist; expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'ssjs')) + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'ssjs')), ).to.not.exist; expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'html')) + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'html')), ).to.not.exist; assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -163,7 +163,7 @@ describe('type: script', () => { assert.equal( result.script ? Object.keys(result.script).length : 0, 2, - 'two scripts in cache expected' + 'two scripts in cache expected', ); expect(file(testUtils.getActualFile('testExisting_script', 'script', 'ssjs'))).to.not @@ -171,7 +171,7 @@ describe('type: script', () => { assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -190,31 +190,31 @@ describe('type: script', () => { assert.equal( result.script ? Object.keys(result.script).length : 0, 3, - 'three scripts expected' + 'three scripts expected', ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'post'), - 'returned metadata was not equal expected for insert script' + 'returned metadata was not equal expected for insert script', ); expect(file(testUtils.getActualFile('testNew_script', 'script', 'ssjs'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'script', 'post', 'ssjs')) + file(testUtils.getExpectedFile('9999999', 'script', 'post', 'ssjs')), ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'patch'), - 'returned metadata was not equal expected for insert script' + 'returned metadata was not equal expected for insert script', ); expect(file(testUtils.getActualFile('testExisting_script', 'script', 'ssjs'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'script', 'patch', 'ssjs')) + file(testUtils.getExpectedFile('9999999', 'script', 'patch', 'ssjs')), ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 5, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -226,53 +226,53 @@ describe('type: script', () => { 'testInstance/testBU', 'script', ['testExisting_script'], - 'testSourceMarket' + 'testSourceMarket', ); // WHEN assert.equal( process.exitCode, false, - 'retrieveAsTemplate should not have thrown an error' + 'retrieveAsTemplate should not have thrown an error', ); assert.equal( result.script ? Object.keys(result.script).length : 0, 1, - 'only one script expected' + 'only one script expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'template'), - 'returned template JSON of retrieveAsTemplate was not equal expected' + 'returned template JSON of retrieveAsTemplate was not equal expected', ); expect( - file(testUtils.getActualTemplateFile('testExisting_script', 'script', 'ssjs')) + file(testUtils.getActualTemplateFile('testExisting_script', 'script', 'ssjs')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'script', 'template', 'ssjs'))); // THEN await handler.buildDefinition( 'testInstance/testBU', 'script', 'testExisting_script', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); expect( - file(testUtils.getActualDeployFile('testTemplated_script', 'script', 'ssjs')) + file(testUtils.getActualDeployFile('testTemplated_script', 'script', 'ssjs')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'script', 'build', 'ssjs'))); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -284,7 +284,7 @@ describe('type: script', () => { 'testInstance/testBU', 'script', ['testExisting_script'], - 'testSourceMarket' + 'testSourceMarket', ); // WHEN assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); @@ -292,42 +292,42 @@ describe('type: script', () => { assert.equal( result.script ? Object.keys(result.script).length : 0, 1, - 'only one script expected' + 'only one script expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'template'), - 'returned template JSON of buildTemplate was not equal expected' + 'returned template JSON of buildTemplate was not equal expected', ); expect( - file(testUtils.getActualTemplateFile('testExisting_script', 'script', 'ssjs')) + file(testUtils.getActualTemplateFile('testExisting_script', 'script', 'ssjs')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'script', 'template', 'ssjs'))); // THEN await handler.buildDefinition( 'testInstance/testBU', 'script', 'testExisting_script', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); expect( - file(testUtils.getActualDeployFile('testTemplated_script', 'script', 'ssjs')) + file(testUtils.getActualDeployFile('testTemplated_script', 'script', 'ssjs')), ).to.equal(file(testUtils.getExpectedFile('9999999', 'script', 'build', 'ssjs'))); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -343,24 +343,24 @@ describe('type: script', () => { assert.equal( process.exitCode, false, - 'getFilesToCommit should not have thrown an error' + 'getFilesToCommit should not have thrown an error', ); assert.equal(fileList.length, 3, 'expected only 3 file paths (html, json, ssjs)'); assert.equal( fileList[0].split('\\').join('/'), 'retrieve/testInstance/testBU/script/testExisting_script.script-meta.json', - 'wrong JSON path' + 'wrong JSON path', ); assert.equal( fileList[1].split('\\').join('/'), 'retrieve/testInstance/testBU/script/testExisting_script.script-meta.ssjs', - 'wrong SSJS path' + 'wrong SSJS path', ); assert.equal( fileList[2].split('\\').join('/'), 'retrieve/testInstance/testBU/script/testExisting_script.script-meta.html', - 'wrong HTML path' + 'wrong HTML path', ); return; }); diff --git a/test/type.transactionalEmail.test.js b/test/type.transactionalEmail.test.js index 60dff65e8..cefd8797f 100644 --- a/test/type.transactionalEmail.test.js +++ b/test/type.transactionalEmail.test.js @@ -24,17 +24,17 @@ describe('type: transactionalEmail', () => { assert.equal( result.transactionalEmail ? Object.keys(result.transactionalEmail).length : 0, 1, - 'only one transactionalEmail expected' + 'only one transactionalEmail expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_temail', 'transactionalEmail'), await testUtils.getExpectedJson('9999999', 'transactionalEmail', 'get'), - 'returned JSON was not equal expected' + 'returned JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 12, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -53,25 +53,25 @@ describe('type: transactionalEmail', () => { assert.equal( result.transactionalEmail ? Object.keys(result.transactionalEmail).length : 0, 2, - 'two transactionalEmails expected' + 'two transactionalEmails expected', ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_temail', 'transactionalEmail'), await testUtils.getExpectedJson('9999999', 'transactionalEmail', 'post'), - 'returned JSON was not equal expected for insert transactionalEmail' + 'returned JSON was not equal expected for insert transactionalEmail', ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_temail', 'transactionalEmail'), await testUtils.getExpectedJson('9999999', 'transactionalEmail', 'patch'), - 'returned JSON was not equal expected for update transactionalEmail' + 'returned JSON was not equal expected for update transactionalEmail', ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 14, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -81,13 +81,13 @@ describe('type: transactionalEmail', () => { await handler.deploy( 'testInstance/testBU', ['transactionalEmail'], - ['testExisting_temail'] + ['testExisting_temail'], ); // THEN assert.equal( process.exitCode, 1, - 'deploy should have thrown an error due to lack of support' + 'deploy should have thrown an error due to lack of support', ); return; }); @@ -102,40 +102,40 @@ describe('type: transactionalEmail', () => { 'testInstance/testBU', 'transactionalEmail', ['testExisting_temail'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.transactionalEmail ? Object.keys(result.transactionalEmail).length : 0, 1, - 'only one transactionalEmail expected' + 'only one transactionalEmail expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_temail', 'transactionalEmail'), await testUtils.getExpectedJson('9999999', 'transactionalEmail', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'transactionalEmail', 'testExisting_temail', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_temail', 'transactionalEmail'), await testUtils.getExpectedJson('9999999', 'transactionalEmail', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 12, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -146,7 +146,7 @@ describe('type: transactionalEmail', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'transactionalEmail', - 'testExisting_temail' + 'testExisting_temail', ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); diff --git a/test/type.transactionalPush.test.js b/test/type.transactionalPush.test.js index dd6e6e9ec..5b7b7ecf6 100644 --- a/test/type.transactionalPush.test.js +++ b/test/type.transactionalPush.test.js @@ -24,17 +24,17 @@ describe('type: transactionalPush', () => { assert.equal( result.transactionalPush ? Object.keys(result.transactionalPush).length : 0, 1, - 'only one transactionalPush expected' + 'only one transactionalPush expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_tpush', 'transactionalPush'), await testUtils.getExpectedJson('9999999', 'transactionalPush', 'get'), - 'returned JSON was not equal expected' + 'returned JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -53,25 +53,25 @@ describe('type: transactionalPush', () => { assert.equal( result.transactionalPush ? Object.keys(result.transactionalPush).length : 0, 2, - 'two transactionalPushs expected' + 'two transactionalPushs expected', ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_tpush', 'transactionalPush'), await testUtils.getExpectedJson('9999999', 'transactionalPush', 'post'), - 'returned JSON was not equal expected for insert transactionalPush' + 'returned JSON was not equal expected for insert transactionalPush', ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_tpush', 'transactionalPush'), await testUtils.getExpectedJson('9999999', 'transactionalPush', 'patch'), - 'returned JSON was not equal expected for update transactionalPush' + 'returned JSON was not equal expected for update transactionalPush', ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 5, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -81,13 +81,13 @@ describe('type: transactionalPush', () => { await handler.deploy( 'testInstance/testBU', ['transactionalPush'], - ['testExisting_tpush'] + ['testExisting_tpush'], ); // THEN assert.equal( process.exitCode, 1, - 'deploy should have thrown an error due to lack of support' + 'deploy should have thrown an error due to lack of support', ); return; }); @@ -102,41 +102,41 @@ describe('type: transactionalPush', () => { 'testInstance/testBU', 'transactionalPush', ['testExisting_tpush'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.transactionalPush ? Object.keys(result.transactionalPush).length : 0, 1, - 'only one transactionalPush expected' + 'only one transactionalPush expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_tpush', 'transactionalPush'), await testUtils.getExpectedJson('9999999', 'transactionalPush', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'transactionalPush', 'testExisting_tpush', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_tpush', 'transactionalPush'), await testUtils.getExpectedJson('9999999', 'transactionalPush', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); diff --git a/test/type.transactionalSMS.test.js b/test/type.transactionalSMS.test.js index 0917e7fae..5974669df 100644 --- a/test/type.transactionalSMS.test.js +++ b/test/type.transactionalSMS.test.js @@ -25,22 +25,22 @@ describe('type: transactionalSMS', () => { assert.equal( result.transactionalSMS ? Object.keys(result.transactionalSMS).length : 0, 1, - 'only one transactionalSMS expected' + 'only one transactionalSMS expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_tsms', 'transactionalSMS'), await testUtils.getExpectedJson('9999999', 'transactionalSMS', 'get'), - 'returned JSON was not equal expected' + 'returned JSON was not equal expected', ); expect( - file(testUtils.getActualFile('testExisting_tsms', 'transactionalSMS', 'amp')) + file(testUtils.getActualFile('testExisting_tsms', 'transactionalSMS', 'amp')), ).to.equal( - file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'get', 'amp')) + file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'get', 'amp')), ); assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -59,35 +59,35 @@ describe('type: transactionalSMS', () => { assert.equal( result.transactionalSMS ? Object.keys(result.transactionalSMS).length : 0, 2, - 'two transactionalSMSs expected' + 'two transactionalSMSs expected', ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_tsms', 'transactionalSMS'), await testUtils.getExpectedJson('9999999', 'transactionalSMS', 'post'), - 'returned JSON was not equal expected for insert transactionalSMS' + 'returned JSON was not equal expected for insert transactionalSMS', ); expect( - file(testUtils.getActualFile('testNew_tsms', 'transactionalSMS', 'amp')) + file(testUtils.getActualFile('testNew_tsms', 'transactionalSMS', 'amp')), ).to.equal( - file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'post', 'amp')) + file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'post', 'amp')), ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_tsms', 'transactionalSMS'), await testUtils.getExpectedJson('9999999', 'transactionalSMS', 'patch'), - 'returned JSON was not equal expected for update transactionalSMS' + 'returned JSON was not equal expected for update transactionalSMS', ); expect( - file(testUtils.getActualFile('testExisting_tsms', 'transactionalSMS', 'amp')) + file(testUtils.getActualFile('testExisting_tsms', 'transactionalSMS', 'amp')), ).to.equal( - file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'patch', 'amp')) + file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'patch', 'amp')), ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -97,13 +97,13 @@ describe('type: transactionalSMS', () => { await handler.deploy( 'testInstance/testBU', ['transactionalSMS'], - ['testExisting_tsms'] + ['testExisting_tsms'], ); // THEN assert.equal( process.exitCode, 1, - 'deploy should have thrown an error due to lack of support' + 'deploy should have thrown an error due to lack of support', ); return; }); @@ -118,54 +118,56 @@ describe('type: transactionalSMS', () => { 'testInstance/testBU', 'transactionalSMS', ['testExisting_tsms'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.transactionalSMS ? Object.keys(result.transactionalSMS).length : 0, 1, - 'only one transactionalSMS expected' + 'only one transactionalSMS expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_tsms', 'transactionalSMS'), await testUtils.getExpectedJson('9999999', 'transactionalSMS', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); expect( file( - testUtils.getActualTemplateFile('testExisting_tsms', 'transactionalSMS', 'amp') - ) + testUtils.getActualTemplateFile('testExisting_tsms', 'transactionalSMS', 'amp'), + ), ).to.equal( - file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'template', 'amp')) + file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'template', 'amp')), ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'transactionalSMS', 'testExisting_tsms', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_tsms', 'transactionalSMS'), await testUtils.getExpectedJson('9999999', 'transactionalSMS', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); expect( - file(testUtils.getActualDeployFile('testTemplated_tsms', 'transactionalSMS', 'amp')) + file( + testUtils.getActualDeployFile('testTemplated_tsms', 'transactionalSMS', 'amp'), + ), ).to.equal( - file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'build', 'amp')) + file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'build', 'amp')), ); assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); diff --git a/test/type.triggeredSend.test.js b/test/type.triggeredSend.test.js index 8d4e3a666..164c8850d 100644 --- a/test/type.triggeredSend.test.js +++ b/test/type.triggeredSend.test.js @@ -24,17 +24,17 @@ describe('type: triggeredSend', () => { assert.equal( result.triggeredSend ? Object.keys(result.triggeredSend).length : 0, 1, - 'only one triggeredSend expected' + 'only one triggeredSend expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_triggeredSend', 'triggeredSend'), await testUtils.getExpectedJson('9999999', 'triggeredSend', 'get'), - 'returned JSON was not equal expected' + 'returned JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 10, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -53,25 +53,25 @@ describe('type: triggeredSend', () => { assert.equal( result.triggeredSend ? Object.keys(result.triggeredSend).length : 0, 2, - 'two triggeredSends expected' + 'two triggeredSends expected', ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_triggeredSend', 'triggeredSend'), await testUtils.getExpectedJson('9999999', 'triggeredSend', 'post'), - 'returned JSON was not equal expected for insert triggeredSend' + 'returned JSON was not equal expected for insert triggeredSend', ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_triggeredSend', 'triggeredSend'), await testUtils.getExpectedJson('9999999', 'triggeredSend', 'patch'), - 'returned JSON was not equal expected for update triggeredSend' + 'returned JSON was not equal expected for update triggeredSend', ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 12, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -85,43 +85,43 @@ describe('type: triggeredSend', () => { 'testInstance/testBU', 'triggeredSend', ['testExisting_triggeredSend'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.triggeredSend ? Object.keys(result.triggeredSend).length : 0, 1, - 'only one triggeredSend expected' + 'only one triggeredSend expected', ); assert.deepEqual( await testUtils.getActualTemplateJson( 'testExisting_triggeredSend', - 'triggeredSend' + 'triggeredSend', ), await testUtils.getExpectedJson('9999999', 'triggeredSend', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'triggeredSend', 'testExisting_triggeredSend', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_triggeredSend', 'triggeredSend'), await testUtils.getExpectedJson('9999999', 'triggeredSend', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 10, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -132,7 +132,7 @@ describe('type: triggeredSend', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'triggeredSend', - 'testExisting_triggeredSend' + 'testExisting_triggeredSend', ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); diff --git a/test/type.user.test.js b/test/type.user.test.js index 7811b21f0..b61cd1840 100644 --- a/test/type.user.test.js +++ b/test/type.user.test.js @@ -25,19 +25,19 @@ describe('type: user', () => { assert.equal( result.user ? Object.keys(result.user).length : 0, 3, - 'only three users expected' + 'only three users expected', ); assert.deepEqual( await testUtils.getActualJson('testExisting_user', 'user', '_ParentBU_'), await testUtils.getExpectedJson('1111111', 'user', 'retrieve'), - 'returned metadata was not equal expected' + 'returned metadata was not equal expected', ); // check if MD file was created and equals expectations // ! this test needs to update the lastLoginDate counter because it changes with every passing day const expectedFile = await File.readFile( testUtils.getExpectedFile('1111111', 'user', 'retrieve', 'md'), - { encoding: 'utf8' } + { encoding: 'utf8' }, ); const regexFindDaysSinceLogin = /\| (\d*) (seconds|minutes|days|weeks|months|years){1} \|/g; @@ -54,7 +54,7 @@ describe('type: user', () => { assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -70,7 +70,7 @@ describe('type: user', () => { assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -96,26 +96,26 @@ describe('type: user', () => { assert.equal( result.user ? Object.keys(result.user).length : 0, 4, - 'four users expected' + 'four users expected', ); // confirm if result.user only includes values from expectedCache assert.deepEqual( Object.keys(result.user), expectedCache, - 'returned user keys were not equal expected' + 'returned user keys were not equal expected', ); // insert assert.deepEqual( await testUtils.getActualJson('testNew_user', 'user', '_ParentBU_'), await testUtils.getExpectedJson('1111111', 'user', 'create'), - 'returned metadata was not equal expected for create' + 'returned metadata was not equal expected for create', ); // update assert.deepEqual( await testUtils.getActualJson('testExisting_user', 'user', '_ParentBU_'), await testUtils.getExpectedJson('1111111', 'user', 'update'), - 'returned metadata was not equal expected for update' + 'returned metadata was not equal expected for update', ); // because user is single-document-type we would not want to find an md file getting created by deploy. only retrieve updates it expect(file(`./docs/user/testInstance.users.md`)).to.not.exist; @@ -123,7 +123,7 @@ describe('type: user', () => { assert.equal( testUtils.getAPIHistoryLength(), 9, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -143,19 +143,19 @@ describe('type: user', () => { assert.equal( result.user ? Object.keys(result.user).length : 0, 3, - 'three users expected' + 'three users expected', ); // confirm if result.user only includes values from expectedCache assert.deepEqual( Object.keys(result.user), expectedCache, - 'returned user keys were not equal expected' + 'returned user keys were not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -170,42 +170,42 @@ describe('type: user', () => { 'testInstance/_ParentBU_', 'user', ['testExisting_user'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); // WHEN assert.equal( result.user ? Object.keys(result.user).length : 0, 1, - 'only one user expected' + 'only one user expected', ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_user', 'user'), await testUtils.getExpectedJson('1111111', 'user', 'template'), - 'returned template was not equal expected' + 'returned template was not equal expected', ); // THEN await handler.buildDefinition( 'testInstance/_ParentBU_', 'user', 'testExisting_user', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_user', 'user', '_ParentBU_'), await testUtils.getExpectedJson('1111111', 'user', 'build'), - 'returned deployment file was not equal expected' + 'returned deployment file was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); diff --git a/test/type.verification.test.js b/test/type.verification.test.js index c93a92f08..a0516ece0 100644 --- a/test/type.verification.test.js +++ b/test/type.verification.test.js @@ -24,28 +24,28 @@ describe('type: verification', () => { assert.equal( result.verification ? Object.keys(result.verification).length : 0, 1, - 'only one verification expected' + 'only one verification expected', ); assert.equal( retrieved['testInstance/testBU']?.verification ? Object.keys(retrieved['testInstance/testBU']?.verification).length : 0, 1, - 'one verifications to be retrieved' + 'one verifications to be retrieved', ); assert.deepEqual( await testUtils.getActualJson( 'testExisting_39f6a488-20eb-4ba0-b0b9', - 'verification' + 'verification', ), await testUtils.getExpectedJson('9999999', 'verification', 'get'), - 'returned JSON was not equal expected' + 'returned JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 9, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -65,35 +65,35 @@ describe('type: verification', () => { assert.equal( result.verification ? Object.keys(result.verification).length : 0, 2, - 'two verifications expected' + 'two verifications expected', ); assert.equal( deployed['testInstance/testBU']?.verification ? Object.keys(deployed['testInstance/testBU']?.verification).length : 0, 2, - 'two verifications to be deployed' + 'two verifications to be deployed', ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_RANDOM_NEW_GUID', 'verification'), await testUtils.getExpectedJson('9999999', 'verification', 'post'), - 'returned new-JSON was not equal expected for insert verification' + 'returned new-JSON was not equal expected for insert verification', ); // confirm updated item assert.deepEqual( await testUtils.getActualJson( 'testExisting_39f6a488-20eb-4ba0-b0b9', - 'verification' + 'verification', ), await testUtils.getExpectedJson('9999999', 'verification', 'patch'), - 'returned existing-JSON was not equal expected for update verification' + 'returned existing-JSON was not equal expected for update verification', ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 11, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -107,46 +107,46 @@ describe('type: verification', () => { 'testInstance/testBU', 'verification', ['testExisting_39f6a488-20eb-4ba0-b0b9'], - 'testSourceMarket' + 'testSourceMarket', ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.verification ? Object.keys(result.verification).length : 0, 1, - 'only one verification expected' + 'only one verification expected', ); assert.deepEqual( await testUtils.getActualTemplateJson( 'testExisting_39f6a488-20eb-4ba0-b0b9', - 'verification' + 'verification', ), await testUtils.getExpectedJson('9999999', 'verification', 'template'), - 'returned template JSON was not equal expected' + 'returned template JSON was not equal expected', ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'verification', 'testExisting_39f6a488-20eb-4ba0-b0b9', - 'testTargetMarket' + 'testTargetMarket', ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error' + 'buildDefinition should not have thrown an error', ); assert.deepEqual( await testUtils.getActualDeployJson( 'testTemplated_39f6a488-20eb-4ba0-b0b9', - 'verification' + 'verification', ), await testUtils.getExpectedJson('9999999', 'verification', 'build'), - 'returned deployment JSON was not equal expected' + 'returned deployment JSON was not equal expected', ); assert.equal( testUtils.getAPIHistoryLength(), 9, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', ); return; }); @@ -157,13 +157,13 @@ describe('type: verification', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'verification', - 'testExisting_39f6a488-20eb-4ba0-b0b9' + 'testExisting_39f6a488-20eb-4ba0-b0b9', ); // THEN assert.equal( process.exitCode, 0, - 'deleteByKey should have thrown an error due to lack of support' + 'deleteByKey should have thrown an error due to lack of support', ); assert.equal(isDeleted, true, 'deleteByKey should have returned true for success'); return; diff --git a/test/utils.js b/test/utils.js index f6404ee8c..301e5fa57 100644 --- a/test/utils.js +++ b/test/utils.js @@ -26,7 +26,7 @@ const authResources = File.readJsonSync(path.join(__dirname, './resources/auth.j */ export function getActualJson(customerKey, type, buName = 'testBU') { return File.readJSON( - `./retrieve/testInstance/${buName}/${type}/${customerKey}.${type}-meta.json` + `./retrieve/testInstance/${buName}/${type}/${customerKey}.${type}-meta.json`, ); } @@ -62,7 +62,7 @@ export function getActualFile(customerKey, type, ext) { */ export function getActualDeployJson(customerKey, type, buName = 'testBU') { return File.readJSON( - `./deploy/testInstance/${buName}/${type}/${customerKey}.${type}-meta.json` + `./deploy/testInstance/${buName}/${type}/${customerKey}.${type}-meta.json`, ); } /** @@ -148,22 +148,22 @@ export function mockSetup(isDeploy) { '.mcdevrc.json': fsmock.load(path.resolve(__dirname, 'mockRoot/.mcdevrc.json')), '.mcdev-auth.json': fsmock.load(path.resolve(__dirname, 'mockRoot/.mcdev-auth.json')), 'boilerplate/config.json': fsmock.load( - path.resolve(__dirname, '../boilerplate/config.json') + path.resolve(__dirname, '../boilerplate/config.json'), ), test: fsmock.load(path.resolve(__dirname)), // the following node_modules are required for prettier's SQL parser to work 'node_modules/prettier': fsmock.load(path.resolve(__dirname, '../node_modules/prettier')), 'node_modules/prettier-plugin-sql': fsmock.load( - path.resolve(__dirname, '../node_modules/prettier-plugin-sql') + path.resolve(__dirname, '../node_modules/prettier-plugin-sql'), ), 'node_modules/node-sql-parser': fsmock.load( - path.resolve(__dirname, '../node_modules/node-sql-parser') + path.resolve(__dirname, '../node_modules/node-sql-parser'), ), 'node_modules/big-integer': fsmock.load( - path.resolve(__dirname, '../node_modules/big-integer') + path.resolve(__dirname, '../node_modules/big-integer'), ), 'node_modules/sql-formatter': fsmock.load( - path.resolve(__dirname, '../node_modules/sql-formatter') + path.resolve(__dirname, '../node_modules/sql-formatter'), ), 'node_modules/nearley': fsmock.load(path.resolve(__dirname, '../node_modules/nearley')), }; From 99719a805fdbd5c69bc269ce52f6bbd957f89695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 21 Sep 2023 09:20:50 +0200 Subject: [PATCH 25/48] #0: upgrade logic to new async-first approach in prettier 3.x --- docs/dist/documentation.md | 6 +++--- lib/metadataTypes/MetadataType.js | 30 ++++++++++++++++-------------- lib/util/file.js | 6 +++--- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/docs/dist/documentation.md b/docs/dist/documentation.md index e42aa02c0..8d6096308 100644 --- a/docs/dist/documentation.md +++ b/docs/dist/documentation.md @@ -6641,7 +6641,7 @@ File extends fs-extra. It adds logger and util methods for file handling * [.writeJSONToFile(directory, filename, content)](#File.writeJSONToFile) ⇒ Promise * [.writePrettyToFile(directory, filename, filetype, content, [templateVariables])](#File.writePrettyToFile) ⇒ Promise.<boolean> * [._beautify_beautyAmp(content)](#File._beautify_beautyAmp) ⇒ string - * [._beautify_prettier(directory, filename, filetype, content)](#File._beautify_prettier) ⇒ string + * [._beautify_prettier(directory, filename, filetype, content)](#File._beautify_prettier) ⇒ Promise.<string> * [.writeToFile(directory, filename, filetype, content, [encoding])](#File.writeToFile) ⇒ Promise.<boolean> * [.readJSONFile(directory, filename, sync, cleanPath)](#File.readJSONFile) ⇒ Promise.<object> \| object \| void * [.readFilteredFilename(directory, filename, filetype, [encoding])](#File.readFilteredFilename) ⇒ Promise.<string> \| void @@ -6756,12 +6756,12 @@ helper for [writePrettyToFile](#File.writePrettyToFile), applying beautyAmp onto -### File.\_beautify\_prettier(directory, filename, filetype, content) ⇒ string +### File.\_beautify\_prettier(directory, filename, filetype, content) ⇒ Promise.<string> helper for [writePrettyToFile](#File.writePrettyToFile), applying prettier onto given stringified content ! Important: run 'await File.initPrettier()' in your MetadataType.retrieve() once before hitting this **Kind**: static method of [File](#File) -**Returns**: string - original string on error; formatted string on success +**Returns**: Promise.<string> - original string on error; formatted string on success | Param | Type | Description | | --- | --- | --- | diff --git a/lib/metadataTypes/MetadataType.js b/lib/metadataTypes/MetadataType.js index 954d716dd..78e544ee0 100644 --- a/lib/metadataTypes/MetadataType.js +++ b/lib/metadataTypes/MetadataType.js @@ -1653,20 +1653,22 @@ class MetadataType { baseDir.push(...postRetrieveData.subFolder); } // save extracted scripts - for (const script of postRetrieveData.codeArr) { - const dir = [...baseDir]; - if (script.subFolder) { - // some files shall be saved in yet a deeper subfolder - dir.push(...script.subFolder); - } - File.writePrettyToFile( - dir, - script.fileName + subtypeExtension, - script.fileExt, - script.content, - templateVariables, - ); - } + await Promise.all( + postRetrieveData.codeArr.map(async (script) => { + const dir = [...baseDir]; + if (script.subFolder) { + // some files shall be saved in yet a deeper subfolder + dir.push(...script.subFolder); + } + return File.writePrettyToFile( + dir, + script.fileName + subtypeExtension, + script.fileExt, + script.content, + templateVariables, + ); + }), + ); // normalize results[metadataEntry] results[originalKey] = postRetrieveData.json; } else { diff --git a/lib/util/file.js b/lib/util/file.js index 9b0b775c7..d1b032e7a 100644 --- a/lib/util/file.js +++ b/lib/util/file.js @@ -218,9 +218,9 @@ const File = { * @param {string} filename name of the file without suffix * @param {string} filetype filetype ie. JSON or SSJS * @param {string} content filecontent - * @returns {string} original string on error; formatted string on success + * @returns {Promise.} original string on error; formatted string on success */ - _beautify_prettier: function (directory, filename, filetype, content) { + _beautify_prettier: async function (directory, filename, filetype, content) { let formatted = ''; try { if (!FileFs.prettierConfig) { @@ -281,7 +281,7 @@ const File = { FileFs.prettierConfig.parser = 'babel'; } } - formatted = prettier.format(content, FileFs.prettierConfig); + formatted = await prettier.format(content, FileFs.prettierConfig); } catch (ex) { const warnMsg = `Potential Code issue found in ${this.normalizePath([ ...directory, From 6d35cdcff79c920d0bc52370838871145a77d40a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 21 Sep 2023 09:29:56 +0200 Subject: [PATCH 26/48] #0: ensure prettier-plugin-sql is loaded when auto-formatting SQL files --- lib/util/file.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/util/file.js b/lib/util/file.js index d1b032e7a..b28ec8051 100644 --- a/lib/util/file.js +++ b/lib/util/file.js @@ -275,6 +275,7 @@ const File = { } case 'sql': { FileFs.prettierConfig.parser = 'sql'; + FileFs.prettierConfig.plugins = ['prettier-plugin-sql']; break; } default: { From a79432c7fd0a534147999744014fdcf9f8402fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 22 Sep 2023 09:50:05 +0200 Subject: [PATCH 27/48] #0: ensure --like filtered complex metadata types dont cause issues for fixKeys --- lib/metadataTypes/MetadataType.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/metadataTypes/MetadataType.js b/lib/metadataTypes/MetadataType.js index 78e544ee0..d5b7373cb 100644 --- a/lib/metadataTypes/MetadataType.js +++ b/lib/metadataTypes/MetadataType.js @@ -1648,6 +1648,14 @@ class MetadataType { } const postRetrieveData = results[originalKey]; + // normalize results[metadataEntry] + results[originalKey] = postRetrieveData.json; + + if (Util.OPTIONS.like && !Util.fieldsLike(results[originalKey])) { + Util.logger.debug(`Filtered ${originalKey} because of --like option`); + continue; + } + if (postRetrieveData.subFolder) { // very complex types have their own subfolder baseDir.push(...postRetrieveData.subFolder); @@ -1669,8 +1677,6 @@ class MetadataType { ); }), ); - // normalize results[metadataEntry] - results[originalKey] = postRetrieveData.json; } else { // not a complex type, run the the entire JSON through templating // replace market values with template variable placeholders @@ -1680,12 +1686,12 @@ class MetadataType { templateVariables, ); } + if (Util.OPTIONS.like && !Util.fieldsLike(results[originalKey])) { + Util.logger.debug(`Filtered ${originalKey} because of --like option`); + continue; + } } - if (Util.OPTIONS.like && !Util.fieldsLike(results[originalKey])) { - Util.logger.debug(`Filtered ${originalKey} because of --like option`); - continue; - } // we dont store Id on local disk, but we need it for caching logic, // so its in retrieve but not in save. Here we put into the clone so that the original // object used for caching doesnt have the Id removed. From 03a913a02408e13c19dc4deed2a3664620fef0bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 22 Sep 2023 10:21:23 +0200 Subject: [PATCH 28/48] #0: reverting prettier's trailingComma to es5 due to incompatibilities with eslint in vscode --- .eslintrc.json | 2 +- .prettierrc | 1 + lib/Builder.js | 16 +- lib/Deployer.js | 42 ++-- lib/Retriever.js | 22 +- lib/cli.js | 4 +- lib/index.js | 80 ++++--- lib/metadataTypes/Asset.js | 140 ++++++------ lib/metadataTypes/AttributeGroup.js | 8 +- lib/metadataTypes/AttributeSet.js | 42 ++-- lib/metadataTypes/Automation.js | 150 ++++++------ lib/metadataTypes/Campaign.js | 10 +- lib/metadataTypes/ContentArea.js | 6 +- lib/metadataTypes/DataExtension.js | 124 +++++----- lib/metadataTypes/DataExtensionField.js | 36 +-- lib/metadataTypes/DataExtract.js | 20 +- lib/metadataTypes/Discovery.js | 4 +- lib/metadataTypes/Email.js | 2 +- lib/metadataTypes/EmailSend.js | 24 +- lib/metadataTypes/Event.js | 26 +-- lib/metadataTypes/FileTransfer.js | 20 +- lib/metadataTypes/Folder.js | 80 +++---- lib/metadataTypes/ImportFile.js | 32 +-- lib/metadataTypes/Journey.js | 126 +++++----- lib/metadataTypes/List.js | 8 +- lib/metadataTypes/MetadataType.js | 212 ++++++++--------- lib/metadataTypes/MobileCode.js | 2 +- lib/metadataTypes/MobileKeyword.js | 38 ++-- lib/metadataTypes/MobileMessage.js | 36 +-- lib/metadataTypes/Query.js | 38 ++-- lib/metadataTypes/Role.js | 18 +- lib/metadataTypes/Script.js | 22 +- lib/metadataTypes/TransactionalEmail.js | 32 +-- lib/metadataTypes/TransactionalMessage.js | 10 +- lib/metadataTypes/TransactionalPush.js | 6 +- lib/metadataTypes/TransactionalSMS.js | 30 +-- lib/metadataTypes/TriggeredSend.js | 28 +-- lib/metadataTypes/User.js | 91 ++++---- lib/metadataTypes/Verification.js | 18 +- lib/retrieveChangelog.js | 2 +- lib/util/auth.js | 14 +- lib/util/businessUnit.js | 12 +- lib/util/cache.js | 18 +- lib/util/cli.js | 30 +-- lib/util/config.js | 34 +-- lib/util/devops.js | 48 ++-- lib/util/file.js | 12 +- lib/util/init.config.js | 42 ++-- lib/util/init.git.js | 14 +- lib/util/init.js | 40 ++-- lib/util/init.npm.js | 14 +- lib/util/util.js | 32 +-- test/general.test.js | 10 +- test/resourceFactory.js | 28 +-- test/type.attributeGroup.test.js | 8 +- test/type.attributeSet.test.js | 8 +- test/type.automation.test.js | 266 +++++++++++----------- test/type.dataExtension.test.js | 110 ++++----- test/type.dataExtract.test.js | 48 ++-- test/type.fileTransfer.test.js | 48 ++-- test/type.importFile.test.js | 48 ++-- test/type.journey.test.js | 36 +-- test/type.mobileKeyword.test.js | 100 ++++---- test/type.mobileMessage.test.js | 52 ++--- test/type.query.test.js | 204 ++++++++--------- test/type.script.test.js | 108 ++++----- test/type.transactionalEmail.test.js | 34 +-- test/type.transactionalPush.test.js | 32 +-- test/type.transactionalSMS.test.js | 56 +++-- test/type.triggeredSend.test.js | 32 +-- test/type.user.test.js | 40 ++-- test/type.verification.test.js | 44 ++-- test/utils.js | 14 +- 73 files changed, 1604 insertions(+), 1640 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index e95ead59b..5edc0fc77 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -10,7 +10,7 @@ "plugin:prettier/recommended", "plugin:unicorn/recommended" ], - "plugins": [], + "plugins": ["prettier"], "globals": { "Atomics": "readonly", "SharedArrayBuffer": "readonly" diff --git a/.prettierrc b/.prettierrc index 0739b9eb2..8d68fa3f2 100644 --- a/.prettierrc +++ b/.prettierrc @@ -2,6 +2,7 @@ "tabWidth": 4, "printWidth": 100, "singleQuote": true, + "trailingComma": "es5", "overrides": [ { "files": "*.json", diff --git a/lib/Builder.js b/lib/Builder.js index f83ac79c3..2d0e382a8 100644 --- a/lib/Builder.js +++ b/lib/Builder.js @@ -36,7 +36,7 @@ saved : [properties.directories.templateBuilds]; this.targetDir = templateBuildsArr.map( (directoriesTemplateBuilds) => - directoriesTemplateBuilds + buObject.credential + '/' + buObject.businessUnit, + directoriesTemplateBuilds + buObject.credential + '/' + buObject.businessUnit ); /** @@ -59,7 +59,7 @@ saved if (name.includes(',')) { nameArr = name.split(',').map((item) => // allow whitespace in comma-separated lists - item.trim(), + item.trim() ); } else { nameArr = [name.trim()]; @@ -81,9 +81,9 @@ saved this.templateDir, this.targetDir, name, - templateVariables, + templateVariables ); - }), + }) ); if (result) { this.metadata[result[0].type] = []; @@ -115,7 +115,7 @@ saved } if (selectedType.includes('-')) { Util.logger.error( - `:: '${selectedType}' is not a valid metadata type. Please don't include subtypes.`, + `:: '${selectedType}' is not a valid metadata type. Please don't include subtypes.` ); return; } @@ -150,9 +150,9 @@ saved this.retrieveDir, this.templateDir, key, - templateVariables, + templateVariables ); - }), + }) ); if (result) { this.metadata[result[0].type] = result.map((element) => element.metadata); @@ -181,7 +181,7 @@ saved } if (selectedType.includes('-')) { Util.logger.error( - `:: '${selectedType}' is not a valid metadata type. Please don't include subtypes.`, + `:: '${selectedType}' is not a valid metadata type. Please don't include subtypes.` ); return; } diff --git a/lib/Deployer.js b/lib/Deployer.js index 1feabae11..2f304617e 100644 --- a/lib/Deployer.js +++ b/lib/Deployer.js @@ -87,7 +87,7 @@ class Deployer { const deployFolders = await File.readDirectories( properties.directories.deploy, 2, - false, + false ); for (const buPath of deployFolders.filter((r) => r.includes(path.sep))) { @@ -97,7 +97,7 @@ class Deployer { bu, properties, selectedTypesArr, - keyArr, + keyArr ); buMultiMetadataTypeMap[cred + '/' + bu] = multiMetadataTypeMap; counter_credBu++; @@ -118,7 +118,7 @@ class Deployer { properties, cred === null ? null : cred + '/' + bu, null, - true, + true ); if (buObject === null) { return; @@ -131,7 +131,7 @@ class Deployer { if (bu === '*' && properties.credentials && properties.credentials[cred]) { if (Util.OPTIONS.changeKeyValue) { Util.logger.error( - '--changeKeyValue is not supported for deployments to all BUs', + '--changeKeyValue is not supported for deployments to all BUs' ); return; } @@ -142,7 +142,7 @@ class Deployer { const deployFolders = await File.readDirectories( File.normalizePath([properties.directories.deploy, cred]), 1, - false, + false ); for (const buPath of deployFolders) { const multiMetadataTypeMap = await this._deployBU( @@ -150,7 +150,7 @@ class Deployer { buPath, properties, selectedTypesArr, - keyArr, + keyArr ); buMultiMetadataTypeMap[cred + '/' + buPath] = multiMetadataTypeMap; counter_credBu++; @@ -165,7 +165,7 @@ class Deployer { bu, properties, selectedTypesArr, - keyArr, + keyArr ); counter_credBu++; buMultiMetadataTypeMap[cred + '/' + bu] = multiMetadataTypeMap; @@ -231,7 +231,7 @@ class Deployer { this.metadata = null; Util.logger.error( 'Please create a directory called deploy and include your metadata in it: ' + - this.deployDir, + this.deployDir ); return null; } @@ -253,7 +253,7 @@ class Deployer { await Deployer.createFolderDefinitions( this.deployDir, this.metadata, - Object.keys(this.metadata), + Object.keys(this.metadata) ); } const foundDeployTypes = Object.keys(this.metadata) @@ -263,7 +263,7 @@ class Deployer { .map((type) => type === 'asset' && Util.includesStartsWith(typeArr, type) ? typeArr[Util.includesStartsWithIndex(typeArr, type)] - : type, + : type ); if (!foundDeployTypes.length) { throw new Error('No metadata found for deployment'); @@ -292,13 +292,13 @@ class Deployer { Util.logger.info( 'Deploying: ' + metadataType + - (Util.OPTIONS.fromRetrieve ? ' (from retrieve folder)' : ''), + (Util.OPTIONS.fromRetrieve ? ' (from retrieve folder)' : '') ); const result = await MetadataTypeInfo[type].deploy( this.metadata[type], this.deployDir, - this.retrieveDir, + this.retrieveDir ); multiMetadataTypeMap[type] = result; cache.mergeMetadata(type, result); @@ -330,7 +330,7 @@ class Deployer { buMetadata[metadataType] = MetadataTypeInfo[metadataType].getJsonFromFS( File.normalizePath([deployDir, metadataType]), listBadKeys, - typeArr, + typeArr ); } } @@ -360,7 +360,7 @@ class Deployer { if ( !MetadataTypeInfo[metadataType].definition.dependencies.includes('folder') && !MetadataTypeInfo[metadataType].definition.dependencies.some((dep) => - dep.startsWith('folder-'), + dep.startsWith('folder-') ) ) { Util.logger.debug(` ☇ skipping ${metadataType} folders: folder not a dependency`); @@ -372,30 +372,30 @@ class Deployer { } if ( !MetadataTypeInfo.folder.definition.deployFolderTypes.includes( - MetadataTypeInfo[metadataType].definition.folderType, + MetadataTypeInfo[metadataType].definition.folderType ) ) { Util.logger.warn( - ` ☇ skipping ${metadataType} folders: folderType ${MetadataTypeInfo[metadataType].definition.folderType} not supported for deployment. Please consider creating folders for this type manually as a pre-deployment step, if you see errors about missing dependent folders for this type later in this log.`, + ` ☇ skipping ${metadataType} folders: folderType ${MetadataTypeInfo[metadataType].definition.folderType} not supported for deployment. Please consider creating folders for this type manually as a pre-deployment step, if you see errors about missing dependent folders for this type later in this log.` ); continue; } Util.logger.debug( - ` - create ${metadataType} folders: Creating relevant folders in deploy dir`, + ` - create ${metadataType} folders: Creating relevant folders in deploy dir` ); const allFolders = Object.keys(metadata[metadataType]) .filter( // filter out root folders (which would not have a slash in their path) - (key) => metadata[metadataType][key].r__folder_Path?.includes('/'), + (key) => metadata[metadataType][key].r__folder_Path?.includes('/') ) .filter( // filter out dataExtension folders other than standard & shared (--> synchronized / salesforce are not allowed) (key) => metadataType !== 'dataExtension' || allowedDeFolderContentTypes.includes( - metadata[metadataType][key].r__folder_ContentType, - ), + metadata[metadataType][key].r__folder_ContentType + ) ) .map((key) => metadata[metadataType][key].r__folder_Path); @@ -448,7 +448,7 @@ class Deployer { // reload from file system to ensure we use the same logic for building the temporary JSON metadata.folder = MetadataTypeInfo.folder.getJsonFromFS( - File.normalizePath([deployDir, 'folder']), + File.normalizePath([deployDir, 'folder']) ); } return folderMetadata; diff --git a/lib/Retriever.js b/lib/Retriever.js index f2322b0c2..bbfb0c0d6 100644 --- a/lib/Retriever.js +++ b/lib/Retriever.js @@ -95,8 +95,8 @@ class Retriever { if (subTypeArr?.length > 1) { Util.logger.warn( `retrieveAsTemplate only works with one subtype, ignoring all but first subtype from your list: ${subTypeArr.join( - ', ', - )}`, + ', ' + )}` ); } result = await Promise.all( @@ -105,9 +105,9 @@ class Retriever { this.templateDir, name, templateVariables, - subTypeArr?.[0], - ), - ), + subTypeArr?.[0] + ) + ) ); } else { // type is in list of types to retrieve and we don't have template variables @@ -121,14 +121,14 @@ class Retriever { Util.logSubtypes(subTypeArr); cacheResult = await MetadataTypeInfo[type].retrieveForCache( null, - subTypeArr, + subTypeArr ); } Util.logger.info( `Retrieving: ${type}` + (typeKeyMap[type][0] === null ? '' - : Util.getKeysString(typeKeyMap[type])), + : Util.getKeysString(typeKeyMap[type])) ); result = await (changelogOnly ? MetadataTypeInfo[type].retrieveChangelog(null, subTypeArr) @@ -138,9 +138,9 @@ class Retriever { this.savePath, null, subTypeArr, - key, - ), - ), + key + ) + ) )); if (Array.isArray(result) && cacheResult !== null) { // if we have a key-list and the type is a dependency, we need to cache the whole type @@ -201,7 +201,7 @@ class Retriever { // if they have dependencies then add a dependency pair for each type if (MetadataDefinitions[type].dependencies.length > 0) { dependencies.push( - ...MetadataDefinitions[type].dependencies.map((dep) => dep.split('-')[0]), + ...MetadataDefinitions[type].dependencies.map((dep) => dep.split('-')[0]) ); } } diff --git a/lib/cli.js b/lib/cli.js index ada5271ef..6be219184 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -602,7 +602,7 @@ yargs(hideBin(process.argv)) .recommendCommands() .wrap(yargs(hideBin(process.argv)).terminalWidth()) .epilog( - 'Copyright 2023. Accenture. Get support at https://github.com/Accenture/sfmc-devtools/issues', + 'Copyright 2023. Accenture. Get support at https://github.com/Accenture/sfmc-devtools/issues' ) .help().argv; @@ -621,7 +621,7 @@ function csvToArray(csv) { .split(',') .map((item) => // allow whitespace in comma-separated lists - item.trim(), + item.trim() ) // make sure trailing commas are ignored .filter(Boolean) diff --git a/lib/index.js b/lib/index.js index 02c101c19..2e9749693 100644 --- a/lib/index.js +++ b/lib/index.js @@ -111,7 +111,7 @@ class Mcdev { properties, argv.range, argv.diffArr, - argv.commitHistory, + argv.commitHistory ); } @@ -190,7 +190,7 @@ class Mcdev { cred, bu, selectedTypesArr, - keys, + keys ); counter_credBu++; Util.startLogger(true); @@ -202,7 +202,7 @@ class Mcdev { Util.logger.info( `:: Done for ${counter_credTotal} BUs of ${credentialCount} credential${ credentialCount === 1 ? '' : 's' - } in total\n`, + } in total\n` ); } else { let [cred, bu] = businessUnit ? businessUnit.split('/') : [null, null]; @@ -216,7 +216,7 @@ class Mcdev { properties, cred === null ? null : cred + '/' + bu, null, - true, + true ); if (buObject === null) { return; @@ -234,7 +234,7 @@ class Mcdev { cred, bu, selectedTypesArr, - keys, + keys ); counter_credBu++; Util.startLogger(true); @@ -247,7 +247,7 @@ class Mcdev { bu, selectedTypesArr, keys, - changelogOnly, + changelogOnly ); if (changelogOnly) { console.timeEnd('Time'); // eslint-disable-line no-console @@ -295,7 +295,7 @@ class Mcdev { properties, cred === null ? null : cred + '/' + bu, null, - true, + true ); if (buObject !== null) { cache.initCache(buObject); @@ -346,7 +346,7 @@ class Mcdev { cred, bu, renamedTypes[type], - ]), + ]) ); } } @@ -358,13 +358,13 @@ class Mcdev { File.removeSync(File.normalizePath([properties.directories.retrieve, cred, bu])); // removes subtypes and removes duplicates retrieveTypesArr.push( - ...new Set(properties.metaDataTypes.retrieve.map((type) => type.split('-')[0])), + ...new Set(properties.metaDataTypes.retrieve.map((type) => type.split('-')[0])) ); for (const selectedType of retrieveTypesArr) { const test = Util._isValidType(selectedType); if (!test) { Util.logger.error( - `Please remove the type ${selectedType} from your ${Util.configFileName}`, + `Please remove the type ${selectedType} from your ${Util.configFileName}` ); return; } @@ -378,7 +378,7 @@ class Mcdev { retrieveTypesArr, Array.isArray(selectedTypesArr) ? keys : selectedTypesArr, null, - changelogOnly, + changelogOnly ); return retrieveChangelog; } catch (ex) { @@ -468,7 +468,7 @@ class Mcdev { const buObject = await Cli.getCredentialObject( properties, parentBUOnlyTypes.includes(type) ? businessUnit.split('/')[0] : businessUnit, - parentBUOnlyTypes.includes(type) ? Util.parentBuName : null, + parentBUOnlyTypes.includes(type) ? Util.parentBuName : null ); if (buObject !== null) { MetadataTypeInfo[type].properties = properties; @@ -479,7 +479,7 @@ class Mcdev { Util.logger.error('mcdev.document ' + ex.message); Util.logger.debug(ex.stack); Util.logger.info( - 'If the directoy does not exist, you may need to retrieve this BU first.', + 'If the directoy does not exist, you may need to retrieve this BU first.' ); } } @@ -511,9 +511,7 @@ class Mcdev { return; } Util.logger.info( - Util.getGrayMsg( - ` - Deleting ${type} with key ${customerKey} on BU ${businessUnit}`, - ), + Util.getGrayMsg(` - Deleting ${type} with key ${customerKey} on BU ${businessUnit}`) ); try { MetadataTypeInfo[type].properties = properties; @@ -582,7 +580,7 @@ class Mcdev { properties.directories.retrieve, buObject.credential, buObject.businessUnit, - ]), + ]) ); const docPath = File.normalizePath([ properties.directories.docs, @@ -627,7 +625,7 @@ class Mcdev { docPath, File.filterIllegalFilenames(buObject.businessUnit) + '.badKeys', 'md', - output, + output ); Util.logger.info('Bad keys documented in ' + filename); } @@ -736,7 +734,7 @@ class Mcdev { } if (selectedType.includes('-')) { Util.logger.error( - `:: '${selectedType}' is not a valid metadata type. Please don't include subtypes.`, + `:: '${selectedType}' is not a valid metadata type. Please don't include subtypes.` ); return; } @@ -847,7 +845,7 @@ class Mcdev { !Object.prototype.hasOwnProperty.call(MetadataTypeInfo[selectedType], methodName) ) { Util.logger.error( - ` ☇ skipping ${selectedType}: ${methodName} is not supported yet for ${selectedType}`, + ` ☇ skipping ${selectedType}: ${methodName} is not supported yet for ${selectedType}` ); return resultObj; } @@ -872,7 +870,7 @@ class Mcdev { if (businessUnit === '*') { Util.OPTIONS._multiBuExecution = true; Util.logger.info( - `:: ${lang_present} the ${selectedType} on all BUs for all credentials`, + `:: ${lang_present} the ${selectedType} on all BUs for all credentials` ); let counter_credTotal = 0; for (const cred in properties.credentials) { @@ -886,7 +884,7 @@ class Mcdev { cred, bu, selectedType, - keys, + keys ); counter_credBu++; counter_credKeys += resultObj[cred + '/' + bu].length; @@ -894,11 +892,11 @@ class Mcdev { } counter_credTotal += counter_credBu; Util.logger.info( - `:: ${lang_past} for ${counter_credKeys} ${selectedType}s on ${counter_credBu} BUs for ${cred}`, + `:: ${lang_past} for ${counter_credKeys} ${selectedType}s on ${counter_credBu} BUs for ${cred}` ); } Util.logger.info( - `:: ${lang_past} ${selectedType} on ${counter_credTotal} BUs in total\n`, + `:: ${lang_past} ${selectedType} on ${counter_credTotal} BUs in total\n` ); } else { let [cred, bu] = businessUnit ? businessUnit.split('/') : [null, null]; @@ -912,7 +910,7 @@ class Mcdev { properties, cred === null ? null : cred + '/' + bu, null, - true, + true ); if (buObject === null) { return resultObj; @@ -930,14 +928,14 @@ class Mcdev { cred, bu, selectedType, - keys, + keys ); counter_credBu++; counter_credKeys += resultObj[cred + '/' + bu].length; Util.startLogger(true); } Util.logger.info( - `:: ${lang_past} for ${counter_credKeys} ${selectedType}s on ${counter_credBu} BUs for ${cred}`, + `:: ${lang_past} for ${counter_credKeys} ${selectedType}s on ${counter_credBu} BUs for ${cred}` ); } else { // execute runMethod for the entity on one BU only @@ -946,7 +944,7 @@ class Mcdev { cred, bu, selectedType, - keys, + keys ); Util.logger.info(`:: Done`); } @@ -970,7 +968,7 @@ class Mcdev { properties, cred === null ? null : cred + '/' + bu, null, - true, + true ); try { if (!type) { @@ -1051,13 +1049,13 @@ class Mcdev { throw new Error(`Selected type ${selectedType} could not be cached`); } Util.logger.info( - Util.getGrayMsg(`Found ${Object.keys(metadataMap).length} ${selectedType}s`), + Util.getGrayMsg(`Found ${Object.keys(metadataMap).length} ${selectedType}s`) ); for (const originalKey in metadataMap) { // hide postRetrieveOutput Util.setLoggingLevel({ silent: true }); metadataMap[originalKey] = MetadataTypeInfo[selectedType].postRetrieveTasks( - metadataMap[originalKey], + metadataMap[originalKey] ); // reactivate logging Util.setLoggingLevel({}); @@ -1069,8 +1067,8 @@ class Mcdev { Util.getGrayMsg( `Identified ${keyArr.length} ${selectedType}${ keyArr.length === 1 ? '' : 's' - } that match${keyArr.length === 1 ? 'es' : ''} the like-filter`, - ), + } that match${keyArr.length === 1 ? 'es' : ''} the like-filter` + ) ); return keyArr; @@ -1101,7 +1099,7 @@ class Mcdev { properties, cred === null ? null : cred + '/' + bu, null, - true, + true ); try { Util.logger.info(`Retrieving latest versions of ${type} from server`); @@ -1112,7 +1110,7 @@ class Mcdev { const keysForDeploy = MetadataTypeInfo[type].getKeysForFixing(metadataMap); if (keysForDeploy.length < 1) { Util.logger.warn( - `No items found with a key-name mismatch that match your criteria.\n`, + `No items found with a key-name mismatch that match your criteria.\n` ); return resultArr; } @@ -1128,27 +1126,25 @@ class Mcdev { Util.logger.info( `Successfully updated ${actuallyFixedKeys.length} key${ actuallyFixedKeys.length === 1 ? '' : 's' - } of type ${type}`, + } of type ${type}` ); if (dependentTypes.length) { Util.logger.warn( `Please re-retrieve the following types as your local copies might now be outdated: ${Util.getGrayMsg( - dependentTypes.join(', '), - )}`, + dependentTypes.join(', ') + )}` ); const reRetrieve = await Cli.postFixKeysReretrieve(type, dependentTypes); if (reRetrieve) { Util.logger.info( - `Retrieving latest versions of ${dependentTypes.join( - ', ', - )} from server`, + `Retrieving latest versions of ${dependentTypes.join(', ')} from server` ); const retriever = new Retriever(properties, buObject); await retriever.retrieve(dependentTypes, null, null, false); } } else { Util.logger.info( - `No dependent types found that need to be re-retrieved after fixing keys of type ${type}.`, + `No dependent types found that need to be re-retrieved after fixing keys of type ${type}.` ); } } else { diff --git a/lib/metadataTypes/Asset.js b/lib/metadataTypes/Asset.js index 2f0a44d26..3abad802d 100644 --- a/lib/metadataTypes/Asset.js +++ b/lib/metadataTypes/Asset.js @@ -40,7 +40,7 @@ class Asset extends MetadataType { if (retrieveDir) { Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(metadata).length})` + - Util.getKeysString(key), + Util.getKeysString(key) ); } return { metadata: metadata, type: this.definition.type }; @@ -75,7 +75,7 @@ class Asset extends MetadataType { // each subtype contains multiple different specific types (images contains jpg and png for example) // we use await here to limit the risk of too many concurrent api requests at time items.push( - ...(await this.requestSubType(subType, templateDir, name, templateVariables)), + ...(await this.requestSubType(subType, templateDir, name, templateVariables)) ); } const metadata = this.parseResponseBody({ items: items }); @@ -94,7 +94,7 @@ class Asset extends MetadataType { */ static _getSubTypes() { const selectedSubTypeArr = this.properties.metaDataTypes.retrieve.filter((type) => - type.startsWith('asset-'), + type.startsWith('asset-') ); /* eslint-disable unicorn/prefer-ternary */ if ( @@ -150,7 +150,7 @@ class Asset extends MetadataType { /** @type {TYPE.AssetSubType[]} */ const extendedSubTypeArr = this.definition.extendedSubTypes[subType]; const subtypeIds = extendedSubTypeArr?.map( - (subTypeItemName) => Asset.definition.typeMapping[subTypeItemName], + (subTypeItemName) => Asset.definition.typeMapping[subTypeItemName] ); const uri = '/asset/v1/content/assets/query'; const payload = { @@ -258,7 +258,7 @@ class Asset extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${item[this.definition.nameField]} (${ item[this.definition.keyField] - }) has leading or trailing spaces in customerKey. Please remove them in SFMC.`, + }) has leading or trailing spaces in customerKey. Please remove them in SFMC.` ); } } @@ -296,7 +296,7 @@ class Asset extends MetadataType { ' Downloaded [{bar}] {percentage}% | {value}/{total} | asset-' + subType, }, - cliProgress.Presets.shades_classic, + cliProgress.Presets.shades_classic ); const completed = []; @@ -328,7 +328,7 @@ class Asset extends MetadataType { else if (!completed.includes(item.id)) { try { const extendedItem = await this.client.rest.get( - 'asset/v1/content/assets/' + item.id, + 'asset/v1/content/assets/' + item.id ); // only save the metadata if we have extended content metadata[item.customerKey] = extendedItem; @@ -342,13 +342,13 @@ class Asset extends MetadataType { metadata, retrieveDir, 'asset-' + subType, - templateVariables, + templateVariables ); } // update the current value in your application.. extendedBar.increment(); - }), - ), + }) + ) ); // stop the progress bar @@ -402,7 +402,7 @@ class Asset extends MetadataType { Util.logger.warn( ` - Failed to download ${failed.length} extended file${ failed.length > 1 ? 's' : '' - }:`, + }:` ); for (const fail of failed) { Util.logger.warn( @@ -412,14 +412,14 @@ class Asset extends MetadataType { fail.error.endpoint ? Util.getGrayMsg( ' - ' + - fail.error.endpoint.split('rest.marketingcloudapis.com')[1], + fail.error.endpoint.split('rest.marketingcloudapis.com')[1] ) : '' - }`, + }` ); } Util.logger.info( - ' - You will still find a JSON file for each of these in the download directory.', + ' - You will still find a JSON file for each of these in the download directory.' ); } } @@ -445,7 +445,7 @@ class Asset extends MetadataType { metadata.customerKey, fileExt, file, - 'base64', + 'base64' ); } /** @@ -479,7 +479,7 @@ class Asset extends MetadataType { [deployDir, this.definition.type, subType], metadata.customerKey, fileExt, - 'base64', + 'base64' ); } return path; @@ -514,7 +514,7 @@ class Asset extends MetadataType { this._refreshTriggeredSend(metadata); } else { Util.logger.warn( - 'You set the --refresh flag but no updated assets found. Skipping refresh of triggeredSendDefinitions.', + 'You set the --refresh flag but no updated assets found. Skipping refresh of triggeredSendDefinitions.' ); } } @@ -535,7 +535,7 @@ class Asset extends MetadataType { if (!legacyIdArr.length) { Util.logger.warn( - 'No legacyId found in updated emails. Skipping refresh of triggeredSendDefinitions.', + 'No legacyId found in updated emails. Skipping refresh of triggeredSendDefinitions.' ); return; } @@ -557,7 +557,7 @@ class Asset extends MetadataType { } const tsdCountFiltered = Object.keys(tsdObj).length; Util.logger.info( - `Found ${tsdCountFiltered} out of ${tsdCountInitial} total triggeredSendDefinitions for ${emailCount} deployed emails. Commencing validation...`, + `Found ${tsdCountFiltered} out of ${tsdCountInitial} total triggeredSendDefinitions for ${emailCount} deployed emails. Commencing validation...` ); // get keys of TSDs to refresh @@ -580,7 +580,7 @@ class Asset extends MetadataType { // additonalattributes fail where the value is "" so we need to remove them from deploy if (metadata?.data?.email?.attributes?.length > 0) { metadata.data.email.attributes = metadata.data.email.attributes.filter( - (attr) => attr.value, + (attr) => attr.value ); } @@ -627,7 +627,7 @@ class Asset extends MetadataType { metadata[this.definition.keyField], metadata[this.definition.nameField], this._getMainSubtype(metadata.assetType.name), - namesInFolder, + namesInFolder ); return metadata; } @@ -639,7 +639,7 @@ class Asset extends MetadataType { */ static _getMainSubtype(extendedSubType) { return Object.keys(this.definition.extendedSubTypes).find((subType) => - this.definition.extendedSubTypes[subType].includes(extendedSubType), + this.definition.extendedSubTypes[subType].includes(extendedSubType) ); } /** @@ -658,7 +658,7 @@ class Asset extends MetadataType { let i = 1; while ( namesInFolder.find( - (item) => item.name === newName && item.type === type && item.key !== key, + (item) => item.name === newName && item.type === type && item.key !== key ) ) { suffix = ' (' + i + ')'; @@ -698,7 +698,7 @@ class Asset extends MetadataType { targetDir, metadata, templateVariables, - templateName, + templateName ) { return this._buildForNested( templateDir, @@ -706,7 +706,7 @@ class Asset extends MetadataType { metadata, templateVariables, templateName, - 'definition', + 'definition' ); } /** @@ -726,7 +726,7 @@ class Asset extends MetadataType { targetDir, metadata, templateVariables, - templateName, + templateName ) { return this._buildForNested( templateDir, @@ -734,7 +734,7 @@ class Asset extends MetadataType { metadata, templateVariables, templateName, - 'template', + 'template' ); } @@ -756,7 +756,7 @@ class Asset extends MetadataType { metadata, templateVariables, templateName, - mode, + mode ) { // * because asset's _mergeCode() is overwriting 'metadata', clone it to ensure the main file is not modified by what we do in here metadata = JSON.parse(JSON.stringify(metadata)); @@ -773,20 +773,20 @@ class Asset extends MetadataType { // replace template variables with their values extractedFile.content = this.applyTemplateValues( extractedFile.content, - templateVariables, + templateVariables ); } else if (mode === 'template') { // replace template values with corresponding variable names extractedFile.content = this.applyTemplateNames( extractedFile.content, - templateVariables, + templateVariables ); } } catch { throw new Error( `${this.definition.type}:: Error applying template variables on ${ metadata[this.definition.keyField] - }: ${extractedFile.fileName}.${extractedFile.fileExt}.`, + }: ${extractedFile.fileName}.${extractedFile.fileExt}.` ); } } @@ -801,7 +801,7 @@ class Asset extends MetadataType { [templateDir, this.definition.type, subType], templateName, fileExt, - 'base64', + 'base64' ); // keep old name if creating templates, otherwise use new name @@ -826,7 +826,7 @@ class Asset extends MetadataType { extractedFile.fileName, extractedFile.fileExt, extractedFile.content, - extractedFile.encoding || null, + extractedFile.encoding || null ); } } @@ -842,14 +842,14 @@ class Asset extends MetadataType { 'folder', metadata.category.id, 'ID', - 'Path', + 'Path' ); delete metadata.category; } catch (ex) { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }): Could not find folder (${ex.message})`, + }): Could not find folder (${ex.message})` ); } } @@ -895,7 +895,7 @@ class Asset extends MetadataType { const fileName = 'views.html.content' + subtypeExtension; if ( (await File.pathExists( - File.normalizePath([...readDirArr, `${fileName}.html`]), + File.normalizePath([...readDirArr, `${fileName}.html`]) )) && metadata.views.html ) { @@ -903,7 +903,7 @@ class Asset extends MetadataType { metadata.views.html.content = await File.readFilteredFilename( readDirArr, fileName, - 'html', + 'html' ); } @@ -929,7 +929,7 @@ class Asset extends MetadataType { fileList, customerKey, templateName, - fileListOnly, + fileListOnly ); } break; @@ -945,7 +945,7 @@ class Asset extends MetadataType { for (const ext of fileExtArr) { if ( await File.pathExists( - File.normalizePath([...readDirArr, `${fileName}.${ext}`]), + File.normalizePath([...readDirArr, `${fileName}.${ext}`]) ) ) { // the main content can be empty (=not set up yet) hence check if we did extract sth or else readFile() will print error msgs @@ -953,7 +953,7 @@ class Asset extends MetadataType { metadata.content = await File.readFilteredFilename( readDirArr, fileName, - ext, + ext ); } if (templateName) { @@ -981,7 +981,7 @@ class Asset extends MetadataType { fileList, customerKey, templateName, - fileListOnly, + fileListOnly ); } @@ -997,7 +997,7 @@ class Asset extends MetadataType { File.normalizePath([ ...readDirArr, `${templateName || customerKey}${subtypeExtension}.html`, - ]), + ]) ) ) { // the main content can be empty (=not set up yet) hence check if we did extract sth or else readFile() will print error msgs @@ -1005,7 +1005,7 @@ class Asset extends MetadataType { metadata.views.text.content = await File.readFilteredFilename( readDirArr, (templateName || customerKey) + subtypeExtension, - 'html', + 'html' ); } if (templateName) { @@ -1037,7 +1037,7 @@ class Asset extends MetadataType { fileList, customerKey, templateName, - fileListOnly, + fileListOnly ); } @@ -1048,7 +1048,7 @@ class Asset extends MetadataType { File.normalizePath([ ...readDirArr, `views.html.content${subtypeExtension}.html`, - ]), + ]) )) && // the main content can be empty (=not set up yet) hence check if we did extract sth or else readFile() will print error msgs metadata.views?.html ) { @@ -1056,7 +1056,7 @@ class Asset extends MetadataType { metadata.views.html.content = await File.readFilteredFilename( readDirArr, 'views.html.content' + subtypeExtension, - 'html', + 'html' ); } if (templateName) { @@ -1074,7 +1074,7 @@ class Asset extends MetadataType { // metadata.content if ( await File.pathExists( - File.normalizePath([...readDirArr, `content${subtypeExtension}.html`]), + File.normalizePath([...readDirArr, `content${subtypeExtension}.html`]) ) ) { // the main content can be empty (=not set up yet) hence check if we did extract sth or else readFile() will print error msgs @@ -1082,7 +1082,7 @@ class Asset extends MetadataType { metadata.content = await File.readFilteredFilename( readDirArr, 'content' + subtypeExtension, - 'html', + 'html' ); } if (templateName) { @@ -1117,7 +1117,7 @@ class Asset extends MetadataType { File.normalizePath([ ...readDirArr, `${templateName || customerKey}${subtypeExtension}.${ext}`, - ]), + ]) ) ) { // the main content can be empty (=not set up yet) hence check if we did extract sth or else readFile() will print error msgs @@ -1125,7 +1125,7 @@ class Asset extends MetadataType { metadata.content = await File.readFilteredFilename( readDirArr, (templateName || customerKey) + subtypeExtension, - ext, + ext ); if (ext === 'ssjs') { metadata.content = ``; @@ -1172,7 +1172,7 @@ class Asset extends MetadataType { fileList, customerKey, templateName, - fileListOnly = false, + fileListOnly = false ) { for (const slot in metadataSlots) { if (Object.prototype.hasOwnProperty.call(metadataSlots, slot)) { @@ -1188,7 +1188,7 @@ class Asset extends MetadataType { ...readDirArr, 'blocks', `${fileName}.html`, - ]), + ]) ) ) { // the main content can be empty (=not set up yet) hence check if we did extract sth or else readFile() will print error msgs @@ -1197,7 +1197,7 @@ class Asset extends MetadataType { slotObj.blocks[block].content = await File.readFilteredFilename( [...readDirArr, 'blocks'], fileName, - 'html', + 'html' ); } if (templateName) { @@ -1220,7 +1220,7 @@ class Asset extends MetadataType { subDirArr, fileList, customerKey, - templateName, + templateName ); } } @@ -1381,7 +1381,7 @@ class Asset extends MetadataType { subType = this._getSubtype(metadata); if (!this.definition.binarySubtypes.includes(subType)) { Util.logger.debug( - 'not processed metadata.assetType.name: ' + metadata.assetType.name, + 'not processed metadata.assetType.name: ' + metadata.assetType.name ); } return { json: metadata, codeArr: codeArr, subFolder: null }; @@ -1417,7 +1417,7 @@ class Asset extends MetadataType { this._extractCode_slots( `${prefix}.[${slot}-${block}]`, slotObj.blocks[block].slots, - codeArr, + codeArr ); } } @@ -1457,7 +1457,7 @@ class Asset extends MetadataType { // own subfolder (with folder name = CustomerKey) // this section aims to find that json in the subfolder const subfolderFiles = File.readdirSync( - File.normalizePath([currentdir, dirent.name]), + File.normalizePath([currentdir, dirent.name]) ); for (const subFileName of subfolderFiles) { if (subFileName.endsWith('-meta.json')) { @@ -1471,12 +1471,12 @@ class Asset extends MetadataType { thisDir, fileName, true, - false, + false ); // subtype will change the metadata suffix length const fileNameWithoutEnding = fileName.slice( 0, - -17 - subtype.length, + -17 - subtype.length ); fileName2FileContent[fileNameWithoutEnding] = fileContent; } @@ -1508,16 +1508,10 @@ class Asset extends MetadataType { const fileNameFull = templateName + '.' + this.definition.type + `-${st}-meta.json`; if ( (await File.pathExists( - File.normalizePath([templateDir, ...typeDirArr, st, fileNameFull]), + File.normalizePath([templateDir, ...typeDirArr, st, fileNameFull]) )) || (await File.pathExists( - File.normalizePath([ - templateDir, - ...typeDirArr, - st, - templateName, - fileNameFull, - ]), + File.normalizePath([templateDir, ...typeDirArr, st, templateName, fileNameFull]) )) ) { subType = st; @@ -1529,7 +1523,7 @@ class Asset extends MetadataType { `Could not find asset with name ${templateName} in ${File.normalizePath([ templateDir, ...typeDirArr, - ])}`, + ])}` ); } return subType; @@ -1573,7 +1567,7 @@ class Asset extends MetadataType { fileName = `${key}.${this.definition.type}-${st}-meta.json`; if ( await File.pathExists( - File.normalizePath([basePath, this.definition.type, st, fileName]), + File.normalizePath([basePath, this.definition.type, st, fileName]) ) ) { subType = st; @@ -1587,7 +1581,7 @@ class Asset extends MetadataType { st, key, fileName, - ]), + ]) ) ) { subType = st; @@ -1609,7 +1603,7 @@ class Asset extends MetadataType { basePath, ...item.subFolder, `${item.fileName}.${item.fileExt}`, - ]), + ]) ); const response = [ File.normalizePath([...filePath, fileName]), @@ -1620,7 +1614,7 @@ class Asset extends MetadataType { metadata, subType, basePath, - false, + false ); if (binaryFilePath) { response.push(binaryFilePath); @@ -1630,7 +1624,7 @@ class Asset extends MetadataType { } else { return []; } - }), + }) ) ).flat(); return fileList; diff --git a/lib/metadataTypes/AttributeGroup.js b/lib/metadataTypes/AttributeGroup.js index 7e97a4f7d..bf17d44c7 100644 --- a/lib/metadataTypes/AttributeGroup.js +++ b/lib/metadataTypes/AttributeGroup.js @@ -25,7 +25,7 @@ class AttributeGroup extends MetadataType { retrieveDir, '/hub/v1/contacts/schema/attributeGroups', null, - key, + key ); } /** @@ -54,11 +54,11 @@ class AttributeGroup extends MetadataType { 'attributeSet', attributeSet.definitionID, 'definitionID', - 'definitionKey', + 'definitionKey' ); if (key !== attributeSet.definitionKey) { throw new Error( - `AttributeSet key mismatch. Found ${key} instead of ${attributeSet.definitionKey}`, + `AttributeSet key mismatch. Found ${key} instead of ${attributeSet.definitionKey}` ); } return key; @@ -66,7 +66,7 @@ class AttributeGroup extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.keyField]} (for ${ attributeSet.definitionKey - }): ${ex.message}`, + }): ${ex.message}` ); return attributeSet; } diff --git a/lib/metadataTypes/AttributeSet.js b/lib/metadataTypes/AttributeSet.js index bf8a8dcdd..edd131c92 100644 --- a/lib/metadataTypes/AttributeSet.js +++ b/lib/metadataTypes/AttributeSet.js @@ -60,13 +60,13 @@ class AttributeSet extends MetadataType { .filter( (asKey) => metadataMap[asKey].storageLogicalType === 'ExactTargetSchema' || - metadataMap[asKey].storageLogicalType === 'DataExtension', + metadataMap[asKey].storageLogicalType === 'DataExtension' ) .filter((asKey) => { // check if dataExtension ID is found on any attributeSet of this BU if (sharedDataExtensionMap[metadataMap[asKey].storageReferenceID.value]) { Util.logger.debug( - ` shared dataExtension ID ${metadataMap[asKey].storageReferenceID.value} found in attributeSet ${asKey}`, + ` shared dataExtension ID ${metadataMap[asKey].storageReferenceID.value} found in attributeSet ${asKey}` ); return true; } else { @@ -84,8 +84,8 @@ class AttributeSet extends MetadataType { if (!search.length) { Util.logger.debug( Util.getGrayMsg( - ` - Field ${deField.Name} not found in attributeSet; Note: only first recognized difference is printed to log`, - ), + ` - Field ${deField.Name} not found in attributeSet; Note: only first recognized difference is printed to log` + ) ); return true; } @@ -93,8 +93,8 @@ class AttributeSet extends MetadataType { if (asField.dataType !== deField.FieldType) { Util.logger.debug( Util.getGrayMsg( - ` - Field ${deField.Name} FieldType changed (old: ${asField.dataType}; new: ${deField.FieldType}); Note: only first recognized difference is printed to log`, - ), + ` - Field ${deField.Name} FieldType changed (old: ${asField.dataType}; new: ${deField.FieldType}); Note: only first recognized difference is printed to log` + ) ); return true; } @@ -110,7 +110,7 @@ class AttributeSet extends MetadataType { deField.DefaultValue !== asField.defaultValue) ) { Util.logger.debug( - ` - Field ${deField.Name} DefaultValue changed (old: ${asField.defaultValue}; new: ${deField.DefaultValue}); Note: only first recognized difference is printed to log`, + ` - Field ${deField.Name} DefaultValue changed (old: ${asField.defaultValue}; new: ${deField.DefaultValue}); Note: only first recognized difference is printed to log` ); return true; } @@ -118,19 +118,19 @@ class AttributeSet extends MetadataType { asField.length ||= 0; if (asField.length !== deField.MaxLength) { Util.logger.debug( - ` - Field ${deField.Name} MaxLength changed (old: ${asField.length}; new: ${deField.MaxLength}); Note: only first recognized difference is printed to log`, + ` - Field ${deField.Name} MaxLength changed (old: ${asField.length}; new: ${deField.MaxLength}); Note: only first recognized difference is printed to log` ); return true; } if (asField.isNullable !== deField.IsRequired) { Util.logger.debug( - ` - Field ${deField.Name} IsRequired changed (old: ${asField.isNullable}; new: ${deField.IsRequired}); Note: only first recognized difference is printed to log`, + ` - Field ${deField.Name} IsRequired changed (old: ${asField.isNullable}; new: ${deField.IsRequired}); Note: only first recognized difference is printed to log` ); return true; } if (asField.isPrimaryKey !== deField.IsPrimaryKey) { Util.logger.debug( - ` - Field ${deField.Name} IsPrimaryKey changed (old: ${asField.isPrimaryKey}; new: ${deField.IsPrimaryKey}); Note: only first recognized difference is printed to log`, + ` - Field ${deField.Name} IsPrimaryKey changed (old: ${asField.isPrimaryKey}; new: ${deField.IsPrimaryKey}); Note: only first recognized difference is printed to log` ); return true; } @@ -187,7 +187,7 @@ class AttributeSet extends MetadataType { 'dataExtension', metadata.storageReferenceID.value, 'ObjectID', - 'CustomerKey', + 'CustomerKey' ); // TODO: check if fields in metadata.sendAttributeStorageName exist in data extension --> error // TODO: check if fields in data extension exist in metadata.sendAttributeStorageName --> warn @@ -199,7 +199,7 @@ class AttributeSet extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.keyField]}: ${ ex.message - }`, + }` ); } break; @@ -243,14 +243,14 @@ class AttributeSet extends MetadataType { 'attributeGroup', relationship[type + 'Item']?.identifier, 'definitionID', - 'definitionKey', + 'definitionKey' ); delete relationship[type + 'Item']?.identifier; } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${ metadata[this.definition.keyField] - }: ${ex.message}`, + }: ${ex.message}` ); } // get relationship fieldnames @@ -266,7 +266,7 @@ class AttributeSet extends MetadataType { 'attributeSet', relationship[type + 'Item']?.identifier, 'definitionID', - 'definitionKey', + 'definitionKey' ); delete relationship[type + 'Item']?.identifier; @@ -279,13 +279,13 @@ class AttributeSet extends MetadataType { : cache.getByKey( 'attributeSet', relationship[type + 'Item'] - .r__attributeSet_definitionKey, + .r__attributeSet_definitionKey ); } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${ metadata[this.definition.keyField] - }: ${ex.message}`, + }: ${ex.message}` ); } break; @@ -297,7 +297,7 @@ class AttributeSet extends MetadataType { for (const attr of relationship.relationshipAttributes) { const id = attr[type + 'AttributeID']; const valueDefinition = relationshipObj.valueDefinitions.find( - (item) => item.valueDefinitionID === id, + (item) => item.valueDefinitionID === id ); if (valueDefinition) { attr['c__' + type + 'FullyQualifiedName'] = @@ -306,7 +306,7 @@ class AttributeSet extends MetadataType { delete attr[type + 'ConnectingID']; } else { throw new Error( - `Could not find ${type}AttributeID ${id} of relationship ${relationship.relationshipID}`, + `Could not find ${type}AttributeID ${id} of relationship ${relationship.relationshipID}` ); } } @@ -314,7 +314,7 @@ class AttributeSet extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} / ${ metadata[this.definition.keyField] - }: ${ex.message}`, + }: ${ex.message}` ); } } @@ -348,7 +348,7 @@ class AttributeSet extends MetadataType { this.systemValueDefinitions ||= {}; if (!this.systemValueDefinitions[this.buObject.mid]) { this.systemValueDefinitions[this.buObject.mid] = Object.values( - cache.getCache()['attributeSet'], + cache.getCache()['attributeSet'] ) .flatMap((item) => { if (item.isSystemDefined) { diff --git a/lib/metadataTypes/Automation.js b/lib/metadataTypes/Automation.js index 0b014b117..e6f05f76f 100644 --- a/lib/metadataTypes/Automation.js +++ b/lib/metadataTypes/Automation.js @@ -48,7 +48,7 @@ class Automation extends MetadataType { const results = await this.client.soap.retrieveBulk( 'Program', ['ObjectID'], - requestParams, + requestParams ); // the API seems to handle 50 concurrent requests nicely const response = results?.Results?.length @@ -58,7 +58,7 @@ class Automation extends MetadataType { uri: '/automation/v1/automations/' + item.ObjectID, })), 50, - !key, + !key ) : null; metadataMap = response?.metadata || {}; @@ -75,7 +75,7 @@ class Automation extends MetadataType { metadataMap = await this.saveResults(metadataMap, retrieveDir, null, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(metadataMap).length})` + - Util.getKeysString(key), + Util.getKeysString(key) ); await this.runDocumentOnRetrieve(key, metadataMap); @@ -122,7 +122,7 @@ class Automation extends MetadataType { this.definition.bodyIteratorField = 'entry'; const automationLegacyMapObj = await super.retrieveREST( undefined, - `/legacy/v1/beta/bulk/automations/automation/definition/`, + `/legacy/v1/beta/bulk/automations/automation/definition/` ); this.definition.bodyIteratorField = iteratorBackup; const automationLegacyMap = Object.keys(automationLegacyMapObj.metadata) @@ -143,7 +143,7 @@ class Automation extends MetadataType { // this is a file so extended is at another endpoint try { const notificationsResult = await this.client.rest.get( - '/legacy/v1/beta/automations/notifications/' + automationLegacy.id, + '/legacy/v1/beta/automations/notifications/' + automationLegacy.id ); if (Array.isArray(notificationsResult?.workers)) { metadataMap[automationLegacy.key].notifications = @@ -166,20 +166,18 @@ class Automation extends MetadataType { } } catch (ex) { Util.logger.debug( - ` ☇ issue retrieving Notifications for automation ${automationLegacy.key}: ${ex.message} ${ex.code}`, + ` ☇ issue retrieving Notifications for automation ${automationLegacy.key}: ${ex.message} ${ex.code}` ); skipped++; } - }), - ), + }) + ) ); Util.logger.info( - Util.getGrayMsg( - ` Notifications found for ${found} automation${found === 1 ? '' : 's'}`, - ), + Util.getGrayMsg(` Notifications found for ${found} automation${found === 1 ? '' : 's'}`) ); Util.logger.debug( - `Notifications not found for ${skipped} automation${skipped === 1 ? '' : 's'}`, + `Notifications not found for ${skipped} automation${skipped === 1 ? '' : 's'}` ); return promiseMap; } @@ -213,9 +211,9 @@ class Automation extends MetadataType { operator: 'equals', rightOperand: a.ObjectID, }, - }, - ), - ), + } + ) + ) ) : []) { details.push(...item.Results); @@ -256,7 +254,7 @@ class Automation extends MetadataType { this.definition.bodyIteratorField = 'entry'; const automationsLegacy = await super.retrieveREST( undefined, - `/legacy/v1/beta/bulk/automations/automation/definition/`, + `/legacy/v1/beta/bulk/automations/automation/definition/` ); this.definition.keyField = keyBackup; this.definition.bodyIteratorField = iteratorBackup; @@ -300,7 +298,7 @@ class Automation extends MetadataType { return; } let details = await this.client.rest.get( - '/automation/v1/automations/' + metadata.ObjectID, + '/automation/v1/automations/' + metadata.ObjectID ); const metadataMap = this.parseResponseBody({ items: [details] }); if (Object.keys(metadataMap).length) { @@ -317,7 +315,7 @@ class Automation extends MetadataType { originalKey = parsedDetails[this.definition.keyField]; if (parsedDetails !== null) { val = JSON.parse( - Util.replaceByObject(JSON.stringify(parsedDetails), templateVariables), + Util.replaceByObject(JSON.stringify(parsedDetails), templateVariables) ); } } catch { @@ -325,7 +323,7 @@ class Automation extends MetadataType { } if (val === null) { throw new Error( - `Automations '${name}' was skipped and hence cannot be used for templating.`, + `Automations '${name}' was skipped and hence cannot be used for templating.` ); } // remove all fields not listed in Definition for templating @@ -333,7 +331,7 @@ class Automation extends MetadataType { await File.writeJSONToFile( [templateDir, this.definition.type].join('/'), originalKey + '.' + this.definition.type + '-meta', - val, + val ); Util.logger.info(`- templated ${this.definition.type}: ${name}`); return { metadata: val, type: this.definition.type }; @@ -360,7 +358,7 @@ class Automation extends MetadataType { } } catch { Util.logger.debug( - `- Schedule name '${metadata.schedule.timezoneName}' not found in definition.timeZoneMapping`, + `- Schedule name '${metadata.schedule.timezoneName}' not found in definition.timeZoneMapping` ); } return true; @@ -408,14 +406,14 @@ class Automation extends MetadataType { // get metadata type of activity activity.r__type = Util.inverseGet( this.definition.activityTypeMapping, - activity.objectTypeId, + activity.objectTypeId ); delete activity.objectTypeId; } catch { Util.logger.warn( ` - Unknown activity type '${activity.objectTypeId}'` + ` in step ${stepNumber}.${activity.displayOrder}` + - ` of Automation '${metadata.name}'`, + ` of Automation '${metadata.name}'` ); continue; } @@ -431,7 +429,7 @@ class Automation extends MetadataType { metadata[this.definition.keyField] } activity ${stepNumber}.${ activity.displayOrder - } due to missing activityObjectId: ${JSON.stringify(activity)}`, + } due to missing activityObjectId: ${JSON.stringify(activity)}` ); // empty if block continue; @@ -443,7 +441,7 @@ class Automation extends MetadataType { activity.displayOrder } because the type ${ activity.r__type - } is not set up as a dependency for ${this.definition.type}`, + } is not set up as a dependency for ${this.definition.type}` ); continue; } @@ -458,12 +456,12 @@ class Automation extends MetadataType { activity.r__type, activity.activityObjectId, Definitions[activity.r__type].idField, - Definitions[activity.r__type].nameField, + Definitions[activity.r__type].nameField ); if (name !== activity.name) { Util.logger.debug( ` - updated name of step ${stepNumber}.${activity.displayOrder}` + - ` in Automation '${metadata.name}' from ${activity.name} to ${name}`, + ` in Automation '${metadata.name}' from ${activity.name} to ${name}` ); activity.name = name; } @@ -472,14 +470,14 @@ class Automation extends MetadataType { Util.logger.warn( ` - Missing ${activity.r__type} activity '${activity.name}'` + ` in step ${stepNumber}.${activity.displayOrder}` + - ` of Automation '${metadata.name}' (${ex.message})`, + ` of Automation '${metadata.name}' (${ex.message})` ); } } else { Util.logger.warn( ` - Missing ${activity.r__type} activity '${activity.name}'` + ` in step ${stepNumber}.${activity.displayOrder}` + - ` of Automation '${metadata.name}' (Not Found in Cache)`, + ` of Automation '${metadata.name}' (Not Found in Cache)` ); } } @@ -490,7 +488,7 @@ class Automation extends MetadataType { Util.logger.warn( ` - ${this.definition.typeName} '${metadata[this.definition.nameField]}': ${ ex.message - }`, + }` ); return null; } @@ -513,7 +511,7 @@ class Automation extends MetadataType { metadataMap[resultKey] = results.metadata[resultKey]; } else { Util.logger.error( - ` - skipping ${this.definition.type} ${results.metadata[resultKey].name}: no valid schedule settings found.`, + ` - skipping ${this.definition.type} ${results.metadata[resultKey].name}: no valid schedule settings found.` ); } } @@ -535,14 +533,14 @@ class Automation extends MetadataType { Util.OPTIONS.schedule ? 'according to schedule' : 'to run once (use --schedule or --execute=schedule to schedule instead)' - }: ${Object.keys(metadataMap).length}`, + }: ${Object.keys(metadataMap).length}` ); const promiseResults = []; for (const key of Object.keys(metadataMap)) { if (Util.OPTIONS.schedule && metadataMap[key].status === 'Scheduled') { // schedule Util.logger.info( - ` - skipping ${this.definition.type} ${metadataMap[key].name}: already scheduled.`, + ` - skipping ${this.definition.type} ${metadataMap[key].name}: already scheduled.` ); } else { // schedule + runOnce @@ -596,7 +594,7 @@ class Automation extends MetadataType { return errors.map((msg) => msg .split('403 Forbidden') - .join('403 Forbidden: Please check if the automation is currently running.'), + .join('403 Forbidden: Please check if the automation is currently running.') ); } return errors; @@ -619,7 +617,7 @@ class Automation extends MetadataType { metadataMap[key] = results.metadata[key]; } else { Util.logger.error( - ` - skipping ${this.definition.type} ${results.metadata[key].name}: no valid schedule settings found.`, + ` - skipping ${this.definition.type} ${results.metadata[key].name}: no valid schedule settings found.` ); } } @@ -634,7 +632,7 @@ class Automation extends MetadataType { promiseResults.push(this.#pauseItem(metadataMap[key])); } else if (metadataMap[key].status === 'PausedSchedule') { Util.logger.info( - ` - skipping ${this.definition.type} ${metadataMap[key].name}: already paused.`, + ` - skipping ${this.definition.type} ${metadataMap[key].name}: already paused.` ); } else { Util.logger.error( @@ -642,7 +640,7 @@ class Automation extends MetadataType { metadataMap[key].name }: currently ${metadataMap[ key - ].status.toLowerCase()}. Please try again in a few minutes.`, + ].status.toLowerCase()}. Please try again in a few minutes.` ); } } @@ -673,12 +671,12 @@ class Automation extends MetadataType { }, }, 'pause', - {}, + {} ); Util.logger.info( ` - paused ${this.definition.type}: ${metadata[this.definition.keyField]} / ${ metadata[this.definition.nameField] - }`, + }` ); return { key: metadata[this.definition.keyField], response }; } catch (ex) { @@ -734,7 +732,7 @@ class Automation extends MetadataType { metadata[this.definition.keyField] || metadata[this.definition.nameField] } / ${ metadata[this.definition.nameField] - }: You cannot update an automation that's currently running. Please wait a bit and retry.`, + }: You cannot update an automation that's currently running. Please wait a bit and retry.` ); return null; } @@ -757,7 +755,7 @@ class Automation extends MetadataType { this.definition.timeZoneMapping[metadata.schedule.timezoneName]; } else { Util.logger.error( - `Could not find timezone ${metadata.schedule.timezoneName} in definition.timeZoneMapping`, + `Could not find timezone ${metadata.schedule.timezoneName} in definition.timeZoneMapping` ); } @@ -836,8 +834,8 @@ class Automation extends MetadataType { activity.name } to ${ this.createdKeyMap[buName].verification[activity.name] - }`, - ), + }` + ) ); // map structure: cred/bu --> type --> old key --> new key activity.name = @@ -848,7 +846,7 @@ class Automation extends MetadataType { activity.r__type, activity.name, Definitions[activity.r__type].nameField, - Definitions[activity.r__type].idField, + Definitions[activity.r__type].idField ); } activity.objectTypeId = @@ -888,13 +886,13 @@ class Automation extends MetadataType { // check if manual deploy required. if so then log warning if (this.definition.manualDeployTypes.includes(activity.r__type)) { Util.logger.warn( - `- ${this.definition.type} '${metadata.name}' requires additional manual configuration: '${activity.name}' in step ${stepNumber}.${displayOrder}`, + `- ${this.definition.type} '${metadata.name}' requires additional manual configuration: '${activity.name}' in step ${stepNumber}.${displayOrder}` ); } // cannot deploy because it is not supported else if (!this.definition.dependencies.includes(activity.r__type)) { errors.push( - ` • not supported ${activity.r__type} activity '${activity.name}' in step ${stepNumber}.${displayOrder}`, + ` • not supported ${activity.r__type} activity '${activity.name}' in step ${stepNumber}.${displayOrder}` ); deployable = false; } @@ -905,7 +903,7 @@ class Automation extends MetadataType { Util.logger.error( ` ☇ skipping ${this.definition.type} ${metadata[this.definition.keyField]} / ${ metadata[this.definition.nameField] - }:`, + }:` ); for (const error of errors) { Util.logger.error(error); @@ -955,7 +953,7 @@ class Automation extends MetadataType { // not existing for triggered automations scheduleHelper.timezoneName ||= Util.inverseGet( this.definition.timeZoneMapping, - scheduleHelper.timezoneId, + scheduleHelper.timezoneId ); } @@ -1008,7 +1006,7 @@ class Automation extends MetadataType { try { const result = await this.client.rest.post( '/legacy/v1/beta/automations/notifications/' + programId, - notificationBody, + notificationBody ); if (result) { // should be empty if all OK @@ -1016,13 +1014,13 @@ class Automation extends MetadataType { } } catch (ex) { Util.logger.error( - `Error updating notifications for automation '${metadataMap[key].name}': ${ex.message} (${ex.code}))`, + `Error updating notifications for automation '${metadataMap[key].name}': ${ex.message} (${ex.code}))` ); } Util.logger.info( Util.getGrayMsg( - ` - updated notifications for automation '${metadataMap[key].name}'`, - ), + ` - updated notifications for automation '${metadataMap[key].name}'` + ) ); } } @@ -1048,7 +1046,7 @@ class Automation extends MetadataType { schedule = this._buildSchedule(originalMetadataMap[oldKey].schedule); } catch (ex) { Util.logger.error( - `- Could not create schedule for automation '${originalMetadataMap[oldKey].name}' to start it: ${ex.message}`, + `- Could not create schedule for automation '${originalMetadataMap[oldKey].name}' to start it: ${ex.message}` ); } if (schedule !== null) { @@ -1070,7 +1068,7 @@ class Automation extends MetadataType { }, }, 'start', - {}, + {} ); const intervalString = (schedule_interval > 1 ? `${schedule_interval} ` : '') + @@ -1083,20 +1081,20 @@ class Automation extends MetadataType { originalMetadataMap[oldKey].name }' deployed as Active: runs every ${intervalString} starting ${ schedule_StartDateTime.split('T').join(' ').split('.')[0] - } ${schedule_timezoneString}`, + } ${schedule_timezoneString}` ); } catch { // API does not return anything usefull here. We have to know the rules instead Util.logger.error( - ` ☇ error starting scheduled ${this.definition.type}${key}: Please check schedule settings`, + ` ☇ error starting scheduled ${this.definition.type}${key}: Please check schedule settings` ); } } } else { Util.logger.info( Util.getGrayMsg( - ` - scheduled automation '${originalMetadataMap[oldKey].name}' deployed as Paused`, - ), + ` - scheduled automation '${originalMetadataMap[oldKey].name}' deployed as Paused` + ) ); } } @@ -1126,7 +1124,7 @@ class Automation extends MetadataType { 'folder', metadata[folderIdField], 'ID', - 'Path', + 'Path' ); delete metadata[folderIdField]; if (metadata.r__folder_Path !== 'my automations') { @@ -1135,14 +1133,14 @@ class Automation extends MetadataType { metadata[this.definition.nameField] }' is located in subfolder ${ metadata.r__folder_Path - }. Please note that creating automation folders is not supported via API and hence you will have to create it manually in the GUI if you choose to deploy this automation.`, + }. Please note that creating automation folders is not supported via API and hence you will have to create it manually in the GUI if you choose to deploy this automation.` ); } } catch (ex) { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }): Could not find folder (${ex.message})`, + }): Could not find folder (${ex.message})` ); } } @@ -1158,7 +1156,7 @@ class Automation extends MetadataType { 'folder', metadata.r__folder_Path, 'Path', - 'ID', + 'ID' ); if (metadata.r__folder_Path !== 'my automations') { Util.logger.warn( @@ -1166,13 +1164,13 @@ class Automation extends MetadataType { metadata[this.definition.nameField] }' is located in subfolder ${ metadata.r__folder_Path - }. Please note that creating automation folders is not supported via API and hence you will have to create it manually in the GUI if you choose to deploy this automation.`, + }. Please note that creating automation folders is not supported via API and hence you will have to create it manually in the GUI if you choose to deploy this automation.` ); } delete metadata.r__folder_Path; } catch { throw new Error( - `Folder '${metadata.r__folder_Path}' was not found on the server. Please create this manually in the GUI. Automation-folders cannot be deployed automatically.`, + `Folder '${metadata.r__folder_Path}' was not found on the server. Please create this manually in the GUI. Automation-folders cannot be deployed automatically.` ); } } @@ -1224,12 +1222,12 @@ class Automation extends MetadataType { // todo: add support for monthly // todo: add support for yearly throw new Error( - 'Scheduling automatically not supported for Weekly, Monthly and Yearly, please configure manually.', + 'Scheduling automatically not supported for Weekly, Monthly and Yearly, please configure manually.' ); } if (recurHelper.FREQ === 'MINUTELY' && recurHelper.INTERVAL && recurHelper.INTERVAL < 5) { throw new Error( - 'The smallest interval you can configure is 5 minutes. Please adjust your schedule.', + 'The smallest interval you can configure is 5 minutes. Please adjust your schedule.' ); } @@ -1238,7 +1236,7 @@ class Automation extends MetadataType { this.definition.timeZoneMapping[scheduleObject.timezoneName]; } else { throw new Error( - `Could not find timezone ${scheduleObject.timezoneName} in definition.timeZoneMapping`, + `Could not find timezone ${scheduleObject.timezoneName} in definition.timeZoneMapping` ); } schedule.TimeZone.ID = scheduleObject.timezoneId; @@ -1282,7 +1280,7 @@ class Automation extends MetadataType { // earliest start 1 minute from now // the same time which would slow performance futureDate.setMinutes( - futureDate.getMinutes() + 1 + Math.ceil(Math.random() * 15), + futureDate.getMinutes() + 1 + Math.ceil(Math.random() * 15) ); break; @@ -1300,7 +1298,7 @@ class Automation extends MetadataType { schedule.StartDateTime = this._calcTime( this.properties.options.serverTimeOffset, schedule.StartDateTime, - schedule._timezoneString, + schedule._timezoneString ); if (recurHelper.UNTIL) { @@ -1436,7 +1434,7 @@ class Automation extends MetadataType { column.description ? `
_${column.description.replaceAll('\n', '
')}
_` : '' - } `, + } ` ); tableSeparator += '| --- '; } @@ -1470,7 +1468,7 @@ class Automation extends MetadataType { json.steps.map((step, index) => ({ title: `Step ${index + 1}`, description: step.name || '-', - })), + })) ); let maxActivities = 0; for (const step of json.steps) { @@ -1487,8 +1485,8 @@ class Automation extends MetadataType { name: step.activities[activityIndex].name, type: step.activities[activityIndex].r__type, } - : null, - ), + : null + ) ); } } @@ -1518,7 +1516,7 @@ class Automation extends MetadataType { this.buObject.credential, this.buObject.businessUnit, ]), - true, + true ).automation; } const docPath = File.normalizePath([ @@ -1533,8 +1531,8 @@ class Automation extends MetadataType { } return await Promise.all( Object.keys(metadata).map((key) => - this._writeDoc(docPath + '/', key, metadata[key], 'md'), - ), + this._writeDoc(docPath + '/', key, metadata[key], 'md') + ) ); } } diff --git a/lib/metadataTypes/Campaign.js b/lib/metadataTypes/Campaign.js index 98326dc08..00032f1d7 100644 --- a/lib/metadataTypes/Campaign.js +++ b/lib/metadataTypes/Campaign.js @@ -25,17 +25,17 @@ class Campaign extends MetadataType { retrieveDir, '/legacy/v1/beta2/data/campaign/', null, - key, + key ); // get assignments Util.logger.info(`Retrieving: campaignAsset`); const campaignAssets = await Promise.all( Object.keys(res.metadata).map((key) => - this.getAssetTags(retrieveDir, res.metadata[key].campaignId, key), - ), + this.getAssetTags(retrieveDir, res.metadata[key].campaignId, key) + ) ); Util.logger.info( - `Downloaded: campaignAsset (${campaignAssets.flat().length})` + Util.getKeysString(key), + `Downloaded: campaignAsset (${campaignAssets.flat().length})` + Util.getKeysString(key) ); return res; @@ -64,7 +64,7 @@ class Campaign extends MetadataType { await File.writeJSONToFile( `${retrieveDir}/campaign/${name}/assets/`, asset.id + '.campaignAsset-meta', - asset, + asset ); } return res.items; diff --git a/lib/metadataTypes/ContentArea.js b/lib/metadataTypes/ContentArea.js index 6bb18163f..a67049c92 100644 --- a/lib/metadataTypes/ContentArea.js +++ b/lib/metadataTypes/ContentArea.js @@ -22,7 +22,7 @@ class ContentArea extends MetadataType { */ static retrieve(retrieveDir, _, __, key) { Util.logger.warn( - ' - Classic Content Areas are deprecated and will be discontinued by SFMC in the near future. Ensure that you migrate any existing Content Areas to Content Builder as soon as possible.', + ' - Classic Content Areas are deprecated and will be discontinued by SFMC in the near future. Ensure that you migrate any existing Content Areas to Content Builder as soon as possible.' ); /** @type {TYPE.SoapRequestParams} */ let requestParams = null; @@ -58,14 +58,14 @@ class ContentArea extends MetadataType { 'folder', metadata[this.definition.folderIdField], 'ID', - 'Path', + 'Path' ); delete metadata[this.definition.folderIdField]; } catch (ex) { Util.logger.debug( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }): Could not find folder (${ex.message})`, + }): Could not find folder (${ex.message})` ); // classic content blocks that reside in the main folder are // saved with CategoryID=0, instead of to the actual ID of diff --git a/lib/metadataTypes/DataExtension.js b/lib/metadataTypes/DataExtension.js index 10a9d349f..5e4a8cad5 100644 --- a/lib/metadataTypes/DataExtension.js +++ b/lib/metadataTypes/DataExtension.js @@ -62,7 +62,7 @@ class DataExtension extends MetadataType { Util.logger.error( ` ☇ skipping ${this.definition.type} ${ metadataMap[metadataKey][this.definition.keyField] - } / ${metadataMap[metadataKey][this.definition.nameField]}: ${ex.message}`, + } / ${metadataMap[metadataKey][this.definition.nameField]}: ${ex.message}` ); delete metadataMap[metadataKey]; // skip rest of handling for this DE @@ -74,12 +74,12 @@ class DataExtension extends MetadataType { metadataKey, false, metadataToUpdate, - metadataToCreate, + metadataToCreate ); } if (metadataToUpdate.length) { Util.logger.info( - ' - Please note that Data Retention Policies can only be set during creation, not during update.', + ' - Please note that Data Retention Policies can only be set during creation, not during update.' ); } const createLimit = pLimit(10); @@ -87,7 +87,7 @@ class DataExtension extends MetadataType { await Promise.allSettled( metadataToCreate .filter((r) => r !== undefined && r !== null) - .map((metadataEntry) => createLimit(() => this.create(metadataEntry))), + .map((metadataEntry) => createLimit(() => this.create(metadataEntry))) ) ) .filter((r) => r !== undefined && r !== null) @@ -99,8 +99,8 @@ class DataExtension extends MetadataType { metadataToUpdate .filter((r) => r !== undefined && r !== null) .map((metadataEntry) => - updateLimit(() => this.update(metadataEntry.after, metadataEntry.before)), - ), + updateLimit(() => this.update(metadataEntry.after, metadataEntry.before)) + ) ) ) .filter((r) => r !== undefined && r !== null) @@ -109,7 +109,7 @@ class DataExtension extends MetadataType { const successfulResults = [...createResults, ...updateResults]; Util.logger.info( `${this.definition.type} upsert: ${createResults.length} of ${metadataToCreate.length} created / ${updateResults.length} of ${metadataToUpdate.length} updated` + - (filteredByPreDeploy > 0 ? ` / ${filteredByPreDeploy} filtered` : ''), + (filteredByPreDeploy > 0 ? ` / ${filteredByPreDeploy} filtered` : '') ); let upsertResults; if (successfulResults.length > 0) { @@ -150,14 +150,14 @@ class DataExtension extends MetadataType { metadataKey, hasError, metadataToUpdate, - metadataToCreate, + metadataToCreate ) { const action = await super.createOrUpdate( metadataMap, metadataKey, hasError, metadataToUpdate, - metadataToCreate, + metadataToCreate ); if (action === 'update') { @@ -169,7 +169,7 @@ class DataExtension extends MetadataType { DataExtension.oldFields[metadataMap[metadataKey][this.definition.keyField]] = await DataExtensionField.prepareDeployColumnsOnUpdate( metadataMap[metadataKey].Fields, - metadataKey, + metadataKey ); if ( @@ -178,7 +178,7 @@ class DataExtension extends MetadataType { ) { // changeKeyValue / changeKeyField used Util.logger.warn( - ` - ${this.definition.type} ${metadataKey}: Cannot change fields while updating the key. Skipping field update in favor of key update.`, + ` - ${this.definition.type} ${metadataKey}: Cannot change fields while updating the key. Skipping field update in favor of key update.` ); metadataMap[metadataKey].Fields.length = 0; } @@ -225,7 +225,7 @@ class DataExtension extends MetadataType { '- error upserting dataExtension: ' + (res.value.Results[0].Object ? res.value.Results[0].Object.Name : '') + '. ' + - res.value.Results[0].StatusMessage, + res.value.Results[0].StatusMessage ); return false; } else if (res.status === 'fulfilled' && res?.value?.faultstring) { @@ -264,7 +264,7 @@ class DataExtension extends MetadataType { ) { metadata.RetainUntil = ''; Util.logger.warn( - ` - RetainUntil date was reset automatically because RetentionPeriod info was found in: ${metadata.CustomerKey}`, + ` - RetainUntil date was reset automatically because RetentionPeriod info was found in: ${metadata.CustomerKey}` ); } } @@ -315,7 +315,7 @@ class DataExtension extends MetadataType { // get list of updated fields /** @type {TYPE.DataExtensionFieldItem[]} */ const updatedFieldsArr = originalMetadata[oldKey].Fields.Field.filter( - (field) => field.ObjectID && field.ObjectID !== '', + (field) => field.ObjectID && field.ObjectID !== '' ); // convert existing fields obj into array and sort /** @type {TYPE.DataExtensionFieldItem[]} */ @@ -326,7 +326,7 @@ class DataExtension extends MetadataType { // check if the current field was updated and then override with it. otherwise use existing value const field = updatedFieldsArr.find( - (field) => field.ObjectID === existingField.ObjectID, + (field) => field.ObjectID === existingField.ObjectID ) || existingField; // field does not have a ordinal value because we rely on array order field.Ordinal = existingField.Ordinal; @@ -339,7 +339,7 @@ class DataExtension extends MetadataType { // get list of new fields /** @type {TYPE.DataExtensionFieldItem[]} */ const newFieldsArr = originalMetadata[oldKey].Fields.Field.filter( - (field) => !field.ObjectID, + (field) => !field.ObjectID ); // push new fields to end of list if (newFieldsArr.length) { @@ -384,7 +384,7 @@ class DataExtension extends MetadataType { // find all shared data extensions if (!this.deployedSharedKeys.length) { Util.logger.debug( - `Skipping fixShared logic because no Shared Data Extensions were updated`, + `Skipping fixShared logic because no Shared Data Extensions were updated` ); return; } @@ -409,7 +409,7 @@ class DataExtension extends MetadataType { key, 'CustomerKey', 'ObjectID', - this.buObject.eid, + this.buObject.eid ); sharedDataExtensionMap[id] = key; } catch { @@ -420,7 +420,7 @@ class DataExtension extends MetadataType { // run the fix-data-model logic Util.logger.info( `Fixing Shared Data Extensions details in data models of child BUs` + - Util.getKeysString(sharedDataExtensionsKeys), + Util.getKeysString(sharedDataExtensionsKeys) ); for (const buName of selectedBuNames) { @@ -433,10 +433,10 @@ class DataExtension extends MetadataType { this.client = clientBak; } else { Util.logger.warn( - 'Shared Data Extensions were updated but --fixShared option is not set. This can result in your changes not being visible in attribute groups on child BUs.', + 'Shared Data Extensions were updated but --fixShared option is not set. This can result in your changes not being visible in attribute groups on child BUs.' ); Util.logger.info( - 'We recommend to re-run your deployment with the --fixShared option unless you are sure your Shared Data Extension is not used in attribute groups on any child BU.', + 'We recommend to re-run your deployment with the --fixShared option unless you are sure your Shared Data Extension is not used in attribute groups on any child BU.' ); } } @@ -450,7 +450,7 @@ class DataExtension extends MetadataType { const buListObj = this.properties.credentials[this.buObject.credential].businessUnits; const fixBuPreselected = []; const availableBuNames = Object.keys(buListObj).filter( - (buName) => buName !== Util.parentBuName, + (buName) => buName !== Util.parentBuName ); if (typeof Util.OPTIONS.fixShared === 'string') { if (Util.OPTIONS.fixShared === '*') { @@ -463,7 +463,7 @@ class DataExtension extends MetadataType { .split(',') .filter(Boolean) .map((bu) => bu.trim()) - .filter((bu) => availableBuNames.includes(bu)), + .filter((bu) => availableBuNames.includes(bu)) ); } } @@ -507,7 +507,7 @@ class DataExtension extends MetadataType { childBuName, buObjectParent, clientParent, - sharedDataExtensionMap, + sharedDataExtensionMap ) { /** @type {TYPE.BuObject} */ const buObjectChildBu = { @@ -525,15 +525,15 @@ class DataExtension extends MetadataType { AttributeSet.client = clientChildBu; const sharedDeIdsUsedOnBU = await AttributeSet.fixShared_retrieve( sharedDataExtensionMap, - DataExtensionField.fixShared_fields, + DataExtensionField.fixShared_fields ); if (sharedDeIdsUsedOnBU.length) { let sharedDataExtensionsKeys = sharedDeIdsUsedOnBU.map( - (deId) => sharedDataExtensionMap[deId], + (deId) => sharedDataExtensionMap[deId] ); Util.logger.info( ` - Fixing dataExtensions on BU ${childBuName} ` + - Util.getKeysString(sharedDataExtensionsKeys), + Util.getKeysString(sharedDataExtensionsKeys) ); for (const deId of sharedDeIdsUsedOnBU) { @@ -544,12 +544,12 @@ class DataExtension extends MetadataType { buObjectChildBu, clientChildBu, buObjectParent, - clientParent, + clientParent ); if (!fixed) { // remove from list of shared DEs that were fixed sharedDataExtensionsKeys = sharedDataExtensionsKeys.filter( - (key) => key !== sharedDataExtensionMap[deId], + (key) => key !== sharedDataExtensionMap[deId] ); } } @@ -557,15 +557,15 @@ class DataExtension extends MetadataType { Util.logger.debug( ` - Fixed ${sharedDataExtensionsKeys.length}/${ sharedDeIdsUsedOnBU.length - }: ${sharedDataExtensionsKeys.join(', ')}`, + }: ${sharedDataExtensionsKeys.join(', ')}` ); } return sharedDataExtensionsKeys; } else { Util.logger.info( Util.getGrayMsg( - ` - No matching attributeSet found for given Shared Data Extensions keys found on BU ${childBuName}`, - ), + ` - No matching attributeSet found for given Shared Data Extensions keys found on BU ${childBuName}` + ) ); return []; } @@ -593,7 +593,7 @@ class DataExtension extends MetadataType { buObjectChildBu, clientChildBu, buObjectParent, - clientParent, + clientParent ) { try { // add field via child BU @@ -601,7 +601,7 @@ class DataExtension extends MetadataType { buObjectChildBu, clientChildBu, deKey, - deId, + deId ); // get field ID from parent BU (it is not returned on child BU) @@ -609,7 +609,7 @@ class DataExtension extends MetadataType { randomSuffix, buObjectParent, clientParent, - deKey, + deKey ); // delete field via child BU @@ -618,17 +618,17 @@ class DataExtension extends MetadataType { buObjectChildBu, clientChildBu, deKey, - fieldObjectID, + fieldObjectID ); Util.logger.info( - ` - Fixed dataExtension ${deKey} on BU ${buObjectChildBu.businessUnit}`, + ` - Fixed dataExtension ${deKey} on BU ${buObjectChildBu.businessUnit}` ); return true; } catch (ex) { Util.logger.error( - `- error fixing dataExtension ${deKey} on BU ${buObjectChildBu.businessUnit}: ${ex.message}`, + `- error fixing dataExtension ${deKey} on BU ${buObjectChildBu.businessUnit}: ${ex.message}` ); return false; } @@ -669,7 +669,7 @@ class DataExtension extends MetadataType { ], }, }, - null, + null ); return randomSuffix; } @@ -696,7 +696,7 @@ class DataExtension extends MetadataType { rightOperand: fieldKey, }, }, - ['Name', 'ObjectID'], + ['Name', 'ObjectID'] ); const fieldObjectID = fieldResponse.metadata[fieldKey]?.ObjectID; return fieldObjectID; @@ -718,13 +718,13 @@ class DataExtension extends MetadataType { buObjectChildBu, clientChildBu, deKey, - fieldObjectID, + fieldObjectID ) { DataExtensionField.buObject = buObjectChildBu; DataExtensionField.client = clientChildBu; await DataExtensionField.deleteByKeySOAP( deKey + '.TriggerUpdate' + randomSuffix, - fieldObjectID, + fieldObjectID ); } @@ -774,7 +774,7 @@ class DataExtension extends MetadataType { const savedMetadata = await super.saveResults(metadata, retrieveDir, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(key), + Util.getKeysString(key) ); await this.runDocumentOnRetrieve(key, savedMetadata); } @@ -831,7 +831,7 @@ class DataExtension extends MetadataType { metadataParentBu[metadataEntry].CategoryID, 'ID', 'ContentType', - this.buObject.eid, + this.buObject.eid ); if (!folderTypesFromParent.includes(folderContentType)) { // Util.logger.verbose( @@ -841,7 +841,7 @@ class DataExtension extends MetadataType { } } catch (ex) { Util.logger.debug( - `removing ${metadataEntry} because of error while retrieving r__folder_ContentType: ${ex.message}`, + `removing ${metadataEntry} because of error while retrieving r__folder_ContentType: ${ex.message}` ); delete metadataParentBu[metadataEntry]; } @@ -921,7 +921,7 @@ class DataExtension extends MetadataType { 'dataExtensionTemplate', metadata.Template.CustomerKey, 'CustomerKey', - 'Name', + 'Name' ); delete metadata.Template; } catch (ex) { @@ -933,7 +933,7 @@ class DataExtension extends MetadataType { Util.logger.warn( ` - Issue with dataExtension '${ metadata[this.definition.nameField] - }': Could not find specified DataExtension Template. Please note that DataExtensions based on SMSMessageTracking and SMSSubscriptionLog cannot be deployed automatically across BUs at this point.`, + }': Could not find specified DataExtension Template. Please note that DataExtensions based on SMSMessageTracking and SMSSubscriptionLog cannot be deployed automatically across BUs at this point.` ); } } @@ -1027,7 +1027,7 @@ class DataExtension extends MetadataType { } if (metadata.r__folder_Path?.startsWith('Synchronized Data Extensions')) { throw new Error( - `Cannot Create/Update a Synchronized Data Extension. Please use Contact Builder to maintain these`, + `Cannot Create/Update a Synchronized Data Extension. Please use Contact Builder to maintain these` ); } @@ -1057,7 +1057,7 @@ class DataExtension extends MetadataType { 'dataExtensionTemplate', metadata.r__dataExtensionTemplate_Name, 'Name', - 'CustomerKey', + 'CustomerKey' ), }; delete metadata.r__dataExtensionTemplate_Name; @@ -1068,7 +1068,7 @@ class DataExtension extends MetadataType { // A workaround for cross-BU deploy exists but it's likely not beneficial to explain to users: // Create a DE based on the not-supported template on the target BU, retrieve it, copy the Template.CustomerKey into the to-be-deployed DE (or use mcdev-templating), done throw new Error( - `Could not find specified DataExtension Template. Please note that DataExtensions based on SMSMessageTracking and SMSSubscriptionLog cannot be deployed automatically across BUs at this point.`, + `Could not find specified DataExtension Template. Please note that DataExtensions based on SMSMessageTracking and SMSSubscriptionLog cannot be deployed automatically across BUs at this point.` ); } } @@ -1253,7 +1253,7 @@ class DataExtension extends MetadataType { this.buObject.credential, this.buObject.businessUnit, ]), - true, + true ).dataExtension; } } catch (ex) { @@ -1299,7 +1299,7 @@ class DataExtension extends MetadataType { key, metadataMap[key], 'html', - columnsToPrint, + columnsToPrint ); } if (['md', 'both'].includes(this.properties.options.documentType)) { @@ -1308,11 +1308,11 @@ class DataExtension extends MetadataType { key, metadataMap[key], 'md', - columnsToPrint, + columnsToPrint ); } } - }), + }) ); } @@ -1380,17 +1380,17 @@ class DataExtension extends MetadataType { const originalKey = key; const metadataCleaned = JSON.parse( - JSON.stringify(await this.postRetrieveTasks(metadata[key])), + JSON.stringify(await this.postRetrieveTasks(metadata[key])) ); this.keepTemplateFields(metadataCleaned); const metadataTemplated = JSON.parse( - Util.replaceByObject(JSON.stringify(metadataCleaned), templateVariables), + Util.replaceByObject(JSON.stringify(metadataCleaned), templateVariables) ); await File.writeJSONToFile( [templateDir, this.definition.type].join('/'), originalKey + '.' + this.definition.type + '-meta', - metadataTemplated, + metadataTemplated ); } catch (ex) { Util.metadataLogger('error', this.definition.type, 'retrieve', ex, key); @@ -1415,7 +1415,7 @@ class DataExtension extends MetadataType { 'folder', metadata[this.definition.folderIdField], 'ID', - 'ContentType', + 'ContentType' ); } catch (ex) { if (/(_Salesforce)(_\d\d?\d?)?$/.test(metadata.Name)) { @@ -1426,7 +1426,7 @@ class DataExtension extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }): Could not find folder (${ex.message})`, + }): Could not find folder (${ex.message})` ); } } @@ -1436,7 +1436,7 @@ class DataExtension extends MetadataType { 'folder', metadata[this.definition.folderIdField], 'ID', - 'Path', + 'Path' ); delete metadata[this.definition.folderIdField]; } catch (ex) { @@ -1446,14 +1446,14 @@ class DataExtension extends MetadataType { if (!verbose) { Util.logger.verbose( - `Synchronized Data Extension of other BU found: '${metadata.Name}'. Setting folder to 'Synchronized Data Extensions'`, + `Synchronized Data Extension of other BU found: '${metadata.Name}'. Setting folder to 'Synchronized Data Extensions'` ); } } else if (!error) { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }): ${ex.message}`, + }): ${ex.message}` ); } } diff --git a/lib/metadataTypes/DataExtensionField.js b/lib/metadataTypes/DataExtensionField.js index 9dd06de1d..ec0eeb329 100644 --- a/lib/metadataTypes/DataExtensionField.js +++ b/lib/metadataTypes/DataExtensionField.js @@ -107,7 +107,7 @@ class DataExtensionField extends MetadataType { let hasData = false; try { const rowset = await this.client.rest.get( - `/data/v1/customobjectdata/key/${deKey}/rowset?$page=1&$pagesize=1`, + `/data/v1/customobjectdata/key/${deKey}/rowset?$page=1&$pagesize=1` ); const rowCount = rowset.count; hasData = rowCount > 0; @@ -125,7 +125,7 @@ class DataExtensionField extends MetadataType { rightOperand: deKey, }, }, - ['Name', 'ObjectID'], + ['Name', 'ObjectID'] ); const fieldsObj = response.metadata; @@ -147,7 +147,7 @@ class DataExtensionField extends MetadataType { if (itemOld.FieldType !== item.FieldType) { // applicable: with or without data but simply ignored by API Util.logger.warn( - ` - The Field Type of an existing field cannot be changed. Keeping the original value for [${deKey}].[${item.Name}]: '${itemOld.FieldType}'`, + ` - The Field Type of an existing field cannot be changed. Keeping the original value for [${deKey}].[${item.Name}]: '${itemOld.FieldType}'` ); item.FieldType = itemOld.FieldType; } @@ -160,14 +160,14 @@ class DataExtensionField extends MetadataType { if (itemOld.MaxLength > item.MaxLength) { // applicable: with or without data (Code 310007) Util.logger.warn( - ` - The length of an existing field cannot be decreased. Keeping the original value for [${deKey}].[${item.Name}]: '${itemOld.MaxLength}'`, + ` - The length of an existing field cannot be decreased. Keeping the original value for [${deKey}].[${item.Name}]: '${itemOld.MaxLength}'` ); item.MaxLength = itemOld.MaxLength; } if (Util.isFalse(itemOld.IsRequired) && Util.isTrue(item.IsRequired)) { // applicable: with or without data (Code 310007) Util.logger.warn( - ` - A field cannot be changed to be required on update after it was created to allow nulls. Resetting to not equired: [${deKey}].[${item.Name}]`, + ` - A field cannot be changed to be required on update after it was created to allow nulls. Resetting to not equired: [${deKey}].[${item.Name}]` ); item.IsRequired = itemOld.IsRequired; } @@ -175,7 +175,7 @@ class DataExtensionField extends MetadataType { // enable renaming if (item.Name_new) { Util.logger.info( - ` - Found Name_new='${item.Name_new}' for field ${deKey}.${item.Name} - trying to rename.`, + ` - Found Name_new='${item.Name_new}' for field ${deKey}.${item.Name} - trying to rename.` ); item.Name = item.Name_new; delete item.Name_new; @@ -207,19 +207,19 @@ class DataExtensionField extends MetadataType { // applicable: with data only if (Util.isFalse(item.IsPrimaryKey)) { Util.logger.warn( - ` - Adding new fields to an existing table requires that these fields are either not-required (nullable) or have a default value set. Changing [${deKey}].[${item.Name}] to be not-required`, + ` - Adding new fields to an existing table requires that these fields are either not-required (nullable) or have a default value set. Changing [${deKey}].[${item.Name}] to be not-required` ); item.IsRequired = false; } else { Util.logger.error( - `- You cannot add a new primary key field to an existing table that has data. Removing [${deKey}].[${item.Name}] from deployment`, + `- You cannot add a new primary key field to an existing table that has data. Removing [${deKey}].[${item.Name}] from deployment` ); deployColumns.splice(i, 1); } } if (item.Name_new) { Util.logger.info( - ` - Found Name_new='${item.Name_new}' for field ${deKey}.${item.Name} but could not find a corresponding DE field on the server - adding new field instead of updating.`, + ` - Found Name_new='${item.Name_new}' for field ${deKey}.${item.Name} but could not find a corresponding DE field on the server - adding new field instead of updating.` ); delete item.Name_new; } @@ -231,7 +231,7 @@ class DataExtensionField extends MetadataType { if (Util.isTrue(item.IsPrimaryKey) && Util.isFalse(item.IsRequired)) { // applicable: with or without data Util.logger.warn( - `- Primary Key field [${deKey}].[${item.Name}] cannot be not-required (nullable). Changing field to be required!`, + `- Primary Key field [${deKey}].[${item.Name}] cannot be not-required (nullable). Changing field to be required!` ); item.IsRequired = true; } @@ -239,13 +239,13 @@ class DataExtensionField extends MetadataType { // filter bad manual changes to the json if (!Util.isTrue(item.IsRequired) && !Util.isFalse(item.IsRequired)) { Util.logger.error( - `- Invalid value for 'IsRequired' of [${deKey}].[${item.Name}]. Found '${item.IsRequired}' instead of 'true'/'false'. Removing field from deploy!`, + `- Invalid value for 'IsRequired' of [${deKey}].[${item.Name}]. Found '${item.IsRequired}' instead of 'true'/'false'. Removing field from deploy!` ); deployColumns.splice(i, 1); } if (!Util.isTrue(item.IsPrimaryKey) && !Util.isFalse(item.IsPrimaryKey)) { Util.logger.error( - `- Invalid value for 'IsPrimaryKey' of [${deKey}].[${item.Name}]. Found '${item.IsPrimaryKey}' instead of 'true'/'false'. Removing field from deploy!`, + `- Invalid value for 'IsPrimaryKey' of [${deKey}].[${item.Name}]. Found '${item.IsPrimaryKey}' instead of 'true'/'false'. Removing field from deploy!` ); deployColumns.splice(i, 1); } @@ -255,8 +255,8 @@ class DataExtensionField extends MetadataType { Util.getGrayMsg( ` - Found ${deployColumns.length} added/updated Fields for ${deKey}${ deployColumns.length ? ': ' : '' - }` + deployColumns.map((item) => item.Name).join(', '), - ), + }` + deployColumns.map((item) => item.Name).join(', ') + ) ); return existingFieldByName; @@ -294,7 +294,7 @@ class DataExtensionField extends MetadataType { rightOperand: customerKey, }, }, - ['Name', 'ObjectID'], + ['Name', 'ObjectID'] ); fieldObjectID = response.metadata[customerKey]?.ObjectID; } @@ -316,7 +316,7 @@ class DataExtensionField extends MetadataType { this.client.soap.delete( 'DataExtension', // yes, not DataExtensionField keyObj, - null, + null ); if (!fieldId) { @@ -329,7 +329,7 @@ class DataExtensionField extends MetadataType { ? `${ex.results[0].StatusMessage} (Code ${ex.results[0].ErrorCode})` : ex.message; Util.logger.error( - `- error deleting ${this.definition.type} '${customerKey}': ${errorMsg}`, + `- error deleting ${this.definition.type} '${customerKey}': ${errorMsg}` ); return false; @@ -344,7 +344,7 @@ class DataExtensionField extends MetadataType { static async postDeleteTasks(customerKey) { // TODO actually clean up local dataextension json Util.logger.warn( - ` - The dataExtension for ${customerKey} wasn't updated locally yet after removing this field.`, + ` - The dataExtension for ${customerKey} wasn't updated locally yet after removing this field.` ); } } diff --git a/lib/metadataTypes/DataExtract.js b/lib/metadataTypes/DataExtract.js index 6e2b6f1c3..c6cdf0168 100644 --- a/lib/metadataTypes/DataExtract.js +++ b/lib/metadataTypes/DataExtract.js @@ -44,7 +44,7 @@ class DataExtract extends MetadataType { */ static async retrieveAsTemplate(templateDir, name, templateVariables) { const res = await this.client.rest.get( - '/automation/v1/dataextracts/?$filter=name%20eq%20' + encodeURIComponent(name), + '/automation/v1/dataextracts/?$filter=name%20eq%20' + encodeURIComponent(name) ); if (Array.isArray(res.items) && res.items.length) { // eq-operator returns a similar, not exact match and hence might return more than 1 entry @@ -56,14 +56,14 @@ class DataExtract extends MetadataType { // get full definition const extended = await this.client.rest.get( - '/automation/v1/dataextracts/' + metadata[this.definition.idField], + '/automation/v1/dataextracts/' + metadata[this.definition.idField] ); const originalKey = extended[this.definition.keyField]; const val = JSON.parse( Util.replaceByObject( JSON.stringify(this.parseMetadata(extended)), - templateVariables, - ), + templateVariables + ) ); // remove all fields listed in Definition for templating @@ -71,7 +71,7 @@ class DataExtract extends MetadataType { await File.writeJSONToFile( [templateDir, this.definition.type].join('/'), originalKey + '.' + this.definition.type + '-meta', - JSON.parse(Util.replaceByObject(JSON.stringify(val), templateVariables)), + JSON.parse(Util.replaceByObject(JSON.stringify(val), templateVariables)) ); Util.logger.info(`- templated ${this.definition.type}: ${name}`); return { metadata: val, type: this.definition.type }; @@ -81,7 +81,7 @@ class DataExtract extends MetadataType { throw new Error( `Encountered unknown error when retrieveing ${ this.definition.typeName - } "${name}": ${JSON.stringify(res)}`, + } "${name}": ${JSON.stringify(res)}` ); } } @@ -115,7 +115,7 @@ class DataExtract extends MetadataType { static update(dataExtract) { return super.updateREST( dataExtract, - '/automation/v1/dataextracts/' + dataExtract.dataExtractDefinitionId, + '/automation/v1/dataextracts/' + dataExtract.dataExtractDefinitionId ); } @@ -130,7 +130,7 @@ class DataExtract extends MetadataType { 'dataExtractType', metadata.r__dataExtractType_name, 'name', - 'extractId', + 'extractId' ); delete metadata.r__dataExtractType_name; return metadata; @@ -147,12 +147,12 @@ class DataExtract extends MetadataType { 'dataExtractType', metadata.dataExtractTypeId, 'extractId', - 'name', + 'name' ); delete metadata.dataExtractTypeId; } catch (ex) { Util.logger.warn( - ` - ${this.definition.type} ${metadata[this.definition.keyField]}: ${ex.message}`, + ` - ${this.definition.type} ${metadata[this.definition.keyField]}: ${ex.message}` ); } return JSON.parse(JSON.stringify(metadata)); diff --git a/lib/metadataTypes/Discovery.js b/lib/metadataTypes/Discovery.js index d8e431f79..803c96e14 100644 --- a/lib/metadataTypes/Discovery.js +++ b/lib/metadataTypes/Discovery.js @@ -27,8 +27,8 @@ class Discovery extends MetadataType { if (this.buObject.eid === this.buObject.mid) { const res = await this.client.rest.getCollection( Object.keys(this.definition.endPointMapping).map( - (endpoint) => this.definition.endPointMapping[endpoint], - ), + (endpoint) => this.definition.endPointMapping[endpoint] + ) ); const metadataStructure = {}; diff --git a/lib/metadataTypes/Email.js b/lib/metadataTypes/Email.js index 47bea9d6e..f4b3c0d4c 100644 --- a/lib/metadataTypes/Email.js +++ b/lib/metadataTypes/Email.js @@ -47,7 +47,7 @@ class Email extends MetadataType { if (Object.keys(results).length) { // only execute the following if records were found Util.logger.warn( - ' - Classic E-Mails are deprecated and will be discontinued by SFMC in the near future. Ensure that you migrate any existing E-Mails to Content Builder as soon as possible.', + ' - Classic E-Mails are deprecated and will be discontinued by SFMC in the near future. Ensure that you migrate any existing E-Mails to Content Builder as soon as possible.' ); } return super.saveResults(results, retrieveDir, overrideType, templateVariables); diff --git a/lib/metadataTypes/EmailSend.js b/lib/metadataTypes/EmailSend.js index f97d44891..38474bd56 100644 --- a/lib/metadataTypes/EmailSend.js +++ b/lib/metadataTypes/EmailSend.js @@ -112,7 +112,7 @@ class EmailSend extends MetadataType { 'asset', metadata.r__assetMessage_Key, 'customerKey', - 'legacyData.legacyId', + 'legacyData.legacyId' ); delete metadata.r__assetMessage_Key; delete metadata.r__assetMessage_Name; @@ -126,7 +126,7 @@ class EmailSend extends MetadataType { 'asset', metadata.r__assetMessage_Key.slice(0, Math.max(0, 36 - suffix.length)) + suffix, 'customerKey', - 'legacyData.legacyId', + 'legacyData.legacyId' ); delete metadata.r__assetMessage_Key; delete metadata.r__assetMessage_Name; @@ -147,19 +147,19 @@ class EmailSend extends MetadataType { if (sdl.r__dataExtension_Key) { if (sdl.DataSourceTypeID !== 'CustomObject') { throw new Error( - ` ☇ skipping ${this.definition.type} ${metadata.Name} (${metadata.CustomerKey}): Expecting DataSourceTypeID to equal 'CustomObject' when r__dataExtension_Key is defined; Found '${sdl.DataSourceTypeID}'`, + ` ☇ skipping ${this.definition.type} ${metadata.Name} (${metadata.CustomerKey}): Expecting DataSourceTypeID to equal 'CustomObject' when r__dataExtension_Key is defined; Found '${sdl.DataSourceTypeID}'` ); } sdl.CustomObjectID = cache.searchForField( 'dataExtension', sdl.r__dataExtension_Key, 'CustomerKey', - 'ObjectID', + 'ObjectID' ); delete sdl.r__dataExtension_Key; } else if (sdl.DataSourceTypeID === 'CustomObject') { throw new Error( - ` ☇ skipping ${this.definition.type} ${metadata.Name} (${metadata.CustomerKey}): Expecting r__dataExtension_Key to be defined if DataSourceTypeID='CustomObject'`, + ` ☇ skipping ${this.definition.type} ${metadata.Name} (${metadata.CustomerKey}): Expecting r__dataExtension_Key to be defined if DataSourceTypeID='CustomObject'` ); } if (!sdl.SalesForceObjectID || sdl.SalesForceObjectID === '') { @@ -174,7 +174,7 @@ class EmailSend extends MetadataType { delete sdl.r__list_PathName; } else { throw new Error( - ` ☇ skipping ${this.definition.type} ${metadata.Name} (${metadata.CustomerKey}) Field SendDefinitionList.r__list_PathName was not defined. Please try re-retrieving this ESD from your source BU.`, + ` ☇ skipping ${this.definition.type} ${metadata.Name} (${metadata.CustomerKey}) Field SendDefinitionList.r__list_PathName was not defined. Please try re-retrieving this ESD from your source BU.` ); } } @@ -217,14 +217,14 @@ class EmailSend extends MetadataType { 'asset', metadata.Email.ID, 'legacyData.legacyId', - 'name', + 'name' ); metadata.r__assetMessage_Name = contentBuilderEmailName; const contentBuilderEmailKey = cache.searchForField( 'asset', metadata.Email.ID, 'legacyData.legacyId', - 'customerKey', + 'customerKey' ); metadata.r__assetMessage_Key = contentBuilderEmailKey; delete metadata.Email; @@ -234,7 +234,7 @@ class EmailSend extends MetadataType { metadata[this.definition.keyField] }): Could not find email with ID ${ metadata.Email.ID - } in Classic nor in Content Builder.`, + } in Classic nor in Content Builder.` ); } } @@ -255,7 +255,7 @@ class EmailSend extends MetadataType { 'dataExtension', sdl.CustomObjectID, 'ObjectID', - 'CustomerKey', + 'CustomerKey' ); delete sdl.CustomObjectID; } catch { @@ -264,7 +264,7 @@ class EmailSend extends MetadataType { metadata[this.definition.keyField] }): Could not find Target Audience (DataExtension) with ObjectID ${ sdl.CustomObjectID - }.`, + }.` ); } } @@ -277,7 +277,7 @@ class EmailSend extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}`, + }): ${ex.message}` ); } } diff --git a/lib/metadataTypes/Event.js b/lib/metadataTypes/Event.js index 9ccf959f9..8b4bd129d 100644 --- a/lib/metadataTypes/Event.js +++ b/lib/metadataTypes/Event.js @@ -31,7 +31,7 @@ class Event extends MetadataType { key ? '/key:' + encodeURIComponent(key) : '' }?extras=all`, null, - key, + key ); } @@ -55,7 +55,7 @@ class Event extends MetadataType { static async retrieveAsTemplate(templateDir, name, templateVariables) { Util.logBeta(this.definition.type); const res = await this.client.rest.get( - '/interaction/v1/EventDefinitions?name=' + encodeURIComponent(name), + '/interaction/v1/EventDefinitions?name=' + encodeURIComponent(name) ); const event = res.items.filter((item) => item.name === name); try { @@ -64,22 +64,22 @@ class Event extends MetadataType { } else if (event.length > 1) { throw new Error( `Multiple Event Definitions with name "${name}"` + - `please rename to be unique to avoid issues`, + `please rename to be unique to avoid issues` ); } else if (event?.length === 1) { const originalKey = event[0][this.definition.keyField]; const eventDef = JSON.parse( Util.replaceByObject( JSON.stringify(this.parseMetadata(event[0])), - templateVariables, - ), + templateVariables + ) ); if (!eventDef.dataExtensionId) { throw new Error( `Event.parseMetadata:: ` + `No Data Extension found for ` + `event: ${eventDef.name}. ` + - `This cannot be templated`, + `This cannot be templated` ); } @@ -88,7 +88,7 @@ class Event extends MetadataType { await File.writeJSONToFile( [templateDir, this.definition.type].join('/'), originalKey + '.' + this.definition.type + '-meta', - JSON.parse(Util.replaceByObject(JSON.stringify(eventDef), templateVariables)), + JSON.parse(Util.replaceByObject(JSON.stringify(eventDef), templateVariables)) ); Util.logger.info(`- templated ${this.definition.type}: ${name}`); return { metadata: eventDef, type: this.definition.type }; @@ -96,7 +96,7 @@ class Event extends MetadataType { throw new Error( `Encountered unknown error when retrieveing ${ this.definition.typeName - } "${name}": ${JSON.stringify(res.body)}`, + } "${name}": ${JSON.stringify(res.body)}` ); } } catch (ex) { @@ -127,7 +127,7 @@ class Event extends MetadataType { return super.deleteByKeyREST( '/interaction/v1/eventDefinitions/key:' + encodeURIComponent(key), key, - false, + false ); } /** @@ -163,7 +163,7 @@ class Event extends MetadataType { return super.updateREST( metadataEntry, '/interaction/v1/EventDefinitions/' + metadataEntry.id, - 'put', + 'put' ); } @@ -178,7 +178,7 @@ class Event extends MetadataType { 'dataExtension', metadata.dataExtensionName, 'Name', - 'ObjectID', + 'ObjectID' ); metadata.arguments.dataExtensionId = metadata.dataExtensionId; return metadata; @@ -196,7 +196,7 @@ class Event extends MetadataType { 'dataExtension', metadata.dataExtensionId, 'ObjectID', - 'CustomerKey', + 'CustomerKey' ); metadata.arguments.dataExtensionId = metadata.dataExtensionId; return JSON.parse(JSON.stringify(metadata)); @@ -205,7 +205,7 @@ class Event extends MetadataType { 'verbose', this.definition.type, 'parseMetadata', - `No related Data Extension found for Event '${metadata.name}'. Consider deleting the event definition`, + `No related Data Extension found for Event '${metadata.name}'. Consider deleting the event definition` ); return metadata; } diff --git a/lib/metadataTypes/FileTransfer.js b/lib/metadataTypes/FileTransfer.js index f7ce38807..35067f816 100644 --- a/lib/metadataTypes/FileTransfer.js +++ b/lib/metadataTypes/FileTransfer.js @@ -44,7 +44,7 @@ class FileTransfer extends MetadataType { */ static async retrieveAsTemplate(templateDir, name, templateVariables) { const res = await this.client.rest.get( - '/automation/v1/filetransfers/?$filter=name%20eq%20' + encodeURIComponent(name), + '/automation/v1/filetransfers/?$filter=name%20eq%20' + encodeURIComponent(name) ); if (Array.isArray(res?.items) && res?.items?.length) { // eq-operator returns a similar, not exact match and hence might return more than 1 entry @@ -56,14 +56,14 @@ class FileTransfer extends MetadataType { // get full definition const extended = await this.client.rest.get( - '/automation/v1/filetransfers/' + metadata[this.definition.idField], + '/automation/v1/filetransfers/' + metadata[this.definition.idField] ); const originalKey = extended[this.definition.keyField]; const val = JSON.parse( Util.replaceByObject( JSON.stringify(this.parseMetadata(extended)), - templateVariables, - ), + templateVariables + ) ); // remove all fields listed in Definition for templating @@ -71,7 +71,7 @@ class FileTransfer extends MetadataType { await File.writeJSONToFile( [templateDir, this.definition.type].join('/'), originalKey + '.' + this.definition.type + '-meta', - JSON.parse(Util.replaceByObject(JSON.stringify(val), templateVariables)), + JSON.parse(Util.replaceByObject(JSON.stringify(val), templateVariables)) ); Util.logger.info(`- templated ${this.definition.type}: ${name}`); return { metadata: val, type: this.definition.type }; @@ -81,7 +81,7 @@ class FileTransfer extends MetadataType { throw new Error( `Encountered unknown error when retrieveing ${ this.definition.typeName - } "${name}": ${JSON.stringify(res)}`, + } "${name}": ${JSON.stringify(res)}` ); } } @@ -129,12 +129,12 @@ class FileTransfer extends MetadataType { 'fileLocation', metadata.r__fileLocation_name, 'name', - 'id', + 'id' ); delete metadata.r__fileLocation_name; } else { throw new Error( - 'r__fileLocation_name not set. Please ensure the source is properly set up and re-retrieve it first.', + 'r__fileLocation_name not set. Please ensure the source is properly set up and re-retrieve it first.' ); } return metadata; @@ -151,12 +151,12 @@ class FileTransfer extends MetadataType { 'fileLocation', metadata.fileTransferLocationId, 'id', - 'name', + 'name' ); delete metadata.fileTransferLocationId; } catch (ex) { Util.logger.warn( - ` - FileTransfer '${metadata[this.definition.keyField]}': ${ex.message}`, + ` - FileTransfer '${metadata[this.definition.keyField]}': ${ex.message}` ); } diff --git a/lib/metadataTypes/Folder.js b/lib/metadataTypes/Folder.js index afcdc5ecb..b4b2b6ae7 100644 --- a/lib/metadataTypes/Folder.js +++ b/lib/metadataTypes/Folder.js @@ -30,7 +30,7 @@ class Folder extends MetadataType { if (this.buObject.eid !== this.buObject.mid) { queryAllFolders.push( - ...(await this.retrieveHelper(additionalFields, false, subTypeArr)), + ...(await this.retrieveHelper(additionalFields, false, subTypeArr)) ); } const sortPairs = toposort(queryAllFolders.map((a) => [a.ParentFolder.ID, a.ID])); @@ -70,7 +70,7 @@ class Folder extends MetadataType { const parent = idMap[idMap[id].ParentFolder.ID]; // we use / here not system separator as it is important to keep metadata consistent idMap[id].Path = [parent.Path, idMap[id].Name].join( - Util.standardizedSplitChar, + Util.standardizedSplitChar ); idMap[id].ParentFolder.Path = parent.Path; } else { @@ -78,7 +78,7 @@ class Folder extends MetadataType { } } else { Util.logger.warn( - ` - Skipping folder ${idMap[id].Name} (${id}, type: ${idMap[id].ContentType}): Cannot find parent folder (${idMap[id].ParentFolder.ID})`, + ` - Skipping folder ${idMap[id].Name} (${id}, type: ${idMap[id].ContentType}): Cannot find parent folder (${idMap[id].ParentFolder.ID})` ); } } @@ -86,7 +86,7 @@ class Folder extends MetadataType { else if (idMap[id].Name !== '') { idMap[id].Path = ''; Util.logger.warn( - ` - Skipping folder ${idMap[id].Name} (${id}, type: ${idMap[id].ContentType}): Does not have a parent folder`, + ` - Skipping folder ${idMap[id].Name} (${id}, type: ${idMap[id].ContentType}): Does not have a parent folder` ); } } @@ -108,7 +108,7 @@ class Folder extends MetadataType { idMap[id].Client?.ID && (this.buObject.mid == idMap[id].Client.ID || this.definition.folderTypesFromParent.includes( - idMap[id].ContentType.toLowerCase(), + idMap[id].ContentType.toLowerCase() )) ) { if (metadata[idMap[id].CustomerKey]) { @@ -119,7 +119,7 @@ class Folder extends MetadataType { idMap[id].ContentType }].retrieve:: Duplicate CustomerKey on Folder. Keeping: ${ idMap[id].Path - }, Overwriting: ${metadata[idMap[id].CustomerKey].Path}`, + }, Overwriting: ${metadata[idMap[id].CustomerKey].Path}` ); metadata[idMap[id].CustomerKey] = idMap[id]; } else { @@ -128,7 +128,7 @@ class Folder extends MetadataType { idMap[id].ContentType }].retrieve:: Duplicate CustomerKey on Folder. Keeping: ${ metadata[idMap[id].CustomerKey].Path - }, Ignoring: ${idMap[id].Path}`, + }, Ignoring: ${idMap[id].Path}` ); } } else { @@ -141,7 +141,7 @@ class Folder extends MetadataType { if (retrieveDir) { const savedMetadata = await this.saveResults(metadata, retrieveDir, this.buObject.mid); Util.logger.info( - `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})`, + `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` ); } return { metadata: metadata, type: this.definition.type }; @@ -178,7 +178,7 @@ class Folder extends MetadataType { Object.keys(metadata).map((customerKey) => [ metadata[customerKey].ParentFolder.Path, metadata[customerKey].Path, - ]), + ]) ); // loop of loops to find a match between two arrays for (const folderPath of sortPairs) { @@ -198,7 +198,7 @@ class Folder extends MetadataType { 'folder', deployableMetadata.Path, 'Path', - 'ID', + 'ID' ); const cachedVersion = cache.getByKey( 'folder', @@ -206,8 +206,8 @@ class Folder extends MetadataType { 'folder', deployableMetadata.Path, 'Path', - this.definition.keyField, - ), + this.definition.keyField + ) ); if ( existingId && @@ -216,14 +216,14 @@ class Folder extends MetadataType { cachedVersion, metadata[metadataKey], 'Path', - true, + true )) ) { Util.logger.verbose( ` - skipping ${this.definition.type} ${ cachedVersion?.Path || metadata[metadataKey][this.definition.nameField] - }: no change detected`, + }: no change detected` ); filteredByPreDeploy++; continue; @@ -239,14 +239,14 @@ class Folder extends MetadataType { cachedVersion, metadata[metadataKey], 'Path', - true, + true )) ) { Util.logger.verbose( ` - skipping ${this.definition.type} ${ cachedVersion?.Path || metadata[metadataKey][this.definition.nameField] - }: no change detected`, + }: no change detected` ); filteredByPreDeploy++; continue; @@ -285,7 +285,7 @@ class Folder extends MetadataType { const newObject = {}; newObject[normalizedKey] = Object.assign( beforeMetadata, - parsed[normalizedKey], + parsed[normalizedKey] ); cache.mergeMetadata('folder', newObject); @@ -293,14 +293,14 @@ class Folder extends MetadataType { } else { Util.logger.debug(result); throw new Error( - `'${beforeMetadata.Path}' was not deployed correctly`, + `'${beforeMetadata.Path}' was not deployed correctly` ); } } } catch (ex) { Util.logger.errorStack( ex, - `Upserting ${this.definition.type} failed: ${ex.message}`, + `Upserting ${this.definition.type} failed: ${ex.message}` ); } } @@ -311,12 +311,12 @@ class Folder extends MetadataType { `${this.definition.type} upsert: ${createCount} of ${ createCount + createFailedCount } created / ${updateCount} of ${updateCount + updateFailedCount} updated` + - (filteredByPreDeploy > 0 ? ` / ${filteredByPreDeploy} filtered` : ''), + (filteredByPreDeploy > 0 ? ` / ${filteredByPreDeploy} filtered` : '') ); if (updateCount) { Util.logger.warn( - ` - Folders are recognized for updates based on their CustomerKey or, if that is not given, their folder-path.`, + ` - Folders are recognized for updates based on their CustomerKey or, if that is not given, their folder-path.` ); } await this.postDeployTasks(upsertResults, orignalMetadata, { @@ -335,7 +335,7 @@ class Folder extends MetadataType { static async create(metadataEntry) { if (metadataEntry?.Parent?.ID === 0) { Util.logger.error( - `${this.definition.type}-${metadataEntry.ContentType}.create:: Cannot create Root Folder: ${metadataEntry.Name}`, + `${this.definition.type}-${metadataEntry.ContentType}.create:: Cannot create Root Folder: ${metadataEntry.Name}` ); return {}; } @@ -354,11 +354,11 @@ class Folder extends MetadataType { } catch (ex) { if (ex?.results) { Util.logger.error( - `${this.definition.type}-${metadataEntry.ContentType}.create:: error creating: '${path}'. ${ex.results[0].StatusMessage}`, + `${this.definition.type}-${metadataEntry.ContentType}.create:: error creating: '${path}'. ${ex.results[0].StatusMessage}` ); } else if (ex) { Util.logger.error( - `${this.definition.type}-${metadataEntry.ContentType}.create:: error creating: '${path}'. ${ex.message}`, + `${this.definition.type}-${metadataEntry.ContentType}.create:: error creating: '${path}'. ${ex.message}` ); } } @@ -384,11 +384,11 @@ class Folder extends MetadataType { } catch (ex) { if (ex?.results) { Util.logger.error( - `${this.definition.type}-${metadataEntry.ContentType}.update:: error updating: '${path}'. ${ex.results[0].StatusMessage}`, + `${this.definition.type}-${metadataEntry.ContentType}.update:: error updating: '${path}'. ${ex.results[0].StatusMessage}` ); } else if (ex) { Util.logger.error( - `${this.definition.type}-${metadataEntry.ContentType}.update:: error updating: '${path}'. ${ex.message}`, + `${this.definition.type}-${metadataEntry.ContentType}.update:: error updating: '${path}'. ${ex.message}` ); } } @@ -403,7 +403,7 @@ class Folder extends MetadataType { static async preDeployTasks(metadata) { if (!this.definition.deployFolderTypes.includes(metadata.ContentType.toLowerCase())) { Util.logger.warn( - ` - Folder ${metadata.Name} is of a type which does not support deployment (Type: ${metadata.ContentType}). Please create this manually in the Web-Interface.`, + ` - Folder ${metadata.Name} is of a type which does not support deployment (Type: ${metadata.ContentType}). Please create this manually in the Web-Interface.` ); return; } @@ -413,7 +413,7 @@ class Folder extends MetadataType { 'debug', 'folder', 'preDeployTasks', - `Folder ${metadata.Name} is blacklisted for deployment due to it being a reserved name or that folder cannot be deployed`, + `Folder ${metadata.Name} is blacklisted for deployment due to it being a reserved name or that folder cannot be deployed` ); return; } @@ -424,7 +424,7 @@ class Folder extends MetadataType { 'warn', 'folder', 'preDeployTasks', - `Folders with IsEditable (such as ${metadata.Name}) are skipped in deployment to avoid overwriting system folder`, + `Folders with IsEditable (such as ${metadata.Name}) are skipped in deployment to avoid overwriting system folder` ); return; } @@ -434,7 +434,7 @@ class Folder extends MetadataType { 'folder', metadata.ParentFolder.Path, 'Path', - 'ID', + 'ID' ); return metadata; } else { @@ -442,7 +442,7 @@ class Folder extends MetadataType { 'warn', 'folder', 'preDeployTasks', - `skipping root folder '${metadata.Name}' (no need to include this in deployment)`, + `skipping root folder '${metadata.Name}' (no need to include this in deployment)` ); return; } @@ -465,7 +465,7 @@ class Folder extends MetadataType { // should not be in the path for the metadata. In case no split then return empty as this is root const standardSubDir = File.reverseFilterIllegalFilenames( - subdir.replaceAll('\\', '/').split(/folder\//)[1] || '', + subdir.replaceAll('\\', '/').split(/folder\//)[1] || '' ); for (const fileName of File.readdirSync(subdir)) { try { @@ -473,7 +473,7 @@ class Folder extends MetadataType { const fileContent = File.readJSONFile(subdir, fileName, true, false); const fileNameWithoutEnding = File.reverseFilterIllegalFilenames( - fileName.split(/\.(\w|-)+-meta.json/)[0], + fileName.split(/\.(\w|-)+-meta.json/)[0] ); if (fileContent.Name === fileNameWithoutEnding) { @@ -486,7 +486,7 @@ class Folder extends MetadataType { const key = fileContent.CustomerKey || `new-${++newCounter}`; if (fileName2FileContent[key]) { Util.logger.error( - `Your have multiple folder-JSONs with the same CustomerKey '${key}' - skipping ${fileName}`, + `Your have multiple folder-JSONs with the same CustomerKey '${key}' - skipping ${fileName}` ); } else { fileName2FileContent[key] = fileContent; @@ -500,7 +500,7 @@ class Folder extends MetadataType { JSON.stringify({ Filename: fileNameWithoutEnding, MetadataName: fileContent.Name, - }), + }) ); } } @@ -549,9 +549,9 @@ class Folder extends MetadataType { const response = await this.client.soap.retrieveBulk( 'DataFolder', this.getFieldNamesToRetrieve(additionalFields).filter( - (field) => !field.includes('Path'), + (field) => !field.includes('Path') ), - options, + options ); return response.Results; } @@ -592,7 +592,7 @@ class Folder extends MetadataType { // * cannot use split('/') here due to the "A/B Testing" folder const stem = results[metadataEntry].Path.slice( 0, - -results[metadataEntry].Name.length, + -results[metadataEntry].Name.length ); // we dont store Id on local disk, but we need it for caching logic, @@ -612,7 +612,7 @@ class Folder extends MetadataType { // manage subtypes [retrieveDir, 'folder', stem], tempHolder.Name + '.folder-meta', - tempHolder, + tempHolder ); } catch (ex) { Util.metadataLogger( @@ -620,7 +620,7 @@ class Folder extends MetadataType { this.definition.type, 'saveResults', ex, - metadataEntry, + metadataEntry ); } } diff --git a/lib/metadataTypes/ImportFile.js b/lib/metadataTypes/ImportFile.js index 091cacd3c..5348a4909 100644 --- a/lib/metadataTypes/ImportFile.js +++ b/lib/metadataTypes/ImportFile.js @@ -46,7 +46,7 @@ class ImportFile extends MetadataType { */ static async retrieveAsTemplate(templateDir, name, templateVariables) { const res = await this.client.rest.get( - '/automation/v1/imports/?$filter=name%20eq%20' + encodeURIComponent(name), + '/automation/v1/imports/?$filter=name%20eq%20' + encodeURIComponent(name) ); if (Array.isArray(res?.items) && res?.items.length) { // eq-operator returns a similar, not exact match and hence might return more than 1 entry @@ -59,8 +59,8 @@ class ImportFile extends MetadataType { const val = JSON.parse( Util.replaceByObject( JSON.stringify(this.parseMetadata(metadata)), - templateVariables, - ), + templateVariables + ) ); // remove all fields listed in Definition for templating @@ -68,7 +68,7 @@ class ImportFile extends MetadataType { await File.writeJSONToFile( [templateDir, this.definition.type].join('/'), originalKey + '.' + this.definition.type + '-meta', - JSON.parse(Util.replaceByObject(JSON.stringify(val), templateVariables)), + JSON.parse(Util.replaceByObject(JSON.stringify(val), templateVariables)) ); Util.logger.info(`- templated ${this.definition.type}: ${name}`); return { metadata: val, type: this.definition.type }; @@ -78,7 +78,7 @@ class ImportFile extends MetadataType { throw new Error( `Encountered unknown error when retrieveing ${ this.definition.typeName - } "${name}": ${JSON.stringify(res)}`, + } "${name}": ${JSON.stringify(res)}` ); } } @@ -113,7 +113,7 @@ class ImportFile extends MetadataType { static update(importFile) { return super.updateREST( importFile, - '/automation/v1/imports/' + importFile.importDefinitionId, + '/automation/v1/imports/' + importFile.importDefinitionId ); } @@ -128,7 +128,7 @@ class ImportFile extends MetadataType { 'fileLocation', metadata.r__fileLocation_name, 'name', - 'id', + 'id' ); delete metadata.r__fileLocation_name; @@ -138,7 +138,7 @@ class ImportFile extends MetadataType { 'dataExtension', metadata.r__dataExtension_CustomerKey, 'CustomerKey', - 'ObjectID', + 'ObjectID' ); delete metadata.r__dataExtension_CustomerKey; } else { @@ -148,7 +148,7 @@ class ImportFile extends MetadataType { if (metadata.r__list_PathName) { metadata.destinationObjectId = cache.getListObjectId( metadata.r__list_PathName, - 'ObjectID', + 'ObjectID' ); // destinationId is also needed for List types metadata.destinationId = cache.getListObjectId(metadata.r__list_PathName, 'ID'); @@ -160,7 +160,7 @@ class ImportFile extends MetadataType { Util.logger.debug( ` - importFile ${metadata[this.definition.keyField]}: Import Destination Type ${ metadata.c__destinationType - } not fully supported. Deploy might fail.`, + } not fully supported. Deploy might fail.` ); } // When the destinationObjectTypeId is 584 it refers to Mobile Connect which is not supported as an Import Type @@ -183,14 +183,14 @@ class ImportFile extends MetadataType { 'fileLocation', metadata.fileTransferLocationId, 'id', - 'name', + 'name' ); delete metadata.fileTransferLocationId; // * When the destinationObjectTypeId is 584 it refers to Mobile Connect which is not supported as an Import Type metadata.c__destinationType = Util.inverseGet( this.definition.destinationObjectTypeMapping, - metadata.destinationObjectTypeId, + metadata.destinationObjectTypeId ); delete metadata.destinationObjectTypeId; if (metadata.c__destinationType === 'DataExtension') { @@ -199,7 +199,7 @@ class ImportFile extends MetadataType { 'dataExtension', metadata.destinationObjectId, 'ObjectID', - 'CustomerKey', + 'CustomerKey' ); delete metadata.destinationObjectId; } catch (ex) { @@ -209,7 +209,7 @@ class ImportFile extends MetadataType { try { metadata.r__list_PathName = cache.getListPathName( metadata.destinationObjectId, - 'ObjectID', + 'ObjectID' ); delete metadata.destinationObjectId; } catch (ex) { @@ -219,12 +219,12 @@ class ImportFile extends MetadataType { metadata.c__subscriberImportType = Util.inverseGet( this.definition.subscriberImportTypeMapping, - metadata.subscriberImportTypeId, + metadata.subscriberImportTypeId ); delete metadata.subscriberImportTypeId; metadata.c__dataAction = Util.inverseGet( this.definition.updateTypeMapping, - metadata.updateTypeId, + metadata.updateTypeId ); delete metadata.updateTypeId; return metadata; diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index 38009cc46..599b4cd58 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -72,7 +72,7 @@ class Journey extends MetadataType { retrieveDir, `${uri}${singleKey}?extras=${extras}`, null, - key, + key ); } else { // retrieve all @@ -84,8 +84,8 @@ class Journey extends MetadataType { // empty results will come back without "items" defined Util.logger.info( Util.getGrayMsg( - ` - ${results.items?.length} ${this.definition.type}s found. Retrieving details...`, - ), + ` - ${results.items?.length} ${this.definition.type}s found. Retrieving details...` + ) ); } // full details for retrieve @@ -97,7 +97,7 @@ class Journey extends MetadataType { try { return await this.client.rest.get( `${uri}key:${a[this.definition.keyField]}?extras=${extras}` + - `&versionNumber=${a.version}`, + `&versionNumber=${a.version}` ); } catch (ex) { // if we do get here, we should log the error and continue instead of failing to download all automations @@ -111,15 +111,15 @@ class Journey extends MetadataType { ? Util.getGrayMsg( ' - ' + ex.endpoint.split( - 'rest.marketingcloudapis.com', - )[1], + 'rest.marketingcloudapis.com' + )[1] ) : '' - }`, + }` ); return null; } - }), + }) ) : []; const parsed = this.parseResponseBody({ items: details.filter(Boolean) }); @@ -128,7 +128,7 @@ class Journey extends MetadataType { const savedMetadata = await this.saveResults(parsed, retrieveDir, null, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(key), + Util.getKeysString(key) ); return { metadata: parsed, @@ -146,8 +146,8 @@ class Journey extends MetadataType { Util.logger.info( `Downloaded: ${this.definition.type} (0)${Util.getKeysString( mode === 'id' ? singleKey : key, - mode === 'id', - )}`, + mode === 'id' + )}` ); } else { throw ex; @@ -187,13 +187,13 @@ class Journey extends MetadataType { // delete by key with specified version does not work, therefore we need to get the ID first const response = await this.client.rest.get( - `/interaction/v1/interactions/key:${encodeURIComponent(key)}?extras=`, + `/interaction/v1/interactions/key:${encodeURIComponent(key)}?extras=` ); const results = this.parseResponseBody(response, key); singleKey = results[key].id; if (version && version > results[key].version) { Util.logger.error( - `The chosen version (${version}) is higher than the latest known version (${results[key].version}). Please choose a lower version.`, + `The chosen version (${version}) is higher than the latest known version (${results[key].version}). Please choose a lower version.` ); return false; } @@ -203,18 +203,18 @@ class Journey extends MetadataType { Util.logger.error( 'Version is required for deleting interactions to avoid accidental deletion of the wrong item. Please append it at the end of the key or id, separated by forward-slash. Example for deleting version 4: ' + key + - '/4', + '/4' ); return false; } Util.logger.warn( - `Deleting Journeys via this command breaks following retrieve-by-key/id requests until you've deployed/created a new draft version! You can get still get the latest available version of your journey by retrieving all interactions on this BU.`, + `Deleting Journeys via this command breaks following retrieve-by-key/id requests until you've deployed/created a new draft version! You can get still get the latest available version of your journey by retrieving all interactions on this BU.` ); /* eslint-enable unicorn/prefer-ternary */ return super.deleteByKeyREST( '/interaction/v1/interactions/' + singleKey + `?versionNumber=${version}`, key, - false, + false ); } /** @@ -240,7 +240,7 @@ class Journey extends MetadataType { return super.updateREST( metadata, '/interaction/v1/interactions/key:' + metadata.key, - 'put', + 'put' ); } @@ -320,11 +320,11 @@ class Journey extends MetadataType { 'event', metadata.triggers[0].metaData.eventDefinitionKey, 'eventDefinitionKey', - 'id', + 'id' ); if (metadata.triggers[0].metaData.eventDefinitionId !== edId) { throw new Error( - `eventDefinitionId not matching Id found on event with key in eventDefinitionKey`, + `eventDefinitionId not matching Id found on event with key in eventDefinitionKey` ); } delete metadata.triggers[0].metaData.eventDefinitionId; @@ -332,7 +332,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } } @@ -349,7 +349,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): definitionType Quicksend is not fully supported yet.`, + }): definitionType Quicksend is not fully supported yet.` ); // ~~~ TRIGGERS ~~~~ // event && triggers[].type === 'ContactAudience' @@ -363,7 +363,7 @@ class Journey extends MetadataType { 'event', metadata.triggers[0].metaData.eventDefinitionKey, 'eventDefinitionKey', - 'id', + 'id' ); if (metadata.triggers[0].metaData.eventDefinitionId !== edId) { throw new Error( @@ -371,7 +371,7 @@ class Journey extends MetadataType { metadata[this.definition.nameField] } (${ metadata[this.definition.keyField] - }): eventDefinitionId not matching Id found on event with key in eventDefinitionKey`, + }): eventDefinitionId not matching Id found on event with key in eventDefinitionKey` ); } delete metadata.triggers[0].metaData.eventDefinitionId; @@ -379,7 +379,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } } @@ -393,7 +393,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } break; @@ -421,7 +421,7 @@ class Journey extends MetadataType { 'transactionalEmail', activity.configurationArguments?.triggeredSendKey, 'definitionKey', - 'definitionId', + 'definitionId' ); if (tEmailId != activity.configurationArguments?.triggeredSendId) { throw new Error( @@ -429,7 +429,7 @@ class Journey extends MetadataType { metadata[this.definition.nameField] } (${ metadata[this.definition.keyField] - }): transactionalEmailId not matching Id found on transactionalEmail with key in transactionalEmailKey`, + }): transactionalEmailId not matching Id found on transactionalEmail with key in transactionalEmailKey` ); } if ( @@ -442,14 +442,14 @@ class Journey extends MetadataType { metadata[this.definition.nameField] } (${ metadata[this.definition.keyField] - }): metaData.highThroughput.definitionKey not matching key in configurationArguments.transactionalEmailKey`, + }): metaData.highThroughput.definitionKey not matching key in configurationArguments.transactionalEmailKey` ); } } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${ metadata[this.definition.nameField] - } (${metadata[this.definition.keyField]}): ${ex.message}.`, + } (${metadata[this.definition.keyField]}): ${ex.message}.` ); } } @@ -463,7 +463,7 @@ class Journey extends MetadataType { metadata[this.definition.keyField] }): channel ${ metadata.channel - } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it`, + } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it` ); } } @@ -476,7 +476,7 @@ class Journey extends MetadataType { metadata[this.definition.keyField] }): definitionType ${ metadata.definitionType - } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it`, + } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it` ); } } @@ -502,7 +502,7 @@ class Journey extends MetadataType { 'triggeredSend', activity.configurationArguments.triggeredSendKey, 'CustomerKey', - 'CustomerKey', + 'CustomerKey' ); delete activity.configurationArguments.triggeredSendId; } else if (activity.configurationArguments?.triggeredSendId) { @@ -511,7 +511,7 @@ class Journey extends MetadataType { 'triggeredSend', activity.configurationArguments.triggeredSendId, 'ObjectID', - 'CustomerKey', + 'CustomerKey' ); delete activity.configurationArguments.triggeredSendId; } @@ -519,7 +519,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }) activity-key=${activity.key}: ${ex.message}`, + }) activity-key=${activity.key}: ${ex.message}` ); } @@ -534,7 +534,7 @@ class Journey extends MetadataType { 'mobileMessage', activity.configurationArguments.messageId, 'id', - 'id', + 'id' ); delete activity.configurationArguments.messageId; } @@ -542,7 +542,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }) activity-key=${activity.key}: ${ex.message}`, + }) activity-key=${activity.key}: ${ex.message}` ); } try { @@ -553,7 +553,7 @@ class Journey extends MetadataType { 'mobileKeyword', activity.configurationArguments.keywordId, 'id', - 'c__codeKeyword', + 'c__codeKeyword' ); delete activity.configurationArguments.keywordId; } @@ -561,7 +561,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }) activity-key=${activity.key}: ${ex.message}`, + }) activity-key=${activity.key}: ${ex.message}` ); } try { @@ -571,7 +571,7 @@ class Journey extends MetadataType { 'mobileKeyword', activity.configurationArguments.nextKeywordId, 'id', - 'keyword', + 'keyword' ); delete activity.configurationArguments.nextKeywordId; } @@ -579,7 +579,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }) activity-key=${activity.key}: ${ex.message}`, + }) activity-key=${activity.key}: ${ex.message}` ); } try { @@ -589,7 +589,7 @@ class Journey extends MetadataType { 'mobileCode', activity.configurationArguments.codeId, 'id', - 'code', + 'code' ); delete activity.configurationArguments.codeId; } @@ -597,7 +597,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }) activity-key=${activity.key}: ${ex.message}`, + }) activity-key=${activity.key}: ${ex.message}` ); } @@ -609,7 +609,7 @@ class Journey extends MetadataType { 'asset', activity.configurationArguments.assetId, 'id', - 'name', + 'name' ); activity.configurationArguments.r__assetMessage_Key = @@ -617,7 +617,7 @@ class Journey extends MetadataType { 'asset', activity.configurationArguments.assetId, 'id', - 'customerKey', + 'customerKey' ); delete activity.configurationArguments.assetId; } @@ -625,7 +625,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }) activity-key=${activity.key}: ${ex.message}`, + }) activity-key=${activity.key}: ${ex.message}` ); } @@ -673,7 +673,7 @@ class Journey extends MetadataType { 'event', metadata.triggers[0].metaData.eventDefinitionKey, 'eventDefinitionKey', - 'id', + 'id' ); } @@ -697,7 +697,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): definitionType Quicksend is not supported yet and might fail to deploy.`, + }): definitionType Quicksend is not supported yet and might fail to deploy.` ); // ~~~ TRIGGERS ~~~~ // event && triggers[].type === 'ContactAudience' @@ -711,13 +711,13 @@ class Journey extends MetadataType { 'event', metadata.triggers[0].metaData?.eventDefinitionKey, 'eventDefinitionKey', - 'id', + 'id' ); } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } } @@ -731,7 +731,7 @@ class Journey extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } break; @@ -759,7 +759,7 @@ class Journey extends MetadataType { 'transactionalEmail', metadata.activities[0].configurationArguments?.triggeredSendKey, 'definitionKey', - 'definitionId', + 'definitionId' ); if ( metadata.activities[0].metaData?.highThroughput?.definitionKey && @@ -771,7 +771,7 @@ class Journey extends MetadataType { metadata[this.definition.nameField] } (${ metadata[this.definition.keyField] - }): metaData.highThroughput.definitionKey not matching key in configurationArguments.transactionalEmailKey`, + }): metaData.highThroughput.definitionKey not matching key in configurationArguments.transactionalEmailKey` ); } } @@ -785,7 +785,7 @@ class Journey extends MetadataType { metadata[this.definition.keyField] }): channel ${ metadata.channel - } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it`, + } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it` ); } } @@ -798,7 +798,7 @@ class Journey extends MetadataType { metadata[this.definition.keyField] }): definitionType ${ metadata.definitionType - } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it`, + } is not supported yet. Please open a ticket at https://github.com/Accenture/sfmc-devtools/issues/new/choose to request it` ); } } @@ -823,7 +823,7 @@ class Journey extends MetadataType { 'triggeredSend', activity.configurationArguments.triggeredSendKey, 'CustomerKey', - 'ObjectID', + 'ObjectID' ); } break; @@ -835,7 +835,7 @@ class Journey extends MetadataType { 'mobileMessage', activity.configurationArguments.c__mobileMessage_id, 'id', - 'id', + 'id' ); delete activity.configurationArguments.c__mobileMessage_id; } @@ -845,7 +845,7 @@ class Journey extends MetadataType { 'mobileKeyword', activity.r__mobileKeyword_codeKeyword, 'c__codeKeyword', - 'id', + 'id' ); delete activity.configurationArguments.r__mobileKeyword_codeKeyword; } @@ -854,7 +854,7 @@ class Journey extends MetadataType { 'mobileKeyword', activity.configurationArguments.c__next_mobileKeyword, 'keyword', - 'id', + 'id' ); delete activity.configurationArguments.c__next_mobileKeyword; } @@ -864,7 +864,7 @@ class Journey extends MetadataType { 'mobileCode', activity.configurationArguments.c__mobileCode, 'code', - 'id', + 'id' ); delete activity.configurationArguments.c__mobileCode; } @@ -874,7 +874,7 @@ class Journey extends MetadataType { 'asset', activity.configurationArguments.r__assetMessage_Key, 'customerKey', - 'id', + 'id' ); delete activity.configurationArguments.r__assetMessage_Key; delete activity.configurationArguments.r__assetMessage_Name_readOnly; @@ -905,11 +905,11 @@ class Journey extends MetadataType { metadataKey, hasError, metadataToUpdate, - metadataToCreate, + metadataToCreate ); if (action === 'update') { const normalizedKey = File.reverseFilterIllegalFilenames( - metadataMap[metadataKey][this.definition.keyField], + metadataMap[metadataKey][this.definition.keyField] ); const cachedVersion = cache.getByKey(this.definition.type, normalizedKey); if (cachedVersion) { @@ -924,7 +924,7 @@ class Journey extends MetadataType { metadataMap[metadataKey][this.definition.nameField] } (${ metadataMap[metadataKey][this.definition.keyField] - }) on BU, but it is not in Draft status. Will create new version.`, + }) on BU, but it is not in Draft status. Will create new version.` ); metadataToCreate.push(metadataMap[metadataKey]); return 'create'; diff --git a/lib/metadataTypes/List.js b/lib/metadataTypes/List.js index 561eee427..2c57375f7 100644 --- a/lib/metadataTypes/List.js +++ b/lib/metadataTypes/List.js @@ -115,13 +115,13 @@ class List extends MetadataType { operator: 'equals', rightOperand: this.properties.credentials[this.buObject.credential].eid, }, - }, + } ); const masterUnsubscribeBehavior = buResult.Results[0]?.MasterUnsubscribeBehavior; if (masterUnsubscribeBehavior === 'ENTIRE_ENTERPRISE') { Util.logger.debug(` - BU uses ParentBU's All Subscriber List`); Util.logger.info( - ' - Caching dependent Metadata: All Subscriber list (on _ParentBU_)', + ' - Caching dependent Metadata: All Subscriber list (on _ParentBU_)' ); // do not use retrieveForCache here because (a) it does not support key-filtering and (b) it would cache folders on top which we do not need for the global all subscriber list const metadataParentBu = await this.retrieve(null, null, null, 'All Subscribers'); @@ -190,14 +190,14 @@ class List extends MetadataType { 'folder', metadata.Category, 'ID', - 'Path', + 'Path' ); if (!parseForCache) { delete metadata.Category; } } catch (ex) { Util.logger.warn( - ` - List ${metadata.ID}: '${metadata.CustomerKey}': ${ex.message}`, + ` - List ${metadata.ID}: '${metadata.CustomerKey}': ${ex.message}` ); } } diff --git a/lib/metadataTypes/MetadataType.js b/lib/metadataTypes/MetadataType.js index d5b7373cb..2ea9cb9c2 100644 --- a/lib/metadataTypes/MetadataType.js +++ b/lib/metadataTypes/MetadataType.js @@ -47,7 +47,7 @@ class MetadataType { if (fileName.endsWith('.json')) { const fileContent = File.readJSONFile(dir, fileName, true, false); const fileNameWithoutEnding = File.reverseFilterIllegalFilenames( - fileName.split(/\.(\w|-)+-meta.json/)[0], + fileName.split(/\.(\w|-)+-meta.json/)[0] ); // We always store the filename using the External Key (CustomerKey or key) to avoid duplicate names. // to ensure any changes are done to both the filename and external key do a check here @@ -60,7 +60,7 @@ class MetadataType { } else { Util.logger.error( ` ${this.definition.type} ${key}: Name of the metadata file and the JSON-key (${this.definition.keyField}) must match` + - Util.getGrayMsg(` - ${dir}/${fileName}`), + Util.getGrayMsg(` - ${dir}/${fileName}`) ); } } @@ -177,7 +177,7 @@ class MetadataType { // postRetrieveTasks will be run automatically on this via super.saveResult } catch (ex) { throw new Error( - `Could not get details for new ${this.definition.type} ${id} from server (${ex.message})`, + `Could not get details for new ${this.definition.type} ${id} from server (${ex.message})` ); } } @@ -207,14 +207,14 @@ class MetadataType { 'folder', metadata[this.definition.folderIdField], 'ID', - 'Path', + 'Path' ); delete metadata[this.definition.folderIdField]; } catch (ex) { Util.logger.warn( ` - ${this.definition.type} '${metadata[this.definition.nameField]}' (${ metadata[this.definition.keyField] - }): Could not find folder (${ex.message})`, + }): Could not find folder (${ex.message})` ); } } @@ -231,7 +231,7 @@ class MetadataType { 'folder', metadata.r__folder_Path, 'Path', - 'ID', + 'ID' ); delete metadata.r__folder_Path; } @@ -286,7 +286,7 @@ class MetadataType { 'debug', this.definition.type, 'retrieveAsTemplate', - `(${templateDir}, ${name}, ${templateVariables}) no templating function`, + `(${templateDir}, ${name}, ${templateVariables}) no templating function` ); return { metadata: null, type: this.definition.type }; } @@ -328,7 +328,7 @@ class MetadataType { metadataStr = await File.readFilteredFilename( [retrieveDir, ...typeDirArr], fileName, - 'json', + 'json' ); } catch (ex) { try { @@ -337,7 +337,7 @@ class MetadataType { typeDirArr, key, fileName, - ex, + ex ); } catch { throw new Error( @@ -345,7 +345,7 @@ class MetadataType { retrieveDir, ...typeDirArr, fileName + '.json', - ])}.`, + ])}.` ); } // return; @@ -380,7 +380,7 @@ class MetadataType { templateDir, metadata, templateVariables, - key, + key ); try { @@ -389,7 +389,7 @@ class MetadataType { Util.logger.info( `- templated ${this.definition.type}: ${key} (${ metadata[this.definition.nameField] - })`, + })` ); return { metadata: metadata, type: this.definition.type }; @@ -420,7 +420,7 @@ class MetadataType { Util.logger.error( ` ☇ skipping ${this.definition.type} ${metadata[this.definition.keyField]} / ${ metadata[this.definition.nameField] - }: create is not supported yet for ${this.definition.type}`, + }: create is not supported yet for ${this.definition.type}` ); return; } @@ -436,7 +436,7 @@ class MetadataType { Util.logger.error( ` ☇ skipping ${this.definition.type} ${metadata[this.definition.keyField]} / ${ metadata[this.definition.nameField] - }: update is not supported yet for ${this.definition.type}`, + }: update is not supported yet for ${this.definition.type}` ); return; } @@ -447,7 +447,7 @@ class MetadataType { */ static refresh() { Util.logger.error( - ` ☇ skipping ${this.definition.type}: refresh is not supported yet for ${this.definition.type}`, + ` ☇ skipping ${this.definition.type}: refresh is not supported yet for ${this.definition.type}` ); return; } @@ -459,7 +459,7 @@ class MetadataType { */ static execute() { Util.logger.error( - ` ☇ skipping ${this.definition.type}: execute is not supported yet for ${this.definition.type}`, + ` ☇ skipping ${this.definition.type}: execute is not supported yet for ${this.definition.type}` ); return []; } @@ -470,7 +470,7 @@ class MetadataType { */ static pause() { Util.logger.error( - ` ☇ skipping ${this.definition.type}: pause is not supported yet for ${this.definition.type}`, + ` ☇ skipping ${this.definition.type}: pause is not supported yet for ${this.definition.type}` ); return []; } @@ -518,7 +518,7 @@ class MetadataType { Util.logger.debug( `${this.definition.type}:: ${ clonedMetada[fieldName || this.definition.keyField] - }.${prop} changed: '${cachedVersion[prop]}' to '${clonedMetada[prop]}'`, + }.${prop} changed: '${cachedVersion[prop]}' to '${clonedMetada[prop]}'` ); return true; } @@ -527,7 +527,7 @@ class MetadataType { Util.logger.debug( `${this.definition.type}:: ${ clonedMetada[fieldName || this.definition.keyField] - }.${prop} changed: '${cachedVersion[prop]}' to '${clonedMetada[prop]}'`, + }.${prop} changed: '${cachedVersion[prop]}' to '${clonedMetada[prop]}'` ); return true; } @@ -536,7 +536,7 @@ class MetadataType { Util.logger.verbose( ` ☇ skipping ${this.definition.type} ${clonedMetada[this.definition.keyField]} / ${ clonedMetada[fieldName || this.definition.nameField] - }: no change detected`, + }: no change detected` ); } return false; @@ -561,7 +561,7 @@ class MetadataType { try { deployableMetadata = await this.preDeployTasks( metadataMap[metadataKey], - deployDir, + deployDir ); } catch (ex) { // do this in case something went wrong during pre-deploy steps to ensure the total counter is correct @@ -570,7 +570,7 @@ class MetadataType { Util.logger.error( ` ☇ skipping ${this.definition.type} ${ deployableMetadata[this.definition.keyField] - } / ${deployableMetadata[this.definition.nameField]}: ${ex.message}`, + } / ${deployableMetadata[this.definition.nameField]}: ${ex.message}` ); } // if preDeploy returns nothing then it cannot be deployed so skip deployment @@ -582,7 +582,7 @@ class MetadataType { metadataKey, hasError, metadataToUpdate, - metadataToCreate, + metadataToCreate ); } else { filteredByPreDeploy++; @@ -590,7 +590,7 @@ class MetadataType { } catch (ex) { Util.logger.errorStack( ex, - `Upserting ${this.definition.type} failed: ${ex.message}`, + `Upserting ${this.definition.type} failed: ${ex.message}` ); } } @@ -600,8 +600,8 @@ class MetadataType { metadataToCreate .filter((r) => r !== undefined && r !== null) .map((metadataEntry) => - createLimit(() => this.create(metadataEntry, deployDir)), - ), + createLimit(() => this.create(metadataEntry, deployDir)) + ) ) ).filter((r) => r !== undefined && r !== null); const updateLimit = pLimit(10); @@ -610,14 +610,14 @@ class MetadataType { metadataToUpdate .filter((r) => r !== undefined && r !== null) .map((metadataEntry) => - updateLimit(() => this.update(metadataEntry.after, metadataEntry.before)), - ), + updateLimit(() => this.update(metadataEntry.after, metadataEntry.before)) + ) ) ).filter((r) => r !== undefined && r !== null); // Logging Util.logger.info( `${this.definition.type} upsert: ${createResults.length} of ${metadataToCreate.length} created / ${updateResults.length} of ${metadataToUpdate.length} updated` + - (filteredByPreDeploy > 0 ? ` / ${filteredByPreDeploy} filtered` : ''), + (filteredByPreDeploy > 0 ? ` / ${filteredByPreDeploy} filtered` : '') ); let upsertResults; if (this.definition.bodyIteratorField === 'Results') { @@ -659,7 +659,7 @@ class MetadataType { */ static createOrUpdate(metadataMap, metadataKey, hasError, metadataToUpdate, metadataToCreate) { const normalizedKey = File.reverseFilterIllegalFilenames( - metadataMap[metadataKey][this.definition.keyField], + metadataMap[metadataKey][this.definition.keyField] ); // Update if it already exists; Create it if not const maxKeyLength = this.definition.maxKeyLength || 36; @@ -672,7 +672,7 @@ class MetadataType { // only used if resource is excluded from cache and we still want to update it // needed e.g. to rewire lost folders Util.logger.warn( - ' - Hotfix for non-cachable resource found in deploy folder. Trying update:', + ' - Hotfix for non-cachable resource found in deploy folder. Trying update:' ); Util.logger.warn(JSON.stringify(metadataMap[metadataKey])); if (hasError) { @@ -694,23 +694,23 @@ class MetadataType { if (Util.OPTIONS.changeKeyField) { if (this.definition.keyField == this.definition.idField) { Util.logger.error( - ` - --changeKeyField cannot be used for types that use their ID as key. Skipping change.`, + ` - --changeKeyField cannot be used for types that use their ID as key. Skipping change.` ); hasError = true; } else if (this.definition.keyIsFixed) { Util.logger.error( - ` - type ${this.definition.type} does not support --changeKeyField and --changeKeyValue. Skipping change.`, + ` - type ${this.definition.type} does not support --changeKeyField and --changeKeyValue. Skipping change.` ); hasError = true; } else if (!metadataMap[metadataKey][Util.OPTIONS.changeKeyField]) { Util.logger.error( - ` - --changeKeyField is set to ${Util.OPTIONS.changeKeyField} but no value was found in the metadata. Skipping change.`, + ` - --changeKeyField is set to ${Util.OPTIONS.changeKeyField} but no value was found in the metadata. Skipping change.` ); hasError = true; } else if (Util.OPTIONS.changeKeyField === this.definition.keyField) { // simple issue, used WARN to avoid signaling a problem to ci/cd and don't fail deploy Util.logger.warn( - ` - --changeKeyField is set to the same value as the keyField for ${this.definition.type}. Skipping change.`, + ` - --changeKeyField is set to the same value as the keyField for ${this.definition.type}. Skipping change.` ); } else if (metadataMap[metadataKey][Util.OPTIONS.changeKeyField]) { // NOTE: trim twice while getting the newKey value to remove leading spaces before limiting the length @@ -720,16 +720,16 @@ class MetadataType { .trim(); if (metadataMap[metadataKey][Util.OPTIONS.changeKeyField] + '' > maxKeyLength) { Util.logger.warn( - `${this.definition.type} ${this.definition.keyField} may not exceed ${maxKeyLength} characters. Truncated the value in field ${Util.OPTIONS.changeKeyField} to ${newKey}`, + `${this.definition.type} ${this.definition.keyField} may not exceed ${maxKeyLength} characters. Truncated the value in field ${Util.OPTIONS.changeKeyField} to ${newKey}` ); } if (metadataKey == newKey) { Util.logger.warn( - ` - --changeKeyField(${Util.OPTIONS.changeKeyField}) is providing the current value of the key (${metadataKey}). Skipping change.`, + ` - --changeKeyField(${Util.OPTIONS.changeKeyField}) is providing the current value of the key (${metadataKey}). Skipping change.` ); } else { Util.logger.info( - ` - Changing ${this.definition.type} key from ${metadataKey} to ${newKey} via --changeKeyField=${Util.OPTIONS.changeKeyField}`, + ` - Changing ${this.definition.type} key from ${metadataKey} to ${newKey} via --changeKeyField=${Util.OPTIONS.changeKeyField}` ); metadataMap[metadataKey][this.definition.keyField] = newKey; @@ -743,26 +743,26 @@ class MetadataType { const newKey = Util.OPTIONS.changeKeyValue.trim().slice(0, maxKeyLength).trim(); if (Util.OPTIONS.changeKeyValue.trim().length > maxKeyLength) { Util.logger.warn( - `${this.definition.type} ${this.definition.keyField} may not exceed ${maxKeyLength} characters. Truncated your value to ${newKey}`, + `${this.definition.type} ${this.definition.keyField} may not exceed ${maxKeyLength} characters. Truncated your value to ${newKey}` ); } if (this.definition.keyField == this.definition.idField) { Util.logger.error( - ` - --changeKeyValue cannot be used for types that use their ID as key. Skipping change.`, + ` - --changeKeyValue cannot be used for types that use their ID as key. Skipping change.` ); hasError = true; } else if (this.definition.keyIsFixed) { Util.logger.error( - ` - type ${this.definition.type} does not support --changeKeyField and --changeKeyValue. Skipping change.`, + ` - type ${this.definition.type} does not support --changeKeyField and --changeKeyValue. Skipping change.` ); hasError = true; } else if (metadataKey == newKey) { Util.logger.warn( - ` - --changeKeyValue is providing the current value of the key (${metadataKey}). Skipping change.`, + ` - --changeKeyValue is providing the current value of the key (${metadataKey}). Skipping change.` ); } else { Util.logger.info( - ` - Changing ${this.definition.type} key from ${metadataKey} to ${newKey} via --changeKeyValue`, + ` - Changing ${this.definition.type} key from ${metadataKey} to ${newKey} via --changeKeyValue` ); metadataMap[metadataKey][this.definition.keyField] = newKey; @@ -818,7 +818,7 @@ class MetadataType { ` - created ${this.definition.type}: ${ metadataEntry[this.definition.keyField] || metadataEntry[this.definition.nameField] - } / ${metadataEntry[this.definition.nameField]}`, + } / ${metadataEntry[this.definition.nameField]}` ); return response; } catch (ex) { @@ -827,7 +827,7 @@ class MetadataType { ` ☇ error creating ${this.definition.type} ${ metadataEntry[this.definition.keyField] || metadataEntry[this.definition.nameField] - } / ${metadataEntry[this.definition.nameField]}:`, + } / ${metadataEntry[this.definition.nameField]}:` ); if (parsedErrors.length) { for (const msg of parsedErrors) { @@ -854,14 +854,14 @@ class MetadataType { const response = await this.client.soap.create( Util.capitalizeFirstLetter(soapType), metadataEntry, - null, + null ); if (!handleOutside) { Util.logger.info( ` - created ${this.definition.type}: ${ metadataEntry[this.definition.keyField] - } / ${metadataEntry[this.definition.nameField]}`, + } / ${metadataEntry[this.definition.nameField]}` ); } return response; @@ -892,7 +892,7 @@ class MetadataType { ` - updated ${this.definition.type}: ${ metadataEntry[this.definition.keyField] || metadataEntry[this.definition.nameField] - } / ${metadataEntry[this.definition.nameField]}`, + } / ${metadataEntry[this.definition.nameField]}` ); return response; } catch (ex) { @@ -901,7 +901,7 @@ class MetadataType { ` ☇ error updating ${this.definition.type} ${ metadataEntry[this.definition.keyField] || metadataEntry[this.definition.nameField] - } / ${metadataEntry[this.definition.nameField]}:`, + } / ${metadataEntry[this.definition.nameField]}:` ); for (const msg of parsedErrors) { Util.logger.error(' • ' + msg); @@ -959,13 +959,13 @@ class MetadataType { const response = await this.client.soap.update( Util.capitalizeFirstLetter(soapType), metadataEntry, - null, + null ); if (!handleOutside) { Util.logger.info( ` - updated ${this.definition.type}: ${ metadataEntry[this.definition.keyField] - } / ${metadataEntry[this.definition.nameField]}`, + } / ${metadataEntry[this.definition.nameField]}` ); } await this._postChangeKeyTasks(metadataEntry); @@ -1025,7 +1025,7 @@ class MetadataType { response = await this.client.soap.retrieveBulk( Util.capitalizeFirstLetter(soapType), fields, - requestParams, + requestParams ); } catch (ex) { this._handleSOAPErrors(ex, 'retrieving'); @@ -1037,7 +1037,7 @@ class MetadataType { const savedMetadata = await this.saveResults(metadata, retrieveDir, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(singleRetrieve), + Util.getKeysString(singleRetrieve) ); await this.runDocumentOnRetrieve(singleRetrieve, savedMetadata); } @@ -1063,7 +1063,7 @@ class MetadataType { if (this.definition.hasExtended) { Util.logger.debug(' - retrieving extended metadata'); const extended = await this.client.rest.getCollection( - Object.keys(results).map((key) => uri + results[key][this.definition.idField]), + Object.keys(results).map((key) => uri + results[key][this.definition.idField]) ); for (const ext of extended) { const key = ext[this.definition.keyField]; @@ -1076,11 +1076,11 @@ class MetadataType { results, retrieveDir, null, - templateVariables, + templateVariables ); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(singleRetrieve), + Util.getKeysString(singleRetrieve) ); await this.runDocumentOnRetrieve(singleRetrieve, savedMetadata); } @@ -1103,8 +1103,8 @@ class MetadataType { Util.getGrayMsg( ` - ${urlArray?.length} ${this.definition.type}${ urlArray?.length === 1 ? '' : 's' - } found. Retrieving details...`, - ), + } found. Retrieving details...` + ) ); } const rateLimit = pLimit(concurrentRequests); @@ -1118,8 +1118,8 @@ class MetadataType { } catch (ex) { return this.handleRESTErrors(ex, item.id); } - }), - ), + }) + ) ) : []; const results = {}; @@ -1181,13 +1181,13 @@ class MetadataType { 'start', { ObjectID: metadataEntry[this.definition.idField], - }, + } ); if (response?.OverallStatus === 'OK') { Util.logger.info( ` - executed ${this.definition.type}: ${ metadataEntry[this.definition.keyField] - }`, + }` ); } else { throw new Error(response?.OverallStatus); @@ -1214,14 +1214,14 @@ class MetadataType { if (!singleRetrieve || (singleRetrieve && !this.definition.documentInOneFile)) { const count = Object.keys(metadataMap).length; Util.logger.debug( - ` - Running document for ${count} record${count === 1 ? '' : 's'}`, + ` - Running document for ${count} record${count === 1 ? '' : 's'}` ); await this.document(metadataMap); } else { Util.logger.info( Util.getGrayMsg( - ` - Skipped running document because you supplied keys and ${this.definition.type} is documented in a single file for all.`, - ), + ` - Skipped running document because you supplied keys and ${this.definition.type} is documented in a single file for all.` + ) ); } } @@ -1314,7 +1314,7 @@ class MetadataType { subObject, subField, definitionProperty, - originHelper + '[]', + originHelper + '[]' ); } } @@ -1331,13 +1331,13 @@ class MetadataType { metadataEntry, originHelper + '.' + subField, definitionProperty, - null, + null ); } } else if (!this.definition.fields[originHelper]) { // Display warining if there is no definition for the current field Util.logger.verbose( - `MetadataType[${this.definition.type}].deleteFieldByDefinition[${definitionProperty}]:: Field ${originHelper} not in metadata info`, + `MetadataType[${this.definition.type}].deleteFieldByDefinition[${definitionProperty}]:: Field ${originHelper} not in metadata info` ); } else if (this.definition.fields[originHelper][definitionProperty] === false) { // Check if field/nested field should be deleted depending on the definitionProperty @@ -1413,13 +1413,13 @@ class MetadataType { const includeByDefinition = this._filterOther(this.definition.include, metadataEntry); const includeByConfig = this._filterOther( this.properties.options.include[this.definition.type], - metadataEntry, + metadataEntry ); if (includeByDefinition === false || includeByConfig === false) { Util.logger.debug( `Filtered ${this.definition.type} '${ metadataEntry[this.definition.nameField] - }' (${metadataEntry[this.definition.keyField]}): not matching include filter`, + }' (${metadataEntry[this.definition.keyField]}): not matching include filter` ); return true; @@ -1429,13 +1429,13 @@ class MetadataType { const excludeByDefinition = this._filterOther(this.definition.filter, metadataEntry); const excludeByConfig = this._filterOther( this.properties.options.exclude[this.definition.type], - metadataEntry, + metadataEntry ); if (excludeByDefinition || excludeByConfig) { Util.logger.debug( `Filtered ${this.definition.type} '${ metadataEntry[this.definition.nameField] - }' (${metadataEntry[this.definition.keyField]}): matching exclude filter`, + }' (${metadataEntry[this.definition.keyField]}): matching exclude filter` ); return true; } @@ -1471,7 +1471,7 @@ class MetadataType { // check include-only filters (== discard rest) const includeByDefinition = this._filterFolder( this.definition.include, - metadataEntry.r__folder_Path, + metadataEntry.r__folder_Path ); if (includeByDefinition === false) { Util.logger.debug(errorMsg + ' (Accenture SFMC DevTools default)'); @@ -1480,7 +1480,7 @@ class MetadataType { const includeByConfig = this._filterFolder( this.properties.options.include[this.definition.type], - metadataEntry.r__folder_Path, + metadataEntry.r__folder_Path ); if (includeByConfig === false) { Util.logger.debug(errorMsg + ' (project config)'); @@ -1493,7 +1493,7 @@ class MetadataType { // check exclude-only filters (== keep rest) const excludeByDefinition = this._filterFolder( this.definition.filter, - metadataEntry.r__folder_Path, + metadataEntry.r__folder_Path ); if (excludeByDefinition) { Util.logger.debug(errorMsg + ' (Accenture SFMC DevTools default)'); @@ -1502,7 +1502,7 @@ class MetadataType { const excludeByConfig = this._filterFolder( this.properties.options.exclude[this.definition.type], - metadataEntry.r__folder_Path, + metadataEntry.r__folder_Path ); if (excludeByConfig) { Util.logger.debug(errorMsg + ' (project config)'); @@ -1594,8 +1594,8 @@ class MetadataType { '-' + Object.keys(this.definition.extendedSubTypes).find((type) => this.definition.extendedSubTypes[type].includes( - results[originalKey].assetType.name, - ), + results[originalKey].assetType.name + ) ); } subtypeExtension = '.' + (overrideType || this.definition.type) + '-meta'; @@ -1615,7 +1615,7 @@ class MetadataType { results[originalKey] = await this.postRetrieveTasks( results[originalKey], retrieveDir, - templateVariables ? true : false, + templateVariables ? true : false ); if (!results[originalKey] || results[originalKey] === null) { // we encountered a situation in our postRetrieveTasks that made us want to filter this record @@ -1639,11 +1639,11 @@ class MetadataType { if (templateVariables) { results[originalKey].json = Util.replaceByObject( results[originalKey].json, - templateVariables, + templateVariables ); results[originalKey].subFolder = Util.replaceByObject( results[originalKey].subFolder, - templateVariables, + templateVariables ); } @@ -1673,9 +1673,9 @@ class MetadataType { script.fileName + subtypeExtension, script.fileExt, script.content, - templateVariables, + templateVariables ); - }), + }) ); } else { // not a complex type, run the the entire JSON through templating @@ -1683,7 +1683,7 @@ class MetadataType { if (templateVariables) { results[originalKey] = Util.replaceByObject( results[originalKey], - templateVariables, + templateVariables ); } if (Util.OPTIONS.like && !Util.fieldsLike(results[originalKey])) { @@ -1713,26 +1713,26 @@ class MetadataType { // manage subtypes baseDir, originalKey + subtypeExtension, - saveClone, + saveClone ); if (templateVariables) { Util.logger.info( `- templated ${this.definition.type}: ${ saveClone[this.definition.nameField] - }`, + }` ); } } catch (ex) { Util.logger.errorStack( ex, - ` - Saving ${this.definition.type} ${originalKey} failed`, + ` - Saving ${this.definition.type} ${originalKey} failed` ); } } if (filterCounter && this.definition.type !== 'asset') { // interferes with progress bar in assets and is printed 1-by-1 otherwise Util.logger.info( - ` - Filtered ${this.definition.type}: ${filterCounter} (downloaded but not saved to disk)`, + ` - Filtered ${this.definition.type}: ${filterCounter} (downloaded but not saved to disk)` ); } return savedResults; @@ -1777,7 +1777,7 @@ class MetadataType { targetDir, metadata, variables, - templateName, + templateName ) { // generic version here does nothing. actual cases handled in type classes return null; @@ -1798,7 +1798,7 @@ class MetadataType { targetDir, metadata, templateVariables, - templateName, + templateName ) { // generic version here does nothing. actual cases handled in type classes return null; @@ -1854,7 +1854,7 @@ class MetadataType { metadataStr = await File.readFilteredFilename( [templateDir, ...typeDirArr], fileName, - 'json', + 'json' ); } catch (ex) { try { @@ -1863,7 +1863,7 @@ class MetadataType { typeDirArr, templateName, fileName, - ex, + ex ); } catch { throw new Error( @@ -1871,7 +1871,7 @@ class MetadataType { templateDir, ...typeDirArr, fileName + '.json', - ])}.`, + ])}.` ); } // return; @@ -1886,7 +1886,7 @@ class MetadataType { throw new Error( `${this.definition.type}:: Error applying template variables on ${ templateName + '.' + this.definition.type - }${suffix}.json. Please check if your replacement values will result in valid json.`, + }${suffix}.json. Please check if your replacement values will result in valid json.` ); } @@ -1898,7 +1898,7 @@ class MetadataType { targetDir, metadata, variables, - templateName, + templateName ); try { @@ -1909,13 +1909,13 @@ class MetadataType { await File.writeJSONToFile( [targetDir, ...typeDirArr], metadata[this.definition.keyField] + '.' + this.definition.type + suffix, - metadata, + metadata ); } Util.logger.info( `- prepared deployment definition of ${this.definition.type}: ${ metadata[this.definition.keyField] - }`, + }` ); return { metadata: metadata, type: this.definition.type }; @@ -1938,7 +1938,7 @@ class MetadataType { ...errMsg.message .split('
') .map((el) => el.trim()) - .filter(Boolean), + .filter(Boolean) ); } } else if (ex.response.data.validationErrors) { @@ -1947,7 +1947,7 @@ class MetadataType { ...errMsg.message .split('
') .map((el) => el.trim()) - .filter(Boolean), + .filter(Boolean) ); } } else if (ex.response.data.message) { @@ -2036,7 +2036,7 @@ class MetadataType { ? `${ex.results[0].StatusMessage} (Code ${ex.results[0].ErrorCode})` : ex.message; Util.logger.error( - `- error deleting ${this.definition.type} '${customerKey}': ${errorMsg}`, + `- error deleting ${this.definition.type} '${customerKey}': ${errorMsg}` ); } @@ -2122,7 +2122,7 @@ class MetadataType { const keysForDeploy = []; if (Object.keys(metadataMap).length) { Util.logger.info( - `Searching for ${this.definition.type} keys among downloaded items that need fixing:`, + `Searching for ${this.definition.type} keys among downloaded items that need fixing:` ); for (const item of Object.values(metadataMap)) { if (item[this.definition.nameField].length > this.definition.maxKeyLength) { @@ -2131,11 +2131,11 @@ class MetadataType { item[this.definition.keyField] } is too long for a key. Consider renaming your item. Key will be equal first ${ this.definition.maxKeyLength - } characters of the name`, + } characters of the name` ); item[this.definition.nameField] = item[this.definition.nameField].slice( 0, - this.definition.maxKeyLength, + this.definition.maxKeyLength ); } @@ -2147,15 +2147,15 @@ class MetadataType { Util.logger.info( ` - added ${this.definition.type} to fixKey queue: ${ item[this.definition.keyField] - }`, + }` ); } else { Util.logger.info( Util.getGrayMsg( ` ☇ skipping ${this.definition.type} ${ item[this.definition.keyField] - }: key does not need to be updated`, - ), + }: key does not need to be updated` + ) ); } } diff --git a/lib/metadataTypes/MobileCode.js b/lib/metadataTypes/MobileCode.js index d9e2f27e5..5101af3f8 100644 --- a/lib/metadataTypes/MobileCode.js +++ b/lib/metadataTypes/MobileCode.js @@ -24,7 +24,7 @@ class MobileCode extends MetadataType { retrieveDir, '/legacy/v1/beta/mobile/code/' + (key ? `?$where=keyword%20eq%20%27${key}%27%20` : ''), null, - key, + key ); } diff --git a/lib/metadataTypes/MobileKeyword.js b/lib/metadataTypes/MobileKeyword.js index c6e9fd40d..23f753cbb 100644 --- a/lib/metadataTypes/MobileKeyword.js +++ b/lib/metadataTypes/MobileKeyword.js @@ -31,13 +31,13 @@ class MobileKeyword extends MetadataType { retrieveDir, '/legacy/v1/beta/mobile/keyword/' + queryParams, null, - key, + key ); } catch (ex) { // if the mobileMessage does not exist, the API returns the error "Request failed with status code 400 (ERR_BAD_REQUEST)" which would otherwise bring execution to a hold if (key && ex.code === 'ERR_BAD_REQUEST') { Util.logger.info( - `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}`, + `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}` ); } else { throw ex; @@ -139,7 +139,7 @@ class MobileKeyword extends MetadataType { metadataKey, hasError, metadataToUpdate, - metadataToCreate, + metadataToCreate ); if (createOrUpdateAction === 'update') { // in case --changeKeyField or --changeKeyValue was used, let's ensure we set code & keyword here again @@ -177,13 +177,13 @@ class MobileKeyword extends MetadataType { templateDir, `/legacy/v1/beta/mobile/keyword/` + queryParams, templateVariables, - key, + key ); } catch (ex) { // if the mobileMessage does not exist, the API returns the error "Request failed with status code 400 (ERR_BAD_REQUEST)" which would otherwise bring execution to a hold if (key && ex.code === 'ERR_BAD_REQUEST') { Util.logger.info( - `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}`, + `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}` ); } else { throw ex; @@ -212,7 +212,7 @@ class MobileKeyword extends MetadataType { queryParams = `?view=simple&$where=keyword%20eq%20%27${keyword}%27%20and%code%20eq%20%27${code}%27%20`; } else { throw new Error( - `key ${key} has unexpected format. Expected 'code.keyword' or 'id:yourId'`, + `key ${key} has unexpected format. Expected 'code.keyword' or 'id:yourId'` ); } } else { @@ -240,7 +240,7 @@ class MobileKeyword extends MetadataType { return super.updateREST( metadata, '/legacy/v1/beta/mobile/keyword/' + metadata[this.definition.idField], - 'post', // upsert API, post for insert and update! + 'post' // upsert API, post for insert and update! ); } @@ -258,7 +258,7 @@ class MobileKeyword extends MetadataType { Util.logger.debug( ` - skipping ${this.definition.type} ${ metadata[this.definition.keyField] - }. Could not find parent mobileCode ${metadata.code.code}`, + }. Could not find parent mobileCode ${metadata.code.code}` ); return; } @@ -308,7 +308,7 @@ class MobileKeyword extends MetadataType { targetDir, metadata, templateVariables, - templateName, + templateName ) { return this._buildForNested( templateDir, @@ -316,7 +316,7 @@ class MobileKeyword extends MetadataType { metadata, templateVariables, templateName, - 'definition', + 'definition' ); } /** @@ -336,7 +336,7 @@ class MobileKeyword extends MetadataType { targetDir, metadata, templateVariables, - templateName, + templateName ) { return this._buildForNested( templateDir, @@ -344,7 +344,7 @@ class MobileKeyword extends MetadataType { metadata, templateVariables, templateName, - 'template', + 'template' ); } @@ -366,7 +366,7 @@ class MobileKeyword extends MetadataType { metadata, templateVariables, templateName, - mode, + mode ) { // get code from filesystem let code = await this._mergeCode(metadata, templateDir, templateName); @@ -389,7 +389,7 @@ class MobileKeyword extends MetadataType { throw new Error( `${this.definition.type}:: Error applying template variables on ${ templateName + '.' + this.definition.type - }-meta.${fileExt}.`, + }-meta.${fileExt}.` ); } @@ -405,7 +405,7 @@ class MobileKeyword extends MetadataType { [targetDir, this.definition.type], fileName + '.' + this.definition.type + '-meta', fileExt, - code, + code ); nestedFilePaths.push([ targetDir, @@ -429,7 +429,7 @@ class MobileKeyword extends MetadataType { if (metadata.responseMessage && metadata.keywordType === 'NORMAL') { throw new Error( - `Custom Response Text is not supported for keywords of type 'NORMAL'. Please remove the .amp file or change the keywordType to 'STOP' or 'INFO'.`, + `Custom Response Text is not supported for keywords of type 'NORMAL'. Please remove the .amp file or change the keywordType to 'STOP' or 'INFO'.` ); } if (!metadata.companyName && metadata.keywordType !== 'NORMAL') { @@ -437,7 +437,7 @@ class MobileKeyword extends MetadataType { Util.logger.debug( ` - No companyName found for keyword ${ metadata[this.definition.keyField] - }. Setting to IGNORED.`, + }. Setting to IGNORED.` ); } @@ -485,7 +485,7 @@ class MobileKeyword extends MetadataType { return await File.readFilteredFilename( [deployDir, this.definition.type], templateName + '.' + this.definition.type + '-meta', - 'amp', + 'amp' ); } else { // keeep this as a debug message, as it is optional and hence not an error @@ -509,7 +509,7 @@ class MobileKeyword extends MetadataType { const id = metadata[key][this.definition.idField]; // execute delete Util.logger.info( - ' - Note: As long as the provided API key once existed, you will not see an error even if the mobileKeyword is already deleted.', + ' - Note: As long as the provided API key once existed, you will not see an error even if the mobileKeyword is already deleted.' ); return super.deleteByKeyREST('/legacy/v1/beta/mobile/keyword/' + id, key, false); } diff --git a/lib/metadataTypes/MobileMessage.js b/lib/metadataTypes/MobileMessage.js index a94aee78a..756d8175b 100644 --- a/lib/metadataTypes/MobileMessage.js +++ b/lib/metadataTypes/MobileMessage.js @@ -33,13 +33,13 @@ class MobileMessage extends MetadataType { (key || '?view=details&version=3&$sort=lastUpdated%20DESC&$where=isTest%20eq%200%20and%20status%20neq%20%27Archive%27'), null, - key, + key ); } catch (ex) { // if the mobileMessage does not exist, the API returns the error "Request failed with status code 400 (ERR_BAD_REQUEST)" which would otherwise bring execution to a hold if (key && ex.code === 'ERR_BAD_REQUEST') { Util.logger.info( - `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}`, + `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}` ); } else { throw ex; @@ -69,7 +69,7 @@ class MobileMessage extends MetadataType { return super.updateREST( metadata, '/legacy/v1/beta/mobile/message/' + metadata[this.definition.idField], - 'post', // upsert API, post for insert and update! + 'post' // upsert API, post for insert and update! ); } @@ -103,7 +103,7 @@ class MobileMessage extends MetadataType { return await File.readFilteredFilename( [deployDir, this.definition.type], templateName + '.' + this.definition.type + '-meta', - fileExtension, + fileExtension ); } else { throw new Error(`Could not find ${codePath}.${fileExtension}`); @@ -157,7 +157,7 @@ class MobileMessage extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } @@ -170,7 +170,7 @@ class MobileMessage extends MetadataType { 'mobileKeyword', metadata[attr].id, 'id', - 'c__codeKeyword', + 'c__codeKeyword' ), }; } @@ -179,7 +179,7 @@ class MobileMessage extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } // campaign @@ -200,7 +200,7 @@ class MobileMessage extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]}: ${ ex.message - }`, + }` ); } } @@ -210,7 +210,7 @@ class MobileMessage extends MetadataType { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } @@ -266,7 +266,7 @@ class MobileMessage extends MetadataType { const keywordObj = cache.getByKey('mobileKeyword', metadata[attr].c__codeKeyword); if (!keywordObj) { throw new Error( - `mobileKeyword ${metadata[attr].c__codeKeyword} not found in cache`, + `mobileKeyword ${metadata[attr].c__codeKeyword} not found in cache` ); } metadata[attr] = keywordObj; @@ -339,7 +339,7 @@ class MobileMessage extends MetadataType { targetDir, metadata, templateVariables, - templateName, + templateName ) { return this._buildForNested( templateDir, @@ -347,7 +347,7 @@ class MobileMessage extends MetadataType { metadata, templateVariables, templateName, - 'definition', + 'definition' ); } /** @@ -367,7 +367,7 @@ class MobileMessage extends MetadataType { targetDir, metadata, templateVariables, - templateName, + templateName ) { return this._buildForNested( templateDir, @@ -375,7 +375,7 @@ class MobileMessage extends MetadataType { metadata, templateVariables, templateName, - 'template', + 'template' ); } @@ -397,7 +397,7 @@ class MobileMessage extends MetadataType { metadata, templateVariables, templateName, - mode, + mode ) { // get code from filesystem let code = await this._mergeCode(metadata, templateDir, templateName); @@ -418,7 +418,7 @@ class MobileMessage extends MetadataType { throw new Error( `${this.definition.type}:: Error applying template variables on ${ templateName + '.' + this.definition.type - }-meta.amp.`, + }-meta.amp.` ); } @@ -434,7 +434,7 @@ class MobileMessage extends MetadataType { [targetDir, this.definition.type], fileName + '.' + this.definition.type + '-meta', fileExt, - code, + code ); nestedFilePaths.push([ targetDir, @@ -453,7 +453,7 @@ class MobileMessage extends MetadataType { */ static deleteByKey(id) { Util.logger.info( - ' - Note: As long as the provided API key once existed, you will not see an error even if the mobileMessage is already deleted.', + ' - Note: As long as the provided API key once existed, you will not see an error even if the mobileMessage is already deleted.' ); return super.deleteByKeyREST('/legacy/v1/beta/mobile/message/' + id, id, false); } diff --git a/lib/metadataTypes/Query.js b/lib/metadataTypes/Query.js index e0d5c9016..a7cd501a7 100644 --- a/lib/metadataTypes/Query.js +++ b/lib/metadataTypes/Query.js @@ -39,7 +39,7 @@ class Query extends MetadataType { if (!objectId) { // avoid running the rest request below by returning early Util.logger.info( - `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}`, + `Downloaded: ${this.definition.type} (0)${Util.getKeysString(key)}` ); return { metadata: {}, type: this.definition.type }; } @@ -49,7 +49,7 @@ class Query extends MetadataType { retrieveDir, '/automation/v1/queries/' + (objectId || ''), null, - key, + key ); } /** @@ -71,7 +71,7 @@ class Query extends MetadataType { } } results.push( - super.executeREST(`/automation/v1/queries/${objectId}/actions/start/`, key), + super.executeREST(`/automation/v1/queries/${objectId}/actions/start/`, key) ); } const executedKeyArr = (await Promise.all(results)) @@ -128,7 +128,7 @@ class Query extends MetadataType { return super.retrieveREST( templateDir, '/automation/v1/queries/?$filter=Name%20eq%20' + encodeURIComponent(name), - templateVariables, + templateVariables ); } @@ -160,7 +160,7 @@ class Query extends MetadataType { 'dataExtension', metadata.targetId, 'ObjectID', - 'CustomerKey', + 'CustomerKey' ); if (targetKey !== metadata.targetKey) { Util.logger.debug( @@ -168,7 +168,7 @@ class Query extends MetadataType { metadata[this.definition.keyField] }): Replacing targetKey value in saved JSON '${ metadata.targetKey - }' --> '${targetKey}'. Acquired new value from looking up the DE's ObjectID in targetId.`, + }' --> '${targetKey}'. Acquired new value from looking up the DE's ObjectID in targetId.` ); metadata.targetKey = targetKey; } @@ -178,14 +178,14 @@ class Query extends MetadataType { 'dataExtension', metadata.targetKey, 'CustomerKey', - 'CustomerKey', + 'CustomerKey' ); } } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } delete metadata.targetId; @@ -230,7 +230,7 @@ class Query extends MetadataType { metadata.queryText = await File.readFilteredFilename( deployDir + '/' + this.definition.type, metadata[this.definition.keyField] + '.' + this.definition.type + '-meta', - 'sql', + 'sql' ); // dataExtension @@ -238,14 +238,14 @@ class Query extends MetadataType { 'dataExtension', metadata.targetKey, 'CustomerKey', - 'CustomerKey', + 'CustomerKey' ); // we've seen queries without this ID set - crucial in case the DE ever gets renamed to ensure the query keeps working metadata.targetId = cache.searchForField( 'dataExtension', metadata.targetKey, 'CustomerKey', - 'ObjectID', + 'ObjectID' ); // set ID for Append / Overwrite/ Update action @@ -292,7 +292,7 @@ class Query extends MetadataType { targetDir, metadata, templateVariables, - templateName, + templateName ) { return this._buildForNested( templateDir, @@ -300,7 +300,7 @@ class Query extends MetadataType { metadata, templateVariables, templateName, - 'definition', + 'definition' ); } /** @@ -320,7 +320,7 @@ class Query extends MetadataType { targetDir, metadata, templateVariables, - templateName, + templateName ) { return this._buildForNested( templateDir, @@ -328,7 +328,7 @@ class Query extends MetadataType { metadata, templateVariables, templateName, - 'template', + 'template' ); } /** @@ -350,13 +350,13 @@ class Query extends MetadataType { metadata, templateVariables, templateName, - mode, + mode ) { // get SQL from filesystem let code = await File.readFilteredFilename( [templateDir, this.definition.type], templateName + '.' + this.definition.type + '-meta', - 'sql', + 'sql' ); try { @@ -369,7 +369,7 @@ class Query extends MetadataType { throw new Error( `${this.definition.type}:: Error applying template variables on ${ templateName + '.' + this.definition.type - }-meta.sql.`, + }-meta.sql.` ); } @@ -385,7 +385,7 @@ class Query extends MetadataType { [targetDir, this.definition.type], fileName + '.' + this.definition.type + '-meta', 'sql', - code, + code ); nestedFilePaths.push([ targetDir, diff --git a/lib/metadataTypes/Role.js b/lib/metadataTypes/Role.js index 28fa23fcc..effa95d40 100644 --- a/lib/metadataTypes/Role.js +++ b/lib/metadataTypes/Role.js @@ -64,7 +64,7 @@ class Role extends MetadataType { if (!retrieveDir) { // retrieve "Marketing Cloud%" roles not returned by SOAP API const { roles, timeZones } = await this.client.rest.get( - '/platform/v1/setup/quickflow/data', + '/platform/v1/setup/quickflow/data' ); // this endpoint does not provide keys const roleNameKeyMap = { @@ -100,7 +100,7 @@ class Role extends MetadataType { const savedMetadata = await super.saveResults(parsed, retrieveDir, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(key), + Util.getKeysString(key) ); await this.runDocumentOnRetrieve(key, savedMetadata); @@ -116,7 +116,7 @@ class Role extends MetadataType { static preDeployTasks(metadata) { if (this.definition.deployBlacklist.includes(metadata.CustomerKey)) { throw new Error( - `Skipped ${metadata.Name} (${metadata.CustomerKey}) because its CustomerKey is reserved for a default system role.`, + `Skipped ${metadata.Name} (${metadata.CustomerKey}) because its CustomerKey is reserved for a default system role.` ); } return metadata; @@ -151,7 +151,7 @@ class Role extends MetadataType { static async document(metadata) { if (this.buObject.eid !== this.buObject.mid) { Util.logger.error( - `Roles can only be retrieved & documented for the ${Util.parentBuName}`, + `Roles can only be retrieved & documented for the ${Util.parentBuName}` ); return; } @@ -163,7 +163,7 @@ class Role extends MetadataType { this.buObject.credential, Util.parentBuName, ]), - true, + true ).role; } catch (ex) { Util.logger.error(ex.message); @@ -276,7 +276,7 @@ class Role extends MetadataType { basePermission = 'Salesforce Marketing Cloud'; } const permissionName = `${permSplit.join( - ' > ', + ' > ' )} > ${permOperation}`; if (!this.allPermissions[basePermission]) { this.allPermissions[basePermission] = {}; @@ -298,7 +298,7 @@ class Role extends MetadataType { element.PermissionSets.PermissionSet, _permission, element.IsAllowed, - isAllowed, + isAllowed ); } // Not at end: Traverse more @@ -309,7 +309,7 @@ class Role extends MetadataType { role, nextElement, _permission, - element.IsAllowed || isAllowed, + element.IsAllowed || isAllowed ); } } else { @@ -317,7 +317,7 @@ class Role extends MetadataType { role, element.Permissions.Permission, _permission, - element.IsAllowed || isAllowed, + element.IsAllowed || isAllowed ); } } diff --git a/lib/metadataTypes/Script.js b/lib/metadataTypes/Script.js index 92b7c49d4..e84ea214d 100644 --- a/lib/metadataTypes/Script.js +++ b/lib/metadataTypes/Script.js @@ -47,7 +47,7 @@ class Script extends MetadataType { return super.retrieveREST( templateDir, '/automation/v1/scripts/?$filter=name%20eq%20' + encodeURIComponent(name), - templateVariables, + templateVariables ); } @@ -102,14 +102,14 @@ class Script extends MetadataType { code = await File.readFilteredFilename( [deployDir, this.definition.type], templateName + '.' + this.definition.type + '-meta', - 'ssjs', + 'ssjs' ); code = ``; } else if (await File.pathExists(codePath + '.html')) { code = await File.readFilteredFilename( [deployDir, this.definition.type], templateName + '.' + this.definition.type + '-meta', - 'html', + 'html' ); } else { throw new Error(`Could not find ${codePath}.ssjs (or html)`); @@ -148,7 +148,7 @@ class Script extends MetadataType { targetDir, metadata, templateVariables, - templateName, + templateName ) { return this._buildForNested( templateDir, @@ -156,7 +156,7 @@ class Script extends MetadataType { metadata, templateVariables, templateName, - 'definition', + 'definition' ); } /** @@ -176,7 +176,7 @@ class Script extends MetadataType { targetDir, metadata, templateVariables, - templateName, + templateName ) { return this._buildForNested( templateDir, @@ -184,7 +184,7 @@ class Script extends MetadataType { metadata, templateVariables, templateName, - 'template', + 'template' ); } @@ -206,7 +206,7 @@ class Script extends MetadataType { metadata, templateVariables, templateName, - mode, + mode ) { // get SSJS from filesystem let code = await this._mergeCode(metadata, templateDir, templateName); @@ -227,7 +227,7 @@ class Script extends MetadataType { throw new Error( `${this.definition.type}:: Error applying template variables on ${ templateName + '.' + this.definition.type - }-meta.ssjs.`, + }-meta.ssjs.` ); } @@ -243,7 +243,7 @@ class Script extends MetadataType { [targetDir, this.definition.type], fileName + '.' + this.definition.type + '-meta', fileExt, - code, + code ); nestedFilePaths.push([ targetDir, @@ -296,7 +296,7 @@ class Script extends MetadataType { code = metadataScript; fileExt = 'html'; Util.logger.warn( - ` - Could not find script tags, saving code in ${metadataName}.script-meta.html instead of as SSJS file.`, + ` - Could not find script tags, saving code in ${metadataName}.script-meta.html instead of as SSJS file.` ); } return { fileExt, code }; diff --git a/lib/metadataTypes/TransactionalEmail.js b/lib/metadataTypes/TransactionalEmail.js index de1328a25..35ad0cf13 100644 --- a/lib/metadataTypes/TransactionalEmail.js +++ b/lib/metadataTypes/TransactionalEmail.js @@ -26,7 +26,7 @@ class TransactionalEmail extends TransactionalMessage { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): Cannot update journey link during update. If you need to relink this item to a new journey please delete and recreate it.`, + }): Cannot update journey link during update. If you need to relink this item to a new journey please delete and recreate it.` ); delete metadata.options.createJourney; } @@ -48,7 +48,7 @@ class TransactionalEmail extends TransactionalMessage { 'asset', metadata.r__asset_customerKey, 'customerKey', - 'customerKey', + 'customerKey' ), }; delete metadata.r__asset_customerKey; @@ -60,14 +60,14 @@ class TransactionalEmail extends TransactionalMessage { 'dataExtension', metadata.subscriptions.r__dataExtension_CustomerKey, 'CustomerKey', - 'CustomerKey', + 'CustomerKey' ); } // subscriptions: list if (metadata.subscriptions?.r__list_PathName) { metadata.subscriptions.list = cache.getListObjectId( metadata.subscriptions.r__list_PathName, - 'CustomerKey', + 'CustomerKey' ); delete metadata.subscriptions.r__list_PathName; } @@ -89,7 +89,7 @@ class TransactionalEmail extends TransactionalMessage { static async postCreateTasks(_, apiResponse) { if (apiResponse.journey?.interactionKey) { Util.logger.warn( - ` - created journey: ${apiResponse.journey.interactionKey} (auto-created when ${this.definition.type} ${apiResponse.definitionKey} was created)`, + ` - created journey: ${apiResponse.journey.interactionKey} (auto-created when ${this.definition.type} ${apiResponse.definitionKey} was created)` ); // when we create new transactionalEmails, we should also download the new journey that was created with it this._createdJourneyKeys ||= []; @@ -110,7 +110,7 @@ class TransactionalEmail extends TransactionalMessage { Util.logger.warn( `Please download related journeys via: mcdev r ${this.buObject.credential}/${ this.buObject.businessUnit - } journey "${this._createdJourneyKeys.join(',')}"`, + } journey "${this._createdJourneyKeys.join(',')}"` ); } delete this._createdJourneyKeys; @@ -132,13 +132,13 @@ class TransactionalEmail extends TransactionalMessage { 'asset', metadata.content.customerKey, 'customerKey', - 'customerKey', + 'customerKey' ); } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } delete metadata.content; @@ -154,13 +154,13 @@ class TransactionalEmail extends TransactionalMessage { 'dataExtension', metadata.subscriptions.dataExtension, 'CustomerKey', - 'CustomerKey', + 'CustomerKey' ); } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } delete metadata.subscriptions.dataExtension; @@ -171,14 +171,14 @@ class TransactionalEmail extends TransactionalMessage { // List metadata.subscriptions.r__list_PathName = cache.getListPathName( metadata.subscriptions.list, - 'CustomerKey', + 'CustomerKey' ); delete metadata.subscriptions.list; } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } } @@ -191,13 +191,13 @@ class TransactionalEmail extends TransactionalMessage { 'journey', metadata.journey.interactionKey, 'key', - 'key', + 'key' ); } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } delete metadata.journey; @@ -218,11 +218,11 @@ class TransactionalEmail extends TransactionalMessage { const isDeleted = await super.deleteByKeyREST( '/messaging/v1/' + this.subType + '/definitions/' + key, key, - false, + false ); if (isDeleted && journeyKey) { Util.logger.info( - ` - deleted ${Journey.definition.type}: ${journeyKey} (SFMC auto-deletes the related journey of ${this.definition.type} ${key})`, + ` - deleted ${Journey.definition.type}: ${journeyKey} (SFMC auto-deletes the related journey of ${this.definition.type} ${key})` ); Journey.buObject = this.buObject; Journey.properties = this.properties; diff --git a/lib/metadataTypes/TransactionalMessage.js b/lib/metadataTypes/TransactionalMessage.js index f8db52328..523c6ac27 100644 --- a/lib/metadataTypes/TransactionalMessage.js +++ b/lib/metadataTypes/TransactionalMessage.js @@ -33,7 +33,7 @@ class TransactionalMessage extends MetadataType { const parsed = ( await this.retrieveREST( null, - baseUri + (retrieveDir ? '?$filter=status%20neq%20deleted' : ''), + baseUri + (retrieveDir ? '?$filter=status%20neq%20deleted' : '') ) ).metadata; keyList = Object.keys(parsed); @@ -47,7 +47,7 @@ class TransactionalMessage extends MetadataType { } catch { return null; } - }), + }) ) ).filter(Boolean); const parsed = this.parseResponseBody({ definitions: details }); @@ -57,7 +57,7 @@ class TransactionalMessage extends MetadataType { savedMetadata = await this.saveResults(parsed, retrieveDir, null, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(key), + Util.getKeysString(key) ); } @@ -85,7 +85,7 @@ class TransactionalMessage extends MetadataType { static update(metadata) { return super.updateREST( metadata, - '/messaging/v1/' + this.subType + '/definitions/' + metadata[this.definition.keyField], + '/messaging/v1/' + this.subType + '/definitions/' + metadata[this.definition.keyField] ); } @@ -108,7 +108,7 @@ class TransactionalMessage extends MetadataType { return super.deleteByKeyREST( '/messaging/v1/' + this.subType + '/definitions/' + key, key, - false, + false ); } } diff --git a/lib/metadataTypes/TransactionalPush.js b/lib/metadataTypes/TransactionalPush.js index 65a8adec7..90930c6c5 100644 --- a/lib/metadataTypes/TransactionalPush.js +++ b/lib/metadataTypes/TransactionalPush.js @@ -27,7 +27,7 @@ class TransactionalPush extends TransactionalMessage { 'asset', metadata.content.customerKey, 'customerKey', - 'customerKey', + 'customerKey' ); } if (metadata.options?.badge && typeof metadata.options?.badge !== 'string') { @@ -52,13 +52,13 @@ class TransactionalPush extends TransactionalMessage { 'asset', metadata.content.customerKey, 'customerKey', - 'customerKey', + 'customerKey' ); } catch (ex) { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): ${ex.message}.`, + }): ${ex.message}.` ); } } diff --git a/lib/metadataTypes/TransactionalSMS.js b/lib/metadataTypes/TransactionalSMS.js index 6baae5131..8aff9a02d 100644 --- a/lib/metadataTypes/TransactionalSMS.js +++ b/lib/metadataTypes/TransactionalSMS.js @@ -44,7 +44,7 @@ class TransactionalSMS extends TransactionalMessage { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): HTML detected`, + }): HTML detected` ); } @@ -60,7 +60,7 @@ class TransactionalSMS extends TransactionalMessage { 'mobileKeyword', metadata.subscriptions.shortCode + '.' + metadata.subscriptions.keyword, 'c__codeKeyword', - 'id', + 'id' ); } return metadata; @@ -85,7 +85,7 @@ class TransactionalSMS extends TransactionalMessage { return await File.readFilteredFilename( [deployDir, this.definition.type], templateName + '.' + this.definition.type + '-meta', - 'amp', + 'amp' ); } else { throw new Error(`Could not find ${codePath}.amp`); @@ -114,7 +114,7 @@ class TransactionalSMS extends TransactionalMessage { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): HTML detected`, + }): HTML detected` ); } @@ -126,13 +126,13 @@ class TransactionalSMS extends TransactionalMessage { 'mobileCode', metadata.subscriptions.shortCode, 'code', - 'code', + 'code' ); } catch { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): Could not find mobileCode ${metadata.subscriptions.shortCode}.`, + }): Could not find mobileCode ${metadata.subscriptions.shortCode}.` ); } } @@ -144,13 +144,13 @@ class TransactionalSMS extends TransactionalMessage { 'mobileKeyword', metadata.subscriptions.shortCode + '.' + metadata.subscriptions.keyword, 'keyword', - 'id', + 'id' ); } catch { Util.logger.warn( ` - ${this.definition.type} ${metadata[this.definition.nameField]} (${ metadata[this.definition.keyField] - }): Could not find mobileKeyword ${metadata.subscriptions.keyword}.`, + }): Could not find mobileKeyword ${metadata.subscriptions.keyword}.` ); } } @@ -204,7 +204,7 @@ class TransactionalSMS extends TransactionalMessage { targetDir, metadata, templateVariables, - templateName, + templateName ) { return this._buildForNested( templateDir, @@ -212,7 +212,7 @@ class TransactionalSMS extends TransactionalMessage { metadata, templateVariables, templateName, - 'definition', + 'definition' ); } /** @@ -232,7 +232,7 @@ class TransactionalSMS extends TransactionalMessage { targetDir, metadata, templateVariables, - templateName, + templateName ) { return this._buildForNested( templateDir, @@ -240,7 +240,7 @@ class TransactionalSMS extends TransactionalMessage { metadata, templateVariables, templateName, - 'template', + 'template' ); } @@ -262,7 +262,7 @@ class TransactionalSMS extends TransactionalMessage { metadata, templateVariables, templateName, - mode, + mode ) { // get code from filesystem let code = await this._mergeCode(metadata, templateDir, templateName); @@ -282,7 +282,7 @@ class TransactionalSMS extends TransactionalMessage { throw new Error( `${this.definition.type}:: Error applying template variables on ${ templateName + '.' + this.definition.type - }-meta.${fileExt}.`, + }-meta.${fileExt}.` ); } @@ -298,7 +298,7 @@ class TransactionalSMS extends TransactionalMessage { [targetDir, this.definition.type], fileName + '.' + this.definition.type + '-meta', fileExt, - code, + code ); nestedFilePaths.push([ targetDir, diff --git a/lib/metadataTypes/TriggeredSend.js b/lib/metadataTypes/TriggeredSend.js index f6670ed79..737360703 100644 --- a/lib/metadataTypes/TriggeredSend.js +++ b/lib/metadataTypes/TriggeredSend.js @@ -96,7 +96,7 @@ class TriggeredSend extends MetadataType { this.setFolderPath(metadata); if (!metadata.r__folder_Path) { Util.logger.verbose( - ` ☇ skipping ${this.definition.typeName} '${metadata.Name}'/'${metadata.CustomerKey}': Could not find folder.`, + ` ☇ skipping ${this.definition.typeName} '${metadata.Name}'/'${metadata.CustomerKey}': Could not find folder.` ); // do not save this TSD because it would not be visible in the user interface return; @@ -115,20 +115,20 @@ class TriggeredSend extends MetadataType { 'asset', metadata.Email.ID, 'legacyData.legacyId', - 'name', + 'name' ); metadata.r__assetMessage_Name_readOnly = contentBuilderEmailName; const contentBuilderEmailKey = cache.searchForField( 'asset', metadata.Email.ID, 'legacyData.legacyId', - 'customerKey', + 'customerKey' ); metadata.r__assetMessage_Key = contentBuilderEmailKey; delete metadata.Email; } catch { Util.logger.verbose( - ` - ${this.definition.typeName} '${metadata.Name}'/'${metadata.CustomerKey}': Could not find email with ID ${metadata.Email.ID} in Classic nor in Content Builder. This TSD cannot be republished but potentially restarted with its cached version of the email.`, + ` - ${this.definition.typeName} '${metadata.Name}'/'${metadata.CustomerKey}': Could not find email with ID ${metadata.Email.ID} in Classic nor in Content Builder. This TSD cannot be republished but potentially restarted with its cached version of the email.` ); // save this TSD because it could be fixed by the user or potentially restarted without a fix; also, it might be used by a journey } @@ -140,7 +140,7 @@ class TriggeredSend extends MetadataType { delete metadata.List; } catch (ex) { Util.logger.verbose( - ` - ${this.definition.typeName} '${metadata.Name}'/'${metadata.CustomerKey}': ${ex.message}`, + ` - ${this.definition.typeName} '${metadata.Name}'/'${metadata.CustomerKey}': ${ex.message}` ); // save this TSD because it could be fixed by the user } @@ -161,7 +161,7 @@ class TriggeredSend extends MetadataType { cachedVersion?.TriggeredSendStatus === metadata.TriggeredSendStatus ) { throw new Error( - `Please pause the Triggered Send '${metadata.Name}' before updating it. You may do so via GUI; or via Accenture SFMC DevTools by setting TriggeredSendStatus to 'Inactive'.`, + `Please pause the Triggered Send '${metadata.Name}' before updating it. You may do so via GUI; or via Accenture SFMC DevTools by setting TriggeredSendStatus to 'Inactive'.` ); } // re-add IsPlatformObject, required for visibility @@ -183,14 +183,14 @@ class TriggeredSend extends MetadataType { 'asset', metadata.r__assetMessage_Key, 'customerKey', - 'legacyData.legacyId', + 'legacyData.legacyId' ), }; delete metadata.r__assetMessage_Key; delete metadata.r__assetMessage_Name_readOnly; } else if (metadata?.Email?.ID) { throw new Error( - `r__assetMessage_Key / r__email_Name not defined but instead found Email.ID. Please try re-retrieving this TSD from your BU.`, + `r__assetMessage_Key / r__email_Name not defined but instead found Email.ID. Please try re-retrieving this TSD from your BU.` ); } // get List (optional) @@ -201,7 +201,7 @@ class TriggeredSend extends MetadataType { delete metadata.r__list_PathName; } else if (metadata?.List?.ID) { throw new Error( - `r__list_PathName not defined but instead found List.ID. Please try re-retrieving this TSD from your BU.`, + `r__list_PathName not defined but instead found List.ID. Please try re-retrieving this TSD from your BU.` ); } @@ -340,13 +340,13 @@ class TriggeredSend extends MetadataType { } if (!test[key]) { Util.logger.error( - ` ☇ skipping ${this.definition.typeName}: ${key} - not found on server`, + ` ☇ skipping ${this.definition.typeName}: ${key} - not found on server` ); return false; } if (test[key].TriggeredSendStatus !== 'Active') { Util.logger.error( - ` ☇ skipping ${this.definition.typeName}: ${key} - refresh only needed for running entries (TriggeredSendStatus=Active)`, + ` ☇ skipping ${this.definition.typeName}: ${key} - refresh only needed for running entries (TriggeredSendStatus=Active)` ); return false; } @@ -365,7 +365,7 @@ class TriggeredSend extends MetadataType { const errorMsg = super.getSOAPErrorMsg(ex); Util.logger.error( - ` - failed to pause ${this.definition.typeName}: ${key} - ${errorMsg}`, + ` - failed to pause ${this.definition.typeName}: ${key} - ${errorMsg}` ); return false; } @@ -382,7 +382,7 @@ class TriggeredSend extends MetadataType { } catch (ex) { const errorMsg = super.getSOAPErrorMsg(ex); Util.logger.error( - ` - failed to publish ${this.definition.typeName}: ${key} - ${errorMsg}`, + ` - failed to publish ${this.definition.typeName}: ${key} - ${errorMsg}` ); return false; } @@ -399,7 +399,7 @@ class TriggeredSend extends MetadataType { } catch (ex) { const errorMsg = super.getSOAPErrorMsg(ex); Util.logger.error( - ` - failed to publish ${this.definition.typeName}: ${key} - ${errorMsg}`, + ` - failed to publish ${this.definition.typeName}: ${key} - ${errorMsg}` ); return false; } diff --git a/lib/metadataTypes/User.js b/lib/metadataTypes/User.js index 86af53085..7674b2484 100644 --- a/lib/metadataTypes/User.js +++ b/lib/metadataTypes/User.js @@ -81,7 +81,7 @@ class User extends MetadataType { Role: metadata.c__RoleNamesGlobal .filter( // individual role (which are not manageable nor visible in the GUI) - (roleName) => !roleName.startsWith('Individual role for '), + (roleName) => !roleName.startsWith('Individual role for ') ) .map((roleName) => { let roleCache; @@ -90,7 +90,7 @@ class User extends MetadataType { 'role', roleName, 'Name', - 'CustomerKey', + 'CustomerKey' ); roleCache = cache.getByKey('role', roleKey); } catch { @@ -99,7 +99,7 @@ class User extends MetadataType { } if (roleCache?.c__notAssignable) { throw new Error( - `Default roles starting on 'Marketing Cloud' are not assignable via API and get removed upon update. Please create/update the user manually in the GUI or remove that role.`, + `Default roles starting on 'Marketing Cloud' are not assignable via API and get removed upon update. Please create/update the user manually in the GUI or remove that role.` ); } return { @@ -117,8 +117,8 @@ class User extends MetadataType { metadata.c__AssociatedBusinessUnits.push(metadata.DefaultBusinessUnit); Util.logger.info( Util.getGrayMsg( - ` - adding DefaultBusinessUnit to list of associated Business Units (${metadata.CustomerKey} / ${metadata.Name}): ${metadata.DefaultBusinessUnit}`, - ), + ` - adding DefaultBusinessUnit to list of associated Business Units (${metadata.CustomerKey} / ${metadata.Name}): ${metadata.DefaultBusinessUnit}` + ) ); } if (metadata.c__AssociatedBusinessUnits.length) { @@ -134,7 +134,7 @@ class User extends MetadataType { '_timezone', metadata.c__TimeZoneName, 'description', - 'id', + 'id' ); delete metadata.c__TimeZoneName; } @@ -175,7 +175,7 @@ class User extends MetadataType { error ) { throw new TypeError( - 'SsoIdentity should be an object with IsActive and FederatedID properties.', + 'SsoIdentity should be an object with IsActive and FederatedID properties.' ); } // if SsoIdentity is set, assume this was on purpose and bring it @@ -211,7 +211,7 @@ class User extends MetadataType { metadataKey, hasError, metadataToUpdate, - metadataToCreate, + metadataToCreate ); if (action === 'create') { @@ -308,7 +308,7 @@ class User extends MetadataType { BusinessUnitIds: { BusinessUnitId: buIds }, IsDelete: action === 'delete', }, - }, + } ); } } @@ -327,8 +327,7 @@ class User extends MetadataType { let configureResults = buResponse.Results?.[0]?.Result; if (!configureResults) { Util.logger.debug( - 'buResponse.Results?.[0]?.Result not defined: ' + - JSON.stringify(buResponse), + 'buResponse.Results?.[0]?.Result not defined: ' + JSON.stringify(buResponse) ); return; } @@ -353,8 +352,8 @@ class User extends MetadataType { } else { Util.logger.debug( `Unknown error occured during processing of BU assignment reponse: ${JSON.stringify( - result, - )}`, + result + )}` ); } } @@ -377,14 +376,14 @@ class User extends MetadataType { this.userIdBuMap[userId] ||= []; this.userIdBuMap[userId].push( ...buResult['add'].filter( - (item) => !this.userIdBuMap[userId].includes(item), - ), + (item) => !this.userIdBuMap[userId].includes(item) + ) ); } if (buResult['delete']?.length) { this.userIdBuMap[userId] ||= []; this.userIdBuMap[userId] = this.userIdBuMap[userId].filter( - (item) => !buResult['delete'].includes(item), + (item) => !buResult['delete'].includes(item) ); } } @@ -405,7 +404,7 @@ class User extends MetadataType { if (!metadata.Password) { metadata.Password = this._generatePassword(); Util.logger.info( - ` - Password for ${metadata.UserID} was not given. Generated password:`, + ` - Password for ${metadata.UserID} was not given. Generated password:` ); // use console.log here to print the generated password to bypass the logfile // eslint-disable-next-line no-console @@ -474,8 +473,8 @@ class User extends MetadataType { Util.getGrayMsg( ` - adding role-assignment (${item.after.CustomerKey} / ${ item.after.Name - }): ${addedRoleNames.join(', ')}`, - ), + }): ${addedRoleNames.join(', ')}` + ) ); } } @@ -484,8 +483,8 @@ class User extends MetadataType { Util.getGrayMsg( ` - removing role-assignment (${item.after.CustomerKey} / ${ item.after.Name - }): ${deletedRoleNames.join(', ')}`, - ), + }): ${deletedRoleNames.join(', ')}` + ) ); // add deleted roles to payload with IsDelete=true if (!item.after.Roles) { @@ -500,9 +499,9 @@ class User extends MetadataType { role.Name, item.after.AccountUserID, false, - true, - ), - ), + true + ) + ) ); } } @@ -522,7 +521,7 @@ class User extends MetadataType { roleName, userId, assignmentOnly, - isRoleRemovale = false, + isRoleRemovale = false ) { const assignmentConfigurations = { AssignmentConfiguration: [ @@ -624,15 +623,15 @@ class User extends MetadataType { const resultsBatch = await this.client.soap.retrieveBulk( soapType, fields, - requestParamsUser, + requestParamsUser ); if (Array.isArray(resultsBatch?.Results)) { Util.logger.debug( Util.getGrayMsg( ` - found ${resultsBatch?.Results.length} ${ active ? 'active' : 'inactive' - } ${this.definition.type}s`, - ), + } ${this.definition.type}s` + ) ); if (resultsBulk) { // once first batch is done, the follow just add to result payload @@ -656,7 +655,7 @@ class User extends MetadataType { requestParams, soapType, fields, - resultsBulk, + resultsBulk )) ) { return {}; @@ -667,7 +666,7 @@ class User extends MetadataType { if (resultsBulk?.Results?.length > 0) { if (!singleRetrieve) { Util.logger.info( - Util.getGrayMsg(` - found ${resultsBulk?.Results.length} users`), + Util.getGrayMsg(` - found ${resultsBulk?.Results.length} users`) ); } // split array resultsBulk?.Results into chunks to avoid not getting all roles @@ -677,9 +676,7 @@ class User extends MetadataType { for (let i = 0; i < resultsBulk?.Results?.length; i += chunkSize) { if (i > 0) { Util.logger.info( - Util.getGrayMsg( - ` - Requesting next batch (retrieved BUs for ${i} users)`, - ), + Util.getGrayMsg(` - Requesting next batch (retrieved BUs for ${i} users)`) ); } const chunk = resultsBulk?.Results?.slice(i, i + chunkSize); @@ -693,7 +690,7 @@ class User extends MetadataType { operator: chunk.length > 1 ? 'IN' : 'equals', // API does not allow IN for single item rightOperand: chunk.map((item) => item.AccountUserID), }, - }, + } ) ).Results; for (const item of resultsBatch) { @@ -712,7 +709,7 @@ class User extends MetadataType { const savedMetadata = await this.saveResults(metadata, retrieveDir, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(singleRetrieve), + Util.getKeysString(singleRetrieve) ); if (!singleRetrieve) { // print summary to cli @@ -733,8 +730,8 @@ class User extends MetadataType { } Util.logger.info( Util.getGrayMsg( - `Found ${counter.userActive} active users / ${counter.userInactive} inactive users / ${counter.installedPackage} installed packages`, - ), + `Found ${counter.userActive} active users / ${counter.userInactive} inactive users / ${counter.installedPackage} installed packages` + ) ); } await this.runDocumentOnRetrieve(singleRetrieve, savedMetadata); @@ -799,13 +796,11 @@ class User extends MetadataType { const resultsBatch = await this.client.soap.retrieveBulk( soapType, fields, - requestParamsInstalledPackage, + requestParamsInstalledPackage ); if (Array.isArray(resultsBatch?.Results)) { Util.logger.debug( - Util.getGrayMsg( - ` - found ${resultsBatch?.Results.length} installed packages`, - ), + Util.getGrayMsg(` - found ${resultsBatch?.Results.length} installed packages`) ); if (resultsBulk) { // once first batch is done, the follow just add to result payload @@ -941,7 +936,7 @@ class User extends MetadataType { static async document(metadata) { if (this.buObject.eid !== this.buObject.mid) { Util.logger.error( - `Users can only be retrieved & documented for the ${Util.parentBuName}`, + `Users can only be retrieved & documented for the ${Util.parentBuName}` ); return; } @@ -955,7 +950,7 @@ class User extends MetadataType { this.buObject.credential, Util.parentBuName, ]), - true, + true ).user; } catch (ex) { Util.logger.error(ex.message); @@ -1047,17 +1042,17 @@ class User extends MetadataType { output += this._generateDocMd( users.filter((user) => user.TYPE === 'User' && user.ActiveFlag === '✓'), 'User', - columnsToPrint, + columnsToPrint ); output += this._generateDocMd( users.filter((user) => user.TYPE === 'User' && user.ActiveFlag === '-'), 'Inactivated User', - columnsToPrint, + columnsToPrint ); output += this._generateDocMd( users.filter((user) => user.TYPE === 'Installed Package'), 'Installed Package', - columnsToPrint, + columnsToPrint ); const docPath = File.normalizePath([this.properties.directories.docs, 'user']); @@ -1142,7 +1137,7 @@ class User extends MetadataType { .filter(Boolean) .filter( // individual role (which are not manageable nor visible in the GUI) - (roleName) => !roleName.startsWith('Individual role for '), + (roleName) => !roleName.startsWith('Individual role for ') ) .sort((a, b) => (a < b ? -1 : a > b ? 1 : 0)); } else { @@ -1158,7 +1153,7 @@ class User extends MetadataType { '_timezone', metadata.TimeZone.ID, 'id', - 'description', + 'description' ); delete metadata.TimeZone; } diff --git a/lib/metadataTypes/Verification.js b/lib/metadataTypes/Verification.js index e004803ef..28cfc5ab3 100644 --- a/lib/metadataTypes/Verification.js +++ b/lib/metadataTypes/Verification.js @@ -70,7 +70,7 @@ class Verification extends MetadataType { const response = await this.retrieveRESTcollection( paramArr.map((id) => ({ id, uri: '/automation/v1/dataverifications/' + id })), undefined, - !key, + !key ); if (response?.metadata) { Object.assign(results, response.metadata); @@ -80,7 +80,7 @@ class Verification extends MetadataType { const savedMetadata = await this.saveResults(results, retrieveDir, null, null); Util.logger.info( `Downloaded: ${this.definition.type} (${Object.keys(savedMetadata).length})` + - Util.getKeysString(key), + Util.getKeysString(key) ); } @@ -100,12 +100,12 @@ class Verification extends MetadataType { if (ex.message === 'Not Found' || ex.message === 'Request failed with status code 400') { // if the ID is too short, the system will throw the 400 error Util.logger.debug( - ` ☇ skipping ${this.definition.type} ${id}: ${ex.message} ${ex.code}`, + ` ☇ skipping ${this.definition.type} ${id}: ${ex.message} ${ex.code}` ); } else { // if we do get here, we should log the error and continue instead of failing to download all automations Util.logger.error( - ` ☇ skipping ${this.definition.type} ${id}: ${ex.message} ${ex.code}`, + ` ☇ skipping ${this.definition.type} ${id}: ${ex.message} ${ex.code}` ); } return null; @@ -147,7 +147,7 @@ class Verification extends MetadataType { metadataEntryWithAllFields?.[this.definition.idField] }: new key ${ apiResponse?.[this.definition.idField] - } automatically assigned during creation`, + } automatically assigned during creation` ); metadataEntry[this.definition.idField] = apiResponse?.[this.definition.idField]; @@ -170,7 +170,7 @@ class Verification extends MetadataType { static update(metadata) { return super.updateREST( metadata, - '/automation/v1/dataverifications/' + metadata.dataVerificationDefinitionId, + '/automation/v1/dataverifications/' + metadata.dataVerificationDefinitionId ); } @@ -185,7 +185,7 @@ class Verification extends MetadataType { 'dataExtension', metadata.r__dataExtension_CustomerKey, 'CustomerKey', - 'ObjectID', + 'ObjectID' ); delete metadata.r__dataExtension_CustomerKey; return metadata; @@ -202,12 +202,12 @@ class Verification extends MetadataType { 'dataExtension', metadata.targetObjectId, 'ObjectID', - 'CustomerKey', + 'CustomerKey' ); delete metadata.targetObjectId; } catch (ex) { Util.logger.warn( - ` - ${this.definition.type} ${metadata[this.definition.keyField]}: ${ex.message}`, + ` - ${this.definition.type} ${metadata[this.definition.keyField]}: ${ex.message}` ); } return metadata; diff --git a/lib/retrieveChangelog.js b/lib/retrieveChangelog.js index 2e7ad1f8f..c6130ad7e 100644 --- a/lib/retrieveChangelog.js +++ b/lib/retrieveChangelog.js @@ -77,7 +77,7 @@ const customDefinition = { lb: getUserName(userList, item, def.lastmodNameField), }; return listEntry; - }), + }) ); } }); diff --git a/lib/util/auth.js b/lib/util/auth.js index daa55d843..3bf665138 100644 --- a/lib/util/auth.js +++ b/lib/util/auth.js @@ -34,7 +34,7 @@ const Auth = { if (missingAccess.length) { Util.logger.warn( - 'Installed package has insufficient access. You might encounter malfunctions!', + 'Installed package has insufficient access. You might encounter malfunctions!' ); Util.logger.warn('Missing scope: ' + missingAccess.join(', ')); } @@ -97,8 +97,8 @@ function setupSDK(sessionKey, authObject) { onLoop: (type, accumulator) => { Util.logger.info( Util.getGrayMsg( - ` - Requesting next batch (currently ${accumulator?.length} records)`, - ), + ` - Requesting next batch (currently ${accumulator?.length} records)` + ) ); }, onRefresh: (authObject) => { @@ -112,10 +112,10 @@ function setupSDK(sessionKey, authObject) { }${ ex.endpoint ? Util.getGrayMsg( - ' - ' + ex.endpoint.split('rest.marketingcloudapis.com')[1], + ' - ' + ex.endpoint.split('rest.marketingcloudapis.com')[1] ) : '' - }`, + }` ); Util.logger.errorStack(ex); }, @@ -124,7 +124,7 @@ function setupSDK(sessionKey, authObject) { if (msg.url === '/Service.asmx') { msg.data = msg.data.replaceAll( //gim, - '*** TOKEN REMOVED ***', + '*** TOKEN REMOVED ***' ); } else if (msg.headers?.Authorization) { msg.headers.Authorization = 'Bearer *** TOKEN REMOVED ***'; @@ -142,7 +142,7 @@ function setupSDK(sessionKey, authObject) { // printing it separately leads to better formatting Util.logger.debug( 'API REQUEST body >> \n ' + - (typeof data === 'string' ? data : JSON.stringify(data, null, 2)), + (typeof data === 'string' ? data : JSON.stringify(data, null, 2)) ); } } diff --git a/lib/util/businessUnit.js b/lib/util/businessUnit.js index ad925a628..b26e010fc 100644 --- a/lib/util/businessUnit.js +++ b/lib/util/businessUnit.js @@ -29,7 +29,7 @@ const BusinessUnit = { const buResult = await client.soap.retrieve( 'BusinessUnit', ['Name', 'ID', 'ParentName', 'ParentID', 'IsActive'], - { QueryAllAccounts: true }, + { QueryAllAccounts: true } ); if (buResult !== null && !buResult.Results) { Util.logger.error(`Credentials worked but no BUs found. Check access rights!`); @@ -69,20 +69,20 @@ const BusinessUnit = { Util.logger.info( ` - ${element.Name} ${ element.Name === equalizedName ? '' : `(${equalizedName})` - }`, + }` ); } } Util.logger.debug(`EID: ${currentCredentials.eid}`); if (currentCredentials.eid === null) { Util.logger.warn( - `It seems your 'installed package' was not created on the Parent BU of your instance.`, + `It seems your 'installed package' was not created on the Parent BU of your instance.` ); Util.logger.warn( - `While basic functionality will work, it is strongly recommended that you create a new 'installed package' there to enable support for shared Data Extensions and automatic retrieval of the BU list.`, + `While basic functionality will work, it is strongly recommended that you create a new 'installed package' there to enable support for shared Data Extensions and automatic retrieval of the BU list.` ); Util.logger.warn( - `If you cannot create a package on the Parent BU, please open your ./.mcdevrc.json and update the list of BUs and their MIDs manually.`, + `If you cannot create a package on the Parent BU, please open your ./.mcdevrc.json and update the list of BUs and their MIDs manually.` ); // allow user to work by setting this to an obviously false value which nonetheless doesn't block execution currentCredentials.eid = -1; @@ -91,7 +91,7 @@ const BusinessUnit = { await File.writeJSONToFile( properties.directories.businessUnits, File.filterIllegalFilenames(credentialsName + '.businessUnits'), - buResult.Results, + buResult.Results ); // update config await File.saveConfigFile(properties); diff --git a/lib/util/cache.js b/lib/util/cache.js index e4b571cf4..f7a133f5b 100644 --- a/lib/util/cache.js +++ b/lib/util/cache.js @@ -97,32 +97,32 @@ export default { if ( Util.resolveObjPath( searchField, - dataStore[overrideMID || currentMID][metadataType][key], + dataStore[overrideMID || currentMID][metadataType][key] ) == searchValue ) { try { if ( Util.resolveObjPath( returnField, - dataStore[overrideMID || currentMID][metadataType][key], + dataStore[overrideMID || currentMID][metadataType][key] ) ) { return Util.resolveObjPath( returnField, - dataStore[overrideMID || currentMID][metadataType][key], + dataStore[overrideMID || currentMID][metadataType][key] ); } else { throw new Error(); // eslint-disable-line unicorn/error-message } } catch { throw new Error( - `${metadataType} with ${searchField} '${searchValue}' does not have field '${returnField}'`, + `${metadataType} with ${searchField} '${searchValue}' does not have field '${returnField}'` ); } } } throw new Error( - `Dependent ${metadataType} with ${searchField}='${searchValue}' was not found on your BU`, + `Dependent ${metadataType} with ${searchField}='${searchValue}' was not found on your BU` ); }, /** @@ -153,13 +153,13 @@ export default { } } catch { throw new Error( - `${'list'} with ${searchField}='${searchValue}' does not have the fields ${returnField1} and ${returnField2}`, + `${'list'} with ${searchField}='${searchValue}' does not have the fields ${returnField1} and ${returnField2}` ); } } } throw new Error( - `Dependent list with ${searchField}='${searchValue}' was not found on your BU`, + `Dependent list with ${searchField}='${searchValue}' was not found on your BU` ); }, /** @@ -187,13 +187,13 @@ export default { } } catch { throw new Error( - `${'list'} with ListName='${listName}' and r__folder_Path='${folderPath}' does not have field '${returnField}'`, + `${'list'} with ListName='${listName}' and r__folder_Path='${folderPath}' does not have field '${returnField}'` ); } } } throw new Error( - `Dependent list with ListName='${listName}' and r__folder_Path='${folderPath}' was not found on your BU`, + `Dependent list with ListName='${listName}' and r__folder_Path='${folderPath}' was not found on your BU` ); }, }; diff --git a/lib/util/cli.js b/lib/util/cli.js index 31dfc05e9..c35aa453a 100644 --- a/lib/util/cli.js +++ b/lib/util/cli.js @@ -45,7 +45,7 @@ const Cli = { Util.logger.info('\nPlease enter your new credentials'); if (skipInteraction && properties.credentials[skipInteraction.credentialName]) { Util.logger.error( - `Credential '${skipInteraction.credentialName}' already existing. If you tried updating please provide run 'mcdev init ${skipInteraction.credentialName}'`, + `Credential '${skipInteraction.credentialName}' already existing. If you tried updating please provide run 'mcdev init ${skipInteraction.credentialName}'` ); return null; } @@ -73,7 +73,7 @@ const Cli = { type: 'confirm', name: 'fixKeysReretrieve', message: `Do you want to re-retrieve dependent types (${dependentTypes.join( - ', ', + ', ' )}) now?`, default: true, }, @@ -160,7 +160,7 @@ const Cli = { businessUnit = response.businessUnit; if (!isCredentialOnly) { Util.logger.info( - `You could directly pass in this info with '${credential}/${businessUnit}'`, + `You could directly pass in this info with '${credential}/${businessUnit}'` ); } else if (credential && !businessUnit && 'string' === typeof isCredentialOnly) { // BU pre-selected @@ -173,13 +173,13 @@ const Cli = { // correct credential provided but BU still needed if (businessUnit && businessUnit !== 'undefined') { Util.logger.warn( - `Business Unit '${businessUnit}' not found for credential '${credential}'`, + `Business Unit '${businessUnit}' not found for credential '${credential}'` ); } const response = await this._selectBU(properties, credential, null, allowAll); businessUnit = response.businessUnit; Util.logger.info( - `You could directly pass in this info with '${credential}/${businessUnit}'`, + `You could directly pass in this info with '${credential}/${businessUnit}'` ); } return { @@ -298,7 +298,7 @@ const Cli = { inputData = skipInteraction; } else { throw new Error( - '--skipInteraction flag found but not defined for all required inputs: client_id,client_secret,auth_url,account_id,credentialName', + '--skipInteraction flag found but not defined for all required inputs: client_id,client_secret,auth_url,account_id,credentialName' ); } } else { @@ -314,7 +314,7 @@ const Cli = { auth_url: inputData.auth_url, account_id: Number.parseInt(inputData.account_id), }, - inputData.credentialName, + inputData.credentialName ); credentialsGood = true; // update central config now that the credentials are verified @@ -412,7 +412,7 @@ const Cli = { type: 'number', name: 'account_id', message: 'MID of Parent Business Unit', - }, + } ); const responses = await inquirer.prompt(questions); // remove extra white space @@ -443,11 +443,11 @@ const Cli = { } else { if (Util.logger.level === 'debug') { Util.logger.warn( - 'Debug mode enabled. Allowing selection of "disabled" types. Please be aware that these might be unstable.', + 'Debug mode enabled. Allowing selection of "disabled" types. Please be aware that these might be unstable.' ); } else { Util.logger.info( - 'Run mcdev selectTypes --debug if you need to use "disabled" types.', + 'Run mcdev selectTypes --debug if you need to use "disabled" types.' ); } const flattenedDefinitions = []; @@ -544,7 +544,7 @@ const Cli = { */ _summarizeSubtypes(responses, type) { const selectedAssetSubtypes = responses.selectedTypes.filter((str) => - str.includes(type + '-'), + str.includes(type + '-') ); if ( selectedAssetSubtypes.length === MetadataDefinitions[type].typeRetrieveByDefault.length @@ -552,12 +552,12 @@ const Cli = { const nonDefaultSelectedAssetSubtypes = selectedAssetSubtypes .map((subtype) => subtype.replace(type + '-', '')) .filter( - (subtype) => !MetadataDefinitions[type].typeRetrieveByDefault.includes(subtype), + (subtype) => !MetadataDefinitions[type].typeRetrieveByDefault.includes(subtype) ); if (!nonDefaultSelectedAssetSubtypes.length) { // found all defaults and nothing else. replace with main type responses.selectedTypes = responses.selectedTypes.filter( - (str) => !str.includes(type + '-'), + (str) => !str.includes(type + '-') ); responses.selectedTypes.push(type); @@ -598,11 +598,11 @@ const Cli = { Object.prototype.hasOwnProperty.call(supportCheckClass, 'update'), buildTemplate: Object.prototype.hasOwnProperty.call( supportCheckClass, - 'create', + 'create' ), // supported for all types that can be created retrieveAsTemplate: Object.prototype.hasOwnProperty.call( supportCheckClass, - 'retrieveAsTemplate', + 'retrieveAsTemplate' ), }, description: details.typeDescription, diff --git a/lib/util/config.js b/lib/util/config.js index 33229d6e7..b5a33918d 100644 --- a/lib/util/config.js +++ b/lib/util/config.js @@ -57,21 +57,21 @@ const config = { config.properties.credentials[cred].eid }) and ${Util.authFileName} (${typeof auth[cred].account_id} ${ auth[cred].account_id - }) have a Enterprise ID mismatch. Please check.`, + }) have a Enterprise ID mismatch. Please check.` ); return; } // TODO add auth checks #294 } else if (!silent) { Util.logger.error( - `'${cred}' found in ${Util.configFileName} but not in ${Util.authFileName}. Please run 'mcdev init' to provide the missing credential details.`, + `'${cred}' found in ${Util.configFileName} but not in ${Util.authFileName}. Please run 'mcdev init' to provide the missing credential details.` ); return; } } } else if (!silent && !isInit) { Util.logger.error( - `${Util.authFileName} not found. Please run 'mcdev init' to provide the missing credential details.`, + `${Util.authFileName} not found. Please run 'mcdev init' to provide the missing credential details.` ); return; } @@ -104,7 +104,7 @@ const config = { // check if user is running older (ignores patches) mcdev version than whats saved to the config if (properties.version && semver.gt(properties.version, Util.packageJsonMcdev.version)) { Util.logger.error( - `Your Accenture SFMC DevTools version ${Util.packageJsonMcdev.version} is lower than your project's config version ${properties.version}`, + `Your Accenture SFMC DevTools version ${Util.packageJsonMcdev.version} is lower than your project's config version ${properties.version}` ); if (Util.skipInteraction) { return false; @@ -138,7 +138,7 @@ const config = { for (const cred in properties.credentials) { if (cred.includes('/') || cred.includes('\\')) { errorMsgs.push( - `Credential names may not includes slashes: ${cred}`, + `Credential names may not includes slashes: ${cred}` ); solutionSet.add('Apply manual fix in your config.'); } @@ -153,14 +153,14 @@ const config = { for (const buName in properties.credentials[cred].businessUnits) { if (buName.includes('/') || buName.includes('\\')) { errorMsgs.push( - `Business Unit names may not includes slashes: ${cred}: ${buName}`, + `Business Unit names may not includes slashes: ${cred}: ${buName}` ); solutionSet.add(`Run 'mcdev reloadBUs ${cred}'`); } if ( Object.prototype.hasOwnProperty.call( properties.credentials[cred].businessUnits, - buName, + buName ) && properties.credentials[cred].businessUnits[buName] !== 0 ) { @@ -186,10 +186,10 @@ const config = { Array.isArray(defaultProps[key][subkey]) ? 'Array' : typeof defaultProps[key][subkey] - }): ${defaultProps[key][subkey]}`, + }): ${defaultProps[key][subkey]}` ); solutionSet.add( - `Run 'mcdev upgrade' to fix missing or changed configuration options`, + `Run 'mcdev upgrade' to fix missing or changed configuration options` ); missingFields.push(`${key}.${subkey}`); } else if (subkey === 'deployment') { @@ -197,11 +197,11 @@ const config = { if ( Object.prototype.hasOwnProperty.call( defaultProps[key][subkey], - dkey, + dkey ) && !Object.prototype.hasOwnProperty.call( properties[key][subkey], - dkey, + dkey ) ) { errorMsgs.push( @@ -209,10 +209,10 @@ const config = { Array.isArray(defaultProps[key][subkey][dkey]) ? 'Array' : typeof defaultProps[key][subkey][dkey] - }): ${defaultProps[key][subkey][dkey]}`, + }): ${defaultProps[key][subkey][dkey]}` ); solutionSet.add( - `Run 'mcdev upgrade' to fix missing or changed configuration options`, + `Run 'mcdev upgrade' to fix missing or changed configuration options` ); missingFields.push(`${key}.${subkey}.${dkey}`); } @@ -223,7 +223,7 @@ const config = { } else { errorMsgs.push(`${key}{} missing`); solutionSet.add( - `Run 'mcdev upgrade' to fix missing or changed configuration options`, + `Run 'mcdev upgrade' to fix missing or changed configuration options` ); missingFields.push(key); } @@ -233,12 +233,12 @@ const config = { if ( !properties.version || (![null, 'patch'].includes( - semver.diff(Util.packageJsonMcdev.version, properties.version), + semver.diff(Util.packageJsonMcdev.version, properties.version) ) && semver.gt(Util.packageJsonMcdev.version, properties.version)) ) { errorMsgs.push( - `Your project's config version ${properties.version} is lower than your Accenture SFMC DevTools version ${Util.packageJsonMcdev.version}`, + `Your project's config version ${properties.version} is lower than your Accenture SFMC DevTools version ${Util.packageJsonMcdev.version}` ); solutionSet.add(`Run 'mcdev upgrade' to ensure optimal performance`); missingFields.push('version'); @@ -261,7 +261,7 @@ const config = { [ 'Here is what you can do to fix these issues:', ...Array.from(solutionSet), - ].join('\n- '), + ].join('\n- ') ); const responses = await inquirer.prompt([ { diff --git a/lib/util/devops.js b/lib/util/devops.js index 5ebd08082..7589ad05b 100644 --- a/lib/util/devops.js +++ b/lib/util/devops.js @@ -32,7 +32,7 @@ const DevOps = { path .normalize(properties.directories.retrieve + filePath) .split('\\') - .join('/'), + .join('/') ) : [properties.directories.retrieve]; if (range) { @@ -42,7 +42,7 @@ const DevOps = { range = range + '..HEAD'; } Util.logger.info( - `Analyzing changes in directories: ${filterPaths} based on commit range: ${range}`, + `Analyzing changes in directories: ${filterPaths} based on commit range: ${range}` ); } else { // get the last 10 commits by default to choose from. Default can be changed in mcdev config. @@ -122,7 +122,7 @@ const DevOps = { return true; } else { Util.logger.debug( - `Unknown metadata-type found for (${file.file}): ` + file.type, + `Unknown metadata-type found for (${file.file}): ` + file.type ); return false; } @@ -172,7 +172,7 @@ const DevOps = { MetadataType[file.type].readBUMetadataForType( buPath, false, - metadata[file._credential][file._businessUnit], + metadata[file._credential][file._businessUnit] ); } catch (ex) { // silently catch directory-not-found errors here @@ -195,7 +195,7 @@ const DevOps = { Util.logger.warn( `- ❌ No changes found. Check what branch you are currently on and if the target branch name (${rangeUserInput}${ range === rangeUserInput ? '' : ' converted to ' + range - }) was correct`, + }) was correct` ); return []; } @@ -207,11 +207,11 @@ const DevOps = { await File.writeJSONToFile(directoryDeltaPkg, 'delta_package', delta); this.document(directoryDeltaPkg, delta); Util.logger.info( - `- ✔️ Identified changes: Add/Update=${gitActionsCounter['add/update']}, Move=${gitActionsCounter['move']}, Delete=${gitActionsCounter['delete']}`, + `- ✔️ Identified changes: Add/Update=${gitActionsCounter['add/update']}, Move=${gitActionsCounter['move']}, Delete=${gitActionsCounter['delete']}` ); if (gitActionsCounter.delete > 0) { Util.logger.warn( - 'Please note that deletions have to be done manually on the SFMC website.', + 'Please note that deletions have to be done manually on the SFMC website.' ); } Util.logger.info(`Saved report in ${path.join(directoryDeltaPkg, 'delta_package.md')}`); @@ -236,7 +236,7 @@ const DevOps = { buObjects[`${file._credential}/${file._businessUnit}`] = await Cli.getCredentialObject( properties, - `${file._credential}/${file._businessUnit}`, + `${file._credential}/${file._businessUnit}` ); } } @@ -246,7 +246,7 @@ const DevOps = { MetadataType[type].buObject = buObject; MetadataType[type].properties = properties; const additionalFiles = await MetadataType[type].getFilesToCommit( - typeKeysMap[type], + typeKeysMap[type] ); if (additionalFiles?.length) { delta.push( @@ -259,8 +259,8 @@ const DevOps = { .filter( // avoid adding files that we already have in the list (addFile) => - !delta.find((existFile) => existFile.file === addFile.file), - ), + !delta.find((existFile) => existFile.file === addFile.file) + ) ); } } @@ -288,7 +288,7 @@ const DevOps = { properties.directories.deploy, buObject.credential, buObject.businessUnit, - ]), + ]) ); } } @@ -303,9 +303,9 @@ const DevOps = { .normalize(file.file) .replace( path.normalize(properties.directories.retrieve), - path.normalize(properties.directories.deploy), - ), - ), + path.normalize(properties.directories.deploy) + ) + ) ); const results = await Promise.all(copied); const failed = results.filter((result) => result.status === 'failed'); @@ -314,12 +314,12 @@ const DevOps = { Util.logger.info( `Copied changes to deploy directory (${ results.length - skipped.length - failed.length - } copied)`, + } copied)` ); Util.logger.debug( `Copied changes to deploy directory (${ results.length - skipped.length - failed.length - } copied, ${skipped.length} skipped, ${failed.length} failed)`, + } copied, ${skipped.length} skipped, ${failed.length} failed)` ); if (skipped.length > 0) { for (const file of skipped) { @@ -381,7 +381,7 @@ const DevOps = { targetML = properties.options.deployment.sourceTargetMapping[sourceML]; if ('string' !== typeof targetML) { throw new TypeError( - 'Please define one target marketList per source in deployment.sourceTargetMapping (No arrays allowed)', + 'Please define one target marketList per source in deployment.sourceTargetMapping (No arrays allowed)' ); } Util.verifyMarketList(targetML, properties); @@ -438,7 +438,7 @@ const DevOps = { // get unique list (original search might include more than one entry for types with docs or extracted code) const keyArr = [...new Set(buTypeDelta[bu][type])]; Util.logger.info( - `⚡ mcdev bt ${bu} ${type} "${keyArr.join(',')}" ${sourceMarket}`, + `⚡ mcdev bt ${bu} ${type} "${keyArr.join(',')}" ${sourceMarket}` ); await Builder.buildTemplate(bu, type, keyArr, sourceMarket); // ensure we have the right key for bd/bdb that matches the name used for rt @@ -456,7 +456,7 @@ const DevOps = { Util.logger.info(`- ✔️ Templates created: ${deltaCounter}`); } else { Util.logger.warn( - `- No Templates or Deploy Definitions created for ${sourceMlName}`, + `- No Templates or Deploy Definitions created for ${sourceMlName}` ); continue; } @@ -491,11 +491,11 @@ const DevOps = { const bdPromises = []; for (const type in typeDelta) { Util.logger.info( - `⚡ mcdev bdb ${targetMlName} ${type} "${typeDelta[type].join(',')}"`, + `⚡ mcdev bdb ${targetMlName} ${type} "${typeDelta[type].join(',')}"` ); // omitting "await" to speed up creation bdPromises.push( - Builder.buildDefinitionBulk(targetMlName, type, typeDelta[type].join(',')), + Builder.buildDefinitionBulk(targetMlName, type, typeDelta[type].join(',')) ); } await Promise.all(bdPromises); @@ -508,13 +508,13 @@ const DevOps = { Util.logger.info(`You can now run deploy on the prepared BUs`); } else { Util.logger.info( - `Your templated defintions are now ready to be copied into the deploy folder. Hint: You can have this auto-copied if you adjust directories.templateBuilds in your config.`, + `Your templated defintions are now ready to be copied into the deploy folder. Hint: You can have this auto-copied if you adjust directories.templateBuilds in your config.` ); } } if (!deltaDeployAll.length) { Util.logger.error( - '- ❌ No Templates or Deploy Definitions created. Check if you expected no changes.', + '- ❌ No Templates or Deploy Definitions created. Check if you expected no changes.' ); } return deltaDeployAll; diff --git a/lib/util/file.js b/lib/util/file.js index b28ec8051..682f897ae 100644 --- a/lib/util/file.js +++ b/lib/util/file.js @@ -303,8 +303,8 @@ const File = { `Error Log\nParser: ${FileFs.prettierConfig.parser}\n${ex.message.replaceAll( /[\u001B\u009B][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, - '', - )}`, + '' + )}` ); formatted = content; @@ -424,7 +424,7 @@ const File = { direntPath, depth - 1, includeStem, - _stemLength, + _stemLength ); children = children.concat(nestedChildren); } @@ -488,7 +488,7 @@ const File = { path.join(directory, dirent.name), depth - 1, includeStem, - _stemLength, + _stemLength ); children.push(...nestedChildren); } @@ -527,12 +527,12 @@ const File = { // by using process.cwd we are limiting ourselves to a config in the project root // note: overrides will be ignored unless they are for *.html if hand in an html file here. This method includes the overrides corresponding to the file we pass in FileFs.prettierConfig = await prettier.resolveConfig( - path.join(process.cwd(), 'index.' + filetype), + path.join(process.cwd(), 'index.' + filetype) ); if (FileFs.prettierConfig === null) { // set to false to avoid re-running this after an initial failure throw new Error( - `No .prettierrc found in your project directory. Please run 'mcdev upgrade' to create it`, + `No .prettierrc found in your project directory. Please run 'mcdev upgrade' to create it` ); } diff --git a/lib/util/init.config.js b/lib/util/init.config.js index cf7c5473e..a8309d4d1 100644 --- a/lib/util/init.config.js +++ b/lib/util/init.config.js @@ -87,14 +87,14 @@ const Init = { } delete properties.options.documentOnRetrieve; upgradeMsgs.push( - `- ✔️ converted 'options.documentOnRetrieve' to '${fieldName}'`, + `- ✔️ converted 'options.documentOnRetrieve' to '${fieldName}'` ); break; } case 'options.deployment.commitHistory': { if (properties.options.commitHistory) { upgradeMsgs.push( - `- ✔️ converted 'options.commitHistory' to '${fieldName}'`, + `- ✔️ converted 'options.commitHistory' to '${fieldName}'` ); properties.options.deployment.commitHistory = properties.options.commitHistory; @@ -133,17 +133,17 @@ const Init = { // ensure we document dataExtensions and automations on retrieve as they should now be in the retrieve folder this._updateLeaf(properties, defaultProps, 'metaDataTypes.documentOnRetrieve'); upgradeMsgs.push( - `- ✔️ updated 'metaDataTypes.documentOnRetrieve' to include all available types`, + `- ✔️ updated 'metaDataTypes.documentOnRetrieve' to include all available types` ); // check if metaDataTypes.retrieve is set to default values and if not, launch selectTypes const defaultRetrieveArr = Util.getRetrieveTypeChoices(); let reselectDefaultRetrieve = false; const toBeRemovedTypes = properties.metaDataTypes.retrieve.filter( - (type) => !defaultRetrieveArr.includes(type), + (type) => !defaultRetrieveArr.includes(type) ); const toBeAddedTypes = defaultRetrieveArr.filter( - (type) => !properties.metaDataTypes.retrieve.includes(type), + (type) => !properties.metaDataTypes.retrieve.includes(type) ); if (toBeRemovedTypes.length || toBeAddedTypes.length) { @@ -156,7 +156,7 @@ const Init = { properties.credentials[cred].eid = Number.parseInt(properties.credentials[cred].eid); for (const bu in properties.credentials[cred].businessUnits) { properties.credentials[cred].businessUnits[bu] = Number.parseInt( - properties.credentials[cred].businessUnits[bu], + properties.credentials[cred].businessUnits[bu] ); } updateConfigNeeded = true; @@ -171,7 +171,7 @@ const Init = { if (reselectDefaultRetrieve) { // run selectTypes here as it _also_ runs File.saveConfigFile() Util.logger.warn( - 'Your metaDataTypes.retrieve list is not set to standard values. Resetting config.', + 'Your metaDataTypes.retrieve list is not set to standard values. Resetting config.' ); Util.logger.warn(''); if (toBeAddedTypes.length) { @@ -217,7 +217,7 @@ const Init = { const gitignoreFileName = path.resolve( __dirname, Util.boilerplateDirectory, - 'gitignore-template', + 'gitignore-template' ); if (await File.pathExists(gitignoreFileName)) { const fileContent = await File.readFile(gitignoreFileName, 'utf8'); @@ -225,8 +225,8 @@ const Init = { await this._createIdeConfigFile( ['.' + path.sep, '', '.gitignore'], relevantForcedUpdates, - fileContent, - ), + fileContent + ) ); } else { Util.logger.debug(`Dependency file not found in ${gitignoreFileName}`); @@ -250,8 +250,8 @@ const Init = { creationLog.push( await this._createIdeConfigFile( [subdir + path.sep, fileArr.join('.'), ext], - relevantForcedUpdates, - ), + relevantForcedUpdates + ) ); } } @@ -287,7 +287,7 @@ const Init = { this._updateLeaf( propertiersCur[curKey], defaultPropsCur[curKey], - fieldNameArr.join('.'), + fieldNameArr.join('.') ); } else { propertiersCur[fieldName] = defaultPropsCur[fieldName]; @@ -305,14 +305,14 @@ const Init = { const relevantForcedUpdates = []; if (await File.pathExists(Util.configFileName)) { forceIdeConfigUpdate = File.readJsonSync( - path.resolve(__dirname, Util.boilerplateDirectory, 'forcedUpdates.json'), + path.resolve(__dirname, Util.boilerplateDirectory, 'forcedUpdates.json') ); // return all if no project version was found or only changes from "newer" versions otherwise for (const element of forceIdeConfigUpdate) { if (!projectVersion || semver.gt(element.version, projectVersion)) { relevantForcedUpdates.push( // adapt it for local file systems - ...element.files.map((item) => path.normalize(item)), + ...element.files.map((item) => path.normalize(item)) ); } else { continue; @@ -337,7 +337,7 @@ const Init = { __dirname, Util.boilerplateDirectory, 'files', - fileName, + fileName ); boilerplateFileContent ||= await File.readFile(boilerplateFileName, 'utf8'); @@ -349,11 +349,11 @@ const Init = { } if (relevantForcedUpdates.includes(path.normalize(fileName))) { Util.logger.info( - `- ✋ ${fileName} found but an update is required. Commencing with override:`, + `- ✋ ${fileName} found but an update is required. Commencing with override:` ); } else { Util.logger.info( - `- ✋ ${fileName} found with differences to the new standard version. We recommend updating it.`, + `- ✋ ${fileName} found with differences to the new standard version. We recommend updating it.` ); if (!Util.skipInteraction) { const responses = await inquirer.prompt([ @@ -379,7 +379,7 @@ const Init = { fileNameArr[0], fileNameArr[1], fileNameArr[2].slice(1), - boilerplateFileContent, + boilerplateFileContent ); if (saveStatus) { @@ -388,7 +388,7 @@ const Init = { update ? `updated (we created a backup of the old file under ${fileName + '.BAK'})` : 'created' - }`, + }` ); return true; } else { @@ -418,7 +418,7 @@ const Init = { await File.writeJSONToFile( './', Util.authFileName.replace(/(.json)+$/, ''), - newAuth, + newAuth ); Util.logger.info(`- ✔️ upgraded credential file`); } diff --git a/lib/util/init.git.js b/lib/util/init.git.js index 2c777cd61..b6525d1a6 100644 --- a/lib/util/init.git.js +++ b/lib/util/init.git.js @@ -23,7 +23,7 @@ const Init = { if (!commandExists.sync('git')) { Util.logger.error('Git installation not found.'); Util.logger.error( - 'Please follow our tutorial on installing Git: https://github.com/Accenture/sfmc-devtools#212-install-the-git-command-line', + 'Please follow our tutorial on installing Git: https://github.com/Accenture/sfmc-devtools#212-install-the-git-command-line' ); result.status = 'error'; return result; @@ -41,7 +41,7 @@ const Init = { newRepoInitialized = true; } else { Util.logger.error( - 'We detected a problem initializing your Git repository. Please run "git init" manually', + 'We detected a problem initializing your Git repository. Please run "git init" manually' ); result.status = 'error'; return result; @@ -52,7 +52,7 @@ const Init = { Util.execSync('git', ['config', '--local', 'core.longpaths', 'true']); } catch { Util.logger.warn( - `Updating your git config failed. We recommend running the above command manually yourself to avoid issues.`, + `Updating your git config failed. We recommend running the above command manually yourself to avoid issues.` ); } Util.logger.info('Ensuring checkout (git pull) as-is and commit Unix-style line endings:'); @@ -60,7 +60,7 @@ const Init = { Util.execSync('git', ['config', '--local', 'core.autocrlf', 'input']); } catch { Util.logger.warn( - `Updating your git config failed. We recommend running the above command manually yourself to avoid issues.`, + `Updating your git config failed. We recommend running the above command manually yourself to avoid issues.` ); } @@ -98,7 +98,7 @@ const Init = { if (remoteBranchesExist === false) { // offer git push if no remote branches found Util.logger.info( - `Your remote Git repository is still empty and ready to store your initial backup. Hint: This is the server version of the repo which you share with your team.`, + `Your remote Git repository is still empty and ready to store your initial backup. Hint: This is the server version of the repo which you share with your team.` ); let responses; if (!skipInteraction) { @@ -116,7 +116,7 @@ const Init = { } } else if (remoteBranchesExist === true) { Util.logger.info( - 'Your remote Git repository already contains data. Please execute a git push manually.', + 'Your remote Git repository already contains data. Please execute a git push manually.' ); } } @@ -184,7 +184,7 @@ const Init = { const skipInteraction = Util.skipInteraction; const gitUser = (await this._getGitConfigUser()) || {}; Util.logger.info( - `Please confirm your Git user name & email. It should be in the format 'FirstName LastName' and 'your.email@accenture.com'. The current (potentially wrong) values are provided as default. If correct, confirm with ENTER, otherwise please update:`, + `Please confirm your Git user name & email. It should be in the format 'FirstName LastName' and 'your.email@accenture.com'. The current (potentially wrong) values are provided as default. If correct, confirm with ENTER, otherwise please update:` ); let responses; /* eslint-disable unicorn/prefer-ternary */ diff --git a/lib/util/init.js b/lib/util/init.js index bc1e68310..6ee716537 100644 --- a/lib/util/init.js +++ b/lib/util/init.js @@ -40,7 +40,7 @@ const Init = { // update-credential mode if (!properties.credentials[credentialName]) { Util.logger.error( - `Could not update credential '${credentialName}' because it was not found in your config. Please check your spelling and try again.`, + `Could not update credential '${credentialName}' because it was not found in your config. Please check your spelling and try again.` ); Cli.logExistingCredentials(properties); if (skipInteraction) { @@ -79,7 +79,7 @@ const Init = { missingCredentials.length > 1 ? 's' : '' } in your ${Util.configFileName} that ${ missingCredentials.length > 1 ? 'are' : 'is' - } missing details.`, + } missing details.` ); for (const badCredName of missingCredentials) { let error; @@ -123,7 +123,7 @@ const Init = { Util.logger.info('Adding another credential'); } else { throw new Error( - '--skipInteraction flag found but missing required input for client_id,client_secret,auth_url,account_id,credentialName', + '--skipInteraction flag found but missing required input for client_id,client_secret,auth_url,account_id,credentialName' ); } } else { @@ -187,7 +187,7 @@ const Init = { // all done Util.logger.info('You are now ready to work with Accenture SFMC DevTools!'); Util.logger.warn( - 'If you use VSCode, please restart it now to install recommended extensions.', + 'If you use VSCode, please restart it now to install recommended extensions.' ); } }, @@ -228,7 +228,7 @@ const Init = { const repoName = gitRepoQs.gitRepoUrl.split('/').pop().replace('.git', ''); // clone repo into current folder Util.logger.info( - 'Cloning initiated. You might be asked for your Git credentials in a pop-up window in a few seconds.', + 'Cloning initiated. You might be asked for your Git credentials in a pop-up window in a few seconds.' ); Util.execSync( 'git', @@ -238,15 +238,15 @@ const Init = { '--config core.longpaths=true', '--config core.autocrlf=input', gitRepoQs.gitRepoUrl, - ].filter(Boolean), + ].filter(Boolean) ); if (!fs.existsSync(repoName)) { Util.logger.error( - 'Could not clone repository. Please check your Git-Repository URL as well as your credentials and try again.', + 'Could not clone repository. Please check your Git-Repository URL as well as your credentials and try again.' ); Util.logger.info( - 'Check if you need an "API-Token" instead of your normal user password to authenticate', + 'Check if you need an "API-Token" instead of your normal user password to authenticate' ); return; } @@ -257,7 +257,7 @@ const Init = { const properties = await config.getProperties(true, true); if (!properties) { Util.logger.error( - 'Could not find .mcdevrc.json file in project folder. Please check your Git repository and branch.', + 'Could not find .mcdevrc.json file in project folder. Please check your Git repository and branch.' ); return; } @@ -281,7 +281,7 @@ const Init = { // get list of business units const firstCredentialName = Object.keys(properties.credentials)[0]; const businessUnits = Object.keys( - properties.credentials[firstCredentialName].businessUnits, + properties.credentials[firstCredentialName].businessUnits ); // set up empty markets for them @@ -297,14 +297,14 @@ const Init = { // don't ask, list all BUs in deployment-target and set deployment-source to ??? if (!businessUnits.includes(skipInteraction.developmentBu)) { Util.logger.warn( - `Could not find developmentBu=${skipInteraction.developmentBu} in business units. Skipping.`, + `Could not find developmentBu=${skipInteraction.developmentBu} in business units. Skipping.` ); delete skipInteraction.developmentBu; } sourceBuName = skipInteraction.developmentBu || '???'; if (!skipInteraction.developmentBu) { Util.logger.info( - 'Market List "deployment-source" will need to be set up manually. Marking all BUs as target BUs in "deployment-target".', + 'Market List "deployment-source" will need to be set up manually. Marking all BUs as target BUs in "deployment-target".' ); } } else { @@ -361,7 +361,7 @@ const Init = { Util.logger.info(`✔️ SFMC instance backed up`); } else if (gitStatus === 'update') { Util.logger.warn( - 'Please manually commit this backup according to your projects guidelines.', + 'Please manually commit this backup according to your projects guidelines.' ); // TODO create guided commit: // 1. ask if commit with all changes shall be created @@ -388,7 +388,7 @@ const Init = { const versionBeforeUpgrade = properties?.version || '0.0.0'; if (!initial) { Util.logger.info( - 'Upgrading project with newest configuration, npm dependencies & other project configurations:', + 'Upgrading project with newest configuration, npm dependencies & other project configurations:' ); // ensure an existing config is up to current specs @@ -434,12 +434,12 @@ const Init = { Util.logger.warn( `It seems your project folder will be synchronized via '${ cloudServices[variable] === 'CloudDocs' ? 'iCloud' : cloudServices[variable] - }'. This can reduce the overall performance of your computer due to conflicts with Git.`, + }'. This can reduce the overall performance of your computer due to conflicts with Git.` ); Util.logger.warn( `We strongly recommend moving your project folder outside of the '${ cloudServices[variable] === 'CloudDocs' ? 'iCloud' : cloudServices[variable] - }' folder.`, + }' folder.` ); cloudServiceFound = true; } @@ -448,11 +448,11 @@ const Init = { // warn user to not place project folder into user profile folder Util.logger.warn( `It seems your project folder is located in your user profile's default folder which is often synchronized to webservices like ${cloudServices.join( - ', ', - )}. This can reduce the overall performance of your computer due to conflicts between with Git.`, + ', ' + )}. This can reduce the overall performance of your computer due to conflicts between with Git.` ); Util.logger.warn( - `We strongly recommend moving your project folder outside of this folder.`, + `We strongly recommend moving your project folder outside of this folder.` ); cloudServiceFound = true; } @@ -499,7 +499,7 @@ const Init = { properties.credentials[cred].eid != auth[cred].account_id || !auth[cred].client_id || !auth[cred].client_secret || - !auth[cred].auth_url, + !auth[cred].auth_url ); } return missingCredentials || []; diff --git a/lib/util/init.npm.js b/lib/util/init.npm.js index 131e4443b..6b7ff27e2 100644 --- a/lib/util/init.npm.js +++ b/lib/util/init.npm.js @@ -28,7 +28,7 @@ const Init = { fileContent = await File.readFile('package.json', 'utf8'); } catch (ex) { Util.logger.error( - 'Your package.json was found but seems to be corrupted: ' + ex.message, + 'Your package.json was found but seems to be corrupted: ' + ex.message ); } if (fileContent) { @@ -68,7 +68,7 @@ const Init = { const dependencyFile = path.resolve( __dirname, Util.boilerplateDirectory, - 'npm-dependencies.json', + 'npm-dependencies.json' ); if (!(await File.pathExists(dependencyFile))) { Util.logger.debug(`Dependency file not found in ${dependencyFile}`); @@ -92,7 +92,7 @@ const Init = { for (const name of defaultDependencies) { // check project.devDependencies versionsProject[name] = Object.keys(projectPackageJson.devDependencies).includes( - name, + name ) ? projectPackageJson.devDependencies[name].replace(/^[\^~]/, '') : // fallback to invalid version if not found @@ -105,12 +105,12 @@ const Init = { !projectPackageJson.devDependencies || !projectPackageJson.devDependencies[name] || versionsDefault[name] == 'latest' || - semver.gt(versionsDefault[name], versionsProject[name]), + semver.gt(versionsDefault[name], versionsProject[name]) ); if (loadDependencies.length) { Util.logger.info('Installing/Updating Dependencies:'); const args = ['install', '--save-dev'].concat( - loadDependencies.map((name) => `${name}@${versionsDefault[name]}`), + loadDependencies.map((name) => `${name}@${versionsDefault[name]}`) ); Util.execSync('npm', args); @@ -118,9 +118,7 @@ const Init = { } else { Util.logger.info( `✔️ All default dependencies are already installed: ` + - defaultDependencies - .map((name) => `${name}@${versionsProject[name]}`) - .join(', '), + defaultDependencies.map((name) => `${name}@${versionsProject[name]}`).join(', ') ); } return true; diff --git a/lib/util/util.js b/lib/util/util.js index 92d8279f8..80d9ffcb5 100644 --- a/lib/util/util.js +++ b/lib/util/util.js @@ -268,8 +268,8 @@ export const Util = { winston.format.timestamp({ format: 'HH:mm:ss' }), winston.format.simple(), winston.format.printf( - (info) => `${info.timestamp} ${info.level}: ${info.message}`, - ), + (info) => `${info.timestamp} ${info.level}: ${info.message}` + ) ), }), }; @@ -283,8 +283,8 @@ export const Util = { winston.format.timestamp({ format: 'HH:mm:ss.SSS' }), winston.format.simple(), winston.format.printf( - (info) => `${info.timestamp} ${info.level}: ${info.message}`, - ), + (info) => `${info.timestamp} ${info.level}: ${info.message}` + ) ), }); transports.fileError = new winston.transports.File({ @@ -297,8 +297,8 @@ export const Util = { winston.format.timestamp({ format: 'HH:mm:ss.SSS' }), winston.format.simple(), winston.format.printf( - (info) => `${info.timestamp} ${info.level}: ${info.message}`, - ), + (info) => `${info.timestamp} ${info.level}: ${info.message}` + ) ), }); } @@ -331,7 +331,7 @@ export const Util = { return; } Util.loggerTransports = this._createNewLoggerTransport( - noLogFile || Util.OPTIONS?.noLogFile, + noLogFile || Util.OPTIONS?.noLogFile ); const myWinston = winston.createLogger({ level: Util.OPTIONS.loggerLevel, @@ -394,7 +394,7 @@ export const Util = { const processArgv = process.argv.slice(2); Util.logger.debug( - `:: mcdev ${Util.packageJsonMcdev.version} :: ⚡ mcdev ${processArgv.join(' ')}`, + `:: mcdev ${Util.packageJsonMcdev.version} :: ⚡ mcdev ${processArgv.join(' ')}` ); }, /** @@ -489,7 +489,7 @@ export const Util = { dependencies.add(dependentType); } else if ( MetadataDefinitions[dependentType].dependencies.some((dependency) => - dependency.startsWith(fixedType + '-'), + dependency.startsWith(fixedType + '-') ) ) { // if MetadataTypeDefinitions[dependentType].dependencies start with type then also add dependentType to the set; use some to check if any of the dependencies start with type @@ -522,7 +522,7 @@ export const Util = { subTypeDeps[dep.split('-')[0]].add(dep); } return [dep, metadataType]; - }), + }) ); } // if they have no dependencies then just add them with undefined. @@ -642,7 +642,7 @@ export const Util = { throw new Error(`No metadata found with name "${searchValue}"`); } else if (matching.length > 1) { throw new Error( - `Multiple metadata with name "${searchValue}" please rename to be unique to avoid issues`, + `Multiple metadata with name "${searchValue}" please rename to be unique to avoid issues` ); } else { return matching[0]; @@ -690,7 +690,7 @@ export const Util = { */ logBeta(type) { Util.logger.warn( - ` - ${type} support is currently still in beta. Please report any issues here: https://github.com/Accenture/sfmc-devtools/issues/new/choose`, + ` - ${type} support is currently still in beta. Please report any issues here: https://github.com/Accenture/sfmc-devtools/issues/new/choose` ); }, // defined colors for logging things in different colors @@ -742,8 +742,8 @@ export const Util = { if (subTypeArr && subTypeArr.length > 0) { Util.logger.info( Util.getGrayMsg( - ` - Subtype${subTypeArr.length > 1 ? 's' : ''}: ${subTypeArr.join(', ')}`, - ), + ` - Subtype${subTypeArr.length > 1 ? 's' : ''}: ${subTypeArr.join(', ')}` + ) ); } }, @@ -764,7 +764,7 @@ export const Util = { } if (keyArr.length > 0) { return Util.getGrayMsg( - ` - ${isId ? 'ID' : 'Key'}${keyArr.length > 1 ? 's' : ''}: ${keyArr.join(', ')}`, + ` - ${isId ? 'ID' : 'Key'}${keyArr.length > 1 ? 's' : ''}: ${keyArr.join(', ')}` ); } return ''; @@ -839,7 +839,7 @@ export const Util = { // Remove special chars search = search.replaceAll( new RegExp('([\\.\\\\\\+\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:\\-])', 'g'), - '\\$1', + '\\$1' ); // Replace % and _ with equivalent regex search = search.replaceAll('%', '.*').replaceAll('_', '.'); diff --git a/test/general.test.js b/test/general.test.js index a710b9f37..9497b7e22 100644 --- a/test/general.test.js +++ b/test/general.test.js @@ -42,7 +42,7 @@ describe('GENERAL', () => { assert.equal( process.exitCode, false, - 'explainTypes --json should not have thrown an error', + 'explainTypes --json should not have thrown an error' ); // check if properties are all there @@ -51,7 +51,7 @@ describe('GENERAL', () => { 'apiName', 'retrieveByDefault', 'description', - 'supports', + 'supports' ); expect(typeArr[0].supports).to.have.all.keys( 'retrieve', @@ -60,14 +60,14 @@ describe('GENERAL', () => { 'delete', 'changeKey', 'buildTemplate', - 'retrieveAsTemplate', + 'retrieveAsTemplate' ); // check if certain types were returned assert.equal( typeArr.find((type) => type.apiName === 'dataExtension').apiName, 'dataExtension', - 'Expected to find dataExtension type', + 'Expected to find dataExtension type' ); return; @@ -79,7 +79,7 @@ describe('GENERAL', () => { it('should show diff between master and develop branch'); // mcdev createDeltaPkg master..develop it( - 'should show diff between master and develop branch and filter the results to only show MyProject/BU1', + 'should show diff between master and develop branch and filter the results to only show MyProject/BU1' ); // mcdev createDeltaPkg master..develop --filter 'MyProject/BU1' }); diff --git a/test/resourceFactory.js b/test/resourceFactory.js index 089f68df7..7ef2fec66 100644 --- a/test/resourceFactory.js +++ b/test/resourceFactory.js @@ -23,7 +23,7 @@ if ( get() { return ''; }, - }, + } ); } else { // test is executed directly in a command prompt. Use colors. @@ -58,7 +58,7 @@ async function loadSOAPRecords(mcdevAction, type, mid, filter) { testPath + '-response.xml' } instead of the more specific ${ testPath + filterPath + '-response.xml' - }. Make sure this is intended`, + }. Make sure this is intended` ); /* eslint-enable no-console */ } @@ -70,7 +70,7 @@ async function loadSOAPRecords(mcdevAction, type, mid, filter) { console.log( `${color.bgRed}${color.fgBlack}TEST-ERROR${color.reset}: Please create file ${ filterPath ? testPath + filterPath + '-response.xml or ' : '' - }${testPath + '-response.xml'}`, + }${testPath + '-response.xml'}` ); /* eslint-enable no-console */ @@ -142,7 +142,7 @@ export const handleSOAPRequest = async (config) => { config.headers.SOAPAction.toLocaleLowerCase(), jObj.Envelope.Body.RetrieveRequestMsg.RetrieveRequest.ObjectType, jObj.Envelope.Header.fueloauth, - jObj.Envelope.Body.RetrieveRequestMsg.RetrieveRequest.Filter, + jObj.Envelope.Body.RetrieveRequestMsg.RetrieveRequest.Filter ); break; @@ -152,7 +152,7 @@ export const handleSOAPRequest = async (config) => { config.headers.SOAPAction.toLocaleLowerCase(), fullObj.Envelope.Body.CreateRequest.Objects['@_xsi:type'], jObj.Envelope.Header.fueloauth, - null, + null ); break; @@ -162,7 +162,7 @@ export const handleSOAPRequest = async (config) => { config.headers.SOAPAction.toLocaleLowerCase(), fullObj.Envelope.Body.UpdateRequest.Objects['@_xsi:type'], jObj.Envelope.Header.fueloauth, - null, + null ); break; @@ -174,7 +174,7 @@ export const handleSOAPRequest = async (config) => { '@_xsi:type' ], jObj.Envelope.Header.fueloauth, - null, + null ); break; @@ -184,7 +184,7 @@ export const handleSOAPRequest = async (config) => { config.headers.SOAPAction.toLocaleLowerCase(), fullObj.Envelope.Body.DeleteRequest.Objects['@_xsi:type'], jObj.Envelope.Header.fueloauth, - null, + null ); break; @@ -194,7 +194,7 @@ export const handleSOAPRequest = async (config) => { config.headers.SOAPAction.toLocaleLowerCase(), fullObj.Envelope.Body.ScheduleRequestMsg.Interactions.Interaction['@_xsi:type'], jObj.Envelope.Header.fueloauth, - fullObj.Envelope.Body.ScheduleRequestMsg.Interactions.Interaction.ObjectID, + fullObj.Envelope.Body.ScheduleRequestMsg.Interactions.Interaction.ObjectID ); break; @@ -204,14 +204,14 @@ export const handleSOAPRequest = async (config) => { config.headers.SOAPAction.toLocaleLowerCase(), fullObj.Envelope.Body.PerformRequestMsg.Definitions.Definition['@_xsi:type'], jObj.Envelope.Header.fueloauth, - fullObj.Envelope.Body.PerformRequestMsg.Definitions.Definition.ObjectID, + fullObj.Envelope.Body.PerformRequestMsg.Definitions.Definition.ObjectID ); break; } default: { throw new Error( - `The SOAP Action ${config.headers.SOAPAction} is not supported by test handler`, + `The SOAP Action ${config.headers.SOAPAction} is not supported by test handler` ); } } @@ -247,7 +247,7 @@ export const handleRESTRequest = async (config) => { 'resources', config.headers.Authorization.replace('Bearer ', ''), urlObj.pathname, - config.method + '-response', + config.method + '-response' ) .replace(':', '_'); // replace : with _ for Windows @@ -257,7 +257,7 @@ export const handleRESTRequest = async (config) => { const response = JSON.parse( await fs.readFile(testPath + '.json', { encoding: 'utf8', - }), + }) ); response.items = response.items.filter((def) => def.name == filterName); response.count = response.items.length; @@ -280,7 +280,7 @@ export const handleRESTRequest = async (config) => { } else { /* eslint-disable no-console */ console.log( - `${color.bgRed}${color.fgBlack}TEST-ERROR${color.reset}: Please create file ${testPath}.json/.txt`, + `${color.bgRed}${color.fgBlack}TEST-ERROR${color.reset}: Please create file ${testPath}.json/.txt` ); /* eslint-enable no-console */ process.exitCode = 404; diff --git a/test/type.attributeGroup.test.js b/test/type.attributeGroup.test.js index 05994089f..da3698f8c 100644 --- a/test/type.attributeGroup.test.js +++ b/test/type.attributeGroup.test.js @@ -24,7 +24,7 @@ describe('type: attributeGroup', () => { ? Object.keys(retrieve['testInstance/testBU'].attributeGroup).length : 0, 8, - 'only 8 attributeGroups expected in retrieve response', + 'only 8 attributeGroups expected in retrieve response' ); // get results from cache @@ -32,19 +32,19 @@ describe('type: attributeGroup', () => { assert.equal( result.attributeGroup ? Object.keys(result.attributeGroup).length : 0, 8, - 'only 8 attributeGroups expected in cache', + 'only 8 attributeGroups expected in cache' ); assert.deepEqual( await testUtils.getActualJson('ETMobileConnect', 'attributeGroup'), await testUtils.getExpectedJson('9999999', 'attributeGroup', 'retrieve'), - 'returned metadata was not equal expected', + 'returned metadata was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 2, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); diff --git a/test/type.attributeSet.test.js b/test/type.attributeSet.test.js index d9c9a1c6e..a4e44e3aa 100644 --- a/test/type.attributeSet.test.js +++ b/test/type.attributeSet.test.js @@ -24,27 +24,27 @@ describe('type: attributeSet', () => { ? Object.keys(retrieve['testInstance/testBU'].attributeSet).length : 0, 28, - 'only 28 attributeSets expected in retrieve response', + 'only 28 attributeSets expected in retrieve response' ); // get results from cache const result = cache.getCache(); assert.equal( result.attributeSet ? Object.keys(result.attributeSet).length : 0, 28, - 'only 28 attributeSets expected in cache', + 'only 28 attributeSets expected in cache' ); assert.deepEqual( await testUtils.getActualJson('testExisting_dataExtensionShared', 'attributeSet'), await testUtils.getExpectedJson('9999999', 'attributeSet', 'retrieve'), - 'returned metadata was not equal expected', + 'returned metadata was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 7, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); diff --git a/test/type.automation.test.js b/test/type.automation.test.js index 01bcaeba4..d2ebd629c 100644 --- a/test/type.automation.test.js +++ b/test/type.automation.test.js @@ -24,13 +24,13 @@ describe('type: automation', () => { assert.equal( result.automation ? Object.keys(result.automation).length : 0, 4, - 'only four automations expected', + 'only four automations expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'retrieve'), - 'returned metadata was not equal expected', + 'returned metadata was not equal expected' ); // check if MD file was created and equals expectations expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal( @@ -39,14 +39,14 @@ describe('type: automation', () => { '9999999', 'automation', 'retrieve-testExisting_automation', - 'md', - ), - ), + 'md' + ) + ) ); assert.equal( testUtils.getAPIHistoryLength(), 18, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -60,11 +60,7 @@ describe('type: automation', () => { const deployResult = await handler.deploy( 'testInstance/testBU', ['automation', 'verification'], - [ - 'testExisting_automation', - 'testNew_automation', - 'testNew_39f6a488-20eb-4ba0-b0b9', - ], + ['testExisting_automation', 'testNew_automation', 'testNew_39f6a488-20eb-4ba0-b0b9'] ); // THEN assert.equal(process.exitCode, false, 'deploy should not have thrown an error'); @@ -75,7 +71,7 @@ describe('type: automation', () => { ? Object.keys(deployResult['testInstance/testBU']?.automation).length : 0, 2, - 'two automations to be deployed', + 'two automations to be deployed' ); // get results from cache @@ -83,19 +79,19 @@ describe('type: automation', () => { assert.equal( cacheResult.automation ? Object.keys(cacheResult.automation).length : 0, 5, - 'three automations expected', + 'three automations expected' ); // insert assert.deepEqual( await testUtils.getActualJson('testNew_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'create'), - 'returned metadata was not equal expected for create', + 'returned metadata was not equal expected for create' ); // update assert.deepEqual( await testUtils.getActualJson('testExisting_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'update'), - 'returned metadata was not equal expected for update', + 'returned metadata was not equal expected for update' ); // check if MD file was created and equals expectations expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal( @@ -104,9 +100,9 @@ describe('type: automation', () => { '9999999', 'automation', 'update-testExisting_automation', - 'md', - ), - ), + 'md' + ) + ) ); // check if MD file was created and equals expectations @@ -116,15 +112,15 @@ describe('type: automation', () => { '9999999', 'automation', 'create-testNew_automation', - 'md', - ), - ), + 'md' + ) + ) ); assert.equal( testUtils.getAPIHistoryLength(), 25, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -134,17 +130,13 @@ describe('type: automation', () => { const deployed = await handler.deploy( 'testInstance/testBU', ['automation', 'verification'], - [ - 'testExisting_automation', - 'testNew_automation', - 'testNew_39f6a488-20eb-4ba0-b0b9', - ], + ['testExisting_automation', 'testNew_automation', 'testNew_39f6a488-20eb-4ba0-b0b9'] ); // THEN assert.equal( process.exitCode, false, - 'deploy with --execute should not have thrown an error', + 'deploy with --execute should not have thrown an error' ); // get results from cache @@ -152,35 +144,35 @@ describe('type: automation', () => { assert.equal( cached.automation ? Object.keys(cached.automation).length : 0, 5, - 'five cached automation expected', + 'five cached automation expected' ); assert.equal( deployed['testInstance/testBU'].automation ? Object.keys(deployed['testInstance/testBU'].automation).length : 0, 2, - 'two deployed automation expected', + 'two deployed automation expected' ); assert.equal( deployed['testInstance/testBU'].automation ? Object.keys(deployed['testInstance/testBU'].automation)[0] : null, 'testNew_automation', - 'expected specific automation to have been deployed', + 'expected specific automation to have been deployed' ); assert.equal( deployed['testInstance/testBU'].automation ? Object.keys(deployed['testInstance/testBU'].automation)[1] : null, 'testExisting_automation', - 'expected specific automation to have been deployed', + 'expected specific automation to have been deployed' ); // update assert.deepEqual( await testUtils.getActualJson('testExisting_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'update'), - 'returned metadata was not equal expected for update', + 'returned metadata was not equal expected for update' ); // check if MD file was created and equals expectations expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal( @@ -189,15 +181,15 @@ describe('type: automation', () => { '9999999', 'automation', 'update-testExisting_automation', - 'md', - ), - ), + 'md' + ) + ) ); assert.equal( testUtils.getAPIHistoryLength(), 33, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -207,17 +199,13 @@ describe('type: automation', () => { const deployed = await handler.deploy( 'testInstance/testBU', ['automation', 'verification'], - [ - 'testExisting_automation', - 'testNew_automation', - 'testNew_39f6a488-20eb-4ba0-b0b9', - ], + ['testExisting_automation', 'testNew_automation', 'testNew_39f6a488-20eb-4ba0-b0b9'] ); // THEN assert.equal( process.exitCode, false, - 'deploy with --execute should not have thrown an error', + 'deploy with --execute should not have thrown an error' ); // get results from cache @@ -225,34 +213,34 @@ describe('type: automation', () => { assert.equal( cached.automation ? Object.keys(cached.automation).length : 0, 5, - 'five cached automation expected', + 'five cached automation expected' ); assert.equal( deployed['testInstance/testBU'].automation ? Object.keys(deployed['testInstance/testBU'].automation).length : 0, 2, - 'two deployed automation expected', + 'two deployed automation expected' ); assert.equal( deployed['testInstance/testBU'].automation ? Object.keys(deployed['testInstance/testBU'].automation)[0] : null, 'testNew_automation', - 'expected specific automation to have been deployed', + 'expected specific automation to have been deployed' ); assert.equal( deployed['testInstance/testBU'].automation ? Object.keys(deployed['testInstance/testBU'].automation)[1] : null, 'testExisting_automation', - 'expected specific automation to have been deployed', + 'expected specific automation to have been deployed' ); // update assert.deepEqual( await testUtils.getActualJson('testExisting_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'update'), - 'returned metadata was not equal expected for update', + 'returned metadata was not equal expected for update' ); // check if MD file was created and equals expectations expect(file(testUtils.getActualDoc('testExisting_automation', 'automation'))).to.equal( @@ -261,15 +249,15 @@ describe('type: automation', () => { '9999999', 'automation', 'update-testExisting_automation', - 'md', - ), - ), + 'md' + ) + ) ); assert.equal( testUtils.getAPIHistoryLength(), 29, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -290,7 +278,7 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 0, - 'expected to find no keys to be fixed', + 'expected to find no keys to be fixed' ); // get results from cache @@ -298,14 +286,14 @@ describe('type: automation', () => { assert.equal( result.automation ? Object.keys(result.automation).length : 0, 1, - 'one automation expected', + 'one automation expected' ); testUtils.logAPIHistoryDebug(); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 18, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -319,12 +307,12 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_automation_fixedKey_scheduled', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -332,24 +320,24 @@ describe('type: automation', () => { assert.deepEqual( await testUtils.getActualJson( 'testExisting_automation_fixedKey_scheduled', - 'automation', + 'automation' ), await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-schedule'), - 'returned metadata was not equal expected for update automation', + 'returned metadata was not equal expected for update automation' ); expect( file( testUtils.getActualDoc( 'testExisting_automation_fixedKey_scheduled', - 'automation', - ), - ), + 'automation' + ) + ) ).to.exist; // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 40, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -363,12 +351,12 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_automation_fixedKey_scheduled', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -376,24 +364,24 @@ describe('type: automation', () => { assert.deepEqual( await testUtils.getActualJson( 'testExisting_automation_fixedKey_scheduled', - 'automation', + 'automation' ), await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-schedule'), - 'returned metadata was not equal expected for update automation', + 'returned metadata was not equal expected for update automation' ); expect( file( testUtils.getActualDoc( 'testExisting_automation_fixedKey_scheduled', - 'automation', - ), - ), + 'automation' + ) + ) ).to.exist; // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 42, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -407,12 +395,12 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_automation_fixedKey_scheduled', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -420,24 +408,24 @@ describe('type: automation', () => { assert.deepEqual( await testUtils.getActualJson( 'testExisting_automation_fixedKey_scheduled', - 'automation', + 'automation' ), await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-schedule'), - 'returned metadata was not equal expected for update automation', + 'returned metadata was not equal expected for update automation' ); expect( file( testUtils.getActualDoc( 'testExisting_automation_fixedKey_scheduled', - 'automation', - ), - ), + 'automation' + ) + ) ).to.exist; // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 43, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -450,12 +438,12 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_automation_fixedKey_paused', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -463,21 +451,21 @@ describe('type: automation', () => { assert.deepEqual( await testUtils.getActualJson( 'testExisting_automation_fixedKey_paused', - 'automation', + 'automation' ), await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-pause'), - 'returned metadata was not equal expected for update automation', + 'returned metadata was not equal expected for update automation' ); expect( file( - testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation'), - ), + testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation') + ) ).to.exist; // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 35, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -491,12 +479,12 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_automation_fixedKey_paused', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -504,21 +492,21 @@ describe('type: automation', () => { assert.deepEqual( await testUtils.getActualJson( 'testExisting_automation_fixedKey_paused', - 'automation', + 'automation' ), await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-pause'), - 'returned metadata was not equal expected for update automation', + 'returned metadata was not equal expected for update automation' ); expect( file( - testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation'), - ), + testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation') + ) ).to.exist; // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 41, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -532,12 +520,12 @@ describe('type: automation', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_automation_fixedKey_paused', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -545,21 +533,21 @@ describe('type: automation', () => { assert.deepEqual( await testUtils.getActualJson( 'testExisting_automation_fixedKey_paused', - 'automation', + 'automation' ), await testUtils.getExpectedJson('9999999', 'automation', 'patch_fixKeys-pause'), - 'returned metadata was not equal expected for update automation', + 'returned metadata was not equal expected for update automation' ); expect( file( - testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation'), - ), + testUtils.getActualDoc('testExisting_automation_fixedKey_paused', 'automation') + ) ).to.exist; // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 43, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -571,46 +559,46 @@ describe('type: automation', () => { 'testInstance/testBU', 'automation', ['testExisting_automation'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal( process.exitCode, false, - 'retrieveAsTemplate should not have thrown an error', + 'retrieveAsTemplate should not have thrown an error' ); // WHEN assert.equal( result.automation ? Object.keys(result.automation).length : 0, 1, - 'only one automation expected', + 'only one automation expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'template'), - 'returned template was not equal expected', + 'returned template was not equal expected' ); // THEN await handler.buildDefinition( 'testInstance/testBU', 'automation', 'testExisting_automation', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'build'), - 'returned deployment file was not equal expected', + 'returned deployment file was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 20, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -622,42 +610,42 @@ describe('type: automation', () => { 'testInstance/testBU', 'automation', ['testExisting_automation'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); // WHEN assert.equal( result.automation ? Object.keys(result.automation).length : 0, 1, - 'only one automation expected', + 'only one automation expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'template'), - 'returned template was not equal expected', + 'returned template was not equal expected' ); // THEN await handler.buildDefinition( 'testInstance/testBU', 'automation', 'testExisting_automation', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_automation', 'automation'), await testUtils.getExpectedJson('9999999', 'automation', 'build'), - 'returned deployment file was not equal expected', + 'returned deployment file was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 18, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -668,7 +656,7 @@ describe('type: automation', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'automation', - 'testExisting_automation', + 'testExisting_automation' ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); @@ -687,19 +675,19 @@ describe('type: automation', () => { assert.equal( process.exitCode, false, - 'getFilesToCommit should not have thrown an error', + 'getFilesToCommit should not have thrown an error' ); assert.equal(fileList.length, 2, 'expected only 2 file paths'); assert.equal( fileList[0].split('\\').join('/'), 'retrieve/testInstance/testBU/automation/testExisting_automation.automation-meta.json', - 'wrong JSON path', + 'wrong JSON path' ); assert.equal( fileList[1].split('\\').join('/'), 'retrieve/testInstance/testBU/automation/testExisting_automation.automation-doc.md', - 'wrong MD path', + 'wrong MD path' ); return; }); @@ -713,12 +701,12 @@ describe('type: automation', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_automation', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); return; }); @@ -729,12 +717,12 @@ describe('type: automation', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_automation', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); return; }); @@ -747,7 +735,7 @@ describe('type: automation', () => { assert.equal( Object.keys(executedKeys).length, 0, - 'automation was not supposed to be executed', + 'automation was not supposed to be executed' ); return; }); @@ -762,12 +750,12 @@ describe('type: automation', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_automation', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); return; }); @@ -778,12 +766,12 @@ describe('type: automation', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_automation', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); return; }); @@ -796,7 +784,7 @@ describe('type: automation', () => { assert.equal( Object.keys(executedKeys).length, 0, - 'automation was not supposed to be executed', + 'automation was not supposed to be executed' ); return; }); @@ -808,12 +796,12 @@ describe('type: automation', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'automation was supposed to be executed', + 'automation was supposed to be executed' ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_automation', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); return; }); @@ -824,12 +812,12 @@ describe('type: automation', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'automation was supposed to be executed', + 'automation was supposed to be executed' ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_automation', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); return; @@ -843,7 +831,7 @@ describe('type: automation', () => { assert.equal( Object.keys(executedKeys).length, 0, - 'automation was not supposed to be executed', + 'automation was not supposed to be executed' ); return; @@ -858,12 +846,12 @@ describe('type: automation', () => { assert.equal( pausedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( pausedKeys['testInstance/testBU'][0], 'testExisting_automation_pause', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); return; }); @@ -874,12 +862,12 @@ describe('type: automation', () => { assert.equal( pausedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( pausedKeys['testInstance/testBU'][0], 'testExisting_automation_pause', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); return; }); @@ -892,7 +880,7 @@ describe('type: automation', () => { assert.equal( Object.keys(pausedKeys).length, 0, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); return; }); diff --git a/test/type.dataExtension.test.js b/test/type.dataExtension.test.js index 04d593717..55a116c07 100644 --- a/test/type.dataExtension.test.js +++ b/test/type.dataExtension.test.js @@ -24,25 +24,25 @@ describe('type: dataExtension', () => { assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 1, - 'only one dataExtension expected', + 'only one dataExtension expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_dataExtension', 'dataExtension'), await testUtils.getExpectedJson('9999999', 'dataExtension', 'retrieve'), - 'returned metadata was not equal expected', + 'returned metadata was not equal expected' ); // check if MD file was created and equals expectations expect( - file(testUtils.getActualDoc('testExisting_dataExtension', 'dataExtension')), + file(testUtils.getActualDoc('testExisting_dataExtension', 'dataExtension')) ).to.equal( - file(testUtils.getExpectedFile('9999999', 'dataExtension', 'retrieve', 'md')), + file(testUtils.getExpectedFile('9999999', 'dataExtension', 'retrieve', 'md')) ); assert.equal( testUtils.getAPIHistoryLength(), 5, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -56,17 +56,17 @@ describe('type: dataExtension', () => { assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 1, - 'only one dataExtension expected', + 'only one dataExtension expected' ); assert.deepEqual( await testUtils.getActualJson( 'testExisting_dataExtensionShared', 'dataExtension', - '_ParentBU_', + '_ParentBU_' ), await testUtils.getExpectedJson('1111111', 'dataExtension', 'retrieve'), - 'returned metadata was not equal expected', + 'returned metadata was not equal expected' ); // check if MD file was created and equals expectations expect( @@ -74,17 +74,17 @@ describe('type: dataExtension', () => { testUtils.getActualDoc( 'testExisting_dataExtensionShared', 'dataExtension', - '_ParentBU_', - ), - ), + '_ParentBU_' + ) + ) ).to.equal( - file(testUtils.getExpectedFile('1111111', 'dataExtension', 'retrieve', 'md')), + file(testUtils.getExpectedFile('1111111', 'dataExtension', 'retrieve', 'md')) ); assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -104,7 +104,7 @@ describe('type: dataExtension', () => { ? Object.keys(deployResult['testInstance/testBU']?.dataExtension).length : 0, 2, - 'two dataExtensions to be deployed', + 'two dataExtensions to be deployed' ); // get results from cache @@ -112,24 +112,24 @@ describe('type: dataExtension', () => { assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 3, - 'three dataExtensions expected', + 'three dataExtensions expected' ); // insert assert.deepEqual( await testUtils.getActualJson('testNew_dataExtension', 'dataExtension'), await testUtils.getExpectedJson('9999999', 'dataExtension', 'create'), - 'returned metadata was not equal expected for create', + 'returned metadata was not equal expected for create' ); // update assert.deepEqual( await testUtils.getActualJson('testExisting_dataExtension', 'dataExtension'), await testUtils.getExpectedJson('9999999', 'dataExtension', 'update'), - 'returned metadata was not equal expected for update', + 'returned metadata was not equal expected for update' ); assert.equal( testUtils.getAPIHistoryLength(), 11, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -144,7 +144,7 @@ describe('type: dataExtension', () => { ? Object.keys(deployResult['testInstance/_ParentBU_']?.dataExtension).length : 0, 2, - 'two dataExtensions to be deployed', + 'two dataExtensions to be deployed' ); // get results from cache @@ -152,32 +152,32 @@ describe('type: dataExtension', () => { assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 2, - 'two dataExtensions expected', + 'two dataExtensions expected' ); // insert assert.deepEqual( await testUtils.getActualJson( 'testNew_dataExtensionShared', 'dataExtension', - '_ParentBU_', + '_ParentBU_' ), await testUtils.getExpectedJson('1111111', 'dataExtension', 'create'), - 'returned metadata was not equal expected for create', + 'returned metadata was not equal expected for create' ); // update assert.deepEqual( await testUtils.getActualJson( 'testExisting_dataExtensionShared', 'dataExtension', - '_ParentBU_', + '_ParentBU_' ), await testUtils.getExpectedJson('1111111', 'dataExtension', 'update'), - 'returned metadata was not equal expected for update', + 'returned metadata was not equal expected for update' ); assert.equal( testUtils.getAPIHistoryLength(), 8, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -194,7 +194,7 @@ describe('type: dataExtension', () => { ? Object.keys(deployResult['testInstance/_ParentBU_']?.dataExtension).length : 0, 2, - 'two dataExtensions to be deployed', + 'two dataExtensions to be deployed' ); // get results from cache @@ -202,32 +202,32 @@ describe('type: dataExtension', () => { assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 2, - 'two dataExtensions expected', + 'two dataExtensions expected' ); // insert assert.deepEqual( await testUtils.getActualJson( 'testNew_dataExtensionShared', 'dataExtension', - '_ParentBU_', + '_ParentBU_' ), await testUtils.getExpectedJson('1111111', 'dataExtension', 'create'), - 'returned metadata was not equal expected for create', + 'returned metadata was not equal expected for create' ); // update assert.deepEqual( await testUtils.getActualJson( 'testExisting_dataExtensionShared', 'dataExtension', - '_ParentBU_', + '_ParentBU_' ), await testUtils.getExpectedJson('1111111', 'dataExtension', 'update'), - 'returned metadata was not equal expected for update', + 'returned metadata was not equal expected for update' ); assert.equal( testUtils.getAPIHistoryLength(), 12, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -239,49 +239,49 @@ describe('type: dataExtension', () => { 'testInstance/testBU', 'dataExtension', ['testExisting_dataExtension'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal( process.exitCode, false, - 'retrieveAsTemplate should not have thrown an error', + 'retrieveAsTemplate should not have thrown an error' ); // WHEN assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 1, - 'only one dataExtension expected', + 'only one dataExtension expected' ); assert.deepEqual( await testUtils.getActualTemplateJson( 'testExisting_dataExtension', - 'dataExtension', + 'dataExtension' ), await testUtils.getExpectedJson('9999999', 'dataExtension', 'template'), - 'returned template was not equal expected', + 'returned template was not equal expected' ); // THEN await handler.buildDefinition( 'testInstance/testBU', 'dataExtension', 'testExisting_dataExtension', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_dataExtension', 'dataExtension'), await testUtils.getExpectedJson('9999999', 'dataExtension', 'build'), - 'returned deployment file was not equal expected', + 'returned deployment file was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 5, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -293,45 +293,45 @@ describe('type: dataExtension', () => { 'testInstance/testBU', 'dataExtension', ['testExisting_dataExtension'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); // WHEN assert.equal( result.dataExtension ? Object.keys(result.dataExtension).length : 0, 1, - 'only one dataExtension expected', + 'only one dataExtension expected' ); assert.deepEqual( await testUtils.getActualTemplateJson( 'testExisting_dataExtension', - 'dataExtension', + 'dataExtension' ), await testUtils.getExpectedJson('9999999', 'dataExtension', 'template'), - 'returned template was not equal expected', + 'returned template was not equal expected' ); // THEN await handler.buildDefinition( 'testInstance/testBU', 'dataExtension', 'testExisting_dataExtension', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_dataExtension', 'dataExtension'), await testUtils.getExpectedJson('9999999', 'dataExtension', 'build'), - 'returned deployment file was not equal expected', + 'returned deployment file was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 5, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -342,7 +342,7 @@ describe('type: dataExtension', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'dataExtension', - 'testExisting_dataExtension', + 'testExisting_dataExtension' ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); @@ -355,7 +355,7 @@ describe('type: dataExtension', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'dataExtensionField', - 'testExisting_dataExtension.LastName', + 'testExisting_dataExtension.LastName' ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); @@ -370,25 +370,25 @@ describe('type: dataExtension', () => { const fileList = await handler.getFilesToCommit( 'testInstance/testBU', 'dataExtension', - ['testExisting_dataExtension'], + ['testExisting_dataExtension'] ); // THEN assert.equal( process.exitCode, false, - 'getFilesToCommit should not have thrown an error', + 'getFilesToCommit should not have thrown an error' ); assert.equal(fileList.length, 2, 'expected only 2 file paths (json, md)'); assert.equal( fileList[0].split('\\').join('/'), 'retrieve/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-meta.json', - 'wrong JSON path', + 'wrong JSON path' ); assert.equal( fileList[1].split('\\').join('/'), 'retrieve/testInstance/testBU/dataExtension/testExisting_dataExtension.dataExtension-doc.md', - 'wrong MD path', + 'wrong MD path' ); return; }); diff --git a/test/type.dataExtract.test.js b/test/type.dataExtract.test.js index 8f6b7c6f2..12cde0fb5 100644 --- a/test/type.dataExtract.test.js +++ b/test/type.dataExtract.test.js @@ -24,17 +24,17 @@ describe('type: dataExtract', () => { assert.equal( result.dataExtract ? Object.keys(result.dataExtract).length : 0, 1, - 'only one dataExtract expected', + 'only one dataExtract expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'get'), - 'returned JSON was not equal expected', + 'returned JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -54,25 +54,25 @@ describe('type: dataExtract', () => { assert.equal( result.dataExtract ? Object.keys(result.dataExtract).length : 0, 2, - 'two dataExtracts expected', + 'two dataExtracts expected' ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'post'), - 'returned new-JSON was not equal expected for insert dataExtract', + 'returned new-JSON was not equal expected for insert dataExtract' ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'patch'), - 'returned existing-JSON was not equal expected for update dataExtract', + 'returned existing-JSON was not equal expected for update dataExtract' ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 8, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -85,40 +85,40 @@ describe('type: dataExtract', () => { 'testInstance/testBU', 'dataExtract', ['testExisting_dataExtract'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.dataExtract ? Object.keys(result.dataExtract).length : 0, 1, - 'only one dataExtract expected', + 'only one dataExtract expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'dataExtract', 'testExisting_dataExtract', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -130,40 +130,40 @@ describe('type: dataExtract', () => { 'testInstance/testBU', 'dataExtract', ['testExisting_dataExtract'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.dataExtract ? Object.keys(result.dataExtract).length : 0, 1, - 'only one dataExtract expected', + 'only one dataExtract expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'dataExtract', 'testExisting_dataExtract', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_dataExtract', 'dataExtract'), await testUtils.getExpectedJson('9999999', 'dataExtract', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -174,18 +174,18 @@ describe('type: dataExtract', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'dataExtract', - 'testExisting_fileTranfer', + 'testExisting_fileTranfer' ); // THEN assert.equal( process.exitCode, 1, - 'deleteByKey should have thrown an error due to lack of support', + 'deleteByKey should have thrown an error due to lack of support' ); assert.equal( isDeleted, false, - 'deleteByKey should have returned false due to lack of support', + 'deleteByKey should have returned false due to lack of support' ); return; }); diff --git a/test/type.fileTransfer.test.js b/test/type.fileTransfer.test.js index 14db1d6dc..1bb0f10e0 100644 --- a/test/type.fileTransfer.test.js +++ b/test/type.fileTransfer.test.js @@ -24,17 +24,17 @@ describe('type: fileTransfer', () => { assert.equal( result.fileTransfer ? Object.keys(result.fileTransfer).length : 0, 1, - 'only one fileTransfer expected', + 'only one fileTransfer expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'get'), - 'returned JSON was not equal expected', + 'returned JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -53,25 +53,25 @@ describe('type: fileTransfer', () => { assert.equal( result.fileTransfer ? Object.keys(result.fileTransfer).length : 0, 2, - 'two fileTransfers expected', + 'two fileTransfers expected' ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'post'), - 'returned JSON was not equal expected for insert fileTransfer', + 'returned JSON was not equal expected for insert fileTransfer' ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'patch'), - 'returned JSON was not equal expected for update fileTransfer', + 'returned JSON was not equal expected for update fileTransfer' ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 5, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -83,40 +83,40 @@ describe('type: fileTransfer', () => { 'testInstance/testBU', 'fileTransfer', ['testExisting_fileTransfer'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.fileTransfer ? Object.keys(result.fileTransfer).length : 0, 1, - 'only one fileTransfer expected', + 'only one fileTransfer expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'fileTransfer', 'testExisting_fileTransfer', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -128,40 +128,40 @@ describe('type: fileTransfer', () => { 'testInstance/testBU', 'fileTransfer', ['testExisting_fileTransfer'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.fileTransfer ? Object.keys(result.fileTransfer).length : 0, 1, - 'only one fileTransfer expected', + 'only one fileTransfer expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'fileTransfer', 'testExisting_fileTransfer', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_fileTransfer', 'fileTransfer'), await testUtils.getExpectedJson('9999999', 'fileTransfer', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -172,18 +172,18 @@ describe('type: fileTransfer', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'fileTransfer', - 'testExisting_fileTranfer', + 'testExisting_fileTranfer' ); // THEN assert.equal( process.exitCode, 1, - 'deleteByKey should have thrown an error due to lack of support', + 'deleteByKey should have thrown an error due to lack of support' ); assert.equal( isDeleted, false, - 'deleteByKey should have returned false due to lack of support', + 'deleteByKey should have returned false due to lack of support' ); return; }); diff --git a/test/type.importFile.test.js b/test/type.importFile.test.js index dd52a9acb..06ca6c009 100644 --- a/test/type.importFile.test.js +++ b/test/type.importFile.test.js @@ -24,17 +24,17 @@ describe('type: importFile', () => { assert.equal( result.importFile ? Object.keys(result.importFile).length : 0, 1, - 'only one importFile expected', + 'only one importFile expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'get'), - 'returned JSON was not equal expected', + 'returned JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 10, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -54,25 +54,25 @@ describe('type: importFile', () => { assert.equal( result.importFile ? Object.keys(result.importFile).length : 0, 2, - 'two importFiles expected', + 'two importFiles expected' ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'post'), - 'returned new-JSON was not equal expected for insert importFile', + 'returned new-JSON was not equal expected for insert importFile' ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'patch'), - 'returned existing-JSON was not equal expected for update importFile', + 'returned existing-JSON was not equal expected for update importFile' ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 12, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -84,40 +84,40 @@ describe('type: importFile', () => { 'testInstance/testBU', 'importFile', ['testExisting_importFile'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.importFile ? Object.keys(result.importFile).length : 0, 1, - 'only one importFile expected', + 'only one importFile expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'importFile', 'testExisting_importFile', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 10, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -129,40 +129,40 @@ describe('type: importFile', () => { 'testInstance/testBU', 'importFile', ['testExisting_importFile'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.importFile ? Object.keys(result.importFile).length : 0, 1, - 'only one importFile expected', + 'only one importFile expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'importFile', 'testExisting_importFile', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_importFile', 'importFile'), await testUtils.getExpectedJson('9999999', 'importFile', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 10, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -173,18 +173,18 @@ describe('type: importFile', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'importFile', - 'testExisting_fileTranfer', + 'testExisting_fileTranfer' ); // THEN assert.equal( process.exitCode, 1, - 'deleteByKey should have thrown an error due to lack of support', + 'deleteByKey should have thrown an error due to lack of support' ); assert.equal( isDeleted, false, - 'deleteByKey should have returned false due to lack of support', + 'deleteByKey should have returned false due to lack of support' ); return; }); diff --git a/test/type.journey.test.js b/test/type.journey.test.js index 351f59b59..aaf43e923 100644 --- a/test/type.journey.test.js +++ b/test/type.journey.test.js @@ -24,17 +24,17 @@ describe('type: journey', () => { assert.equal( result.journey ? Object.keys(result.journey).length : 0, 2, - 'only 2 journeys expected', + 'only 2 journeys expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_interaction', 'journey'), await testUtils.getExpectedJson('9999999', 'journey', 'get'), - 'returned JSON was not equal expected', + 'returned JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 13, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -53,27 +53,27 @@ describe('type: journey', () => { assert.equal( result.journey ? Object.keys(result.journey).length : 0, 3, - '3 journeys expected', + '3 journeys expected' ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_interaction', 'journey'), await testUtils.getExpectedJson('9999999', 'journey', 'post'), - 'returned JSON was not equal expected for insert journey', + 'returned JSON was not equal expected for insert journey' ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_interaction', 'journey'), await testUtils.getExpectedJson('9999999', 'journey', 'put'), // watch out - journey api wants put instead of patch for updates - 'returned JSON was not equal expected for update journey', + 'returned JSON was not equal expected for update journey' ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 11, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -85,7 +85,7 @@ describe('type: journey', () => { assert.equal( process.exitCode, 1, - 'deploy should have thrown an error due to lack of support', + 'deploy should have thrown an error due to lack of support' ); return; }); @@ -99,18 +99,18 @@ describe('type: journey', () => { 'testInstance/testBU', 'journey', ['testExisting_interaction'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.journey ? Object.keys(result.journey).length : 0, 1, - 'only one journey expected', + 'only one journey expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_interaction', 'journey'), await testUtils.getExpectedJson('9999999', 'journey', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); // buildDefinition @@ -118,23 +118,23 @@ describe('type: journey', () => { 'testInstance/testBU', 'journey', 'testExisting_interaction', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_interaction', 'journey'), await testUtils.getExpectedJson('9999999', 'journey', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 13, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -145,7 +145,7 @@ describe('type: journey', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'journey', - 'testExisting_interaction', + 'testExisting_interaction' ); // THEN assert.equal(process.exitCode, true, 'delete should have thrown an error'); @@ -158,7 +158,7 @@ describe('type: journey', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'journey', - 'testExisting_interaction/2', + 'testExisting_interaction/2' ); // THEN assert.equal(process.exitCode, true, 'delete should have thrown an error'); @@ -171,7 +171,7 @@ describe('type: journey', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'journey', - 'testExisting_interaction/1', + 'testExisting_interaction/1' ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); diff --git a/test/type.mobileKeyword.test.js b/test/type.mobileKeyword.test.js index fe64f758c..7ecb99b89 100644 --- a/test/type.mobileKeyword.test.js +++ b/test/type.mobileKeyword.test.js @@ -25,29 +25,29 @@ describe('type: mobileKeyword', () => { assert.equal( result.mobileKeyword ? Object.keys(result.mobileKeyword).length : 0, 1, - 'only 1 mobileKeywords expected', + 'only 1 mobileKeywords expected' ); assert.deepEqual( await testUtils.getActualJson( '4912312345678.TESTEXISTING_KEYWORD', - 'mobileKeyword', + 'mobileKeyword' ), await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'get'), - 'saved JSON was not equal expected', + 'saved JSON was not equal expected' ); expect( file( testUtils.getActualFile( '4912312345678.TESTEXISTING_KEYWORD', 'mobileKeyword', - 'amp', - ), - ), + 'amp' + ) + ) ).to.equal(file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'get', 'amp'))); assert.equal( testUtils.getAPIHistoryLength(), 2, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -61,7 +61,7 @@ describe('type: mobileKeyword', () => { await handler.deploy( 'testInstance/testBU', ['mobileKeyword'], - ['4912312345678.TESTNEW_KEYWORD'], + ['4912312345678.TESTNEW_KEYWORD'] ); // THEN assert.equal(process.exitCode, false, 'deploy should not have thrown an error'); @@ -70,37 +70,33 @@ describe('type: mobileKeyword', () => { assert.equal( result.mobileKeyword ? Object.keys(result.mobileKeyword).length : 0, 2, - '2 mobileKeywords expected', + '2 mobileKeywords expected' ); // confirm created item assert.deepEqual( await testUtils.getActualJson('4912312345678.TESTNEW_KEYWORD', 'mobileKeyword'), await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'post-create'), - 'returned JSON was not equal expected for insert mobileKeyword', + 'returned JSON was not equal expected for insert mobileKeyword' ); expect( file( - testUtils.getActualFile( - '4912312345678.TESTNEW_KEYWORD', - 'mobileKeyword', - 'amp', - ), - ), + testUtils.getActualFile('4912312345678.TESTNEW_KEYWORD', 'mobileKeyword', 'amp') + ) ).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'post-create', 'amp')), + file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'post-create', 'amp')) ); // confirm updated item // eslint-disable-next-line no-console console.log( - 'Not testing UPDATE because the API only responds with an empty body unless there are errors in the request body', + 'Not testing UPDATE because the API only responds with an empty body unless there are errors in the request body' ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -109,7 +105,7 @@ describe('type: mobileKeyword', () => { await handler.deploy( 'testInstance/testBU', ['mobileKeyword'], - ['4912312345678.TESTNEW_KEYWORD_BLOCKED'], + ['4912312345678.TESTNEW_KEYWORD_BLOCKED'] ); // THEN assert.equal(process.exitCode, true, 'deploy should have thrown an error'); @@ -118,7 +114,7 @@ describe('type: mobileKeyword', () => { assert.equal( testUtils.getAPIHistoryLength(), 2, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -130,42 +126,42 @@ describe('type: mobileKeyword', () => { 'testInstance/testBU', 'mobileKeyword', ['4912312345678.TESTEXISTING_KEYWORD'], - 'testSourceMarket', + 'testSourceMarket' ); // WHEN assert.equal( process.exitCode, false, - 'retrieveAsTemplate should not have thrown an error', + 'retrieveAsTemplate should not have thrown an error' ); assert.equal( result.mobileKeyword ? Object.keys(result.mobileKeyword).length : 0, 1, - 'only one item expected', + 'only one item expected' ); assert.deepEqual( await testUtils.getActualTemplateJson( '4912312345678.TESTEXISTING_KEYWORD', - 'mobileKeyword', + 'mobileKeyword' ), await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); expect( file( testUtils.getActualTemplateFile( '4912312345678.TESTEXISTING_KEYWORD', 'mobileKeyword', - 'amp', - ), - ), + 'amp' + ) + ) ).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'template', 'amp')), + file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'template', 'amp')) ); assert.equal( testUtils.getAPIHistoryLength(), 2, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -177,33 +173,33 @@ describe('type: mobileKeyword', () => { 'testInstance/testBU', 'mobileKeyword', ['4912312345678.TESTEXISTING_KEYWORD'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.mobileKeyword ? Object.keys(result.mobileKeyword).length : 0, 1, - 'only one mobileKeyword expected', + 'only one mobileKeyword expected' ); assert.deepEqual( await testUtils.getActualTemplateJson( '4912312345678.TESTEXISTING_KEYWORD', - 'mobileKeyword', + 'mobileKeyword' ), await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); expect( file( testUtils.getActualTemplateFile( '4912312345678.TESTEXISTING_KEYWORD', 'mobileKeyword', - 'amp', - ), - ), + 'amp' + ) + ) ).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'template', 'amp')), + file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'template', 'amp')) ); // buildDefinition @@ -211,35 +207,35 @@ describe('type: mobileKeyword', () => { 'testInstance/testBU', 'mobileKeyword', '4912312345678.TESTEXISTING_KEYWORD', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson( '4912312345678.TESTTEMPLATED_KEYWORD', - 'mobileKeyword', + 'mobileKeyword' ), await testUtils.getExpectedJson('9999999', 'mobileKeyword', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); expect( file( testUtils.getActualDeployFile( '4912312345678.TESTTEMPLATED_KEYWORD', 'mobileKeyword', - 'amp', - ), - ), + 'amp' + ) + ) ).to.equal(file(testUtils.getExpectedFile('9999999', 'mobileKeyword', 'build', 'amp'))); assert.equal( testUtils.getAPIHistoryLength(), 2, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -250,7 +246,7 @@ describe('type: mobileKeyword', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'mobileKeyword', - '4912312345678.TESTEXISTING_KEYWORD', + '4912312345678.TESTEXISTING_KEYWORD' ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); @@ -265,25 +261,25 @@ describe('type: mobileKeyword', () => { const fileList = await handler.getFilesToCommit( 'testInstance/testBU', 'mobileKeyword', - ['4912312345678.TESTEXISTING_KEYWORD'], + ['4912312345678.TESTEXISTING_KEYWORD'] ); // THEN assert.equal( process.exitCode, false, - 'getFilesToCommit should not have thrown an error', + 'getFilesToCommit should not have thrown an error' ); assert.equal(fileList.length, 2, 'expected only 2 file paths'); assert.equal( fileList[0].split('\\').join('/'), 'retrieve/testInstance/testBU/mobileKeyword/4912312345678.TESTEXISTING_KEYWORD.mobileKeyword-meta.json', - 'wrong JSON path', + 'wrong JSON path' ); assert.equal( fileList[1].split('\\').join('/'), 'retrieve/testInstance/testBU/mobileKeyword/4912312345678.TESTEXISTING_KEYWORD.mobileKeyword-meta.amp', - 'wrong AMP path', + 'wrong AMP path' ); return; }); diff --git a/test/type.mobileMessage.test.js b/test/type.mobileMessage.test.js index ffd0e09db..9e8cc1d16 100644 --- a/test/type.mobileMessage.test.js +++ b/test/type.mobileMessage.test.js @@ -25,20 +25,20 @@ describe('type: mobileMessage', () => { assert.equal( result.mobileMessage ? Object.keys(result.mobileMessage).length : 0, 1, - 'only 1 mobileMessages expected', + 'only 1 mobileMessages expected' ); assert.deepEqual( await testUtils.getActualJson('NTIzOjc4OjA', 'mobileMessage'), await testUtils.getExpectedJson('9999999', 'mobileMessage', 'get'), - 'saved JSON was not equal expected', + 'saved JSON was not equal expected' ); expect(file(testUtils.getActualFile('NTIzOjc4OjA', 'mobileMessage', 'amp'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'get', 'amp')), + file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'get', 'amp')) ); assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -57,33 +57,33 @@ describe('type: mobileMessage', () => { assert.equal( result.mobileMessage ? Object.keys(result.mobileMessage).length : 0, 2, - '2 mobileMessages expected', + '2 mobileMessages expected' ); // confirm created item assert.deepEqual( await testUtils.getActualJson('NTQ3Ojc4OjA', 'mobileMessage'), await testUtils.getExpectedJson('9999999', 'mobileMessage', 'post-create'), - 'returned JSON was not equal expected for insert mobileMessage', + 'returned JSON was not equal expected for insert mobileMessage' ); expect(file(testUtils.getActualFile('NTQ3Ojc4OjA', 'mobileMessage', 'amp'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'post-create', 'amp')), + file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'post-create', 'amp')) ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('NTIzOjc4OjA', 'mobileMessage'), await testUtils.getExpectedJson('9999999', 'mobileMessage', 'post-update'), // watch out - mobileMessage api wants put instead of patch for updates - 'returned JSON was not equal expected for update mobileMessage', + 'returned JSON was not equal expected for update mobileMessage' ); expect(file(testUtils.getActualFile('NTIzOjc4OjA', 'mobileMessage', 'amp'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'post-update', 'amp')), + file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'post-update', 'amp')) ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 8, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -95,7 +95,7 @@ describe('type: mobileMessage', () => { assert.equal( process.exitCode, 1, - 'deploy should have thrown an error due to lack of support', + 'deploy should have thrown an error due to lack of support' ); return; }); @@ -109,24 +109,24 @@ describe('type: mobileMessage', () => { 'testInstance/testBU', 'mobileMessage', ['NTIzOjc4OjA'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.mobileMessage ? Object.keys(result.mobileMessage).length : 0, 1, - 'only one mobileMessage expected', + 'only one mobileMessage expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('NTIzOjc4OjA', 'mobileMessage'), await testUtils.getExpectedJson('9999999', 'mobileMessage', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); expect( - file(testUtils.getActualTemplateFile('NTIzOjc4OjA', 'mobileMessage', 'amp')), + file(testUtils.getActualTemplateFile('NTIzOjc4OjA', 'mobileMessage', 'amp')) ).to.equal( - file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'template', 'amp')), + file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'template', 'amp')) ); // buildDefinition @@ -134,26 +134,26 @@ describe('type: mobileMessage', () => { 'testInstance/testBU', 'mobileMessage', 'NTIzOjc4OjA', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('NTIzOjc4OjA', 'mobileMessage'), await testUtils.getExpectedJson('9999999', 'mobileMessage', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); expect( - file(testUtils.getActualDeployFile('NTIzOjc4OjA', 'mobileMessage', 'amp')), + file(testUtils.getActualDeployFile('NTIzOjc4OjA', 'mobileMessage', 'amp')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'mobileMessage', 'build', 'amp'))); assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -164,7 +164,7 @@ describe('type: mobileMessage', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'mobileMessage', - 'NTIzOjc4OjA', + 'NTIzOjc4OjA' ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); @@ -179,25 +179,25 @@ describe('type: mobileMessage', () => { const fileList = await handler.getFilesToCommit( 'testInstance/testBU', 'mobileMessage', - ['NTIzOjc4OjA'], + ['NTIzOjc4OjA'] ); // THEN assert.equal( process.exitCode, false, - 'getFilesToCommit should not have thrown an error', + 'getFilesToCommit should not have thrown an error' ); assert.equal(fileList.length, 2, 'expected only 2 file paths'); assert.equal( fileList[0].split('\\').join('/'), 'retrieve/testInstance/testBU/mobileMessage/NTIzOjc4OjA.mobileMessage-meta.json', - 'wrong JSON path', + 'wrong JSON path' ); assert.equal( fileList[1].split('\\').join('/'), 'retrieve/testInstance/testBU/mobileMessage/NTIzOjc4OjA.mobileMessage-meta.amp', - 'wrong AMP path', + 'wrong AMP path' ); return; }); diff --git a/test/type.query.test.js b/test/type.query.test.js index fc542f54f..57c16d8f3 100644 --- a/test/type.query.test.js +++ b/test/type.query.test.js @@ -25,28 +25,28 @@ describe('type: query', () => { assert.equal( result.query ? Object.keys(result.query).length : 0, 3, - 'only three queries expected', + 'only three queries expected' ); // normal test assert.deepEqual( await testUtils.getActualJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'get'), - 'returned metadata with correct key was not equal expected', + 'returned metadata with correct key was not equal expected' ); expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'query', 'get', 'sql')), + file(testUtils.getExpectedFile('9999999', 'query', 'get', 'sql')) ); // check if targetKey was overwritten assert.deepEqual( await testUtils.getActualJson('testExisting_query2', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'get2'), - 'returned metadata with wrong key was not equal expected', + 'returned metadata with wrong key was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -60,20 +60,20 @@ describe('type: query', () => { assert.equal( result.query ? Object.keys(result.query).length : 0, 1, - 'only one query expected', + 'only one query expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'get'), - 'returned metadata was not equal expected', + 'returned metadata was not equal expected' ); expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'query', 'get', 'sql')), + file(testUtils.getExpectedFile('9999999', 'query', 'get', 'sql')) ); assert.equal( testUtils.getAPIHistoryLength(), 7, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -88,22 +88,22 @@ describe('type: query', () => { assert.equal( result.query ? Object.keys(result.query).length : 0, 3, - 'three queries in cache expected', + 'three queries in cache expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'get'), - 'returned metadata was not equal expected', + 'returned metadata was not equal expected' ); expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'query', 'get', 'sql')), + file(testUtils.getExpectedFile('9999999', 'query', 'get', 'sql')) ); expect(file(testUtils.getActualFile('testExisting_query2', 'query', 'sql'))).to.not .exist; assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -118,7 +118,7 @@ describe('type: query', () => { assert.equal( result.query ? Object.keys(result.query).length : 0, 3, - 'three queries in cache expected', + 'three queries in cache expected' ); expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.not @@ -128,7 +128,7 @@ describe('type: query', () => { assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -142,7 +142,7 @@ describe('type: query', () => { const resultDeploy = await handler.deploy( 'testInstance/testBU', ['query'], - ['testNew_query', 'testExisting_query'], + ['testNew_query', 'testExisting_query'] ); // THEN assert.equal(process.exitCode, false, 'deploy should not have thrown an error'); @@ -151,38 +151,38 @@ describe('type: query', () => { ? Object.keys(resultDeploy['testInstance/testBU']?.query).length : 0, 2, - 'two queries to be deployed', + 'two queries to be deployed' ); // get results from cache const result = cache.getCache(); assert.equal( result.query ? Object.keys(result.query).length : 0, 4, - 'four queries expected in cache', + 'four queries expected in cache' ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'post'), - 'returned metadata was not equal expected for insert query', + 'returned metadata was not equal expected for insert query' ); expect(file(testUtils.getActualFile('testNew_query', 'query', 'sql'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'query', 'post', 'sql')), + file(testUtils.getExpectedFile('9999999', 'query', 'post', 'sql')) ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch'), - 'returned metadata was not equal expected for insert query', + 'returned metadata was not equal expected for insert query' ); expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'query', 'patch', 'sql')), + file(testUtils.getExpectedFile('9999999', 'query', 'patch', 'sql')) ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 8, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -192,28 +192,28 @@ describe('type: query', () => { await handler.deploy( 'testInstance/testBU', ['query'], - ['testExisting_query', 'testNew_query'], + ['testExisting_query', 'testNew_query'] ); // THEN assert.equal( process.exitCode, false, - 'deploy with --execute should not have thrown an error', + 'deploy with --execute should not have thrown an error' ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch'), - 'returned metadata was not equal expected for insert query', + 'returned metadata was not equal expected for insert query' ); expect(file(testUtils.getActualFile('testExisting_query', 'query', 'sql'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'query', 'patch', 'sql')), + file(testUtils.getExpectedFile('9999999', 'query', 'patch', 'sql')) ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 12, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -227,7 +227,7 @@ describe('type: query', () => { await handler.retrieve( 'testInstance/testBU', ['query'], - ['testExisting_query_fixKeys'], + ['testExisting_query_fixKeys'] ); handler.setOptions({ changeKeyValue: 'testExisting_query_fixedKeys', @@ -236,39 +236,39 @@ describe('type: query', () => { const deployed = await handler.deploy( 'testInstance/testBU', ['query'], - ['testExisting_query_fixKeys'], + ['testExisting_query_fixKeys'] ); // THEN assert.equal( process.exitCode, false, - 'deploy --changeKeyValue should not have thrown an error', + 'deploy --changeKeyValue should not have thrown an error' ); assert.equal( Object.keys(deployed['testInstance/testBU'].query).length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( Object.keys(deployed['testInstance/testBU'].query)[0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query', + 'returned metadata was not equal expected for update query' ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 14, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -277,44 +277,44 @@ describe('type: query', () => { await handler.retrieve( 'testInstance/testBU', ['query'], - ['testExisting_query_fixKeys'], + ['testExisting_query_fixKeys'] ); handler.setOptions({ changeKeyField: 'name', fromRetrieve: true }); const deployed = await handler.deploy( 'testInstance/testBU', ['query'], - ['testExisting_query_fixKeys'], + ['testExisting_query_fixKeys'] ); // THEN assert.equal( process.exitCode, false, - 'deploy --changeKeyValue should not have thrown an error', + 'deploy --changeKeyValue should not have thrown an error' ); assert.equal( Object.keys(deployed['testInstance/testBU'].query).length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( Object.keys(deployed['testInstance/testBU'].query)[0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query', + 'returned metadata was not equal expected for update query' ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 14, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -330,7 +330,7 @@ describe('type: query', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 0, - 'expected to find no keys to be fixed', + 'expected to find no keys to be fixed' ); // get results from cache @@ -338,13 +338,13 @@ describe('type: query', () => { assert.equal( result.query ? Object.keys(result.query).length : 0, 1, - 'one query expected', + 'one query expected' ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 7, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -358,12 +358,12 @@ describe('type: query', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -371,16 +371,16 @@ describe('type: query', () => { assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query', + 'returned metadata was not equal expected for update query' ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 16, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -394,33 +394,33 @@ describe('type: query', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); // THEN assert.equal( process.exitCode, false, - 'fixKeys with --execute should not have thrown an error', + 'fixKeys with --execute should not have thrown an error' ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query', + 'returned metadata was not equal expected for update query' ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 18, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -434,12 +434,12 @@ describe('type: query', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -447,16 +447,16 @@ describe('type: query', () => { assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query', + 'returned metadata was not equal expected for update query' ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 34, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -470,33 +470,33 @@ describe('type: query', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); // THEN assert.equal( process.exitCode, false, - 'fixKeys with --execute should not have thrown an error', + 'fixKeys with --execute should not have thrown an error' ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query', + 'returned metadata was not equal expected for update query' ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 36, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -510,12 +510,12 @@ describe('type: query', () => { assert.equal( resultFixKeys['testInstance/testBU'].length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( resultFixKeys['testInstance/testBU'][0], 'testExisting_query_fixedKeys', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); // THEN assert.equal(process.exitCode, false, 'fixKeys should not have thrown an error'); @@ -523,16 +523,16 @@ describe('type: query', () => { assert.deepEqual( await testUtils.getActualJson('testExisting_query_fixedKeys', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'patch_fixKeys'), - 'returned metadata was not equal expected for update query', + 'returned metadata was not equal expected for update query' ); expect( - file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')), + file(testUtils.getActualFile('testExisting_query_fixedKeys', 'query', 'sql')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'patch_fixKeys', 'sql'))); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 13, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -544,53 +544,53 @@ describe('type: query', () => { 'testInstance/testBU', 'query', ['testExisting_query'], - 'testSourceMarket', + 'testSourceMarket' ); // WHEN assert.equal( process.exitCode, false, - 'retrieveAsTemplate should not have thrown an error', + 'retrieveAsTemplate should not have thrown an error' ); assert.equal( result.query ? Object.keys(result.query).length : 0, 1, - 'only one query expected', + 'only one query expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'template'), - 'returned template JSON of retrieveAsTemplate was not equal expected', + 'returned template JSON of retrieveAsTemplate was not equal expected' ); expect( - file(testUtils.getActualTemplateFile('testExisting_query', 'query', 'sql')), + file(testUtils.getActualTemplateFile('testExisting_query', 'query', 'sql')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'template', 'sql'))); // THEN await handler.buildDefinition( 'testInstance/testBU', 'query', 'testExisting_query', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); expect( - file(testUtils.getActualDeployFile('testTemplated_query', 'query', 'sql')), + file(testUtils.getActualDeployFile('testTemplated_query', 'query', 'sql')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'build', 'sql'))); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -602,7 +602,7 @@ describe('type: query', () => { 'testInstance/testBU', 'query', ['testExisting_query'], - 'testSourceMarket', + 'testSourceMarket' ); // WHEN assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); @@ -610,42 +610,42 @@ describe('type: query', () => { assert.equal( result.query ? Object.keys(result.query).length : 0, 1, - 'only one query expected', + 'only one query expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'template'), - 'returned template JSON of buildTemplate was not equal expected', + 'returned template JSON of buildTemplate was not equal expected' ); expect( - file(testUtils.getActualTemplateFile('testExisting_query', 'query', 'sql')), + file(testUtils.getActualTemplateFile('testExisting_query', 'query', 'sql')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'template', 'sql'))); // THEN await handler.buildDefinition( 'testInstance/testBU', 'query', 'testExisting_query', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_query', 'query'), await testUtils.getExpectedJson('9999999', 'query', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); expect( - file(testUtils.getActualDeployFile('testTemplated_query', 'query', 'sql')), + file(testUtils.getActualDeployFile('testTemplated_query', 'query', 'sql')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'query', 'build', 'sql'))); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -656,7 +656,7 @@ describe('type: query', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'query', - 'testExisting_query', + 'testExisting_query' ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); @@ -675,19 +675,19 @@ describe('type: query', () => { assert.equal( process.exitCode, false, - 'getFilesToCommit should not have thrown an error', + 'getFilesToCommit should not have thrown an error' ); assert.equal(fileList.length, 2, 'expected only 2 file paths'); assert.equal( fileList[0].split('\\').join('/'), 'retrieve/testInstance/testBU/query/testExisting_query.query-meta.json', - 'wrong JSON path', + 'wrong JSON path' ); assert.equal( fileList[1].split('\\').join('/'), 'retrieve/testInstance/testBU/query/testExisting_query.query-meta.sql', - 'wrong JSON path', + 'wrong JSON path' ); return; }); @@ -701,12 +701,12 @@ describe('type: query', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_query', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); return; }); @@ -717,12 +717,12 @@ describe('type: query', () => { assert.equal( executedKeys['testInstance/testBU']?.length, 1, - 'returned number of keys does not correspond to number of expected fixed keys', + 'returned number of keys does not correspond to number of expected fixed keys' ); assert.equal( executedKeys['testInstance/testBU'][0], 'testExisting_query', - 'returned keys do not correspond to expected fixed keys', + 'returned keys do not correspond to expected fixed keys' ); return; }); @@ -735,7 +735,7 @@ describe('type: query', () => { assert.equal( Object.keys(executedKeys).length, 0, - 'query was not supposed to be executed', + 'query was not supposed to be executed' ); return; }); diff --git a/test/type.script.test.js b/test/type.script.test.js index e4ba85b63..d50fda9a1 100644 --- a/test/type.script.test.js +++ b/test/type.script.test.js @@ -27,7 +27,7 @@ describe('type: script', () => { ? Object.keys(retrieve['testInstance/testBU'].script).length : 0, 2, - 'only 2 scripts expected in retrieve response', + 'only 2 scripts expected in retrieve response' ); // get results from cache @@ -35,38 +35,38 @@ describe('type: script', () => { assert.equal( result.script ? Object.keys(result.script).length : 0, 2, - 'only 2 scripts expected', + 'only 2 scripts expected' ); // normal test assert.deepEqual( await testUtils.getActualJson('testExisting_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'get'), - 'returned metadata with correct key was not equal expected', + 'returned metadata with correct key was not equal expected' ); expect(file(testUtils.getActualFile('testExisting_script', 'script', 'html'))).to.not .exist; expect(file(testUtils.getActualFile('testExisting_script', 'script', 'ssjs'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'script', 'get', 'ssjs')), + file(testUtils.getExpectedFile('9999999', 'script', 'get', 'ssjs')) ); assert.deepEqual( await testUtils.getActualJson('testExisting_script_noScriptTag', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'get_noScriptTag'), - 'returned metadata was not equal expected', + 'returned metadata was not equal expected' ); expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'html')), + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'html')) ).to.equal( - file(testUtils.getExpectedFile('9999999', 'script', 'get_noScriptTag', 'html')), + file(testUtils.getExpectedFile('9999999', 'script', 'get_noScriptTag', 'html')) ); expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'ssjs')), + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'ssjs')) ).to.not.exist; assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -80,33 +80,33 @@ describe('type: script', () => { assert.equal( result.script ? Object.keys(result.script).length : 0, 1, - 'only one script expected', + 'only one script expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'get'), - 'returned metadata was not equal expected', + 'returned metadata was not equal expected' ); expect(file(testUtils.getActualFile('testExisting_script', 'script', 'html'))).to.not .exist; expect(file(testUtils.getActualFile('testExisting_script', 'script', 'ssjs'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'script', 'get', 'ssjs')), + file(testUtils.getExpectedFile('9999999', 'script', 'get', 'ssjs')) ); expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'json')), + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'json')) ).to.not.exist; expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'ssjs')), + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'ssjs')) ).to.not.exist; expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'html')), + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'html')) ).to.not.exist; assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -123,31 +123,31 @@ describe('type: script', () => { assert.equal( result.script ? Object.keys(result.script).length : 0, 2, - 'two scripts in cache expected', + 'two scripts in cache expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'get'), - 'returned metadata was not equal expected', + 'returned metadata was not equal expected' ); expect(file(testUtils.getActualFile('testExisting_script', 'script', 'ssjs'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'script', 'get', 'ssjs')), + file(testUtils.getExpectedFile('9999999', 'script', 'get', 'ssjs')) ); expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'json')), + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'json')) ).to.not.exist; expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'ssjs')), + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'ssjs')) ).to.not.exist; expect( - file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'html')), + file(testUtils.getActualFile('testExisting_script_noScriptTag', 'script', 'html')) ).to.not.exist; assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -163,7 +163,7 @@ describe('type: script', () => { assert.equal( result.script ? Object.keys(result.script).length : 0, 2, - 'two scripts in cache expected', + 'two scripts in cache expected' ); expect(file(testUtils.getActualFile('testExisting_script', 'script', 'ssjs'))).to.not @@ -171,7 +171,7 @@ describe('type: script', () => { assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -190,31 +190,31 @@ describe('type: script', () => { assert.equal( result.script ? Object.keys(result.script).length : 0, 3, - 'three scripts expected', + 'three scripts expected' ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'post'), - 'returned metadata was not equal expected for insert script', + 'returned metadata was not equal expected for insert script' ); expect(file(testUtils.getActualFile('testNew_script', 'script', 'ssjs'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'script', 'post', 'ssjs')), + file(testUtils.getExpectedFile('9999999', 'script', 'post', 'ssjs')) ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'patch'), - 'returned metadata was not equal expected for insert script', + 'returned metadata was not equal expected for insert script' ); expect(file(testUtils.getActualFile('testExisting_script', 'script', 'ssjs'))).to.equal( - file(testUtils.getExpectedFile('9999999', 'script', 'patch', 'ssjs')), + file(testUtils.getExpectedFile('9999999', 'script', 'patch', 'ssjs')) ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 5, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -226,53 +226,53 @@ describe('type: script', () => { 'testInstance/testBU', 'script', ['testExisting_script'], - 'testSourceMarket', + 'testSourceMarket' ); // WHEN assert.equal( process.exitCode, false, - 'retrieveAsTemplate should not have thrown an error', + 'retrieveAsTemplate should not have thrown an error' ); assert.equal( result.script ? Object.keys(result.script).length : 0, 1, - 'only one script expected', + 'only one script expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'template'), - 'returned template JSON of retrieveAsTemplate was not equal expected', + 'returned template JSON of retrieveAsTemplate was not equal expected' ); expect( - file(testUtils.getActualTemplateFile('testExisting_script', 'script', 'ssjs')), + file(testUtils.getActualTemplateFile('testExisting_script', 'script', 'ssjs')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'script', 'template', 'ssjs'))); // THEN await handler.buildDefinition( 'testInstance/testBU', 'script', 'testExisting_script', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); expect( - file(testUtils.getActualDeployFile('testTemplated_script', 'script', 'ssjs')), + file(testUtils.getActualDeployFile('testTemplated_script', 'script', 'ssjs')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'script', 'build', 'ssjs'))); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -284,7 +284,7 @@ describe('type: script', () => { 'testInstance/testBU', 'script', ['testExisting_script'], - 'testSourceMarket', + 'testSourceMarket' ); // WHEN assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); @@ -292,42 +292,42 @@ describe('type: script', () => { assert.equal( result.script ? Object.keys(result.script).length : 0, 1, - 'only one script expected', + 'only one script expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'template'), - 'returned template JSON of buildTemplate was not equal expected', + 'returned template JSON of buildTemplate was not equal expected' ); expect( - file(testUtils.getActualTemplateFile('testExisting_script', 'script', 'ssjs')), + file(testUtils.getActualTemplateFile('testExisting_script', 'script', 'ssjs')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'script', 'template', 'ssjs'))); // THEN await handler.buildDefinition( 'testInstance/testBU', 'script', 'testExisting_script', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_script', 'script'), await testUtils.getExpectedJson('9999999', 'script', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); expect( - file(testUtils.getActualDeployFile('testTemplated_script', 'script', 'ssjs')), + file(testUtils.getActualDeployFile('testTemplated_script', 'script', 'ssjs')) ).to.equal(file(testUtils.getExpectedFile('9999999', 'script', 'build', 'ssjs'))); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -343,24 +343,24 @@ describe('type: script', () => { assert.equal( process.exitCode, false, - 'getFilesToCommit should not have thrown an error', + 'getFilesToCommit should not have thrown an error' ); assert.equal(fileList.length, 3, 'expected only 3 file paths (html, json, ssjs)'); assert.equal( fileList[0].split('\\').join('/'), 'retrieve/testInstance/testBU/script/testExisting_script.script-meta.json', - 'wrong JSON path', + 'wrong JSON path' ); assert.equal( fileList[1].split('\\').join('/'), 'retrieve/testInstance/testBU/script/testExisting_script.script-meta.ssjs', - 'wrong SSJS path', + 'wrong SSJS path' ); assert.equal( fileList[2].split('\\').join('/'), 'retrieve/testInstance/testBU/script/testExisting_script.script-meta.html', - 'wrong HTML path', + 'wrong HTML path' ); return; }); diff --git a/test/type.transactionalEmail.test.js b/test/type.transactionalEmail.test.js index cefd8797f..60dff65e8 100644 --- a/test/type.transactionalEmail.test.js +++ b/test/type.transactionalEmail.test.js @@ -24,17 +24,17 @@ describe('type: transactionalEmail', () => { assert.equal( result.transactionalEmail ? Object.keys(result.transactionalEmail).length : 0, 1, - 'only one transactionalEmail expected', + 'only one transactionalEmail expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_temail', 'transactionalEmail'), await testUtils.getExpectedJson('9999999', 'transactionalEmail', 'get'), - 'returned JSON was not equal expected', + 'returned JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 12, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -53,25 +53,25 @@ describe('type: transactionalEmail', () => { assert.equal( result.transactionalEmail ? Object.keys(result.transactionalEmail).length : 0, 2, - 'two transactionalEmails expected', + 'two transactionalEmails expected' ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_temail', 'transactionalEmail'), await testUtils.getExpectedJson('9999999', 'transactionalEmail', 'post'), - 'returned JSON was not equal expected for insert transactionalEmail', + 'returned JSON was not equal expected for insert transactionalEmail' ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_temail', 'transactionalEmail'), await testUtils.getExpectedJson('9999999', 'transactionalEmail', 'patch'), - 'returned JSON was not equal expected for update transactionalEmail', + 'returned JSON was not equal expected for update transactionalEmail' ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 14, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -81,13 +81,13 @@ describe('type: transactionalEmail', () => { await handler.deploy( 'testInstance/testBU', ['transactionalEmail'], - ['testExisting_temail'], + ['testExisting_temail'] ); // THEN assert.equal( process.exitCode, 1, - 'deploy should have thrown an error due to lack of support', + 'deploy should have thrown an error due to lack of support' ); return; }); @@ -102,40 +102,40 @@ describe('type: transactionalEmail', () => { 'testInstance/testBU', 'transactionalEmail', ['testExisting_temail'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.transactionalEmail ? Object.keys(result.transactionalEmail).length : 0, 1, - 'only one transactionalEmail expected', + 'only one transactionalEmail expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_temail', 'transactionalEmail'), await testUtils.getExpectedJson('9999999', 'transactionalEmail', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'transactionalEmail', 'testExisting_temail', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_temail', 'transactionalEmail'), await testUtils.getExpectedJson('9999999', 'transactionalEmail', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 12, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -146,7 +146,7 @@ describe('type: transactionalEmail', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'transactionalEmail', - 'testExisting_temail', + 'testExisting_temail' ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); diff --git a/test/type.transactionalPush.test.js b/test/type.transactionalPush.test.js index 5b7b7ecf6..dd6e6e9ec 100644 --- a/test/type.transactionalPush.test.js +++ b/test/type.transactionalPush.test.js @@ -24,17 +24,17 @@ describe('type: transactionalPush', () => { assert.equal( result.transactionalPush ? Object.keys(result.transactionalPush).length : 0, 1, - 'only one transactionalPush expected', + 'only one transactionalPush expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_tpush', 'transactionalPush'), await testUtils.getExpectedJson('9999999', 'transactionalPush', 'get'), - 'returned JSON was not equal expected', + 'returned JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -53,25 +53,25 @@ describe('type: transactionalPush', () => { assert.equal( result.transactionalPush ? Object.keys(result.transactionalPush).length : 0, 2, - 'two transactionalPushs expected', + 'two transactionalPushs expected' ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_tpush', 'transactionalPush'), await testUtils.getExpectedJson('9999999', 'transactionalPush', 'post'), - 'returned JSON was not equal expected for insert transactionalPush', + 'returned JSON was not equal expected for insert transactionalPush' ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_tpush', 'transactionalPush'), await testUtils.getExpectedJson('9999999', 'transactionalPush', 'patch'), - 'returned JSON was not equal expected for update transactionalPush', + 'returned JSON was not equal expected for update transactionalPush' ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 5, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -81,13 +81,13 @@ describe('type: transactionalPush', () => { await handler.deploy( 'testInstance/testBU', ['transactionalPush'], - ['testExisting_tpush'], + ['testExisting_tpush'] ); // THEN assert.equal( process.exitCode, 1, - 'deploy should have thrown an error due to lack of support', + 'deploy should have thrown an error due to lack of support' ); return; }); @@ -102,41 +102,41 @@ describe('type: transactionalPush', () => { 'testInstance/testBU', 'transactionalPush', ['testExisting_tpush'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.transactionalPush ? Object.keys(result.transactionalPush).length : 0, 1, - 'only one transactionalPush expected', + 'only one transactionalPush expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_tpush', 'transactionalPush'), await testUtils.getExpectedJson('9999999', 'transactionalPush', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'transactionalPush', 'testExisting_tpush', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_tpush', 'transactionalPush'), await testUtils.getExpectedJson('9999999', 'transactionalPush', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 3, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); diff --git a/test/type.transactionalSMS.test.js b/test/type.transactionalSMS.test.js index 5974669df..0917e7fae 100644 --- a/test/type.transactionalSMS.test.js +++ b/test/type.transactionalSMS.test.js @@ -25,22 +25,22 @@ describe('type: transactionalSMS', () => { assert.equal( result.transactionalSMS ? Object.keys(result.transactionalSMS).length : 0, 1, - 'only one transactionalSMS expected', + 'only one transactionalSMS expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_tsms', 'transactionalSMS'), await testUtils.getExpectedJson('9999999', 'transactionalSMS', 'get'), - 'returned JSON was not equal expected', + 'returned JSON was not equal expected' ); expect( - file(testUtils.getActualFile('testExisting_tsms', 'transactionalSMS', 'amp')), + file(testUtils.getActualFile('testExisting_tsms', 'transactionalSMS', 'amp')) ).to.equal( - file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'get', 'amp')), + file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'get', 'amp')) ); assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -59,35 +59,35 @@ describe('type: transactionalSMS', () => { assert.equal( result.transactionalSMS ? Object.keys(result.transactionalSMS).length : 0, 2, - 'two transactionalSMSs expected', + 'two transactionalSMSs expected' ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_tsms', 'transactionalSMS'), await testUtils.getExpectedJson('9999999', 'transactionalSMS', 'post'), - 'returned JSON was not equal expected for insert transactionalSMS', + 'returned JSON was not equal expected for insert transactionalSMS' ); expect( - file(testUtils.getActualFile('testNew_tsms', 'transactionalSMS', 'amp')), + file(testUtils.getActualFile('testNew_tsms', 'transactionalSMS', 'amp')) ).to.equal( - file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'post', 'amp')), + file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'post', 'amp')) ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_tsms', 'transactionalSMS'), await testUtils.getExpectedJson('9999999', 'transactionalSMS', 'patch'), - 'returned JSON was not equal expected for update transactionalSMS', + 'returned JSON was not equal expected for update transactionalSMS' ); expect( - file(testUtils.getActualFile('testExisting_tsms', 'transactionalSMS', 'amp')), + file(testUtils.getActualFile('testExisting_tsms', 'transactionalSMS', 'amp')) ).to.equal( - file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'patch', 'amp')), + file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'patch', 'amp')) ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -97,13 +97,13 @@ describe('type: transactionalSMS', () => { await handler.deploy( 'testInstance/testBU', ['transactionalSMS'], - ['testExisting_tsms'], + ['testExisting_tsms'] ); // THEN assert.equal( process.exitCode, 1, - 'deploy should have thrown an error due to lack of support', + 'deploy should have thrown an error due to lack of support' ); return; }); @@ -118,56 +118,54 @@ describe('type: transactionalSMS', () => { 'testInstance/testBU', 'transactionalSMS', ['testExisting_tsms'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.transactionalSMS ? Object.keys(result.transactionalSMS).length : 0, 1, - 'only one transactionalSMS expected', + 'only one transactionalSMS expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_tsms', 'transactionalSMS'), await testUtils.getExpectedJson('9999999', 'transactionalSMS', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); expect( file( - testUtils.getActualTemplateFile('testExisting_tsms', 'transactionalSMS', 'amp'), - ), + testUtils.getActualTemplateFile('testExisting_tsms', 'transactionalSMS', 'amp') + ) ).to.equal( - file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'template', 'amp')), + file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'template', 'amp')) ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'transactionalSMS', 'testExisting_tsms', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_tsms', 'transactionalSMS'), await testUtils.getExpectedJson('9999999', 'transactionalSMS', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); expect( - file( - testUtils.getActualDeployFile('testTemplated_tsms', 'transactionalSMS', 'amp'), - ), + file(testUtils.getActualDeployFile('testTemplated_tsms', 'transactionalSMS', 'amp')) ).to.equal( - file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'build', 'amp')), + file(testUtils.getExpectedFile('9999999', 'transactionalSMS', 'build', 'amp')) ); assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); diff --git a/test/type.triggeredSend.test.js b/test/type.triggeredSend.test.js index 164c8850d..8d4e3a666 100644 --- a/test/type.triggeredSend.test.js +++ b/test/type.triggeredSend.test.js @@ -24,17 +24,17 @@ describe('type: triggeredSend', () => { assert.equal( result.triggeredSend ? Object.keys(result.triggeredSend).length : 0, 1, - 'only one triggeredSend expected', + 'only one triggeredSend expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_triggeredSend', 'triggeredSend'), await testUtils.getExpectedJson('9999999', 'triggeredSend', 'get'), - 'returned JSON was not equal expected', + 'returned JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 10, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -53,25 +53,25 @@ describe('type: triggeredSend', () => { assert.equal( result.triggeredSend ? Object.keys(result.triggeredSend).length : 0, 2, - 'two triggeredSends expected', + 'two triggeredSends expected' ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_triggeredSend', 'triggeredSend'), await testUtils.getExpectedJson('9999999', 'triggeredSend', 'post'), - 'returned JSON was not equal expected for insert triggeredSend', + 'returned JSON was not equal expected for insert triggeredSend' ); // confirm updated item assert.deepEqual( await testUtils.getActualJson('testExisting_triggeredSend', 'triggeredSend'), await testUtils.getExpectedJson('9999999', 'triggeredSend', 'patch'), - 'returned JSON was not equal expected for update triggeredSend', + 'returned JSON was not equal expected for update triggeredSend' ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 12, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -85,43 +85,43 @@ describe('type: triggeredSend', () => { 'testInstance/testBU', 'triggeredSend', ['testExisting_triggeredSend'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.triggeredSend ? Object.keys(result.triggeredSend).length : 0, 1, - 'only one triggeredSend expected', + 'only one triggeredSend expected' ); assert.deepEqual( await testUtils.getActualTemplateJson( 'testExisting_triggeredSend', - 'triggeredSend', + 'triggeredSend' ), await testUtils.getExpectedJson('9999999', 'triggeredSend', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'triggeredSend', 'testExisting_triggeredSend', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_triggeredSend', 'triggeredSend'), await testUtils.getExpectedJson('9999999', 'triggeredSend', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 10, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -132,7 +132,7 @@ describe('type: triggeredSend', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'triggeredSend', - 'testExisting_triggeredSend', + 'testExisting_triggeredSend' ); // THEN assert.equal(process.exitCode, false, 'delete should not have thrown an error'); diff --git a/test/type.user.test.js b/test/type.user.test.js index b61cd1840..7811b21f0 100644 --- a/test/type.user.test.js +++ b/test/type.user.test.js @@ -25,19 +25,19 @@ describe('type: user', () => { assert.equal( result.user ? Object.keys(result.user).length : 0, 3, - 'only three users expected', + 'only three users expected' ); assert.deepEqual( await testUtils.getActualJson('testExisting_user', 'user', '_ParentBU_'), await testUtils.getExpectedJson('1111111', 'user', 'retrieve'), - 'returned metadata was not equal expected', + 'returned metadata was not equal expected' ); // check if MD file was created and equals expectations // ! this test needs to update the lastLoginDate counter because it changes with every passing day const expectedFile = await File.readFile( testUtils.getExpectedFile('1111111', 'user', 'retrieve', 'md'), - { encoding: 'utf8' }, + { encoding: 'utf8' } ); const regexFindDaysSinceLogin = /\| (\d*) (seconds|minutes|days|weeks|months|years){1} \|/g; @@ -54,7 +54,7 @@ describe('type: user', () => { assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -70,7 +70,7 @@ describe('type: user', () => { assert.equal( testUtils.getAPIHistoryLength(), 4, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -96,26 +96,26 @@ describe('type: user', () => { assert.equal( result.user ? Object.keys(result.user).length : 0, 4, - 'four users expected', + 'four users expected' ); // confirm if result.user only includes values from expectedCache assert.deepEqual( Object.keys(result.user), expectedCache, - 'returned user keys were not equal expected', + 'returned user keys were not equal expected' ); // insert assert.deepEqual( await testUtils.getActualJson('testNew_user', 'user', '_ParentBU_'), await testUtils.getExpectedJson('1111111', 'user', 'create'), - 'returned metadata was not equal expected for create', + 'returned metadata was not equal expected for create' ); // update assert.deepEqual( await testUtils.getActualJson('testExisting_user', 'user', '_ParentBU_'), await testUtils.getExpectedJson('1111111', 'user', 'update'), - 'returned metadata was not equal expected for update', + 'returned metadata was not equal expected for update' ); // because user is single-document-type we would not want to find an md file getting created by deploy. only retrieve updates it expect(file(`./docs/user/testInstance.users.md`)).to.not.exist; @@ -123,7 +123,7 @@ describe('type: user', () => { assert.equal( testUtils.getAPIHistoryLength(), 9, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -143,19 +143,19 @@ describe('type: user', () => { assert.equal( result.user ? Object.keys(result.user).length : 0, 3, - 'three users expected', + 'three users expected' ); // confirm if result.user only includes values from expectedCache assert.deepEqual( Object.keys(result.user), expectedCache, - 'returned user keys were not equal expected', + 'returned user keys were not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -170,42 +170,42 @@ describe('type: user', () => { 'testInstance/_ParentBU_', 'user', ['testExisting_user'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); // WHEN assert.equal( result.user ? Object.keys(result.user).length : 0, 1, - 'only one user expected', + 'only one user expected' ); assert.deepEqual( await testUtils.getActualTemplateJson('testExisting_user', 'user'), await testUtils.getExpectedJson('1111111', 'user', 'template'), - 'returned template was not equal expected', + 'returned template was not equal expected' ); // THEN await handler.buildDefinition( 'testInstance/_ParentBU_', 'user', 'testExisting_user', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson('testTemplated_user', 'user', '_ParentBU_'), await testUtils.getExpectedJson('1111111', 'user', 'build'), - 'returned deployment file was not equal expected', + 'returned deployment file was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 6, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); diff --git a/test/type.verification.test.js b/test/type.verification.test.js index a0516ece0..c93a92f08 100644 --- a/test/type.verification.test.js +++ b/test/type.verification.test.js @@ -24,28 +24,28 @@ describe('type: verification', () => { assert.equal( result.verification ? Object.keys(result.verification).length : 0, 1, - 'only one verification expected', + 'only one verification expected' ); assert.equal( retrieved['testInstance/testBU']?.verification ? Object.keys(retrieved['testInstance/testBU']?.verification).length : 0, 1, - 'one verifications to be retrieved', + 'one verifications to be retrieved' ); assert.deepEqual( await testUtils.getActualJson( 'testExisting_39f6a488-20eb-4ba0-b0b9', - 'verification', + 'verification' ), await testUtils.getExpectedJson('9999999', 'verification', 'get'), - 'returned JSON was not equal expected', + 'returned JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 9, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -65,35 +65,35 @@ describe('type: verification', () => { assert.equal( result.verification ? Object.keys(result.verification).length : 0, 2, - 'two verifications expected', + 'two verifications expected' ); assert.equal( deployed['testInstance/testBU']?.verification ? Object.keys(deployed['testInstance/testBU']?.verification).length : 0, 2, - 'two verifications to be deployed', + 'two verifications to be deployed' ); // confirm created item assert.deepEqual( await testUtils.getActualJson('testNew_RANDOM_NEW_GUID', 'verification'), await testUtils.getExpectedJson('9999999', 'verification', 'post'), - 'returned new-JSON was not equal expected for insert verification', + 'returned new-JSON was not equal expected for insert verification' ); // confirm updated item assert.deepEqual( await testUtils.getActualJson( 'testExisting_39f6a488-20eb-4ba0-b0b9', - 'verification', + 'verification' ), await testUtils.getExpectedJson('9999999', 'verification', 'patch'), - 'returned existing-JSON was not equal expected for update verification', + 'returned existing-JSON was not equal expected for update verification' ); // check number of API calls assert.equal( testUtils.getAPIHistoryLength(), 11, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -107,46 +107,46 @@ describe('type: verification', () => { 'testInstance/testBU', 'verification', ['testExisting_39f6a488-20eb-4ba0-b0b9'], - 'testSourceMarket', + 'testSourceMarket' ); assert.equal(process.exitCode, false, 'buildTemplate should not have thrown an error'); assert.equal( result.verification ? Object.keys(result.verification).length : 0, 1, - 'only one verification expected', + 'only one verification expected' ); assert.deepEqual( await testUtils.getActualTemplateJson( 'testExisting_39f6a488-20eb-4ba0-b0b9', - 'verification', + 'verification' ), await testUtils.getExpectedJson('9999999', 'verification', 'template'), - 'returned template JSON was not equal expected', + 'returned template JSON was not equal expected' ); // buildDefinition await handler.buildDefinition( 'testInstance/testBU', 'verification', 'testExisting_39f6a488-20eb-4ba0-b0b9', - 'testTargetMarket', + 'testTargetMarket' ); assert.equal( process.exitCode, false, - 'buildDefinition should not have thrown an error', + 'buildDefinition should not have thrown an error' ); assert.deepEqual( await testUtils.getActualDeployJson( 'testTemplated_39f6a488-20eb-4ba0-b0b9', - 'verification', + 'verification' ), await testUtils.getExpectedJson('9999999', 'verification', 'build'), - 'returned deployment JSON was not equal expected', + 'returned deployment JSON was not equal expected' ); assert.equal( testUtils.getAPIHistoryLength(), 9, - 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests', + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; }); @@ -157,13 +157,13 @@ describe('type: verification', () => { const isDeleted = await handler.deleteByKey( 'testInstance/testBU', 'verification', - 'testExisting_39f6a488-20eb-4ba0-b0b9', + 'testExisting_39f6a488-20eb-4ba0-b0b9' ); // THEN assert.equal( process.exitCode, 0, - 'deleteByKey should have thrown an error due to lack of support', + 'deleteByKey should have thrown an error due to lack of support' ); assert.equal(isDeleted, true, 'deleteByKey should have returned true for success'); return; diff --git a/test/utils.js b/test/utils.js index 301e5fa57..f6404ee8c 100644 --- a/test/utils.js +++ b/test/utils.js @@ -26,7 +26,7 @@ const authResources = File.readJsonSync(path.join(__dirname, './resources/auth.j */ export function getActualJson(customerKey, type, buName = 'testBU') { return File.readJSON( - `./retrieve/testInstance/${buName}/${type}/${customerKey}.${type}-meta.json`, + `./retrieve/testInstance/${buName}/${type}/${customerKey}.${type}-meta.json` ); } @@ -62,7 +62,7 @@ export function getActualFile(customerKey, type, ext) { */ export function getActualDeployJson(customerKey, type, buName = 'testBU') { return File.readJSON( - `./deploy/testInstance/${buName}/${type}/${customerKey}.${type}-meta.json`, + `./deploy/testInstance/${buName}/${type}/${customerKey}.${type}-meta.json` ); } /** @@ -148,22 +148,22 @@ export function mockSetup(isDeploy) { '.mcdevrc.json': fsmock.load(path.resolve(__dirname, 'mockRoot/.mcdevrc.json')), '.mcdev-auth.json': fsmock.load(path.resolve(__dirname, 'mockRoot/.mcdev-auth.json')), 'boilerplate/config.json': fsmock.load( - path.resolve(__dirname, '../boilerplate/config.json'), + path.resolve(__dirname, '../boilerplate/config.json') ), test: fsmock.load(path.resolve(__dirname)), // the following node_modules are required for prettier's SQL parser to work 'node_modules/prettier': fsmock.load(path.resolve(__dirname, '../node_modules/prettier')), 'node_modules/prettier-plugin-sql': fsmock.load( - path.resolve(__dirname, '../node_modules/prettier-plugin-sql'), + path.resolve(__dirname, '../node_modules/prettier-plugin-sql') ), 'node_modules/node-sql-parser': fsmock.load( - path.resolve(__dirname, '../node_modules/node-sql-parser'), + path.resolve(__dirname, '../node_modules/node-sql-parser') ), 'node_modules/big-integer': fsmock.load( - path.resolve(__dirname, '../node_modules/big-integer'), + path.resolve(__dirname, '../node_modules/big-integer') ), 'node_modules/sql-formatter': fsmock.load( - path.resolve(__dirname, '../node_modules/sql-formatter'), + path.resolve(__dirname, '../node_modules/sql-formatter') ), 'node_modules/nearley': fsmock.load(path.resolve(__dirname, '../node_modules/nearley')), }; From 6fd5b631891e2bacb5413777f0592821dad56df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 22 Sep 2023 10:36:04 +0200 Subject: [PATCH 29/48] #0: change homepage of node package to our wiki --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2c15a8980..52e856451 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "type": "git", "url": "https://github.com/Accenture/sfmc-devtools.git" }, - "homepage": "https://github.com/Accenture/sfmc-devtools#readme", + "homepage": "https://github.com/Accenture/sfmc-devtools/wiki", "bugs": { "url": "https://github.com/Accenture/sfmc-devtools/issues", "email": "joern.berkefeld@accenture.com" From 7890eea6ef97c628fb561f2d15d0af54d7fb5ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 28 Sep 2023 11:36:57 +0200 Subject: [PATCH 30/48] #1108: add exports-section to package.json --- docs/dist/documentation.md | 6 ++++++ package.json | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/docs/dist/documentation.md b/docs/dist/documentation.md index 8d6096308..b632c784b 100644 --- a/docs/dist/documentation.md +++ b/docs/dist/documentation.md @@ -521,6 +521,7 @@ 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 @@ -547,6 +548,11 @@ main class * [.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 diff --git a/package.json b/package.json index 52e856451..c9cd2fe9b 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,10 @@ "rest" ], "main": "./lib/index.js", + "exports": { + ".": { "default": "./lib/index.js" }, + "./*": "./*" + }, "bin": { "mcdev": "./lib/cli.js" }, From a7d740cad8c4490a0bc8d833400522570e97b337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 28 Sep 2023 11:39:18 +0200 Subject: [PATCH 31/48] #0: typescript dependency updated --- package-lock.json | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index d0938404e..9b5478584 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6362,6 +6362,19 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-eslint/node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/prettier-linter-helpers": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", @@ -7722,16 +7735,17 @@ } }, "node_modules/typescript": { - "version": "4.6.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz", - "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/typical": { From ab11d2807b0183636c6c916dc7a0c81769ca9d3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 28 Sep 2023 11:42:17 +0200 Subject: [PATCH 32/48] #0: aligned prettier printWidth with formatting applied by npm --- .prettierrc | 6 ++++++ package.json | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.prettierrc b/.prettierrc index 8d68fa3f2..946dd787e 100644 --- a/.prettierrc +++ b/.prettierrc @@ -10,6 +10,12 @@ "parser": "json" } }, + { + "files": "package.json", + "options": { + "printWidth": 40 + } + }, { "files": "*.ssjs", "options": { diff --git a/package.json b/package.json index c9cd2fe9b..75e4788cc 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,9 @@ ], "main": "./lib/index.js", "exports": { - ".": { "default": "./lib/index.js" }, + ".": { + "default": "./lib/index.js" + }, "./*": "./*" }, "bin": { @@ -108,7 +110,9 @@ "fsevents": "*" }, "lint-staged": { - "*.{js,jsx,ts,tsx}": ["eslint --fix"] + "*.{js,jsx,ts,tsx}": [ + "eslint --fix" + ] }, "type": "module" } From e3098a912fc456ec7a04e9e8234b6e0d7a916ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 28 Sep 2023 11:44:17 +0200 Subject: [PATCH 33/48] #1108: add new api method version() to allow printing the version when the package is required instead of called via cli --- lib/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/index.js b/lib/index.js index 2e9749693..01e553142 100644 --- a/lib/index.js +++ b/lib/index.js @@ -21,6 +21,13 @@ import cache from './util/cache.js'; * main class */ class Mcdev { + /** + * @returns {string} current version of mcdev + */ + static version() { + console.log('mcdev v' + Util.packageJsonMcdev.version); // eslint-disable-line no-console + return Util.packageJsonMcdev.version; + } /** * helper method to use unattended mode when including mcdev as a package * From 682063ea3330d5d2af261c77a64d861b270c21ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 28 Sep 2023 11:46:54 +0200 Subject: [PATCH 34/48] #0: Bumped get-func-name from 2.0.0 to 2.0.2 via npm audit fix --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9b5478584..1c8c45c14 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3225,9 +3225,9 @@ } }, "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", "dev": true, "engines": { "node": "*" From 7b1a87a8bc65f65b0b3a1d406787313e6ecfd57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 29 Sep 2023 14:21:20 +0200 Subject: [PATCH 35/48] 6.0.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1c8c45c14..31d821cae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mcdev", - "version": "5.3.0", + "version": "6.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mcdev", - "version": "5.3.0", + "version": "6.0.0", "license": "MIT", "dependencies": { "beauty-amp-core": "0.3.7", diff --git a/package.json b/package.json index 75e4788cc..98e796219 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mcdev", - "version": "5.3.0", + "version": "6.0.0", "description": "Accenture Salesforce Marketing Cloud DevTools", "author": "Accenture: joern.berkefeld, douglas.midgley, robert.zimmermann, maciej.barnas", "license": "MIT", From ed62fdba41639eefd001f5ef32de7d9729565da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 29 Sep 2023 14:29:38 +0200 Subject: [PATCH 36/48] #0: prep for v6.0.0 --- .github/ISSUE_TEMPLATE/bug.yml | 1 + test/mockRoot/.mcdevrc.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 461f21e53..fb7efa774 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -39,6 +39,7 @@ body: label: Version description: What version of our software are you running? (mcdev --version) options: + - 6.0.0 - 5.3.0 - 5.2.0 - 5.1.0 diff --git a/test/mockRoot/.mcdevrc.json b/test/mockRoot/.mcdevrc.json index 30c384a28..266fb2dc3 100644 --- a/test/mockRoot/.mcdevrc.json +++ b/test/mockRoot/.mcdevrc.json @@ -78,5 +78,5 @@ "triggeredSend" ] }, - "version": "5.3.0" + "version": "6.0.0" } From 893fc3a4cbc546948a61c719f4728c5891f85902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 29 Sep 2023 15:16:36 +0200 Subject: [PATCH 37/48] #1108: omit .js endings for imports --- docs/dist/documentation.md | 9 --------- package.json | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/docs/dist/documentation.md b/docs/dist/documentation.md index b632c784b..c9d9205d9 100644 --- a/docs/dist/documentation.md +++ b/docs/dist/documentation.md @@ -137,9 +137,6 @@ Provides default functionality that can be overwritten by child metadata type cl ## Constants
-
MetadataTypeInfo
-

Provides access to all metadataType classes

-
BusinessUnit

Helper that handles retrieval of BU info

@@ -6290,12 +6287,6 @@ helper for [Retriever.retrieve](Retriever.retrieve) to get all dependencies of t | --- | --- | --- | | metadataTypes | Array.<TYPE.SupportedMetadataTypes> | list of metadata types to retrieve; can include subtypes! | - - -## MetadataTypeInfo -Provides access to all metadataType classes - -**Kind**: global constant ## BusinessUnit diff --git a/package.json b/package.json index 98e796219..014733405 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ ".": { "default": "./lib/index.js" }, - "./*": "./*" + "./*": "./*.js" }, "bin": { "mcdev": "./lib/cli.js" From 2b98fe5d0fa0dfc74ba9d630a1bb3f6d4bcb2acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 29 Sep 2023 15:18:42 +0200 Subject: [PATCH 38/48] #1108: intellisense --- lib/MetadataTypeDefinitions.js | 2 +- lib/MetadataTypeInfo.js | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/MetadataTypeDefinitions.js b/lib/MetadataTypeDefinitions.js index 89fb7dee9..d34eeeef7 100644 --- a/lib/MetadataTypeDefinitions.js +++ b/lib/MetadataTypeDefinitions.js @@ -37,7 +37,7 @@ import user from './metadataTypes/definitions/User.definition.js'; import verification from './metadataTypes/definitions/Verification.definition.js'; /** - * Provides access to all metadataType classes + * Provides access to definitions of all metadataType classes */ export default { asset, diff --git a/lib/MetadataTypeInfo.js b/lib/MetadataTypeInfo.js index 0234b069d..17ae9d198 100644 --- a/lib/MetadataTypeInfo.js +++ b/lib/MetadataTypeInfo.js @@ -39,7 +39,7 @@ import verification from './metadataTypes/Verification.js'; /** * Provides access to all metadataType classes */ -const MetadataTypeInfo = { +export default { asset, attributeGroup, attributeSet, @@ -76,5 +76,3 @@ const MetadataTypeInfo = { user, verification, }; - -export default MetadataTypeInfo; From 9fb7cb180509e9dc215db3b854c55b63cfcaf8d9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:48:59 +0000 Subject: [PATCH 39/48] Bump fast-xml-parser from 4.2.7 to 4.3.1 Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 4.2.7 to 4.3.1. - [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases) - [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v4.2.7...v4.3.1) --- updated-dependencies: - dependency-name: fast-xml-parser dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 30 ++++++++++++++++++++++++++---- package.json | 2 +- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 31d821cae..f0bfabeaa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,7 @@ "eslint-plugin-mocha": "10.1.0", "eslint-plugin-prettier": "5.0.0", "eslint-plugin-unicorn": "48.0.0", - "fast-xml-parser": "4.2.7", + "fast-xml-parser": "4.3.1", "husky": "8.0.3", "jsdoc-to-markdown": "8.0.0", "lint-staged": "14.0.1", @@ -2894,9 +2894,10 @@ "dev": true }, "node_modules/fast-xml-parser": { - "version": "4.2.7", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.2.7.tgz", - "integrity": "sha512-J8r6BriSLO1uj2miOk1NW0YVm8AGOOu3Si2HQp/cSmo6EA4m3fcwu2WKjJ4RK9wMLBtg69y1kS8baDiQBR41Ig==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.1.tgz", + "integrity": "sha512-viVv3xb8D+SiS1W4cv4tva3bni08kAkx0gQnWrykMM8nXPc1FxqZPU00dCEVjkiCg4HoXd2jC4x29Nzg/l2DAA==", + "dev": true, "funding": [ { "type": "paypal", @@ -7088,6 +7089,27 @@ "npm": ">=9" } }, + "node_modules/sfmc-sdk/node_modules/fast-xml-parser": { + "version": "4.2.7", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.2.7.tgz", + "integrity": "sha512-J8r6BriSLO1uj2miOk1NW0YVm8AGOOu3Si2HQp/cSmo6EA4m3fcwu2WKjJ4RK9wMLBtg69y1kS8baDiQBR41Ig==", + "funding": [ + { + "type": "paypal", + "url": "https://paypal.me/naturalintelligence" + }, + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "dependencies": { + "strnum": "^1.0.5" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", diff --git a/package.json b/package.json index 014733405..b22a146fb 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "eslint-plugin-mocha": "10.1.0", "eslint-plugin-prettier": "5.0.0", "eslint-plugin-unicorn": "48.0.0", - "fast-xml-parser": "4.2.7", + "fast-xml-parser": "4.3.1", "husky": "8.0.3", "jsdoc-to-markdown": "8.0.0", "lint-staged": "14.0.1", From 71ba7c5daf71fad9a7da066f12d33a46809970cf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:54:21 +0000 Subject: [PATCH 40/48] Bump simple-git from 3.19.0 to 3.20.0 Bumps [simple-git](https://github.com/steveukx/git-js/tree/HEAD/simple-git) from 3.19.0 to 3.20.0. - [Release notes](https://github.com/steveukx/git-js/releases) - [Changelog](https://github.com/steveukx/git-js/blob/main/simple-git/CHANGELOG.md) - [Commits](https://github.com/steveukx/git-js/commits/simple-git@3.20.0/simple-git) --- updated-dependencies: - dependency-name: simple-git dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index f0bfabeaa..d0a93ed30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "prettier-plugin-sql": "0.15.1", "semver": "7.5.4", "sfmc-sdk": "2.0.1", - "simple-git": "3.19.0", + "simple-git": "3.20.0", "toposort": "2.0.2", "update-notifier": "6.0.2", "winston": "3.10.0", @@ -7156,9 +7156,9 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, "node_modules/simple-git": { - "version": "3.19.0", - "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.19.0.tgz", - "integrity": "sha512-hyH2p9Ptxjf/xPuL7HfXbpYt9gKhC1yWDh3KYIAYJJePAKV7AEjLN4xhp7lozOdNiaJ9jlVvAbBymVlcS2jRiA==", + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.20.0.tgz", + "integrity": "sha512-ozK8tl2hvLts8ijTs18iFruE+RoqmC/mqZhjs/+V7gS5W68JpJ3+FCTmLVqmR59MaUQ52MfGQuWsIqfsTbbJ0Q==", "dependencies": { "@kwsites/file-exists": "^1.1.1", "@kwsites/promise-deferred": "^1.1.1", diff --git a/package.json b/package.json index b22a146fb..853809753 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "prettier-plugin-sql": "0.15.1", "semver": "7.5.4", "sfmc-sdk": "2.0.1", - "simple-git": "3.19.0", + "simple-git": "3.20.0", "toposort": "2.0.2", "update-notifier": "6.0.2", "winston": "3.10.0", From 98baad4ce1f756c01a6abd69e5472cee8088b017 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:57:19 +0000 Subject: [PATCH 41/48] Bump assert from 2.0.0 to 2.1.0 Bumps [assert](https://github.com/browserify/commonjs-assert) from 2.0.0 to 2.1.0. - [Release notes](https://github.com/browserify/commonjs-assert/releases) - [Changelog](https://github.com/browserify/commonjs-assert/blob/main/CHANGELOG.md) - [Commits](https://github.com/browserify/commonjs-assert/compare/v2.0.0...v2.1.0) --- updated-dependencies: - dependency-name: assert dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 30 ++++++++++++------------------ package.json | 2 +- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index d0a93ed30..55a4408fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,7 @@ "mcdev": "lib/cli.js" }, "devDependencies": { - "assert": "2.0.0", + "assert": "2.1.0", "axios-mock-adapter": "1.22.0", "c8": "7.14.0", "chai": "4.3.8", @@ -924,15 +924,16 @@ } }, "node_modules/assert": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-2.0.0.tgz", - "integrity": "sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz", + "integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==", "dev": true, "dependencies": { - "es6-object-assign": "^1.1.0", - "is-nan": "^1.2.1", - "object-is": "^1.0.1", - "util": "^0.12.0" + "call-bind": "^1.0.2", + "is-nan": "^1.3.2", + "object-is": "^1.1.5", + "object.assign": "^4.1.4", + "util": "^0.12.5" } }, "node_modules/assertion-error": { @@ -2392,12 +2393,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es6-object-assign": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", - "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=", - "dev": true - }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -7933,16 +7928,15 @@ } }, "node_modules/util": { - "version": "0.12.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz", - "integrity": "sha512-bxZ9qtSlGUWSOy9Qa9Xgk11kSslpuZwaxCg4sNIDj6FLucDab2JxnHwyNTCpHMtK1MjoQiWQ6DiUMZYbSrO+Sw==", + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", "dev": true, "dependencies": { "inherits": "^2.0.3", "is-arguments": "^1.0.4", "is-generator-function": "^1.0.7", "is-typed-array": "^1.1.3", - "safe-buffer": "^5.1.2", "which-typed-array": "^1.1.2" } }, diff --git a/package.json b/package.json index 853809753..ebb5bc033 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "yargs": "17.7.2" }, "devDependencies": { - "assert": "2.0.0", + "assert": "2.1.0", "axios-mock-adapter": "1.22.0", "c8": "7.14.0", "chai": "4.3.8", From 306a8ff2739ba8463603aec25a4a3ff8ce9a1794 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:59:55 +0000 Subject: [PATCH 42/48] Bump eslint-plugin-jsdoc from 46.8.1 to 46.8.2 Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 46.8.1 to 46.8.2. - [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases) - [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc) - [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v46.8.1...v46.8.2) --- updated-dependencies: - dependency-name: eslint-plugin-jsdoc dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 55a4408fe..1394c77b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,7 @@ "eslint": "8.49.0", "eslint-config-prettier": "9.0.0", "eslint-config-ssjs": "1.1.11", - "eslint-plugin-jsdoc": "46.8.1", + "eslint-plugin-jsdoc": "46.8.2", "eslint-plugin-mocha": "10.1.0", "eslint-plugin-prettier": "5.0.0", "eslint-plugin-unicorn": "48.0.0", @@ -2506,9 +2506,9 @@ } }, "node_modules/eslint-plugin-jsdoc": { - "version": "46.8.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-46.8.1.tgz", - "integrity": "sha512-uTce7IBluPKXIQMWJkIwFsI1gv7sZRmLjctca2K5DIxPi8fSBj9f4iru42XmGwuiMyH2f3nfc60sFmnSGv4Z/A==", + "version": "46.8.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-46.8.2.tgz", + "integrity": "sha512-5TSnD018f3tUJNne4s4gDWQflbsgOycIKEUBoCLn6XtBMgNHxQFmV8vVxUtiPxAQq8lrX85OaSG/2gnctxw9uQ==", "dev": true, "dependencies": { "@es-joy/jsdoccomment": "~0.40.1", diff --git a/package.json b/package.json index ebb5bc033..52c64341b 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "eslint": "8.49.0", "eslint-config-prettier": "9.0.0", "eslint-config-ssjs": "1.1.11", - "eslint-plugin-jsdoc": "46.8.1", + "eslint-plugin-jsdoc": "46.8.2", "eslint-plugin-mocha": "10.1.0", "eslint-plugin-prettier": "5.0.0", "eslint-plugin-unicorn": "48.0.0", From 880c32983746fdf734ebf13ffabe086e48ef2087 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Sep 2023 14:10:05 +0000 Subject: [PATCH 43/48] Bump eslint-plugin-mocha from 10.1.0 to 10.2.0 Bumps [eslint-plugin-mocha](https://github.com/lo1tuma/eslint-plugin-mocha) from 10.1.0 to 10.2.0. - [Release notes](https://github.com/lo1tuma/eslint-plugin-mocha/releases) - [Changelog](https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/lo1tuma/eslint-plugin-mocha/compare/10.1.0...10.2.0) --- updated-dependencies: - dependency-name: eslint-plugin-mocha dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1394c77b1..73933f3a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,7 +43,7 @@ "eslint-config-prettier": "9.0.0", "eslint-config-ssjs": "1.1.11", "eslint-plugin-jsdoc": "46.8.2", - "eslint-plugin-mocha": "10.1.0", + "eslint-plugin-mocha": "10.2.0", "eslint-plugin-prettier": "5.0.0", "eslint-plugin-unicorn": "48.0.0", "fast-xml-parser": "4.3.1", @@ -2529,13 +2529,13 @@ } }, "node_modules/eslint-plugin-mocha": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-10.1.0.tgz", - "integrity": "sha512-xLqqWUF17llsogVOC+8C6/jvQ+4IoOREbN7ZCHuOHuD6cT5cDD4h7f2LgsZuzMAiwswWE21tO7ExaknHVDrSkw==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-10.2.0.tgz", + "integrity": "sha512-ZhdxzSZnd1P9LqDPF0DBcFLpRIGdh1zkF2JHnQklKQOvrQtT73kdP5K9V2mzvbLR+cCAO9OI48NXK/Ax9/ciCQ==", "dev": true, "dependencies": { "eslint-utils": "^3.0.0", - "rambda": "^7.1.0" + "rambda": "^7.4.0" }, "engines": { "node": ">=14.0.0" @@ -6497,9 +6497,9 @@ "integrity": "sha512-cz93DjNeLY0idrCNOH6PviZGRN9GJhsdm9hpn1YCS879fj4W+x5IFJhhkRZcwVgMmFF7R82UA/7Oh+R8lLZg6A==" }, "node_modules/rambda": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/rambda/-/rambda-7.1.4.tgz", - "integrity": "sha512-bPK8sSiVHIC7CqdWga8R+hRi5hfc4hK6S01lZW4KrLwSNryQoKaCOJA9GNiF20J7Nbe1vejRfR37/ASQXFL5EA==", + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/rambda/-/rambda-7.5.0.tgz", + "integrity": "sha512-y/M9weqWAH4iopRd7EHDEQQvpFPHj1AA3oHozE9tfITHUtTR7Z9PSlIRRG2l1GuW7sefC1cXFfIcF+cgnShdBA==", "dev": true }, "node_modules/randexp": { diff --git a/package.json b/package.json index 52c64341b..cc1814fc3 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ "eslint-config-prettier": "9.0.0", "eslint-config-ssjs": "1.1.11", "eslint-plugin-jsdoc": "46.8.2", - "eslint-plugin-mocha": "10.1.0", + "eslint-plugin-mocha": "10.2.0", "eslint-plugin-prettier": "5.0.0", "eslint-plugin-unicorn": "48.0.0", "fast-xml-parser": "4.3.1", From 0ebc30ac3e0c34880e4a6a4fe920dc0d52848adb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 20:53:14 +0000 Subject: [PATCH 44/48] Bump eslint from 8.49.0 to 8.50.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.49.0 to 8.50.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.49.0...v8.50.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 73933f3a8..6ea64252b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "c8": "7.14.0", "chai": "4.3.8", "chai-files": "1.4.0", - "eslint": "8.49.0", + "eslint": "8.50.0", "eslint-config-prettier": "9.0.0", "eslint-config-ssjs": "1.1.11", "eslint-plugin-jsdoc": "46.8.2", @@ -373,9 +373,9 @@ "dev": true }, "node_modules/@eslint/js": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.49.0.tgz", - "integrity": "sha512-1S8uAY/MTJqVx0SC4epBq+N2yhuwtNwLbJYNZyhL2pO1ZVKn5HFXav5T41Ryzy9K9V7ZId2JB2oy/W4aCd9/2w==", + "version": "8.50.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz", + "integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -2425,15 +2425,15 @@ } }, "node_modules/eslint": { - "version": "8.49.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.49.0.tgz", - "integrity": "sha512-jw03ENfm6VJI0jA9U+8H5zfl5b+FvuU3YYvZRdZHOlU2ggJkxrlkJH4HcDrZpj6YwD8kuYqvQM8LyesoazrSOQ==", + "version": "8.50.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz", + "integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.49.0", + "@eslint/js": "8.50.0", "@humanwhocodes/config-array": "^0.11.11", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", diff --git a/package.json b/package.json index cc1814fc3..ac797eab8 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "c8": "7.14.0", "chai": "4.3.8", "chai-files": "1.4.0", - "eslint": "8.49.0", + "eslint": "8.50.0", "eslint-config-prettier": "9.0.0", "eslint-config-ssjs": "1.1.11", "eslint-plugin-jsdoc": "46.8.2", From a04ff749cc3a91c429e9e36ddfca37c9804d2f24 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:16:47 +0000 Subject: [PATCH 45/48] Bump c8 from 7.14.0 to 8.0.1 Bumps [c8](https://github.com/bcoe/c8) from 7.14.0 to 8.0.1. - [Release notes](https://github.com/bcoe/c8/releases) - [Changelog](https://github.com/bcoe/c8/blob/main/CHANGELOG.md) - [Commits](https://github.com/bcoe/c8/compare/v7.14.0...v8.0.1) --- updated-dependencies: - dependency-name: c8 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 80 +++++++++++++---------------------------------- package.json | 2 +- 2 files changed, 23 insertions(+), 59 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6ea64252b..6d91e227e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,7 +36,7 @@ "devDependencies": { "assert": "2.1.0", "axios-mock-adapter": "1.22.0", - "c8": "7.14.0", + "c8": "8.0.1", "chai": "4.3.8", "chai-files": "1.4.0", "eslint": "8.50.0", @@ -1279,9 +1279,9 @@ } }, "node_modules/c8": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/c8/-/c8-7.14.0.tgz", - "integrity": "sha512-i04rtkkcNcCf7zsQcSv/T9EbUn4RXQ6mropeMcjFOsQXQ0iGLAr/xT6TImQg4+U9hmNpN9XdvPkjUL1IzbgxJw==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/c8/-/c8-8.0.1.tgz", + "integrity": "sha512-EINpopxZNH1mETuI0DzRA4MZpAUH+IFiRhnmFD3vFr3vdrgxqi3VfE3KL0AIL+zDq8rC9bZqwM/VDmmoe04y7w==", "dev": true, "dependencies": { "@bcoe/v8-coverage": "^0.2.3", @@ -1289,46 +1289,19 @@ "find-up": "^5.0.0", "foreground-child": "^2.0.0", "istanbul-lib-coverage": "^3.2.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-reports": "^3.1.4", + "istanbul-lib-report": "^3.0.1", + "istanbul-reports": "^3.1.6", "rimraf": "^3.0.2", "test-exclude": "^6.0.0", "v8-to-istanbul": "^9.0.0", - "yargs": "^16.2.0", - "yargs-parser": "^20.2.9" + "yargs": "^17.7.2", + "yargs-parser": "^21.1.1" }, "bin": { "c8": "bin/c8.js" }, "engines": { - "node": ">=10.12.0" - } - }, - "node_modules/c8/node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/c8/node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/cache-point": { @@ -4356,23 +4329,23 @@ } }, "node_modules/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, "dependencies": { "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", + "make-dir": "^4.0.0", "supports-color": "^7.1.0" }, "engines": { - "node": ">=8" + "node": ">=10" } }, "node_modules/istanbul-reports": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", - "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", + "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", "dev": true, "dependencies": { "html-escaper": "^2.0.0", @@ -5338,29 +5311,20 @@ } }, "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", "dev": true, "dependencies": { - "semver": "^6.0.0" + "semver": "^7.5.3" }, "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/markdown-it": { "version": "12.3.2", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", diff --git a/package.json b/package.json index ac797eab8..a482bbd5e 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "devDependencies": { "assert": "2.1.0", "axios-mock-adapter": "1.22.0", - "c8": "7.14.0", + "c8": "8.0.1", "chai": "4.3.8", "chai-files": "1.4.0", "eslint": "8.50.0", From ea04f9d70887db8147f9dc4470db7beec4c4b147 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:19:58 +0000 Subject: [PATCH 46/48] Bump fast-xml-parser from 4.3.1 to 4.3.2 Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 4.3.1 to 4.3.2. - [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases) - [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v4.3.1...v4.3.2) --- updated-dependencies: - dependency-name: fast-xml-parser dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6d91e227e..0f0fc3c14 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,7 @@ "eslint-plugin-mocha": "10.2.0", "eslint-plugin-prettier": "5.0.0", "eslint-plugin-unicorn": "48.0.0", - "fast-xml-parser": "4.3.1", + "fast-xml-parser": "4.3.2", "husky": "8.0.3", "jsdoc-to-markdown": "8.0.0", "lint-staged": "14.0.1", @@ -2862,18 +2862,18 @@ "dev": true }, "node_modules/fast-xml-parser": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.1.tgz", - "integrity": "sha512-viVv3xb8D+SiS1W4cv4tva3bni08kAkx0gQnWrykMM8nXPc1FxqZPU00dCEVjkiCg4HoXd2jC4x29Nzg/l2DAA==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.2.tgz", + "integrity": "sha512-rmrXUXwbJedoXkStenj1kkljNF7ugn5ZjR9FJcwmCfcCbtOMDghPajbc+Tck6vE6F5XsDmx+Pr2le9fw8+pXBg==", "dev": true, "funding": [ - { - "type": "paypal", - "url": "https://paypal.me/naturalintelligence" - }, { "type": "github", "url": "https://github.com/sponsors/NaturalIntelligence" + }, + { + "type": "paypal", + "url": "https://paypal.me/naturalintelligence" } ], "dependencies": { diff --git a/package.json b/package.json index a482bbd5e..d14387ecc 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "eslint-plugin-mocha": "10.2.0", "eslint-plugin-prettier": "5.0.0", "eslint-plugin-unicorn": "48.0.0", - "fast-xml-parser": "4.3.1", + "fast-xml-parser": "4.3.2", "husky": "8.0.3", "jsdoc-to-markdown": "8.0.0", "lint-staged": "14.0.1", From 70a5f022fe5dec50ba98efce94e17b7c60f5c1a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:22:39 +0000 Subject: [PATCH 47/48] Bump chai from 4.3.8 to 4.3.10 Bumps [chai](https://github.com/chaijs/chai) from 4.3.8 to 4.3.10. - [Release notes](https://github.com/chaijs/chai/releases) - [Changelog](https://github.com/chaijs/chai/blob/4.x.x/History.md) - [Commits](https://github.com/chaijs/chai/compare/v4.3.8...v4.3.10) --- updated-dependencies: - dependency-name: chai dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 39 +++++++++++++++++++++------------------ package.json | 2 +- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0f0fc3c14..367ffbc85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,7 +37,7 @@ "assert": "2.1.0", "axios-mock-adapter": "1.22.0", "c8": "8.0.1", - "chai": "4.3.8", + "chai": "4.3.10", "chai-files": "1.4.0", "eslint": "8.50.0", "eslint-config-prettier": "9.0.0", @@ -1381,18 +1381,18 @@ } }, "node_modules/chai": { - "version": "4.3.8", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.8.tgz", - "integrity": "sha512-vX4YvVVtxlfSZ2VecZgFUTU5qPCYsobVI2O9FmwEXBhDigYGQA6jRXCycIs1yJnnWbZ6/+a2zNIF5DfVCcJBFQ==", + "version": "4.3.10", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.10.tgz", + "integrity": "sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==", "dev": true, "dependencies": { "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^4.1.2", - "get-func-name": "^2.0.0", - "loupe": "^2.3.1", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", "pathval": "^1.1.1", - "type-detect": "^4.0.5" + "type-detect": "^4.0.8" }, "engines": { "node": ">=4" @@ -1428,10 +1428,13 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" }, "node_modules/check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", "dev": true, + "dependencies": { + "get-func-name": "^2.0.2" + }, "engines": { "node": "*" } @@ -2013,9 +2016,9 @@ } }, "node_modules/deep-eql": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.2.tgz", - "integrity": "sha512-gT18+YW4CcW/DBNTwAmqTtkJh7f9qqScu2qFVlx7kCoeY9tlBu9cUcr7+I+Z/noG8INehS3xQgLpTtd/QUTn4w==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", "dev": true, "dependencies": { "type-detect": "^4.0.0" @@ -5291,9 +5294,9 @@ } }, "node_modules/loupe": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.4.tgz", - "integrity": "sha512-OvKfgCC2Ndby6aSTREl5aCCPTNIzlDfQZvZxNUrBrihDhL3xcrYegTblhmEiCrg2kKQz4XsFIaemE5BF4ybSaQ==", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", "dev": true, "dependencies": { "get-func-name": "^2.0.0" diff --git a/package.json b/package.json index d14387ecc..28fd625b0 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "assert": "2.1.0", "axios-mock-adapter": "1.22.0", "c8": "8.0.1", - "chai": "4.3.8", + "chai": "4.3.10", "chai-files": "1.4.0", "eslint": "8.50.0", "eslint-config-prettier": "9.0.0", From 0667788860f8bd89cae3c82c9081ecd2225ff2d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Mon, 9 Oct 2023 14:26:19 +0200 Subject: [PATCH 48/48] #0: improve log message for credential problems --- lib/util/cli.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/util/cli.js b/lib/util/cli.js index c35aa453a..cceeb4616 100644 --- a/lib/util/cli.js +++ b/lib/util/cli.js @@ -323,7 +323,9 @@ const Cli = { businessUnits: {}, }; } catch (ex) { - Util.logger.error(ex.message); + Util.logger.error( + `We could not verify your credential due to a problem (${ex.message}). Please try again.` + ); credentialsGood = false; if (skipInteraction) { // break the otherwise infinite loop