diff --git a/src/cdk/v1/autopilot/config.yaml b/src/cdk/v1/autopilot/config.yaml deleted file mode 100644 index c6cccd59d6..0000000000 --- a/src/cdk/v1/autopilot/config.yaml +++ /dev/null @@ -1,33 +0,0 @@ -message: - supportedMessageTypes: - - identify - - track - identify: - transformation: - mapperPath: ./mapping/identify.yaml - postMapper: - name: 'identifyPostMapper' - response: - endpoint: 'https://api2.autopilothq.com/v1/contact' - method: POST - format: JSON - headers: - Accept: 'application/json' - autopilotapikey: '{{ destConfig.apiKey }}' - Content-Type: 'application/json' - userId: '{{ message.anonymousId }}' - - track: - transformation: - mapperPath: ./mapping/track.yaml - postMapper: - name: 'trackPostMapper' - response: - endpoint: '{{ rudderContext.endpoint }}' - method: POST - format: JSON - headers: - Accept: 'application/json' - autopilotapikey: '{{ destConfig.apiKey }}' - Content-Type: 'application/json' - userId: '{{ message.anonymousId }}' diff --git a/src/cdk/v1/autopilot/mapping/identify.yaml b/src/cdk/v1/autopilot/mapping/identify.yaml deleted file mode 100644 index a460907b7e..0000000000 --- a/src/cdk/v1/autopilot/mapping/identify.yaml +++ /dev/null @@ -1,38 +0,0 @@ -- destKey: Email - sourceKeys: - - traits.email - - context.traits.email - -- destKey: FirstName - sourceKeys: - - traits.firstName - - context.traits.firstName - - traits.firstname - - context.traits.firstname - -- destKey: LastName - sourceKeys: - - traits.lastName - - context.traits.lastName - - traits.lastname - - context.traits.lastname - -- destKey: Phone - sourceKeys: - - traits.phone - - context.traits.phone - -- destKey: Company - sourceKeys: - - traits.company.name - - context.traits.company.name - -- destKey: Status - sourceKeys: - - traits.status - - context.traits.status - -- destKey: LeadSource - sourceKeys: - - traits.LeadSource - - context.traits.LeadSource diff --git a/src/cdk/v1/autopilot/mapping/track.yaml b/src/cdk/v1/autopilot/mapping/track.yaml deleted file mode 100644 index 0315d2bcda..0000000000 --- a/src/cdk/v1/autopilot/mapping/track.yaml +++ /dev/null @@ -1,2 +0,0 @@ -- destKey: property - sourceKeys: properties diff --git a/src/cdk/v1/autopilot/transform.js b/src/cdk/v1/autopilot/transform.js deleted file mode 100644 index b27e50f096..0000000000 --- a/src/cdk/v1/autopilot/transform.js +++ /dev/null @@ -1,55 +0,0 @@ -const { Utils } = require('rudder-transformer-cdk'); -const { InstrumentationError } = require('@rudderstack/integrations-lib'); - -function identifyPostMapper(event, mappedPayload) { - const { message } = event; - const payload = mappedPayload; - - // better to outsource constants like this in a separate file - const identifyFields = [ - 'email', - 'firstname', - 'firstName', - 'lastname', - 'lastName', - 'phone', - 'company', - 'status', - 'LeadSource', - ]; - - let responseBody; - const customPayload = message.traits || message.context.traits || {}; - identifyFields.forEach((value) => { - delete customPayload[value]; - }); - if (Object.keys(customPayload).length > 0) { - responseBody = { - contact: { ...payload, custom: customPayload }, - }; - } else { - responseBody = { - contact: { ...payload }, - }; - } - return responseBody; // this flows onto the next stage in the yaml -} - -function trackPostMapper(event, mappedPayload, rudderContext) { - const { message, destination } = event; - - const contactIdOrEmail = Utils.getFieldValueFromMessage(message, 'email'); - if (contactIdOrEmail) { - // eslint-disable-next-line no-param-reassign - rudderContext.endpoint = `https://api2.autopilothq.com/v1/trigger/${destination.Config.triggerId}/contact/${contactIdOrEmail}`; - } else { - throw new InstrumentationError('Email is required for track calls'); - } - // The plan is to delete the rudderResponse property from the mappedPayload finally - // While removing the rudderResponse property, we'd need to do a deep-clone of rudderProperty first - // And then go ahead with `rudderResponse` property - // This `rudderResponse` property has to be combined with transformation mentioned `response` tag in config.yaml - return mappedPayload; // this flows onto the next stage in the yaml -} - -module.exports = { identifyPostMapper, trackPostMapper }; diff --git a/src/cdk/v1/dcm_floodlight/config.js b/src/cdk/v1/dcm_floodlight/config.js deleted file mode 100644 index ce7ab69902..0000000000 --- a/src/cdk/v1/dcm_floodlight/config.js +++ /dev/null @@ -1,5 +0,0 @@ -const BASE_URL = 'https://ad.doubleclick.net/ddm/activity/'; - -const BLACKLISTED_CHARACTERS = ['"', '<', '>', '#']; - -module.exports = { BASE_URL, BLACKLISTED_CHARACTERS }; diff --git a/src/cdk/v1/dcm_floodlight/config.yaml b/src/cdk/v1/dcm_floodlight/config.yaml deleted file mode 100644 index cac23f66d3..0000000000 --- a/src/cdk/v1/dcm_floodlight/config.yaml +++ /dev/null @@ -1,26 +0,0 @@ -message: - supportedMessageTypes: - - track - - page - track: - transformation: - mapperPath: ./mapping/DCMFloodlightConfig.yaml - postMapper: - name: 'postMapper' - response: - endpoint: '{{ rudderContext.endpoint }}' - method: GET - format: JSON - headers: - User-Agent: '{{ rudderContext.userAgent }}' - page: - transformation: - mapperPath: ./mapping/DCMFloodlightConfig.yaml - postMapper: - name: 'postMapper' - response: - endpoint: '{{ rudderContext.endpoint }}' - method: GET - format: JSON - headers: - User-Agent: '{{ rudderContext.userAgent }}' diff --git a/src/cdk/v1/dcm_floodlight/mapping/DCMFloodlightConfig.yaml b/src/cdk/v1/dcm_floodlight/mapping/DCMFloodlightConfig.yaml deleted file mode 100644 index 6126dac5c7..0000000000 --- a/src/cdk/v1/dcm_floodlight/mapping/DCMFloodlightConfig.yaml +++ /dev/null @@ -1,21 +0,0 @@ -- destKey: dc_rdid - sourceKeys: context.device.advertisingId - required: true - -- destKey: ord - sourceKeys: - - properties.orderId - - properties.order_id - required: false - -- destKey: qty - sourceKeys: properties.quantity - required: false - -- destKey: cost - sourceKeys: properties.revenue - required: false - -- destKey: dc_lat - sourceKeys: context.device.adTrackingEnabled - required: false diff --git a/src/cdk/v1/dcm_floodlight/transform.js b/src/cdk/v1/dcm_floodlight/transform.js deleted file mode 100644 index bb93333745..0000000000 --- a/src/cdk/v1/dcm_floodlight/transform.js +++ /dev/null @@ -1,211 +0,0 @@ -/* eslint-disable no-param-reassign */ -const get = require('get-value'); -const lodash = require('lodash'); -const { - removeUndefinedAndNullValues, - isDefinedAndNotNull, -} = require('rudder-transformer-cdk/build/utils'); -const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); -const { - getIntegrationsObj, - isEmpty, - isEmptyObject, - getValueFromPropertiesOrTraits, - getHashFromArray, -} = require('../../../v0/util'); -const { GENERIC_TRUE_VALUES, GENERIC_FALSE_VALUES } = require('../../../constants'); -const { BASE_URL, BLACKLISTED_CHARACTERS } = require('./config'); - -// append properties to endpoint -// eg: ${BASE_URL}key1=value1;key2=value2;.... -const appendProperties = (payload) => { - let endpoint = ''; - endpoint += Object.keys(payload) - .map((key) => `${key}=${payload[key]}`) - .join(';'); - - return endpoint; -}; - -// transform webapp dynamicForm custom floodlight variable -// into {property1: u1, property2: u2, ...} -// Ref - https://support.google.com/campaignmanager/answer/2823222?hl=en -const transformCustomVariable = (customFloodlightVariable, message) => { - const customVariable = {}; - const customMapping = getHashFromArray(customFloodlightVariable, 'from', 'to', false); - - Object.keys(customMapping).forEach((key) => { - // it takes care of getting the value in the order. - // returns null if not present - const itemValue = getValueFromPropertiesOrTraits({ - message, - key, - }); - - if ( - // the value is not null - !lodash.isNil(itemValue) && - // the value is string and doesn't have any blacklisted characters - !( - typeof itemValue === 'string' && BLACKLISTED_CHARACTERS.some((k) => itemValue.includes(k)) - ) && - // boolean values are not supported - typeof itemValue !== 'boolean' - ) { - customVariable[`u${customMapping[key].replace(/u/g, '')}`] = encodeURIComponent(itemValue); - } - }); - - return customVariable; -}; - -// valid flag should be provided [1|true] or [0|false] -const mapFlagValue = (key, value) => { - if (GENERIC_TRUE_VALUES.includes(value.toString())) { - return 1; - } - if (GENERIC_FALSE_VALUES.includes(value.toString())) { - return 0; - } - - throw new InstrumentationError(`${key}: valid parameters are [1|true] or [0|false]`); -}; - -/** - * postMapper does the processing after we do the initial mapping - * defined in mapping/*.yaml - * @param {*} input - * @param {*} mappedPayload - * @param {*} rudderContext - * @returns - */ -const postMapper = (input, mappedPayload, rudderContext) => { - const { message, destination } = input; - const { advertiserId, conversionEvents } = destination.Config; - let { activityTag, groupTag } = destination.Config; - let customFloodlightVariable; - let salesTag; - - let event; - // for page() take event from name and category - if (message.type.toLowerCase() === 'page') { - const { category } = message.properties; - const { name } = message || message.properties; - - if (category && name) { - message.event = `Viewed ${category} ${name} Page`; - } else if (category) { - // categorized pages - message.event = `Viewed ${category} Page`; - } else if (name) { - // named pages - message.event = `Viewed ${name} Page`; - } else { - message.event = 'Viewed Page'; - } - } - - event = message.event; - - if (!event) { - throw new InstrumentationError(`${message.type}:: event is required`); - } - - const userAgent = get(message, 'context.userAgent'); - if (!userAgent) { - throw new InstrumentationError(`${message.type}:: userAgent is required`); - } - rudderContext.userAgent = userAgent; - - // find conversion event - // some() stops execution if at least one condition is passed and returns bool - event = event.trim().toLowerCase(); - const conversionEventFound = conversionEvents.some((conversionEvent) => { - if ( - conversionEvent && - conversionEvent.eventName && - conversionEvent.eventName.trim().toLowerCase() === event - ) { - if ( - !isEmpty(conversionEvent.floodlightActivityTag) && - !isEmpty(conversionEvent.floodlightGroupTag) - ) { - activityTag = conversionEvent.floodlightActivityTag.trim(); - groupTag = conversionEvent.floodlightGroupTag.trim(); - } - salesTag = conversionEvent.salesTag; - customFloodlightVariable = conversionEvent.customVariables || []; - return true; - } - return false; - }); - - if (!conversionEventFound) { - throw new ConfigurationError(`${message.type}:: Conversion event not found`); - } - - // Ref - https://support.google.com/displayvideo/answer/6040012?hl=en - customFloodlightVariable = transformCustomVariable(customFloodlightVariable, message); - mappedPayload = { - src: advertiserId, - cat: activityTag, - type: groupTag, - ...mappedPayload, - }; - - if (salesTag) { - // sums quantity from products array or fallback to properties.quantity - const products = get(message, 'properties.products'); - if (!isEmpty(products) && Array.isArray(products)) { - const quantities = products.reduce((accumulator, product) => { - if (product.quantity) { - return accumulator + product.quantity; - } - return accumulator; - }, 0); - if (quantities) { - mappedPayload.qty = quantities; - } - } - } else { - // for counter tag - mappedPayload.ord = get(message, 'messageId'); - delete mappedPayload.qty; - delete mappedPayload.cost; - } - - // COPPA, GDPR, npa must be provided inside integration object ("DCM FLoodlight") - // Ref - https://support.google.com/displayvideo/answer/6040012?hl=en - const integrationsObj = getIntegrationsObj(message, 'dcm_floodlight'); - if (integrationsObj) { - if (isDefinedAndNotNull(integrationsObj.COPPA)) { - mappedPayload.tag_for_child_directed_treatment = mapFlagValue('COPPA', integrationsObj.COPPA); - } - - if (isDefinedAndNotNull(integrationsObj.GDPR)) { - mappedPayload.tfua = mapFlagValue('GDPR', integrationsObj.GDPR); - } - - if (isDefinedAndNotNull(integrationsObj.npa)) { - mappedPayload.npa = mapFlagValue('npa', integrationsObj.npa); - } - } - - if (isDefinedAndNotNull(mappedPayload.dc_lat)) { - mappedPayload.dc_lat = mapFlagValue('dc_lat', mappedPayload.dc_lat); - } - - mappedPayload = removeUndefinedAndNullValues(mappedPayload); - customFloodlightVariable = removeUndefinedAndNullValues(customFloodlightVariable); - - let dcmEndpoint = `${BASE_URL}${appendProperties(mappedPayload)}`; - if (!isEmptyObject(customFloodlightVariable)) { - dcmEndpoint = `${dcmEndpoint};${appendProperties(customFloodlightVariable)}`; - } - - rudderContext.endpoint = dcmEndpoint; - - return {}; -}; - -module.exports = { postMapper }; diff --git a/src/cdk/v1/handler.js b/src/cdk/v1/handler.js deleted file mode 100644 index 0af0859f49..0000000000 --- a/src/cdk/v1/handler.js +++ /dev/null @@ -1,85 +0,0 @@ -const { ConfigFactory, Executor } = require('rudder-transformer-cdk'); -const { CustomError } = require('rudder-transformer-cdk/build/error'); -const { TRANSFORMER_METRIC } = require('rudder-transformer-cdk/build/constants'); -const path = require('path'); - -const basePath = path.resolve(__dirname); -ConfigFactory.init({ basePath, loggingMode: 'production' }); - -const { - InstrumentationError, - TransformationError, - ConfigurationError, -} = require('@rudderstack/integrations-lib'); -const tags = require('../../v0/util/tags'); -const { generateErrorObject } = require('../../v0/util'); - -const defTags = { - [tags.TAG_NAMES.IMPLEMENTATION]: tags.IMPLEMENTATIONS.CDK_V1, -}; - -/** - * Translates CDK errors into transformer errors - * @param {} err The error object - * @returns An error type which the transformer recognizes - */ -function getErrorInfo(err) { - if (err instanceof CustomError) { - let errInstance = ''; - switch (err.statTags?.meta) { - case TRANSFORMER_METRIC.MEASUREMENT_TYPE.CDK.META.BAD_CONFIG: - errInstance = new TransformationError( - `Bad transformer configuration file. Original error: ${err.message}`, - ); - break; - - case TRANSFORMER_METRIC.MEASUREMENT_TYPE.CDK.META.CONFIGURATION: - errInstance = new ConfigurationError(`Bad configuration. Original error: ${err.message}`); - break; - - case TRANSFORMER_METRIC.MEASUREMENT_TYPE.CDK.META.TF_FUNC: - errInstance = new TransformationError( - `Bad pre/post transformation function. Original error: ${err.message}`, - ); - break; - - case TRANSFORMER_METRIC.MEASUREMENT_TYPE.CDK.META.BAD_EVENT: - case TRANSFORMER_METRIC.MEASUREMENT_TYPE.CDK.META.INSTRUMENTATION: - errInstance = new InstrumentationError(`Bad event. Original error: ${err.message}`); - break; - - case TRANSFORMER_METRIC.MEASUREMENT_TYPE.CDK.META.EXCEPTION: - errInstance = new TransformationError( - `Unknown error occurred. Original error: ${err.message}`, - ); - break; - default: - break; - } - if (err.statTags.scope === TRANSFORMER_METRIC.MEASUREMENT_TYPE.EXCEPTION.SCOPE) { - errInstance = new TransformationError( - `Unknown error occurred. Original error: ${err.message}`, - ); - } - if (errInstance) { - return generateErrorObject(errInstance, defTags); - } - } - - return generateErrorObject(err, defTags); -} - -async function processCdkV1(destType, parsedEvent) { - try { - const tfConfig = await ConfigFactory.getConfig(destType); - const respEvents = await Executor.execute(parsedEvent, tfConfig); - return respEvents; - } catch (error) { - throw getErrorInfo(error); - } -} - -module.exports = { - processCdkV1, - getErrorInfo, -}; diff --git a/src/cdk/v1/heap/config.yaml b/src/cdk/v1/heap/config.yaml deleted file mode 100644 index da6a2dfe28..0000000000 --- a/src/cdk/v1/heap/config.yaml +++ /dev/null @@ -1,28 +0,0 @@ -message: - identify: - transformation: - mapperPath: ./mapping/identify.yaml - postMapper: - name: 'commonPostMapper' - response: - method: POST - format: JSON - endpoint: 'https://heapanalytics.com/api/add_user_properties' - userId: '{{ message.anonymousId }}' - headers: - Accept: 'application/json' - Content-Type: 'application/json' - - track: - transformation: - mapperPath: ./mapping/track.yaml - postMapper: - name: 'commonPostMapper' - response: - method: POST - format: JSON - endpoint: 'https://heapanalytics.com/api/track' - userId: '{{ message.anonymousId }}' - headers: - Accept: 'application/json' - Content-Type: 'application/json' diff --git a/src/cdk/v1/heap/mapping/identify.yaml b/src/cdk/v1/heap/mapping/identify.yaml deleted file mode 100644 index 6b9a237943..0000000000 --- a/src/cdk/v1/heap/mapping/identify.yaml +++ /dev/null @@ -1,17 +0,0 @@ -- destKey: identity - sourceKeys: - - userId - - traits.userId - - traits.id - - context.traits.userId - - context.traits.id - - anonymousId - required: true - -- destKey: properties - sourceKeys: - - traits - - context.traits - metadata: - type: flatJson - required: true diff --git a/src/cdk/v1/heap/mapping/track.yaml b/src/cdk/v1/heap/mapping/track.yaml deleted file mode 100644 index e0ffa2b9a5..0000000000 --- a/src/cdk/v1/heap/mapping/track.yaml +++ /dev/null @@ -1,28 +0,0 @@ -- destKey: identity - sourceKeys: - - userId - - traits.userId - - traits.id - - context.traits.userId - - context.traits.id - - anonymousId - required: true - -- destKey: event - sourceKeys: event - required: true - -- destKey: properties - sourceKeys: properties - metadata: - type: flatJson - -- destKey: timestamp - sourceKeys: - - timestamp - - originalTimestamp - required: false - -- destKey: idempotency_key - sourceKeys: properties.idempotencyKey - required: false diff --git a/src/cdk/v1/heap/transform.js b/src/cdk/v1/heap/transform.js deleted file mode 100644 index 120af3ef90..0000000000 --- a/src/cdk/v1/heap/transform.js +++ /dev/null @@ -1,15 +0,0 @@ -async function commonPostMapper(event, mappedPayload) { - const { destination } = event; - const payload = mappedPayload; - if (payload.properties && payload.properties.idempotencyKey) { - delete payload.properties.idempotencyKey; - } - const responseBody = { - ...payload, - app_id: destination.Config.appId, - }; - - return responseBody; // this flows onto the next stage in the yaml -} - -module.exports = { commonPostMapper }; diff --git a/src/cdk/v1/kochava/config.yaml b/src/cdk/v1/kochava/config.yaml deleted file mode 100644 index 90ae837fae..0000000000 --- a/src/cdk/v1/kochava/config.yaml +++ /dev/null @@ -1,15 +0,0 @@ -message: - supportedMessageTypes: - - screen - - track - default: - transformation: - mapperPath: ./mappings/default.yaml - postMapper: - name: processExtraPayloadParams - response: - endpoint: https://control.kochava.com/track/json - userId: '{{ message.anonymousId }}' - format: JSON - method: POST - headers: {} diff --git a/src/cdk/v1/kochava/mappings/default.yaml b/src/cdk/v1/kochava/mappings/default.yaml deleted file mode 100644 index c17292d40f..0000000000 --- a/src/cdk/v1/kochava/mappings/default.yaml +++ /dev/null @@ -1,49 +0,0 @@ -- destKey: data.event_data - sourceKeys: - - properties - metadata: - defaultValue: {} - -- destKey: kochava_app_id - sourceKeys: apiKey - context: destConfig - -- destKey: kochava_device_id - sourceKeys: - - context.device.id - - anonymousId - -- destKey: data.usertime - sourceKeys: - - timestamp - - originalTimestamp - metadata: - type: timestamp - -- destKey: data.app_version - sourceKeys: context.app.build - -- destKey: data.origination_ip - sourceKeys: - - context.ip - - request_ip - -- destKey: data.app_name - sourceKeys: context.app.name - -- destKey: data.app_short_string - sourceKeys: context.app.version - -- destKey: data.locale - sourceKeys: context.locale - -- destKey: data.os_version - sourceKeys: context.os.version - -- destKey: data.screen_dpi - sourceKeys: context.screen.density - -- destKey: action - sourceKeys: rudderAction # This will not be available - metadata: - defaultValue: 'event' diff --git a/src/cdk/v1/kochava/transform.js b/src/cdk/v1/kochava/transform.js deleted file mode 100644 index 504981aa6a..0000000000 --- a/src/cdk/v1/kochava/transform.js +++ /dev/null @@ -1,78 +0,0 @@ -const { Utils } = require('rudder-transformer-cdk'); - -const eventNameMapping = { - 'product added': 'Add to Cart', - 'product added to wishlist': 'Add to Wishlist', - 'checkout started': 'Checkout Start', - 'order completed': 'Purchase', - 'product reviewed': 'Rating', - 'products searched': 'Search', -}; - -function processExtraPayloadParams(event, mappedPayload) { - const clonedMappedPayload = { ...mappedPayload }; - const { message } = event; - let eventName = message.event; - const eventData = message.properties || {}; - switch (message.type.toLowerCase()) { - case 'screen': - eventName = 'screen view'; - if (message.properties && message.properties.name) { - eventName += ` ${message.properties.name}`; - } - break; - case 'track': - if (eventName) { - const evName = eventName.toLowerCase(); - if (eventNameMapping[evName] !== undefined) { - eventName = eventNameMapping[evName]; - } - } - break; - default: - break; - } - - const extraParams = { - // This kind of formatting multiple fields into a single one - // is currently not supported in cdk - app_tracking_transparency: { - att: message.context?.device?.attTrackingStatus === 3 || false, - }, - device_ver: - message.context?.device?.model && message.context?.os?.version - ? `${message.context?.device?.model}-${message.context?.os?.name}-${message.context?.os?.version}` - : '', - device_ids: { - idfa: - message.context?.os?.name && Utils.isAppleFamily(message.context?.os?.name) - ? message.context?.device?.advertisingId || '' - : '', - idfv: - message.context?.os?.name && Utils.isAppleFamily(message.context?.os?.name) - ? message.context?.device?.id || message.anonymousId || '' - : '', - adid: - message.context?.os?.name && message.context.os.name.toLowerCase() === 'android' - ? message.context?.device?.advertisingId || '' - : '', - android_id: - message.context?.os?.name && message.context.os.name.toLowerCase() === 'android' - ? message.context?.device?.id || message.anonymousId || '' - : '', - }, - event_name: eventName, - device_ua: message.context?.userAgent || '', - currency: eventData?.currency || 'USD', - }; - clonedMappedPayload.data = { ...clonedMappedPayload.data, ...extraParams }; - // Note: "defaultValue" cannot be empty string hence had to manually set it here since kochava requires it - if (Utils.getValueFromMessage(message, 'context.os.version') === '') { - clonedMappedPayload.data.os_version = ''; - } - return clonedMappedPayload; -} - -module.exports = { - processExtraPayloadParams, -}; diff --git a/src/cdk/v1/lytics/config.yaml b/src/cdk/v1/lytics/config.yaml deleted file mode 100644 index 14f2f79ddb..0000000000 --- a/src/cdk/v1/lytics/config.yaml +++ /dev/null @@ -1,53 +0,0 @@ -message: - supportedMessageTypes: - - identify - - page - - screen - - track - identify: - transformation: - mapperPath: ./mappings/identify.yaml - postMapper: - name: cleanResponse - response: - endpoint: 'https://api.lytics.io/collect/json/{{destConfig.stream}}?access_token={{destConfig.apiKey}}' - method: POST - format: JSON - headers: - Content-Type: application/json - - page: - transformation: - mapperPath: ./mappings/page-screen.yaml - postMapper: - name: cleanResponse - response: - endpoint: 'https://api.lytics.io/collect/json/{{destConfig.stream}}?access_token={{destConfig.apiKey}}' - method: POST - format: JSON - headers: - Content-Type: application/json - - screen: - transformation: - mapperPath: ./mappings/page-screen.yaml - postMapper: - name: cleanResponse - response: - endpoint: 'https://api.lytics.io/collect/json/{{destConfig.stream}}?access_token={{destConfig.apiKey}}' - method: POST - format: JSON - headers: - Content-Type: application/json - - track: - transformation: - mapperPath: ./mappings/track.yaml - postMapper: - name: cleanResponse - response: - endpoint: 'https://api.lytics.io/collect/json/{{destConfig.stream}}?access_token={{destConfig.apiKey}}' - method: POST - format: JSON - headers: - Content-Type: application/json diff --git a/src/cdk/v1/lytics/mappings/identify.yaml b/src/cdk/v1/lytics/mappings/identify.yaml deleted file mode 100644 index 388660c3c4..0000000000 --- a/src/cdk/v1/lytics/mappings/identify.yaml +++ /dev/null @@ -1,29 +0,0 @@ -- destKey: user_id - sourceKeys: - - 'userId' - - 'traits.userId' - - 'traits.id' - - 'context.traits.userId' - - 'context.traits.id' - - 'anonymousId' - -- destKey: '...' - sourceKeys: - - 'traits' - - 'context.traits' - metadata: - type: flatJson - -- destKey: first_name - sourceKeys: - - traits.firstName - - traits.firstname - - context.traits.firstName - - context.traits.firstname - -- destKey: last_name - sourceKeys: - - traits.lastName - - traits.lastname - - context.traits.lastName - - context.traits.lastname diff --git a/src/cdk/v1/lytics/mappings/page-screen.yaml b/src/cdk/v1/lytics/mappings/page-screen.yaml deleted file mode 100644 index 78fada65f0..0000000000 --- a/src/cdk/v1/lytics/mappings/page-screen.yaml +++ /dev/null @@ -1,17 +0,0 @@ -- destKey: event - sourceKeys: name - -- destKey: '...' - sourceKeys: properties - metadata: - type: flatJson - -- destKey: first_name - sourceKeys: - - properties.firstName - - properties.firstname - -- destKey: last_name - sourceKeys: - - properties.lastName - - properties.lastname diff --git a/src/cdk/v1/lytics/mappings/track.yaml b/src/cdk/v1/lytics/mappings/track.yaml deleted file mode 100644 index fdc24f16fc..0000000000 --- a/src/cdk/v1/lytics/mappings/track.yaml +++ /dev/null @@ -1,17 +0,0 @@ -- destKey: _e - sourceKeys: event - -- destKey: '...' - sourceKeys: properties - metadata: - type: flatJson - -- destKey: first_name - sourceKeys: - - properties.firstName - - properties.firstname - -- destKey: last_name - sourceKeys: - - properties.lastName - - properties.lastname diff --git a/src/cdk/v1/lytics/transform.js b/src/cdk/v1/lytics/transform.js deleted file mode 100644 index e31d0733c6..0000000000 --- a/src/cdk/v1/lytics/transform.js +++ /dev/null @@ -1,23 +0,0 @@ -const { Utils } = require('rudder-transformer-cdk'); - -const forFirstName = ['firstname', 'firstName']; -const forLastName = ['lastname', 'lastName']; - -function cleanResponse(event, mappedPayload) { - // Here basically we have a requirement wherein - // we have to remove certain properties from the final payload - const flattenedPayload = Utils.removeUndefinedAndNullValues(mappedPayload); - forFirstName.forEach((key) => { - if (flattenedPayload[key]) { - delete flattenedPayload[key]; - } - }); - forLastName.forEach((key) => { - if (flattenedPayload[key]) { - delete flattenedPayload[key]; - } - }); - return flattenedPayload; -} - -module.exports = { cleanResponse }; diff --git a/src/cdk/v1/new_relic/config.yaml b/src/cdk/v1/new_relic/config.yaml deleted file mode 100644 index d6f04b989f..0000000000 --- a/src/cdk/v1/new_relic/config.yaml +++ /dev/null @@ -1,15 +0,0 @@ -message: - supportedMessageTypes: - - track - track: - transformation: - mapperPath: ./mapping/track.yaml - postMapper: - name: 'commonPostMapper' - response: - endpoint: '{{ rudderContext.endpoint }}' - method: POST - format: JSON - headers: - Api-Key: '{{ rudderContext.insertKey }}' - Content-Type: 'application/json' diff --git a/src/cdk/v1/new_relic/mapping/track.yaml b/src/cdk/v1/new_relic/mapping/track.yaml deleted file mode 100644 index 6a4a9f04f3..0000000000 --- a/src/cdk/v1/new_relic/mapping/track.yaml +++ /dev/null @@ -1,14 +0,0 @@ -- destKey: 'event' - sourceKeys: event - -- destKey: '...' - sourceKeys: properties - metadata: - type: flatJson - -- destKey: 'timestamp' - sourceKeys: - - 'timestamp' - - 'originalTimestamp' - metadata: - type: 'secondTimestamp' diff --git a/src/cdk/v1/new_relic/transform.js b/src/cdk/v1/new_relic/transform.js deleted file mode 100644 index 43cebd548f..0000000000 --- a/src/cdk/v1/new_relic/transform.js +++ /dev/null @@ -1,112 +0,0 @@ -/* eslint-disable no-param-reassign */ -const { isBoolean } = require('lodash'); -const { Utils } = require('rudder-transformer-cdk'); - -function commonPostMapper(event, mappedPayload, rudderContext) { - const { message, destination } = event; - const payload = mappedPayload; - const destConfig = destination.Config; - const reservedNrqlWords = [ - 'ago', - 'and', - 'as', - 'auto', - 'begin', - 'begintime', - 'compare', - 'day', - 'days', - 'end', - 'endtime', - 'explain', - 'facet', - 'from', - 'hour', - 'hours', - 'in', - 'is', - 'like', - 'limit', - 'minute', - 'minutes', - 'month', - 'months', - 'not', - 'null', - 'offset', - 'or', - 'raw', - 'second', - 'seconds', - 'select', - 'since', - 'timeseries', - 'until', - 'week', - 'weeks', - 'where', - 'with', - ]; - const reservedWords = ['accountId', 'appId', 'eventType']; - - Object.keys(payload).forEach((item) => { - if (reservedNrqlWords.includes(item) && isBoolean(payload[item])) { - const str = `'${item}'`; - payload[str] = payload[item].toString(); - delete payload[item]; - } else if (reservedNrqlWords.includes(item)) { - const str = `'${item}'`; - payload[str] = payload[item]; - delete payload[item]; - } else if (reservedWords.includes(item)) { - delete payload[item]; - } else if (isBoolean(payload[item])) { - payload[item] = payload[item].toString(); - } - }); - - // If user provided a eventType name, then we will include it in the payload directly - if (destConfig.customEventType) { - payload.eventType = destConfig.customEventType; - } else { - // If eventType is not provided by the user, by default it is 'rudderstack' - payload.eventType = 'rudderstack'; - } - - // If user enables 'sendUserIdanonymousId', then we include userId and anonymousId into the payload - if (destConfig.sendUserIdanonymousId) { - if (message.userId || message.context.userId || message.context.id) { - payload.userId = message.userId; - } - if (message.anonymousId) { - payload.anonymousId = message.anonymousId; - } - } - - // Upon users choice for data center, we are updating the endpoint accordingly - rudderContext.endpoint = - destConfig.dataCenter === 'eu' - ? `https://insights-collector.eu01.nr-data.net/v1/accounts/${destConfig.accountId}/events` - : `https://insights-collector.newrelic.com/v1/accounts/${destConfig.accountId}/events`; - - rudderContext.insertKey = destConfig.insertKey; - - // If user enables 'sendDeviceContext', then we are delimiting context fields and include them in responseBody - let flattenedContext = {}; - let responseBody; - if (destConfig.sendDeviceContext) { - flattenedContext = Utils.flattenJson(message.context); - responseBody = { - ...payload, - ...flattenedContext, - }; - } else { - responseBody = { - ...payload, - }; - } - - return responseBody; // this flows onto the next stage in the yaml -} - -module.exports = { commonPostMapper }; diff --git a/src/cdk/v1/statsig/config.yaml b/src/cdk/v1/statsig/config.yaml deleted file mode 100644 index 467629faa1..0000000000 --- a/src/cdk/v1/statsig/config.yaml +++ /dev/null @@ -1,19 +0,0 @@ -message: - supportedMessageTypes: - - identify - - page - - screen - - alias - - track - - group - default: - transformation: - spreadMessage: true - response: - endpoint: 'https://api.statsig.com/v1/webhooks/rudderstack' - method: POST - # based on the format set, we can formulate - format: JSON - headers: - STATSIG-API-KEY: '{{ destConfig.secretKey }}' - content-type: 'application/json' diff --git a/src/cdk/v1/userlist/config.yaml b/src/cdk/v1/userlist/config.yaml deleted file mode 100644 index 19df913fef..0000000000 --- a/src/cdk/v1/userlist/config.yaml +++ /dev/null @@ -1,19 +0,0 @@ -message: - supportedMessageTypes: - - identify - - track - - group - default: - transformation: - # If the mapping mentioned in this yaml doesn't work - # we can make use of postMapper tag and apply the required transformation - mapperPath: ./mapping/userlist_default.yaml - spreadMessage: true - response: - endpoint: 'https://incoming.userlist.com/rudderstack/events' - method: POST - format: JSON - statusCode: 200 # probably this can be removed also. - headers: - Authorization: 'Push {{destConfig.pushKey}}' - Content-Type: 'application/json' diff --git a/src/cdk/v1/userlist/mapping/userlist_default.yaml b/src/cdk/v1/userlist/mapping/userlist_default.yaml deleted file mode 100644 index 0d9b4acade..0000000000 --- a/src/cdk/v1/userlist/mapping/userlist_default.yaml +++ /dev/null @@ -1,8 +0,0 @@ -- destKey: type - sourceKeys: type - metadata: - type: toLowerCase -- destKey: userId - sourceKeys: userIdOnly - sourceFromGenericMap: true - required: true diff --git a/src/cdk/v1/variance/config.yaml b/src/cdk/v1/variance/config.yaml deleted file mode 100644 index 9a38723206..0000000000 --- a/src/cdk/v1/variance/config.yaml +++ /dev/null @@ -1,13 +0,0 @@ -message: - default: - transformation: - spreadMessage: true - mapperPath: ./mappings/default.yaml - response: - format: JSON - method: POST - endpoint: '{{ destConfig.webhookUrl }}' - headers: - authorization: '{{ destConfig.authHeader }}' - content-type: 'application/json' - userId: '{{ message.anonymousId }}' diff --git a/src/cdk/v1/variance/mappings/default.yaml b/src/cdk/v1/variance/mappings/default.yaml deleted file mode 100644 index 5a23b4a931..0000000000 --- a/src/cdk/v1/variance/mappings/default.yaml +++ /dev/null @@ -1,4 +0,0 @@ -- destKey: context.ip - sourceKeys: - - 'context.ip' - - 'request_ip' diff --git a/src/cdk/v1/vitally/config.yaml b/src/cdk/v1/vitally/config.yaml deleted file mode 100644 index c7edbacca2..0000000000 --- a/src/cdk/v1/vitally/config.yaml +++ /dev/null @@ -1,15 +0,0 @@ -message: - supportedMessageTypes: - - track - - identify - - group - default: - transformation: - spreadMessage: true - response: - format: JSON - method: POST - endpoint: 'https://api.vitally.io/rudderstack' - headers: - authorization: 'Basic {{ destConfig.apiKeyVitally }}' - content-type: 'application/json' diff --git a/src/cdk/v1/zapier/config.yaml b/src/cdk/v1/zapier/config.yaml deleted file mode 100644 index 52f9317587..0000000000 --- a/src/cdk/v1/zapier/config.yaml +++ /dev/null @@ -1,16 +0,0 @@ -message: - supportedMessageTypes: - - track - - page - - screen - default: - transformation: - spreadMessage: true - postMapper: - name: 'commonPostMapper' - response: - format: JSON - method: POST - endpoint: '{{ rudderContext.zapUrl }}' - headers: - content-type: 'application/json' diff --git a/src/cdk/v1/zapier/transform.js b/src/cdk/v1/zapier/transform.js deleted file mode 100644 index d99c3af315..0000000000 --- a/src/cdk/v1/zapier/transform.js +++ /dev/null @@ -1,43 +0,0 @@ -/* eslint-disable no-param-reassign */ -const { getHashFromArray } = require('../../../v0/util'); - -function commonPostMapper(event, mappedPayload, rudderContext) { - const { message, destination } = event; - const destConfig = destination.Config; - - const { trackEventsToZap, pageScreenEventsToZap, zapUrl } = destConfig; - - const trackEventsMap = getHashFromArray(trackEventsToZap); - const pageScreenEventsMap = getHashFromArray(pageScreenEventsToZap); - - // default Zap URL - rudderContext.zapUrl = zapUrl; - - // track event - if (message?.type === 'track') { - const eventName = message?.event; - // checking if the event is present track events mapping - if (trackEventsMap[eventName]) { - // if present, we are updating the zapUrl(with one specified in the mapping) - rudderContext.zapUrl = trackEventsMap[eventName]; - } - } - - // page/screen event - if (message?.type === 'page' || message?.type === 'screen') { - const pageScreenName = message?.name; - // checking if the event is present page/screen events mapping - if (pageScreenEventsMap[pageScreenName]) { - // if present, we are updating the zapUrl(with the one specified in the mapping) - rudderContext.zapUrl = pageScreenEventsMap[pageScreenName]; - } - } - - const responseBody = { - ...mappedPayload, - }; - - return responseBody; // this flows onto the next stage in the yaml -} - -module.exports = { commonPostMapper }; diff --git a/src/helpers/__tests__/serviceSelector.test.ts b/src/helpers/__tests__/serviceSelector.test.ts index c48d6bbe8b..0dab906f7a 100644 --- a/src/helpers/__tests__/serviceSelector.test.ts +++ b/src/helpers/__tests__/serviceSelector.test.ts @@ -1,9 +1,8 @@ -import { ServiceSelector } from '../serviceSelector'; import { INTEGRATION_SERVICE } from '../../routes/utils/constants'; -import { ProcessorTransformationRequest } from '../../types/index'; -import { CDKV1DestinationService } from '../../services/destination/cdkV1Integration'; import { CDKV2DestinationService } from '../../services/destination/cdkV2Integration'; import { NativeIntegrationDestinationService } from '../../services/destination/nativeIntegration'; +import { ProcessorTransformationRequest } from '../../types/index'; +import { ServiceSelector } from '../serviceSelector'; afterEach(() => { jest.clearAllMocks(); @@ -27,20 +26,6 @@ describe('ServiceSelector Service', () => { ); }); - test('isCdkDestination should return true', async () => { - const destinationDefinitionConfig = { - cdkEnabled: true, - }; - expect(ServiceSelector['isCdkDestination'](destinationDefinitionConfig)).toBe(true); - }); - - test('isCdkDestination should return false', async () => { - const destinationDefinitionConfig = { - cdkEnabledXYZ: true, - }; - expect(ServiceSelector['isCdkDestination'](destinationDefinitionConfig)).toBe(false); - }); - test('isCdkV2Destination should return true', async () => { const destinationDefinitionConfig = { cdkV2Enabled: true, @@ -55,23 +40,6 @@ describe('ServiceSelector Service', () => { expect(ServiceSelector['isCdkV2Destination'](destinationDefinitionConfig)).toBe(false); }); - test('getPrimaryDestinationService should return cdk v1 dest service', async () => { - const events = [ - { - destination: { - DestinationDefinition: { - Config: { - cdkEnabled: true, - }, - }, - }, - }, - ] as ProcessorTransformationRequest[]; - expect(ServiceSelector['getPrimaryDestinationService'](events)).toBeInstanceOf( - CDKV1DestinationService, - ); - }); - test('getPrimaryDestinationService should return cdk v2 dest service', async () => { const events = [ { diff --git a/src/helpers/serviceSelector.ts b/src/helpers/serviceSelector.ts index faa1c58240..a1f6a43349 100644 --- a/src/helpers/serviceSelector.ts +++ b/src/helpers/serviceSelector.ts @@ -1,29 +1,23 @@ import { PlatformError } from '@rudderstack/integrations-lib'; -import { ProcessorTransformationRequest, RouterTransformationRequestData } from '../types/index'; +import { DestinationService } from '../interfaces/DestinationService'; +import { SourceService } from '../interfaces/SourceService'; import { INTEGRATION_SERVICE } from '../routes/utils/constants'; -import { CDKV1DestinationService } from '../services/destination/cdkV1Integration'; +import { ComparatorService } from '../services/comparator'; import { CDKV2DestinationService } from '../services/destination/cdkV2Integration'; -import { DestinationService } from '../interfaces/DestinationService'; import { NativeIntegrationDestinationService } from '../services/destination/nativeIntegration'; -import { SourceService } from '../interfaces/SourceService'; import { NativeIntegrationSourceService } from '../services/source/nativeIntegration'; -import { ComparatorService } from '../services/comparator'; +import { ProcessorTransformationRequest, RouterTransformationRequestData } from '../types/index'; import { FixMe } from '../util/types'; export class ServiceSelector { private static serviceMap: Map = new Map(); private static services = { - [INTEGRATION_SERVICE.CDK_V1_DEST]: CDKV1DestinationService, [INTEGRATION_SERVICE.CDK_V2_DEST]: CDKV2DestinationService, [INTEGRATION_SERVICE.NATIVE_DEST]: NativeIntegrationDestinationService, [INTEGRATION_SERVICE.NATIVE_SOURCE]: NativeIntegrationSourceService, }; - private static isCdkDestination(destinationDefinitionConfig: FixMe) { - return !!destinationDefinitionConfig?.cdkEnabled; - } - private static isCdkV2Destination(destinationDefinitionConfig: FixMe) { return Boolean(destinationDefinitionConfig?.cdkV2Enabled); } @@ -68,9 +62,6 @@ export class ServiceSelector { ): DestinationService { const destinationDefinitionConfig: FixMe = events[0]?.destination?.DestinationDefinition?.Config; - if (this.isCdkDestination(destinationDefinitionConfig)) { - return this.fetchCachedService(INTEGRATION_SERVICE.CDK_V1_DEST); - } if (this.isCdkV2Destination(destinationDefinitionConfig)) { return this.fetchCachedService(INTEGRATION_SERVICE.CDK_V2_DEST); } diff --git a/src/legacy/router.js b/src/legacy/router.js index 6cf035350c..60f786e225 100644 --- a/src/legacy/router.js +++ b/src/legacy/router.js @@ -18,7 +18,6 @@ const { isNonFuncObject, getMetadata, generateErrorObject, - isCdkDestination, checkAndCorrectUserId, } = require('../v0/util'); const { processDynamicConfig } = require('../util/dynamicConfig'); @@ -35,12 +34,9 @@ const { sendViolationMetrics, constructValidationErrors, } = require('../util/utils'); -const { processCdkV1 } = require('../cdk/v1/handler'); const { extractLibraries } = require('../util/customTransformer'); const { getCompatibleStatusCode } = require('../adapters/utils/networkUtils'); -const CDK_V1_DEST_PATH = 'cdk/v1'; - const transformerMode = process.env.TRANSFORMER_MODE; const startDestTransformer = transformerMode === 'destination' || !transformerMode; @@ -157,14 +153,11 @@ async function handleDest(ctx, version, destination) { parsedEvent.request = { query: reqParams }; parsedEvent = processDynamicConfig(parsedEvent); let respEvents; - if (isCdkDestination(parsedEvent)) { - respEvents = await processCdkV1(destination, parsedEvent); - } else { - if (destHandler === null) { - destHandler = getDestHandler(version, destination); - } - respEvents = await handleV0Destination(destHandler.process, [parsedEvent]); + if (destHandler === null) { + destHandler = getDestHandler(version, destination); } + respEvents = await handleV0Destination(destHandler.process, [parsedEvent]); + if (respEvents) { if (!Array.isArray(respEvents)) { respEvents = [respEvents]; @@ -185,12 +178,8 @@ async function handleDest(ctx, version, destination) { } catch (error) { logger.error(error); - let implementation = tags.IMPLEMENTATIONS.NATIVE; - let errCtx = 'Processor Transformation'; - if (isCdkDestination(event)) { - errCtx = `CDK - ${errCtx}`; - implementation = tags.IMPLEMENTATIONS.CDK_V1; - } + const implementation = tags.IMPLEMENTATIONS.NATIVE; + const errCtx = 'Processor Transformation'; const errObj = generateErrorObject(error, { [tags.TAG_NAMES.DEST_TYPE]: destination.toUpperCase(), @@ -432,7 +421,6 @@ async function routerHandleDest(ctx) { if (startDestTransformer) { SUPPORTED_VERSIONS.forEach((version) => { const destinations = getIntegrations(path.resolve(__dirname, `../${version}/destinations`)); - destinations.push(...getIntegrations(path.resolve(__dirname, `../${CDK_V1_DEST_PATH}`))); destinations.forEach((destination) => { // eg. v0/destinations/ga router.post(`/${version}/destinations/${destination}`, async (ctx) => { diff --git a/src/services/destination/cdkV1Integration.ts b/src/services/destination/cdkV1Integration.ts deleted file mode 100644 index c6e60f5857..0000000000 --- a/src/services/destination/cdkV1Integration.ts +++ /dev/null @@ -1,134 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -import { ConfigFactory, Executor, RudderBaseConfig } from 'rudder-transformer-cdk'; -import path from 'path'; -import { TransformationError } from '@rudderstack/integrations-lib'; -import { DestinationService } from '../../interfaces/DestinationService'; -import { - DeliveryV0Response, - ErrorDetailer, - MetaTransferObject, - ProcessorTransformationRequest, - ProcessorTransformationResponse, - RouterTransformationRequestData, - RouterTransformationResponse, - UserDeletionRequest, - UserDeletionResponse, - ProxyRequest, - DeliveryV1Response, -} from '../../types/index'; -import { DestinationPostTransformationService } from './postTransformation'; -import tags from '../../v0/util/tags'; -import { getErrorInfo } from '../../cdk/v1/handler'; -import { CatchErr } from '../../util/types'; - -export class CDKV1DestinationService implements DestinationService { - public init() { - ConfigFactory.init({ - basePath: path.resolve(__dirname, '../../cdk/v1'), - loggingMode: 'production', - }); - } - - public getName(): string { - return 'CDK_V1'; - } - - public getTags( - destType: string, - destinationId: string, - workspaceId: string, - feature: string, - ): MetaTransferObject { - const metaTO = { - errorDetails: { - destType: destType.toUpperCase(), - module: tags.MODULES.DESTINATION, - implementation: tags.IMPLEMENTATIONS.CDK_V1, - feature, - destinationId, - workspaceId, - } as ErrorDetailer, - errorContext: '[CDKV1 Integration Service] Failure During Proc Transform', - } as MetaTransferObject; - return metaTO; - } - - private async processCDKV1(event: any, tfConfig: RudderBaseConfig): Promise { - try { - const respEvents = await Executor.execute(event, tfConfig); - return respEvents; - } catch (error) { - throw getErrorInfo(error); - } - } - - public async doProcessorTransformation( - events: ProcessorTransformationRequest[], - destinationType: string, - _version: string, - _requestMetadata: NonNullable, - ): Promise { - const tfConfig = await ConfigFactory.getConfig(destinationType); - const respList: ProcessorTransformationResponse[][] = await Promise.all( - events.map(async (event) => { - try { - const transformedPayloads: any = await this.processCDKV1(event as any, tfConfig); - // We are not passing destinationHandler to post processor as we don't have post processing in CDK flows - return DestinationPostTransformationService.handleProcessorTransformSucessEvents( - event, - transformedPayloads, - undefined, - ); - } catch (error: CatchErr) { - const metaTO = this.getTags( - destinationType, - event.metadata.destinationId, - event.metadata.workspaceId, - tags.FEATURES.PROCESSOR, - ); - metaTO.metadata = event.metadata; - const erroredResp = - DestinationPostTransformationService.handleProcessorTransformFailureEvents( - error, - metaTO, - ); - return [erroredResp]; - } - }), - ); - return respList.flat(); - } - - public doRouterTransformation( - _events: RouterTransformationRequestData[], - _destinationType: string, - _version: string, - _requestMetadata: NonNullable, - ): Promise { - throw new TransformationError('CDKV1 Does not Implement Router Transform Routine'); - } - - public doBatchTransformation( - _events: RouterTransformationRequestData[], - _destinationType: string, - _version: any, - _requestMetadata: NonNullable, - ): RouterTransformationResponse[] { - throw new TransformationError('CDKV1 Does not Implement Batch Transform Routine'); - } - - public deliver( - _event: ProxyRequest, - _destinationType: string, - _requestMetadata: NonNullable, - ): Promise { - throw new TransformationError('CDV1 Does not Implement Delivery Routine'); - } - - public processUserDeletion( - requests: UserDeletionRequest[], - rudderDestInfo: string, - ): Promise { - throw new TransformationError('CDV1 Does not Implement Deletion Routine'); - } -} diff --git a/src/util/types.ts b/src/util/types.ts index bd2836d710..549003f79a 100644 --- a/src/util/types.ts +++ b/src/util/types.ts @@ -7,7 +7,6 @@ export type ContextBodySimple = { destType: string; }; export interface Config { - cdkEnabled?: boolean; cdkV2Enabled?: boolean; comparisonTestEnabeld?: boolean; comparisonService?: string; diff --git a/src/v0/util/index.js b/src/v0/util/index.js index fa6cc34b70..599c116a8c 100644 --- a/src/v0/util/index.js +++ b/src/v0/util/index.js @@ -1625,16 +1625,6 @@ function removeHyphens(str) { return str.replace(/-/g, ''); } -function isCdkDestination(event) { - // TODO: maybe dont need all these checks in place - return ( - event.destination && - event.destination.DestinationDefinition && - event.destination.DestinationDefinition.Config && - event.destination.DestinationDefinition.Config.cdkEnabled - ); -} - /** * This function helps to remove any invalid object values from the config generated by dynamicForm, * dynamicCustomForm, and dynamicSelectForm web app form elements. @@ -2348,7 +2338,6 @@ module.exports = { hashToSha256, isAppleFamily, isBlank, - isCdkDestination, isDefined, isDefinedAndNotNull, isDefinedAndNotNullAndNotEmpty, diff --git a/src/v0/util/tags.js b/src/v0/util/tags.js index dce8c0a338..1fdb5ddef2 100644 --- a/src/v0/util/tags.js +++ b/src/v0/util/tags.js @@ -24,7 +24,6 @@ const MODULES = { const IMPLEMENTATIONS = { NATIVE: 'native', - CDK_V1: 'cdkV1', CDK_V2: 'cdkV2', }; diff --git a/test/__tests__/cdk_postMapper/autopilot.test.js b/test/__tests__/cdk_postMapper/autopilot.test.js deleted file mode 100644 index 0dde490017..0000000000 --- a/test/__tests__/cdk_postMapper/autopilot.test.js +++ /dev/null @@ -1,60 +0,0 @@ -const { - trackPostMapper, - identifyPostMapper -} = require("../../../src/cdk/v1/autopilot/transform"); - -describe("Unit Test for track postMapper", () => { - it("should update the rudderContext with correct endpoint", () => { - const message = { traits: { email: "test@email.com" } }; - const destination = { Config: { triggerId: "sample-trigger-id" } }; - const event = { message, destination }; - const expectedRudderContext = { - endpoint: `https://api2.autopilothq.com/v1/trigger/sample-trigger-id/contact/test@email.com` - }; - const rudderContext = {}; - trackPostMapper(event, {}, rudderContext); - expect(rudderContext).toEqual(expectedRudderContext); - }); -}); - -describe("Unit Test for identify postMapper", () => { - it("should delete fields from traits", () => { - const message = { - traits: { email: "test@email.com", firstName: "firstName" } - }; - const destination = {}; - const event = { message, destination }; - const payload = { someKey: "here" }; - const expected = { contact: { someKey: "here" } }; - const resp = identifyPostMapper(event, payload, {}); - expect(resp).toEqual(expected); - }); - - it("should delete fields from traits and keep custom values", () => { - const message = { - traits: { - email: "test@email.com", - firstName: "firstName", - something: "custom" - } - }; - const destination = {}; - const event = { message, destination }; - const payload = { someKey: "here" }; - const expected = { - contact: { someKey: "here", custom: { something: "custom" } } - }; - const resp = identifyPostMapper(event, payload, {}); - expect(resp).toEqual(expected); - }); - - it("should not throw error on empty traits", () => { - const message = { traits: {} }; - const destination = {}; - const event = { message, destination }; - const payload = { someKey: "here" }; - const expected = { contact: { someKey: "here" } }; - const resp = identifyPostMapper(event, payload, {}); - expect(resp).toEqual(expected); - }); -}); diff --git a/test/__tests__/cdk_postMapper/dcm_floodlight.test.js b/test/__tests__/cdk_postMapper/dcm_floodlight.test.js deleted file mode 100644 index 9bf7563a8d..0000000000 --- a/test/__tests__/cdk_postMapper/dcm_floodlight.test.js +++ /dev/null @@ -1,106 +0,0 @@ -const { postMapper } = require("../../../src/cdk/v1/dcm_floodlight/transform"); - -describe("Unit Test for postMapper", () => { - it("should update the rudderContext with userAgent and valid endpoint", () => { - const message = { - event: "Checkout Started", - type: "track", - properties: { - orderId: 1234, - quantity: 45, - revenue: 800 - }, - context: { - device: { - advertisingId: "2a3e36d172-5e28-45a1-9eda-ce22a3e36d1a" - }, - userAgent: - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" - } - }; - const destination = { - Config: { - advertiserId: "12649566", - activityTag: "", - groupTag: "", - conversionEvents: [ - { - customVariables: [ - { - from: "", - to: "" - } - ], - eventName: "Sign up Completed", - floodlightActivityTag: "signu0", - floodlightGroupTag: "conv01", - salesTag: false - }, - { - customVariables: [ - { - from: "1", - to: "rudder1" - }, - { - from: "2", - to: "akash1" - } - ], - eventName: "Order Complete", - floodlightActivityTag: "order0", - floodlightGroupTag: "conv000", - salesTag: false - }, - { - eventName: "Checkout Started", - floodlightActivityTag: "check0", - floodlightGroupTag: "conv0000", - salesTag: true - }, - { - customVariables: [ - { - from: "1", - to: "rudder2" - }, - { - from: "2", - to: "akash2" - }, - { - from: "3", - to: "friendlyName2" - }, - { - from: "4", - to: "name2" - } - ], - eventName: "Purchase", - floodlightActivityTag: "Pur0", - floodlightGroupTag: "conv111", - salesTag: false - } - ] - } - }; - const event = { message, destination }; - const payload = { - dc_rdid: "T0T0T072-5e28-45a1-9eda-ce22a3e36d1a", - ord: 111, - qty: 999999, - cost: 800, - dc_lat: "true" - }; - const expectedRudderContext = { - userAgent: - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36", - endpoint: - "https://ad.doubleclick.net/ddm/activity/src=12649566;cat=check0;type=conv0000;dc_rdid=T0T0T072-5e28-45a1-9eda-ce22a3e36d1a;ord=111;qty=999999;cost=800;dc_lat=1" - }; - const rudderContext = {}; - postMapper(event, payload, rudderContext); - expect(rudderContext).toEqual(expectedRudderContext); - }); -}); diff --git a/test/__tests__/cdk_postMapper/heap.test.js b/test/__tests__/cdk_postMapper/heap.test.js deleted file mode 100644 index 440cdb2f6b..0000000000 --- a/test/__tests__/cdk_postMapper/heap.test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { commonPostMapper } = require("../../../src/cdk/v1/heap/transform"); - -describe("Unit test cases for heap common post mapper", () => { - let payload, event, rudderContext; - beforeEach(() => { - payload = { should: "remain", properties: { idempotencyKey: "someKey" } }; - event = { message: {}, destination: { Config: { appId: "app_id" } } }; - rudderContext = {}; - }); - - it("should delete idempotency key from mappedPayload", async () => { - const expectedOutput = { - should: "remain", - app_id: "app_id", - properties: {} - }; - await expect( - commonPostMapper(event, payload, rudderContext) - ).resolves.toMatchObject(expectedOutput); - }); - - it("should mutate the mappedPayload on calling postMapper", async () => { - await expect( - commonPostMapper(event, payload, rudderContext) - ).resolves.toMatchObject({ should: "remain", properties: {} }); - }); -}); diff --git a/test/__tests__/cdk_postMapper/kochava.test.js b/test/__tests__/cdk_postMapper/kochava.test.js deleted file mode 100644 index 67f09faff3..0000000000 --- a/test/__tests__/cdk_postMapper/kochava.test.js +++ /dev/null @@ -1,110 +0,0 @@ -const { - processExtraPayloadParams -} = require("../../../src/cdk/v1/kochava/transform"); - -describe("Unit Test for kochava postMapper", () => { - it("should set all the default values", () => { - const event = { - destination: { - Config: { - apiKey: "" - }, - DestinationDefinition: { - Config: { - cdkEnabled: true - }, - DisplayName: "Kochava", - ID: "1WTpBSTiL3iAUHUdW7rHT4sawgU", - Name: "KOCHAVA" - }, - Enabled: true, - ID: "1WTpIHpH7NTBgjeiUPW1kCUgZGI", - Name: "kochava test", - Transformations: [] - }, - message: { - anonymousId: "sampath", - channel: "web", - context: {}, - event: "product added", - properties: { name: "sampath" }, - type: "track", - event: "eventName" - } - }; - const expected = { - data: { - app_tracking_transparency: { - att: false - }, - device_ver: "", - device_ids: { - idfa: "", - idfv: "", - adid: "", - android_id: "" - }, - event_name: "eventName", - device_ua: "", - currency: "USD" - } - }; - const resp = processExtraPayloadParams(event, {}, {}); - expect(resp).toEqual(expected); - }); - - it("should set all the default values and os_version as empty string", () => { - const event = { - destination: { - Config: { - apiKey: "" - }, - DestinationDefinition: { - Config: { - cdkEnabled: true - }, - DisplayName: "Kochava", - ID: "1WTpBSTiL3iAUHUdW7rHT4sawgU", - Name: "KOCHAVA" - }, - Enabled: true, - ID: "1WTpIHpH7NTBgjeiUPW1kCUgZGI", - Name: "kochava test", - Transformations: [] - }, - message: { - anonymousId: "sampath", - channel: "web", - context: { - os: { - version: "" - } - }, - event: "product added", - properties: { name: "sampath" }, - type: "track", - event: "eventName" - } - }; - const expected = { - data: { - app_tracking_transparency: { - att: false - }, - device_ver: "", - device_ids: { - idfa: "", - idfv: "", - adid: "", - android_id: "" - }, - event_name: "eventName", - device_ua: "", - currency: "USD", - os_version: "" - } - }; - const resp = processExtraPayloadParams(event, {}, {}); - expect(resp).toEqual(expected); - }); -}); diff --git a/test/__tests__/cdk_postMapper/lytics.test.js b/test/__tests__/cdk_postMapper/lytics.test.js deleted file mode 100644 index 0b005155dc..0000000000 --- a/test/__tests__/cdk_postMapper/lytics.test.js +++ /dev/null @@ -1,14 +0,0 @@ -const { cleanResponse } = require("../../../src/cdk/v1/lytics/transform"); - -describe("Test for Lytics common post mapper", () => { - it("should remove both first name and last name from mappedPayload", () => { - const mappedPayload = { - firstname: "somename", - lastName: "lastName", - some: "otherKey" - }; - const resp = cleanResponse({}, mappedPayload, {}); - const expected = { some: "otherKey" }; - expect(resp).toEqual(expected); - }); -}); diff --git a/test/__tests__/cdk_postMapper/new_relic.test.js b/test/__tests__/cdk_postMapper/new_relic.test.js deleted file mode 100644 index 3aab6aaf67..0000000000 --- a/test/__tests__/cdk_postMapper/new_relic.test.js +++ /dev/null @@ -1,86 +0,0 @@ -const { even } = require("is"); -const { commonPostMapper } = require("../../../src/cdk/v1/new_relic/transform"); - -describe("Unit test cases for new_relic common post mapper", () => { - let payload, event, rudderContext, expectedOutput; - beforeEach(() => { - payload = { - event: "first", - timestamp: 1580602989, - abc: "123", - key: 124, - auto: true, - eventType: "standard" - }; - event = { - message: { - userId: "identified user id", - anonymousId: "anon-id-new", - context: { - traits: { trait1: "new-val" }, - ip: "14.5.67.21", - library: { name: "http" } - } - }, - destination: { - Config: { - accountId: "12345", - insertKey: "11111122702j2a2U2K2C7H", - dataCenter: "us", - customEventType: "", - sendDeviceContext: false, - sendUserIdanonymousId: true - } - } - }; - rudderContext = {}; - expectedOutput = { - event: "first", - timestamp: 1580602989, - abc: "123", - key: 124, - eventType: "rudderstack", - userId: "identified user id", - anonymousId: "anon-id-new", - "'auto'": "true" - }; - }); - - it('If user did not provid a eventType name, then we will include "rudderstack" in the payload directly', () => { - // event is manupulated to suit the test-cases - event.destination.Config.sendDeviceContext = false; - expect(commonPostMapper(event, payload, rudderContext)).toEqual( - expectedOutput - ); - }); - - it("If user provides a eventType name, then we will include it in the payload directly", () => { - event.destination.Config.customEventType = "abc"; - // expectedOutput is also manupulated to suit the expectation of the test-case - expectedOutput.eventType = "abc"; - expect(commonPostMapper(event, payload, rudderContext)).toEqual( - expectedOutput - ); - }); - it('when "sendUserIdanonymousId" is false, we do not send userId or anonymousId ', () => { - event.destination.Config.sendUserIdanonymousId = false; - event.destination.Config.customEventType = "abc"; - expectedOutput.eventType = "abc"; - delete expectedOutput.userId; - delete expectedOutput.anonymousId; - expect(commonPostMapper(event, payload, rudderContext)).toEqual( - expectedOutput - ); - }); - - it('when "sendDeviceContext" is true, we will flatten the context and merge with the payload ', () => { - event.destination.Config.sendUserIdanonymousId = true; - event.destination.Config.sendDeviceContext = true; - expectedOutput["traits.trait1"] = "new-val"; - expectedOutput.ip = "14.5.67.21"; - expectedOutput["library.name"] = "http"; - expect(commonPostMapper(event, payload, rudderContext)).toEqual( - expectedOutput - ); - }); -}); diff --git a/test/__tests__/cdk_postMapper/zapier.test.js b/test/__tests__/cdk_postMapper/zapier.test.js deleted file mode 100644 index c12b737afd..0000000000 --- a/test/__tests__/cdk_postMapper/zapier.test.js +++ /dev/null @@ -1,37 +0,0 @@ -const { commonPostMapper } = require("../../../src/cdk/v1/zapier/transform"); - -describe("Unit test cases for zapier common post mapper", () => { - it("should update the rudderContext with default endpoint", () => { - const message = { - type: "track", - userId: "identified user id", - anonymousId: "anon-id-new", - event: "Product Purchased new", - properties: { - name: "Shirt", - revenue: 4.99 - }, - context: { - ip: "14.5.67.21", - library: { - name: "http" - } - }, - timestamp: "2020-02-02T00:23:09.544Z" - }; - const destination = { - Config: { - zapUrl: "zapier.abcd-hook", - trackEventsToZap: {}, - pageScreenEventsToZap: {} - } - }; - const event = { message, destination }; - const expectedRudderContext = { - zapUrl: `zapier.abcd-hook` - }; - const rudderContext = {}; - commonPostMapper(event, {}, rudderContext); - expect(rudderContext).toEqual(expectedRudderContext); - }); -}); diff --git a/test/__tests__/data/versioned_processor_heap_input.json b/test/__tests__/data/versioned_processor_heap_input.json index d9f94fe9b5..901eea3a9f 100644 --- a/test/__tests__/data/versioned_processor_heap_input.json +++ b/test/__tests__/data/versioned_processor_heap_input.json @@ -11,7 +11,7 @@ "ID": "1WTbl0l5GjOQKOvfmcGwk0T49kV", "Name": "HEAP", "Config": { - "cdkEnabled": true + "cdkV2Enabled": true } }, "Enabled": true, @@ -74,7 +74,7 @@ "ID": "1WTbl0l5GjOQKOvfmcGwk0T49kV", "Name": "HEAP", "Config": { - "cdkEnabled": true + "cdkV2Enabled": true } }, "Enabled": true, @@ -138,7 +138,7 @@ "ID": "1WTbl0l5GjOQKOvfmcGwk0T49kV", "Name": "HEAP", "Config": { - "cdkEnabled": true + "cdkV2Enabled": true } }, "Enabled": true, @@ -204,7 +204,7 @@ "ID": "1WTbl0l5GjOQKOvfmcGwk0T49kV", "Name": "HEAP", "Config": { - "cdkEnabled": true + "cdkV2Enabled": true } }, "Enabled": true, @@ -272,7 +272,7 @@ "ID": "1WTbl0l5GjOQKOvfmcGwk0T49kV", "Name": "HEAP", "Config": { - "cdkEnabled": true + "cdkV2Enabled": true } }, "Enabled": true, @@ -340,7 +340,7 @@ "ID": "1WTbl0l5GjOQKOvfmcGwk0T49kV", "Name": "HEAP", "Config": { - "cdkEnabled": true + "cdkV2Enabled": true } }, "Enabled": true, diff --git a/test/__tests__/data/versioned_processor_heap_output.json b/test/__tests__/data/versioned_processor_heap_output.json index 3041a6f35c..73ef473017 100644 --- a/test/__tests__/data/versioned_processor_heap_output.json +++ b/test/__tests__/data/versioned_processor_heap_output.json @@ -139,7 +139,7 @@ "ID": "1WTbl0l5GjOQKOvfmcGwk0T49kV", "Name": "HEAP", "Config": { - "cdkEnabled": true + "cdkV2Enabled": true } }, "Enabled": true, @@ -153,7 +153,7 @@ "errorCategory": "dataValidation", "errorType": "instrumentation", "feature": "processor", - "implementation": "cdkV1", + "implementation": "cdkV", "module": "destination", "destType": "HEAP" } @@ -171,7 +171,7 @@ "ID": "1WTbl0l5GjOQKOvfmcGwk0T49kV", "Name": "HEAP", "Config": { - "cdkEnabled": true + "cdkV2Enabled": true } }, "Enabled": true, @@ -184,7 +184,7 @@ "statTags": { "errorCategory": "transformation", "feature": "processor", - "implementation": "cdkV1", + "implementation": "cdkV2", "module": "destination", "destType": "HEAP" } diff --git a/test/__tests__/utilities/test-utils.js b/test/__tests__/utilities/test-utils.js deleted file mode 100644 index 4d5d7fc909..0000000000 --- a/test/__tests__/utilities/test-utils.js +++ /dev/null @@ -1,135 +0,0 @@ -const fs = require("fs"); -const _ = require("lodash"); -const path = require("path"); -const { ConfigFactory, Executor } = require("rudder-transformer-cdk"); -const { assertRouterOutput } = require('../../testHelper'); - -// TODO: separate this out later as the list grows -const cdkEnabledDestinations = { - variance: true, - autopilot: true, - heap: true, - userlist: true, - lytics: true, - kochava: true, - statsig: true, - new_relic: true, - zapier: true, - vitally: true -}; - -function getDestFromTestFile(filePath) { - const filePathArr = filePath.split("/"); - return filePathArr[filePathArr.length - 1].replace(".test.js", ""); -} - -function formTestParams(dest, transformAt) { - //for router test - let trCat = ""; - if (transformAt === "router") { - trCat += "router_"; - } - const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `../data/${dest}_${trCat}input.json`) - ); - const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `../data/${dest}_${trCat}output.json`) - ); - const inputData = JSON.parse(inputDataFile); - const expected = JSON.parse(outputDataFile); - return { - input: inputData, - expected, - iscdkDest: cdkEnabledDestinations[dest] - }; -} - -function routerCommonformTestParams() { - const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `../data/routerCommonInput.json`) - ); - const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `../data/routerCommonOutput.json`) - ); - - const inputData = JSON.parse(inputDataFile); - const expected = JSON.parse(outputDataFile); - return { - commonInput: inputData, - commonExpected: expected - }; -} - -function fetchCdkStageFromConfig(destination) { - let cdkEnabled = false; - if ( - destination.DestinationDefinition && - destination.DestinationDefinition.Config && - destination.DestinationDefinition.Config.cdkEnabled - ) { - cdkEnabled = destination.DestinationDefinition.Config.cdkEnabled; - } - return cdkEnabled; -} - -function executeTransformationTest(dest, transformAt) { - const testParams = formTestParams(dest, transformAt); - const routerCommonTestParams = routerCommonformTestParams(); - const { iscdkDest, expected, input } = testParams; - const { commonInput, commonExpected } = routerCommonTestParams; - const basePath = path.resolve(__dirname, "../../../src/cdk/v1"); - ConfigFactory.init({ basePath, loggingMode: "production" }); - - describe(`${dest} ${transformAt} tests`, () => { - input.map((tcInput, index) => { - const cdkEnabled = fetchCdkStageFromConfig(tcInput.destination); - return it(`${dest} ${transformAt} tests - ${index}`, async () => { - let actualData; - try { - if ((iscdkDest || cdkEnabled) && transformAt === "processor") { - const baseConfig = await ConfigFactory.getConfig(dest); - // We currently support processor transformation only in CDK - actualData = await Executor.execute(tcInput, baseConfig); - } else { - const version = "v0"; - const transformer = require(`../../../src/${version}/destinations/${dest}/transform`); - if (transformAt == "processor") { - actualData = await transformer.process(tcInput); - } else { - actual = await transformer.processRouterDest([tcInput]) - assertRouterOutput(actual, [tcInput]); - actualData = (actual)[0]; - } - } - // Compare actual and expected data - expect(actualData).toEqual(expected[index]); - } catch (error) { - // Force fail the test case if the expected exception is not raised - expect(error.message).toEqual(expected[index].error); - } - }); - }); - }); - if (transformAt == "router") { - describe(`${dest} ${transformAt} Common tests`, () => { - it(`${dest} ${transformAt} Common tests`, async () => { - let actualData; - try { - const version = "v0"; - const transformer = require(`../../../src/${version}/destinations/${dest}/transform`); - actualData = await transformer.processRouterDest(commonInput); - assertRouterOutput(actualData, commonInput); - const cloneActual = _.cloneDeep(actualData); - cloneActual[0].statTags = "undefined"; - // Compare actual and expected data - expect(cloneActual).toEqual(commonExpected); - } catch (error) { - // Force fail the test case if the expected exception is not raised - expect(error.message).toEqual(commonExpected); - } - }); - }); - } -} - -module.exports = { getDestFromTestFile, executeTransformationTest }; diff --git a/test/apitests/data_scenarios/cdk_v1/failure.json b/test/apitests/data_scenarios/cdk_v1/failure.json index df45006d84..d2ec384efa 100644 --- a/test/apitests/data_scenarios/cdk_v1/failure.json +++ b/test/apitests/data_scenarios/cdk_v1/failure.json @@ -77,7 +77,7 @@ "Name": "ZAPIER", "DisplayName": "Zapier", "Config": { - "cdkEnabled": true, + "cdkV2Enabled": true, "destConfig": { "defaultConfig": ["zapUrl", "trackEventsToZap", "pageScreenEventsToZap"] }, @@ -154,7 +154,7 @@ "errorCategory": "transformation", "destType": "ZAPIER", "module": "destination", - "implementation": "cdkV1", + "implementation": "cdkV2", "feature": "processor", "destinationId": "2JVZ3owjdCdDajoiZwWgJbR9y0q", "workspaceId": "27O0bhB6p5ehfOWeeZlOSsSDTLg" diff --git a/test/apitests/data_scenarios/cdk_v1/success.json b/test/apitests/data_scenarios/cdk_v1/success.json index 68d68a2b5f..34151040a3 100644 --- a/test/apitests/data_scenarios/cdk_v1/success.json +++ b/test/apitests/data_scenarios/cdk_v1/success.json @@ -77,7 +77,7 @@ "Name": "ZAPIER", "DisplayName": "Zapier", "Config": { - "cdkEnabled": true, + "cdkV2Enabled": true, "destConfig": { "defaultConfig": ["zapUrl", "trackEventsToZap", "pageScreenEventsToZap"] }, diff --git a/test/apitests/service.api.test.ts b/test/apitests/service.api.test.ts index e46357f824..b4ed8d3b09 100644 --- a/test/apitests/service.api.test.ts +++ b/test/apitests/service.api.test.ts @@ -604,28 +604,6 @@ describe('Source api tests', () => { }); }); -describe('CDK V1 api tests', () => { - test('(zapier) successful transform', async () => { - const data = getDataFromPath('./data_scenarios/cdk_v1/success.json'); - const response = await request(server) - .post('/v0/destinations/zapier') - .set('Accept', 'application/json') - .send(data.input); - expect(response.status).toEqual(200); - expect(JSON.parse(response.text)).toEqual(data.output); - }); - - test('(zapier) failure transform', async () => { - const data = getDataFromPath('./data_scenarios/cdk_v1/failure.json'); - const response = await request(server) - .post('/v0/destinations/zapier') - .set('Accept', 'application/json') - .send(data.input); - expect(response.status).toEqual(200); - expect(JSON.parse(response.text)).toEqual(data.output); - }); -}); - describe('CDK V2 api tests', () => { test('(pinterest_tag) successful transform', async () => { const data = getDataFromPath('./data_scenarios/cdk_v2/success.json'); diff --git a/test/integrations/destinations/statsig/processor/data.ts b/test/integrations/destinations/statsig/processor/data.ts index c76ce506dc..2602764032 100644 --- a/test/integrations/destinations/statsig/processor/data.ts +++ b/test/integrations/destinations/statsig/processor/data.ts @@ -312,7 +312,7 @@ export const data = [ destination: { DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, }, Config: { @@ -734,7 +734,7 @@ export const data = [ destination: { DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, }, Config: { @@ -1142,7 +1142,7 @@ export const data = [ destination: { DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, }, Config: { @@ -1466,7 +1466,7 @@ export const data = [ destination: { DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, }, Config: { @@ -1488,13 +1488,13 @@ export const data = [ { statusCode: 400, error: - 'Bad event. Original error: message type "NOT_A_TYPE" not supported for "statsig"', + 'message type NOT_A_TYPE is not supported: Workflow: procWorkflow, Step: validateInput, ChildStep: undefined, OriginalError: message type NOT_A_TYPE is not supported', statTags: { errorCategory: 'dataValidation', errorType: 'instrumentation', destType: 'STATSIG', module: 'destination', - implementation: 'cdkV1', + implementation: 'cdkV2', destinationId: 'd1', workspaceId: 'w1', feature: 'processor', diff --git a/test/integrations/destinations/variance/processor/data.ts b/test/integrations/destinations/variance/processor/data.ts index ae33b75e5f..f4f3054296 100644 --- a/test/integrations/destinations/variance/processor/data.ts +++ b/test/integrations/destinations/variance/processor/data.ts @@ -350,7 +350,7 @@ export const data = [ destination: { DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, }, Config: { @@ -819,7 +819,7 @@ export const data = [ destination: { DestinationDefinition: { Config: { - cdkEnabled: true, + cdkV2Enabled: true, }, }, Config: {