From 2fc57dcb506e623e17ceee70717444af73d05e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 29 Aug 2024 18:07:53 +0200 Subject: [PATCH 01/14] #1627: run publish journey action sequentially for multi-step journeys to fix race condition for sf-journeys --- @types/lib/metadataTypes/Journey.d.ts.map | 2 +- lib/metadataTypes/Journey.js | 98 ++++++++++------------- 2 files changed, 45 insertions(+), 55 deletions(-) diff --git a/@types/lib/metadataTypes/Journey.d.ts.map b/@types/lib/metadataTypes/Journey.d.ts.map index 93314f462..de995b816 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":";uBAaa,OAAO,wBAAwB,EAAE,QAAQ;0BACzC,OAAO,wBAAwB,EAAE,WAAW;8BAC5C,OAAO,wBAAwB,EAAE,eAAe;+BAChD,OAAO,wBAAwB,EAAE,gBAAgB;mCACjD,OAAO,wBAAwB,EAAE,oBAAoB;kCACrD,OAAO,wBAAwB,EAAE,mBAAmB;8BACpD,OAAO,wBAAwB,EAAE,eAAe;iCAChD,OAAO,wBAAwB,EAAE,kBAAkB;gCACnD,OAAO,wBAAwB,EAAE,iBAAiB;0BAClD,OAAO,wBAAwB,EAAE,WAAW;AAVzD;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AACH;IACI;;;;;;;;OAQG;IACH,6BANW,MAAM,MACN,IAAI,GAAG,MAAM,EAAE,OACf,IAAI,GAAG,MAAM,EAAE,QACf,MAAM,GACJ,OAAO,CAAE,kBAAkB,CAAC,CA8JxC;IAmFD;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAS1B;IAED;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAK1B;IAmBD;;;;OAIG;IACH,2CAFW,eAAe,iBAmBzB;IAED;;;;;OAKG;IACH,mCA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA55DwB,mBAAmB"} \ No newline at end of file +{"version":3,"file":"Journey.d.ts","sourceRoot":"","sources":["../../../lib/metadataTypes/Journey.js"],"names":[],"mappings":";uBAaa,OAAO,wBAAwB,EAAE,QAAQ;0BACzC,OAAO,wBAAwB,EAAE,WAAW;8BAC5C,OAAO,wBAAwB,EAAE,eAAe;+BAChD,OAAO,wBAAwB,EAAE,gBAAgB;mCACjD,OAAO,wBAAwB,EAAE,oBAAoB;kCACrD,OAAO,wBAAwB,EAAE,mBAAmB;8BACpD,OAAO,wBAAwB,EAAE,eAAe;iCAChD,OAAO,wBAAwB,EAAE,kBAAkB;gCACnD,OAAO,wBAAwB,EAAE,iBAAiB;0BAClD,OAAO,wBAAwB,EAAE,WAAW;AAVzD;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AACH;IACI;;;;;;;;OAQG;IACH,6BANW,MAAM,MACN,IAAI,GAAG,MAAM,EAAE,OACf,IAAI,GAAG,MAAM,EAAE,QACf,MAAM,GACJ,OAAO,CAAE,kBAAkB,CAAC,CA8JxC;IAmFD;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAS1B;IAED;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAK1B;IAmBD;;;;OAIG;IACH,2CAFW,eAAe,iBAmBzB;IAED;;;;;OAKG;IACH,mCA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAl5DwB,mBAAmB"} \ No newline at end of file diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index d8d13474c..ec007fcc5 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -1557,7 +1557,6 @@ class Journey extends MetadataType { * @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) { - const resultsJourney = []; const resultsTransactional = []; // works only with objectId const statusUrls = []; @@ -1679,65 +1678,56 @@ class Journey extends MetadataType { ); break; } - case 'Multistep': - case 'Quicksend': { - resultsJourney.push( - (async () => { - try { - const response = await this.client.rest.post( - `/interaction/v1/interactions/publishAsync/${journey.id}?versionNumber=${version}`, - {} - ); // payload is empty for this request - if (response.statusUrl && response.statusId) { - Util.logger.info( - ` - queued for publishing ${this.definition.type}: ${key}` - ); - statusUrls.push({ key, statusUrl: response.statusUrl }); - } else { - throw new Error(response); - } - return journey.key; - } catch (ex) { - if ( - ex.message === 'Cannot publish interaction in Published status.' - ) { - Util.logger.info( - ` - ${this.definition.type} ${key} is already published` - ); - } else if ( - ex.message === 'Cannot publish interaction in Stopped status.' - ) { - Util.logger.warn( - ` - ${this.definition.type} ${key} is already published but stopped. Please resume it manually.` - ); - } else { - Util.logger.error( - `Failed to publish ${this.definition.type} ${key}: ${ex.message}` - ); - } - } - })() + case 'Multistep': { + // SF Event, Api Event Journeys + // ! for SF-triggered journeys this cannot be asynchronous or it will cause a race-condition (see #1627 for details); the requests are accepted but then processed sequentually anyways, eliminating potential speed gains. + // It is unknown if the same would happen for API-event journeys but given that it's the same endpoint, lets not risk it and run this sequentially + let statusUrl; + try { + const response = await this.client.rest.post( + `/interaction/v1/interactions/publishAsync/${journey.id}?versionNumber=${version}`, + {} + ); // payload is empty for this request + if (response.statusUrl && response.statusId) { + Util.logger.info( + ` - queued for publishing ${this.definition.type}: ${key}` + ); + statusUrl = response.statusUrl; + } else { + throw new Error(response); + } + if (!Util.OPTIONS.skipStatusCheck && statusUrl) { + Util.logger.info(`Checking status of published item`); + await Util.sleep(1000); + executedKeyArr.push(await this._checkPublishStatus(statusUrl, key)); + } + } catch (ex) { + if (ex.message === 'Cannot publish interaction in Published status.') { + Util.logger.info( + ` - ${this.definition.type} ${key} is already published` + ); + } else if (ex.message === 'Cannot publish interaction in Stopped status.') { + Util.logger.warn( + ` - ${this.definition.type} ${key} is already published but stopped. Please resume it manually.` + ); + } else { + Util.logger.error( + `Failed to publish ${this.definition.type} ${key}: ${ex.message}` + ); + } + } + break; + } + default: { + throw new Error( + `${this.definition.type} type ${journey.definitionType} not supported yet by publish method` ); } } } // for loop - if (resultsJourney.length) { - Util.logger.info(`Found ${resultsJourney.length} journey results`); - executedKeyArr.push(...(await Promise.all(resultsJourney)).filter(Boolean)); - if (!Util.OPTIONS.skipStatusCheck && statusUrls.length) { - Util.logger.info( - `Checking status of ${statusUrls.length} published item${statusUrls.length === 1 ? '' : 's'}` - ); - executedKeyArr.length = 0; - await Util.sleep(5000); - for (const item of statusUrls) { - executedKeyArr.push(await this._checkPublishStatus(item.statusUrl, item.key)); - } - } - } + // Transactional Send Journeys if (resultsTransactional.length) { - Util.logger.info(`Found ${resultsTransactional.length} journey results`); const transactionalKeyArr = (await Promise.all(resultsTransactional)).filter(Boolean); executedKeyArr.push(...transactionalKeyArr); From bc60650eb5f432e34ea0c5ced4acd1477e6b3583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 29 Aug 2024 22:20:17 +0200 Subject: [PATCH 02/14] #1627: improve error handling for publish --- lib/metadataTypes/Journey.js | 39 +++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index ec007fcc5..27a4ba52d 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -1702,18 +1702,33 @@ class Journey extends MetadataType { executedKeyArr.push(await this._checkPublishStatus(statusUrl, key)); } } catch (ex) { - if (ex.message === 'Cannot publish interaction in Published status.') { - Util.logger.info( - ` - ${this.definition.type} ${key} is already published` - ); - } else if (ex.message === 'Cannot publish interaction in Stopped status.') { - Util.logger.warn( - ` - ${this.definition.type} ${key} is already published but stopped. Please resume it manually.` - ); - } else { - Util.logger.error( - `Failed to publish ${this.definition.type} ${key}: ${ex.message}` - ); + switch (ex.message) { + case 'Cannot publish interaction in Published status.': { + Util.logger.info( + ` - ${this.definition.type} ${key}/${version} is already published.` + ); + + break; + } + case 'Cannot publish interaction in Stopped status.': { + Util.logger.warn( + ` - ${this.definition.type} ${key}/${version} is stopped. Please create a new version and publish that.` + ); + + break; + } + case 'Cannot publish interaction in Paused status.': { + Util.logger.warn( + ` - ${this.definition.type} ${key}/${version} is already published but currently paused. Run 'mcdev resume' instead.` + ); + + break; + } + default: { + Util.logger.error( + `Failed to publish ${this.definition.type} ${key}: ${ex.message}` + ); + } } } break; From cf25fa7e338051c963023d6e8becb9892a5a960b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 29 Aug 2024 22:24:12 +0200 Subject: [PATCH 03/14] #1627: add spinner to publish journey --- lib/metadataTypes/Journey.js | 23 +++++++++++++---- package-lock.json | 50 +++++++++++++++++++++++++++--------- package.json | 3 ++- 3 files changed, 58 insertions(+), 18 deletions(-) diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index 27a4ba52d..3945f3d2a 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -9,6 +9,7 @@ import File from '../util/file.js'; import ReplaceCbReference from '../util/replaceContentBlockReference.js'; import Retriever from '../Retriever.js'; import pLimit from 'p-limit'; +import yoctoSpinner from 'yocto-spinner'; /** * @typedef {import('../../types/mcdev.d.js').BuObject} BuObject @@ -1697,9 +1698,14 @@ class Journey extends MetadataType { throw new Error(response); } if (!Util.OPTIONS.skipStatusCheck && statusUrl) { - Util.logger.info(`Checking status of published item`); + const spinner = yoctoSpinner({ + text: `Publishing journey…`, + }).start(); + await Util.sleep(1000); - executedKeyArr.push(await this._checkPublishStatus(statusUrl, key)); + executedKeyArr.push( + await this._checkPublishStatus(statusUrl, key, spinner) + ); } } catch (ex) { switch (ex.message) { @@ -1743,7 +1749,11 @@ class Journey extends MetadataType { // Transactional Send Journeys if (resultsTransactional.length) { + const spinner = yoctoSpinner({ + text: `Publishing ${resultsTransactional.length} journey${resultsTransactional.length === 1 ? '' : 's'}…`, + }).start(); const transactionalKeyArr = (await Promise.all(resultsTransactional)).filter(Boolean); + spinner.success('done.'); executedKeyArr.push(...transactionalKeyArr); Util.logger.info('Retrieving relevant journeys'); @@ -1792,30 +1802,33 @@ class Journey extends MetadataType { * * @param {string} statusUrl URL to check the status of the publish request * @param {string} key key or id for log messages + * @param {any} spinner key or id for log messages * @param {number} [tries] number of tries used to check the status * @returns {Promise.} key of the item that was published successfully */ - static async _checkPublishStatus(statusUrl, key, tries = 1) { + static async _checkPublishStatus(statusUrl, key, spinner, tries = 1) { try { const response = await this.client.rest.get(statusUrl); switch (response.status) { case 'PublishCompleted': { + spinner.success('done.'); Util.logger.info(` - ${this.definition.type} ${key}: publishing succeeded`); this._showPublishStatusDetails(response); return key; } case 'PublishInProcess': { - Util.logger.info( + Util.logger.debug( ` - ${this.definition.type} ${key}: publishing still in progress` ); if (tries < 50) { await (tries < 10 ? Util.sleep(2000) : Util.sleep(5000)); - return await this._checkPublishStatus(statusUrl, key, tries + 1); + return await this._checkPublishStatus(statusUrl, key, spinner, tries + 1); } else { return; } } case 'Error': { + spinner.success('failed.'); Util.logger.error(` - ${this.definition.type} ${key}: publishing failed.`); this._showPublishStatusDetails(response); return; diff --git a/package-lock.json b/package-lock.json index e34de7d65..0d3a68f3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,7 +28,8 @@ "toposort": "2.0.2", "update-notifier": "7.2.0", "winston": "3.14.2", - "yargs": "17.7.2" + "yargs": "17.7.2", + "yocto-spinner": "0.1.0" }, "bin": { "mcdev": "lib/cli.js" @@ -538,6 +539,17 @@ "node": ">=18" } }, + "node_modules/@inquirer/core/node_modules/cli-spinners": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@inquirer/core/node_modules/signal-exit": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", @@ -1892,17 +1904,6 @@ "node": ">=4" } }, - "node_modules/cli-spinners": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", - "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/cli-truncate": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz", @@ -7846,6 +7847,31 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/yocto-spinner": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-spinner/-/yocto-spinner-0.1.0.tgz", + "integrity": "sha512-sBra0N4uhNn5UibnOz/HJxB1a0tzZ5zXbqnDe+tfRR3BGy+BmOrzrnQCZRJI7C++JiSZaPygPeNon4QCUmMQ4g==", + "dependencies": { + "yoctocolors": "^2.1.1" + }, + "engines": { + "node": ">=18.19" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yoctocolors": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.1.tgz", + "integrity": "sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/yoctocolors-cjs": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yoctocolors-cjs/-/yoctocolors-cjs-2.1.2.tgz", diff --git a/package.json b/package.json index 0a738805f..a42740ef7 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,8 @@ "toposort": "2.0.2", "update-notifier": "7.2.0", "winston": "3.14.2", - "yargs": "17.7.2" + "yargs": "17.7.2", + "yocto-spinner": "0.1.0" }, "devDependencies": { "@eslint/js": "9.9.0", From eb093bb4ffc8a85b458dad69194d60b077d712fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 29 Aug 2024 23:01:18 +0200 Subject: [PATCH 04/14] #1627: fix publish journey tests --- @types/lib/metadataTypes/Journey.d.ts | 6 +++-- @types/lib/metadataTypes/Journey.d.ts.map | 2 +- lib/metadataTypes/Journey.js | 7 ++++-- test/general.test.js | 4 ++-- .../post-response.json | 0 test/type.journey.test.js | 22 +++++++++---------- 6 files changed, 23 insertions(+), 18 deletions(-) rename test/resources/9999999/interaction/v1/interactions/publishAsync/{3c3f4112-9b43-43ca-8a89-aa0375b2c1a2 => 0175b971-71a3-4d8e-98ac-48121f3fbf4f}/post-response.json (100%) diff --git a/@types/lib/metadataTypes/Journey.d.ts b/@types/lib/metadataTypes/Journey.d.ts index 576193f96..2e328f46f 100644 --- a/@types/lib/metadataTypes/Journey.d.ts +++ b/@types/lib/metadataTypes/Journey.d.ts @@ -94,8 +94,9 @@ declare class Journey extends MetadataType { * Gets executed after deployment of metadata type * * @param {MetadataTypeMap} upsertResults metadata mapped by their keyField as returned by update/create + * @returns {Promise.} - */ - static postDeployTasks(upsertResults: MetadataTypeMap): Promise; + static postDeployTasks(upsertResults: MetadataTypeMap): Promise; /** * a function to publish the journey via API * @@ -108,10 +109,11 @@ declare class Journey extends MetadataType { * * @param {string} statusUrl URL to check the status of the publish request * @param {string} key key or id for log messages + * @param {any} spinner key or id for log messages * @param {number} [tries] number of tries used to check the status * @returns {Promise.} key of the item that was published successfully */ - static _checkPublishStatus(statusUrl: string, key: string, tries?: number): Promise; + static _checkPublishStatus(statusUrl: string, key: string, spinner: any, tries?: number): Promise; /** * helper for {@link Journey._checkPublishStatus} * diff --git a/@types/lib/metadataTypes/Journey.d.ts.map b/@types/lib/metadataTypes/Journey.d.ts.map index de995b816..8cf4bab8d 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":";uBAaa,OAAO,wBAAwB,EAAE,QAAQ;0BACzC,OAAO,wBAAwB,EAAE,WAAW;8BAC5C,OAAO,wBAAwB,EAAE,eAAe;+BAChD,OAAO,wBAAwB,EAAE,gBAAgB;mCACjD,OAAO,wBAAwB,EAAE,oBAAoB;kCACrD,OAAO,wBAAwB,EAAE,mBAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA99DwB,mBAAmB"} \ No newline at end of file diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index 3945f3d2a..d707bbc19 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -1691,7 +1691,7 @@ class Journey extends MetadataType { ); // payload is empty for this request if (response.statusUrl && response.statusId) { Util.logger.info( - ` - queued for publishing ${this.definition.type}: ${key}` + ` - ${this.definition.type} queued for publishing : ${key}/${version}` ); statusUrl = response.statusUrl; } else { @@ -1706,6 +1706,9 @@ class Journey extends MetadataType { executedKeyArr.push( await this._checkPublishStatus(statusUrl, key, spinner) ); + } else { + // no guarantees if the journey was actually published + executedKeyArr.push(key); } } catch (ex) { switch (ex.message) { @@ -1925,7 +1928,7 @@ class Journey extends MetadataType { return stoppedKeyArr; } /** - * pauses all journey versions + * pauses selected journey versions * * @param {string[]} keyArr customerkey of the metadata * @returns {Promise.} Returns list of keys that were paused diff --git a/test/general.test.js b/test/general.test.js index 225673d2d..4c607e8d4 100644 --- a/test/general.test.js +++ b/test/general.test.js @@ -2067,7 +2067,7 @@ describe('GENERAL', () => { describe('Publish --metadata ~~~', () => { it('Should publish the journey', async () => { handler.setOptions({ skipStatusCheck: true }); - const argvMetadata = ['journey:id:3c3f4112-9b43-43ca-8a89-aa0375b2c1a2/1']; + const argvMetadata = ['journey:testExisting_journey_Multistep']; const typeKeyCombo = handler.metadataToTypeKey(argvMetadata); // WHEN const publish = await handler.publish('testInstance/testBU', typeKeyCombo); @@ -2075,7 +2075,7 @@ describe('GENERAL', () => { assert.equal(process.exitCode, 0, 'publish should not have thrown an error'); assert.deepEqual( publish['testInstance/testBU']?.journey, - ['testExisting_journey_Quicksend'], + ['testExisting_journey_Multistep'], 'should have published the right journey' ); return; diff --git a/test/resources/9999999/interaction/v1/interactions/publishAsync/3c3f4112-9b43-43ca-8a89-aa0375b2c1a2/post-response.json b/test/resources/9999999/interaction/v1/interactions/publishAsync/0175b971-71a3-4d8e-98ac-48121f3fbf4f/post-response.json similarity index 100% rename from test/resources/9999999/interaction/v1/interactions/publishAsync/3c3f4112-9b43-43ca-8a89-aa0375b2c1a2/post-response.json rename to test/resources/9999999/interaction/v1/interactions/publishAsync/0175b971-71a3-4d8e-98ac-48121f3fbf4f/post-response.json diff --git a/test/type.journey.test.js b/test/type.journey.test.js index 899076b70..b864442a3 100644 --- a/test/type.journey.test.js +++ b/test/type.journey.test.js @@ -593,14 +593,14 @@ describe('type: journey', () => { const publish = await handler.publish( 'testInstance/testBU', ['journey'], - ['testExisting_journey_Quicksend'] + ['testExisting_journey_Multistep'] ); // THEN assert.equal(process.exitCode, 0, 'publish should not have thrown an error'); // retrieve result assert.deepEqual( publish['testInstance/testBU']?.journey, - ['testExisting_journey_Quicksend'], + ['testExisting_journey_Multistep'], 'should have published the right journey' ); @@ -630,14 +630,14 @@ describe('type: journey', () => { const publish = await handler.publish( 'testInstance/testBU', ['journey'], - ['id:3c3f4112-9b43-43ca-8a89-aa0375b2c1a2/1'] + ['id:0175b971-71a3-4d8e-98ac-48121f3fbf4f/1'] ); // THEN assert.equal(process.exitCode, 0, 'publish should not have thrown an error'); // retrieve result assert.deepEqual( publish['testInstance/testBU']?.journey, - ['testExisting_journey_Quicksend'], + ['id:0175b971-71a3-4d8e-98ac-48121f3fbf4f/1'], 'should have published the right journey' ); @@ -666,14 +666,14 @@ describe('type: journey', () => { const publish = await handler.publish( 'testInstance/testBU', ['journey'], - ['id:3c3f4112-9b43-43ca-8a89-aa0375b2c1a2'] + ['id:0175b971-71a3-4d8e-98ac-48121f3fbf4f'] ); // THEN assert.equal(process.exitCode, 0, 'publish should not have thrown an error'); // retrieve result assert.deepEqual( publish['testInstance/testBU']?.journey, - ['testExisting_journey_Quicksend'], + ['id:0175b971-71a3-4d8e-98ac-48121f3fbf4f'], 'should have published the right journey' ); @@ -708,7 +708,7 @@ describe('type: journey', () => { const publish = await handler.publish( 'testInstance/testBU', ['journey'], - ['id:3c3f4112-9b43-43ca-8a89-aa0375b2c1a2/1'] + ['id:0175b971-71a3-4d8e-98ac-48121f3fbf4f/1'] ); // THEN assert.equal(process.exitCode, 1, 'publish should have thrown an error'); @@ -750,14 +750,14 @@ describe('type: journey', () => { const publish = await handler.publish( 'testInstance/testBU', ['journey'], - ['id:3c3f4112-9b43-43ca-8a89-aa0375b2c1a2/1'] + ['id:0175b971-71a3-4d8e-98ac-48121f3fbf4f/1'] ); // THEN assert.equal(process.exitCode, 0, 'publish should not have thrown an error'); // retrieve result assert.deepEqual( publish['testInstance/testBU']?.journey, - ['id:3c3f4112-9b43-43ca-8a89-aa0375b2c1a2/1'], + ['id:0175b971-71a3-4d8e-98ac-48121f3fbf4f/1'], 'should have published the journey' ); @@ -792,14 +792,14 @@ describe('type: journey', () => { const publish = await handler.publish( 'testInstance/testBU', ['journey'], - ['id:3c3f4112-9b43-43ca-8a89-aa0375b2c1a2/1'] + ['id:0175b971-71a3-4d8e-98ac-48121f3fbf4f/1'] ); // THEN assert.equal(process.exitCode, 0, 'publish should not have thrown an error'); // retrieve result assert.deepEqual( publish['testInstance/testBU']?.journey, - ['id:3c3f4112-9b43-43ca-8a89-aa0375b2c1a2/1'], + ['id:0175b971-71a3-4d8e-98ac-48121f3fbf4f/1'], 'should have published the journey' ); From d802d95b51d65d5d582ff0585c2b2be61206cdcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 29 Aug 2024 23:12:30 +0200 Subject: [PATCH 05/14] #1627: improve logs & tests --- @types/lib/metadataTypes/Journey.d.ts | 3 +-- @types/lib/metadataTypes/Journey.d.ts.map | 2 +- lib/metadataTypes/Journey.js | 4 ++-- test/general.test.js | 7 +++++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/@types/lib/metadataTypes/Journey.d.ts b/@types/lib/metadataTypes/Journey.d.ts index 2e328f46f..accda7757 100644 --- a/@types/lib/metadataTypes/Journey.d.ts +++ b/@types/lib/metadataTypes/Journey.d.ts @@ -94,9 +94,8 @@ declare class Journey extends MetadataType { * Gets executed after deployment of metadata type * * @param {MetadataTypeMap} upsertResults metadata mapped by their keyField as returned by update/create - * @returns {Promise.} - */ - static postDeployTasks(upsertResults: MetadataTypeMap): Promise; + static postDeployTasks(upsertResults: MetadataTypeMap): Promise; /** * a function to publish the journey via API * diff --git a/@types/lib/metadataTypes/Journey.d.ts.map b/@types/lib/metadataTypes/Journey.d.ts.map index 8cf4bab8d..892627aa2 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":";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;kCACrD,OAAO,wBAAwB,EAAE,mBAAmB;8BACpD,OAAO,wBAAwB,EAAE,eAAe;iCAChD,OAAO,wBAAwB,EAAE,kBAAkB;gCACnD,OAAO,wBAAwB,EAAE,iBAAiB;0BAClD,OAAO,wBAAwB,EAAE,WAAW;AAVzD;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AACH;IACI;;;;;;;;OAQG;IACH,6BANW,MAAM,MACN,IAAI,GAAG,MAAM,EAAE,OACf,IAAI,GAAG,MAAM,EAAE,QACf,MAAM,GACJ,OAAO,CAAE,kBAAkB,CAAC,CA8JxC;IAmFD;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAS1B;IAED;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAK1B;IAmBD;;;;OAIG;IACH,2CAFW,eAAe,iBAmBzB;IAED;;;;;OAKG;IACH,mCAHW,gBAAgB,GACd,OAAO,CAAE,gBAAgB,CAAC,CAsMtC;IAED;;;;;OAKG;IACH,6CA2aC;IAED;;;;;;OAMG;IACH,gCAHW,gBAAgB,GACd,OAAO,CAAE,gBAAgB,CAAC,CA+ItC;IAED;;;;;OAKG;IACH,0CA6MC;IA4LD;;;;;OAKG;IACH,sCAHW,eAAe,GACb,OAAO,CAAE,GAAG,CAAC,CAWzB;IAED;;;;;OAKG;IACH,uBAHW,MAAM,EAAE,GACN,OAAO,CAAE,MAAM,EAAE,CAAC,CAmP9B;IAED;;;;;;;;O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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA99DwB,mBAAmB"} \ No newline at end of file +{"version":3,"file":"Journey.d.ts","sourceRoot":"","sources":["../../../lib/metadataTypes/Journey.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;kCACrD,OAAO,wBAAwB,EAAE,mBAAmB;8BACpD,OAAO,wBAAwB,EAAE,eAAe;iCAChD,OAAO,wBAAwB,EAAE,kBAAkB;gCACnD,OAAO,wBAAwB,EAAE,iBAAiB;0BAClD,OAAO,wBAAwB,EAAE,WAAW;AAVzD;;;;;;;;;;;GAWG;AAEH;;;;;;;;GAQG;AACH;IACI;;;;;;;;OAQG;IACH,6BANW,MAAM,MACN,IAAI,GAAG,MAAM,EAAE,OACf,IAAI,GAAG,MAAM,EAAE,QACf,MAAM,GACJ,OAAO,CAAE,kBAAkB,CAAC,CA8JxC;IAmFD;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAS1B;IAED;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAK1B;IAmBD;;;;OAIG;IACH,2CAFW,eAAe,iBAmBzB;IAED;;;;;OAKG;IACH,mCAHW,gBAAgB,GACd,OAAO,CAAE,gBAAgB,CAAC,CAsMtC;IAED;;;;;OAKG;IACH,6CA2aC;IAED;;;;;;OAMG;IACH,gCAHW,gBAAgB,GACd,OAAO,CAAE,gBAAgB,CAAC,CA+ItC;IAED;;;;;OAKG;IACH,0CA6MC;IA4LD;;;;OAIG;IACH,sCAFW,eAAe,iBAWzB;IAED;;;;;OAKG;IACH,uBAHW,MAAM,EAAE,GACN,OAAO,CAAE,MAAM,EAAE,CAAC,CAmP9B;IAED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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA79DwB,mBAAmB"} \ No newline at end of file diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index d707bbc19..e7b5ed7c8 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -1646,7 +1646,7 @@ class Journey extends MetadataType { Util.logger.info( ` - published ${this.definition.type}: ${ journey[this.definition.nameField] - } (${journey[this.definition.keyField]} by creating the matching transactionalEmail` + } (${journey[this.definition.keyField]}) by creating the matching transactionalEmail` ); statusUrls.push({ key, statusUrl: response.statusUrl }); } @@ -1753,7 +1753,7 @@ class Journey extends MetadataType { // Transactional Send Journeys if (resultsTransactional.length) { const spinner = yoctoSpinner({ - text: `Publishing ${resultsTransactional.length} journey${resultsTransactional.length === 1 ? '' : 's'}…`, + text: `Publishing ${resultsTransactional.length} transactional journey${resultsTransactional.length === 1 ? '' : 's'}…`, }).start(); const transactionalKeyArr = (await Promise.all(resultsTransactional)).filter(Boolean); spinner.success('done.'); diff --git a/test/general.test.js b/test/general.test.js index 4c607e8d4..fa2de8fa1 100644 --- a/test/general.test.js +++ b/test/general.test.js @@ -2067,7 +2067,10 @@ describe('GENERAL', () => { describe('Publish --metadata ~~~', () => { it('Should publish the journey', async () => { handler.setOptions({ skipStatusCheck: true }); - const argvMetadata = ['journey:testExisting_journey_Multistep']; + const argvMetadata = [ + 'journey:testExisting_journey_Multistep', + 'journey:testExisting_temail_notPublished', + ]; const typeKeyCombo = handler.metadataToTypeKey(argvMetadata); // WHEN const publish = await handler.publish('testInstance/testBU', typeKeyCombo); @@ -2075,7 +2078,7 @@ describe('GENERAL', () => { assert.equal(process.exitCode, 0, 'publish should not have thrown an error'); assert.deepEqual( publish['testInstance/testBU']?.journey, - ['testExisting_journey_Multistep'], + ['testExisting_journey_Multistep', 'testExisting_temail_notPublished'], 'should have published the right journey' ); return; From ed13296e52cd71ba3abc3ea8f361ce3f3fa257e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Thu, 29 Aug 2024 23:31:31 +0200 Subject: [PATCH 06/14] #1631: ensure Common fields are tracked but originals are kept on Contact/Lead --- lib/metadataTypes/Event.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/metadataTypes/Event.js b/lib/metadataTypes/Event.js index 97260bd49..eca47d7f5 100644 --- a/lib/metadataTypes/Event.js +++ b/lib/metadataTypes/Event.js @@ -607,13 +607,12 @@ class Event extends MetadataType { leadFieldNames.includes(item) )) { // copy the value from contact - while thats not perfectly correct it will hopefully be sufficient for what we need to check - this.sfObjects.objectFields[contactLeadName][fieldName] = - this.sfObjects.objectFields['Contact'][fieldName]; + this.sfObjects.objectFields[contactLeadName][fieldName] = structuredClone( + this.sfObjects.objectFields['Contact'][fieldName] + ); this.sfObjects.objectFields[contactLeadName][fieldName].objectname = 'Common'; - // delete the field from Contact obj and from Lead obj - delete this.sfObjects.objectFields['Contact'][fieldName]; - delete this.sfObjects.objectFields['Lead'][fieldName]; + // do not delete fields from Contact or Lead because it depends on the environment where we have to look for those } // create duplicate to also reference this via "Common" this.sfObjects.objectFields['Common'] = From 94f62a69c301c9b7f6bcf4fb3c117d6067c63064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 30 Aug 2024 00:04:56 +0200 Subject: [PATCH 07/14] #1631: correct common-vs-contact logic and fix check of ca.contactKey logic --- @types/lib/metadataTypes/Event.d.ts.map | 2 +- @types/lib/metadataTypes/Journey.d.ts.map | 2 +- lib/metadataTypes/Event.js | 133 +++++++++++----------- 3 files changed, 69 insertions(+), 68 deletions(-) diff --git a/@types/lib/metadataTypes/Event.d.ts.map b/@types/lib/metadataTypes/Event.d.ts.map index 44fe4f61b..28ac17a6c 100644 --- a/@types/lib/metadataTypes/Event.d.ts.map +++ b/@types/lib/metadataTypes/Event.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Event.d.ts","sourceRoot":"","sources":["../../../lib/metadataTypes/Event.js"],"names":[],"mappings":";uBAUa,OAAO,wBAAwB,EAAE,QAAQ;0BACzC,OAAO,wBAAwB,EAAE,WAAW;8BAC5C,OAAO,wBAAwB,EAAE,eAAe;+BAChD,OAAO,wBAAwB,EAAE,gBAAgB;mCACjD,OAAO,wBAAwB,EAAE,oBAAoB;kCACrD,OAAO,wBAAwB,EAAE,mBAAmB;8BACpD,OAAO,wBAAwB,EAAE,eAAe;iCAChD,OAAO,wBAAwB,EAAE,kBAAkB;gCACnD,OAAO,wBAAwB,EAAE,iBAAiB;0BAClD,OAAO,wBAAwB,EAAE,WAAW;8BAE5C,OAAO,wBAAwB,EAAE,eAAe;4BAChD,OAAO,wBAAwB,EAAE,aAAa;AAb3D;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AACH;IACI,oCAAkC;IAElC;;;;;;;;;;OAUG;IACH,6BANW,MAAM,MACN,IAAI,GAAG,MAAM,EAAE,OACf,IAAI,GAAG,MAAM,EAAE,QACf,MAAM,GACJ,OAAO,CAAE,kBAAkB,CAAC,CAwBxC;IAED;;;;OAIG;IACH,2BAFa,OAAO,CAAE,kBAAkB,CAAC,CAIxC;IAED;;;;;;;OAOG;IACH,uCALW,MAAM,QACN,MAAM,qBACN,WAAW,GACT,OAAO,CAAE,mBAAmB,CAAC,CAiDzC;IA8BD;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAK1B;IAED;;;;;OAKG;IACH,6BAHW,gBAAgB,gBAU1B;IAED;;;;;OAKG;IACH,gCAHW,gBAAgB,GACd,OAAO,CAAE,gBAAgB,CAAC,CAmCtC;IAyLD;;;;;OAKG;IACH,mCAHW,gBAAgB,GACd,OAAO,CAAE,gBAAgB,CAAC,CA2CtC;IACD;QACI,uBAAuB;yBAAZ,MAAM,EAAE;QAEnB,2EAA2E;2BAAhE;gB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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA77BwB,mBAAmB"} \ No newline at end of file +{"version":3,"file":"Event.d.ts","sourceRoot":"","sources":["../../../lib/metadataTypes/Event.js"],"names":[],"mappings":";uBAUa,OAAO,wBAAwB,EAAE,QAAQ;0BACzC,OAAO,wBAAwB,EAAE,WAAW;8BAC5C,OAAO,wBAAwB,EAAE,eAAe;+BAChD,OAAO,wBAAwB,EAAE,gBAAgB;mCACjD,OAAO,wBAAwB,EAAE,oBAAoB;kCACrD,OAAO,wBAAwB,EAAE,mBAAmB;8BACpD,OAAO,wBAAwB,EAAE,eAAe;iCAChD,OAAO,wBAAwB,EAAE,kBAAkB;gCACnD,OAAO,wBAAwB,EAAE,iBAAiB;0BAClD,OAAO,wBAAwB,EAAE,WAAW;8BAE5C,OAAO,wBAAwB,EAAE,eAAe;4BAChD,OAAO,wBAAwB,EAAE,aAAa;AAb3D;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AACH;IACI,oCAAkC;IAElC;;;;;;;;;;OAUG;IACH,6BANW,MAAM,MACN,IAAI,GAAG,MAAM,EAAE,OACf,IAAI,GAAG,MAAM,EAAE,QACf,MAAM,GACJ,OAAO,CAAE,kBAAkB,CAAC,CAwBxC;IAED;;;;OAIG;IACH,2BAFa,OAAO,CAAE,kBAAkB,CAAC,CAIxC;IAED;;;;;;;OAOG;IACH,uCALW,MAAM,QACN,MAAM,qBACN,WAAW,GACT,OAAO,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA77BwB,mBAAmB"} \ No newline at end of file diff --git a/@types/lib/metadataTypes/Journey.d.ts.map b/@types/lib/metadataTypes/Journey.d.ts.map index 892627aa2..c45080e38 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":";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;kCACrD,OAAO,wBAAwB,EAAE,mBAAmB;8BACpD,OAAO,wBAAwB,EAAE,eAAe;iCAChD,OAAO,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAj7DwB,mBAAmB"} \ No newline at end of file diff --git a/lib/metadataTypes/Event.js b/lib/metadataTypes/Event.js index eca47d7f5..73b787fef 100644 --- a/lib/metadataTypes/Event.js +++ b/lib/metadataTypes/Event.js @@ -646,6 +646,8 @@ class Event extends MetadataType { const dePrefixFields = {}; const dePrefixRelationshipMap = {}; const dePrefixReferenceObjectMap = {}; + const checkCommon = ca.whoToInject === 'Contact ID/Lead ID (Contacts and Leads)'; + Util.logger.info(Util.getGrayMsg(' - Checking eventDataConfig')); for (const object of edcObjects) { // create secondary object to quickly check eventDataSummary against dePrefixFields[object.dePrefix] = object.fields; @@ -670,23 +672,23 @@ class Event extends MetadataType { } else { // check if the fields selected in the eventDefinition are actually available for (const fieldName of object.fields) { - if (!this.sfObjects.objectFields[referencedObject][fieldName]) { - if ( - (referencedObject === 'Contact' || referencedObject === 'Lead') && - this.sfObjects.objectFields['Contacts and Leads'][fieldName] - ) { - errors.push( - `Salesforce object field ${referencedObject}.${fieldName} needs to be referenced as Common.${fieldName}` - ); - } else { - // TODO reactivate after switch to new API - // errors.push( - // `Salesforce object field ${referencedObject}.${fieldName} not available on connected org.` - // ); - } + if ( + checkCommon && + (referencedObject === 'Contact' || referencedObject === 'Lead') && + this.sfObjects.objectFields['Common'][fieldName] + ) { + errors.push( + `Salesforce object field ${referencedObject}.${fieldName} needs to be referenced as Common.${fieldName}` + ); + } else if (!this.sfObjects.objectFields[referencedObject][fieldName]) { + // TODO reactivate after switch to new API + // errors.push( + // `Salesforce object field ${referencedObject}.${fieldName} not available on connected org.` + // ); } // 1.2 check if all fields in eventDataConfig are listed in the eventDataSummary if (!ca.eventDataSummary.includes(object.dePrefix + fieldName)) { + // TODO instead, remove in postRetrieve and re-add in preDeploy errors.push( `Field ${object.dePrefix + fieldName} is listed under eventDataConfig for referenceObject ${object.referenceObject} but not in eventDataSummary` ); @@ -699,6 +701,7 @@ class Event extends MetadataType { // check if all fields in eventDataSummary are listed in the eventDataConfig for (let fieldName of ca.eventDataSummary) { + // TODO instead, remove in postRetrieve and re-add in preDeploy const fieldPath = fieldName.split(':'); fieldName = fieldPath.pop(); const dePrefix = fieldPath.join(':') + ':'; @@ -711,60 +714,58 @@ class Event extends MetadataType { // 3 check contactKey // check against referencedObjects - // const referencedContactObj = this.sfObjects.referencedObjects[ca.objectAPIName].find( - // (el) => - // el.relationshipName === - // (ca.contactKey.relationshipName == '' - // ? ca.contactKey.referenceObjectName - // : ca.contactKey.relationshipName) - // ); - // if (referencedContactObj) { - // if ( - // ca.contactKey.isPolymorphic && - // referencedContactObj.isPolymorphic !== ca.contactKey.isPolymorphic - // ) { - // errors.push( - // `configurationArguments.contactKey states an incorrect isPolimorphic value. Should be ${referencedContactObj.isPolymorphic}` - // ); - // } - // if (referencedContactObj.referenceObjectName !== ca.contactKey.referenceObjectName) { - // errors.push( - // `configurationArguments.contactKey states an incorrect referenceObjectName value. Should be ${referencedContactObj.referenceObjectName}` - // ); - // } - // if ( - // !this.sfObjects.objectFields[ca.contactKey.referenceObjectName]?.[ - // ca.contactKey.fieldName || ca.contactKey.relationshipIdName - // ] - // ) { - // // * if contactKey uses "Common" then there is no fieldName attribute but instead relationshipIdName needs to be checked - // if ( - // ca.contactKey.referenceObjectName === 'Contact' && - // this.sfObjects.objectFields['Common'][ - // ca.contactKey.fieldName || ca.contactKey.relationshipIdName - // ] - // ) { - // errors.push( - // `configurationArguments.contactKey should be referencing Common instead of Contact` - // ); - // } else { - // errors.push( - // `configurationArguments.contactKey states the invalid fieldName '${ca.contactKey.fieldName || ca.contactKey.relationshipIdName}' value that does not exist on ${ca.contactKey.referenceObjectName}` - // ); - // } - // } - // } else { - // errors.push( - // `configurationArguments.contactKey references ${ - // ca.contactKey.relationshipName == '' - // ? ca.contactKey.referenceObjectName - // : ca.contactKey.relationshipName - // } which is not found in related salesforce objects` - // ); - // } + const referencedContactObj = this.sfObjects.referencedObjects[ca.objectAPIName].find( + (el) => + el.relationshipName === + (ca.contactKey.relationshipName == '' + ? ca.contactKey.referenceObjectName + : ca.contactKey.relationshipName) + ); + if (referencedContactObj) { + if ( + ca.contactKey.isPolymorphic && + referencedContactObj.isPolymorphic !== ca.contactKey.isPolymorphic + ) { + errors.push( + `configurationArguments.contactKey states an incorrect isPolimorphic value. Should be ${referencedContactObj.isPolymorphic}` + ); + } + if (referencedContactObj.referenceObjectName !== ca.contactKey.referenceObjectName) { + errors.push( + `configurationArguments.contactKey states an incorrect referenceObjectName value. Should be ${referencedContactObj.referenceObjectName}` + ); + } + // * if contactKey uses "Common" then there is no fieldName attribute but instead relationshipIdName needs to be checked + if ( + checkCommon && + ca.contactKey.referenceObjectName === 'Contact' && + this.sfObjects.objectFields['Common'][ + ca.contactKey.fieldName || ca.contactKey.relationshipIdName + ] + ) { + errors.push( + `configurationArguments.contactKey should be referencing Common instead of Contact` + ); + } else if ( + !this.sfObjects.objectFields[ca.contactKey.referenceObjectName]?.[ + ca.contactKey.fieldName || ca.contactKey.relationshipIdName + ] + ) { + errors.push( + `configurationArguments.contactKey states the invalid fieldName '${ca.contactKey.fieldName || ca.contactKey.relationshipIdName}' value that does not exist on ${ca.contactKey.referenceObjectName}` + ); + } + } else { + errors.push( + `configurationArguments.contactKey references ${ + ca.contactKey.relationshipName == '' + ? ca.contactKey.referenceObjectName + : ca.contactKey.relationshipName + } which is not found in related salesforce objects` + ); + } // 4 check passThroughArgument - // TODO check where Common vs Contact is really required // const dePrefixCommon = ca.objectAPIName + ':Common'; // for (const key of Object.keys(ca.passThroughArgument.fields)) { // const fieldPath = ca.passThroughArgument.fields[key].split(':'); From 7c631424acdfec43338ad6419463f85ebda5aee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 30 Aug 2024 00:33:24 +0200 Subject: [PATCH 08/14] #1631: checks on passThroughArgument, primaryObjectFilterCriteria, relatedObjectFilterCriteria --- @types/lib/metadataTypes/Event.d.ts | 7 ++ @types/lib/metadataTypes/Event.d.ts.map | 2 +- lib/metadataTypes/Event.js | 106 ++++++++++++++---------- 3 files changed, 72 insertions(+), 43 deletions(-) diff --git a/@types/lib/metadataTypes/Event.d.ts b/@types/lib/metadataTypes/Event.d.ts index a90790c9b..8fd9a904c 100644 --- a/@types/lib/metadataTypes/Event.d.ts +++ b/@types/lib/metadataTypes/Event.d.ts @@ -114,6 +114,13 @@ declare class Event extends MetadataType { * @param {any} ca trigger[0].configurationArguments */ static checkSalesforceEntryEvents(ca: any): void; + /** + * + * @param {object[]} conditions - + * @param {string[]} errors list of errors + * @param {'primaryObjectFilterCriteria'|'relatedObjectFilterCriteria'} context used to improve error logs + */ + static checkSfFilterFieldsExist(conditions: object[], errors: string[], context: "primaryObjectFilterCriteria" | "relatedObjectFilterCriteria"): void; static requiredConfigurationArguments: string[]; /** * diff --git a/@types/lib/metadataTypes/Event.d.ts.map b/@types/lib/metadataTypes/Event.d.ts.map index 28ac17a6c..a1c4c5cb0 100644 --- a/@types/lib/metadataTypes/Event.d.ts.map +++ b/@types/lib/metadataTypes/Event.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Event.d.ts","sourceRoot":"","sources":["../../../lib/metadataTypes/Event.js"],"names":[],"mappings":";uBAUa,OAAO,wBAAwB,EAAE,QAAQ;0BACzC,OAAO,wBAAwB,EAAE,WAAW;8BAC5C,OAAO,wBAAwB,EAAE,eAAe;+BAChD,OAAO,wBAAwB,EAAE,gBAAgB;mCACjD,OAAO,wBAAwB,EAAE,oBAAoB;kCACrD,OAAO,wBAAwB,EAAE,mBAAmB;8BACpD,OAAO,wBAAwB,EAAE,eAAe;iCAChD,OAAO,wBAAwB,EAAE,kBAAkB;gCACnD,OAAO,wBAAwB,EAAE,iBAAiB;0BAClD,OAAO,wBAAwB,EAAE,WAAW;8BAE5C,OAAO,wBAAwB,EAAE,eAAe;4BAChD,OAAO,wBAAwB,EAAE,aAAa;AAb3D;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AACH;IACI,oCAAkC;IAElC;;;;;;;;;;OAUG;IACH,6BANW,MAAM,MACN,IAAI,GAAG,MAAM,EAAE,OACf,IAAI,GAAG,MAAM,EAAE,QACf,MAAM,GACJ,OAAO,CAAE,kBAAkB,CAAC,CAwBxC;IAED;;;;OAIG;IACH,2BAFa,OAAO,CAAE,kBAAkB,CAAC,CAIxC;IAED;;;;;;;OAOG;IACH,uCALW,MAAM,QACN,MAAM,qBACN,WAAW,GACT,OAAO,CAAE,mBAAmB,CAAC,CAiDzC;IA8BD;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAK1B;IAED;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAn9BwB,mBAAmB"} \ No newline at end of file diff --git a/lib/metadataTypes/Event.js b/lib/metadataTypes/Event.js index 73b787fef..45c00b65c 100644 --- a/lib/metadataTypes/Event.js +++ b/lib/metadataTypes/Event.js @@ -647,7 +647,6 @@ class Event extends MetadataType { const dePrefixRelationshipMap = {}; const dePrefixReferenceObjectMap = {}; const checkCommon = ca.whoToInject === 'Contact ID/Lead ID (Contacts and Leads)'; - Util.logger.info(Util.getGrayMsg(' - Checking eventDataConfig')); for (const object of edcObjects) { // create secondary object to quickly check eventDataSummary against dePrefixFields[object.dePrefix] = object.fields; @@ -766,53 +765,55 @@ class Event extends MetadataType { } // 4 check passThroughArgument - // const dePrefixCommon = ca.objectAPIName + ':Common'; - // for (const key of Object.keys(ca.passThroughArgument.fields)) { - // const fieldPath = ca.passThroughArgument.fields[key].split(':'); - // const fieldName = fieldPath.pop(); - // const dePrefix = fieldPath.join(':') + ':'; - // // it seems these fields do NOT need to be in the eventDataConfig - // const relationshipName = dePrefixRelationshipMap[dePrefix]; - // let referenceObject = dePrefixReferenceObjectMap[dePrefix]; - // if ( - // relationshipName !== 'Contact' && - // referenceObject === 'Contact' && - // !this.sfObjects.objectFields[referenceObject][fieldName] && - // this.sfObjects.objectFields['Common'] - // ) { - // // basically, when we link to Contact indirectly through other fields then the whole "common" thing does not apply but we still moved the fields to common - // referenceObject = 'Common'; - // } - // if ( - // !this.sfObjects.objectFields[referenceObject]?.[fieldName] && - // relationshipName !== 'Contact' && - // referenceObject === 'Contact' && - // !this.sfObjects.objectFields['Common']?.[fieldName] - // ) { - // if ( - // (relationshipName === 'Contact' || relationshipName === 'Lead') && - // this.sfObjects.objectFields['Common']?.[fieldName] - // ) { - // errors.push( - // `(${referenceObject})(${relationshipName}) Field ${dePrefix + fieldName} is listed under passThroughArgument.fields.${key} but needs to be referenced as ${dePrefixCommon}.${fieldName}` - // ); - // } else { - // errors.push( - // `(${referenceObject})(${relationshipName}) Field ${dePrefix + fieldName} is listed under passThroughArgument.fields.${key} but is not available on connected org.` - // ); - // } - // } - // } - - // 5 check primaryObjectFilterCriteria - // TODO + const dePrefixCommon = ca.objectAPIName + ':Common'; + for (const key of Object.keys(ca.passThroughArgument.fields)) { + const fieldPath = ca.passThroughArgument.fields[key].split(':'); + const fieldName = fieldPath.pop(); + const dePrefix = fieldPath.join(':') + ':'; + // it seems these fields do NOT need to be in the eventDataConfig + const relationshipName = dePrefixRelationshipMap[dePrefix]; + const referenceObject = dePrefixReferenceObjectMap[dePrefix]; + + if (!this.sfObjects.objectFields[referenceObject]?.[fieldName]) { + errors.push( + `Field ${dePrefix + fieldName} is listed under passThroughArgument.fields.${key} but is not available on connected org.` + ); + } else if ( + checkCommon && + (relationshipName === 'Contact' || relationshipName === 'Lead') && + this.sfObjects.objectFields['Common']?.[fieldName] + ) { + errors.push( + `Field ${dePrefix + fieldName} is listed under passThroughArgument.fields.${key} but needs to be referenced as ${dePrefixCommon}.${fieldName}` + ); + } + } + + // 5.a check primaryObjectFilterCriteria + this.checkSfFilterFieldsExist( + ca.primaryObjectFilterCriteria.conditions, + errors, + 'primaryObjectFilterCriteria' + ); + + // 5.b check relatedObjectFilterCriteria + this.checkSfFilterFieldsExist( + ca.relatedObjectFilterCriteria.conditions, + errors, + 'relatedObjectFilterCriteria' + ); - // 6 remove primaryObjectFilterSummary (and auto-generate it again in preDeploy from primaryObjectFilterCriteria) + // 6.a remove primaryObjectFilterSummary (and auto-generate it again in preDeploy from primaryObjectFilterCriteria) + // TODO + // 6.b remove relatedObjectFilterSummary (and auto-generate it again in preDeploy from relatedObjectFilterCriteria) // TODO // 7 remove eventDataSummary (and auto-generate it again in preDeploy from eventDataConfig) // TODO + // 8 remove evaluationCriteriaSummary (and auto-generate it again in preDeploy from salesforceTriggerCriteria) + // TODO + // throw error if problems were found if (errors?.length) { // add a line break @@ -821,6 +822,27 @@ class Event extends MetadataType { } } + /** + * + * @param {object[]} conditions - + * @param {string[]} errors list of errors + * @param {'primaryObjectFilterCriteria'|'relatedObjectFilterCriteria'} context used to improve error logs + */ + static checkSfFilterFieldsExist(conditions, errors, context) { + for (const condition of conditions) { + if ( + condition.fieldName & condition.referenceObjectName && + !this.sfObjects.objectFields[condition.referenceObjectName]?.[condition.fieldName] + ) { + errors.push( + `Field ${condition.referenceObjectName}.${condition.fieldName} is listed under ${context} but is not available on connected org.` + ); + } else if (condition.conditions) { + this.checkSfFilterFieldsExist(condition.conditions, errors, context); + } + } + } + static requiredConfigurationArguments = [ 'applicationExtensionKey', 'contactKey', From ec7cacfc478f37bc2911e6a911e808f272b0c065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 30 Aug 2024 11:23:15 +0200 Subject: [PATCH 09/14] Revert "#1570: disable beautyAmp for *.html files again" This reverts commit 0e7a251e283d762bc0ed096cdf752ddceb4cb00d. html formatting totally ruined ampscript after this change --- .vscode/settings.json | 2 +- boilerplate/files/.vscode/settings.json | 5 +++-- boilerplate/forcedUpdates.json | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ded56bd88..28bc58f4a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -20,7 +20,7 @@ "sql-formatter.indent": " ", "sql-formatter.uppercase": true, "[html]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "FiB.beautyAmp" }, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" diff --git a/boilerplate/files/.vscode/settings.json b/boilerplate/files/.vscode/settings.json index 0426edcfa..78687da09 100644 --- a/boilerplate/files/.vscode/settings.json +++ b/boilerplate/files/.vscode/settings.json @@ -37,7 +37,8 @@ }, "editor.formatOnSave": true, "files.associations": { - "*.ssjs": "javascript" + "*.ssjs": "javascript", + "*.html": "ampscript" }, "files.eol": "\n", "files.exclude": { @@ -48,7 +49,7 @@ "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[html]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "FiB.beautyAmp" }, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" diff --git a/boilerplate/forcedUpdates.json b/boilerplate/forcedUpdates.json index ec8df521e..ca781e5f5 100644 --- a/boilerplate/forcedUpdates.json +++ b/boilerplate/forcedUpdates.json @@ -1,4 +1,8 @@ [ + { + "version": "7.3.1", + "files": [".vscode/settings.json"] + }, { "version": "7.3.0", "files": [".vscode/settings.json"] From fef681d3f96fa8f90404d00477bdb9b79c8a84c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 30 Aug 2024 11:26:08 +0200 Subject: [PATCH 10/14] #0: fix predeploy check of sf entry events in journeys --- lib/metadataTypes/Journey.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/metadataTypes/Journey.js b/lib/metadataTypes/Journey.js index e7b5ed7c8..1a0480ced 100644 --- a/lib/metadataTypes/Journey.js +++ b/lib/metadataTypes/Journey.js @@ -1035,7 +1035,7 @@ class Journey extends MetadataType { delete config.r__dataExtension_key; } } - Event.preDeployTasks_SalesforceEntryEvents( + await Event.preDeployTasks_SalesforceEntryEvents( metadata.triggers[0].type, metadata.triggers[0].configurationArguments ); From 7c705970b912c6fe9273b10fe75b1b147a76ffb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 30 Aug 2024 11:49:53 +0200 Subject: [PATCH 11/14] #1510: ensure we always cache default roles & timezones (relevant for retrieve-user) --- @types/lib/metadataTypes/Role.d.ts | 7 +++ @types/lib/metadataTypes/Role.d.ts.map | 2 +- lib/metadataTypes/Role.js | 82 +++++++++++++++----------- 3 files changed, 55 insertions(+), 36 deletions(-) diff --git a/@types/lib/metadataTypes/Role.d.ts b/@types/lib/metadataTypes/Role.d.ts index 60fb3651f..cb876ea74 100644 --- a/@types/lib/metadataTypes/Role.d.ts +++ b/@types/lib/metadataTypes/Role.d.ts @@ -39,6 +39,13 @@ declare class Role extends MetadataType { * @returns {Promise.} Metadata store object */ static retrieve(retrieveDir: string, _?: void | string[], ___?: void | string[], key?: string): Promise; + /** + * adds default roles to the list of retrieved roles for proper caching (but not storing) + * also caches available timezones for retrieve-user + * + * @param {MetadataTypeMap} parsed list or previously retrieved items as reference + */ + static cacheDefaultRolesAndTimezones(parsed: MetadataTypeMap): Promise; /** * Gets executed before deploying metadata * diff --git a/@types/lib/metadataTypes/Role.d.ts.map b/@types/lib/metadataTypes/Role.d.ts.map index 30483fc20..f13852fbb 100644 --- a/@types/lib/metadataTypes/Role.d.ts.map +++ b/@types/lib/metadataTypes/Role.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"Role.d.ts","sourceRoot":"","sources":["../../../lib/metadataTypes/Role.js"],"names":[],"mappings":";uBAQa,OAAO,wBAAwB,EAAE,QAAQ;0BACzC,OAAO,wBAAwB,EAAE,WAAW;8BAC5C,OAAO,wBAAwB,EAAE,eAAe;+BAChD,OAAO,wBAAwB,EAAE,gBAAgB;mCACjD,OAAO,wBAAwB,EAAE,oBAAoB;kCACrD,OAAO,wBAAwB,EAAE,mBAAmB;8BACpD,OAAO,wBAAwB,EAAE,eAAe;iCAChD,OAAO,wBAAwB,EAAE,kBAAkB;gCACnD,OAAO,wBAAwB,EAAE,iBAAiB;kCAClD,OAAO,wBAAwB,EAAE,mBAAmB;0BACpD,OAAO,wBAAwB,EAAE,WAAW;AAXzD;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH;IACI;;;;;;;;OAQG;IACH,6BANW,MAAM,MACN,IAAI,GAAG,MAAM,EAAE,QACf,IAAI,GAAG,MAAM,EAAE,QACf,MAAM,GACJ,OAAO,CAAE,kBAAkB,CAAC,CAsFxC;IAED;;;;;OAKG;IACH,gCAHW,gBAAgB,GACd,gBAAgB,CAS5B;IAED;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAK1B;IAED;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAK1B;IAED;;;;;OAKG;IACH,2BAHW,eAAe,GACb,OAAO,CAAE,IAAI,CAAC,CA4G1B;IAED;;;;;;;;;;OAUG;IACH,4BAPW,MAAM,WACN,MAAM,eACN,MAAM,cACN,MAAM,GAEJ,IAAI,CAyDhB;CACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAhVwB,mBAAmB"} \ No newline at end of file +{"version":3,"file":"Role.d.ts","sourceRoot":"","sources":["../../../lib/metadataTypes/Role.js"],"names":[],"mappings":";uBAQa,OAAO,wBAAwB,EAAE,QAAQ;0BACzC,OAAO,wBAAwB,EAAE,WAAW;8BAC5C,OAAO,wBAAwB,EAAE,eAAe;+BAChD,OAAO,wBAAwB,EAAE,gBAAgB;mCACjD,OAAO,wBAAwB,EAAE,oBAAoB;kCACrD,OAAO,wBAAwB,EAAE,mBAAmB;8BACpD,OAAO,wBAAwB,EAAE,eAAe;iCAChD,OAAO,wBAAwB,EAAE,kBAAkB;gCACnD,OAAO,wBAAwB,EAAE,iBAAiB;kCAClD,OAAO,wBAAwB,EAAE,mBAAmB;0BACpD,OAAO,wBAAwB,EAAE,WAAW;AAXzD;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH;IACI;;;;;;;;OAQG;IACH,6BANW,MAAM,MACN,IAAI,GAAG,MAAM,EAAE,QACf,IAAI,GAAG,MAAM,EAAE,QACf,MAAM,GACJ,OAAO,CAAE,kBAAkB,CAAC,CAsDxC;IAED;;;;;OAKG;IACH,6CAFW,eAAe,iBAsCzB;IAED;;;;;OAKG;IACH,gCAHW,gBAAgB,GACd,gBAAgB,CAS5B;IAED;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAK1B;IAED;;;;;OAKG;IACH,wBAHW,gBAAgB,gBAK1B;IAED;;;;;OAKG;IACH,2BAHW,eAAe,GACb,OAAO,CAAE,IAAI,CAAC,CA4G1B;IAED;;;;;;;;;;OAUG;IACH,4BAPW,MAAM,WACN,MAAM,eACN,MAAM,cACN,MAAM,GAEJ,IAAI,CAyDhB;CACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA5VwB,mBAAmB"} \ No newline at end of file diff --git a/lib/metadataTypes/Role.js b/lib/metadataTypes/Role.js index 8286b6b85..eae687288 100644 --- a/lib/metadataTypes/Role.js +++ b/lib/metadataTypes/Role.js @@ -73,41 +73,6 @@ class Role extends MetadataType { const results = await this.client.soap.retrieve('Role', fields, requestParams); const parsed = this.parseResponseBody(results); - if (!retrieveDir) { - // retrieve "Marketing Cloud%" roles not returned by SOAP API - const { roles, timeZones } = await this.client.rest.get( - '/platform/v1/setup/quickflow/data' - ); - // this endpoint does not provide keys - const roleNameKeyMap = { - 'Marketing Cloud Administrator': 'SYS_DEF_IMHADMIN', - 'Marketing Cloud Channel Manager': 'SYS_DEF_CHANNELMANAGER', - 'Marketing Cloud Content Editor/Publisher': 'SYS_DEF_CONTENTEDIT', - 'Marketing Cloud Security Administrator': 'SYS_DEF_SECURITYADMIN', - 'Marketing Cloud Viewer': 'SYS_DEF_VIEWER', - }; - for (const role of roles) { - if (roleNameKeyMap[role.roleName]) { - parsed[roleNameKeyMap[role.roleName]] = { - CustomerKey: roleNameKeyMap[role.roleName], - Name: role.roleName, - ObjectID: role.roleID, - Desscription: role.description, - CreatedDate: '2012-02-21T02:09:19.983', - IsSystemDefined: true, - c__notAssignable: true, - }; - } - } - // the languages object is incomplete. the actual list is much longer --> ignoring it here - // convert timeZones to object - const timeZonesObj = {}; - for (const timeZone of timeZones) { - timeZonesObj[timeZone.id] = timeZone; - } - // cache timeZones to share it with other type-classes - cache.setMetadata('_timezone', timeZonesObj); - } if (retrieveDir) { const savedMetadata = await super.saveResults(parsed, retrieveDir, null); Util.logger.info( @@ -117,9 +82,56 @@ class Role extends MetadataType { await this.runDocumentOnRetrieve(key, savedMetadata); } + + await this.cacheDefaultRolesAndTimezones(parsed); + return { metadata: parsed, type: this.definition.type }; } + /** + * adds default roles to the list of retrieved roles for proper caching (but not storing) + * also caches available timezones for retrieve-user + * + * @param {MetadataTypeMap} parsed list or previously retrieved items as reference + */ + static async cacheDefaultRolesAndTimezones(parsed) { + // retrieve "Marketing Cloud%" roles not returned by SOAP API for cache (required by retrieve-user) + // also cache available timezones for retrieve-user + Util.logger.info(Util.getGrayMsg(' - Caching default roles and timezones')); + const { roles, timeZones } = await this.client.rest.get( + '/platform/v1/setup/quickflow/data' + ); + // this endpoint does not provide keys + const roleNameKeyMap = { + 'Marketing Cloud Administrator': 'SYS_DEF_IMHADMIN', + 'Marketing Cloud Channel Manager': 'SYS_DEF_CHANNELMANAGER', + 'Marketing Cloud Content Editor/Publisher': 'SYS_DEF_CONTENTEDIT', + 'Marketing Cloud Security Administrator': 'SYS_DEF_SECURITYADMIN', + 'Marketing Cloud Viewer': 'SYS_DEF_VIEWER', + }; + for (const role of roles) { + if (roleNameKeyMap[role.roleName]) { + parsed[roleNameKeyMap[role.roleName]] = { + CustomerKey: roleNameKeyMap[role.roleName], + Name: role.roleName, + ObjectID: role.roleID, + Desscription: role.description, + CreatedDate: '2012-02-21T02:09:19.983', + IsSystemDefined: true, + c__notAssignable: true, + }; + } + } + // the languages object is incomplete. the actual list is much longer --> ignoring it here + // convert timeZones to object + const timeZonesObj = {}; + for (const timeZone of timeZones) { + timeZonesObj[timeZone.id] = timeZone; + } + // cache timeZones to share it with other type-classes + cache.setMetadata('_timezone', timeZonesObj); + } + /** * Gets executed before deploying metadata * From 281b77ec9d21f6f75d3a3ec32590cc43dc9ad1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 30 Aug 2024 13:15:39 +0200 Subject: [PATCH 12/14] #0: improved release process by introducing new prepare-release task --- .github/PULL_REQUEST_TEMPLATE/pr_template_release.md | 5 ++--- package.json | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md b/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md index 19d322403..b940f7801 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md +++ b/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md @@ -5,9 +5,8 @@ ### Before merge - [ ] Wiki updated with info in ticket listed under **Documentation** -- [ ] ran `npm audit fix` -- [ ] ran `npm run lint-ts` -- [ ] ran `npm run lint:fix` +- [ ] ran `npm run prepare-release` (which runs `npm audit fix`, `npm run lint-ts` and `npm run lint:fix`) +- [ ] committed & pushed potential changes made by prepare-release ### After merge diff --git a/package.json b/package.json index a42740ef7..ea215976d 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,8 @@ "lint-and-test": "run-s lint test", "test": "mocha --reporter-option maxDiffSize=25000", "coverage": "c8 npm run test", + "audit-fix": "npm audit fix", + "prepare-release": "run-s audit-fix lint-ts lint:fix", "version:major": "npm version --no-commit-hooks major", "version:minor": "npm version --no-commit-hooks minor", "version:patch": "npm version --no-commit-hooks patch" From 1493c34fb1b8dc86db59d3a7aa3043526a43ae59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 30 Aug 2024 13:21:37 +0200 Subject: [PATCH 13/14] prepare-release changes --- .github/PULL_REQUEST_TEMPLATE/pr_template_release.md | 2 +- package.json | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md b/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md index b940f7801..6eaf2ff5a 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md +++ b/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md @@ -6,7 +6,7 @@ - [ ] Wiki updated with info in ticket listed under **Documentation** - [ ] ran `npm run prepare-release` (which runs `npm audit fix`, `npm run lint-ts` and `npm run lint:fix`) -- [ ] committed & pushed potential changes made by prepare-release +- [ ] pushed potential changes made by prepare-release ### After merge diff --git a/package.json b/package.json index ea215976d..ec2aaa298 100644 --- a/package.json +++ b/package.json @@ -59,8 +59,10 @@ "lint-and-test": "run-s lint test", "test": "mocha --reporter-option maxDiffSize=25000", "coverage": "c8 npm run test", - "audit-fix": "npm audit fix", - "prepare-release": "run-s audit-fix lint-ts lint:fix", + "prepare-release:audit-fix": "npm audit fix", + "prepare-release:git-stage": "git add .", + "prepare-release:git-commit": "git commit -n -m \"prepare-release changes\"", + "prepare-release": "run-s prepare-release:audit-fix lint-ts lint:fix prepare-release:git-stage prepare-release:git-commit", "version:major": "npm version --no-commit-hooks major", "version:minor": "npm version --no-commit-hooks minor", "version:patch": "npm version --no-commit-hooks patch" @@ -121,9 +123,7 @@ "fsevents": "*" }, "lint-staged": { - "*.js": [ - "eslint --fix" - ] + "*.js": ["eslint --fix"] }, "type": "module" } From cb0c778d8d887b646e0c6e24fbf46fed3157e826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Berkefeld?= Date: Fri, 30 Aug 2024 13:25:21 +0200 Subject: [PATCH 14/14] update note on what prepare-release does --- .github/PULL_REQUEST_TEMPLATE/pr_template_release.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md b/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md index 6eaf2ff5a..f59d9094c 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md +++ b/.github/PULL_REQUEST_TEMPLATE/pr_template_release.md @@ -5,7 +5,7 @@ ### Before merge - [ ] Wiki updated with info in ticket listed under **Documentation** -- [ ] ran `npm run prepare-release` (which runs `npm audit fix`, `npm run lint-ts` and `npm run lint:fix`) +- [ ] ran `npm run prepare-release` (which runs `npm audit fix`, `npm run lint-ts`, `npm run lint:fix`, `git add`, `git commit`) - [ ] pushed potential changes made by prepare-release ### After merge