diff --git a/docs/dist/documentation.md b/docs/dist/documentation.md index 151b36298..76a46badc 100644 --- a/docs/dist/documentation.md +++ b/docs/dist/documentation.md @@ -55,8 +55,8 @@ as this is a configuration in the EID

EmailSendDefinitionMetadataType

MessageSendActivity MetadataType

-
EventDefinitionMetadataType
-

EventDefinition MetadataType

+
EventMetadataType
+

Event MetadataType

FtpLocationMetadataType

ImportFile MetadataType

@@ -2326,34 +2326,34 @@ parses retrieved Metadata before saving | --- | --- | --- | | metadata | TYPE.MetadataTypeItem | a single query activity definition | - + -## EventDefinition ⇐ [MetadataType](#MetadataType) -EventDefinition MetadataType +## Event ⇐ [MetadataType](#MetadataType) +Event MetadataType **Kind**: global class **Extends**: [MetadataType](#MetadataType) -* [EventDefinition](#EventDefinition) ⇐ [MetadataType](#MetadataType) - * [.retrieve(retrieveDir, [_], [__], [key])](#EventDefinition.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj> - * [.retrieveForCache()](#EventDefinition.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj> - * [.retrieveAsTemplate(templateDir, name, templateVariables)](#EventDefinition.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj> - * [.postRetrieveTasks(eventDef)](#EventDefinition.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem - * [.deleteByKey(key)](#EventDefinition.deleteByKey) ⇒ Promise.<boolean> - * [.deploy(metadata, deployDir, retrieveDir)](#EventDefinition.deploy) ⇒ Promise.<TYPE.MetadataTypeMap> - * [.create(EventDefinition)](#EventDefinition.create) ⇒ Promise - * [.update(metadataEntry)](#EventDefinition.update) ⇒ Promise - * [.preDeployTasks(metadata)](#EventDefinition.preDeployTasks) ⇒ TYPE.MetadataTypeItem - * [.parseMetadata(metadata)](#EventDefinition.parseMetadata) ⇒ TYPE.MetadataTypeItem - - - -### EventDefinition.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj> +* [Event](#Event) ⇐ [MetadataType](#MetadataType) + * [.retrieve(retrieveDir, [_], [__], [key])](#Event.retrieve) ⇒ Promise.<TYPE.MetadataTypeMapObj> + * [.retrieveForCache()](#Event.retrieveForCache) ⇒ Promise.<TYPE.MetadataTypeMapObj> + * [.retrieveAsTemplate(templateDir, name, templateVariables)](#Event.retrieveAsTemplate) ⇒ Promise.<TYPE.MetadataTypeItemObj> + * [.postRetrieveTasks(eventDef)](#Event.postRetrieveTasks) ⇒ TYPE.MetadataTypeItem + * [.deleteByKey(key)](#Event.deleteByKey) ⇒ Promise.<boolean> + * [.deploy(metadata, deployDir, retrieveDir)](#Event.deploy) ⇒ Promise.<TYPE.MetadataTypeMap> + * [.create(metadata)](#Event.create) ⇒ Promise + * [.update(metadataEntry)](#Event.update) ⇒ Promise + * [.preDeployTasks(metadata)](#Event.preDeployTasks) ⇒ TYPE.MetadataTypeItem + * [.parseMetadata(metadata)](#Event.parseMetadata) ⇒ TYPE.MetadataTypeItem + + + +### Event.retrieve(retrieveDir, [_], [__], [key]) ⇒ Promise.<TYPE.MetadataTypeMapObj> Retrieves Metadata of Event Definition. Endpoint /interaction/v1/EventDefinitions return all Event Definitions with all details. Currently it is not needed to loop over Imports with endpoint /interaction/v1/EventDefinitions/{id} -**Kind**: static method of [EventDefinition](#EventDefinition) +**Kind**: static method of [Event](#Event) **Returns**: Promise.<TYPE.MetadataTypeMapObj> - Promise of metadata | Param | Type | Description | @@ -2363,19 +2363,19 @@ Currently it is not needed to loop over Imports with endpoint /interaction/v1/Ev | [__] | void | unused parameter | | [key] | string | customer key of single item to retrieve | - + -### EventDefinition.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj> +### Event.retrieveForCache() ⇒ Promise.<TYPE.MetadataTypeMapObj> Retrieves event definition metadata for caching -**Kind**: static method of [EventDefinition](#EventDefinition) +**Kind**: static method of [Event](#Event) **Returns**: Promise.<TYPE.MetadataTypeMapObj> - Promise of metadata - + -### EventDefinition.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj> +### Event.retrieveAsTemplate(templateDir, name, templateVariables) ⇒ Promise.<TYPE.MetadataTypeItemObj> Retrieve a specific Event Definition by Name -**Kind**: static method of [EventDefinition](#EventDefinition) +**Kind**: static method of [Event](#Event) **Returns**: Promise.<TYPE.MetadataTypeItemObj> - Promise of metadata | Param | Type | Description | @@ -2384,36 +2384,36 @@ Retrieve a specific Event Definition by Name | name | string | name of the metadata file | | templateVariables | TYPE.TemplateMap | variables to be replaced in the metadata | - + -### EventDefinition.postRetrieveTasks(eventDef) ⇒ TYPE.MetadataTypeItem +### Event.postRetrieveTasks(eventDef) ⇒ TYPE.MetadataTypeItem manages post retrieve steps -**Kind**: static method of [EventDefinition](#EventDefinition) +**Kind**: static method of [Event](#Event) **Returns**: TYPE.MetadataTypeItem - metadata | Param | Type | Description | | --- | --- | --- | | eventDef | TYPE.MetadataTypeItem | a single item of Event Definition | - + -### EventDefinition.deleteByKey(key) ⇒ Promise.<boolean> +### Event.deleteByKey(key) ⇒ Promise.<boolean> Delete a metadata item from the specified business unit -**Kind**: static method of [EventDefinition](#EventDefinition) +**Kind**: static method of [Event](#Event) **Returns**: Promise.<boolean> - deletion success status | Param | Type | Description | | --- | --- | --- | | key | string | Identifier of item | - + -### EventDefinition.deploy(metadata, deployDir, retrieveDir) ⇒ Promise.<TYPE.MetadataTypeMap> +### Event.deploy(metadata, deployDir, retrieveDir) ⇒ Promise.<TYPE.MetadataTypeMap> Deploys metadata - merely kept here to be able to print [logBeta](#Util.logBeta) once per deploy -**Kind**: static method of [EventDefinition](#EventDefinition) +**Kind**: static method of [Event](#Event) **Returns**: Promise.<TYPE.MetadataTypeMap> - Promise of keyField => metadata map | Param | Type | Description | @@ -2422,48 +2422,48 @@ Deploys metadata - merely kept here to be able to print [logBeta](#Util.logBeta) | deployDir | string | directory where deploy metadata are saved | | retrieveDir | string | directory where metadata after deploy should be saved | - + -### EventDefinition.create(EventDefinition) ⇒ Promise +### Event.create(metadata) ⇒ Promise Creates a single Event Definition -**Kind**: static method of [EventDefinition](#EventDefinition) +**Kind**: static method of [Event](#Event) **Returns**: Promise - Promise | Param | Type | Description | | --- | --- | --- | -| EventDefinition | TYPE.MetadataTypeItem | a single Event Definition | +| metadata | TYPE.MetadataTypeItem | a single Event Definition | - + -### EventDefinition.update(metadataEntry) ⇒ Promise +### Event.update(metadataEntry) ⇒ Promise Updates a single Event Definition (using PUT method since PATCH isn't supported) -**Kind**: static method of [EventDefinition](#EventDefinition) +**Kind**: static method of [Event](#Event) **Returns**: Promise - Promise | Param | Type | Description | | --- | --- | --- | | metadataEntry | TYPE.MetadataTypeItem | a single Event Definition | - + -### EventDefinition.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem +### Event.preDeployTasks(metadata) ⇒ TYPE.MetadataTypeItem prepares an event definition for deployment -**Kind**: static method of [EventDefinition](#EventDefinition) +**Kind**: static method of [Event](#Event) **Returns**: TYPE.MetadataTypeItem - parsed version | Param | Type | Description | | --- | --- | --- | | metadata | TYPE.MetadataTypeItem | a single eventDefinition | - + -### EventDefinition.parseMetadata(metadata) ⇒ TYPE.MetadataTypeItem +### Event.parseMetadata(metadata) ⇒ TYPE.MetadataTypeItem parses retrieved Metadata before saving -**Kind**: static method of [EventDefinition](#EventDefinition) +**Kind**: static method of [Event](#Event) **Returns**: TYPE.MetadataTypeItem - parsed metadata | Param | Type | Description | diff --git a/lib/MetadataTypeDefinitions.js b/lib/MetadataTypeDefinitions.js index df8817781..a53f85827 100644 --- a/lib/MetadataTypeDefinitions.js +++ b/lib/MetadataTypeDefinitions.js @@ -18,7 +18,7 @@ const MetadataTypeDefinitions = { discovery: require('./metadataTypes/definitions/Discovery.definition'), email: require('./metadataTypes/definitions/Email.definition'), emailSendDefinition: require('./metadataTypes/definitions/EmailSendDefinition.definition'), - eventDefinition: require('./metadataTypes/definitions/EventDefinition.definition'), + event: require('./metadataTypes/definitions/Event.definition'), fileLocation: require('./metadataTypes/definitions/FileLocation.definition'), fileTransfer: require('./metadataTypes/definitions/FileTransfer.definition'), filter: require('./metadataTypes/definitions/Filter.definition'), diff --git a/lib/MetadataTypeInfo.js b/lib/MetadataTypeInfo.js index 8b7b58ac3..662692032 100644 --- a/lib/MetadataTypeInfo.js +++ b/lib/MetadataTypeInfo.js @@ -18,7 +18,7 @@ const MetadataTypeInfo = { discovery: require('./metadataTypes/Discovery'), email: require('./metadataTypes/Email'), emailSendDefinition: require('./metadataTypes/EmailSendDefinition'), - eventDefinition: require('./metadataTypes/EventDefinition'), + event: require('./metadataTypes/Event'), fileLocation: require('./metadataTypes/FileLocation'), fileTransfer: require('./metadataTypes/FileTransfer'), filter: require('./metadataTypes/Filter'), diff --git a/lib/metadataTypes/EventDefinition.js b/lib/metadataTypes/Event.js similarity index 93% rename from lib/metadataTypes/EventDefinition.js rename to lib/metadataTypes/Event.js index 9fdd2855b..ed6ebd1ef 100644 --- a/lib/metadataTypes/EventDefinition.js +++ b/lib/metadataTypes/Event.js @@ -7,11 +7,11 @@ const File = require('../util/file'); const cache = require('../util/cache'); /** - * EventDefinition MetadataType + * Event MetadataType * * @augments MetadataType */ -class EventDefinition extends MetadataType { +class Event extends MetadataType { /** * Retrieves Metadata of Event Definition. * Endpoint /interaction/v1/EventDefinitions return all Event Definitions with all details. @@ -77,7 +77,7 @@ class EventDefinition extends MetadataType { ); if (!eventDef.dataExtensionId) { throw new Error( - `EventDefinition.parseMetadata:: ` + + `Event.parseMetadata:: ` + `No Data Extension found for ` + `event: ${eventDef.name}. ` + `This cannot be templated` @@ -101,7 +101,7 @@ class EventDefinition extends MetadataType { ); } } catch (ex) { - Util.logger.error('EventDefinition.retrieveAsTemplate:: ' + ex); + Util.logger.error('Event.retrieveAsTemplate:: ' + ex); return null; } } @@ -147,11 +147,11 @@ class EventDefinition extends MetadataType { /** * Creates a single Event Definition * - * @param {TYPE.MetadataTypeItem} EventDefinition a single Event Definition + * @param {TYPE.MetadataTypeItem} metadata a single Event Definition * @returns {Promise} Promise */ - static create(EventDefinition) { - return super.createREST(EventDefinition, '/interaction/v1/EventDefinitions/'); + static create(metadata) { + return super.createREST(metadata, '/interaction/v1/EventDefinitions/'); } /** @@ -232,6 +232,6 @@ class EventDefinition extends MetadataType { } // Assign definition to static attributes -EventDefinition.definition = require('../MetadataTypeDefinitions').eventDefinition; +Event.definition = require('../MetadataTypeDefinitions').event; -module.exports = EventDefinition; +module.exports = Event; diff --git a/lib/metadataTypes/Interaction.js b/lib/metadataTypes/Interaction.js index eaca3e6f8..047bc0423 100644 --- a/lib/metadataTypes/Interaction.js +++ b/lib/metadataTypes/Interaction.js @@ -299,7 +299,7 @@ class Interaction extends MetadataType { case 'Multistep': { // Multi-Step Journey // ~~~ TRIGGERS ~~~~ - // eventDefinition / definitionType==='Multistep' && channel==='' && triggers[].type === 'EmailAudience'|'APIEvent' + // event / definitionType==='Multistep' && channel==='' && triggers[].type === 'EmailAudience'|'APIEvent' if ( metadata.triggers?.length > 0 && metadata.triggers[0].metaData?.eventDefinitionKey @@ -307,14 +307,14 @@ class Interaction extends MetadataType { // trigger found; there can only be one entry in this array try { const edId = cache.searchForField( - 'eventDefinition', + 'event', metadata.triggers[0].metaData.eventDefinitionKey, 'eventDefinitionKey', 'id' ); if (metadata.triggers[0].metaData.eventDefinitionId !== edId) { throw new Error( - `eventDefinitionId not matching Id found on eventDefinition with key in eventDefinitionKey` + `eventDefinitionId not matching Id found on event with key in eventDefinitionKey` ); } delete metadata.triggers[0].metaData.eventDefinitionId; @@ -379,7 +379,7 @@ class Interaction extends MetadataType { }): definitionType Quicksend is not fully supported yet.` ); // ~~~ TRIGGERS ~~~~ - // eventDefinition && triggers[].type === 'ContactAudience' + // event && triggers[].type === 'ContactAudience' if ( metadata.triggers?.length > 0 && metadata.triggers[0].metaData?.eventDefinitionKey @@ -387,7 +387,7 @@ class Interaction extends MetadataType { // trigger found; there can only be one entry in this array try { const edId = cache.searchForField( - 'eventDefinition', + 'event', metadata.triggers[0].metaData.eventDefinitionKey, 'eventDefinitionKey', 'id' @@ -398,7 +398,7 @@ class Interaction extends MetadataType { metadata[this.definition.nameField] } (${ metadata[this.definition.keyField] - }): eventDefinitionId not matching Id found on eventDefinition with key in eventDefinitionKey` + }): eventDefinitionId not matching Id found on event with key in eventDefinitionKey` ); } delete metadata.triggers[0].metaData.eventDefinitionId; @@ -535,14 +535,14 @@ class Interaction extends MetadataType { // Multi-Step Journey // ~~~ TRIGGERS ~~~~ - // eventDefinition / definitionType==='Multistep' && channel==='' && triggers[].type === 'EmailAudience'|'APIEvent' + // event / definitionType==='Multistep' && channel==='' && triggers[].type === 'EmailAudience'|'APIEvent' if ( metadata.triggers?.length > 0 && metadata.triggers[0].metaData?.eventDefinitionKey ) { // trigger found; there can only be one entry in this array metadata.triggers[0].metaData.eventDefinitionId = cache.searchForField( - 'eventDefinition', + 'event', metadata.triggers[0].metaData.eventDefinitionKey, 'eventDefinitionKey', 'id' @@ -586,7 +586,7 @@ class Interaction extends MetadataType { }): definitionType Quicksend is not supported yet and might fail to deploy.` ); // ~~~ TRIGGERS ~~~~ - // eventDefinition && triggers[].type === 'ContactAudience' + // event && triggers[].type === 'ContactAudience' if ( metadata.triggers?.length > 0 && metadata.triggers[0].metaData?.eventDefinitionKey @@ -594,7 +594,7 @@ class Interaction extends MetadataType { // trigger found; there can only be one entry in this array try { metadata.triggers[0].metaData.eventDefinitionId = cache.searchForField( - 'eventDefinition', + 'event', metadata.triggers[0].metaData?.eventDefinitionKey, 'eventDefinitionKey', 'id' diff --git a/lib/metadataTypes/definitions/EventDefinition.definition.js b/lib/metadataTypes/definitions/Event.definition.js similarity index 99% rename from lib/metadataTypes/definitions/EventDefinition.definition.js rename to lib/metadataTypes/definitions/Event.definition.js index 5a522e47d..99711d510 100644 --- a/lib/metadataTypes/definitions/EventDefinition.definition.js +++ b/lib/metadataTypes/definitions/Event.definition.js @@ -10,7 +10,7 @@ module.exports = { lastmodDateField: 'modifiedDate', lastmodNameField: 'modifiedBy', restPagination: true, - type: 'eventDefinition', + type: 'event', typeDescription: 'Used in Journeys (Interactions) to define Entry Events.', typeRetrieveByDefault: true, typeName: 'Journey: Entry Event Definition', diff --git a/lib/metadataTypes/definitions/Interaction.definition.js b/lib/metadataTypes/definitions/Interaction.definition.js index 1afc769b1..d1ede2324 100644 --- a/lib/metadataTypes/definitions/Interaction.definition.js +++ b/lib/metadataTypes/definitions/Interaction.definition.js @@ -4,7 +4,7 @@ // update: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/putUpdateInteraction.html module.exports = { bodyIteratorField: 'items', - dependencies: ['folder-journey', 'triggeredSendDefinition', 'eventDefinition'], // ! interaction and transactionalEmail both link to each other. caching transactionalEmail here "manually" instead of via dependencies array, assuming that it is quicker than the other way round + dependencies: ['folder-journey', 'triggeredSendDefinition', 'event'], // ! interaction and transactionalEmail both link to each other. caching transactionalEmail here "manually" instead of via dependencies array, assuming that it is quicker than the other way round folderIdField: 'categoryId', hasExtended: false, idField: 'id',