diff --git a/@types/lib/metadataTypes/Journey.d.ts b/@types/lib/metadataTypes/Journey.d.ts index 5b9dd9719..812be64e3 100644 --- a/@types/lib/metadataTypes/Journey.d.ts +++ b/@types/lib/metadataTypes/Journey.d.ts @@ -9,6 +9,7 @@ export type MetadataTypeMap = import("../../types/mcdev.d.js").MetadataTypeMap; export type MetadataTypeMapObj = import("../../types/mcdev.d.js").MetadataTypeMapObj; export type SoapRequestParams = import("../../types/mcdev.d.js").SoapRequestParams; export type TemplateMap = import("../../types/mcdev.d.js").TemplateMap; +export type TypeKeyCombo = import("../../types/mcdev.d.js").TypeKeyCombo; /** * @typedef {import('../../types/mcdev.d.js').BuObject} BuObject * @typedef {import('../../types/mcdev.d.js').CodeExtract} CodeExtract @@ -20,6 +21,7 @@ export type TemplateMap = import("../../types/mcdev.d.js").TemplateMap; * @typedef {import('../../types/mcdev.d.js').MetadataTypeMapObj} MetadataTypeMapObj * @typedef {import('../../types/mcdev.d.js').SoapRequestParams} SoapRequestParams * @typedef {import('../../types/mcdev.d.js').TemplateMap} TemplateMap + * @typedef {import('../../types/mcdev.d.js').TypeKeyCombo} TypeKeyCombo */ /** * Journey MetadataType @@ -100,9 +102,10 @@ declare class Journey extends MetadataType { * a function to publish the journey via API * * @param {string[]} keyArr keys or ids of the metadata + * @param {MetadataTypeMap} [upsertResults] metadata mapped by their keyField as returned by update/create * @returns {Promise.} Returns list of updated keys/ids that were published. Success could only be seen with a delay in the UI because the publish-endpoint is async */ - static publish(keyArr: string[]): Promise; + static publish(keyArr: string[], upsertResults?: MetadataTypeMap): Promise; /** * helper for {@link Journey.publish} and {@link Journey.validate} * diff --git a/@types/lib/metadataTypes/Journey.d.ts.map b/@types/lib/metadataTypes/Journey.d.ts.map index fdb58ff7f..410544424 100644 --- a/@types/lib/metadataTypes/Journey.d.ts.map +++ b/@types/lib/metadataTypes/Journey.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Journey.d.ts","sourceRoot":"","sources":["../../../lib/metadataTypes/Journey.js"],"names":[],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"Journey.d.ts","sourceRoot":"","sources":["../../../lib/metadataTypes/Journey.js"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index 8de2fa76c..74f261318 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -23,6 +23,7 @@ import yoctoSpinner from 'yocto-spinner'; * @typedef {import('../../types/mcdev.d.js').MetadataTypeMapObj} MetadataTypeMapObj * @typedef {import('../../types/mcdev.d.js').SoapRequestParams} SoapRequestParams * @typedef {import('../../types/mcdev.d.js').TemplateMap} TemplateMap + * @typedef {import('../../types/mcdev.d.js').TypeKeyCombo} TypeKeyCombo */ /** @@ -1863,7 +1864,7 @@ class Journey extends MetadataType { const idArr = Object.values(upsertResults).map( (item) => 'id:' + item.id + '/' + item.version ); - await this.publish(idArr); + await this.publish(idArr, upsertResults); } else if (Util.OPTIONS.validate) { Util.logger.info(`Validating: ${this.definition.type}`); // pubslih @@ -1883,15 +1884,18 @@ class Journey extends MetadataType { * a function to publish the journey via API * * @param {string[]} keyArr keys or ids of the metadata + * @param {MetadataTypeMap} [upsertResults] metadata mapped by their keyField as returned by update/create * @returns {Promise.} Returns list of updated keys/ids that were published. Success could only be seen with a delay in the UI because the publish-endpoint is async */ - static async publish(keyArr) { + static async publish(keyArr, upsertResults) { const resultsTransactional = []; // works only with objectId const statusUrls = []; const executedKeyArr = []; const refreshTransactionalKeys = []; - const metadataMap = await this.retrieveForCache(); + const metadataMap = upsertResults + ? { metadata: upsertResults } + : await this.retrieveForCache(); const spinnerTransactional = yoctoSpinner({ text: `Publishing transactional journey…`, }); @@ -1994,7 +1998,7 @@ class Journey extends MetadataType { statusUrls.push({ key, statusUrl: response.statusUrl }); } spinnerTransactional.start(); - return key; + return journey[this.definition.keyField]; } catch (ex) { spinnerTransactional.stop(); if ( @@ -2043,6 +2047,11 @@ class Journey extends MetadataType { } else { throw new Error(response); } + if (Util.OPTIONS.skipStatusCheck) { + Util.logger.warn( + ` - Skipping status check for publishing journey ${key} due to --skipStatusCheck flag` + ); + } if (!Util.OPTIONS.skipStatusCheck && statusUrl) { const spinner = yoctoSpinner({ text: `Publishing journey…`, @@ -2101,6 +2110,10 @@ class Journey extends MetadataType { } } // for loop + const publishedJourneyCounter = { + multiStep: executedKeyArr.filter(Boolean).length, + transactional: 0, + }; // Transactional Send Journeys if (resultsTransactional.length) { const transactionalKeyArr = (await Promise.all(resultsTransactional)).filter(Boolean); @@ -2109,55 +2122,79 @@ class Journey extends MetadataType { // if all publish actions failed, we don't need to re-retrieve anything here if (transactionalKeyArr.length) { executedKeyArr.push(...transactionalKeyArr); - + publishedJourneyCounter.transactional = transactionalKeyArr.length; // reset transactionalEmail cache to trigger re-caching it. cache.clearCache(this.buObject.mid, 'transactionalEmail'); + } + } - Util.logger.info('Retrieving relevant journeys'); - const retriever = new Retriever(this.properties, this.buObject); - - try { - const updatedJourneyRetrieve = await retriever.retrieve( - ['journey'], - transactionalKeyArr - ); + // reload published non-transactional journeys including their events + if (executedKeyArr.filter(Boolean).length) { + Util.logger.info('Re-retrieving published journeys'); + const retriever = new Retriever(this.properties, this.buObject); + try { + // we need to retrieve the updated journeys and all dependencies + const updatedJourneyRetrieve = await retriever.retrieve( + ['journey'], + executedKeyArr.filter(Boolean) + ); - /** @type {MetadataTypeItem[]} */ - const updatedJourneys = - updatedJourneyRetrieve?.journey?.length > 1 - ? Object.values( - updatedJourneyRetrieve?.journey.reduce( - (previousValue, currentValue) => - Object.assign(previousValue, currentValue), - {} - ) + /** @type {MetadataTypeItem[]} */ + const updatedJourneys = + updatedJourneyRetrieve?.journey?.length > 1 + ? Object.values( + updatedJourneyRetrieve?.journey.reduce( + (previousValue, currentValue) => + Object.assign(previousValue, currentValue), + {} ) - : Object.values(updatedJourneyRetrieve?.journey[0]); - if (updatedJourneys) { - const updatedTransactionalEmails = []; - for (const journey of updatedJourneys) { - updatedTransactionalEmails.push( - journey.activities?.[0]?.configurationArguments - ?.r__transactionalEmail_key - ); - } - if (updatedTransactionalEmails.filter(Boolean).length) { - Util.logger.info('Retrieving relevant transactionalEmails'); - await retriever.retrieve( - ['transactionalEmail'], - updatedTransactionalEmails.filter(Boolean) - ); - } else { - Util.logger.error( - `Could not find transactional Emails for the published journeys` - ); - } + ) + : Object.values(updatedJourneyRetrieve?.journey[0]); + + if (updatedJourneys) { + // regardless of upsert vs publish-only mode, we need to retrieve the events/transactionalEmail and their dependencies + const updatedEvents = []; + const updatedTransactionalEmails = []; + for (const journey of updatedJourneys) { + // multi-step journeys + updatedEvents.push(journey.triggers?.[0]?.metaData?.r__event_key); + // transactional-send journeys + updatedTransactionalEmails.push( + journey.activities?.[0]?.configurationArguments + ?.r__transactionalEmail_key + ); + } + /** @type {TypeKeyCombo} */ + const eventTransEmailCombo = {}; + if (updatedEvents.filter(Boolean).length) { + eventTransEmailCombo.event = updatedEvents.filter(Boolean); + } else if (publishedJourneyCounter.multiStep) { + Util.logger.error(`Could not find events for the published journeys`); + } + if (updatedTransactionalEmails.filter(Boolean).length) { + eventTransEmailCombo.transactionalEmail = + updatedTransactionalEmails.filter(Boolean); + Util.logger.info('Retrieving relevant transactionalEmails'); + } else if (publishedJourneyCounter.transactional) { + Util.logger.error( + `Could not find transactional Emails for the published journeys` + ); + } + + const toBeRetrievedTypes = Object.keys(eventTransEmailCombo); + if (toBeRetrievedTypes.length) { + Util.logger.info( + 'Retrieving relevant ' + + toBeRetrievedTypes.map((item) => item + 's').join(', ') + ); + await retriever.retrieve(toBeRetrievedTypes, eventTransEmailCombo); } - } catch (ex) { - Util.logger.errorStack(ex, 'retrieve failed'); } + } catch (ex) { + Util.logger.errorStack(ex, 'retrieve failed'); } } + Util.logger.info( `Published ${executedKeyArr.filter(Boolean).length} of ${keyArr.length} items` ); diff --git a/test/mockRoot/deploy/testInstance/testBU/journey/testExisting_journey_Multistep.journey-meta.json b/test/mockRoot/deploy/testInstance/testBU/journey/testExisting_journey_Multistep.journey-meta.json new file mode 100644 index 000000000..e12c3fa55 --- /dev/null +++ b/test/mockRoot/deploy/testInstance/testBU/journey/testExisting_journey_Multistep.journey-meta.json @@ -0,0 +1,418 @@ +{ + "key": "testExisting_journey_Multistep", + "name": "testExisting_journey_Multistep", + "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": "my custom activity name", + "description": "", + "type": "EMAILV2", + "outcomes": [ + { + "key": "ff60a294-3804-4165-85cd-c7c19c8e3a6d", + "next": "WAITBYDURATION-1", + "arguments": {}, + "metaData": { "invalid": false } + } + ], + "arguments": {}, + "configurationArguments": { + "applicationExtensionKey": "jb-email-activity", + "isModified": true, + "googleAnalyticsCampaignName": "", + "r__triggeredSend_key": "testExisting_triggeredSend", + "triggeredSend": { + "autoAddSubscribers": false, + "autoUpdateSubscribers": false, + "bccEmail": [], + "ccEmail": [], + "created": { "name": "", "date": "" }, + "description": "my custom description", + "domainExclusions": [], + "dynamicEmailSubject": "You are successfully unsubscribed", + "emailSubject": "You are successfully unsubscribed", + "exclusionFilter": "", + "isSalesforceTracking": false, + "isMultipart": false, + "isSendLogging": true, + "isStoppedOnJobError": false, + "modified": { "name": "", "date": "" }, + "preHeader": "testExisting_ email preheader", + "throttleOpens": "1/1/0001 12:00:00 AM", + "throttleCloses": "1/1/0001 12:00:00 AM", + "isTrackingClicks": true, + "suppressTracking": false, + "triggeredSendStatus": "New", + "r__list_PathName": { "publicationList": "my subscribers/All Subscribers" }, + "r__deliveryProfile_key": "Default", + "r__senderProfile_key": "testExisting_senderProfile", + "r__sendClassification_key": "testExisting_sendClassification", + "c__priority": "Medium", + "r__asset_name_readOnly": "testExisting_asset_message", + "r__asset_key": "testExisting_asset_message", + "r__triggeredSend_key": "testExisting_triggeredSend" + } + }, + "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": "342dd0aa-a6be-401e-8614-3538800bfd7c", + "key": "MULTICRITERIADECISIONV2-1", + "name": "", + "description": "", + "type": "MULTICRITERIADECISION", + "outcomes": [ + { + "key": "default_path_1", + "next": "EMAILV2-1", + "arguments": {}, + "metaData": { + "label": "send message", + "skipI18n": true, + "isLabelFromConversion": false, + "criteriaDescription": "Email is not null" + } + }, + { + "key": "remainder_path", + "next": "WAITBYDURATION-2", + "arguments": {}, + "metaData": { "label": null } + } + ], + "arguments": {}, + "configurationArguments": { + "criteria": { + "default_path_1": "" + }, + "schemaVersionId": "252" + }, + "metaData": { "isConfigured": true }, + "schema": { + "arguments": { + "actualChoice": { + "dataType": "Number", + "isNullable": false, + "direction": "Out", + "readOnly": false, + "access": "Hidden" + }, + "filterResult": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": true, + "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" + } + } + } + }, + { + "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" + } + } + } + } + ], + "triggers": [ + { + "key": "TRIGGER", + "name": "TRIGGER", + "description": "", + "type": "EmailAudience", + "outcomes": [], + "arguments": {}, + "configurationArguments": {}, + "metaData": { + "r__event_key": "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": [], + "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", + "status": "Draft", + "scheduledStatus": "Draft", + "r__folder_Path": "my journeys" +} diff --git a/test/mockRoot/deploy/testInstance/testBU/journey/testExisting_temail.journey-meta.json b/test/mockRoot/deploy/testInstance/testBU/journey/testExisting_temail.journey-meta.json new file mode 100644 index 000000000..a5436a85c --- /dev/null +++ b/test/mockRoot/deploy/testInstance/testBU/journey/testExisting_temail.journey-meta.json @@ -0,0 +1,212 @@ +{ + "key": "testExisting_temail", + "name": "testExisting_temail", + "lastPublishedDate": "0001-01-01T00:00:00", + "description": "", + "version": 1, + "workflowApiVersion": 1, + "createdDate": "2022-03-24T02:20:32.74", + "modifiedDate": "2022-03-24T02:20:40.45", + "activities": [ + { + "id": "9606bcb0-9246-4610-9800-963bc77fc20a", + "key": "EMAILV2-4", + "name": "testExisting_temail", + "description": "", + "type": "EMAILV2", + "outcomes": [ + { + "key": "1f44021a-74ac-49be-a07c-67862228214d", + "arguments": {}, + "metaData": { "invalid": false } + } + ], + "arguments": {}, + "configurationArguments": { + "applicationExtensionKey": "jb-email-activity", + "isModified": true, + "triggeredSend": { + "autoAddSubscribers": true, + "autoUpdateSubscribers": true, + "bccEmail": [], + "ccEmail": [], + "created": {}, + "domainExclusions": [], + "dynamicEmailSubject": "test email", + "emailSubject": "test email", + "exclusionFilter": "", + "isSalesforceTracking": true, + "isMultipart": true, + "isSendLogging": false, + "isStoppedOnJobError": false, + "modified": {}, + "preHeader": "", + "throttleOpens": "1/1/0001 12:00:00 AM", + "throttleCloses": "1/1/0001 12:00:00 AM", + "isTrackingClicks": true, + "r__list_PathName": { "publicationList": "my subscribers/All Subscribers" }, + "r__deliveryProfile_key": "Default", + "r__senderProfile_key": "Default", + "r__sendClassification_key": "Default Transactional", + "c__priority": "Medium", + "r__asset_name_readOnly": "testExisting_asset_message", + "r__asset_key": "testExisting_asset_message" + }, + "r__transactionalEmail_key": "testExisting_temail" + }, + "metaData": { + "highThroughput": { "r__dataExtension_key": "testExisting_dataExtension" }, + "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" + } + } + } + } + ], + "triggers": [ + { + "key": "TRIGGER", + "name": "TRIGGER", + "description": "", + "type": "transactional-api", + "outcomes": [], + "arguments": {}, + "configurationArguments": {}, + "metaData": { + "chainType": "none", + "configurationRequired": false, + "iconUrl": "/images/icon_journeyBuilder-event-transactional-blue.svg", + "title": "Transactional API Event", + "category": "Transactional", + "entrySourceGroupConfigUrl": "null" + } + } + ], + "goals": [], + "exits": [], + "notifiers": [], + "entryMode": "MultipleEntries", + "definitionType": "Transactional", + "channel": "email", + "defaults": { + "properties": { + "analyticsTracking": { + "enabled": false, + "analyticsType": "google", + "urlDomainsToTrack": [] + } + } + }, + "metaData": {}, + "executionMode": "Production", + "status": "Published", + "scheduledStatus": "Draft", + "r__folder_Path": "my journeys" +} diff --git a/test/mockRoot/deploy/testInstance/testBU/journey/testExisting_temail_notPublished.journey-meta.json b/test/mockRoot/deploy/testInstance/testBU/journey/testExisting_temail_notPublished.journey-meta.json new file mode 100644 index 000000000..26357c013 --- /dev/null +++ b/test/mockRoot/deploy/testInstance/testBU/journey/testExisting_temail_notPublished.journey-meta.json @@ -0,0 +1,217 @@ +{ + "activities": [ + { + "arguments": {}, + "configurationArguments": { + "applicationExtensionKey": "jb-email-activity", + "isModified": true, + "r__transactionalEmail_key": "testExisting_temail_notPublished", + "triggeredSend": { + "autoAddSubscribers": true, + "autoUpdateSubscribers": true, + "bccEmail": [], + "c__priority": "Medium", + "ccEmail": [], + "created": {}, + "domainExclusions": [], + "dynamicEmailSubject": "%%=treatascontent(@subject)=%%", + "emailSubject": "%%=treatascontent(@subject)=%%", + "exclusionFilter": "", + "isMultipart": true, + "isSalesforceTracking": true, + "isSendLogging": false, + "isStoppedOnJobError": false, + "isTrackingClicks": true, + "modified": {}, + "preHeader": "%%=treatascontent(@preheader)=%%\n", + "r__asset_key": "testExisting_asset_message", + "r__asset_name_readOnly": "testExisting_asset_message", + "r__deliveryProfile_key": "Default", + "r__list_PathName": { + "publicationList": "my subscribers/All Subscribers" + }, + "r__sendClassification_key": "Default Transactional", + "r__senderProfile_key": "Default", + "throttleCloses": "1/1/0001 12:00:00 AM", + "throttleOpens": "1/1/0001 12:00:00 AM" + } + }, + "description": "", + "id": "4ae63473-ea1e-4963-a257-6fea45a9038a", + "key": "EMAILV2-3", + "metaData": { + "highThroughput": { + "r__dataExtension_key": "testExisting_temail_notPublished" + }, + "isConfigured": true, + "sections": {} + }, + "name": "my email activity", + "outcomes": [ + { + "arguments": {}, + "key": "067f20ba-af36-4401-99d8-934100e1935d", + "metaData": { + "invalid": false + } + } + ], + "schema": { + "arguments": { + "activityId": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": false + }, + "contactId": { + "access": "Hidden", + "dataType": "Number", + "direction": "In", + "isNullable": true, + "readOnly": false + }, + "contactKey": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": false, + "readOnly": false + }, + "customObjectKey": { + "access": "Hidden", + "dataType": "LongNumber", + "direction": "In", + "isNullable": true, + "readOnly": true + }, + "definitionId": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": true + }, + "definitionInstanceId": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": false, + "readOnly": false + }, + "emailAddress": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": false, + "readOnly": false + }, + "emailSubjectDataBound": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": true + }, + "eventData": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": false + }, + "fieldType": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": false + }, + "messageKey": { + "access": "Hidden", + "dataType": "Text", + "direction": "Out", + "isNullable": true, + "readOnly": false + }, + "obfuscationProperties": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": false + }, + "requestID": { + "access": "Hidden", + "dataType": "Text", + "direction": "Out", + "isNullable": true, + "readOnly": false + }, + "sourceCustomObjectId": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": false + }, + "sourceCustomObjectKey": { + "access": "Hidden", + "dataType": "LongNumber", + "direction": "In", + "isNullable": true, + "readOnly": false + } + } + }, + "type": "EMAILV2" + } + ], + "channel": "email", + "createdDate": "2024-08-23T01:29:33.233", + "defaults": { + "properties": {} + }, + "definitionType": "Transactional", + "description": "", + "entryMode": "MultipleEntries", + "executionMode": "Production", + "exits": [], + "goals": [], + "key": "testExisting_temail_notPublished", + "lastPublishedDate": "0001-01-01T00:00:00", + "metaData": { + "dataSource": "ContactsModel", + "highThroughputSending": { + "email": false + } + }, + "modifiedDate": "2024-08-23T02:00:44.57", + "name": "testExisting_temail_notPublished", + "notifiers": [], + "r__folder_Path": "my journeys", + "scheduledStatus": "Draft", + "status": "Published", + "triggers": [ + { + "arguments": {}, + "configurationArguments": {}, + "description": "", + "key": "TRIGGER", + "metaData": { + "category": "Transactional", + "chainType": "none", + "configurationRequired": false, + "entrySourceGroupConfigUrl": "null", + "iconUrl": "/images/icon_journeyBuilder-event-transactional-blue.svg", + "title": "Transactional API Event" + }, + "name": "TRIGGER", + "outcomes": [], + "type": "transactional-api" + } + ], + "version": 1, + "workflowApiVersion": 1 +} diff --git a/test/resources/9999999/event/get-published-expected.json b/test/resources/9999999/event/get-published-expected.json new file mode 100644 index 000000000..01fedc723 --- /dev/null +++ b/test/resources/9999999/event/get-published-expected.json @@ -0,0 +1,30 @@ +{ + "type": "EmailAudience", + "name": "testExisting_journey_Multistep", + "description": "", + "createdDate": "2024-05-04T05:54:44.95", + "createdBy": "Jörn Berkefeld", + "modifiedDate": "2024-05-04T05:54:44.95", + "modifiedBy": "Jörn Berkefeld", + "eventDefinitionKey": "DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e", + "sourceApplicationExtensionId": "97e942ee-6914-4d3d-9e52-37ecb71f79ed", + "filterDefinitionId": "00000000-0000-0000-0000-000000000000", + "filterDefinitionTemplate": "", + "iconUrl": "/images/icon-data-extension.svg", + "configurationArguments": {}, + "arguments": { + "serializedObjectType": 3, + "criteria": "" + }, + "metaData": { + "criteriaDescription": "", + "scheduleState": "No Schedule" + }, + "interactionCount": 1, + "isVisibleInPicker": false, + "category": "Audience", + "publishedInteractionCount": 0, + "automationId": "00000000-0000-0000-0000-000000000000", + "disableDEDataLogging": false, + "r__dataExtension_key": "testExisting_journey_Multistep" +} diff --git a/test/resources/9999999/interaction/v1/eventDefinitions/key_DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e/get-response.json b/test/resources/9999999/interaction/v1/eventDefinitions/key_DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e/get-response.json new file mode 100644 index 000000000..355c083d7 --- /dev/null +++ b/test/resources/9999999/interaction/v1/eventDefinitions/key_DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e/get-response.json @@ -0,0 +1,39 @@ +{ + "id": "649d512b-4d08-4eca-a14e-fc7b64b4ada8", + "type": "EmailAudience", + "name": "testExisting_journey_Multistep", + "description": "", + "createdDate": "2024-05-04T05:54:44.95", + "createdBy": 700301950, + "modifiedDate": "2024-05-04T05:54:44.95", + "modifiedBy": 700301950, + "mode": "Production", + "eventDefinitionKey": "DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e", + "dataExtensionId": "ed305df3-6502-ef11-a5c8-5cba2c702db8", + "dataExtensionName": "testExisting_journey_Multistep", + "sourceApplicationExtensionId": "97e942ee-6914-4d3d-9e52-37ecb71f79ed", + "filterDefinitionId": "00000000-0000-0000-0000-000000000000", + "filterDefinitionTemplate": "", + "iconUrl": "/images/icon-data-extension.svg", + "arguments": { + "serializedObjectType": 3, + "eventDefinitionId": "649d512b-4d08-4eca-a14e-fc7b64b4ada8", + "eventDefinitionKey": "DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e", + "dataExtensionId": "ed305df3-6502-ef11-a5c8-5cba2c702db8", + "criteria": "" + }, + "configurationArguments": { + "unconfigured": true + }, + "metaData": { + "criteriaDescription": "", + "scheduleState": "No Schedule" + }, + "interactionCount": 1, + "isVisibleInPicker": false, + "isPlatformObject": false, + "category": "Audience", + "publishedInteractionCount": 0, + "automationId": "00000000-0000-0000-0000-000000000000", + "disableDEDataLogging": false +} diff --git a/test/resources/9999999/interaction/v1/interactions/key_testExisting_journey_Multistep/put-response.json b/test/resources/9999999/interaction/v1/interactions/key_testExisting_journey_Multistep/put-response.json new file mode 100644 index 000000000..b3a10af04 --- /dev/null +++ b/test/resources/9999999/interaction/v1/interactions/key_testExisting_journey_Multistep/put-response.json @@ -0,0 +1,461 @@ +{ + "id": "0175b971-71a3-4d8e-98ac-48121f3fbf4f", + "key": "testExisting_journey_Multistep", + "name": "testExisting_journey_Multistep", + "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": "342dd0aa-a6be-401e-8614-3538800bfd7c", + "key": "MULTICRITERIADECISIONV2-1", + "name": "", + "description": "", + "type": "MULTICRITERIADECISION", + "outcomes": [ + { + "key": "default_path_1", + "next": "EMAILV2-1", + "arguments": {}, + "metaData": { + "label": "send message", + "skipI18n": true, + "isLabelFromConversion": false, + "criteriaDescription": "Email is not null" + } + }, + { + "key": "remainder_path", + "next": "WAITBYDURATION-2", + "arguments": {}, + "metaData": { + "label": null + } + } + ], + "arguments": {}, + "configurationArguments": { + "criteria": { + "default_path_1": "" + }, + "schemaVersionId": "252" + }, + "metaData": { + "isConfigured": true + }, + "schema": { + "arguments": { + "actualChoice": { + "dataType": "Number", + "isNullable": false, + "direction": "Out", + "readOnly": false, + "access": "Hidden" + }, + "filterResult": { + "dataType": "Text", + "isNullable": false, + "direction": "In", + "readOnly": true, + "access": "Hidden" + } + } + } + }, + { + "id": "7ba1e59a-6be4-46c7-b76f-4c06feb1268a", + "key": "EMAILV2-1", + "name": "my custom activity name", + "description": "", + "type": "EMAILV2", + "outcomes": [ + { + "key": "ff60a294-3804-4165-85cd-c7c19c8e3a6d", + "next": "WAITBYDURATION-1", + "arguments": {}, + "metaData": { + "invalid": false + } + } + ], + "arguments": {}, + "configurationArguments": { + "applicationExtensionKey": "jb-email-activity", + "isModified": true, + "googleAnalyticsCampaignName": "", + "triggeredSendId": "b3150cf0-6e78-e811-80d4-1402ec721c9d", + "triggeredSendKey": "wrong key", + "triggeredSend": { + "id": "outdated id", + "key": "outdated key", + "autoAddSubscribers": true, + "autoUpdateSubscribers": true, + "bccEmail": "", + "ccEmail": "", + "created": { + "name": "", + "date": "" + }, + "description": "my custom description", + "domainExclusions": [], + "dynamicEmailSubject": "testExisting_ email subject", + "emailId": 808714, + "emailSubject": "testExisting_ email subject", + "exclusionFilter": "", + "isSalesforceTracking": false, + "isMultipart": true, + "isSendLogging": true, + "isStoppedOnJobError": false, + "modified": { + "name": "", + "date": "" + }, + "preHeader": "testExisting_ email preheader", + "priority": 4, + "sendClassificationId": "95da425b-a06f-e611-96fe-38eaa7142c61", + "throttleOpens": "1/1/0001 12:00:00 AM", + "throttleCloses": "1/1/0001 12:00:00 AM", + "deliveryProfileId": "163f8417-13f7-e911-a2d8-1402ec938a35", + "senderProfileId": "a75d452b-7ef4-eb11-b82d-48df37d1da95", + "isTrackingClicks": true, + "publicationListId": 15 + } + }, + "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": "Draft", + "definitionId": "0175b971-71a3-4d8e-98ac-48121f3fbf4f", + "scheduledStatus": "Draft" +} diff --git a/test/resources/9999999/interaction/v1/interactions/key_testExisting_temail/put-response.json b/test/resources/9999999/interaction/v1/interactions/key_testExisting_temail/put-response.json new file mode 100644 index 000000000..8427da85d --- /dev/null +++ b/test/resources/9999999/interaction/v1/interactions/key_testExisting_temail/put-response.json @@ -0,0 +1,219 @@ +{ + "id": "dsfdsafdsa-922c-4568-85a5-e5cc77efc3be", + "key": "testExisting_temail", + "name": "testExisting_temail", + "lastPublishedDate": "0001-01-01T00:00:00", + "description": "", + "version": 1, + "workflowApiVersion": 1, + "createdDate": "2022-03-24T02:20:32.74", + "modifiedDate": "2022-03-24T02:20:40.45", + "activities": [ + { + "id": "9606bcb0-9246-4610-9800-963bc77fc20a", + "key": "EMAILV2-4", + "name": "testExisting_temail", + "description": "", + "type": "EMAILV2", + "outcomes": [ + { + "key": "1f44021a-74ac-49be-a07c-67862228214d", + "arguments": {}, + "metaData": { + "invalid": false + } + } + ], + "arguments": {}, + "configurationArguments": { + "applicationExtensionKey": "jb-email-activity", + "isModified": true, + "triggeredSend": { + "autoAddSubscribers": true, + "autoUpdateSubscribers": true, + "bccEmail": "", + "ccEmail": "", + "created": {}, + "domainExclusions": [], + "dynamicEmailSubject": "test email", + "emailId": 531213, + "emailSubject": "test email", + "exclusionFilter": "", + "isSalesforceTracking": true, + "isMultipart": true, + "isSendLogging": false, + "isStoppedOnJobError": false, + "modified": {}, + "preHeader": "", + "priority": 4, + "sendClassificationId": "95da425b-a06f-e611-96fe-38eaa7142c61", + "throttleOpens": "1/1/0001 12:00:00 AM", + "throttleCloses": "1/1/0001 12:00:00 AM", + "deliveryProfileId": "163f8417-13f7-e911-a2d8-1402ec938a35", + "senderProfileId": "a75d452b-7ef4-eb11-b82d-48df37d1da95", + "isTrackingClicks": true, + "publicationListId": 15 + }, + "triggeredSendId": "0a650d90-755e-ed11-b852-48df37d1df5b", + "triggeredSendKey": "testExisting_temail" + }, + "metaData": { + "highThroughput": { + "definitionKey": "testExisting_temail", + "dataExtensionId": "21711373-72c1-ec11-b83b-48df37d1deb7" + }, + "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" + } + } + } + } + ], + "triggers": [ + { + "key": "TRIGGER", + "name": "TRIGGER", + "description": "", + "type": "transactional-api", + "outcomes": [], + "arguments": {}, + "configurationArguments": {}, + "metaData": { + "chainType": "none", + "configurationRequired": false, + "iconUrl": "/images/icon_journeyBuilder-event-transactional-blue.svg", + "title": "Transactional API Event", + "category": "Transactional", + "entrySourceGroupConfigUrl": "null" + } + } + ], + "goals": [], + "exits": [], + "notifiers": [], + "entryMode": "MultipleEntries", + "definitionType": "Transactional", + "channel": "email", + "defaults": { + "properties": { + "analyticsTracking": { + "enabled": false, + "analyticsType": "google", + "urlDomainsToTrack": [] + } + } + }, + "metaData": {}, + "executionMode": "Production", + "categoryId": 6298, + "status": "Published", + "scheduledStatus": "Draft", + "definitionId": "dsfdsafdsa-922c-4568-85a5-e5cc77efc3be" +} diff --git a/test/resources/9999999/interaction/v1/interactions/key_testExisting_temail_notPublished/put-response.json b/test/resources/9999999/interaction/v1/interactions/key_testExisting_temail_notPublished/put-response.json new file mode 100644 index 000000000..6d57ebdd2 --- /dev/null +++ b/test/resources/9999999/interaction/v1/interactions/key_testExisting_temail_notPublished/put-response.json @@ -0,0 +1,226 @@ +{ + "id": "d4a900fe-3a8f-4cc5-9a49-81286e3e2cd2", + "key": "testExisting_temail_notPublished", + "name": "testExisting_temail_notPublished", + "lastPublishedDate": "0001-01-01T00:00:00", + "description": "", + "version": 1, + "workflowApiVersion": 1, + "createdDate": "2024-08-23T01:29:33.233", + "modifiedDate": "2024-08-23T02:00:44.57", + "activities": [ + { + "id": "4ae63473-ea1e-4963-a257-6fea45a9038a", + "key": "EMAILV2-3", + "name": "my email activity", + "description": "", + "type": "EMAILV2", + "outcomes": [ + { + "key": "067f20ba-af36-4401-99d8-934100e1935d", + "arguments": {}, + "metaData": { + "invalid": false + } + } + ], + "arguments": {}, + "configurationArguments": { + "applicationExtensionKey": "jb-email-activity", + "isModified": true, + "triggeredSend": { + "autoAddSubscribers": true, + "autoUpdateSubscribers": true, + "bccEmail": "", + "ccEmail": "", + "created": {}, + "domainExclusions": [], + "dynamicEmailSubject": "%%=treatascontent(@subject)=%%", + "emailId": 531213, + "emailSubject": "%%=treatascontent(@subject)=%%", + "exclusionFilter": "", + "isSalesforceTracking": true, + "isMultipart": true, + "isSendLogging": false, + "isStoppedOnJobError": false, + "modified": {}, + "preHeader": "%%=treatascontent(@preheader)=%%\n", + "priority": 4, + "sendClassificationId": "95da425b-a06f-e611-96fe-38eaa7142c61", + "throttleOpens": "1/1/0001 12:00:00 AM", + "throttleCloses": "1/1/0001 12:00:00 AM", + "deliveryProfileId": "163f8417-13f7-e911-a2d8-1402ec938a35", + "senderProfileId": "a75d452b-7ef4-eb11-b82d-48df37d1da95", + "isTrackingClicks": true, + "publicationListId": 15 + }, + "triggeredSendId": "6a2f70c5-2561-ef11-b876-f40343c95928", + "triggeredSendKey": "testExisting_temail_notPublished" + }, + "metaData": { + "highThroughput": { + "definitionKey": "testExisting_temail_notPublished", + "dataExtensionId": "3c3a54a5-d55f-ef11-b876-f40343c95928" + }, + "isConfigured": true, + "sections": {} + }, + "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" + } + } + } + } + ], + "triggers": [ + { + "id": "64a93832-fd23-487e-b585-8f3af3b5b6eb", + "key": "TRIGGER", + "name": "TRIGGER", + "description": "", + "type": "transactional-api", + "outcomes": [], + "arguments": {}, + "configurationArguments": {}, + "metaData": { + "chainType": "none", + "configurationRequired": false, + "iconUrl": "/images/icon_journeyBuilder-event-transactional-blue.svg", + "title": "Transactional API Event", + "category": "Transactional", + "entrySourceGroupConfigUrl": "null" + } + } + ], + "goals": [], + "exits": [], + "notifiers": [], + "stats": { + "currentPopulation": 0, + "cumulativePopulation": 0, + "metGoal": 0, + "metExitCriteria": 0, + "goalPerformance": 0 + }, + "entryMode": "MultipleEntries", + "definitionType": "Transactional", + "channel": "email", + "defaults": { + "properties": {} + }, + "metaData": { + "dataSource": "ContactsModel", + "highThroughputSending": { + "email": false + } + }, + "executionMode": "Production", + "categoryId": 6298, + "status": "Draft", + "definitionId": "d4a900fe-3a8f-4cc5-9a49-81286e3e2cd2", + "scheduledStatus": "Draft" +} diff --git a/test/resources/9999999/journey/get-published-expected.json b/test/resources/9999999/journey/get-published-expected.json new file mode 100644 index 000000000..26357c013 --- /dev/null +++ b/test/resources/9999999/journey/get-published-expected.json @@ -0,0 +1,217 @@ +{ + "activities": [ + { + "arguments": {}, + "configurationArguments": { + "applicationExtensionKey": "jb-email-activity", + "isModified": true, + "r__transactionalEmail_key": "testExisting_temail_notPublished", + "triggeredSend": { + "autoAddSubscribers": true, + "autoUpdateSubscribers": true, + "bccEmail": [], + "c__priority": "Medium", + "ccEmail": [], + "created": {}, + "domainExclusions": [], + "dynamicEmailSubject": "%%=treatascontent(@subject)=%%", + "emailSubject": "%%=treatascontent(@subject)=%%", + "exclusionFilter": "", + "isMultipart": true, + "isSalesforceTracking": true, + "isSendLogging": false, + "isStoppedOnJobError": false, + "isTrackingClicks": true, + "modified": {}, + "preHeader": "%%=treatascontent(@preheader)=%%\n", + "r__asset_key": "testExisting_asset_message", + "r__asset_name_readOnly": "testExisting_asset_message", + "r__deliveryProfile_key": "Default", + "r__list_PathName": { + "publicationList": "my subscribers/All Subscribers" + }, + "r__sendClassification_key": "Default Transactional", + "r__senderProfile_key": "Default", + "throttleCloses": "1/1/0001 12:00:00 AM", + "throttleOpens": "1/1/0001 12:00:00 AM" + } + }, + "description": "", + "id": "4ae63473-ea1e-4963-a257-6fea45a9038a", + "key": "EMAILV2-3", + "metaData": { + "highThroughput": { + "r__dataExtension_key": "testExisting_temail_notPublished" + }, + "isConfigured": true, + "sections": {} + }, + "name": "my email activity", + "outcomes": [ + { + "arguments": {}, + "key": "067f20ba-af36-4401-99d8-934100e1935d", + "metaData": { + "invalid": false + } + } + ], + "schema": { + "arguments": { + "activityId": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": false + }, + "contactId": { + "access": "Hidden", + "dataType": "Number", + "direction": "In", + "isNullable": true, + "readOnly": false + }, + "contactKey": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": false, + "readOnly": false + }, + "customObjectKey": { + "access": "Hidden", + "dataType": "LongNumber", + "direction": "In", + "isNullable": true, + "readOnly": true + }, + "definitionId": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": true + }, + "definitionInstanceId": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": false, + "readOnly": false + }, + "emailAddress": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": false, + "readOnly": false + }, + "emailSubjectDataBound": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": true + }, + "eventData": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": false + }, + "fieldType": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": false + }, + "messageKey": { + "access": "Hidden", + "dataType": "Text", + "direction": "Out", + "isNullable": true, + "readOnly": false + }, + "obfuscationProperties": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": false + }, + "requestID": { + "access": "Hidden", + "dataType": "Text", + "direction": "Out", + "isNullable": true, + "readOnly": false + }, + "sourceCustomObjectId": { + "access": "Hidden", + "dataType": "Text", + "direction": "In", + "isNullable": true, + "readOnly": false + }, + "sourceCustomObjectKey": { + "access": "Hidden", + "dataType": "LongNumber", + "direction": "In", + "isNullable": true, + "readOnly": false + } + } + }, + "type": "EMAILV2" + } + ], + "channel": "email", + "createdDate": "2024-08-23T01:29:33.233", + "defaults": { + "properties": {} + }, + "definitionType": "Transactional", + "description": "", + "entryMode": "MultipleEntries", + "executionMode": "Production", + "exits": [], + "goals": [], + "key": "testExisting_temail_notPublished", + "lastPublishedDate": "0001-01-01T00:00:00", + "metaData": { + "dataSource": "ContactsModel", + "highThroughputSending": { + "email": false + } + }, + "modifiedDate": "2024-08-23T02:00:44.57", + "name": "testExisting_temail_notPublished", + "notifiers": [], + "r__folder_Path": "my journeys", + "scheduledStatus": "Draft", + "status": "Published", + "triggers": [ + { + "arguments": {}, + "configurationArguments": {}, + "description": "", + "key": "TRIGGER", + "metaData": { + "category": "Transactional", + "chainType": "none", + "configurationRequired": false, + "entrySourceGroupConfigUrl": "null", + "iconUrl": "/images/icon_journeyBuilder-event-transactional-blue.svg", + "title": "Transactional API Event" + }, + "name": "TRIGGER", + "outcomes": [], + "type": "transactional-api" + } + ], + "version": 1, + "workflowApiVersion": 1 +} diff --git a/test/type.journey.test.js b/test/type.journey.test.js index 293125d2f..0896a46af 100644 --- a/test/type.journey.test.js +++ b/test/type.journey.test.js @@ -217,6 +217,160 @@ describe('type: journey', () => { ); return; }); + + it('Should deploy --publish a transactional journey', async () => { + // WHEN + handler.setOptions({ skipStatusCheck: true, publish: true }); + const deploy = await handler.deploy( + 'testInstance/testBU', + ['journey'], + ['testExisting_temail_notPublished'] + ); + + // THEN + assert.equal(process.exitCode, 0, 'deploy --publish should not have thrown an error'); + // retrieve result + assert.deepEqual( + Object.keys(deploy['testInstance/testBU']?.journey), + ['testExisting_temail_notPublished'], + 'should have published the right journey' + ); + + // get callouts + const publishCallout = testUtils.getRestCallout( + 'post', + '/interaction/v1/interactions/transactional/create' + ); + // confirm callouts + assert.deepEqual( + publishCallout, + { + definitionId: 'd4a900fe-3a8f-4cc5-9a49-81286e3e2cd2', + }, + 'publish-payload JSON was not equal expected' + ); + + // confirm transactionalEmail was downloaded + assert.deepEqual( + await testUtils.getActualJson( + 'testExisting_temail_notPublished', + 'transactionalEmail' + ), + await testUtils.getExpectedJson('9999999', 'transactionalEmail', 'get-published'), + 'returned JSON was not equal expected' + ); + + assert.equal( + testUtils.getAPIHistoryLength(), + 57, + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + ); + return; + }); + + it('Should deploy --publish an already published transactional journey and refresh it', async () => { + // WHEN + handler.setOptions({ skipStatusCheck: true, publish: true }); + const deploy = await handler.deploy( + 'testInstance/testBU', + ['journey'], + ['testExisting_temail'] + ); + + // THEN + assert.equal(process.exitCode, 0, 'deploy --publish should not have thrown an error'); + // retrieve result + assert.deepEqual( + Object.keys(deploy['testInstance/testBU']?.journey), + ['testExisting_temail'], + 'should have published the right journey' + ); + + // get callouts + const pauseCallout = testUtils.getRestCallout( + 'post', + '/interaction/v1/interactions/transactional/pause' + ); + const resumeCallout = testUtils.getRestCallout( + 'post', + '/interaction/v1/interactions/transactional/pause' + ); + // confirm callouts + assert.deepEqual( + pauseCallout, + { + definitionId: 'dsfdsafdsa-922c-4568-85a5-e5cc77efc3be', + }, + 'pause-payload JSON was not equal expected' + ); + assert.deepEqual( + resumeCallout, + { + definitionId: 'dsfdsafdsa-922c-4568-85a5-e5cc77efc3be', + }, + 'resume-payload JSON was not equal expected' + ); + + // confirm transactionalEmail was downloaded + // assert.deepEqual( + // await testUtils.getActualJson('testExisting_temail', 'transactionalEmail'), + // await testUtils.getExpectedJson('9999999', 'transactionalEmail', 'get'), + // 'returned JSON was not equal expected' + // ); + + assert.equal( + testUtils.getAPIHistoryLength(), + 26, + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + ); + return; + }); + + it('Should deploy --publish a journey by key (auto-picks latest version)', async () => { + handler.setOptions({ skipStatusCheck: true, publish: true }); + // WHEN + const deploy = await handler.deploy( + 'testInstance/testBU', + ['journey'], + ['testExisting_journey_Multistep'] + ); + // THEN + assert.equal(process.exitCode, 0, 'publish should not have thrown an error'); + // retrieve result + assert.deepEqual( + Object.keys(deploy['testInstance/testBU']?.journey), + ['testExisting_journey_Multistep'], + 'should have published the right journey' + ); + + // get callouts + const publishCallout = testUtils.getRestCallout( + 'post', + '/interaction/v1/interactions/publishAsync/%' + ); + // confirm created item + assert.deepEqual( + publishCallout, + await testUtils.getExpectedJson('9999999', 'journey', 'publish-callout'), + 'publish-payload JSON was not equal expected' + ); + // confirm event was downloaded + assert.deepEqual( + await testUtils.getActualJson( + 'DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e', + 'event' + ), + await testUtils.getExpectedJson('9999999', 'event', 'get-published'), + 'returned JSON was not equal expected' + ); + + assert.equal( + testUtils.getAPIHistoryLength(), + 50, + 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' + ); + return; + }); }); describe('Templating ================', () => { @@ -603,6 +757,11 @@ describe('type: journey', () => { }, 'publish-payload JSON was not equal expected' ); + assert.deepEqual( + await testUtils.getActualJson('testExisting_temail_notPublished', 'journey'), + await testUtils.getExpectedJson('9999999', 'journey', 'get-published'), + 'returned JSON was not equal expected' + ); // confirm transactionalEmail was downloaded assert.deepEqual( @@ -650,10 +809,19 @@ describe('type: journey', () => { await testUtils.getExpectedJson('9999999', 'journey', 'publish-callout'), 'publish-payload JSON was not equal expected' ); + // confirm event was downloaded + assert.deepEqual( + await testUtils.getActualJson( + 'DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e', + 'event' + ), + await testUtils.getExpectedJson('9999999', 'event', 'get-published'), + 'returned JSON was not equal expected' + ); assert.equal( testUtils.getAPIHistoryLength(), - 2, + 31, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -687,9 +855,18 @@ describe('type: journey', () => { await testUtils.getExpectedJson('9999999', 'journey', 'publish-callout'), 'publish-payload JSON was not equal expected' ); + // confirm event was downloaded + assert.deepEqual( + await testUtils.getActualJson( + 'DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e', + 'event' + ), + await testUtils.getExpectedJson('9999999', 'event', 'get-published'), + 'returned JSON was not equal expected' + ); assert.equal( testUtils.getAPIHistoryLength(), - 2, + 31, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -726,7 +903,7 @@ describe('type: journey', () => { assert.equal( testUtils.getAPIHistoryLength(), - 2, + 31, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -807,10 +984,19 @@ describe('type: journey', () => { await testUtils.getExpectedJson('9999999', 'journey', 'publish-callout'), 'publish-payload JSON was not equal expected' ); + // confirm event was downloaded + assert.deepEqual( + await testUtils.getActualJson( + 'DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e', + 'event' + ), + await testUtils.getExpectedJson('9999999', 'event', 'get-published'), + 'returned JSON was not equal expected' + ); assert.equal( testUtils.getAPIHistoryLength(), - 3, + 32, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return; @@ -849,10 +1035,19 @@ describe('type: journey', () => { await testUtils.getExpectedJson('9999999', 'journey', 'publish-callout'), 'publish-payload JSON was not equal expected' ); + // confirm event was downloaded + assert.deepEqual( + await testUtils.getActualJson( + 'DEAudience-2e3c73b6-48cc-2ec0-5522-48636e1a236e', + 'event' + ), + await testUtils.getExpectedJson('9999999', 'event', 'get-published'), + 'returned JSON was not equal expected' + ); assert.equal( testUtils.getAPIHistoryLength(), - 3, + 32, 'Unexpected number of requests made. Run testUtils.logAPIHistoryDebug() to see the requests' ); return;