diff --git a/.github/workflows/sync-milestone.yml b/.github/workflows/sync-milestone.yml index 947758af5..fec3e7442 100644 --- a/.github/workflows/sync-milestone.yml +++ b/.github/workflows/sync-milestone.yml @@ -17,16 +17,17 @@ jobs: REPO: ${{ github.repository }} OWNER: ${{ github.repository_owner }} run: | - # 1. Get the milestone of the officially linked issues and the PR's current milestone via GraphQL - # This catches issues linked via "Fixes #123" and similar in the body or the UI sidebar. + # 1. Get milestones from ALL linked closing issues and the PR's current milestone via GraphQL. + # closingIssuesReferences catches issues linked via "Fixes #123" and similar in the body or sidebar. API_RESPONSE=$(gh api graphql -f query=' query($owner: String!, $name: String!, $pr: Int!) { repository(owner: $owner, name: $name) { pullRequest(number: $pr) { milestone { number + title } - closingIssuesReferences(first: 1) { + closingIssuesReferences(first: 20) { nodes { milestone { number @@ -38,18 +39,43 @@ jobs: } }' -F owner="$OWNER" -F name="${REPO#*/}" -F pr=$PR_NUMBER) - MILESTONE_NUMBER=$(echo "$API_RESPONSE" | jq -r '.data.repository.pullRequest.closingIssuesReferences.nodes[0].milestone.number // "null"') - MILESTONE_TITLE=$(echo "$API_RESPONSE" | jq -r '.data.repository.pullRequest.closingIssuesReferences.nodes[0].milestone.title // "null"') - CURRENT_PR_MILESTONE=$(echo "$API_RESPONSE" | jq -r '.data.repository.pullRequest.milestone.number // "null"') - - # 2. Check if a milestone was found - if [ "$MILESTONE_NUMBER" != "null" ] && [ -n "$MILESTONE_NUMBER" ]; then - if [ "$MILESTONE_NUMBER" = "$CURRENT_PR_MILESTONE" ]; then - echo "PR already has milestone '$MILESTONE_TITLE' set. No update needed." - else - echo "Found milestone '$MILESTONE_TITLE' from linked issue. Assigning to PR..." - gh pr edit $PR_NUMBER --milestone "$MILESTONE_TITLE" --repo "$REPO" - fi - else - echo "No milestone found on linked issues or no issues linked." + # 2. Collect all X.Y.Z milestone titles from linked issues, dedupe, version-sort, pick highest. + MILESTONE_TITLE=$(echo "$API_RESPONSE" \ + | jq -r '.data.repository.pullRequest.closingIssuesReferences.nodes[].milestone.title // empty' \ + | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' \ + | sort -uV \ + | tail -n1) + + CURRENT_PR_MILESTONE_TITLE=$(echo "$API_RESPONSE" | jq -r '.data.repository.pullRequest.milestone.title // "null"') + + # 3. No qualifying milestone found across all linked issues. + if [ -z "$MILESTONE_TITLE" ]; then + echo "No X.Y.Z milestone found on any linked issue. Nothing to sync." + exit 0 + fi + + # 4. PR already has that exact milestone title — nothing to do. + if [ "$MILESTONE_TITLE" = "$CURRENT_PR_MILESTONE_TITLE" ]; then + echo "PR already has milestone '$MILESTONE_TITLE' set. No update needed." + exit 0 + fi + + echo "Candidate milestone: '$MILESTONE_TITLE' (current PR milestone: '$CURRENT_PR_MILESTONE_TITLE')" + + # 5. Confirm the milestone title exists as an OPEN milestone on this repo. + # gh pr edit --milestone only accepts open milestones; closed ones return "not found". + REPO_MILESTONE_MATCH=$(gh api "repos/$REPO/milestones?per_page=100&state=open" --paginate \ + | jq -r '.[].title' \ + | grep -Fx "$MILESTONE_TITLE" || true) + + if [ -z "$REPO_MILESTONE_MATCH" ]; then + echo "::warning::Milestone '$MILESTONE_TITLE' not found as an open milestone on $REPO (it may be closed or deleted). Skipping PR milestone update." + exit 0 + fi + + # 6. Assign milestone to PR — treat any failure as a warning, never fail the job. + echo "Assigning milestone '$MILESTONE_TITLE' to PR #$PR_NUMBER..." + if ! gh pr edit "$PR_NUMBER" --milestone "$MILESTONE_TITLE" --repo "$REPO"; then + echo "::warning::Failed to assign milestone '$MILESTONE_TITLE' to PR #$PR_NUMBER. Manual update may be needed." fi + exit 0 diff --git a/@types/lib/metadataTypes/Asset.d.ts b/@types/lib/metadataTypes/Asset.d.ts index 43c32a558..2e6331082 100644 --- a/@types/lib/metadataTypes/Asset.d.ts +++ b/@types/lib/metadataTypes/Asset.d.ts @@ -189,12 +189,22 @@ declare class Asset extends MetadataType { * @returns {CodeExtractItem} metadata */ static postRetrieveTasks(metadata: AssetItem): CodeExtractItem; + /** + * helper for {@link Asset}. finds active emails that reference the updated block + * + * @private + * @param {AssetMap[]} blocks block metadata + * @param {AssetMap} _foundEmails map of found emails + * @param {Set} _searchedKeys set of searched block keys + * @returns {Promise.} - map of assets keyed by their keyField + */ + private static _findEmailsUsingBlock; /** * helper for {@link Asset.postDeployTasks}. triggers a refresh of active triggerredSendDefinitions associated with the updated asset-message items. Gets executed if refresh option has been set. * * @private * @param {MetadataTypeMap} metadata metadata mapped by their keyField - * @returns {Promise.} - + * @returns {Promise.} Returns list of keys that were refreshed */ private static _refreshTriggeredSend; /** @@ -417,6 +427,13 @@ declare class Asset extends MetadataType { * @param {string[]} dependentKeyArr list of found keys */ static _getDependentFilesExtra(slots: object, dependentKeyArr: string[]): void; + /** + * Finds emails in running journeys, filters out the ones that reference the block (if it's a block) and refreshes related TSDs + * + * @param {string[]} [keyArr] metadata keys + * @returns {Promise.} Returns list of keys that were refreshed + */ + static refresh(keyArr?: string[]): Promise; } declare namespace Asset { let getJsonFromFSCache: { diff --git a/@types/lib/metadataTypes/Asset.d.ts.map b/@types/lib/metadataTypes/Asset.d.ts.map index 82bfbc36e..bb0777e24 100644 --- a/@types/lib/metadataTypes/Asset.d.ts.map +++ b/@types/lib/metadataTypes/Asset.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Asset.d.ts","sourceRoot":"","sources":["../../../lib/metadataTypes/Asset.js"],"names":[],"mappings":";uBAca,OAAO,wBAAwB,EAAE,QAAQ;0BACzC,OAAO,wBAAwB,EAAE,WAAW;8BAC5C,OAAO,wBAAwB,EAAE,eAAe;+BAChD,OAAO,wBAAwB,EAAE,gBAAgB;mCACjD,OAAO,wBAAwB,EAAE,oBAAoB;8BACrD,OAAO,wBAAwB,EAAE,eAAe;gCAChD,OAAO,wBAAwB,EAAE,iBAAiB;0BAClD,OAAO,wBAAwB,EAAE,WAAW;2BAC5C,OAAO,wBAAwB,EAAE,YAAY;2BAI7C,OAAO,wBAAwB,EAAE,YAAY;uBAC7C,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AHW,MAAM,EAAE,GACN,OAAO,CAAE,MAAM,EAAE,CAAC,CAqC9B;CACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA3jGwB,mBAAmB"} \ No newline at end of file diff --git a/lib/metadataTypes/Asset.js b/lib/metadataTypes/Asset.js index cd8a55997..8f2340a60 100644 --- a/lib/metadataTypes/Asset.js +++ b/lib/metadataTypes/Asset.js @@ -848,7 +848,7 @@ class Asset extends MetadataType { if (Util.OPTIONS.refresh) { if (createdUpdated.updated) { // only run this if assets were updated. for created assets we do not expect - await this._refreshTriggeredSend(metadata); + await this.refresh(Object.keys(metadata)); } else { Util.logger.warn( 'You set the --refresh flag but no updated assets found. Skipping refresh of triggeredSendDefinitions.' @@ -856,13 +856,122 @@ class Asset extends MetadataType { } } } + /** + * helper for {@link Asset}. finds active emails that reference the updated block + * + * @private + * @param {AssetMap[]} blocks block metadata + * @param {AssetMap} _foundEmails map of found emails + * @param {Set} _searchedKeys set of searched block keys + * @returns {Promise.} - map of assets keyed by their keyField + */ + static async _findEmailsUsingBlock(blocks, _foundEmails = {}, _searchedKeys = new Set()) { + const uri = '/asset/v1/content/assets/query'; + + // Mark all current blocks as searched + for (const block of blocks) { + _searchedKeys.add(block.customerKey); + } + + /** @type {AssetRequestParams} */ + const payload = { + page: { page: 1, pageSize: 50 }, + // @ts-ignore + query: blocks + .flatMap((obj) => [ + { + property: 'content', + simpleOperator: 'mustContain', + value: `ContentBlockByKey("${obj.customerKey}")`, + }, + ...(obj.id + ? [ + { + property: 'content', + simpleOperator: 'mustContain', + value: `ContentBlockById(${obj.id})`, + }, + ] + : []), + ...(obj.name + ? [ + { + property: 'content', + simpleOperator: 'mustContain', + value: `ContentBlockByName("${obj.name}")`, + }, + ] + : []), + ]) + .reduce((acc, condition, index) => { + if (index === 0) { + return condition; + } + return { leftOperand: acc, logicalOperator: 'OR', rightOperand: condition }; + }, null), + }; + + let items = []; + let moreResults; + let lastPage = 0; + + try { + do { + payload.page.page = lastPage + 1; + const response = await this.client.rest.post(uri, payload); + // sometimes the api will return a payload without items + // --> ensure we only add proper items-arrays here + if (response?.items?.length) { + items = items.concat(response.items); + } + // check if any more records + if (response?.message?.includes('all shards failed')) { + // When running certain filters, there is a limit of 10k on ElastiCache. + // Since we sort by ID, we can get the last ID then run new requests from there + payload.query = { + property: 'id', + simpleOperator: 'greaterThan', + value: items.at(-1).id, + }; + lastPage = 0; + moreResults = true; + } else if (response.page * response.pageSize < response.count) { + moreResults = true; + lastPage = Number(response.page); + } else { + moreResults = false; + } + } while (moreResults); + } catch (ex) { + Util.logger.error(`An error occurred while attempting to query assets. ${ex.message}`); + } + + const emailTypes = this.definition.extendedSubTypes.message; + const foundEmails = items.filter((item) => emailTypes.includes(item.assetType.name)); + const foundBlocks = items.filter((item) => !emailTypes.includes(item.assetType.name)); + + for (const email of foundEmails) { + _foundEmails[email.customerKey] = email; + } + + // Recurse with all unsearched blocks in one call + const unsearchedBlocks = foundBlocks.filter( + (block) => !_searchedKeys.has(block.customerKey) + ); + if (unsearchedBlocks.length) { + await this._findEmailsUsingBlock(unsearchedBlocks, _foundEmails, _searchedKeys); + } + + // @ts-ignore + return _foundEmails; + } /** * helper for {@link Asset.postDeployTasks}. triggers a refresh of active triggerredSendDefinitions associated with the updated asset-message items. Gets executed if refresh option has been set. * * @private * @param {MetadataTypeMap} metadata metadata mapped by their keyField - * @returns {Promise.} - + * @returns {Promise.} Returns list of keys that were refreshed */ static async _refreshTriggeredSend(metadata) { // get legacyData.legacyId from assets to compare to TSD's metadata.Email.ID to @@ -900,7 +1009,7 @@ class Asset extends MetadataType { // get keys of TSDs to refresh const keyArr = await TriggeredSend.getKeysForValidTSDs(tsdObj); - await TriggeredSend.refresh(keyArr); + return await TriggeredSend.refresh(keyArr); } catch { Util.logger.warn('Failed to refresh triggeredSendDefinition'); } @@ -2980,11 +3089,52 @@ class Asset extends MetadataType { } return cacheMatchedByName; } + /** + * Finds emails in running journeys, filters out the ones that reference the block (if it's a block) and refreshes related TSDs + * + * @param {string[]} [keyArr] metadata keys + * @returns {Promise.} Returns list of keys that were refreshed + */ + static async refresh(keyArr) { + const codeBlocks = []; + const toPublish = []; + + Util.logger.info(' - Caching dependent Metadata: asset'); + const assets = await this.retrieveForCache(undefined, null, undefined, false); + cache.mergeMetadata('asset', assets.metadata); + + Util.logger.info(' - Caching dependent Metadata: shared-asset'); + const sharedAssets = await this.retrieveForCache(undefined, null, undefined, true); + cache.mergeMetadata('asset', sharedAssets.metadata); + + for (const key of keyArr) { + const item = cache.getByKey(this.definition.type, key); + if (!item) { + Util.logger.warn(` - Could not find asset in cache for key: ${key}, skipping`); + continue; + } + if (this.definition.extendedSubTypes.message.includes(item?.assetType?.name)) { + toPublish.push(item); + // refreshing code blocks referenced with ContentBlockBy + } else if ( + this.definition.extendedSubTypes.block.includes(item?.assetType?.name) || + this.definition.extendedSubTypes.other.includes(item?.assetType?.name) + ) { + codeBlocks.push(item); + } + } + if (codeBlocks.length > 0) { + toPublish.push(...Object.values(await this._findEmailsUsingBlock(codeBlocks))); + } + Util.logger.info( + ` - Found ${toPublish.length} assets to publish. Looking up triggered sends for the following emails: ${toPublish.map((e) => e.name)}` + ); + return toPublish.length ? await this._refreshTriggeredSend(toPublish) : []; + } } // Assign definition to static attributes import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js'; - Asset.definition = MetadataTypeDefinitions.asset; export default Asset; diff --git a/test/mockRoot/deploy/testInstance/testBU/asset/block/testExisting_block_refresh.asset-block-meta.html b/test/mockRoot/deploy/testInstance/testBU/asset/block/testExisting_block_refresh.asset-block-meta.html new file mode 100644 index 000000000..0e3606f44 --- /dev/null +++ b/test/mockRoot/deploy/testInstance/testBU/asset/block/testExisting_block_refresh.asset-block-meta.html @@ -0,0 +1,15 @@ + + + + + diff --git a/test/mockRoot/deploy/testInstance/testBU/asset/block/testExisting_block_refresh.asset-block-meta.json b/test/mockRoot/deploy/testInstance/testBU/asset/block/testExisting_block_refresh.asset-block-meta.json new file mode 100644 index 000000000..e8ff5605f --- /dev/null +++ b/test/mockRoot/deploy/testInstance/testBU/asset/block/testExisting_block_refresh.asset-block-meta.json @@ -0,0 +1,30 @@ +{ + "id": 334322, + "customerKey": "testExisting_block_refresh", + "objectID": "baf8348d-61d5-451f-948a-28045e41e50c", + "assetType": { + "id": 220, + "name": "codesnippetblock", + "displayName": "Code Snippet Block" + }, + "name": "testExisting_block_refresh", + "createdDate": "2025-10-24T12:19:21.2-06:00", + "createdBy": { + "id": 724496218, + "email": "test@test.com", + "name": "Yuliia Likhytska", + "userId": "724496218" + }, + "modifiedDate": "2026-03-15T11:37:51.38-06:00", + "modifiedBy": { + "id": 724496218, + "email": "test@test.com", + "name": "Yuliia Likhytska", + "userId": "724496218" + }, + "category": { + "id": 370568 + }, + "modelVersion": 2, + "r__folder_Path": "Content Builder" +} \ No newline at end of file diff --git a/test/resourceFactory.js b/test/resourceFactory.js index fd8b5237d..fae8c4dae 100644 --- a/test/resourceFactory.js +++ b/test/resourceFactory.js @@ -310,11 +310,18 @@ export const handleRESTRequest = async (config) => { : null; if (!testPathFilter && config.method === 'post' && config.data) { - const simpleOperators = { equal: '=', in: 'IN' }; + const simpleOperators = { equal: '=', in: 'IN', mustContain: 'MUSTCONTAIN' }; const data = JSON.parse(config.data); const myObj = data.query?.rightOperand || data.query; if (myObj) { const op = simpleOperators[myObj.simpleOperator]; + // if it's a content block refresh. update expected file name to remove special characters from it + const contentBlockMatch = + typeof myObj.value === 'string' && + myObj.value.match(/^ContentBlockByName\("(.+?)"\)$/); + if (contentBlockMatch) { + myObj.value = contentBlockMatch[1]; + } filterBody = `${myObj.property}${op}${op === 'IN' ? myObj.value.join(',') : myObj.value}`; } else if (config.url === '/email/v1/category') { const data = JSON.parse(config.data); diff --git a/test/resources/9999999/asset/v1/content/assets/334322/patch-response.json b/test/resources/9999999/asset/v1/content/assets/334322/patch-response.json new file mode 100644 index 000000000..e8ff5605f --- /dev/null +++ b/test/resources/9999999/asset/v1/content/assets/334322/patch-response.json @@ -0,0 +1,30 @@ +{ + "id": 334322, + "customerKey": "testExisting_block_refresh", + "objectID": "baf8348d-61d5-451f-948a-28045e41e50c", + "assetType": { + "id": 220, + "name": "codesnippetblock", + "displayName": "Code Snippet Block" + }, + "name": "testExisting_block_refresh", + "createdDate": "2025-10-24T12:19:21.2-06:00", + "createdBy": { + "id": 724496218, + "email": "test@test.com", + "name": "Yuliia Likhytska", + "userId": "724496218" + }, + "modifiedDate": "2026-03-15T11:37:51.38-06:00", + "modifiedBy": { + "id": 724496218, + "email": "test@test.com", + "name": "Yuliia Likhytska", + "userId": "724496218" + }, + "category": { + "id": 370568 + }, + "modelVersion": 2, + "r__folder_Path": "Content Builder" +} \ No newline at end of file diff --git a/test/resources/9999999/asset/v1/content/assets/query/post-response-assetType.idIN219,220,221,222,223,224,225,226,227,228,230,232,240,241,242,243,244,245.json b/test/resources/9999999/asset/v1/content/assets/query/post-response-assetType.idIN219,220,221,222,223,224,225,226,227,228,230,232,240,241,242,243,244,245.json index e67e7539a..f908820fd 100644 --- a/test/resources/9999999/asset/v1/content/assets/query/post-response-assetType.idIN219,220,221,222,223,224,225,226,227,228,230,232,240,241,242,243,244,245.json +++ b/test/resources/9999999/asset/v1/content/assets/query/post-response-assetType.idIN219,220,221,222,223,224,225,226,227,228,230,232,240,241,242,243,244,245.json @@ -7,7 +7,11 @@ { "id": 1209971, "customerKey": "mobileMessage_test", - "assetType": { "id": 230, "name": "jsonmessage", "displayName": "JSON Message" }, + "assetType": { + "id": 230, + "name": "jsonmessage", + "displayName": "JSON Message" + }, "name": "mobileMessage_test", "createdDate": "2022-12-07T02:49:36.857-06:00", "createdBy": { @@ -23,9 +27,18 @@ "name": "J├Ârn Berkefeld (ASGR)", "userId": "700301950" }, - "status": { "id": 1, "name": "Draft" }, - "category": { "id": 89397, "name": "Content Builder", "parentId": 0 }, - "availableViews": ["push"], + "status": { + "id": 1, + "name": "Draft" + }, + "category": { + "id": 89397, + "name": "Content Builder", + "parentId": 0 + }, + "availableViews": [ + "push" + ], "modelVersion": 2 }, { @@ -163,6 +176,315 @@ } }, "modelVersion": 2 + }, + { + "id": 317008, + "customerKey": "testExisting_email_block_refresh", + "objectID": "91dd2b7a-b99d-4203-b99b-d157f419d6e2", + "contentType": "application/vnd.etmc.email.Message; kind=template", + "assetType": { + "id": 207, + "name": "templatebasedemail", + "displayName": "Template-Based Email" + }, + "name": "testExisting_email_block_refresh", + "owner": { + "id": 724496218, + "email": "test@test.com", + "name": "Yuliia Likhytska", + "userId": "724496218" + }, + "createdDate": "2025-02-18T14:01:04.887-06:00", + "createdBy": { + "id": 724496218, + "email": "test@test.com", + "name": "Yuliia Likhytska", + "userId": "724496218" + }, + "modifiedDate": "2026-03-15T11:36:06.29-06:00", + "modifiedBy": { + "id": 724496218, + "email": "test@test.com", + "name": "Yuliia Likhytska", + "userId": "724496218" + }, + "enterpriseId": 10958751, + "memberId": 524008782, + "status": { + "id": 1, + "name": "Draft" + }, + "thumbnail": { + "thumbnailUrl": "/v1/assets/317008/thumbnail" + }, + "category": { + "id": 370568 + }, + "meta": { + "globalStyles": { + "isLocked": false, + "template": { + "background-color": "#FFFFFF", + "border-width": "0px", + "border-style": "solid" + }, + "body": { + "background-color": "#FFFFFF", + "font-family": "Arial,helvetica,sans-serif", + "font-size": "16px", + "color": "#000000", + "line-height": 1, + "margin": "0px", + "padding": "0px", + "content-padding-top": "0px", + "content-padding-right": "0px", + "content-padding-bottom": "0px", + "content-padding-left": "0px" + }, + "h1": { + "font-family": "Arial,helvetica,sans-serif", + "font-size": "28px", + "color": "#181818", + "line-height": 1, + "font-weight": "bold", + "font-style": "normal" + }, + "h2": { + "font-family": "Arial,helvetica,sans-serif", + "font-size": "22px", + "color": "#181818", + "line-height": 1, + "font-weight": "bold", + "font-style": "normal" + }, + "h3": { + "font-family": "Arial,helvetica,sans-serif", + "font-size": "20px", + "color": "#181818", + "line-height": 1, + "font-weight": "bold", + "font-style": "normal" + }, + "links": { + "font-weight": "normal", + "color": "#0176d3", + "text-decoration": "none" + }, + "buttons": { + "font-family": "Arial,helvetica,sans-serif", + "font-size": "16px", + "color": "#FFFFFF", + "background-color": "#5D5D5D", + "border-radius": "3px", + "padding": "10px", + "border-color": "#5D5D5D", + "border-width": "1px", + "border-style": "solid" + }, + "mobile": { + "body": { + "padding": "0px", + "font-size": "16px", + "line-height": 1.5 + }, + "h1": { + "font-size": "22px", + "line-height": 1 + }, + "h2": { + "font-size": "20px", + "line-height": 1 + }, + "h3": { + "font-size": "18px", + "line-height": 1 + }, + "buttons": { + "font-family": "Arial,helvetica,sans-serif", + "font-size": "16px", + "color": "#FFFFFF", + "padding": "10px" + } + } + } + }, + "views": { + "subjectline": { + "contentType": "application/vnd.etmc.email.View; kind=subjectline", + "content": "WelcomeEmail", + "availableViews": [], + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + }, + "preheader": { + "availableViews": [], + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + }, + "html": { + "content": "\n\n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n \n
\n \n \n \n \n \n
\n \n \n \n \n \n \n
\n \n \n \n \n \n \n
\n
\n\t\t\t\t\t\t\t\t\t\t\t\t
\n
\n
\n
\n
\n
\n
\n
\n \n
\n \n\n", + "availableViews": [], + "slots": { + "banner": { + "content": "
", + "design": "

