Skip to content

Commit

Permalink
#38: jsdoc & log output improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Jul 17, 2023
1 parent e2b10f5 commit 9b1f939
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 20 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/coverage-develop-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ jobs:

- run: npm ci --ignore-scripts

- run: npm run lint

- name: Run mcdev-tests with coverage
run: npm run coverage

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/coverage-main-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ jobs:

- run: npm ci --ignore-scripts

- run: npm run lint

- name: Run mcdev-tests with coverage
run: npm run coverage

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:

- run: npm ci --ignore-scripts

- run: npm run lint

- name: Run mcdev-tests with coverage
run: npm run coverage

Expand Down
10 changes: 5 additions & 5 deletions docs/dist/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,7 @@ Retrieves all records for caching
<a name="DataExtensionField.convertToSortedArray"></a>

### DataExtensionField.convertToSortedArray(fieldsObj) ⇒ <code>Array.&lt;TYPE.DataExtensionFieldItem&gt;</code>
helper for [DataExtension._retrieveFieldsForSingleDe](DataExtension._retrieveFieldsForSingleDe) that sorts the fields into an array
helper for DataExtension.retrieveFieldsForSingleDe that sorts the fields into an array

**Kind**: static method of [<code>DataExtensionField</code>](#DataExtensionField)
**Returns**: <code>Array.&lt;TYPE.DataExtensionFieldItem&gt;</code> - sorted array of field objects
Expand Down Expand Up @@ -6170,7 +6170,7 @@ SFMC accepts multiple false values for Boolean attributes for which we are check
<a name="Util._isValidType"></a>

### Util.\_isValidType(selectedType, [handleOutside]) ⇒ <code>boolean</code>
helper for [retrieve](#Mcdev.retrieve), [retrieveAsTemplate](#Mcdev.retrieveAsTemplate) and [deploy](#Mcdev.deploy)
helper for Mcdev.retrieve, Mcdev.retrieveAsTemplate and Mcdev.deploy

**Kind**: static method of [<code>Util</code>](#Util)
**Returns**: <code>boolean</code> - type ok or not
Expand Down Expand Up @@ -6394,7 +6394,7 @@ pause execution of code; useful when multiple server calls are dependent on each
<a name="Util.getSsjs"></a>

### Util.getSsjs(code) ⇒ <code>string</code>
helper for [_extractCode](#Asset._extractCode) and [prepExtractedCode](#Script.prepExtractedCode) to determine if a code block is a valid SSJS block
helper for Asset.extractCode and Script.prepExtractedCode to determine if a code block is a valid SSJS block

**Kind**: static method of [<code>Util</code>](#Util)
**Returns**: <code>string</code> - the SSJS code if code block is a valid SSJS block, otherwise null
Expand Down Expand Up @@ -8101,7 +8101,7 @@ SFMC accepts multiple false values for Boolean attributes for which we are check
<a name="Util._isValidType"></a>

### Util.\_isValidType(selectedType, [handleOutside]) ⇒ <code>boolean</code>
helper for [retrieve](#Mcdev.retrieve), [retrieveAsTemplate](#Mcdev.retrieveAsTemplate) and [deploy](#Mcdev.deploy)
helper for Mcdev.retrieve, Mcdev.retrieveAsTemplate and Mcdev.deploy

**Kind**: static method of [<code>Util</code>](#Util)
**Returns**: <code>boolean</code> - type ok or not
Expand Down Expand Up @@ -8325,7 +8325,7 @@ pause execution of code; useful when multiple server calls are dependent on each
<a name="Util.getSsjs"></a>

### Util.getSsjs(code) ⇒ <code>string</code>
helper for [_extractCode](#Asset._extractCode) and [prepExtractedCode](#Script.prepExtractedCode) to determine if a code block is a valid SSJS block
helper for Asset.extractCode and Script.prepExtractedCode to determine if a code block is a valid SSJS block

**Kind**: static method of [<code>Util</code>](#Util)
**Returns**: <code>string</code> - the SSJS code if code block is a valid SSJS block, otherwise null
Expand Down
12 changes: 8 additions & 4 deletions lib/Deployer.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class Deployer {
return;
}
// valid credential given and -all- BUs targeted
Util.logger.info(`\n :: Deploying all BUs for ${cred}`);
Util.logger.info(`:: Deploying all BUs for ${cred}`);
let counter_credBu = 0;
// for (const bu in properties.credentials[cred].businessUnits) {
const deployFolders = await File.readDirectories(
Expand All @@ -157,7 +157,7 @@ class Deployer {
Util.logger.info('');
Util.startLogger(true);
}
Util.logger.info(`\n :: ${counter_credBu} BUs for ${cred}\n`);
Util.logger.info(` :: ${counter_credBu} BUs for ${cred}\n`);
} else {
// either bad credential or specific BU or no BU given
const multiMetadataTypeMap = await this._deployBU(
Expand All @@ -175,7 +175,7 @@ class Deployer {
properties.directories.deploy = deployDirBak;
}
if (counter_credBu !== 0) {
Util.logger.info(`\n :: Deployed ${counter_credBu} BUs\n`);
Util.logger.info(`:: Deployed ${counter_credBu} BUs\n`);
}
return buMultiMetadataTypeMap;
}
Expand Down Expand Up @@ -289,7 +289,11 @@ class Deployer {
// TODO rewrite to allow deploying only a specific sub-type; currently, subtypes are ignored when executing deploy
const type = metadataType;
if (this.metadata[type]) {
Util.logger.info('Deploying: ' + metadataType);
Util.logger.info(
'Deploying: ' +
metadataType +
(Util.OPTIONS.fromRetrieve ? ' (from retrieve folder)' : '')
);

const result = await MetadataTypeInfo[type].deploy(
this.metadata[type],
Expand Down
8 changes: 6 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,11 @@ class Mcdev {
cred = buObject.credential;
bu = buObject.businessUnit;
}
Util.logger.info(`\n :: Updating keys for ${type} on ${cred}/${bu}\n`);
Util.logger.info(
`Updating keys for ${type} on ${cred}/${bu}` +
(keys ? Util.getKeysString(keys) : '') +
`\n`
);
try {
try {
MetadataTypeInfo[type].client = auth.getSDK(buObject);
Expand Down Expand Up @@ -1086,7 +1090,7 @@ class Mcdev {
} catch (ex) {
Util.logger.errorStack(ex, 'mcdev.fixKeys failed');
}
Util.logger.info(`\n :: Done\n`);
Util.logger.info(`:: Done\n`);
return Object.keys(Object.values(Object.values(deployed)[0])[0]);
}
/**
Expand Down
2 changes: 1 addition & 1 deletion lib/metadataTypes/DataExtensionField.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DataExtensionField extends MetadataType {
return super.retrieveSOAP(null, requestParams, null, additionalFields);
}
/**
* helper for {@link DataExtension._retrieveFieldsForSingleDe} that sorts the fields into an array
* helper for DataExtension.retrieveFieldsForSingleDe that sorts the fields into an array
*
* @param {TYPE.DataExtensionFieldMap} fieldsObj customerKey-based list of fields for one dataExtension
* @returns {TYPE.DataExtensionFieldItem[]} sorted array of field objects
Expand Down
5 changes: 3 additions & 2 deletions lib/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ const Util = {
isFalse(attrValue) {
return ['false', 'FALSE', 'False', '0', 0, 'N', false].includes(attrValue);
},

/**
* helper for {@link Mcdev.retrieve}, {@link Mcdev.retrieveAsTemplate} and {@link Mcdev.deploy}
* helper for Mcdev.retrieve, Mcdev.retrieveAsTemplate and 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
Expand Down Expand Up @@ -736,7 +737,7 @@ const Util = {
});
},
/**
* helper for {@link Asset._extractCode} and {@link Script.prepExtractedCode} to determine if a code block is a valid SSJS block
* helper for Asset.extractCode and Script.prepExtractedCode to determine if a code block is a valid SSJS block
*
* @example the following is invalid:
* <script runat="server">
Expand Down

0 comments on commit 9b1f939

Please sign in to comment.