@basetime/bldr-sfmc-sdk
Advanced tools
Comparing version 1.2.7 to 1.2.8-beta
@@ -11,2 +11,5 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -19,2 +22,3 @@ exports.AutomationStudio = void 0; | ||
const FormatAutomationAsset_1 = require("../utils/_context/automationStudio/FormatAutomationAsset"); | ||
const ParseSQLDataExtensions_1 = __importDefault(require("../utils/_context/automationStudio/ParseSQLDataExtensions")); | ||
class AutomationStudio { | ||
@@ -148,3 +152,5 @@ constructor(sfmc, contentBuilder, emailStudio) { | ||
const folderResponse = yield this.sfmc.folder.getFoldersFromMiddle(request); | ||
console.log(JSON.stringify(folderResponse, null, 2)); | ||
const buildFolderPaths = yield (0, BuildSoapFolderObjects_1.buildFolderPathsSoap)(folderResponse.full); | ||
const ignoreFolders = folderResponse.up.results.map((folder) => folder.ID); | ||
const formattedFolders = buildFolderPaths.folders.map((folder) => { | ||
@@ -162,4 +168,7 @@ return { | ||
folderResponse.full | ||
.map((folder) => folder.Name !== 'my automations' && folder.ID) | ||
.map((folder) => folder.Name !== 'my automations' && | ||
!ignoreFolders.includes(folder.ID) && | ||
folder.ID) | ||
.filter(Boolean); | ||
console.log({ ignoreFolders, isolateFolderIds }); | ||
const collectAutomationKeys = yield this.sfmc.automation.getAssetsByFolderArray(isolateFolderIds); | ||
@@ -345,2 +354,3 @@ const isolateAutomationKeys = collectAutomationKeys && | ||
case 'queryactivity': | ||
case 'filteractivity': | ||
if (assetTypeName === 'dataextractactivity') { | ||
@@ -352,2 +362,15 @@ findDECustomerKey = definition.dataFields.find((dataField) => dataField.name === 'DECustomerKey'); | ||
} | ||
else if (assetTypeName === 'filteractivity') { | ||
findDECustomerKey = | ||
yield this.emailStudio.searchDataExtensions({ | ||
searchKey: 'ObjectID', | ||
searchTerm: definition.sourceObjectId, | ||
}); | ||
findDECustomerKey && | ||
Array.isArray(findDECustomerKey) && | ||
findDECustomerKey.length === 1 && | ||
findDECustomerKey[0].CustomerKey && | ||
customerKeyArr.push(findDECustomerKey[0].CustomerKey); | ||
customerKeyArr.push(definition.resultDEKey); | ||
} | ||
else if (assetTypeName === 'importactivity') { | ||
@@ -366,2 +389,3 @@ findDECustomerKey = | ||
else if (assetTypeName === 'queryactivity') { | ||
//Get CustomerKey of target DE | ||
findDECustomerKey = | ||
@@ -377,5 +401,20 @@ yield this.emailStudio.searchDataExtensions({ | ||
customerKeyArr.push(findDECustomerKey[0].CustomerKey); | ||
// definition && | ||
// definition.targetKey && | ||
// customerKeyArr.push(definition.targetKey); | ||
//Get Reference Data Extensions from sql text | ||
const parsedQueryDataExtensions = yield (0, ParseSQLDataExtensions_1.default)(definition.queryText); | ||
if (parsedQueryDataExtensions && | ||
parsedQueryDataExtensions.length) { | ||
for (const p in parsedQueryDataExtensions) { | ||
const dataExtensionName = parsedQueryDataExtensions[p]; | ||
findDECustomerKey = | ||
yield this.emailStudio.searchDataExtensions({ | ||
searchKey: 'Name', | ||
searchTerm: dataExtensionName, | ||
}); | ||
findDECustomerKey && | ||
Array.isArray(findDECustomerKey) && | ||
findDECustomerKey.length === 1 && | ||
findDECustomerKey[0].CustomerKey && | ||
customerKeyArr.push(findDECustomerKey[0].CustomerKey); | ||
} | ||
} | ||
} | ||
@@ -382,0 +421,0 @@ else if (assetTypeName === 'userinitiatedsend') { |
@@ -257,9 +257,6 @@ "use strict"; | ||
} | ||
console.log(assetId); | ||
const apiRequest = yield this.client.rest.delete(`/asset/v1/content/assets/${assetId}`); | ||
console.log('apiRequest', apiRequest); | ||
return apiRequest; | ||
} | ||
catch (err) { | ||
console.log('(e)', err); | ||
return err; | ||
@@ -266,0 +263,0 @@ } |
@@ -64,2 +64,3 @@ import { SFMC_SOAP_Folder } from '../types/objects/sfmc_soap_folders'; | ||
results: any[]; | ||
initialCategory: any[]; | ||
stop: Boolean; | ||
@@ -91,2 +92,3 @@ }>; | ||
results: any[]; | ||
initialCategory: any[]; | ||
stop: Boolean; | ||
@@ -93,0 +95,0 @@ }; |
@@ -190,2 +190,3 @@ "use strict"; | ||
results, | ||
initialCategory: rootFolderRequest.Results, | ||
stop: true, | ||
@@ -204,3 +205,3 @@ }; | ||
const initResult = initialCategory.Results[0]; | ||
results = [...results, ...initialCategory.Results]; | ||
// results = [...results, ...initialCategory.Results]; | ||
if (initResult && | ||
@@ -213,2 +214,3 @@ initResult.ParentFolder && | ||
results, | ||
initialCategory: initialCategory.Results, | ||
stop: false, | ||
@@ -259,2 +261,3 @@ }; | ||
results, | ||
initialCategory: initialCategory.Results, | ||
stop: false, | ||
@@ -350,3 +353,3 @@ }; | ||
full: [ | ||
...new Map([...up.results, ...down].map((item) => [item['ID'], item])).values(), | ||
...new Map([...up.results, ...up.initialCategory, ...down].map((item) => [item['ID'], item])).values(), | ||
], | ||
@@ -353,0 +356,0 @@ }; |
@@ -10,2 +10,3 @@ import { Folder } from '../../sfmc/api/Folder'; | ||
import { formatAutomation } from '../utils/_context/automationStudio/FormatAutomationAsset'; | ||
import parseQueryText from '../utils/_context/automationStudio/ParseSQLDataExtensions'; | ||
@@ -186,2 +187,4 @@ export class AutomationStudio { | ||
); | ||
console.log(JSON.stringify(folderResponse, null, 2)); | ||
const buildFolderPaths = await buildFolderPathsSoap( | ||
@@ -191,2 +194,5 @@ folderResponse.full | ||
const ignoreFolders = folderResponse.up.results.map( | ||
(folder: { ID: number }) => folder.ID | ||
); | ||
const formattedFolders = buildFolderPaths.folders.map((folder) => { | ||
@@ -208,6 +214,10 @@ return { | ||
(folder: SFMC_SOAP_Folder) => | ||
folder.Name !== 'my automations' && folder.ID | ||
folder.Name !== 'my automations' && | ||
!ignoreFolders.includes(folder.ID) && | ||
folder.ID | ||
) | ||
.filter(Boolean); | ||
console.log({ ignoreFolders, isolateFolderIds }); | ||
const collectAutomationKeys = | ||
@@ -478,2 +488,3 @@ await this.sfmc.automation.getAssetsByFolderArray( | ||
); | ||
case 'dataextractactivity': | ||
@@ -483,2 +494,3 @@ case 'importactivity': | ||
case 'queryactivity': | ||
case 'filteractivity': | ||
if (assetTypeName === 'dataextractactivity') { | ||
@@ -496,2 +508,18 @@ findDECustomerKey = definition.dataFields.find( | ||
customerKeyArr.push(findDECustomerKey.value); | ||
} else if (assetTypeName === 'filteractivity') { | ||
findDECustomerKey = | ||
await this.emailStudio.searchDataExtensions({ | ||
searchKey: 'ObjectID', | ||
searchTerm: definition.sourceObjectId, | ||
}); | ||
findDECustomerKey && | ||
Array.isArray(findDECustomerKey) && | ||
findDECustomerKey.length === 1 && | ||
findDECustomerKey[0].CustomerKey && | ||
customerKeyArr.push( | ||
findDECustomerKey[0].CustomerKey | ||
); | ||
customerKeyArr.push(definition.resultDEKey); | ||
} else if (assetTypeName === 'importactivity') { | ||
@@ -512,2 +540,3 @@ findDECustomerKey = | ||
} else if (assetTypeName === 'queryactivity') { | ||
//Get CustomerKey of target DE | ||
findDECustomerKey = | ||
@@ -527,5 +556,30 @@ await this.emailStudio.searchDataExtensions({ | ||
// definition && | ||
// definition.targetKey && | ||
// customerKeyArr.push(definition.targetKey); | ||
//Get Reference Data Extensions from sql text | ||
const parsedQueryDataExtensions = | ||
await parseQueryText(definition.queryText); | ||
if ( | ||
parsedQueryDataExtensions && | ||
parsedQueryDataExtensions.length | ||
) { | ||
for (const p in parsedQueryDataExtensions) { | ||
const dataExtensionName = | ||
parsedQueryDataExtensions[p]; | ||
findDECustomerKey = | ||
await this.emailStudio.searchDataExtensions( | ||
{ | ||
searchKey: 'Name', | ||
searchTerm: dataExtensionName, | ||
} | ||
); | ||
findDECustomerKey && | ||
Array.isArray(findDECustomerKey) && | ||
findDECustomerKey.length === 1 && | ||
findDECustomerKey[0].CustomerKey && | ||
customerKeyArr.push( | ||
findDECustomerKey[0].CustomerKey | ||
); | ||
} | ||
} | ||
} else if (assetTypeName === 'userinitiatedsend') { | ||
@@ -532,0 +586,0 @@ const sendDefinitionList = |
@@ -86,3 +86,2 @@ import { Client } from '../types/sfmc_client'; | ||
const getAllMidsRequest = await this.getInstanceDetails(); | ||
if ( | ||
@@ -89,0 +88,0 @@ getAllMidsRequest && |
@@ -271,5 +271,2 @@ import { Client } from '../types/sfmc_client'; | ||
} | ||
console.log(assetId); | ||
const apiRequest = await this.client.rest.delete( | ||
@@ -279,6 +276,4 @@ `/asset/v1/content/assets/${assetId}` | ||
console.log('apiRequest', apiRequest); | ||
return apiRequest; | ||
} catch (err) { | ||
console.log('(e)', err); | ||
return err; | ||
@@ -285,0 +280,0 @@ } |
@@ -196,3 +196,3 @@ import { SFMC_SOAP_Folder } from '../types/objects/sfmc_soap_folders'; | ||
categoryId: number; | ||
}): Promise<{ results: any[]; stop: Boolean }> { | ||
}): Promise<{ results: any[]; initialCategory: any[]; stop: Boolean }> { | ||
let parentId; | ||
@@ -229,2 +229,3 @@ let stopFolderId; | ||
results, | ||
initialCategory: rootFolderRequest.Results, | ||
stop: true, | ||
@@ -247,3 +248,3 @@ }; | ||
const initResult = initialCategory.Results[0]; | ||
results = [...results, ...initialCategory.Results]; | ||
// results = [...results, ...initialCategory.Results]; | ||
if ( | ||
@@ -258,2 +259,3 @@ initResult && | ||
results, | ||
initialCategory: initialCategory.Results, | ||
stop: false, | ||
@@ -318,2 +320,3 @@ }; | ||
results, | ||
initialCategory: initialCategory.Results, | ||
stop: false, | ||
@@ -426,3 +429,5 @@ }; | ||
...new Map( | ||
[...up.results, ...down].map((item) => [item['ID'], item]) | ||
[...up.results, ...up.initialCategory, ...down].map( | ||
(item) => [item['ID'], item] | ||
) | ||
).values(), | ||
@@ -429,0 +434,0 @@ ], |
{ | ||
"name": "@basetime/bldr-sfmc-sdk", | ||
"version": "1.2.7", | ||
"version": "1.2.8-beta", | ||
"description": "SDK for BLDR SFMC Core Functionality", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
401844
131
10711
2