Drop blocks or content here

", + "availableViews": [], + "blocks": { + "xt7992z12xm": { + "assetType": { + "id": 220, + "name": "codesnippetblock" + }, + "content": "

Test1

\n%%=ContentBlockByKey(\"testExisting_block_refresh\")=%%\n", + "design": "
", + "availableViews": [], + "data": { + "email": { + "options": { + "generateFrom": "" + } + } + }, + "modelVersion": 2 + } + }, + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + } + }, + "template": { + "id": 0, + "assetType": { + "id": 214, + "name": "defaulttemplate" + }, + "name": "CONTENTTEMPLATES_BLANK_PAGE", + "content": "", + "meta": { + "contentHash": 1850388723 + }, + "availableViews": [], + "slots": { + "banner": { + "locked": false, + "availableViews": [], + "data": { + "email": { + "options": { + "generateFrom": null + } + } + }, + "modelVersion": 2 + } + }, + "data": { + "email": { + "options": { + "generateFrom": null + } + } + }, + "modelVersion": 2 + }, + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + }, + "text": { + "availableViews": [], + "data": { + "email": { + "options": { + "generateFrom": "html" + } + } + }, + "generateFrom": "html", + "modelVersion": 2 + }, + "viewAsAWebPage": { + "availableViews": [], + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + }, + "subscriptioncenter": { + "availableViews": [], + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + }, + "forwardHTML": { + "availableViews": [], + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + }, + "forwardText": { + "availableViews": [], + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + } + }, + "availableViews": [ + "subjectline", + "preheader", + "html", + "text", + "viewAsAWebPage", + "subscriptioncenter", + "forwardHTML", + "forwardText" + ], + "data": { + "email": { + "options": { + "characterEncoding": "utf-8" + }, + "legacy": { + "legacyId": 45226, + "legacyKey": "1d5f326a-a4cf-4eb6-a2e9-12983e7c49bc", + "legacyType": "email", + "legacyCategoryId": 368109 + } + } + }, + "legacyData": { + "legacyId": 45226, + "legacyKey": "1d5f326a-a4cf-4eb6-a2e9-12983e7c49bc", + "legacyType": "email", + "legacyCategoryId": 368109 + }, + "modelVersion": 2 } ] -} +} \ No newline at end of file diff --git a/test/resources/9999999/asset/v1/content/assets/query/post-response-contentMUSTCONTAINtestExisting_block_refresh.json b/test/resources/9999999/asset/v1/content/assets/query/post-response-contentMUSTCONTAINtestExisting_block_refresh.json new file mode 100644 index 000000000..bee967c21 --- /dev/null +++ b/test/resources/9999999/asset/v1/content/assets/query/post-response-contentMUSTCONTAINtestExisting_block_refresh.json @@ -0,0 +1,317 @@ +{ + "count": 1, + "page": 1, + "pageSize": 50, + "links": {}, + "items": [ + { + "id": 317008, + "customerKey": "testExisting_email_block_refresh", + "objectID": "91dd2b7a-b99d-4203-b99b-d157f419d6e2", + "contentType": "application/vnd.etmc.email.Message; kind=template", + "assetType": { + "id": 207, + "name": "templatebasedemail", + "displayName": "Template-Based Email" + }, + "name": "testExisting_email_block_refresh", + "owner": { + "id": 724496218, + "email": "test@test.com", + "name": "Yuliia Likhytska", + "userId": "724496218" + }, + "createdDate": "2025-02-18T14:01:04.887-06:00", + "createdBy": { + "id": 724496218, + "email": "test@test.com", + "name": "Yuliia Likhytska", + "userId": "724496218" + }, + "modifiedDate": "2026-03-15T11:36:06.29-06:00", + "modifiedBy": { + "id": 724496218, + "email": "test@test.com", + "name": "Yuliia Likhytska", + "userId": "724496218" + }, + "enterpriseId": 10958751, + "memberId": 524008782, + "status": { + "id": 1, + "name": "Draft" + }, + "thumbnail": { + "thumbnailUrl": "/v1/assets/317008/thumbnail" + }, + "category": { + "id": 370568 + }, + "meta": { + "globalStyles": { + "isLocked": false, + "template": { + "background-color": "#FFFFFF", + "border-width": "0px", + "border-style": "solid" + }, + "body": { + "background-color": "#FFFFFF", + "font-family": "Arial,helvetica,sans-serif", + "font-size": "16px", + "color": "#000000", + "line-height": 1, + "margin": "0px", + "padding": "0px", + "content-padding-top": "0px", + "content-padding-right": "0px", + "content-padding-bottom": "0px", + "content-padding-left": "0px" + }, + "h1": { + "font-family": "Arial,helvetica,sans-serif", + "font-size": "28px", + "color": "#181818", + "line-height": 1, + "font-weight": "bold", + "font-style": "normal" + }, + "h2": { + "font-family": "Arial,helvetica,sans-serif", + "font-size": "22px", + "color": "#181818", + "line-height": 1, + "font-weight": "bold", + "font-style": "normal" + }, + "h3": { + "font-family": "Arial,helvetica,sans-serif", + "font-size": "20px", + "color": "#181818", + "line-height": 1, + "font-weight": "bold", + "font-style": "normal" + }, + "links": { + "font-weight": "normal", + "color": "#0176d3", + "text-decoration": "none" + }, + "buttons": { + "font-family": "Arial,helvetica,sans-serif", + "font-size": "16px", + "color": "#FFFFFF", + "background-color": "#5D5D5D", + "border-radius": "3px", + "padding": "10px", + "border-color": "#5D5D5D", + "border-width": "1px", + "border-style": "solid" + }, + "mobile": { + "body": { + "padding": "0px", + "font-size": "16px", + "line-height": 1.5 + }, + "h1": { + "font-size": "22px", + "line-height": 1 + }, + "h2": { + "font-size": "20px", + "line-height": 1 + }, + "h3": { + "font-size": "18px", + "line-height": 1 + }, + "buttons": { + "font-family": "Arial,helvetica,sans-serif", + "font-size": "16px", + "color": "#FFFFFF", + "padding": "10px" + } + } + } + }, + "views": { + "subjectline": { + "contentType": "application/vnd.etmc.email.View; kind=subjectline", + "content": "WelcomeEmail", + "availableViews": [], + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + }, + "preheader": { + "availableViews": [], + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + }, + "html": { + "content": "\n\n \n \n \n \n \n \n \n \n
\n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n \n \n \n
\n \n \n \n \n
\n \n \n \n \n \n
\n \n \n \n \n \n
\n \n \n \n \n \n \n
\n \n \n \n \n \n \n
\n
\n\t\t\t\t\t\t\t\t\t\t\t\t
\n
\n
\n
\n
\n
\n
\n
\n \n
\n \n\n", + "availableViews": [], + "slots": { + "banner": { + "content": "
", + "design": "

Drop blocks or content here

", + "availableViews": [], + "blocks": { + "xt7992z12xm": { + "assetType": { + "id": 220, + "name": "codesnippetblock" + }, + "content": "

Test1

\n%%=ContentBlockByKey(\"testExisting_block_refresh\")=%%\n", + "design": "
", + "availableViews": [], + "data": { + "email": { + "options": { + "generateFrom": "" + } + } + }, + "modelVersion": 2 + } + }, + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + } + }, + "template": { + "id": 0, + "assetType": { + "id": 214, + "name": "defaulttemplate" + }, + "name": "CONTENTTEMPLATES_BLANK_PAGE", + "content": "", + "meta": { + "contentHash": 1850388723 + }, + "availableViews": [], + "slots": { + "banner": { + "locked": false, + "availableViews": [], + "data": { + "email": { + "options": { + "generateFrom": null + } + } + }, + "modelVersion": 2 + } + }, + "data": { + "email": { + "options": { + "generateFrom": null + } + } + }, + "modelVersion": 2 + }, + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + }, + "text": { + "availableViews": [], + "data": { + "email": { + "options": { + "generateFrom": "html" + } + } + }, + "generateFrom": "html", + "modelVersion": 2 + }, + "viewAsAWebPage": { + "availableViews": [], + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + }, + "subscriptioncenter": { + "availableViews": [], + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + }, + "forwardHTML": { + "availableViews": [], + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + }, + "forwardText": { + "availableViews": [], + "data": { + "email": { + "options": {} + } + }, + "modelVersion": 2 + } + }, + "availableViews": [ + "subjectline", + "preheader", + "html", + "text", + "viewAsAWebPage", + "subscriptioncenter", + "forwardHTML", + "forwardText" + ], + "data": { + "email": { + "options": { + "characterEncoding": "utf-8" + }, + "legacy": { + "legacyId": 45226, + "legacyKey": "1d5f326a-a4cf-4eb6-a2e9-12983e7c49bc", + "legacyType": "email", + "legacyCategoryId": 368109 + } + } + }, + "legacyData": { + "legacyId": 45226, + "legacyKey": "1d5f326a-a4cf-4eb6-a2e9-12983e7c49bc", + "legacyType": "email", + "legacyCategoryId": 368109 + }, + "modelVersion": 2 + } + ] +} \ No newline at end of file diff --git a/test/resources/9999999/interaction/v1/interactions/get-response-status=Published.json b/test/resources/9999999/interaction/v1/interactions/get-response-status=Published.json index 9f3018518..4edd538b5 100644 --- a/test/resources/9999999/interaction/v1/interactions/get-response-status=Published.json +++ b/test/resources/9999999/interaction/v1/interactions/get-response-status=Published.json @@ -35,6 +35,429 @@ "status": "Published", "scheduledStatus": "Draft", "definitionId": "dsfdsafdsa-922c-4568-85a5-e5cc77efc3be" + }, + { + "id": "ee45d1d0-134b-f147-3143-9c7f53a8a9c4", + "key": "testExisting_email_block_refresh", + "name": "testExisting_email_block_refresh", + "lastPublishedDate": "0001-01-01T00:00:00", + "description": "", + "version": 1, + "workflowApiVersion": 1, + "createdDate": "2024-05-04T05:54:48.027", + "modifiedDate": "2024-05-04T17:25:57.9", + "activities": [ + { + "id": "7ba1e59a-6be4-46c7-b76f-4c06feb1268a", + "key": "EMAILV2-1", + "name": "testExisting_email_block_refresh", + "description": "", + "type": "EMAILV2", + "outcomes": [ + { + "key": "ff60a294-3804-4165-85cd-c7c19c8e3a6d", + "next": "WAITBYDURATION-1", + "arguments": {}, + "metaData": { + "invalid": false + } + } + ], + "arguments": {}, + "configurationArguments": { + "applicationExtensionKey": "jb-email-activity", + "isModified": false, + "isSimulation": false, + "googleAnalyticsCampaignName": "", + "useLLTS": false, + "fuelAgentRequested": true, + "isReconcilable": false, + "r__triggeredSend_key": "testExistingRefresh_triggeredSend", + "triggeredSend": { + "autoAddSubscribers": true, + "autoUpdateSubscribers": true, + "bccEmail": [], + "c__priority": "Medium", + "campaigns": [], + "categoryId": 386288, + "ccEmail": [], + "created": { + "name": "5fdc029c-8f64-44f0-b64e-596e6dc1d4a8 app user", + "date": "2026-02-27T03:07:00Z" + }, + "description": "testExisting_email_block_refresh - 1cd2907abd4b4d89b9c0950b7f95a758", + "domainExclusions": [], + "dynamicEmailSubject": "testExisting_email_block_refresh", + "emailSubject": "testExisting_email_block_refresh", + "exclusionFilter": "", + "isMultipart": true, + "isReconcilable": null, + "isSalesforceTracking": true, + "isSendLogging": false, + "isStoppedOnJobError": false, + "isTrackingClicks": true, + "keyword": "", + "modified": { + "name": "Test", + "date": "2026-02-27T03:14:00Z" + }, + "name": "testExisting_email_block_refresh - e5ddb96bfd4e4ebfbef73b554f2eabc6", + "preHeader": "", + "r__asset_key": "testExisting_email_block_refresh", + "r__asset_name_readOnly": "testExisting_email_block_refresh", + "r__deliveryProfile_key": "Default", + "r__list_PathName": { + "publicationList": "my subscribers/All Subscribers" + }, + "r__sendClassification_key": "Default Commercial", + "r__senderProfile_key": "Default", + "r__triggeredSend_key": "testExistingRefresh_triggeredSend", + "reconciliationExpiryHours": null, + "replyToAddress": "", + "replyToDisplayName": "", + "suppressTracking": false, + "suppressionLists": [], + "throttleLimit": 0, + "triggeredSendStatus": "Active", + "version": 2 + } + }, + "metaData": { + "category": "message", + "version": "1.0", + "icon": "https://jb-email-activity.s7.marketingcloudapps.com/img/email-icon.svg", + "iconSmall": "https://jb-email-activity.s7.marketingcloudapps.com/img/email-icon.svg", + "statsContactIcon": null, + "original_icon": "/img/email-icon.svg", + "original_iconSmall": "/img/email-icon.svg", + "sections": {}, + "isConfigured": true + }, + "schema": { + "arguments": { + "requestID": { + "dataType": "Text", + "isNullable": true, + "direction": "Out", + "readOnly": false, + "access": "Hidden" + }, + "messageKey": { + "dataType": "Text", + "isNullable": true, + "direction": "Out", + "readOnly": false, + "access": "Hidden" + }, + "activityId": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "definitionId": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": true, + "access": "Hidden" + }, + "emailSubjectDataBound": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": true, + "access": "Hidden" + }, + "contactId": { + "dataType": "Number", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "contactKey": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "emailAddress": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "sourceCustomObjectId": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "sourceCustomObjectKey": { + "dataType": "LongNumber", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "fieldType": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "eventData": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "obfuscationProperties": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "customObjectKey": { + "dataType": "LongNumber", + "isNullable": true, + "direction": "In", + "readOnly": true, + "access": "Hidden" + }, + "definitionInstanceId": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + } + } + } + }, + { + "id": "70572b1a-e274-4f09-a3fa-6fc0732ec52b", + "key": "WAITBYDURATION-2", + "name": "", + "description": "", + "type": "WAIT", + "outcomes": [ + { + "key": "a0908f9f-bc3c-47f7-9489-7fef5af25ce3", + "arguments": {}, + "metaData": { + "invalid": false + } + } + ], + "arguments": {}, + "configurationArguments": { + "waitDuration": 1, + "waitUnit": "DAYS" + }, + "metaData": { + "isConfigured": true, + "uiType": "WAITBYDURATION" + }, + "schema": { + "arguments": { + "endDate": { + "dataType": "Date", + "isNullable": false, + "direction": "Out", + "readOnly": false, + "access": "Hidden" + }, + "waitEndDateAttributeDataBound": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "waitDefinitionId": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "waitForEventId": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "executionMode": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "startActivityKey": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "waitQueueId": { + "dataType": "LongNumber", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + } + } + } + }, + { + "id": "e2a486cf-c85f-4543-88a2-d579cac1e0de", + "key": "WAITBYDURATION-1", + "name": "1 day", + "description": "", + "type": "WAIT", + "outcomes": [ + { + "key": "97af222a-450a-429e-8925-649b72f01ccf", + "arguments": {}, + "metaData": { + "invalid": false + } + } + ], + "arguments": {}, + "configurationArguments": { + "waitDuration": 1, + "waitUnit": "DAYS" + }, + "metaData": { + "isConfigured": true, + "uiType": "WAITBYDURATION" + }, + "schema": { + "arguments": { + "endDate": { + "dataType": "Date", + "isNullable": false, + "direction": "Out", + "readOnly": false, + "access": "Hidden" + }, + "waitEndDateAttributeDataBound": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "waitDefinitionId": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "waitForEventId": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "executionMode": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "startActivityKey": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "waitQueueId": { + "dataType": "LongNumber", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + } + } + } + } + ], + "triggers": [ + { + "id": "92753481-1258-49bd-8a84-921ed63bcc2e", + "key": "TRIGGER", + "name": "TRIGGER", + "description": "", + "type": "EmailAudience", + "outcomes": [], + "arguments": {}, + "configurationArguments": {}, + "metaData": { + "eventDefinitionId": "649d512b-4d08-4eca-a14e-fc7b64b4ada8", + "eventDefinitionKey": "DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e", + "chainType": "None", + "configurationRequired": false, + "iconUrl": "/images/icon-data-extension.svg", + "title": "Data Extension", + "entrySourceGroupConfigUrl": "jb:///data/entry/audience/entrysourcegroupconfig.json", + "sourceInteractionId": "00000000-0000-0000-0000-000000000000" + } + } + ], + "goals": [], + "exits": [], + "notifiers": [], + "stats": { + "currentPopulation": 0, + "cumulativePopulation": 0, + "metGoal": 0, + "metExitCriteria": 0, + "goalPerformance": 0 + }, + "entryMode": "NotSet", + "definitionType": "Multistep", + "channel": "", + "defaults": { + "email": [ + "{{Event.DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e.\"Email\"}}" + ], + "properties": { + "analyticsTracking": { + "enabled": true, + "analyticsType": "google", + "urlDomainsToTrack": [] + } + } + }, + "metaData": { + "dataSource": "ContactsModel", + "highThroughputSending": { + "email": false + } + }, + "executionMode": "Production", + "categoryId": 6298, + "status": "Published", + "definitionId": "0175b971-71a3-4d8e-98ac-48121f3fbf4f", + "scheduledStatus": "Draft" } ] -} +} \ No newline at end of file diff --git a/test/resources/9999999/interaction/v1/interactions/key_testExisting_email_block_refresh/get-response.json b/test/resources/9999999/interaction/v1/interactions/key_testExisting_email_block_refresh/get-response.json new file mode 100644 index 000000000..9febc0cc8 --- /dev/null +++ b/test/resources/9999999/interaction/v1/interactions/key_testExisting_email_block_refresh/get-response.json @@ -0,0 +1,423 @@ +{ + "id": "ee45d1d0-134b-f147-3143-9c7f53a8a9c4", + "key": "testExisting_email_block_refresh", + "name": "testExisting_email_block_refresh", + "lastPublishedDate": "0001-01-01T00:00:00", + "description": "", + "version": 1, + "workflowApiVersion": 1, + "createdDate": "2024-05-04T05:54:48.027", + "modifiedDate": "2024-05-04T17:25:57.9", + "activities": [ + { + "id": "7ba1e59a-6be4-46c7-b76f-4c06feb1268a", + "key": "EMAILV2-1", + "name": "testExisting_email_block_refresh", + "description": "", + "type": "EMAILV2", + "outcomes": [ + { + "key": "ff60a294-3804-4165-85cd-c7c19c8e3a6d", + "next": "WAITBYDURATION-1", + "arguments": {}, + "metaData": { + "invalid": false + } + } + ], + "arguments": {}, + "configurationArguments": { + "applicationExtensionKey": "jb-email-activity", + "isModified": false, + "isSimulation": false, + "googleAnalyticsCampaignName": "", + "useLLTS": false, + "fuelAgentRequested": true, + "isReconcilable": false, + "r__triggeredSend_key": "testExistingRefresh_triggeredSend", + "triggeredSend": { + "autoAddSubscribers": true, + "autoUpdateSubscribers": true, + "bccEmail": [], + "c__priority": "Medium", + "campaigns": [], + "categoryId": 386288, + "ccEmail": [], + "created": { + "name": "5fdc029c-8f64-44f0-b64e-596e6dc1d4a8 app user", + "date": "2026-02-27T03:07:00Z" + }, + "description": "testExisting_email_block_refresh - 1cd2907abd4b4d89b9c0950b7f95a758", + "domainExclusions": [], + "dynamicEmailSubject": "testExisting_email_block_refresh", + "emailSubject": "testExisting_email_block_refresh", + "exclusionFilter": "", + "isMultipart": true, + "isReconcilable": null, + "isSalesforceTracking": true, + "isSendLogging": false, + "isStoppedOnJobError": false, + "isTrackingClicks": true, + "keyword": "", + "modified": { + "name": "Test", + "date": "2026-02-27T03:14:00Z" + }, + "name": "testExisting_email_block_refresh - e5ddb96bfd4e4ebfbef73b554f2eabc6", + "preHeader": "", + "r__asset_key": "testExisting_email_block_refresh", + "r__asset_name_readOnly": "testExisting_email_block_refresh", + "r__deliveryProfile_key": "Default", + "r__list_PathName": { + "publicationList": "my subscribers/All Subscribers" + }, + "r__sendClassification_key": "Default Commercial", + "r__senderProfile_key": "Default", + "r__triggeredSend_key": "testExistingRefresh_triggeredSend", + "reconciliationExpiryHours": null, + "replyToAddress": "", + "replyToDisplayName": "", + "suppressTracking": false, + "suppressionLists": [], + "throttleLimit": 0, + "triggeredSendStatus": "Active", + "version": 2 + } + }, + "metaData": { + "category": "message", + "version": "1.0", + "icon": "https://jb-email-activity.s7.marketingcloudapps.com/img/email-icon.svg", + "iconSmall": "https://jb-email-activity.s7.marketingcloudapps.com/img/email-icon.svg", + "statsContactIcon": null, + "original_icon": "/img/email-icon.svg", + "original_iconSmall": "/img/email-icon.svg", + "sections": {}, + "isConfigured": true + }, + "schema": { + "arguments": { + "requestID": { + "dataType": "Text", + "isNullable": true, + "direction": "Out", + "readOnly": false, + "access": "Hidden" + }, + "messageKey": { + "dataType": "Text", + "isNullable": true, + "direction": "Out", + "readOnly": false, + "access": "Hidden" + }, + "activityId": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "definitionId": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": true, + "access": "Hidden" + }, + "emailSubjectDataBound": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": true, + "access": "Hidden" + }, + "contactId": { + "dataType": "Number", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "contactKey": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "emailAddress": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "sourceCustomObjectId": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "sourceCustomObjectKey": { + "dataType": "LongNumber", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "fieldType": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "eventData": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "obfuscationProperties": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "customObjectKey": { + "dataType": "LongNumber", + "isNullable": true, + "direction": "In", + "readOnly": true, + "access": "Hidden" + }, + "definitionInstanceId": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + } + } + } + }, + { + "id": "70572b1a-e274-4f09-a3fa-6fc0732ec52b", + "key": "WAITBYDURATION-2", + "name": "", + "description": "", + "type": "WAIT", + "outcomes": [ + { + "key": "a0908f9f-bc3c-47f7-9489-7fef5af25ce3", + "arguments": {}, + "metaData": { + "invalid": false + } + } + ], + "arguments": {}, + "configurationArguments": { + "waitDuration": 1, + "waitUnit": "DAYS" + }, + "metaData": { + "isConfigured": true, + "uiType": "WAITBYDURATION" + }, + "schema": { + "arguments": { + "endDate": { + "dataType": "Date", + "isNullable": false, + "direction": "Out", + "readOnly": false, + "access": "Hidden" + }, + "waitEndDateAttributeDataBound": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "waitDefinitionId": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "waitForEventId": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "executionMode": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "startActivityKey": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "waitQueueId": { + "dataType": "LongNumber", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + } + } + } + }, + { + "id": "e2a486cf-c85f-4543-88a2-d579cac1e0de", + "key": "WAITBYDURATION-1", + "name": "1 day", + "description": "", + "type": "WAIT", + "outcomes": [ + { + "key": "97af222a-450a-429e-8925-649b72f01ccf", + "arguments": {}, + "metaData": { + "invalid": false + } + } + ], + "arguments": {}, + "configurationArguments": { + "waitDuration": 1, + "waitUnit": "DAYS" + }, + "metaData": { + "isConfigured": true, + "uiType": "WAITBYDURATION" + }, + "schema": { + "arguments": { + "endDate": { + "dataType": "Date", + "isNullable": false, + "direction": "Out", + "readOnly": false, + "access": "Hidden" + }, + "waitEndDateAttributeDataBound": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "waitDefinitionId": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "waitForEventId": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "executionMode": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "startActivityKey": { + "dataType": "Text", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + }, + "waitQueueId": { + "dataType": "LongNumber", + "isNullable": true, + "direction": "In", + "readOnly": false, + "access": "Hidden" + } + } + } + } + ], + "triggers": [ + { + "id": "92753481-1258-49bd-8a84-921ed63bcc2e", + "key": "TRIGGER", + "name": "TRIGGER", + "description": "", + "type": "EmailAudience", + "outcomes": [], + "arguments": {}, + "configurationArguments": {}, + "metaData": { + "eventDefinitionId": "649d512b-4d08-4eca-a14e-fc7b64b4ada8", + "eventDefinitionKey": "DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e", + "chainType": "None", + "configurationRequired": false, + "iconUrl": "/images/icon-data-extension.svg", + "title": "Data Extension", + "entrySourceGroupConfigUrl": "jb:///data/entry/audience/entrysourcegroupconfig.json", + "sourceInteractionId": "00000000-0000-0000-0000-000000000000" + } + } + ], + "goals": [], + "exits": [], + "notifiers": [], + "stats": { + "currentPopulation": 0, + "cumulativePopulation": 0, + "metGoal": 0, + "metExitCriteria": 0, + "goalPerformance": 0 + }, + "entryMode": "NotSet", + "definitionType": "Multistep", + "channel": "", + "defaults": { + "email": [ + "{{Event.DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e.\"Email\"}}" + ], + "properties": { + "analyticsTracking": { + "enabled": true, + "analyticsType": "google", + "urlDomainsToTrack": [] + } + } + }, + "metaData": { + "dataSource": "ContactsModel", + "highThroughputSending": { + "email": false + } + }, + "executionMode": "Production", + "categoryId": 6298, + "status": "Published", + "definitionId": "0175b971-71a3-4d8e-98ac-48121f3fbf4f", + "scheduledStatus": "Draft" +} \ No newline at end of file diff --git a/test/resources/9999999/triggeredSendDefinition/retrieve-CustomerKey=testExistingRefresh_triggeredSend-response.xml b/test/resources/9999999/triggeredSendDefinition/retrieve-CustomerKey=testExistingRefresh_triggeredSend-response.xml new file mode 100644 index 000000000..ff8ac8e4f --- /dev/null +++ b/test/resources/9999999/triggeredSendDefinition/retrieve-CustomerKey=testExistingRefresh_triggeredSend-response.xml @@ -0,0 +1,72 @@ + + + + RetrieveResponse + urn:uuid:8fe86c01-56d5-4c56-8ac2-991578c79485 + urn:uuid:592f71ac-78a0-45a2-8cfe-37a91fc6cfd5 + http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous + + + 2023-02-01T10:29:21Z + 2023-02-01T10:34:21Z + + + + + + OK + a90dda5e-aeba-440a-82ce-74fb2abf5eb2 + + + + TestEmailAddr + + + 2018-06-25T05:58:00 + 2018-06-25T05:58:00 + b3150cf0-6e78-e811-80d4-1402ec721c9a + testExistingRefresh_triggeredSend + false + testExistingRefresh_triggeredSend + WelcomeEmail + + 89348 + + + 95da425b-a06f-e611-96fe-38eaa7142c61 + testExisting_sendClassification + + + + a75d452b-7ef4-eb11-b82d-48df37d1da99 + testExisting_senderProfile_rcb + + Test + unsubscribe@emails.mcdev.accenture.com + false + Continuous + Active + + + 45226 + + + false + false + 0 + WelcomeEmail + WelcomeEmail + false + true + 0 + 0 + 4 + + + + \ No newline at end of file diff --git a/test/resources/9999999/triggeredSendDefinition/retrieve-TriggeredSendStatusINdummy,Active-response.xml b/test/resources/9999999/triggeredSendDefinition/retrieve-TriggeredSendStatusINdummy,Active-response.xml index 80b956623..a033823bc 100644 --- a/test/resources/9999999/triggeredSendDefinition/retrieve-TriggeredSendStatusINdummy,Active-response.xml +++ b/test/resources/9999999/triggeredSendDefinition/retrieve-TriggeredSendStatusINdummy,Active-response.xml @@ -113,6 +113,52 @@ 0 4 + + + + TestEmailAddr + + + 2018-06-25T05:58:00 + 2018-06-25T05:58:00 + b3150cf0-6e78-e811-80d4-1402ec721c9a + testExistingRefresh_triggeredSend + false + testExistingRefresh_triggeredSend + WelcomeEmail + + 89348 + + + 95da425b-a06f-e611-96fe-38eaa7142c61 + testExisting_sendClassification + + + + a75d452b-7ef4-eb11-b82d-48df37d1da99 + testExisting_senderProfile_rcb + + Test + unsubscribe@emails.mcdev.accenture.com + false + Continuous + Active + + + 45226 + + + false + false + 0 + WelcomeEmail + WelcomeEmail + false + true + 0 + 0 + 4 + - + \ No newline at end of file diff --git a/test/type.asset.test.js b/test/type.asset.test.js index aeeb133dc..ea1b32840 100644 --- a/test/type.asset.test.js +++ b/test/type.asset.test.js @@ -825,6 +825,32 @@ describe('type: asset', () => { ); return; }); + + it('Should update an asset-block and refresh triggeredSends related to emails containing the block', async () => { + handler.setOptions({ refresh: true }); + // WHEN + const deployResult = await handler.deploy( + 'testInstance/testBU', + ['asset'], + ['testExisting_block_refresh'] + ); + // THEN + assert.equal(process.exitCode, 0, 'deploy should not have thrown an error'); + // check how many items were deployed + assert.equal( + deployResult['testInstance/testBU']?.asset + ? Object.keys(deployResult['testInstance/testBU']?.asset).length + : 0, + 1, + 'Unexpected number of assets deployed' + ); + assert.equal( + testUtils.getAPIHistoryLength(), + 22, + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + ); + return; + }); }); describe('Templating ================', () => { diff --git a/test/type.journey.test.js b/test/type.journey.test.js index 5632568f7..7f030b661 100644 --- a/test/type.journey.test.js +++ b/test/type.journey.test.js @@ -105,7 +105,7 @@ describe('type: journey', () => { const result = cache.getCache(); assert.equal( result.journey ? Object.keys(result.journey).length : 0, - 1, + 2, 'unexpected number of journeys' ); assert.deepEqual( @@ -115,7 +115,7 @@ describe('type: journey', () => { ); assert.equal( testUtils.getAPIHistoryLength(), - 24, + 25, '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 fd3b2e7c5..6cb584d72 100644 --- a/test/type.triggeredSend.test.js +++ b/test/type.triggeredSend.test.js @@ -221,13 +221,17 @@ describe('type: triggeredSend', () => { assert.deepEqual( replace['testInstance/testBU'].triggeredSend, - ['testExisting_triggeredSend', 'testExisting_triggeredSend_rcb'], + [ + 'testExisting_triggeredSend', + 'testExisting_triggeredSend_rcb', + 'testExistingRefresh_triggeredSend', + ], 'should have found the right triggeredSends that need updating' ); assert.equal( testUtils.getAPIHistoryLength(), - 15, + 18, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return;