Skip to content

Commit

Permalink
Merge pull request #1387 from Accenture/develop
Browse files Browse the repository at this point in the history
v7.0.2
  • Loading branch information
JoernBerkefeld authored Jun 26, 2024
2 parents 9c8f436 + f9ad11b commit 16863c7
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 77 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ body:
label: Version
description: What version of our software are you running? (mcdev --version)
options:
- 7.0.2
- 7.0.1
- 7.0.0
- 6.0.2
Expand Down
1 change: 1 addition & 0 deletions @types/lib/metadataTypes/Folder.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ declare namespace Folder {
dependencies: any[];
subTypes: string[];
deployFolderTypes: string[];
deployFolderTypesRest: string[];
deployFolderBlacklist: string[];
folderTypesFromParent: string[];
hasExtended: boolean;
Expand Down
2 changes: 1 addition & 1 deletion @types/lib/metadataTypes/Folder.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ declare namespace _default {
let dependencies: any[];
let subTypes: string[];
let deployFolderTypes: string[];
let deployFolderTypesRest: string[];
let deployFolderBlacklist: string[];
let folderTypesFromParent: string[];
let hasExtended: boolean;
Expand Down
53 changes: 33 additions & 20 deletions lib/metadataTypes/Folder.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,29 +351,42 @@ class Folder extends MetadataType {
}
const path = metadataEntry.Path;
try {
// * We tried using the SOAP endpoint for creating folders but that did not support folders for automations nor journeys. This rest endpoint seems to cover everything though
const restPayload = {
parentCatId: metadataEntry.ParentFolder.ID,
name: metadataEntry.Name,
catType: metadataEntry.ContentType,
};
const response = await super.createREST(restPayload, '/email/v1/category', true);
if (response?.objectId) {
// convert the response to the same format as the SOAP response
metadataEntry.ID = response.objectId;
// the following is a bit of a hack to make the response look like the SOAP response; not sure if we actually need that anywhere like this --> future developers feel free to double check
const returnObject = {
Results: [
{
Object: metadataEntry,
},
],
if (this.definition.deployFolderTypesRest.includes(metadataEntry.ContentType)) {
// * The SOAP endpoint for creating folders does not support folders for automations nor journeys. The Rest endpoint on the other hand errors out on certain characters in the folder names that are actually valid. We therefore only use Rest for the folder types that are not supported by SOAP.
const restPayload = {
parentCatId: metadataEntry.ParentFolder.ID,
name: metadataEntry.Name,
catType: metadataEntry.ContentType,
};
const response = await super.createREST(restPayload, '/email/v1/category', true);
if (response?.objectId) {
// convert the response to the same format as the SOAP response
metadataEntry.ID = response.objectId;
// the following is a bit of a hack to make the response look like the SOAP response; not sure if we actually need that anywhere like this --> future developers feel free to double check
const returnObject = {
Results: [
{
Object: metadataEntry,
},
],
};

Util.logger.info(` - created folder: ${path}`);
return returnObject;
Util.logger.info(` - created folder: ${path}`);
return returnObject;
} else {
throw new Error(response);
}
} else {
throw new Error(response);
const response = await super.createSOAP(metadataEntry, true);
if (response) {
response.Results[0].Object = metadataEntry;
response.Results[0].Object.ID = response.Results[0].NewID;
response.Results[0].Object.CustomerKey = metadataEntry.CustomerKey;
delete response.Results[0].Object.$;

Util.logger.info(` - created folder: ${path}`);
return response;
}
}
} catch (ex) {
if (ex?.results) {
Expand Down
2 changes: 2 additions & 0 deletions lib/metadataTypes/definitions/Folder.definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default {
subTypes: [
'asset-shared',
'asset',
'automations',
'contextual_suppression_list',
'dataextension',
'filteractivity',
Expand Down Expand Up @@ -52,6 +53,7 @@ export default {
'triggered_send_journeybuilder',
'triggered_send',
],
deployFolderTypesRest: ['automations', 'journey', 'triggered_send_journeybuilder'],
deployFolderBlacklist: [
// lower-case values!
'shared data extensions',
Expand Down
125 changes: 74 additions & 51 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 16863c7

Please sign in to comment.