From c02370e38fabb581698baa00e1ddd3da93dc07fa Mon Sep 17 00:00:00 2001 From: Anant Jain <62471433+anantjain45823@users.noreply.github.com> Date: Thu, 9 Nov 2023 20:26:15 +0530 Subject: [PATCH 1/4] fix: shopify redis metric when there is no data returned for a key (#2811) fix: shopfify redis metric when there is no data returned for a key --- src/v0/sources/shopify/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v0/sources/shopify/util.js b/src/v0/sources/shopify/util.js index 0d81ddc185..2521e9cb9d 100644 --- a/src/v0/sources/shopify/util.js +++ b/src/v0/sources/shopify/util.js @@ -32,7 +32,7 @@ const getDataFromRedis = async (key, metricMetadata) => { ...metricMetadata, }); const redisData = await RedisDB.getVal(key); - if (redisData === null) { + if (redisData === null || (typeof redisData === "object" && Object.keys(redisData).length === 0)) { stats.increment('shopify_redis_no_val', { ...metricMetadata, }); From 8eb1e1d482923004e2f3357e4163a8ea95b9e183 Mon Sep 17 00:00:00 2001 From: Gauravudia <60897972+Gauravudia@users.noreply.github.com> Date: Fri, 10 Nov 2023 12:16:32 +0530 Subject: [PATCH 2/4] chore: import error classes from integrations lib (#2719) --- package-lock.json | 35 ++++++-- package.json | 1 + .../networkhandler/genericNetworkHandler.js | 2 +- src/adapters/utils/networkUtils.js | 2 +- src/cdk/v1/autopilot/transform.js | 2 +- src/cdk/v1/dcm_floodlight/transform.js | 2 +- src/cdk/v1/handler.js | 8 +- src/cdk/v2/bindings/default.js | 2 +- .../v2/destinations/dcm_floodlight/utils.js | 2 +- src/cdk/v2/utils.ts | 2 +- src/helpers/serviceSelector.ts | 2 +- src/services/destination/cdkV1Integration.ts | 2 +- src/services/destination/cdkV2Integration.ts | 2 +- src/util/errorNotifier/bugsnag.js | 9 +- src/util/redis/redisConnector.js | 2 +- .../destinations/active_campaign/transform.js | 10 +-- src/v0/destinations/active_campaign/util.js | 2 +- src/v0/destinations/adj/transform.js | 10 +-- .../destinations/adobe_analytics/transform.js | 10 +-- src/v0/destinations/adobe_analytics/utils.js | 8 +- src/v0/destinations/af/deleteUsers.js | 6 +- src/v0/destinations/af/transform.js | 2 +- src/v0/destinations/airship/transform.js | 2 +- src/v0/destinations/algolia/transform.js | 4 +- src/v0/destinations/algolia/util.js | 2 +- src/v0/destinations/am/deleteUsers.js | 2 +- src/v0/destinations/am/transform.js | 3 +- src/v0/destinations/appcues/transform.js | 2 +- .../destinations/attentive_tag/transform.js | 2 +- src/v0/destinations/attentive_tag/util.js | 2 +- src/v0/destinations/attribution/transform.js | 2 +- src/v0/destinations/autopilot/transform.js | 2 +- src/v0/destinations/awin/transform.js | 2 +- .../destinations/azure_event_hub/transform.js | 1 - src/v0/destinations/blueshift/transform.js | 10 +-- src/v0/destinations/bqstream/transform.js | 2 +- src/v0/destinations/branch/transform.js | 2 +- src/v0/destinations/braze/deleteUsers.js | 2 +- src/v0/destinations/braze/networkHandler.js | 2 +- src/v0/destinations/braze/transform.js | 7 +- src/v0/destinations/braze/util.js | 2 +- .../campaign_manager/networkHandler.js | 2 +- .../campaign_manager/transform.js | 3 +- src/v0/destinations/candu/transform.js | 2 +- src/v0/destinations/canny/transform.js | 2 +- src/v0/destinations/canny/util.js | 2 +- src/v0/destinations/clevertap/deleteUsers.js | 2 +- .../destinations/clevertap/networkHandler.js | 2 +- src/v0/destinations/clevertap/transform.js | 2 +- src/v0/destinations/clickup/transform.js | 2 +- src/v0/destinations/clickup/util.js | 2 +- .../destinations/confluent_cloud/transform.js | 1 - src/v0/destinations/courier/transform.js | 10 +-- .../criteo_audience/networkHandler.js | 14 +-- .../destinations/criteo_audience/transform.js | 2 +- src/v0/destinations/criteo_audience/util.js | 2 +- src/v0/destinations/custify/deleteUsers.js | 6 +- src/v0/destinations/custify/transform.js | 2 +- src/v0/destinations/custify/util.js | 2 +- src/v0/destinations/customerio/transform.js | 2 +- src/v0/destinations/customerio/util.js | 3 +- src/v0/destinations/delighted/transform.js | 10 +-- src/v0/destinations/delighted/util.js | 8 +- src/v0/destinations/discord/transform.js | 2 +- src/v0/destinations/drip/transform.js | 10 +-- src/v0/destinations/drip/util.js | 2 +- src/v0/destinations/engage/deleteUsers.js | 2 +- src/v0/destinations/engage/transform.js | 2 +- src/v0/destinations/eventbridge/transform.js | 2 +- .../facebook_offline_conversions/transform.js | 2 +- .../facebook_offline_conversions/utils.js | 2 +- .../destinations/facebook_pixel/transform.js | 3 +- src/v0/destinations/facebook_pixel/utils.js | 2 +- src/v0/destinations/factorsai/transform.js | 2 +- src/v0/destinations/fb/transform.js | 2 +- .../fb_custom_audience/transform.js | 10 +-- .../destinations/fb_custom_audience/util.js | 2 +- src/v0/destinations/firehose/transform.js | 2 +- .../destinations/freshmarketer/transform.js | 10 +-- src/v0/destinations/freshmarketer/utils.js | 10 +-- src/v0/destinations/freshsales/transform.js | 2 +- src/v0/destinations/freshsales/utils.js | 10 +-- src/v0/destinations/ga/deleteUsers.js | 2 +- src/v0/destinations/ga/networkHandler.js | 2 +- src/v0/destinations/ga/transform.js | 2 +- src/v0/destinations/ga/utils.js | 2 +- src/v0/destinations/ga360/transform.js | 2 +- src/v0/destinations/ga4/networkHandler.js | 2 +- src/v0/destinations/ga4/transform.js | 10 +-- src/v0/destinations/ga4/utils.js | 2 +- src/v0/destinations/gainsight/transform.js | 2 +- src/v0/destinations/gainsight/util.js | 6 +- src/v0/destinations/gainsight_px/transform.js | 2 +- src/v0/destinations/gainsight_px/util.js | 2 +- .../networkHandler.js | 3 +- .../transform.js | 3 +- .../networkHandler.js | 10 +-- .../transform.js | 2 +- .../utils.js | 6 +- .../networkHandler.js | 2 +- .../transform.js | 2 +- .../google_cloud_function/util.js | 2 +- src/v0/destinations/googlepubsub/transform.js | 2 +- src/v0/destinations/googlesheets/transform.js | 2 +- src/v0/destinations/heap/transform.js | 2 +- src/v0/destinations/hs/HSTransform-v1.js | 10 +-- src/v0/destinations/hs/HSTransform-v2.js | 10 +-- src/v0/destinations/hs/transform.js | 2 +- src/v0/destinations/hs/util.js | 12 +-- src/v0/destinations/impact/transform.js | 10 +-- src/v0/destinations/indicative/transform.js | 2 +- src/v0/destinations/intercom/deleteUsers.js | 2 +- .../destinations/intercom/networkHandler.js | 3 +- src/v0/destinations/intercom/transform.js | 2 +- src/v0/destinations/iterable/deleteUsers.js | 2 +- src/v0/destinations/iterable/transform.js | 2 +- src/v0/destinations/iterable/util.js | 2 +- src/v0/destinations/june/transform.js | 2 +- src/v0/destinations/kafka/transform.js | 1 - src/v0/destinations/keen/transform.js | 2 +- src/v0/destinations/kissmetrics/transform.js | 2 +- src/v0/destinations/klaviyo/transform.js | 7 +- src/v0/destinations/klaviyo/util.js | 2 +- src/v0/destinations/kochava/transform.js | 2 +- src/v0/destinations/kustomer/transform.js | 2 +- src/v0/destinations/kustomer/util.js | 2 +- src/v0/destinations/lambda/transform.js | 2 +- src/v0/destinations/leanplum/transform.js | 2 +- src/v0/destinations/lemnisk/transform.js | 10 +-- src/v0/destinations/lemnisk/utils.js | 2 +- src/v0/destinations/lytics/transform.js | 2 +- src/v0/destinations/mailchimp/transform.js | 2 +- src/v0/destinations/mailchimp/utils.js | 2 +- src/v0/destinations/mailjet/transform.js | 2 +- src/v0/destinations/mailmodo/transform.js | 2 +- src/v0/destinations/marketo/transform.js | 10 +-- src/v0/destinations/marketo/util.js | 14 +-- .../marketo_bulk_upload/fetchJobStatus.js | 2 +- .../marketo_bulk_upload/fileUpload.js | 12 +-- .../marketo_bulk_upload.util.test.js | 2 +- .../destinations/marketo_bulk_upload/poll.js | 2 +- .../marketo_bulk_upload/transform.js | 2 +- .../destinations/marketo_bulk_upload/util.js | 4 +- .../marketo_static_list/transform.js | 2 +- .../destinations/marketo_static_list/util.js | 2 +- src/v0/destinations/mautic/transform.js | 10 +-- src/v0/destinations/mautic/utils.js | 6 +- src/v0/destinations/moengage/transform.js | 10 +-- src/v0/destinations/monday/transform.js | 10 +-- src/v0/destinations/monday/util.js | 6 +- src/v0/destinations/monetate/transform.js | 2 +- src/v0/destinations/monetate/utils.js | 2 +- src/v0/destinations/mp/deleteUsers.js | 2 +- src/v0/destinations/mp/transform.js | 2 +- src/v0/destinations/mp/util.js | 2 +- .../ometria/networkResponseHandler.js | 2 +- src/v0/destinations/ometria/transform.js | 2 +- src/v0/destinations/one_signal/transform.js | 10 +-- src/v0/destinations/one_signal/util.js | 2 +- src/v0/destinations/pagerduty/transform.js | 10 +-- src/v0/destinations/pagerduty/util.js | 2 +- src/v0/destinations/pardot/networkHandler.js | 2 +- src/v0/destinations/pardot/transform.js | 2 +- src/v0/destinations/persistiq/transform.js | 2 +- src/v0/destinations/persistiq/util.js | 2 +- src/v0/destinations/personalize/transform.js | 2 +- .../destinations/pinterest_tag/transform.js | 2 +- src/v0/destinations/pinterest_tag/utils.js | 2 +- src/v0/destinations/posthog/transform.js | 2 +- src/v0/destinations/profitwell/transform.js | 6 +- src/v0/destinations/profitwell/utils.js | 5 +- src/v0/destinations/redis/transform.js | 2 +- src/v0/destinations/refiner/transform.js | 2 +- src/v0/destinations/refiner/utils.js | 2 +- src/v0/destinations/revenue_cat/transform.js | 10 +-- src/v0/destinations/rockerbox/transform.js | 2 +- src/v0/destinations/salesforce/transform.js | 5 +- src/v0/destinations/salesforce/utils.js | 2 +- src/v0/destinations/sendgrid/deleteUsers.js | 2 +- src/v0/destinations/sendgrid/transform.js | 10 +-- src/v0/destinations/sendgrid/util.js | 6 +- src/v0/destinations/sendinblue/transform.js | 2 +- src/v0/destinations/sendinblue/util.js | 2 +- src/v0/destinations/serenytics/transform.js | 10 +-- src/v0/destinations/serenytics/utils.js | 2 +- src/v0/destinations/sfmc/transform.js | 6 +- src/v0/destinations/shynet/transform.js | 2 +- src/v0/destinations/signl4/transform.js | 10 +-- src/v0/destinations/singular/transform.js | 2 +- src/v0/destinations/singular/util.js | 2 +- src/v0/destinations/slack/transform.js | 2 +- .../snapchat_conversion/transform.js | 2 +- .../networkHandler.js | 2 +- .../snapchat_custom_audience/transform.js | 2 +- .../snapchat_custom_audience/utils.js | 2 +- src/v0/destinations/splitio/transform.js | 2 +- src/v0/destinations/statsig/transform.js | 2 +- src/v0/destinations/stormly/transform.js | 5 +- .../destinations/tiktok_ads/networkHandler.js | 2 +- src/v0/destinations/tiktok_ads/transform.js | 2 +- .../tiktok_ads_offline_events/transform.js | 2 +- src/v0/destinations/trengo/transform.js | 14 +-- src/v0/destinations/twitter_ads/transform.js | 10 +-- src/v0/destinations/user/transform.js | 10 +-- src/v0/destinations/user/utils.js | 5 +- src/v0/destinations/userlist/transform.js | 2 +- src/v0/destinations/vero/transform.js | 2 +- src/v0/destinations/webengage/transform.js | 2 +- src/v0/destinations/webhook/transform.js | 2 +- src/v0/destinations/woopra/transform.js | 2 +- src/v0/destinations/wootric/transform.js | 2 +- src/v0/destinations/wootric/util.js | 2 +- src/v0/destinations/yahoo_dsp/transform.js | 2 +- src/v0/destinations/yahoo_dsp/util.js | 2 +- src/v0/destinations/zendesk/transform.js | 10 +-- src/v0/destinations/zendesk/util.js | 2 +- src/v0/sources/appsflyer/transform.js | 2 +- src/v0/sources/braze/transform.js | 2 +- src/v0/sources/canny/transform.js | 2 +- src/v0/sources/canny/util.js | 2 +- src/v0/sources/customerio/transform.js | 2 - src/v0/sources/gainsightpx/transform.js | 2 +- src/v0/sources/iterable/transform.js | 2 +- src/v0/sources/mailmodo/transform.js | 2 +- src/v0/sources/monday/transform.js | 2 +- src/v0/sources/shopify/util.js | 2 +- src/v0/util/errorTypes/abortedError.js | 15 ---- src/v0/util/errorTypes/configurationError.js | 16 ---- src/v0/util/errorTypes/index.js | 32 ------- .../util/errorTypes/instrumentationError.js | 15 ---- .../util/errorTypes/invalidAuthTokenError.js | 16 ---- src/v0/util/errorTypes/networkError.js | 29 ------- .../errorTypes/networkInstrumentationError.js | 16 ---- src/v0/util/errorTypes/oAuthSecretError.js | 15 ---- src/v0/util/errorTypes/platformError.js | 14 --- src/v0/util/errorTypes/redisError.js | 15 ---- src/v0/util/errorTypes/retryableError.js | 15 ---- src/v0/util/errorTypes/throttledError.js | 15 ---- src/v0/util/errorTypes/transformationError.js | 14 --- src/v0/util/errorTypes/unauthorizedError.js | 16 ---- .../errorTypes/unhandledStatusCodeError.js | 16 ---- .../util/errorTypes/unsupportedEventError.js | 14 --- src/v0/util/facebookUtils/index.js | 2 +- src/v0/util/facebookUtils/networkHandler.js | 2 +- src/v0/util/index.js | 8 +- src/v0/util/regulation-api.js | 2 +- src/warehouse/identity.js | 2 +- src/warehouse/index.js | 2 +- src/warehouse/util.js | 2 +- src/warehouse/v1/util.js | 2 +- .../pinterest_tag/processor/data.ts | 85 +++++++++++++++++++ 251 files changed, 562 insertions(+), 689 deletions(-) delete mode 100644 src/v0/util/errorTypes/abortedError.js delete mode 100644 src/v0/util/errorTypes/configurationError.js delete mode 100644 src/v0/util/errorTypes/instrumentationError.js delete mode 100644 src/v0/util/errorTypes/invalidAuthTokenError.js delete mode 100644 src/v0/util/errorTypes/networkError.js delete mode 100644 src/v0/util/errorTypes/networkInstrumentationError.js delete mode 100644 src/v0/util/errorTypes/oAuthSecretError.js delete mode 100644 src/v0/util/errorTypes/platformError.js delete mode 100644 src/v0/util/errorTypes/redisError.js delete mode 100644 src/v0/util/errorTypes/retryableError.js delete mode 100644 src/v0/util/errorTypes/throttledError.js delete mode 100644 src/v0/util/errorTypes/transformationError.js delete mode 100644 src/v0/util/errorTypes/unauthorizedError.js delete mode 100644 src/v0/util/errorTypes/unhandledStatusCodeError.js delete mode 100644 src/v0/util/errorTypes/unsupportedEventError.js diff --git a/package-lock.json b/package-lock.json index c16855ccfd..91f984e22c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "@koa/router": "^12.0.0", "@ndhoule/extend": "^2.0.0", "@pyroscope/nodejs": "^0.2.6", + "@rudderstack/integrations-lib": "^0.1.8", "@rudderstack/workflow-engine": "^0.5.7", "ajv": "^8.12.0", "ajv-draft-04": "^1.0.0", @@ -6637,6 +6638,25 @@ "node": ">= 8" } }, + "node_modules/@rudderstack/integrations-lib": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/@rudderstack/integrations-lib/-/integrations-lib-0.1.8.tgz", + "integrity": "sha512-f8GX78RFma3XAWPNEI6QjGk4avbE8r9aspHNaYE+YyRKsJGWrl8gw/k+Jso36C0juOGas79GWPSiypbXLu8Q/g==", + "dependencies": { + "@rudderstack/workflow-engine": "^0.5.7", + "axios": "^1.4.0", + "axios-mock-adapter": "^1.22.0", + "crypto": "^1.0.1", + "get-value": "^3.0.1", + "handlebars": "^4.7.8", + "lodash": "^4.17.21", + "moment": "^2.29.4", + "moment-timezone": "^0.5.43", + "set-value": "^4.1.0", + "sha256": "^0.2.0", + "tslib": "^2.4.0" + } + }, "node_modules/@rudderstack/json-template-engine": { "version": "0.5.5", "license": "MIT" @@ -8184,7 +8204,6 @@ "version": "1.22.0", "resolved": "https://registry.npmjs.org/axios-mock-adapter/-/axios-mock-adapter-1.22.0.tgz", "integrity": "sha512-dmI0KbkyAhntUR05YY96qg2H6gg0XMl2+qTW0xmYg6Up+BFBAJYRLROMXRdDEL06/Wqwa0TJThAYvFtSFdRCZw==", - "dev": true, "dependencies": { "fast-deep-equal": "^3.1.3", "is-buffer": "^2.0.5" @@ -8197,7 +8216,6 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "dev": true, "funding": [ { "type": "github", @@ -10608,6 +10626,12 @@ "node": "*" } }, + "node_modules/crypto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", + "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==", + "deprecated": "This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in." + }, "node_modules/crypto-js": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", @@ -13104,11 +13128,12 @@ "license": "MIT" }, "node_modules/handlebars": { - "version": "4.7.7", - "license": "MIT", + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", "dependencies": { "minimist": "^1.2.5", - "neo-async": "^2.6.0", + "neo-async": "^2.6.2", "source-map": "^0.6.1", "wordwrap": "^1.0.0" }, diff --git a/package.json b/package.json index f0746c9aaf..bfa2630971 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "@koa/router": "^12.0.0", "@ndhoule/extend": "^2.0.0", "@pyroscope/nodejs": "^0.2.6", + "@rudderstack/integrations-lib": "^0.1.8", "@rudderstack/workflow-engine": "^0.5.7", "ajv": "^8.12.0", "ajv-draft-04": "^1.0.0", diff --git a/src/adapters/networkhandler/genericNetworkHandler.js b/src/adapters/networkhandler/genericNetworkHandler.js index 23bdc1d7a2..bcbcb21259 100644 --- a/src/adapters/networkhandler/genericNetworkHandler.js +++ b/src/adapters/networkhandler/genericNetworkHandler.js @@ -1,7 +1,7 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { isHttpStatusSuccess } = require('../../v0/util/index'); const { proxyRequest, prepareProxyRequest } = require('../network'); const { getDynamicErrorType, processAxiosResponse } = require('../utils/networkUtils'); -const { NetworkError } = require('../../v0/util/errorTypes'); const tags = require('../../v0/util/tags'); /** diff --git a/src/adapters/utils/networkUtils.js b/src/adapters/utils/networkUtils.js index 7f830f5a4b..0dcb9931e9 100644 --- a/src/adapters/utils/networkUtils.js +++ b/src/adapters/utils/networkUtils.js @@ -1,6 +1,7 @@ /* eslint-disable eqeqeq */ const lodash = require('lodash'); const { isEmpty } = require('lodash'); +const { AbortedError } = require('@rudderstack/integrations-lib'); const { isHttpStatusRetryable, isDefinedAndNotNullAndNotEmpty, @@ -9,7 +10,6 @@ const { isHttpStatusSuccess, getErrorStatusCode, } = require('../../v0/util'); -const { AbortedError } = require('../../v0/util/errorTypes'); const tags = require('../../v0/util/tags'); const { HTTP_STATUS_CODES } = require('../../v0/util/constant'); diff --git a/src/cdk/v1/autopilot/transform.js b/src/cdk/v1/autopilot/transform.js index 613b985c0d..b27e50f096 100644 --- a/src/cdk/v1/autopilot/transform.js +++ b/src/cdk/v1/autopilot/transform.js @@ -1,5 +1,5 @@ const { Utils } = require('rudder-transformer-cdk'); -const { InstrumentationError } = require('../../../v0/util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); function identifyPostMapper(event, mappedPayload) { const { message } = event; diff --git a/src/cdk/v1/dcm_floodlight/transform.js b/src/cdk/v1/dcm_floodlight/transform.js index d5835d3e2b..bb93333745 100644 --- a/src/cdk/v1/dcm_floodlight/transform.js +++ b/src/cdk/v1/dcm_floodlight/transform.js @@ -5,6 +5,7 @@ const { removeUndefinedAndNullValues, isDefinedAndNotNull, } = require('rudder-transformer-cdk/build/utils'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { getIntegrationsObj, isEmpty, @@ -14,7 +15,6 @@ const { } = require('../../../v0/util'); const { GENERIC_TRUE_VALUES, GENERIC_FALSE_VALUES } = require('../../../constants'); const { BASE_URL, BLACKLISTED_CHARACTERS } = require('./config'); -const { ConfigurationError, InstrumentationError } = require('../../../v0/util/errorTypes'); // append properties to endpoint // eg: ${BASE_URL}key1=value1;key2=value2;.... diff --git a/src/cdk/v1/handler.js b/src/cdk/v1/handler.js index a7dfe85a9f..0af0859f49 100644 --- a/src/cdk/v1/handler.js +++ b/src/cdk/v1/handler.js @@ -6,13 +6,13 @@ const path = require('path'); const basePath = path.resolve(__dirname); ConfigFactory.init({ basePath, loggingMode: 'production' }); -const tags = require('../../v0/util/tags'); -const { generateErrorObject } = require('../../v0/util'); const { + InstrumentationError, TransformationError, ConfigurationError, - InstrumentationError, -} = require('../../v0/util/errorTypes'); +} = 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, diff --git a/src/cdk/v2/bindings/default.js b/src/cdk/v2/bindings/default.js index b86b6d2b63..a447370aca 100644 --- a/src/cdk/v2/bindings/default.js +++ b/src/cdk/v2/bindings/default.js @@ -3,7 +3,7 @@ const { InstrumentationError, ConfigurationError, NetworkError, -} = require('../../../v0/util/errorTypes'); +} = require('@rudderstack/integrations-lib'); const { isHttpStatusSuccess } = require('../../../v0/util'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../../v0/util/tags'); diff --git a/src/cdk/v2/destinations/dcm_floodlight/utils.js b/src/cdk/v2/destinations/dcm_floodlight/utils.js index bee45bdea3..07b158efa3 100644 --- a/src/cdk/v2/destinations/dcm_floodlight/utils.js +++ b/src/cdk/v2/destinations/dcm_floodlight/utils.js @@ -1,7 +1,7 @@ const lodash = require('lodash'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { getValueFromPropertiesOrTraits, getHashFromArray } = require('../../../../v0/util'); const { GENERIC_TRUE_VALUES, GENERIC_FALSE_VALUES } = require('../../../../constants'); -const { InstrumentationError } = require('../../../../v0/util/errorTypes'); // valid flag should be provided [1|true] or [0|false] const mapFlagValue = (key, value) => { diff --git a/src/cdk/v2/utils.ts b/src/cdk/v2/utils.ts index 3fb26c07e0..f9a5c66937 100644 --- a/src/cdk/v2/utils.ts +++ b/src/cdk/v2/utils.ts @@ -1,9 +1,9 @@ import path from 'path'; import fs from 'fs/promises'; import { WorkflowExecutionError, WorkflowCreationError } from '@rudderstack/workflow-engine'; +import { PlatformError } from '@rudderstack/integrations-lib'; import logger from '../../logger'; import { generateErrorObject } from '../../v0/util'; -import { PlatformError } from '../../v0/util/errorTypes'; import tags from '../../v0/util/tags'; import { CatchErr } from '../../util/types'; diff --git a/src/helpers/serviceSelector.ts b/src/helpers/serviceSelector.ts index bac1a17c16..891c21313d 100644 --- a/src/helpers/serviceSelector.ts +++ b/src/helpers/serviceSelector.ts @@ -1,3 +1,4 @@ +import { PlatformError } from '@rudderstack/integrations-lib'; import { ProcessorTransformationRequest, RouterTransformationRequestData } from '../types/index'; import { INTEGRATION_SERVICE } from '../routes/utils/constants'; import CDKV1DestinationService from '../services/destination/cdkV1Integration'; @@ -6,7 +7,6 @@ import DestinationService from '../interfaces/DestinationService'; import NativeIntegrationDestinationService from '../services/destination/nativeIntegration'; import SourceService from '../interfaces/SourceService'; import NativeIntegrationSourceService from '../services/source/nativeIntegration'; -import { PlatformError } from '../v0/util/errorTypes'; import ComparatorService from '../services/comparator'; import { FixMe } from '../util/types'; diff --git a/src/services/destination/cdkV1Integration.ts b/src/services/destination/cdkV1Integration.ts index a016665afb..2f655fca9b 100644 --- a/src/services/destination/cdkV1Integration.ts +++ b/src/services/destination/cdkV1Integration.ts @@ -1,6 +1,7 @@ /* 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 IntegrationDestinationService from '../../interfaces/DestinationService'; import { DeliveryResponse, @@ -14,7 +15,6 @@ import { UserDeletionRequest, UserDeletionResponse, } from '../../types/index'; -import { TransformationError } from '../../v0/util/errorTypes'; import DestinationPostTransformationService from './postTransformation'; import tags from '../../v0/util/tags'; import { getErrorInfo } from '../../cdk/v1/handler'; diff --git a/src/services/destination/cdkV2Integration.ts b/src/services/destination/cdkV2Integration.ts index b4c0a15e87..bc5a1126a8 100644 --- a/src/services/destination/cdkV2Integration.ts +++ b/src/services/destination/cdkV2Integration.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable class-methods-use-this */ import groupBy from 'lodash/groupBy'; +import { TransformationError } from '@rudderstack/integrations-lib'; import { processCdkV2Workflow } from '../../cdk/v2/handler'; import IntegrationDestinationService from '../../interfaces/DestinationService'; import { @@ -15,7 +16,6 @@ import { UserDeletionRequest, UserDeletionResponse, } from '../../types/index'; -import { TransformationError } from '../../v0/util/errorTypes'; import tags from '../../v0/util/tags'; import DestinationPostTransformationService from './postTransformation'; import stats from '../../util/stats'; diff --git a/src/util/errorNotifier/bugsnag.js b/src/util/errorNotifier/bugsnag.js index a88432f23d..ef01c58730 100644 --- a/src/util/errorNotifier/bugsnag.js +++ b/src/util/errorNotifier/bugsnag.js @@ -5,9 +5,6 @@ const { DataValidationError, } = require('rudder-transformer-cdk/build/error/index'); const stackTraceParser = require('stacktrace-parser'); -const { logger } = require('../../logger'); -const pkg = require('../../../package.json'); - const { BaseError, TransformationError, @@ -23,8 +20,10 @@ const { UnhandledStatusCodeError, UnauthorizedError, NetworkInstrumentationError, - FilteredEventsError, -} = require('../../v0/util/errorTypes'); +} = require('@rudderstack/integrations-lib'); +const { FilteredEventsError } = require('../../v0/util/errorTypes'); +const { logger } = require('../../logger'); +const pkg = require('../../../package.json'); const { BUGSNAG_API_KEY: apiKey, diff --git a/src/util/redis/redisConnector.js b/src/util/redis/redisConnector.js index 749e23ff83..84d578d3b3 100644 --- a/src/util/redis/redisConnector.js +++ b/src/util/redis/redisConnector.js @@ -1,5 +1,5 @@ const Redis = require('ioredis'); -const { RedisError } = require('../../v0/util/errorTypes'); +const { RedisError } = require('@rudderstack/integrations-lib'); const log = require('../../logger'); const stats = require('../stats'); diff --git a/src/v0/destinations/active_campaign/transform.js b/src/v0/destinations/active_campaign/transform.js index 9c6643ebc3..e00808622d 100644 --- a/src/v0/destinations/active_campaign/transform.js +++ b/src/v0/destinations/active_campaign/transform.js @@ -1,6 +1,11 @@ /* eslint-disable array-callback-return */ /* eslint-disable no-empty */ const get = require('get-value'); +const { + InstrumentationError, + TransformationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, getHeader } = require('./config'); const { @@ -12,11 +17,6 @@ const { } = require('../../util'); const { errorHandler } = require('./util'); const { httpGET, httpPOST } = require('../../../adapters/network'); -const { - InstrumentationError, - TransformationError, - NetworkError, -} = require('../../util/errorTypes'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../util/tags'); diff --git a/src/v0/destinations/active_campaign/util.js b/src/v0/destinations/active_campaign/util.js index c508618336..6e1f5a3683 100644 --- a/src/v0/destinations/active_campaign/util.js +++ b/src/v0/destinations/active_campaign/util.js @@ -1,8 +1,8 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { nodeSysErrorToStatus, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const errorHandler = (err, message) => { diff --git a/src/v0/destinations/adj/transform.js b/src/v0/destinations/adj/transform.js index 695654e58a..8248e731c9 100644 --- a/src/v0/destinations/adj/transform.js +++ b/src/v0/destinations/adj/transform.js @@ -1,4 +1,9 @@ const get = require('get-value'); +const { + InstrumentationError, + TransformationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, baseEndpoint } = require('./config'); const { @@ -11,11 +16,6 @@ const { isAppleFamily, simpleProcessRouterDest, } = require('../../util'); -const { - InstrumentationError, - TransformationError, - ConfigurationError, -} = require('../../util/errorTypes'); const rejectParams = ['revenue', 'currency']; diff --git a/src/v0/destinations/adobe_analytics/transform.js b/src/v0/destinations/adobe_analytics/transform.js index 67bb66310a..a805e379ff 100644 --- a/src/v0/destinations/adobe_analytics/transform.js +++ b/src/v0/destinations/adobe_analytics/transform.js @@ -1,5 +1,10 @@ const jsonxml = require('jsontoxml'); const get = require('get-value'); +const { + InstrumentationError, + TransformationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ECOM_PRODUCT_EVENTS, commonConfig, formatDestinationConfig } = require('./config'); const { @@ -14,11 +19,6 @@ const { removeUndefinedAndNullValues, simpleProcessRouterDest, } = require('../../util'); -const { - InstrumentationError, - TransformationError, - ConfigurationError, -} = require('../../util/errorTypes'); const { handleContextData, diff --git a/src/v0/destinations/adobe_analytics/utils.js b/src/v0/destinations/adobe_analytics/utils.js index 55059884b1..cbd4f51c23 100644 --- a/src/v0/destinations/adobe_analytics/utils.js +++ b/src/v0/destinations/adobe_analytics/utils.js @@ -4,8 +4,8 @@ /* eslint-disable unicorn/no-for-loop */ /* eslint-disable no-restricted-syntax */ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { isDefinedAndNotNull, getValueFromMessage } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const SOURCE_KEYS = ['properties', 'traits', 'context.traits', 'context']; @@ -147,13 +147,13 @@ function rudderPropToDestMapWithDelimitter(mapping, delimMapping, message, prefi `${prefix} mapping properties variable is neither a string nor an array`, ); } - + if (typeof val === 'string') { /* following regex is used to find the one or more commas separated/padded by white spaces. Example: val = 'r15,faze90R' , 'r1v, bvp, pol' */ - val = val.replace(/\s*,+\s*/g, delimMapping[key]); - // Above regex is good as for every comma with whitespace padding the no. of steps will increase by 4. + val = val.replace(/\s*,+\s*/g, delimMapping[key]); + // Above regex is good as for every comma with whitespace padding the no. of steps will increase by 4. } else { val = val.join(delimMapping[key]); } diff --git a/src/v0/destinations/af/deleteUsers.js b/src/v0/destinations/af/deleteUsers.js index 7970d02c20..2d68549fcc 100644 --- a/src/v0/destinations/af/deleteUsers.js +++ b/src/v0/destinations/af/deleteUsers.js @@ -1,12 +1,16 @@ /* eslint-disable no-await-in-loop */ /* eslint-disable no-param-reassign */ +const { + ConfigurationError, + InstrumentationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); const { generateUUID, isHttpStatusSuccess } = require('../../util'); -const { ConfigurationError, InstrumentationError, NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { executeCommonValidations } = require('../../util/regulation-api'); diff --git a/src/v0/destinations/af/transform.js b/src/v0/destinations/af/transform.js index 858adce147..4d7ed7e635 100644 --- a/src/v0/destinations/af/transform.js +++ b/src/v0/destinations/af/transform.js @@ -1,6 +1,7 @@ const get = require('get-value'); const set = require('set-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { removeUndefinedValues, @@ -15,7 +16,6 @@ const { isDefinedAndNotNullAndNotEmpty, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { Event, ENDPOINT, ConfigCategory, mappingConfig, nameToEventMap } = require('./config'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/airship/transform.js b/src/v0/destinations/airship/transform.js index a390ec8060..091c9b7f39 100644 --- a/src/v0/destinations/airship/transform.js +++ b/src/v0/destinations/airship/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { @@ -22,7 +23,6 @@ const { isEmptyObject, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const DEFAULT_ACCEPT_HEADER = 'application/vnd.urbanairship+json; version=3'; diff --git a/src/v0/destinations/algolia/transform.js b/src/v0/destinations/algolia/transform.js index c8b9be28dd..8e9cd57e8b 100644 --- a/src/v0/destinations/algolia/transform.js +++ b/src/v0/destinations/algolia/transform.js @@ -1,10 +1,10 @@ const set = require('set-value'); -const { EventType } = require('../../../constants'); const { InstrumentationError, ConfigurationError, PlatformError, -} = require('../../util/errorTypes'); +} = require('@rudderstack/integrations-lib'); +const { EventType } = require('../../../constants'); const { getValueFromMessage, constructPayload, diff --git a/src/v0/destinations/algolia/util.js b/src/v0/destinations/algolia/util.js index 89048f0e43..eddb4dc16d 100644 --- a/src/v0/destinations/algolia/util.js +++ b/src/v0/destinations/algolia/util.js @@ -1,5 +1,5 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const logger = require('../../../logger'); -const { InstrumentationError } = require('../../util/errorTypes'); const { EVENT_TYPES } = require('./config'); /** diff --git a/src/v0/destinations/am/deleteUsers.js b/src/v0/destinations/am/deleteUsers.js index c0402284b4..578c58fb5c 100644 --- a/src/v0/destinations/am/deleteUsers.js +++ b/src/v0/destinations/am/deleteUsers.js @@ -1,4 +1,5 @@ const btoa = require('btoa'); +const { ConfigurationError, NetworkError } = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const tags = require('../../util/tags'); const { @@ -6,7 +7,6 @@ const { getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); const { isHttpStatusSuccess } = require('../../util'); -const { ConfigurationError, NetworkError } = require('../../util/errorTypes'); const { executeCommonValidations } = require('../../util/regulation-api'); const { DELETE_MAX_BATCH_SIZE } = require('./config'); const { getUserIdBatches } = require('../../util/deleteUserUtils'); diff --git a/src/v0/destinations/am/transform.js b/src/v0/destinations/am/transform.js index 04a1c5a107..d7101982a7 100644 --- a/src/v0/destinations/am/transform.js +++ b/src/v0/destinations/am/transform.js @@ -4,6 +4,7 @@ const cloneDeep = require('lodash/cloneDeep'); const get = require('get-value'); const set = require('set-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType, SpecedTraits, @@ -44,7 +45,7 @@ const tags = require('../../util/tags'); const AMUtils = require('./utils'); const logger = require('../../../logger'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); + const { JSON_MIME_TYPE } = require('../../util/constant'); const EVENTS_KEY_PATH = 'body.JSON.events'; diff --git a/src/v0/destinations/appcues/transform.js b/src/v0/destinations/appcues/transform.js index 095256cc4e..57a54bce33 100644 --- a/src/v0/destinations/appcues/transform.js +++ b/src/v0/destinations/appcues/transform.js @@ -1,4 +1,5 @@ /* eslint-disable no-underscore-dangle */ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { @@ -9,7 +10,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { InstrumentationError } = require('../../util/errorTypes'); const { ConfigCategory, mappingConfig, getEndpoint } = require('./config'); diff --git a/src/v0/destinations/attentive_tag/transform.js b/src/v0/destinations/attentive_tag/transform.js index 231beec143..fa05eb6c21 100644 --- a/src/v0/destinations/attentive_tag/transform.js +++ b/src/v0/destinations/attentive_tag/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ConfigCategory, mappingConfig, BASE_URL } = require('./config'); const { @@ -18,7 +19,6 @@ const { getPropertiesKeyValidation, validateTimestamp, } = require('./util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload, apiKey, endpoint) => { diff --git a/src/v0/destinations/attentive_tag/util.js b/src/v0/destinations/attentive_tag/util.js index 890f73cdc9..c96d03028f 100644 --- a/src/v0/destinations/attentive_tag/util.js +++ b/src/v0/destinations/attentive_tag/util.js @@ -1,13 +1,13 @@ /* eslint-disable no-restricted-syntax */ const get = require('get-value'); const moment = require('moment'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { constructPayload, isDefinedAndNotNull, getDestinationExternalID, isDefinedAndNotNullAndNotEmpty, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { mappingConfig, ConfigCategory } = require('./config'); /** diff --git a/src/v0/destinations/attribution/transform.js b/src/v0/destinations/attribution/transform.js index 712f3e5e5d..fa42a6238a 100644 --- a/src/v0/destinations/attribution/transform.js +++ b/src/v0/destinations/attribution/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { batchEndpoint } = require('./config'); const { defaultPostRequestConfig, @@ -5,7 +6,6 @@ const { removeUndefinedAndNullValues, getFieldValueFromMessage, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function responseBuilderSimple(payload, attributionConfig) { diff --git a/src/v0/destinations/autopilot/transform.js b/src/v0/destinations/autopilot/transform.js index e0fe9aa400..e4a2c408af 100644 --- a/src/v0/destinations/autopilot/transform.js +++ b/src/v0/destinations/autopilot/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { @@ -9,7 +10,6 @@ const { simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const identifyFields = [ diff --git a/src/v0/destinations/awin/transform.js b/src/v0/destinations/awin/transform.js index f6070fccd5..49a115c1ff 100644 --- a/src/v0/destinations/awin/transform.js +++ b/src/v0/destinations/awin/transform.js @@ -1,8 +1,8 @@ +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { BASE_URL, ConfigCategory, mappingConfig } = require('./config'); const { defaultRequestConfig, constructPayload, simpleProcessRouterDest } = require('../../util'); const { getParams } = require('./utils'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const responseBuilder = (message, { Config }) => { const { advertiserId, eventsToTrack } = Config; diff --git a/src/v0/destinations/azure_event_hub/transform.js b/src/v0/destinations/azure_event_hub/transform.js index 6200e32ce7..98180b55b4 100644 --- a/src/v0/destinations/azure_event_hub/transform.js +++ b/src/v0/destinations/azure_event_hub/transform.js @@ -1,6 +1,5 @@ const cloneDeep = require('lodash/cloneDeep'); const { getIntegrationsObj } = require('../../util'); -// const { InstrumentationError } = require("../../util/errorTypes"); function process(event) { const { message, destination } = event; diff --git a/src/v0/destinations/blueshift/transform.js b/src/v0/destinations/blueshift/transform.js index b79af327d2..cdfbfe32e1 100644 --- a/src/v0/destinations/blueshift/transform.js +++ b/src/v0/destinations/blueshift/transform.js @@ -1,3 +1,8 @@ +const { + TransformationError, + InstrumentationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { constructPayload, @@ -10,11 +15,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { - TransformationError, - InstrumentationError, - ConfigurationError, -} = require('../../util/errorTypes'); const { MAPPING_CONFIG, diff --git a/src/v0/destinations/bqstream/transform.js b/src/v0/destinations/bqstream/transform.js index 55679b08a8..598a97946d 100644 --- a/src/v0/destinations/bqstream/transform.js +++ b/src/v0/destinations/bqstream/transform.js @@ -1,5 +1,6 @@ /* eslint-disable no-console */ const lodash = require('lodash'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultBatchRequestConfig, @@ -9,7 +10,6 @@ const { groupEventsByType, } = require('../../util'); const { MAX_ROWS_PER_REQUEST, DESTINATION } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); const { getRearrangedEvents } = require('./util'); const getInsertIdColValue = (properties, insertIdCol) => { diff --git a/src/v0/destinations/branch/transform.js b/src/v0/destinations/branch/transform.js index 0d47fbd791..23dcd6c8db 100644 --- a/src/v0/destinations/branch/transform.js +++ b/src/v0/destinations/branch/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { endpoints } = require('./config'); const { categoriesList } = require('./data/eventMapping'); @@ -11,7 +12,6 @@ const { isAppleFamily, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function responseBuilder(payload, message, destination, category) { diff --git a/src/v0/destinations/braze/deleteUsers.js b/src/v0/destinations/braze/deleteUsers.js index 799aa3f9b4..b94d901138 100644 --- a/src/v0/destinations/braze/deleteUsers.js +++ b/src/v0/destinations/braze/deleteUsers.js @@ -1,3 +1,4 @@ +const { NetworkError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { processAxiosResponse, @@ -8,7 +9,6 @@ const { isHttpStatusSuccess } = require('../../util'); const { executeCommonValidations } = require('../../util/regulation-api'); const { DEL_MAX_BATCH_SIZE } = require('./config'); const { getUserIdBatches } = require('../../util/deleteUserUtils'); -const { NetworkError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const userDeletionHandler = async (userAttributes, config) => { diff --git a/src/v0/destinations/braze/networkHandler.js b/src/v0/destinations/braze/networkHandler.js index a141607fe9..c6cf7222ea 100644 --- a/src/v0/destinations/braze/networkHandler.js +++ b/src/v0/destinations/braze/networkHandler.js @@ -1,4 +1,5 @@ /* eslint-disable no-unused-vars */ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { isHttpStatusSuccess } = require('../../util/index'); const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network'); const { @@ -6,7 +7,6 @@ const { processAxiosResponse, } = require('../../../adapters/utils/networkUtils'); const { DESTINATION } = require('./config'); -const { NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const stats = require('../../../util/stats'); diff --git a/src/v0/destinations/braze/transform.js b/src/v0/destinations/braze/transform.js index 26fd86b3dd..b939e1f414 100644 --- a/src/v0/destinations/braze/transform.js +++ b/src/v0/destinations/braze/transform.js @@ -1,6 +1,8 @@ /* eslint-disable no-nested-ternary,no-param-reassign */ const lodash = require('lodash'); const get = require('get-value'); +const { InstrumentationError, NetworkError } = require('@rudderstack/integrations-lib'); +const { FilteredEventsError } = require('../../util/errorTypes'); const { BrazeDedupUtility, CustomAttributeOperationUtil, @@ -24,11 +26,6 @@ const { simpleProcessRouterDest, isNewStatusCodesAccepted, } = require('../../util'); -const { - InstrumentationError, - NetworkError, - FilteredEventsError, -} = require('../../util/errorTypes'); const { ConfigCategory, mappingConfig, diff --git a/src/v0/destinations/braze/util.js b/src/v0/destinations/braze/util.js index b3e60f2c6a..9b5d57d6bc 100644 --- a/src/v0/destinations/braze/util.js +++ b/src/v0/destinations/braze/util.js @@ -25,7 +25,7 @@ const { const { JSON_MIME_TYPE, HTTP_STATUS_CODES } = require('../../util/constant'); const { isObject } = require('../../util'); const { removeUndefinedValues, getIntegrationsObj } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const getEndpointFromConfig = (destination) => { // Init -- mostly for test cases diff --git a/src/v0/destinations/campaign_manager/networkHandler.js b/src/v0/destinations/campaign_manager/networkHandler.js index cd98de253e..0683b0c55c 100644 --- a/src/v0/destinations/campaign_manager/networkHandler.js +++ b/src/v0/destinations/campaign_manager/networkHandler.js @@ -1,3 +1,4 @@ +const { AbortedError, RetryableError, NetworkError } = require('@rudderstack/integrations-lib'); const { prepareProxyRequest, proxyRequest } = require('../../../adapters/network'); const { isHttpStatusSuccess, getAuthErrCategoryFromStCode } = require('../../util/index'); @@ -5,7 +6,6 @@ const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { AbortedError, RetryableError, NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); function checkIfFailuresAreRetryable(response) { diff --git a/src/v0/destinations/campaign_manager/transform.js b/src/v0/destinations/campaign_manager/transform.js index af097e5b4c..7b6d6cba4c 100644 --- a/src/v0/destinations/campaign_manager/transform.js +++ b/src/v0/destinations/campaign_manager/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { @@ -19,8 +20,6 @@ const { } = require('./config'); const { convertToMicroseconds } = require('./util'); - -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function isEmptyObject(obj) { diff --git a/src/v0/destinations/candu/transform.js b/src/v0/destinations/candu/transform.js index 659af36540..d114998484 100644 --- a/src/v0/destinations/candu/transform.js +++ b/src/v0/destinations/candu/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -6,7 +7,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { endpoint, identifyDataMapping, trackDataMapping } = require('./config'); const responseBuilder = (body, { Config }) => { diff --git a/src/v0/destinations/canny/transform.js b/src/v0/destinations/canny/transform.js index d837a8ddd3..f4364e1fb7 100644 --- a/src/v0/destinations/canny/transform.js +++ b/src/v0/destinations/canny/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ConfigCategory, mappingConfig, BASE_URL } = require('./config'); const { @@ -14,7 +15,6 @@ const { validateCreatePostFields, validateEventMapping, } = require('./util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (responseConfgs) => { diff --git a/src/v0/destinations/canny/util.js b/src/v0/destinations/canny/util.js index 002d9aa69f..59644bcd6b 100644 --- a/src/v0/destinations/canny/util.js +++ b/src/v0/destinations/canny/util.js @@ -1,8 +1,8 @@ const qs = require('qs'); +const { InstrumentationError, NetworkError } = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const { getDestinationExternalID } = require('../../util'); -const { InstrumentationError, NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const logger = require('../../../logger'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/clevertap/deleteUsers.js b/src/v0/destinations/clevertap/deleteUsers.js index 826c6c6939..3c07a63d93 100644 --- a/src/v0/destinations/clevertap/deleteUsers.js +++ b/src/v0/destinations/clevertap/deleteUsers.js @@ -1,3 +1,4 @@ +const { NetworkError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { getEndpoint, DEL_MAX_BATCH_SIZE } = require('./config'); const { @@ -6,7 +7,6 @@ const { } = require('../../../adapters/utils/networkUtils'); const { isHttpStatusSuccess } = require('../../util'); const { executeCommonValidations } = require('../../util/regulation-api'); -const { NetworkError, ConfigurationError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { getUserIdBatches } = require('../../util/deleteUserUtils'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/clevertap/networkHandler.js b/src/v0/destinations/clevertap/networkHandler.js index 35c972e502..e17afb57d1 100644 --- a/src/v0/destinations/clevertap/networkHandler.js +++ b/src/v0/destinations/clevertap/networkHandler.js @@ -1,10 +1,10 @@ +const { NetworkError, AbortedError } = require('@rudderstack/integrations-lib'); const { isHttpStatusSuccess } = require('../../util/index'); const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network'); const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, AbortedError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const responseHandler = (destinationResponse) => { diff --git a/src/v0/destinations/clevertap/transform.js b/src/v0/destinations/clevertap/transform.js index 5c1e28c086..efcd101668 100644 --- a/src/v0/destinations/clevertap/transform.js +++ b/src/v0/destinations/clevertap/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-param-reassign */ /* eslint-disable no-nested-ternary */ const get = require('get-value'); +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { getEndpoint, @@ -25,7 +26,6 @@ const { } = require('../../util'); const { generateClevertapBatchedPayload } = require('./utils'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const TIMESTAMP_KEY_PATH = 'context.traits.ts'; diff --git a/src/v0/destinations/clickup/transform.js b/src/v0/destinations/clickup/transform.js index d93e53b349..0637d65bd4 100644 --- a/src/v0/destinations/clickup/transform.js +++ b/src/v0/destinations/clickup/transform.js @@ -1,3 +1,4 @@ +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -14,7 +15,6 @@ const { checkEventIfUIMapped, } = require('./util'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, createTaskEndPoint } = require('./config'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = async (payload, listId, apiToken) => { diff --git a/src/v0/destinations/clickup/util.js b/src/v0/destinations/clickup/util.js index 7b17f83bb6..148fe1bd07 100644 --- a/src/v0/destinations/clickup/util.js +++ b/src/v0/destinations/clickup/util.js @@ -1,3 +1,4 @@ +const { NetworkError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { httpGET } = require('../../../adapters/network'); const { processAxiosResponse, @@ -9,7 +10,6 @@ const { formatTimeStamp, } = require('../../util'); const { getCustomFieldsEndPoint } = require('./config'); -const { NetworkError, InstrumentationError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/confluent_cloud/transform.js b/src/v0/destinations/confluent_cloud/transform.js index e8f0f4d2e2..b33abc90cf 100644 --- a/src/v0/destinations/confluent_cloud/transform.js +++ b/src/v0/destinations/confluent_cloud/transform.js @@ -1,6 +1,5 @@ const cloneDeep = require('lodash/cloneDeep'); const { getIntegrationsObj } = require('../../util'); -// const { InstrumentationError } = require("../../util/errorTypes"); function process(event) { const { message, destination } = event; diff --git a/src/v0/destinations/courier/transform.js b/src/v0/destinations/courier/transform.js index 7d52b503d9..d5e25434ec 100644 --- a/src/v0/destinations/courier/transform.js +++ b/src/v0/destinations/courier/transform.js @@ -1,3 +1,8 @@ +const { + TransformationError, + InstrumentationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -6,11 +11,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { - TransformationError, - InstrumentationError, - ConfigurationError, -} = require('../../util/errorTypes'); const { API_URL } = require('./config'); const responseBuilder = (payload, endpoint, destination) => { diff --git a/src/v0/destinations/criteo_audience/networkHandler.js b/src/v0/destinations/criteo_audience/networkHandler.js index f4369cdc9e..18bd9a93a0 100644 --- a/src/v0/destinations/criteo_audience/networkHandler.js +++ b/src/v0/destinations/criteo_audience/networkHandler.js @@ -1,3 +1,10 @@ +const { + NetworkError, + ThrottledError, + NetworkInstrumentationError, + AbortedError, + RetryableError, +} = require('@rudderstack/integrations-lib'); const { prepareProxyRequest, proxyRequest } = require('../../../adapters/network'); const { isHttpStatusSuccess } = require('../../util/index'); const { REFRESH_TOKEN } = require('../../../adapters/networkhandler/authConstants'); @@ -6,13 +13,6 @@ const { getDynamicErrorType, processAxiosResponse, } = require('../../../adapters/utils/networkUtils'); -const { - NetworkError, - ThrottledError, - NetworkInstrumentationError, - AbortedError, - RetryableError, -} = require('../../util/errorTypes'); // https://developers.criteo.com/marketing-solutions/v2021.01/docs/how-to-handle-api-errors#:~:text=the%20response%20body.-,401,-Authentication%20error // Following fucntion tells us if there is a particular error code in the response. diff --git a/src/v0/destinations/criteo_audience/transform.js b/src/v0/destinations/criteo_audience/transform.js index 7ddbdbef20..25e53cc305 100644 --- a/src/v0/destinations/criteo_audience/transform.js +++ b/src/v0/destinations/criteo_audience/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { BASE_ENDPOINT, operation } = require('./config'); const { defaultRequestConfig, @@ -9,7 +10,6 @@ const { getEventType, getDestinationExternalIDInfoForRetl, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { MappedToDestinationKey } = require('../../../constants'); const { preparePayload } = require('./util'); diff --git a/src/v0/destinations/criteo_audience/util.js b/src/v0/destinations/criteo_audience/util.js index a7541f7911..d9d37bc331 100644 --- a/src/v0/destinations/criteo_audience/util.js +++ b/src/v0/destinations/criteo_audience/util.js @@ -1,6 +1,6 @@ const lodash = require('lodash'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { isDefinedAndNotNullAndNotEmpty } = require('../../util'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { MAX_IDENTIFIERS } = require('./config'); const populateIdentifiers = (audienceList, audienceType) => { diff --git a/src/v0/destinations/custify/deleteUsers.js b/src/v0/destinations/custify/deleteUsers.js index e90abe7abb..147fcc602c 100644 --- a/src/v0/destinations/custify/deleteUsers.js +++ b/src/v0/destinations/custify/deleteUsers.js @@ -1,9 +1,13 @@ +const { + ConfigurationError, + InstrumentationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const { httpDELETE } = require('../../../adapters/network'); const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { ConfigurationError, InstrumentationError, NetworkError } = require('../../util/errorTypes'); const { executeCommonValidations } = require('../../util/regulation-api'); const tags = require('../../util/tags'); diff --git a/src/v0/destinations/custify/transform.js b/src/v0/destinations/custify/transform.js index fd81511982..6b08be1c56 100644 --- a/src/v0/destinations/custify/transform.js +++ b/src/v0/destinations/custify/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType, MappedToDestinationKey } = require('../../../constants'); const { ConfigCategory } = require('./config'); const { @@ -9,7 +10,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { processIdentify, processTrack, processGroup } = require('./util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); /** diff --git a/src/v0/destinations/custify/util.js b/src/v0/destinations/custify/util.js index d943b5c8bf..ae6f21fe20 100644 --- a/src/v0/destinations/custify/util.js +++ b/src/v0/destinations/custify/util.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError, NetworkError } = require('@rudderstack/integrations-lib'); const { ConfigCategory, MappingConfig, @@ -16,7 +17,6 @@ const { constructPayload, isHttpStatusSuccess, } = require('../../util'); -const { InstrumentationError, NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/customerio/transform.js b/src/v0/destinations/customerio/transform.js index 984fb7e67f..be4486717c 100644 --- a/src/v0/destinations/customerio/transform.js +++ b/src/v0/destinations/customerio/transform.js @@ -1,6 +1,7 @@ const get = require('get-value'); const btoa = require('btoa'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType, MappedToDestinationKey } = require('../../../constants'); const { @@ -24,7 +25,6 @@ const { defaultResponseBuilder, validateConfigFields, } = require('./util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function responseBuilder(message, evType, evName, destination, messageType) { diff --git a/src/v0/destinations/customerio/util.js b/src/v0/destinations/customerio/util.js index 6b4dbc0e11..ef983748a5 100644 --- a/src/v0/destinations/customerio/util.js +++ b/src/v0/destinations/customerio/util.js @@ -1,6 +1,7 @@ const get = require('get-value'); const set = require('set-value'); const truncate = require('truncate-utf8-bytes'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { MAX_BATCH_SIZE, configFieldsToCheck } = require('./config'); const { constructPayload, @@ -28,8 +29,6 @@ const { DEVICE_REGISTER_ENDPOINT, } = require('./config'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); - const deviceRelatedEventNames = [ 'Application Installed', 'Application Opened', diff --git a/src/v0/destinations/delighted/transform.js b/src/v0/destinations/delighted/transform.js index f5a2afdcaf..cf80dc878d 100644 --- a/src/v0/destinations/delighted/transform.js +++ b/src/v0/destinations/delighted/transform.js @@ -1,3 +1,8 @@ +const { + InstrumentationError, + ConfigurationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { getFieldValueFromMessage, @@ -20,11 +25,6 @@ const { userValidity, } = require('./util'); const { ENDPOINT, TRACKING_EXCLUSION_FIELDS, identifyMapping } = require('./config'); -const { - InstrumentationError, - ConfigurationError, - NetworkInstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const identifyResponseBuilder = (message, { Config }) => { diff --git a/src/v0/destinations/delighted/util.js b/src/v0/destinations/delighted/util.js index 3cf26a3697..2c92685fd7 100644 --- a/src/v0/destinations/delighted/util.js +++ b/src/v0/destinations/delighted/util.js @@ -1,11 +1,11 @@ -const myAxios = require('../../../util/myAxios'); -const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); -const { getValueFromMessage } = require('../../util'); const { NetworkInstrumentationError, InstrumentationError, NetworkError, -} = require('../../util/errorTypes'); +} = require('@rudderstack/integrations-lib'); +const myAxios = require('../../../util/myAxios'); +const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); +const { getValueFromMessage } = require('../../util'); const { ENDPOINT } = require('./config'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/discord/transform.js b/src/v0/destinations/discord/transform.js index 4eb2f79235..714ee4f52b 100644 --- a/src/v0/destinations/discord/transform.js +++ b/src/v0/destinations/discord/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-nested-ternary */ /* eslint-disable no-prototype-builtins */ const Handlebars = require('handlebars'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { @@ -9,7 +10,6 @@ const { getFieldValueFromMessage, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { stringifyJSON, getName, diff --git a/src/v0/destinations/drip/transform.js b/src/v0/destinations/drip/transform.js index 9abe3e3f77..4ccba076d0 100644 --- a/src/v0/destinations/drip/transform.js +++ b/src/v0/destinations/drip/transform.js @@ -1,3 +1,8 @@ +const { + InstrumentationError, + ConfigurationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { getDestinationExternalID, @@ -31,11 +36,6 @@ const { createUpdateUser, createList, } = require('./util'); -const { - InstrumentationError, - ConfigurationError, - NetworkInstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const identifyResponseBuilder = async (message, { Config }) => { diff --git a/src/v0/destinations/drip/util.js b/src/v0/destinations/drip/util.js index dbb59fc6af..a502cf0d20 100644 --- a/src/v0/destinations/drip/util.js +++ b/src/v0/destinations/drip/util.js @@ -1,8 +1,8 @@ +const { NetworkError, AbortedError } = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const logger = require('../../../logger'); const { constructPayload, isDefinedAndNotNull } = require('../../util'); -const { NetworkError, AbortedError } = require('../../util/errorTypes'); const { ENDPOINT, productMapping } = require('./config'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/engage/deleteUsers.js b/src/v0/destinations/engage/deleteUsers.js index 940529ea0c..a3c3055c7d 100644 --- a/src/v0/destinations/engage/deleteUsers.js +++ b/src/v0/destinations/engage/deleteUsers.js @@ -1,3 +1,4 @@ +const { ConfigurationError, NetworkError } = require('@rudderstack/integrations-lib'); const { httpDELETE } = require('../../../adapters/network'); const { processAxiosResponse, @@ -5,7 +6,6 @@ const { } = require('../../../adapters/utils/networkUtils'); const { isHttpStatusSuccess } = require('../../util'); const tags = require('../../util/tags'); -const { ConfigurationError, NetworkError } = require('../../util/errorTypes'); const { executeCommonValidations } = require('../../util/regulation-api'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/engage/transform.js b/src/v0/destinations/engage/transform.js index 98b8bb2bb9..f5daafb98c 100644 --- a/src/v0/destinations/engage/transform.js +++ b/src/v0/destinations/engage/transform.js @@ -1,4 +1,5 @@ const { set } = require('lodash'); +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, constructPayload, @@ -14,7 +15,6 @@ const { getDestinationExternalID } = require('../../util'); const { EventType } = require('../../../constants'); const { mappingConfig, ConfigCategories } = require('./config'); const { refinePayload, generatePageName, getLists } = require('./utils'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const UID_ERROR_MSG = 'Neither externalId nor userId is available'; diff --git a/src/v0/destinations/eventbridge/transform.js b/src/v0/destinations/eventbridge/transform.js index 71c7731074..53c74d0f88 100644 --- a/src/v0/destinations/eventbridge/transform.js +++ b/src/v0/destinations/eventbridge/transform.js @@ -1,5 +1,5 @@ +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { removeUndefinedAndNullValues, simpleProcessRouterDest } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); function getResouceList(config) { let resource; diff --git a/src/v0/destinations/facebook_offline_conversions/transform.js b/src/v0/destinations/facebook_offline_conversions/transform.js index e30bc2fa9a..cc95270fcc 100644 --- a/src/v0/destinations/facebook_offline_conversions/transform.js +++ b/src/v0/destinations/facebook_offline_conversions/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, simpleProcessRouterDest, @@ -7,7 +8,6 @@ const { const { offlineConversionResponseBuilder, prepareUrls } = require('./utils'); const { EventType } = require('../../../constants'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const responseBuilder = (endpoint) => { if (endpoint) { diff --git a/src/v0/destinations/facebook_offline_conversions/utils.js b/src/v0/destinations/facebook_offline_conversions/utils.js index 819bf8056d..c48de4e0b9 100644 --- a/src/v0/destinations/facebook_offline_conversions/utils.js +++ b/src/v0/destinations/facebook_offline_conversions/utils.js @@ -1,5 +1,6 @@ const sha256 = require('sha256'); const get = require('get-value'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { isObject, formatTimeStamp, @@ -22,7 +23,6 @@ const { eventToStandardMapping, MATCH_KEY_FIELD_TYPE_DICTIONARY, } = require('./config'); -const { ConfigurationError } = require('../../util/errorTypes'); /** * @param {*} message diff --git a/src/v0/destinations/facebook_pixel/transform.js b/src/v0/destinations/facebook_pixel/transform.js index 02c416cfde..7c55b61302 100644 --- a/src/v0/destinations/facebook_pixel/transform.js +++ b/src/v0/destinations/facebook_pixel/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-param-reassign */ const get = require('get-value'); const moment = require('moment'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const stats = require('../../../util/stats'); const { CONFIG_CATEGORIES, @@ -36,8 +37,6 @@ const { formingFinalResponse, } = require('../../util/facebookUtils'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); - const responseBuilderSimple = (message, category, destination) => { const { Config, ID } = destination; const { pixelId, accessToken } = Config; diff --git a/src/v0/destinations/facebook_pixel/utils.js b/src/v0/destinations/facebook_pixel/utils.js index d642c446fd..1901edf306 100644 --- a/src/v0/destinations/facebook_pixel/utils.js +++ b/src/v0/destinations/facebook_pixel/utils.js @@ -1,7 +1,7 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { isObject } = require('../../util'); const { ACTION_SOURCES_VALUES, CONFIG_CATEGORIES, OTHER_STANDARD_EVENTS } = require('./config'); const { getContentType, getContentCategory } = require('../../util/facebookUtils'); -const { InstrumentationError } = require('../../util/errorTypes'); /** format revenue according to fb standards with max two decimal places. * @param revenue diff --git a/src/v0/destinations/factorsai/transform.js b/src/v0/destinations/factorsai/transform.js index dd2dad42fc..9824b73bbf 100644 --- a/src/v0/destinations/factorsai/transform.js +++ b/src/v0/destinations/factorsai/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { @@ -9,7 +10,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { InstrumentationError } = require('../../util/errorTypes'); const { ConfigCategories, mappingConfig, BASE_URL } = require('./config'); diff --git a/src/v0/destinations/fb/transform.js b/src/v0/destinations/fb/transform.js index 756c74ba83..c0d78a2b3f 100644 --- a/src/v0/destinations/fb/transform.js +++ b/src/v0/destinations/fb/transform.js @@ -1,6 +1,7 @@ const get = require('get-value'); const set = require('set-value'); const sha256 = require('sha256'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { removeUndefinedValues, @@ -20,7 +21,6 @@ const { eventPropToTypeMapping, } = require('./config'); const logger = require('../../../logger'); -const { InstrumentationError } = require('../../util/errorTypes'); // const funcMap = { // integer: parseInt, diff --git a/src/v0/destinations/fb_custom_audience/transform.js b/src/v0/destinations/fb_custom_audience/transform.js index f31a3dd42e..9320a3476b 100644 --- a/src/v0/destinations/fb_custom_audience/transform.js +++ b/src/v0/destinations/fb_custom_audience/transform.js @@ -1,5 +1,10 @@ const lodash = require('lodash'); const get = require('get-value'); +const { + InstrumentationError, + TransformationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, defaultPostRequestConfig, @@ -26,11 +31,6 @@ const { } = require('./config'); const { MappedToDestinationKey } = require('../../../constants'); -const { - InstrumentationError, - TransformationError, - ConfigurationError, -} = require('../../util/errorTypes'); const responseBuilderSimple = (payload, audienceId) => { if (payload) { diff --git a/src/v0/destinations/fb_custom_audience/util.js b/src/v0/destinations/fb_custom_audience/util.js index 9e7198e393..47ccb9bf7d 100644 --- a/src/v0/destinations/fb_custom_audience/util.js +++ b/src/v0/destinations/fb_custom_audience/util.js @@ -2,11 +2,11 @@ const lodash = require('lodash'); const sha256 = require('sha256'); const get = require('get-value'); const jsonSize = require('json-size'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const stats = require('../../../util/stats'); const { isDefinedAndNotNull } = require('../../util'); const { maxPayloadSize } = require('./config'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); /** * Example payload ={ diff --git a/src/v0/destinations/firehose/transform.js b/src/v0/destinations/firehose/transform.js index b0dc841579..81e2a1ebc8 100644 --- a/src/v0/destinations/firehose/transform.js +++ b/src/v0/destinations/firehose/transform.js @@ -1,6 +1,6 @@ const isString = require('lodash/isString'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { getHashFromArray, simpleProcessRouterDest } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); function getDeliveryStreamMapTo(event) { const { message, destination } = event; diff --git a/src/v0/destinations/freshmarketer/transform.js b/src/v0/destinations/freshmarketer/transform.js index 41c604d407..aa0e03811d 100644 --- a/src/v0/destinations/freshmarketer/transform.js +++ b/src/v0/destinations/freshmarketer/transform.js @@ -1,4 +1,9 @@ const get = require('get-value'); +const { + InstrumentationError, + NetworkInstrumentationError, + TransformationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -9,11 +14,6 @@ const { getValidDynamicFormConfig, simpleProcessRouterDest, } = require('../../util'); -const { - InstrumentationError, - NetworkInstrumentationError, - TransformationError, -} = require('../../util/errorTypes'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { diff --git a/src/v0/destinations/freshmarketer/utils.js b/src/v0/destinations/freshmarketer/utils.js index f7dcc46b06..6fa1fe9976 100644 --- a/src/v0/destinations/freshmarketer/utils.js +++ b/src/v0/destinations/freshmarketer/utils.js @@ -1,5 +1,10 @@ /* eslint-disable no-param-reassign */ const get = require('get-value'); +const { + InstrumentationError, + NetworkInstrumentationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const logger = require('../../../logger'); const { httpPOST, httpGET } = require('../../../adapters/network'); const { @@ -13,11 +18,6 @@ const { getFieldValueFromMessage, } = require('../../util'); const { CONFIG_CATEGORIES, LIFECYCLE_STAGE_ENDPOINT } = require('./config'); -const { - InstrumentationError, - NetworkInstrumentationError, - NetworkError, -} = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/freshsales/transform.js b/src/v0/destinations/freshsales/transform.js index c1e18482ed..096a2d749c 100644 --- a/src/v0/destinations/freshsales/transform.js +++ b/src/v0/destinations/freshsales/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -10,7 +11,6 @@ const { simpleProcessRouterDest, validateEventName, } = require('../../util'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { getUserAccountDetails, diff --git a/src/v0/destinations/freshsales/utils.js b/src/v0/destinations/freshsales/utils.js index b30d9fa16b..96acabb037 100644 --- a/src/v0/destinations/freshsales/utils.js +++ b/src/v0/destinations/freshsales/utils.js @@ -1,5 +1,10 @@ /* eslint-disable no-param-reassign */ const get = require('get-value'); +const { + NetworkInstrumentationError, + InstrumentationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const { httpPOST, httpGET } = require('../../../adapters/network'); const { processAxiosResponse, @@ -10,11 +15,6 @@ const { defaultPostRequestConfig, getFieldValueFromMessage, } = require('../../util'); -const { - NetworkInstrumentationError, - InstrumentationError, - NetworkError, -} = require('../../util/errorTypes'); const { CONFIG_CATEGORIES, LIFECYCLE_STAGE_ENDPOINT } = require('./config'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/ga/deleteUsers.js b/src/v0/destinations/ga/deleteUsers.js index cf4694f44a..bb909a0053 100644 --- a/src/v0/destinations/ga/deleteUsers.js +++ b/src/v0/destinations/ga/deleteUsers.js @@ -1,7 +1,7 @@ const { isEmpty } = require('lodash'); +const { InstrumentationError, OAuthSecretError } = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); -const { InstrumentationError, OAuthSecretError } = require('../../util/errorTypes'); const { executeCommonValidations } = require('../../util/regulation-api'); const { GA_USER_DELETION_ENDPOINT } = require('./config'); const { gaResponseHandler } = require('./networkHandler'); diff --git a/src/v0/destinations/ga/networkHandler.js b/src/v0/destinations/ga/networkHandler.js index a12f9594cd..57db1cb7af 100644 --- a/src/v0/destinations/ga/networkHandler.js +++ b/src/v0/destinations/ga/networkHandler.js @@ -1,3 +1,4 @@ +const { NetworkError, InvalidAuthTokenError } = require('@rudderstack/integrations-lib'); const { REFRESH_TOKEN, AUTH_STATUS_INACTIVE, @@ -7,7 +8,6 @@ const { getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, InvalidAuthTokenError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); /** diff --git a/src/v0/destinations/ga/transform.js b/src/v0/destinations/ga/transform.js index c10697c4e1..32e94bdd41 100644 --- a/src/v0/destinations/ga/transform.js +++ b/src/v0/destinations/ga/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-nested-ternary */ const get = require('get-value'); const md5 = require('md5'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType, MappedToDestinationKey } = require('../../../constants'); const { Event, GA_ENDPOINT, ConfigCategory, mappingConfig, nameToEventMap } = require('./config'); const { setContextualFields } = require('./utils'); @@ -19,7 +20,6 @@ const { } = require('../../util'); const { isDefinedAndNotNull } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const gaDisplayName = 'Google Analytics'; diff --git a/src/v0/destinations/ga/utils.js b/src/v0/destinations/ga/utils.js index 0d3a2f9798..617f2522a0 100644 --- a/src/v0/destinations/ga/utils.js +++ b/src/v0/destinations/ga/utils.js @@ -1,4 +1,4 @@ -const { InstrumentationError } = require('../../util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { GA_ENDPOINT } = require('./config'); /** diff --git a/src/v0/destinations/ga360/transform.js b/src/v0/destinations/ga360/transform.js index c60ea47551..3655c330d5 100644 --- a/src/v0/destinations/ga360/transform.js +++ b/src/v0/destinations/ga360/transform.js @@ -1,5 +1,6 @@ const get = require('get-value'); const md5 = require('md5'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { Event, GA_ENDPOINT, ConfigCategory, mappingConfig, nameToEventMap } = require('./config'); const { @@ -12,7 +13,6 @@ const { getDestinationExternalID, simpleProcessRouterDest, } = require('../../util'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const gaDisplayName = 'Google Analytics'; diff --git a/src/v0/destinations/ga4/networkHandler.js b/src/v0/destinations/ga4/networkHandler.js index e90d2c3095..b62fcc8d3b 100644 --- a/src/v0/destinations/ga4/networkHandler.js +++ b/src/v0/destinations/ga4/networkHandler.js @@ -1,3 +1,4 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network'); const { getDynamicErrorType, @@ -5,7 +6,6 @@ const { } = require('../../../adapters/utils/networkUtils'); const { isDefinedAndNotNull, isDefined, isHttpStatusSuccess } = require('../../util'); -const { NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const responseHandler = (destinationResponse, dest) => { diff --git a/src/v0/destinations/ga4/transform.js b/src/v0/destinations/ga4/transform.js index d1d0790fa9..d8fc531e92 100644 --- a/src/v0/destinations/ga4/transform.js +++ b/src/v0/destinations/ga4/transform.js @@ -1,4 +1,9 @@ const get = require('get-value'); +const { + ConfigurationError, + InstrumentationError, + UnsupportedEventError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { isEmptyObject, @@ -11,11 +16,6 @@ const { getDestinationExternalID, removeUndefinedAndNullValues, } = require('../../util'); -const { - ConfigurationError, - InstrumentationError, - UnsupportedEventError, -} = require('../../util/errorTypes'); const { ENDPOINT, mappingConfig, diff --git a/src/v0/destinations/ga4/utils.js b/src/v0/destinations/ga4/utils.js index d356300ff7..e4db494727 100644 --- a/src/v0/destinations/ga4/utils.js +++ b/src/v0/destinations/ga4/utils.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { isEmpty, constructPayload, @@ -7,7 +8,6 @@ const { extractCustomFields, isDefinedAndNotNull, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { mappingConfig, ConfigCategory } = require('./config'); /** diff --git a/src/v0/destinations/gainsight/transform.js b/src/v0/destinations/gainsight/transform.js index f58fc0d566..f47296f066 100644 --- a/src/v0/destinations/gainsight/transform.js +++ b/src/v0/destinations/gainsight/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-nested-ternary */ const set = require('set-value'); const get = require('get-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { identifyMapping, @@ -28,7 +29,6 @@ const { renameCustomFieldsFromMap, getConfigOrThrowError, } = require('./util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); /** diff --git a/src/v0/destinations/gainsight/util.js b/src/v0/destinations/gainsight/util.js index 3c986b420d..39e666c1a5 100644 --- a/src/v0/destinations/gainsight/util.js +++ b/src/v0/destinations/gainsight/util.js @@ -1,7 +1,11 @@ +const { + ConfigurationError, + RetryableError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const logger = require('../../../logger'); -const { ConfigurationError, RetryableError, NetworkError } = require('../../util/errorTypes'); const { ENDPOINTS, getLookupPayload } = require('./config'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/gainsight_px/transform.js b/src/v0/destinations/gainsight_px/transform.js index ab66b87c5a..4d91980f11 100644 --- a/src/v0/destinations/gainsight_px/transform.js +++ b/src/v0/destinations/gainsight_px/transform.js @@ -1,4 +1,5 @@ /* eslint-disable no-nested-ternary */ +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { isEmptyObject, @@ -29,7 +30,6 @@ const { groupMapping, identifyMapping, } = require('./config'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); /** diff --git a/src/v0/destinations/gainsight_px/util.js b/src/v0/destinations/gainsight_px/util.js index 6900180ab5..5109286b3f 100644 --- a/src/v0/destinations/gainsight_px/util.js +++ b/src/v0/destinations/gainsight_px/util.js @@ -1,6 +1,6 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { ENDPOINTS } = require('./config'); -const { NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js b/src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js index e25349dfdc..8ac432935f 100644 --- a/src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js +++ b/src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js @@ -1,5 +1,6 @@ const { get, set } = require('lodash'); const sha256 = require('sha256'); +const { NetworkError, NetworkInstrumentationError } = require('@rudderstack/integrations-lib'); const { prepareProxyRequest, handleHttpRequest } = require('../../../adapters/network'); const { isHttpStatusSuccess, getAuthErrCategoryFromStCode } = require('../../util/index'); const { CONVERSION_ACTION_ID_CACHE_TTL } = require('./config'); @@ -12,7 +13,7 @@ const { getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); const { BASE_ENDPOINT } = require('./config'); -const { NetworkError, NetworkInstrumentationError } = require('../../util/errorTypes'); + const tags = require('../../util/tags'); const ERROR_MSG_PATH = 'response[0].error.message'; diff --git a/src/v0/destinations/google_adwords_enhanced_conversions/transform.js b/src/v0/destinations/google_adwords_enhanced_conversions/transform.js index 898c3f95b0..0be7c3f0ee 100644 --- a/src/v0/destinations/google_adwords_enhanced_conversions/transform.js +++ b/src/v0/destinations/google_adwords_enhanced_conversions/transform.js @@ -2,6 +2,7 @@ const get = require('get-value'); const { cloneDeep } = require('lodash'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { constructPayload, defaultRequestConfig, @@ -11,8 +12,6 @@ const { getAccessToken, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); - const { trackMapping, BASE_ENDPOINT } = require('./config'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js b/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js index 71fdccff20..a87a2431f2 100644 --- a/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js +++ b/src/v0/destinations/google_adwords_offline_conversions/networkHandler.js @@ -1,6 +1,11 @@ const set = require('set-value'); const get = require('get-value'); const sha256 = require('sha256'); +const { + AbortedError, + NetworkInstrumentationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const { prepareProxyRequest, httpSend, httpPOST } = require('../../../adapters/network'); const { isHttpStatusSuccess, @@ -15,11 +20,6 @@ const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { - AbortedError, - NetworkInstrumentationError, - NetworkError, -} = require('../../util/errorTypes'); const tags = require('../../util/tags'); const conversionCustomVariableCache = new Cache(CONVERSION_CUSTOM_VARIABLE_CACHE_TTL); diff --git a/src/v0/destinations/google_adwords_offline_conversions/transform.js b/src/v0/destinations/google_adwords_offline_conversions/transform.js index 0186739d37..397895c603 100644 --- a/src/v0/destinations/google_adwords_offline_conversions/transform.js +++ b/src/v0/destinations/google_adwords_offline_conversions/transform.js @@ -1,4 +1,5 @@ const { set, get } = require('lodash'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { getHashFromArrayWithDuplicate, @@ -21,7 +22,6 @@ const { requestBuilder, getClickConversionPayloadAndEndpoint, } = require('./utils'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const helper = require('./helper'); /** diff --git a/src/v0/destinations/google_adwords_offline_conversions/utils.js b/src/v0/destinations/google_adwords_offline_conversions/utils.js index 7fa5eb29af..c69c5a436f 100644 --- a/src/v0/destinations/google_adwords_offline_conversions/utils.js +++ b/src/v0/destinations/google_adwords_offline_conversions/utils.js @@ -1,5 +1,10 @@ const sha256 = require('sha256'); const { get, set, cloneDeep } = require('lodash'); +const { + AbortedError, + ConfigurationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { isHttpStatusSuccess, @@ -24,7 +29,6 @@ const { } = require('./config'); const { processAxiosResponse } = require('../../../adapters/utils/networkUtils'); const Cache = require('../../util/cache'); -const { AbortedError, ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const helper = require('./helper'); const conversionActionIdCache = new Cache(CONVERSION_ACTION_ID_CACHE_TTL); diff --git a/src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js b/src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js index b8470f9d28..5be8597bdb 100644 --- a/src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js +++ b/src/v0/destinations/google_adwords_remarketing_lists/networkHandler.js @@ -1,3 +1,4 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { httpSend, prepareProxyRequest } = require('../../../adapters/network'); const { isHttpStatusSuccess, getAuthErrCategoryFromStCode } = require('../../util/index'); @@ -5,7 +6,6 @@ const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); /** * This function helps to create a offlineUserDataJobs diff --git a/src/v0/destinations/google_adwords_remarketing_lists/transform.js b/src/v0/destinations/google_adwords_remarketing_lists/transform.js index f8cd7c7037..884fcd71f6 100644 --- a/src/v0/destinations/google_adwords_remarketing_lists/transform.js +++ b/src/v0/destinations/google_adwords_remarketing_lists/transform.js @@ -1,5 +1,6 @@ const sha256 = require('sha256'); const get = require('get-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const logger = require('../../../logger'); const { isDefinedAndNotNullAndNotEmpty, @@ -14,7 +15,6 @@ const { getAccessToken, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { offlineDataJobsMapping, addressInfoMapping, diff --git a/src/v0/destinations/google_cloud_function/util.js b/src/v0/destinations/google_cloud_function/util.js index 0a4fb9f4de..8f85460902 100644 --- a/src/v0/destinations/google_cloud_function/util.js +++ b/src/v0/destinations/google_cloud_function/util.js @@ -1,4 +1,4 @@ -const { ConfigurationError } = require('../../util/errorTypes'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); /** * validate destination config diff --git a/src/v0/destinations/googlepubsub/transform.js b/src/v0/destinations/googlepubsub/transform.js index 44208735e0..7a022d6c29 100644 --- a/src/v0/destinations/googlepubsub/transform.js +++ b/src/v0/destinations/googlepubsub/transform.js @@ -1,5 +1,5 @@ +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { simpleProcessRouterDest } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); const { getTopic, createAttributesMetadata } = require('./util'); diff --git a/src/v0/destinations/googlesheets/transform.js b/src/v0/destinations/googlesheets/transform.js index 6cfb3f1d1e..6e27f6192c 100644 --- a/src/v0/destinations/googlesheets/transform.js +++ b/src/v0/destinations/googlesheets/transform.js @@ -1,12 +1,12 @@ /* eslint-disable no-nested-ternary */ const get = require('get-value'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { getValueFromMessage, getSuccessRespEvents, handleRtTfSingleEventError, checkInvalidRtTfEvents, } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); const SOURCE_KEYS = ['properties', 'traits', 'context.traits']; diff --git a/src/v0/destinations/heap/transform.js b/src/v0/destinations/heap/transform.js index 32196eb7be..4256324165 100644 --- a/src/v0/destinations/heap/transform.js +++ b/src/v0/destinations/heap/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { EventType } = require('../../../constants'); const { @@ -8,7 +9,6 @@ const { flattenJson, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function responseBuilderSimple(message, category, destination) { diff --git a/src/v0/destinations/hs/HSTransform-v1.js b/src/v0/destinations/hs/HSTransform-v1.js index 30546ad8f6..51feebea74 100644 --- a/src/v0/destinations/hs/HSTransform-v1.js +++ b/src/v0/destinations/hs/HSTransform-v1.js @@ -1,5 +1,10 @@ const get = require('get-value'); const lodash = require('lodash'); +const { + InstrumentationError, + ConfigurationError, + TransformationError, +} = require('@rudderstack/integrations-lib'); const { MappedToDestinationKey, GENERIC_TRUE_VALUES } = require('../../../constants'); const { defaultGetRequestConfig, @@ -14,11 +19,6 @@ const { getDestinationExternalID, getDestinationExternalIDInfoForRetl, } = require('../../util'); -const { - InstrumentationError, - ConfigurationError, - TransformationError, -} = require('../../util/errorTypes'); const { BATCH_CONTACT_ENDPOINT, MAX_BATCH_SIZE, diff --git a/src/v0/destinations/hs/HSTransform-v2.js b/src/v0/destinations/hs/HSTransform-v2.js index 26c12d3eea..2acdd82152 100644 --- a/src/v0/destinations/hs/HSTransform-v2.js +++ b/src/v0/destinations/hs/HSTransform-v2.js @@ -1,5 +1,10 @@ const get = require('get-value'); const lodash = require('lodash'); +const { + TransformationError, + ConfigurationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { MappedToDestinationKey, GENERIC_TRUE_VALUES } = require('../../../constants'); const { defaultPostRequestConfig, @@ -16,11 +21,6 @@ const { getDestinationExternalIDInfoForRetl, getDestinationExternalIDObjectForRetl, } = require('../../util'); -const { - TransformationError, - ConfigurationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { IDENTIFY_CRM_UPDATE_CONTACT, IDENTIFY_CRM_CREATE_NEW_CONTACT, diff --git a/src/v0/destinations/hs/transform.js b/src/v0/destinations/hs/transform.js index a2326e0395..c26e024a6c 100644 --- a/src/v0/destinations/hs/transform.js +++ b/src/v0/destinations/hs/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { checkInvalidRtTfEvents, @@ -19,7 +20,6 @@ const { getProperties, validateDestinationConfig, } = require('./util'); -const { InstrumentationError } = require('../../util/errorTypes'); const processSingleMessage = async (message, destination, propertyMap) => { if (!message.type) { diff --git a/src/v0/destinations/hs/util.js b/src/v0/destinations/hs/util.js index eb062b0c39..72025997d2 100644 --- a/src/v0/destinations/hs/util.js +++ b/src/v0/destinations/hs/util.js @@ -1,4 +1,10 @@ const get = require('get-value'); +const { + NetworkInstrumentationError, + InstrumentationError, + ConfigurationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const { httpGET, httpPOST } = require('../../../adapters/network'); const { processAxiosResponse, @@ -12,12 +18,6 @@ const { getDestinationExternalIDInfoForRetl, getValueFromMessage, } = require('../../util'); -const { - NetworkInstrumentationError, - InstrumentationError, - ConfigurationError, - NetworkError, -} = require('../../util/errorTypes'); const { CONTACT_PROPERTY_MAP_ENDPOINT, IDENTIFY_CRM_SEARCH_CONTACT, diff --git a/src/v0/destinations/impact/transform.js b/src/v0/destinations/impact/transform.js index 026318cec7..2eefdf7992 100644 --- a/src/v0/destinations/impact/transform.js +++ b/src/v0/destinations/impact/transform.js @@ -1,5 +1,10 @@ const sha1 = require('js-sha1'); const btoa = require('btoa'); +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { @@ -17,11 +22,6 @@ const { removeUndefinedAndNullValues, isDefinedAndNotNullAndNotEmpty, } = require('../../util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); /** * This function takes the transformed payload, endpoint and destination Config as input and returns the prepared response. diff --git a/src/v0/destinations/indicative/transform.js b/src/v0/destinations/indicative/transform.js index 81eb19f320..000998c3b8 100644 --- a/src/v0/destinations/indicative/transform.js +++ b/src/v0/destinations/indicative/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { @@ -9,7 +10,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { getUAInfo } = require('./utils'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const handleProperties = (properties) => { diff --git a/src/v0/destinations/intercom/deleteUsers.js b/src/v0/destinations/intercom/deleteUsers.js index 9241a22906..e11d352117 100644 --- a/src/v0/destinations/intercom/deleteUsers.js +++ b/src/v0/destinations/intercom/deleteUsers.js @@ -1,8 +1,8 @@ +const { NetworkError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { processAxiosResponse } = require('../../../adapters/utils/networkUtils'); const { isHttpStatusSuccess } = require('../../util'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, ConfigurationError } = require('../../util/errorTypes'); const { executeCommonValidations } = require('../../util/regulation-api'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/intercom/networkHandler.js b/src/v0/destinations/intercom/networkHandler.js index 33f78e8cf6..a4106257b3 100644 --- a/src/v0/destinations/intercom/networkHandler.js +++ b/src/v0/destinations/intercom/networkHandler.js @@ -1,8 +1,7 @@ +const { RetryableError } = require('@rudderstack/integrations-lib'); const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network'); const { processAxiosResponse } = require('../../../adapters/utils/networkUtils'); -const { RetryableError } = require('../../util/errorTypes'); - const errorResponseHandler = (destinationResponse, dest) => { const { status } = destinationResponse; if (status === 408) { diff --git a/src/v0/destinations/intercom/transform.js b/src/v0/destinations/intercom/transform.js index 552c80527c..212eaba13b 100644 --- a/src/v0/destinations/intercom/transform.js +++ b/src/v0/destinations/intercom/transform.js @@ -1,5 +1,6 @@ const md5 = require('md5'); const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType, MappedToDestinationKey } = require('../../../constants'); const { ConfigCategory, @@ -18,7 +19,6 @@ const { flattenJson, } = require('../../util'); const { separateReservedAndRestMetadata } = require('./util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function getCompanyAttribute(company) { diff --git a/src/v0/destinations/iterable/deleteUsers.js b/src/v0/destinations/iterable/deleteUsers.js index 834cccd4cb..a179a8930f 100644 --- a/src/v0/destinations/iterable/deleteUsers.js +++ b/src/v0/destinations/iterable/deleteUsers.js @@ -1,8 +1,8 @@ +const { NetworkError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { httpDELETE } = require('../../../adapters/network'); const { processAxiosResponse } = require('../../../adapters/utils/networkUtils'); const { isHttpStatusSuccess } = require('../../util'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, ConfigurationError } = require('../../util/errorTypes'); const { executeCommonValidations } = require('../../util/regulation-api'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/iterable/transform.js b/src/v0/destinations/iterable/transform.js index c54b579a52..64bdcfcfa4 100644 --- a/src/v0/destinations/iterable/transform.js +++ b/src/v0/destinations/iterable/transform.js @@ -1,5 +1,6 @@ const lodash = require('lodash'); const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { getCatalogEndpoint, hasMultipleResponses, @@ -26,7 +27,6 @@ const { } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); const { mappingConfig, ConfigCategory } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); const { EventType, MappedToDestinationKey } = require('../../../constants'); /** diff --git a/src/v0/destinations/iterable/util.js b/src/v0/destinations/iterable/util.js index 0b7e402f01..7c1509c2b7 100644 --- a/src/v0/destinations/iterable/util.js +++ b/src/v0/destinations/iterable/util.js @@ -1,6 +1,7 @@ const lodash = require('lodash'); const get = require('get-value'); const jsonSize = require('json-size'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { isAppleFamily, constructPayload, @@ -20,7 +21,6 @@ const { } = require('./config'); const { JSON_MIME_TYPE } = require('../../util/constant'); const { EventType, MappedToDestinationKey } = require('../../../constants'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const MESSAGE_JSON_PATH = 'message.body.JSON'; diff --git a/src/v0/destinations/june/transform.js b/src/v0/destinations/june/transform.js index f85cb0fd3d..c8f3206903 100644 --- a/src/v0/destinations/june/transform.js +++ b/src/v0/destinations/june/transform.js @@ -1,3 +1,4 @@ +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { isEmptyObject, constructPayload, @@ -10,7 +11,6 @@ const { const { EventType } = require('../../../constants'); const { JSON_MIME_TYPE } = require('../../util/constant'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const responseBuilder = (payload, endpoint, destination) => { const destPayload = payload; diff --git a/src/v0/destinations/kafka/transform.js b/src/v0/destinations/kafka/transform.js index 39334b5f52..b08c717475 100644 --- a/src/v0/destinations/kafka/transform.js +++ b/src/v0/destinations/kafka/transform.js @@ -8,7 +8,6 @@ const { getSuccessRespEvents, getErrorRespEvents, } = require('../../util'); -// const { InstrumentationError } = require("../../util/errorTypes"); const filterConfigTopics = (message, destination) => { const { Config } = destination; diff --git a/src/v0/destinations/keen/transform.js b/src/v0/destinations/keen/transform.js index 6d99c90dcc..b68b5e5e1d 100644 --- a/src/v0/destinations/keen/transform.js +++ b/src/v0/destinations/keen/transform.js @@ -2,6 +2,7 @@ /* eslint-disable no-nested-ternary */ const isIp = require('is-ip'); const validUrl = require('valid-url'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultPostRequestConfig, @@ -10,7 +11,6 @@ const { getFieldValueFromMessage, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { ENDPOINT } = require('./config'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/kissmetrics/transform.js b/src/v0/destinations/kissmetrics/transform.js index 3e2c5593de..b24395076c 100644 --- a/src/v0/destinations/kissmetrics/transform.js +++ b/src/v0/destinations/kissmetrics/transform.js @@ -9,6 +9,7 @@ const is = require('is'); const extend = require('@ndhoule/extend'); const each = require('component-each'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultGetRequestConfig, @@ -17,7 +18,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { ENDPOINT } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); // source : https://github.com/segment-integrations/analytics.js-integration-kissmetrics/blob/master/lib/index.js function toUnixTimestamp(date) { diff --git a/src/v0/destinations/klaviyo/transform.js b/src/v0/destinations/klaviyo/transform.js index 5ad9b1869d..7c9061fc41 100644 --- a/src/v0/destinations/klaviyo/transform.js +++ b/src/v0/destinations/klaviyo/transform.js @@ -2,6 +2,7 @@ /* eslint-disable no-underscore-dangle */ /* eslint-disable array-callback-return */ const get = require('get-value'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType, WhiteListedTraits, MappedToDestinationKey } = require('../../../constants'); const { CONFIG_CATEGORIES, @@ -36,7 +37,6 @@ const { flattenJson, isNewStatusCodesAccepted, } = require('../../util'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE, HTTP_STATUS_CODES } = require('../../util/constant'); /** @@ -373,8 +373,9 @@ const processRouterDest = async (inputs, reqMetadata) => { eventDestination, false, HTTP_STATUS_CODES.SUPPRESS_EVENTS, - ), error - } + ), + error, + }; } return getSuccessRespEvents(message, [metadata], eventDestination); }); diff --git a/src/v0/destinations/klaviyo/util.js b/src/v0/destinations/klaviyo/util.js index b31dafd78b..60b334f3a2 100644 --- a/src/v0/destinations/klaviyo/util.js +++ b/src/v0/destinations/klaviyo/util.js @@ -1,5 +1,6 @@ const { defaultRequestConfig } = require('rudder-transformer-cdk/build/utils'); const lodash = require('lodash'); +const { NetworkError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { WhiteListedTraits } = require('../../../constants'); const { @@ -15,7 +16,6 @@ const { const tags = require('../../util/tags'); const { handleHttpRequest } = require('../../../adapters/network'); const { JSON_MIME_TYPE, HTTP_STATUS_CODES } = require('../../util/constant'); -const { NetworkError, InstrumentationError } = require('../../util/errorTypes'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const { BASE_ENDPOINT, MAPPING_CONFIG, CONFIG_CATEGORIES, MAX_BATCH_SIZE } = require('./config'); diff --git a/src/v0/destinations/kochava/transform.js b/src/v0/destinations/kochava/transform.js index c5a4fec81f..e9cf2eb1a0 100644 --- a/src/v0/destinations/kochava/transform.js +++ b/src/v0/destinations/kochava/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { KOCHAVA_ENDPOINT, @@ -11,7 +12,6 @@ const { formatTimeStamp, isAppleFamily, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); // build final response // -------------------- diff --git a/src/v0/destinations/kustomer/transform.js b/src/v0/destinations/kustomer/transform.js index 2898f0dfc2..e5010f55e0 100644 --- a/src/v0/destinations/kustomer/transform.js +++ b/src/v0/destinations/kustomer/transform.js @@ -1,5 +1,6 @@ /* eslint-disable no-nested-ternary */ const get = require('get-value'); +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, DEFAULT_BASE_ENDPOINT } = require('./config'); const { @@ -13,7 +14,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { fetchKustomer, handleAdvancedtransformations } = require('./util'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); // Function responsible for constructing the Kustomer (User) Payload for identify diff --git a/src/v0/destinations/kustomer/util.js b/src/v0/destinations/kustomer/util.js index 31157b2738..571a03f139 100644 --- a/src/v0/destinations/kustomer/util.js +++ b/src/v0/destinations/kustomer/util.js @@ -2,11 +2,11 @@ const lodash = require('lodash'); const set = require('set-value'); const get = require('get-value'); +const { NetworkError, AbortedError } = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { DEFAULT_BASE_ENDPOINT } = require('./config'); const { getType, isDefinedAndNotNull, isObject } = require('../../util'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, AbortedError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); /** diff --git a/src/v0/destinations/lambda/transform.js b/src/v0/destinations/lambda/transform.js index 221ef18186..1570a69ec3 100644 --- a/src/v0/destinations/lambda/transform.js +++ b/src/v0/destinations/lambda/transform.js @@ -1,6 +1,6 @@ const _ = require('lodash'); const { getErrorRespEvents, getSuccessRespEvents } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const DEFAULT_INVOCATION_TYPE = 'Event'; // asynchronous invocation const MAX_PAYLOAD_SIZE_IN_KB = 256; // only for asynchronous invocation diff --git a/src/v0/destinations/leanplum/transform.js b/src/v0/destinations/leanplum/transform.js index 9a5462f2e5..df075dd631 100644 --- a/src/v0/destinations/leanplum/transform.js +++ b/src/v0/destinations/leanplum/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ConfigCategory, mappingConfig, ENDPOINT, API_VERSION } = require('./config'); const { @@ -7,7 +8,6 @@ const { constructPayload, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function preparePayload(message, name, destination) { diff --git a/src/v0/destinations/lemnisk/transform.js b/src/v0/destinations/lemnisk/transform.js index 1d6d9a89fb..905199079b 100644 --- a/src/v0/destinations/lemnisk/transform.js +++ b/src/v0/destinations/lemnisk/transform.js @@ -1,3 +1,8 @@ +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, @@ -14,11 +19,6 @@ const { isDefinedAndNotNullAndNotEmpty, } = require('../../util'); const { fetchPlatform } = require('./utils'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (message, category, destination, platform) => { diff --git a/src/v0/destinations/lemnisk/utils.js b/src/v0/destinations/lemnisk/utils.js index 207122153d..28de9ab354 100644 --- a/src/v0/destinations/lemnisk/utils.js +++ b/src/v0/destinations/lemnisk/utils.js @@ -1,4 +1,4 @@ -const { ConfigurationError } = require('../../util/errorTypes'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); /** * Fetches the platform type from the destination Config diff --git a/src/v0/destinations/lytics/transform.js b/src/v0/destinations/lytics/transform.js index a8d489fa5f..c3a971adba 100644 --- a/src/v0/destinations/lytics/transform.js +++ b/src/v0/destinations/lytics/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, @@ -14,7 +15,6 @@ const { flattenJson, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilderSimple = (message, category, destination) => { diff --git a/src/v0/destinations/mailchimp/transform.js b/src/v0/destinations/mailchimp/transform.js index ced92ddea1..894f70672a 100644 --- a/src/v0/destinations/mailchimp/transform.js +++ b/src/v0/destinations/mailchimp/transform.js @@ -1,4 +1,5 @@ const lodash = require('lodash'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { defaultPutRequestConfig, handleRtTfSingleEventError, @@ -23,7 +24,6 @@ const { stringifyPropertiesValues, } = require('./utils'); const { MAX_BATCH_SIZE, VALID_STATUSES, TRACK_CONFIG } = require('./config'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilderSimple = (finalPayload, endpoint, Config, audienceId) => { diff --git a/src/v0/destinations/mailchimp/utils.js b/src/v0/destinations/mailchimp/utils.js index 5a6d62c72c..e1e2e9883b 100644 --- a/src/v0/destinations/mailchimp/utils.js +++ b/src/v0/destinations/mailchimp/utils.js @@ -1,5 +1,6 @@ const get = require('get-value'); const md5 = require('md5'); +const { InstrumentationError, NetworkError } = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { MappedToDestinationKey } = require('../../../constants'); const logger = require('../../../logger'); @@ -15,7 +16,6 @@ const { defaultBatchRequestConfig, constructPayload, } = require('../../util'); -const { InstrumentationError, NetworkError } = require('../../util/errorTypes'); const { MERGE_CONFIG, MERGE_ADDRESS, SUBSCRIPTION_STATUS, VALID_STATUSES } = require('./config'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../util/tags'); diff --git a/src/v0/destinations/mailjet/transform.js b/src/v0/destinations/mailjet/transform.js index 3e3cfe5c81..9156bf45e9 100644 --- a/src/v0/destinations/mailjet/transform.js +++ b/src/v0/destinations/mailjet/transform.js @@ -1,4 +1,5 @@ const lodash = require('lodash'); +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { getErrorRespEvents, getSuccessRespEvents, @@ -12,7 +13,6 @@ const { const { MAX_BATCH_SIZE } = require('./config'); const { EventType } = require('../../../constants'); const { createOrUpdateContactResponseBuilder } = require('./utils'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload) => { diff --git a/src/v0/destinations/mailmodo/transform.js b/src/v0/destinations/mailmodo/transform.js index 39783c864f..756522939d 100644 --- a/src/v0/destinations/mailmodo/transform.js +++ b/src/v0/destinations/mailmodo/transform.js @@ -1,6 +1,7 @@ const lodash = require('lodash'); const get = require('get-value'); const { isEmpty } = require('lodash'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ConfigCategory, IDENTIFY_MAX_BATCH_SIZE, mappingConfig, BASE_URL } = require('./config'); const { @@ -14,7 +15,6 @@ const { handleRtTfSingleEventError, } = require('../../util'); const { deduceAddressFields, extractCustomProperties } = require('./utils'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (responseConfgs) => { diff --git a/src/v0/destinations/marketo/transform.js b/src/v0/destinations/marketo/transform.js index b23d992b64..5000ef506b 100644 --- a/src/v0/destinations/marketo/transform.js +++ b/src/v0/destinations/marketo/transform.js @@ -3,6 +3,11 @@ /* eslint-disable no-use-before-define */ const get = require('get-value'); const cloneDeep = require('lodash/cloneDeep'); +const { + InstrumentationError, + ConfigurationError, + UnauthorizedError, +} = require('@rudderstack/integrations-lib'); const stats = require('../../../util/stats'); const { EventType, MappedToDestinationKey } = require('../../../constants'); const { @@ -38,11 +43,6 @@ const { getResponseHandlerData, } = require('./util'); const logger = require('../../../logger'); -const { - InstrumentationError, - ConfigurationError, - UnauthorizedError, -} = require('../../util/errorTypes'); const userIdLeadCache = new Cache(USER_LEAD_CACHE_TTL); // 1 day const emailLeadCache = new Cache(USER_LEAD_CACHE_TTL); // 1 day diff --git a/src/v0/destinations/marketo/util.js b/src/v0/destinations/marketo/util.js index 0de14e2072..203e0bf859 100644 --- a/src/v0/destinations/marketo/util.js +++ b/src/v0/destinations/marketo/util.js @@ -1,9 +1,3 @@ -const { httpGET, httpPOST } = require('../../../adapters/network'); -const { - getDynamicErrorType, - processAxiosResponse, -} = require('../../../adapters/utils/networkUtils'); -const { isHttpStatusSuccess } = require('../../util/index'); const { NetworkError, AbortedError, @@ -11,7 +5,13 @@ const { RetryableError, UnhandledStatusCodeError, InstrumentationError, -} = require('../../util/errorTypes'); +} = require('@rudderstack/integrations-lib'); +const { httpGET, httpPOST } = require('../../../adapters/network'); +const { + getDynamicErrorType, + processAxiosResponse, +} = require('../../../adapters/utils/networkUtils'); +const { isHttpStatusSuccess } = require('../../util/index'); const tags = require('../../util/tags'); /** diff --git a/src/v0/destinations/marketo_bulk_upload/fetchJobStatus.js b/src/v0/destinations/marketo_bulk_upload/fetchJobStatus.js index 04eadc4c51..e6f5662000 100644 --- a/src/v0/destinations/marketo_bulk_upload/fetchJobStatus.js +++ b/src/v0/destinations/marketo_bulk_upload/fetchJobStatus.js @@ -1,8 +1,8 @@ /* eslint-disable no-restricted-syntax */ /* eslint-disable no-prototype-builtins */ +const { PlatformError } = require('@rudderstack/integrations-lib'); const { getAccessToken } = require('./util'); const { handleHttpRequest } = require('../../../adapters/network'); -const { PlatformError } = require('../../util/errorTypes'); const stats = require('../../../util/stats'); const { JSON_MIME_TYPE } = require('../../util/constant'); const { diff --git a/src/v0/destinations/marketo_bulk_upload/fileUpload.js b/src/v0/destinations/marketo_bulk_upload/fileUpload.js index 2c77cd6e29..c7212ff9cb 100644 --- a/src/v0/destinations/marketo_bulk_upload/fileUpload.js +++ b/src/v0/destinations/marketo_bulk_upload/fileUpload.js @@ -1,6 +1,12 @@ /* eslint-disable no-plusplus */ const FormData = require('form-data'); const fs = require('fs'); +const { + NetworkError, + ConfigurationError, + RetryableError, + TransformationError, +} = require('@rudderstack/integrations-lib'); const { getAccessToken, getMarketoFilePath, @@ -16,12 +22,6 @@ const { isDefinedAndNotNullAndNotEmpty, } = require('../../util'); const { handleHttpRequest } = require('../../../adapters/network'); -const { - NetworkError, - ConfigurationError, - RetryableError, - TransformationError, -} = require('../../util/errorTypes'); const { client } = require('../../../util/errorNotifier'); const stats = require('../../../util/stats'); diff --git a/src/v0/destinations/marketo_bulk_upload/marketo_bulk_upload.util.test.js b/src/v0/destinations/marketo_bulk_upload/marketo_bulk_upload.util.test.js index 777301b6c3..78ac7c9e48 100644 --- a/src/v0/destinations/marketo_bulk_upload/marketo_bulk_upload.util.test.js +++ b/src/v0/destinations/marketo_bulk_upload/marketo_bulk_upload.util.test.js @@ -4,7 +4,7 @@ const { handleFileUploadResponse, } = require('./util'); -const { AbortedError, RetryableError } = require('../../util/errorTypes'); +const { AbortedError, RetryableError } = require('@rudderstack/integrations-lib'); describe('handleCommonErrorResponse', () => { test('should throw AbortedError for abortable error codes', () => { diff --git a/src/v0/destinations/marketo_bulk_upload/poll.js b/src/v0/destinations/marketo_bulk_upload/poll.js index 5e37fd7c0e..3ad458c545 100644 --- a/src/v0/destinations/marketo_bulk_upload/poll.js +++ b/src/v0/destinations/marketo_bulk_upload/poll.js @@ -1,8 +1,8 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { removeUndefinedValues, isHttpStatusSuccess } = require('../../util'); const { getAccessToken, handlePollResponse, hydrateStatusForServer } = require('./util'); const { handleHttpRequest } = require('../../../adapters/network'); const stats = require('../../../util/stats'); -const { NetworkError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const { POLL_ACTIVITY } = require('./config'); diff --git a/src/v0/destinations/marketo_bulk_upload/transform.js b/src/v0/destinations/marketo_bulk_upload/transform.js index d5764ee6c3..5431e67d38 100644 --- a/src/v0/destinations/marketo_bulk_upload/transform.js +++ b/src/v0/destinations/marketo_bulk_upload/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { getHashFromArray, getFieldValueFromMessage, @@ -5,7 +6,6 @@ const { defaultRequestConfig, } = require('../../util'); const { EventType } = require('../../../constants'); -const { InstrumentationError } = require('../../util/errorTypes'); function responseBuilderSimple(message, destination) { const payload = {}; diff --git a/src/v0/destinations/marketo_bulk_upload/util.js b/src/v0/destinations/marketo_bulk_upload/util.js index a60f57e50b..7b329a3441 100644 --- a/src/v0/destinations/marketo_bulk_upload/util.js +++ b/src/v0/destinations/marketo_bulk_upload/util.js @@ -1,10 +1,10 @@ -const { handleHttpRequest } = require('../../../adapters/network'); const { AbortedError, RetryableError, NetworkError, TransformationError, -} = require('../../util/errorTypes'); +} = require('@rudderstack/integrations-lib'); +const { handleHttpRequest } = require('../../../adapters/network'); const tags = require('../../util/tags'); const { isHttpStatusSuccess, generateUUID } = require('../../util'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); diff --git a/src/v0/destinations/marketo_static_list/transform.js b/src/v0/destinations/marketo_static_list/transform.js index 156e26270b..856947c33c 100644 --- a/src/v0/destinations/marketo_static_list/transform.js +++ b/src/v0/destinations/marketo_static_list/transform.js @@ -1,5 +1,6 @@ const lodash = require('lodash'); const cloneDeep = require('lodash/cloneDeep'); +const { InstrumentationError, UnauthorizedError } = require('@rudderstack/integrations-lib'); const { defaultPostRequestConfig, defaultDeleteRequestConfig, @@ -16,7 +17,6 @@ const { const { formatConfig, MAX_LEAD_IDS_SIZE } = require('./config'); const Cache = require('../../util/cache'); const { getAuthToken } = require('../marketo/transform'); -const { InstrumentationError, UnauthorizedError } = require('../../util/errorTypes'); const authCache = new Cache(AUTH_CACHE_TTL); // 1 hr diff --git a/src/v0/destinations/marketo_static_list/util.js b/src/v0/destinations/marketo_static_list/util.js index 2d4fe493a0..3db6180d24 100644 --- a/src/v0/destinations/marketo_static_list/util.js +++ b/src/v0/destinations/marketo_static_list/util.js @@ -1,4 +1,4 @@ -const { InstrumentationError } = require('../../util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); /** * Fetches the ids from the array of objects diff --git a/src/v0/destinations/mautic/transform.js b/src/v0/destinations/mautic/transform.js index 12b0d06b6f..13808f6e3c 100644 --- a/src/v0/destinations/mautic/transform.js +++ b/src/v0/destinations/mautic/transform.js @@ -1,3 +1,8 @@ +const { + TransformationError, + InstrumentationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, constructPayload, @@ -20,11 +25,6 @@ const { const { EventType } = require('../../../constants'); const { mappingConfig, ConfigCategories } = require('./config'); -const { - TransformationError, - InstrumentationError, - ConfigurationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = async (payload, endpoint, method, messageType, Config) => { diff --git a/src/v0/destinations/mautic/utils.js b/src/v0/destinations/mautic/utils.js index f9dd787d9d..d8ad8dbffc 100644 --- a/src/v0/destinations/mautic/utils.js +++ b/src/v0/destinations/mautic/utils.js @@ -1,5 +1,10 @@ /* eslint-disable no-return-assign, no-param-reassign, no-restricted-syntax */ const get = require('get-value'); +const { + NetworkError, + InstrumentationError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { getFieldValueFromMessage } = require('../../util'); const { BASE_URL, lookupFieldMap } = require('./config'); const { httpGET } = require('../../../adapters/network'); @@ -7,7 +12,6 @@ const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/moengage/transform.js b/src/v0/destinations/moengage/transform.js index d87d931817..ea7db24406 100644 --- a/src/v0/destinations/moengage/transform.js +++ b/src/v0/destinations/moengage/transform.js @@ -1,4 +1,9 @@ const btoa = require('btoa'); +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, @@ -16,11 +21,6 @@ const { simpleProcessRouterDest, isAppleFamily, } = require('../../util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function responseBuilderSimple(message, category, destination) { diff --git a/src/v0/destinations/monday/transform.js b/src/v0/destinations/monday/transform.js index 37ee835e50..152b42f8d0 100644 --- a/src/v0/destinations/monday/transform.js +++ b/src/v0/destinations/monday/transform.js @@ -1,4 +1,9 @@ const get = require('get-value'); +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ENDPOINT } = require('./config'); const { populatePayload, getBoardDetails, checkAllowedEventNameFromUI } = require('./util'); @@ -10,11 +15,6 @@ const { getDestinationExternalID, validateEventName, } = require('../../util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload, endpoint, apiToken) => { diff --git a/src/v0/destinations/monday/util.js b/src/v0/destinations/monday/util.js index 5f260aabae..a66dd63dff 100644 --- a/src/v0/destinations/monday/util.js +++ b/src/v0/destinations/monday/util.js @@ -1,8 +1,12 @@ const { isNumber } = require('lodash'); +const { + NetworkError, + ConfigurationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { httpPOST } = require('../../../adapters/network'); const { processAxiosResponse } = require('../../../adapters/utils/networkUtils'); const { getDestinationExternalID, isDefinedAndNotNull } = require('../../util'); -const { NetworkError, ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/monetate/transform.js b/src/v0/destinations/monetate/transform.js index e4d1f28b61..26a88e686b 100644 --- a/src/v0/destinations/monetate/transform.js +++ b/src/v0/destinations/monetate/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { removeUndefinedValues, simpleProcessRouterDest } = require('../../util'); const { handleProductViewed, @@ -11,7 +12,6 @@ const { } = require('./utils'); const { EventType } = require('../../../constants'); const { mappingConfig } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); function track(message, destination) { const rawPayload = constructPayload(message, mappingConfig.MONETATETrack); diff --git a/src/v0/destinations/monetate/utils.js b/src/v0/destinations/monetate/utils.js index 7facc2617d..1fe899f120 100644 --- a/src/v0/destinations/monetate/utils.js +++ b/src/v0/destinations/monetate/utils.js @@ -1,6 +1,6 @@ const set = require('set-value'); const get = require('get-value'); -const { InstrumentationError } = require('../../util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { isDefinedAndNotNull, defaultRequestConfig, getValueFromMessage } = require('../../util'); const { ENDPOINT } = require('./config'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/mp/deleteUsers.js b/src/v0/destinations/mp/deleteUsers.js index 5b86cae6ae..f01475ef2b 100644 --- a/src/v0/destinations/mp/deleteUsers.js +++ b/src/v0/destinations/mp/deleteUsers.js @@ -1,4 +1,5 @@ const lodash = require('lodash'); +const { ConfigurationError, NetworkError } = require('@rudderstack/integrations-lib'); const { handleHttpRequest } = require('../../../adapters/network'); const { isHttpStatusSuccess } = require('../../util'); const { @@ -7,7 +8,6 @@ const { DISTINCT_ID_MAX_BATCH_SIZE, } = require('./config'); const { executeCommonValidations } = require('../../util/regulation-api'); -const { ConfigurationError, NetworkError } = require('../../util/errorTypes'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/mp/transform.js b/src/v0/destinations/mp/transform.js index a5f1bf2d9d..bb8d3e5756 100644 --- a/src/v0/destinations/mp/transform.js +++ b/src/v0/destinations/mp/transform.js @@ -1,5 +1,6 @@ const lodash = require('lodash'); const get = require('get-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { base64Convertor, @@ -35,7 +36,6 @@ const { groupEventsByEndpoint, batchEvents, } = require('./util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { CommonUtils } = require('../../../util/common'); // ref: https://help.mixpanel.com/hc/en-us/articles/115004613766-Default-Properties-Collected-by-Mixpanel diff --git a/src/v0/destinations/mp/util.js b/src/v0/destinations/mp/util.js index 30173fd514..bb4c23f1b4 100644 --- a/src/v0/destinations/mp/util.js +++ b/src/v0/destinations/mp/util.js @@ -1,5 +1,6 @@ const set = require('set-value'); const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { isDefined, constructPayload, @@ -20,7 +21,6 @@ const { GEO_SOURCE_ALLOWED_VALUES, mappingConfig, } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); const { CommonUtils } = require('../../../util/common'); const mPIdentifyConfigJson = mappingConfig[ConfigCategory.IDENTIFY.name]; diff --git a/src/v0/destinations/ometria/networkResponseHandler.js b/src/v0/destinations/ometria/networkResponseHandler.js index 2020ab0343..501b67f176 100644 --- a/src/v0/destinations/ometria/networkResponseHandler.js +++ b/src/v0/destinations/ometria/networkResponseHandler.js @@ -1,8 +1,8 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { getDynamicErrorType, trimResponse } = require('../../../adapters/utils/networkUtils'); const { isDefinedAndNotNull } = require('../../util'); const { isEmpty } = require('../../util/index'); const tags = require('../../util/tags'); -const { NetworkError } = require('../../util/errorTypes'); const responseTransform = (destResponse) => { let respBody; diff --git a/src/v0/destinations/ometria/transform.js b/src/v0/destinations/ometria/transform.js index 6d3c2ab174..55038e10b8 100644 --- a/src/v0/destinations/ometria/transform.js +++ b/src/v0/destinations/ometria/transform.js @@ -1,7 +1,7 @@ /* eslint-disable one-var, @typescript-eslint/naming-convention */ /* eslint-disable camelcase */ +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { constructPayload, extractCustomFields, diff --git a/src/v0/destinations/one_signal/transform.js b/src/v0/destinations/one_signal/transform.js index db699935f4..a072aef0e4 100644 --- a/src/v0/destinations/one_signal/transform.js +++ b/src/v0/destinations/one_signal/transform.js @@ -1,4 +1,9 @@ const get = require('get-value'); +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ConfigCategory, mappingConfig, BASE_URL, ENDPOINTS } = require('./config'); const { @@ -13,11 +18,6 @@ const { defaultPutRequestConfig, } = require('../../util'); const { populateDeviceType, populateTags } = require('./util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload, endpoint, eventType) => { diff --git a/src/v0/destinations/one_signal/util.js b/src/v0/destinations/one_signal/util.js index 4b53949e55..2de57de1b4 100644 --- a/src/v0/destinations/one_signal/util.js +++ b/src/v0/destinations/one_signal/util.js @@ -1,5 +1,5 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { getIntegrationsObj, getFieldValueFromMessage, getBrowserInfo } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); // For mapping device_type value const deviceTypeMapping = { diff --git a/src/v0/destinations/pagerduty/transform.js b/src/v0/destinations/pagerduty/transform.js index d7a8848ace..fb862d2553 100644 --- a/src/v0/destinations/pagerduty/transform.js +++ b/src/v0/destinations/pagerduty/transform.js @@ -1,3 +1,8 @@ +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -6,11 +11,6 @@ const { removeUndefinedAndNullValues, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { trackEventPayloadBuilder } = require('./util'); const responseBuilder = (payload, endpoint) => { diff --git a/src/v0/destinations/pagerduty/util.js b/src/v0/destinations/pagerduty/util.js index 42030aa2e7..5b768704ed 100644 --- a/src/v0/destinations/pagerduty/util.js +++ b/src/v0/destinations/pagerduty/util.js @@ -1,5 +1,6 @@ const get = require('get-value'); const moment = require('moment'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { SEVERITIES, EVENT_ACTIONS, @@ -9,7 +10,6 @@ const { DEFAULT_EVENT_ACTION, } = require('./config'); const { constructPayload, getIntegrationsObj } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); /** * Validates the timestamp diff --git a/src/v0/destinations/pardot/networkHandler.js b/src/v0/destinations/pardot/networkHandler.js index 4cec03ebf8..12b4abbc53 100644 --- a/src/v0/destinations/pardot/networkHandler.js +++ b/src/v0/destinations/pardot/networkHandler.js @@ -1,3 +1,4 @@ +const { NetworkError } = require('@rudderstack/integrations-lib'); const { removeUndefinedValues } = require('../../util'); const { prepareProxyRequest, getPayloadData, httpSend } = require('../../../adapters/network'); const { @@ -7,7 +8,6 @@ const { const { isHttpStatusSuccess } = require('../../util/index'); const { REFRESH_TOKEN } = require('../../../adapters/networkhandler/authConstants'); const tags = require('../../util/tags'); -const { NetworkError } = require('../../util/errorTypes'); /** * Example Response from pardot diff --git a/src/v0/destinations/pardot/transform.js b/src/v0/destinations/pardot/transform.js index bfc7386ef9..b32b8967bd 100644 --- a/src/v0/destinations/pardot/transform.js +++ b/src/v0/destinations/pardot/transform.js @@ -34,6 +34,7 @@ */ const get = require('get-value'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { identifyConfig, DESTINATION } = require('./config'); const logger = require('../../../logger'); const { @@ -48,7 +49,6 @@ const { getAccessToken, } = require('../../util'); const { CONFIG_CATEGORIES } = require('./config'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const buildResponse = (payload, url, destination, token) => { const responseBody = removeUndefinedValues(payload); diff --git a/src/v0/destinations/persistiq/transform.js b/src/v0/destinations/persistiq/transform.js index 195f8d6567..3b4fd6cadc 100644 --- a/src/v0/destinations/persistiq/transform.js +++ b/src/v0/destinations/persistiq/transform.js @@ -1,4 +1,5 @@ const { set } = require('lodash'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, removeUndefinedAndNullValues, @@ -8,7 +9,6 @@ const { const { configCategories } = require('./config'); const { buildLeadPayload, getIdentifyTraits } = require('./util'); const { EventType } = require('../../../constants'); -const { InstrumentationError } = require('../../util/errorTypes'); const responseBuilder = (payload, endpoint, method, Config) => { const { apiKey } = Config; diff --git a/src/v0/destinations/persistiq/util.js b/src/v0/destinations/persistiq/util.js index 7e1986e9b3..f37a9d1886 100644 --- a/src/v0/destinations/persistiq/util.js +++ b/src/v0/destinations/persistiq/util.js @@ -1,4 +1,5 @@ const { get } = require('lodash'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { getFieldValueFromMessage, getHashFromArray, @@ -6,7 +7,6 @@ const { flattenMultilevelPayload, } = require('../../util'); const { identifySourceKeys, fileConfigCategories, mappingConfig } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); /** * Returns the remaining keys from traits diff --git a/src/v0/destinations/personalize/transform.js b/src/v0/destinations/personalize/transform.js index 3523987a89..dcfaae755c 100644 --- a/src/v0/destinations/personalize/transform.js +++ b/src/v0/destinations/personalize/transform.js @@ -1,4 +1,5 @@ const lodash = require('lodash'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { KEY_CHECK_LIST, MANDATORY_PROPERTIES } = require('./config'); const { EventType } = require('../../../constants'); const { @@ -9,7 +10,6 @@ const { isDefined, simpleProcessRouterDest, } = require('../../util'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const putEventsHandler = (message, destination) => { const { properties, anonymousId, event, messageId, context } = message; diff --git a/src/v0/destinations/pinterest_tag/transform.js b/src/v0/destinations/pinterest_tag/transform.js index 15efd63436..ee7e2e5b19 100644 --- a/src/v0/destinations/pinterest_tag/transform.js +++ b/src/v0/destinations/pinterest_tag/transform.js @@ -1,4 +1,5 @@ const { get } = require('lodash'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -28,7 +29,6 @@ const { getV5EventsEndpoint, API_VERSION, } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); const responseBuilderSimple = (finalPayload, { Config }) => { const { apiVersion = API_VERSION.v3, adAccountId, conversionToken, sendAsTestEvent } = Config; diff --git a/src/v0/destinations/pinterest_tag/utils.js b/src/v0/destinations/pinterest_tag/utils.js index c6822636dc..c1493e9dbd 100644 --- a/src/v0/destinations/pinterest_tag/utils.js +++ b/src/v0/destinations/pinterest_tag/utils.js @@ -1,5 +1,6 @@ /* eslint-disable no-param-reassign */ const sha256 = require('sha256'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { constructPayload, @@ -8,7 +9,6 @@ const { getHashFromArrayWithDuplicate, removeUndefinedAndNullValues, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { COMMON_CONFIGS, CUSTOM_CONFIGS, API_VERSION } = require('./config'); const VALID_ACTION_SOURCES = ['app_android', 'app_ios', 'web', 'offline']; diff --git a/src/v0/destinations/posthog/transform.js b/src/v0/destinations/posthog/transform.js index 9f639b59de..62a2f26783 100644 --- a/src/v0/destinations/posthog/transform.js +++ b/src/v0/destinations/posthog/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { DEFAULT_BASE_ENDPOINT, CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const { @@ -14,7 +15,6 @@ const { removeUndefinedAndNullValues, simpleProcessRouterDest, } = require('../../util'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); // Logic To match destination Property key that is in Rudder Stack Properties Object. diff --git a/src/v0/destinations/profitwell/transform.js b/src/v0/destinations/profitwell/transform.js index 70de193fbd..58449fd9c1 100644 --- a/src/v0/destinations/profitwell/transform.js +++ b/src/v0/destinations/profitwell/transform.js @@ -1,3 +1,8 @@ +const { + NetworkError, + ConfigurationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { getSubscriptionHistory, @@ -15,7 +20,6 @@ const { simpleProcessRouterDest, } = require('../../util'); const { BASE_ENDPOINT, createPayloadMapping } = require('./config'); -const { NetworkError, ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/profitwell/utils.js b/src/v0/destinations/profitwell/utils.js index d7a3562126..acc4db2035 100644 --- a/src/v0/destinations/profitwell/utils.js +++ b/src/v0/destinations/profitwell/utils.js @@ -1,4 +1,8 @@ const get = require('get-value'); +const { + InstrumentationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const { httpGET } = require('../../../adapters/network'); const { toUnixTimestamp, @@ -11,7 +15,6 @@ const { constructPayload, } = require('../../util'); const { BASE_ENDPOINT, createPayloadMapping, updatePayloadMapping } = require('./config'); -const { InstrumentationError, NetworkInstrumentationError } = require('../../util/errorTypes'); const CURRENCY_CODES = [ 'aed', diff --git a/src/v0/destinations/redis/transform.js b/src/v0/destinations/redis/transform.js index ffc4a33c43..23c73f0ba4 100644 --- a/src/v0/destinations/redis/transform.js +++ b/src/v0/destinations/redis/transform.js @@ -1,9 +1,9 @@ const lodash = require('lodash'); const flatten = require('flat'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { isEmpty, isObject } = require('../../util'); const { EventType } = require('../../../constants'); -const { InstrumentationError } = require('../../util/errorTypes'); // processValues: // 1. removes keys with empty values or still an object(empty) after flattening diff --git a/src/v0/destinations/refiner/transform.js b/src/v0/destinations/refiner/transform.js index def685b597..b891945f7f 100644 --- a/src/v0/destinations/refiner/transform.js +++ b/src/v0/destinations/refiner/transform.js @@ -1,3 +1,4 @@ +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { ErrorMessage, defaultRequestConfig, @@ -13,7 +14,6 @@ const { identifyUserPayloadBuilder, } = require('./utils'); const { EventType } = require('../../../constants'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const responseBuilder = (payload, endpoint, destination) => { if (payload) { diff --git a/src/v0/destinations/refiner/utils.js b/src/v0/destinations/refiner/utils.js index 109f6ff656..5e788352ca 100644 --- a/src/v0/destinations/refiner/utils.js +++ b/src/v0/destinations/refiner/utils.js @@ -1,7 +1,7 @@ const get = require('get-value'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { CONFIG_CATEGORIES } = require('./config'); const { getHashFromArray, getFieldValueFromMessage } = require('../../util'); -const { InstrumentationError } = require('../../util/errorTypes'); /** * Validation for userId and an email diff --git a/src/v0/destinations/revenue_cat/transform.js b/src/v0/destinations/revenue_cat/transform.js index 5f165a9278..407cb91608 100644 --- a/src/v0/destinations/revenue_cat/transform.js +++ b/src/v0/destinations/revenue_cat/transform.js @@ -1,5 +1,10 @@ const set = require('set-value'); const { defaultRequestConfig } = require('rudder-transformer-cdk/build/utils'); +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { constructPayload, @@ -15,11 +20,6 @@ const { REVENUE_CAT_IDENTIFY_EXCLUSION, BASE_URL, } = require('./config'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const trackResponseBuilder = async (message, category, { Config }) => { diff --git a/src/v0/destinations/rockerbox/transform.js b/src/v0/destinations/rockerbox/transform.js index 5369afa7e5..3ac806e5ee 100644 --- a/src/v0/destinations/rockerbox/transform.js +++ b/src/v0/destinations/rockerbox/transform.js @@ -1,4 +1,5 @@ const get = require('get-value'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, removeUndefinedAndNullValues, @@ -9,7 +10,6 @@ const { } = require('../../util'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, ROCKERBOX_DEFINED_PROPERTIES } = require('./config'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const responseBuilderSimple = (message, category, destination) => { const payload = constructPayload(message, MAPPING_CONFIG[category.name]); diff --git a/src/v0/destinations/salesforce/transform.js b/src/v0/destinations/salesforce/transform.js index 95e41ccd98..ab06a16d07 100644 --- a/src/v0/destinations/salesforce/transform.js +++ b/src/v0/destinations/salesforce/transform.js @@ -1,5 +1,9 @@ const get = require('get-value'); const cloneDeep = require('lodash/cloneDeep'); +const { + InstrumentationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType, MappedToDestinationKey } = require('../../../constants'); const { SF_API_VERSION, @@ -25,7 +29,6 @@ const { } = require('../../util'); const { getAccessToken, salesforceResponseHandler } = require('./utils'); const { handleHttpRequest } = require('../../../adapters/network'); -const { InstrumentationError, NetworkInstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); // Basic response builder diff --git a/src/v0/destinations/salesforce/utils.js b/src/v0/destinations/salesforce/utils.js index 3ffa4e56d8..9429e12e8d 100644 --- a/src/v0/destinations/salesforce/utils.js +++ b/src/v0/destinations/salesforce/utils.js @@ -1,7 +1,7 @@ +const { RetryableError, ThrottledError, AbortedError } = require('@rudderstack/integrations-lib'); const { handleHttpRequest } = require('../../../adapters/network'); const { isHttpStatusSuccess } = require('../../util'); const Cache = require('../../util/cache'); -const { RetryableError, ThrottledError, AbortedError } = require('../../util/errorTypes'); const { ACCESS_TOKEN_CACHE_TTL, SF_TOKEN_REQUEST_URL_SANDBOX, diff --git a/src/v0/destinations/sendgrid/deleteUsers.js b/src/v0/destinations/sendgrid/deleteUsers.js index e93fefa59e..8410f41296 100644 --- a/src/v0/destinations/sendgrid/deleteUsers.js +++ b/src/v0/destinations/sendgrid/deleteUsers.js @@ -1,3 +1,4 @@ +const { NetworkError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { httpDELETE } = require('../../../adapters/network'); const { delIdUrlLimit, DELETE_CONTACTS_ENDPOINT } = require('./config'); const { @@ -5,7 +6,6 @@ const { getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); const { isHttpStatusSuccess } = require('../../util'); -const { NetworkError, ConfigurationError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { executeCommonValidations } = require('../../util/regulation-api'); diff --git a/src/v0/destinations/sendgrid/transform.js b/src/v0/destinations/sendgrid/transform.js index d2f5b38b70..5038fedf7b 100644 --- a/src/v0/destinations/sendgrid/transform.js +++ b/src/v0/destinations/sendgrid/transform.js @@ -1,4 +1,9 @@ const lodash = require('lodash'); +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ErrorMessage, @@ -34,11 +39,6 @@ const { generatePayloadFromConfig, createOrUpdateContactPayloadBuilder, } = require('./util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload, method, endpoint, apiKey) => { diff --git a/src/v0/destinations/sendgrid/util.js b/src/v0/destinations/sendgrid/util.js index fad227a65b..1df34bfe69 100644 --- a/src/v0/destinations/sendgrid/util.js +++ b/src/v0/destinations/sendgrid/util.js @@ -1,4 +1,9 @@ const get = require('get-value'); +const { + NetworkError, + ConfigurationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const logger = require('../../../logger'); const { isEmpty, @@ -21,7 +26,6 @@ const { processAxiosResponse, } = require('../../../adapters/utils/networkUtils'); const { httpGET } = require('../../../adapters/network'); -const { NetworkError, ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { AUTH_CACHE_TTL, JSON_MIME_TYPE } = require('../../util/constant'); const { MAPPING_CONFIG, CONFIG_CATEGORIES } = require('./config'); diff --git a/src/v0/destinations/sendinblue/transform.js b/src/v0/destinations/sendinblue/transform.js index 151304db22..7663672f12 100644 --- a/src/v0/destinations/sendinblue/transform.js +++ b/src/v0/destinations/sendinblue/transform.js @@ -1,5 +1,6 @@ /* eslint-disable camelcase */ /* eslint-disable @typescript-eslint/naming-convention */ +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -25,7 +26,6 @@ const { prepareTrackEventData, getListIds, } = require('./util'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const responseBuilder = ( payload, diff --git a/src/v0/destinations/sendinblue/util.js b/src/v0/destinations/sendinblue/util.js index f184ee1ac1..9ad37fc9b7 100644 --- a/src/v0/destinations/sendinblue/util.js +++ b/src/v0/destinations/sendinblue/util.js @@ -1,3 +1,4 @@ +const { NetworkError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EMAIL_SUFFIX, getContactDetailsEndpoint } = require('./config'); const { getHashFromArray, @@ -12,7 +13,6 @@ const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, InstrumentationError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/serenytics/transform.js b/src/v0/destinations/serenytics/transform.js index ee7279e288..ee38f7d1a1 100644 --- a/src/v0/destinations/serenytics/transform.js +++ b/src/v0/destinations/serenytics/transform.js @@ -1,14 +1,14 @@ +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { ErrorMessage, simpleProcessRouterDest, getHashFromArrayWithDuplicate, } = require('../../util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { CONFIG_CATEGORIES, diff --git a/src/v0/destinations/serenytics/utils.js b/src/v0/destinations/serenytics/utils.js index bccce2585d..90ce374d5a 100644 --- a/src/v0/destinations/serenytics/utils.js +++ b/src/v0/destinations/serenytics/utils.js @@ -1,10 +1,10 @@ +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { constructPayload, extractCustomFields, defaultRequestConfig, defaultPostRequestConfig, } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); const { MAPPING_CONFIG } = require('./config'); const checkStorageUrl = (STORAGE_URL, messageType) => { diff --git a/src/v0/destinations/sfmc/transform.js b/src/v0/destinations/sfmc/transform.js index 161720b2cc..879ca1989a 100644 --- a/src/v0/destinations/sfmc/transform.js +++ b/src/v0/destinations/sfmc/transform.js @@ -1,4 +1,9 @@ /* eslint-disable no-nested-ternary */ +const { + NetworkError, + ConfigurationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, ENDPOINTS } = require('./config'); @@ -19,7 +24,6 @@ const { getDynamicErrorType, nodeSysErrorToStatus, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/shynet/transform.js b/src/v0/destinations/shynet/transform.js index 833616a11f..565c0790d5 100644 --- a/src/v0/destinations/shynet/transform.js +++ b/src/v0/destinations/shynet/transform.js @@ -1,4 +1,5 @@ /* eslint-disable no-underscore-dangle */ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { @@ -9,7 +10,6 @@ const { generateUUID, } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); -const { InstrumentationError } = require('../../util/errorTypes'); const { ConfigCategory, mappingConfig } = require('./config'); diff --git a/src/v0/destinations/signl4/transform.js b/src/v0/destinations/signl4/transform.js index 63dc10d73c..3a8b23b630 100644 --- a/src/v0/destinations/signl4/transform.js +++ b/src/v0/destinations/signl4/transform.js @@ -1,3 +1,8 @@ +const { + ConfigurationError, + TransformationError, + InstrumentationError, +} = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { BASE_URL } = require('./config'); const { populatePayload } = require('./utils'); @@ -7,11 +12,6 @@ const { simpleProcessRouterDest, removeUndefinedAndNullAndEmptyValues, } = require('../../util'); -const { - ConfigurationError, - TransformationError, - InstrumentationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload, endpoint) => { diff --git a/src/v0/destinations/singular/transform.js b/src/v0/destinations/singular/transform.js index 749debb0b0..ff5d18db9a 100644 --- a/src/v0/destinations/singular/transform.js +++ b/src/v0/destinations/singular/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { BASE_URL } = require('./config'); const { defaultRequestConfig, @@ -10,7 +11,6 @@ const { generateRevenuePayloadArray, isSessionEvent, } = require('./util'); -const { InstrumentationError } = require('../../util/errorTypes'); const responseBuilderSimple = (message, { Config }) => { const eventName = message.event; diff --git a/src/v0/destinations/singular/util.js b/src/v0/destinations/singular/util.js index 542b049a2e..4c5aeb8964 100644 --- a/src/v0/destinations/singular/util.js +++ b/src/v0/destinations/singular/util.js @@ -1,4 +1,5 @@ const lodash = require('lodash'); +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, @@ -20,7 +21,6 @@ const { isDefinedAndNotNull, isAppleFamily, } = require('../../util'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); /* All the fields listed inside properties which are not directly mapped, will be sent to 'e' as custom event attributes diff --git a/src/v0/destinations/slack/transform.js b/src/v0/destinations/slack/transform.js index 8db934d71f..41282c6887 100644 --- a/src/v0/destinations/slack/transform.js +++ b/src/v0/destinations/slack/transform.js @@ -1,5 +1,6 @@ /* eslint-disable no-nested-ternary, no-restricted-syntax, no-prototype-builtins */ const Handlebars = require('handlebars'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { stringifyJSON, @@ -17,7 +18,6 @@ const { simpleProcessRouterDest, isDefinedAndNotNull, } = require('../../util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); // build the response to be sent to backend, url encoded header is required as slack accepts payload in this format // add the username and image for Rudder diff --git a/src/v0/destinations/snapchat_conversion/transform.js b/src/v0/destinations/snapchat_conversion/transform.js index 49776935de..37d321a468 100644 --- a/src/v0/destinations/snapchat_conversion/transform.js +++ b/src/v0/destinations/snapchat_conversion/transform.js @@ -1,5 +1,6 @@ const get = require('get-value'); const moment = require('moment'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { @@ -33,7 +34,6 @@ const { channelMapping, generateBatchedPayloadForArray, } = require('./util'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function buildResponse(apiKey, payload) { diff --git a/src/v0/destinations/snapchat_custom_audience/networkHandler.js b/src/v0/destinations/snapchat_custom_audience/networkHandler.js index 196f9a87fb..db36f6f518 100644 --- a/src/v0/destinations/snapchat_custom_audience/networkHandler.js +++ b/src/v0/destinations/snapchat_custom_audience/networkHandler.js @@ -1,3 +1,4 @@ +const { NetworkError, RetryableError, AbortedError } = require('@rudderstack/integrations-lib'); const { removeUndefinedValues, getAuthErrCategoryFromErrDetailsAndStCode } = require('../../util'); const { prepareProxyRequest, getPayloadData, httpSend } = require('../../../adapters/network'); const { isHttpStatusSuccess } = require('../../util/index'); @@ -7,7 +8,6 @@ const { getDynamicErrorType, processAxiosResponse, } = require('../../../adapters/utils/networkUtils'); -const { NetworkError, RetryableError, AbortedError } = require('../../util/errorTypes'); const { HTTP_STATUS_CODES } = require('../../util/constant'); const prepareProxyReq = (request) => { diff --git a/src/v0/destinations/snapchat_custom_audience/transform.js b/src/v0/destinations/snapchat_custom_audience/transform.js index 7938236594..f4cbeafb56 100644 --- a/src/v0/destinations/snapchat_custom_audience/transform.js +++ b/src/v0/destinations/snapchat_custom_audience/transform.js @@ -1,4 +1,5 @@ const sha256 = require('sha256'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, removeUndefinedAndNullValues, @@ -6,7 +7,6 @@ const { isDefinedAndNotNullAndNotEmpty, getAccessToken, } = require('../../util'); -const { ConfigurationError } = require('../../util/errorTypes'); const { BASE_URL, schemaType } = require('./config'); const { validatePayload, validateFields } = require('./utils'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/snapchat_custom_audience/utils.js b/src/v0/destinations/snapchat_custom_audience/utils.js index 4d20b27a09..bc4a2292da 100644 --- a/src/v0/destinations/snapchat_custom_audience/utils.js +++ b/src/v0/destinations/snapchat_custom_audience/utils.js @@ -1,4 +1,4 @@ -const { InstrumentationError } = require('../../util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); /** * Verifies whether the input payload is in right format or not diff --git a/src/v0/destinations/splitio/transform.js b/src/v0/destinations/splitio/transform.js index 012c73a8b6..6641a62fe8 100644 --- a/src/v0/destinations/splitio/transform.js +++ b/src/v0/destinations/splitio/transform.js @@ -1,3 +1,4 @@ +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, @@ -18,7 +19,6 @@ const { simpleProcessRouterDest, ErrorMessage, } = require('../../util'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function responseBuilderSimple(payload, category, destination) { diff --git a/src/v0/destinations/statsig/transform.js b/src/v0/destinations/statsig/transform.js index 1be72d4095..81658a255a 100644 --- a/src/v0/destinations/statsig/transform.js +++ b/src/v0/destinations/statsig/transform.js @@ -1,7 +1,7 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultPostRequestConfig, defaultRequestConfig } = require('../../util'); const { ENDPOINT } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); function process(event) { diff --git a/src/v0/destinations/stormly/transform.js b/src/v0/destinations/stormly/transform.js index 756bfb8024..dc7a256583 100644 --- a/src/v0/destinations/stormly/transform.js +++ b/src/v0/destinations/stormly/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-nested-ternary */ const get = require('get-value'); const set = require('set-value'); +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -12,7 +13,6 @@ const { getDestinationExternalID, } = require('../../util'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (payload, endpoint, destination) => { @@ -40,7 +40,8 @@ const identifyResponseBuilder = (message, destination) => { const trackResponseBuilder = (message, destination) => { const { endpoint, name } = CONFIG_CATEGORIES.TRACK; - const groupId = getDestinationExternalID(message, 'stormlyGroupId') || message.properties?.groupId; + const groupId = + getDestinationExternalID(message, 'stormlyGroupId') || message.properties?.groupId; let payload = constructPayload(message, MAPPING_CONFIG[name]); if (groupId) { diff --git a/src/v0/destinations/tiktok_ads/networkHandler.js b/src/v0/destinations/tiktok_ads/networkHandler.js index 1ec31e982a..ae93b1ec15 100644 --- a/src/v0/destinations/tiktok_ads/networkHandler.js +++ b/src/v0/destinations/tiktok_ads/networkHandler.js @@ -1,10 +1,10 @@ +const { NetworkError, ThrottledError, AbortedError } = require('@rudderstack/integrations-lib'); const { proxyRequest, prepareProxyRequest } = require('../../../adapters/network'); const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); const { DESTINATION } = require('./config'); -const { NetworkError, ThrottledError, AbortedError } = require('../../util/errorTypes'); const { TAG_NAMES } = require('../../util/tags'); const { HTTP_STATUS_CODES } = require('../../util/constant'); diff --git a/src/v0/destinations/tiktok_ads/transform.js b/src/v0/destinations/tiktok_ads/transform.js index 4e99d83575..f0ed04a120 100644 --- a/src/v0/destinations/tiktok_ads/transform.js +++ b/src/v0/destinations/tiktok_ads/transform.js @@ -4,6 +4,7 @@ const _ = require('lodash'); const { SHA256 } = require('crypto-js'); const get = require('get-value'); const set = require('set-value'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { constructPayload, @@ -29,7 +30,6 @@ const { MAX_BATCH_SIZE, PARTNER_NAME, } = require('./config'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const USER_EMAIL_KEY_PATH = 'context.user.email'; diff --git a/src/v0/destinations/tiktok_ads_offline_events/transform.js b/src/v0/destinations/tiktok_ads_offline_events/transform.js index 3539c856a3..945c31ea63 100644 --- a/src/v0/destinations/tiktok_ads_offline_events/transform.js +++ b/src/v0/destinations/tiktok_ads_offline_events/transform.js @@ -1,6 +1,7 @@ const { SHA256 } = require('crypto-js'); const set = require('set-value'); const lodash = require('lodash'); +const { ConfigurationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { constructPayload, @@ -21,7 +22,6 @@ const { EVENT_NAME_MAPPING, PARTNER_NAME, } = require('./config'); -const { ConfigurationError, InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const getContents = (message) => { diff --git a/src/v0/destinations/trengo/transform.js b/src/v0/destinations/trengo/transform.js index 14d1d8c84c..06e5496a1e 100644 --- a/src/v0/destinations/trengo/transform.js +++ b/src/v0/destinations/trengo/transform.js @@ -2,6 +2,13 @@ /* eslint-disable no-prototype-builtins */ const Handlebars = require('handlebars'); const get = require('get-value'); +const { + NetworkError, + ConfigurationError, + TransformationError, + InstrumentationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { EventType } = require('../../../constants'); const { EndPoints, BASE_URL } = require('./config'); @@ -17,13 +24,6 @@ const { getStringValueOfJSON, ErrorMessage, } = require('../../util'); -const { - NetworkError, - ConfigurationError, - TransformationError, - InstrumentationError, - NetworkInstrumentationError, -} = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/twitter_ads/transform.js b/src/v0/destinations/twitter_ads/transform.js index 363e61072e..268dca3636 100644 --- a/src/v0/destinations/twitter_ads/transform.js +++ b/src/v0/destinations/twitter_ads/transform.js @@ -1,5 +1,10 @@ const sha256 = require('sha256'); +const { + InstrumentationError, + OAuthSecretError, + ConfigurationError, +} = require('@rudderstack/integrations-lib'); const { constructPayload, defaultRequestConfig, @@ -11,11 +16,6 @@ const { const { EventType } = require('../../../constants'); const { ConfigCategories, mappingConfig, BASE_URL } = require('./config'); -const { - InstrumentationError, - OAuthSecretError, - ConfigurationError, -} = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const { getAuthHeaderForRequest } = require('./util'); diff --git a/src/v0/destinations/user/transform.js b/src/v0/destinations/user/transform.js index 6cde9c9b80..ed04f5ccd4 100644 --- a/src/v0/destinations/user/transform.js +++ b/src/v0/destinations/user/transform.js @@ -1,3 +1,8 @@ +const { + TransformationError, + InstrumentationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, simpleProcessRouterDest, @@ -17,11 +22,6 @@ const { createOrUpdateUserPayloadBuilder, createEventOccurrencePayloadBuilder, } = require('./utils'); -const { - TransformationError, - InstrumentationError, - NetworkInstrumentationError, -} = require('../../util/errorTypes'); const { EventType } = require('../../../constants'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/user/utils.js b/src/v0/destinations/user/utils.js index 23dd74a30f..41ad173583 100644 --- a/src/v0/destinations/user/utils.js +++ b/src/v0/destinations/user/utils.js @@ -1,4 +1,8 @@ const get = require('get-value'); +const { + InstrumentationError, + NetworkInstrumentationError, +} = require('@rudderstack/integrations-lib'); const { getHashFromArray, constructPayload, @@ -19,7 +23,6 @@ const { groupSourceKeys, identifySourceKeys, } = require('./config'); -const { InstrumentationError, NetworkInstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const ACCEPT_HEADER_VAL = '*/*;version=2'; diff --git a/src/v0/destinations/userlist/transform.js b/src/v0/destinations/userlist/transform.js index 20b47c6a35..45d58edbbf 100644 --- a/src/v0/destinations/userlist/transform.js +++ b/src/v0/destinations/userlist/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -9,7 +10,6 @@ const { const { endpoint } = require('./config'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); // ------------------------------------------------ diff --git a/src/v0/destinations/vero/transform.js b/src/v0/destinations/vero/transform.js index 7115ea425d..f489056681 100644 --- a/src/v0/destinations/vero/transform.js +++ b/src/v0/destinations/vero/transform.js @@ -1,5 +1,6 @@ const set = require('set-value'); const get = require('get-value'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, constructPayload, @@ -11,7 +12,6 @@ const { } = require('../../util'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); // This function handles the common response payload for the supported calls const responseBuilderSimple = (message, category, destination) => { diff --git a/src/v0/destinations/webengage/transform.js b/src/v0/destinations/webengage/transform.js index 835a486eff..f18a7399ff 100644 --- a/src/v0/destinations/webengage/transform.js +++ b/src/v0/destinations/webengage/transform.js @@ -1,4 +1,5 @@ /* eslint-disable no-param-reassign */ +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { CONFIG_CATEGORIES, @@ -15,7 +16,6 @@ const { simpleProcessRouterDest, extractCustomFields, } = require('../../util'); -const { InstrumentationError, TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const responseBuilder = (message, category, { Config }) => { diff --git a/src/v0/destinations/webhook/transform.js b/src/v0/destinations/webhook/transform.js index a4a7617f68..6a115f1c63 100644 --- a/src/v0/destinations/webhook/transform.js +++ b/src/v0/destinations/webhook/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-nested-ternary */ const get = require('get-value'); const set = require('set-value'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); const { defaultPostRequestConfig, defaultPutRequestConfig, @@ -17,7 +18,6 @@ const { } = require('../../util'); const { EventType } = require('../../../constants'); -const { ConfigurationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const getPropertyParams = (message) => { diff --git a/src/v0/destinations/woopra/transform.js b/src/v0/destinations/woopra/transform.js index 1414cbac23..9104884416 100644 --- a/src/v0/destinations/woopra/transform.js +++ b/src/v0/destinations/woopra/transform.js @@ -1,5 +1,6 @@ /* eslint-disable no-param-reassign */ const { set, get } = require('lodash'); +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { defaultRequestConfig, constructPayload, @@ -12,7 +13,6 @@ const { const { EventType } = require('../../../constants'); const { BASE_URL, mappingConfig, ConfigCategories } = require('./config'); const { refinePayload, getEvent } = require('./utils'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const responseBuilder = (payload, endpoint, method, projectName) => { if (!payload) { diff --git a/src/v0/destinations/wootric/transform.js b/src/v0/destinations/wootric/transform.js index f89e63a5ed..f8b4274af7 100644 --- a/src/v0/destinations/wootric/transform.js +++ b/src/v0/destinations/wootric/transform.js @@ -1,3 +1,4 @@ +const { TransformationError, InstrumentationError } = require('@rudderstack/integrations-lib'); const { EventType } = require('../../../constants'); const { defaultRequestConfig, @@ -19,7 +20,6 @@ const { createDeclinePayloadBuilder, } = require('./util'); const { PROPERTIES, END_USER_PROPERTIES } = require('./config'); -const { TransformationError, InstrumentationError } = require('../../util/errorTypes'); const responseBuilder = async (payload, endpoint, method, accessToken) => { if (payload) { diff --git a/src/v0/destinations/wootric/util.js b/src/v0/destinations/wootric/util.js index 207a0994bb..fce8a66586 100644 --- a/src/v0/destinations/wootric/util.js +++ b/src/v0/destinations/wootric/util.js @@ -1,4 +1,5 @@ const qs = require('qs'); +const { InstrumentationError, NetworkError } = require('@rudderstack/integrations-lib'); const { httpGET, httpPOST } = require('../../../adapters/network'); const { getDynamicErrorType, @@ -8,7 +9,6 @@ const { BASE_ENDPOINT, VERSION, ACCESS_TOKEN_CACHE_TTL_SECONDS } = require('./co const { constructPayload, isDefinedAndNotNullAndNotEmpty } = require('../../util'); const { CONFIG_CATEGORIES, MAPPING_CONFIG } = require('./config'); const Cache = require('../../util/cache'); -const { InstrumentationError, NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/yahoo_dsp/transform.js b/src/v0/destinations/yahoo_dsp/transform.js index 8b0875f1a0..4cd1eee73d 100644 --- a/src/v0/destinations/yahoo_dsp/transform.js +++ b/src/v0/destinations/yahoo_dsp/transform.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { BASE_ENDPOINT, ENDPOINTS, @@ -12,7 +13,6 @@ const { } = require('../../util'); const { getAccessToken, createPayload } = require('./util'); -const { InstrumentationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); /** diff --git a/src/v0/destinations/yahoo_dsp/util.js b/src/v0/destinations/yahoo_dsp/util.js index a069660bde..d41716935f 100644 --- a/src/v0/destinations/yahoo_dsp/util.js +++ b/src/v0/destinations/yahoo_dsp/util.js @@ -1,12 +1,12 @@ const qs = require('qs'); const sha256 = require('sha256'); +const { InstrumentationError, NetworkError } = require('@rudderstack/integrations-lib'); const { generateJWTToken } = require('../../../util/jwtTokenGenerator'); const { httpSend } = require('../../../adapters/network'); const { isDefinedAndNotNullAndNotEmpty } = require('../../util'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const { ACCESS_TOKEN_CACHE_TTL, AUDIENCE_ATTRIBUTE, DSP_SUPPORTED_OPERATION } = require('./config'); const Cache = require('../../util/cache'); -const { InstrumentationError, NetworkError } = require('../../util/errorTypes'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/zendesk/transform.js b/src/v0/destinations/zendesk/transform.js index 869e54c220..bf2bc01ed2 100644 --- a/src/v0/destinations/zendesk/transform.js +++ b/src/v0/destinations/zendesk/transform.js @@ -1,5 +1,10 @@ const get = require('get-value'); const set = require('set-value'); +const { + NetworkInstrumentationError, + InstrumentationError, + NetworkError, +} = require('@rudderstack/integrations-lib'); const myAxios = require('../../../util/myAxios'); const { EventType } = require('../../../constants'); @@ -26,11 +31,6 @@ const { const { getSourceName } = require('./util'); const logger = require('../../../logger'); const { httpGET } = require('../../../adapters/network'); -const { - NetworkInstrumentationError, - InstrumentationError, - NetworkError, -} = require('../../util/errorTypes'); const { getDynamicErrorType } = require('../../../adapters/utils/networkUtils'); const tags = require('../../util/tags'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/destinations/zendesk/util.js b/src/v0/destinations/zendesk/util.js index 0d03f73c19..29f3fc0602 100644 --- a/src/v0/destinations/zendesk/util.js +++ b/src/v0/destinations/zendesk/util.js @@ -1,4 +1,4 @@ -const { ConfigurationError } = require('../../util/errorTypes'); +const { ConfigurationError } = require('@rudderstack/integrations-lib'); /** * Get source name from config or return 'Rudder' as default source name diff --git a/src/v0/sources/appsflyer/transform.js b/src/v0/sources/appsflyer/transform.js index 862e19acd0..1f21392b67 100644 --- a/src/v0/sources/appsflyer/transform.js +++ b/src/v0/sources/appsflyer/transform.js @@ -1,8 +1,8 @@ const path = require('path'); const fs = require('fs'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const Message = require('../message'); const { generateUUID } = require('../../util'); -const { TransformationError } = require('../../util/errorTypes'); const mappingJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, './mapping.json'), 'utf-8')); diff --git a/src/v0/sources/braze/transform.js b/src/v0/sources/braze/transform.js index 34158c8e68..e3d7200023 100644 --- a/src/v0/sources/braze/transform.js +++ b/src/v0/sources/braze/transform.js @@ -2,9 +2,9 @@ const set = require('set-value'); const get = require('get-value'); const path = require('path'); const fs = require('fs'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const { formatTimeStamp, removeUndefinedAndNullValues } = require('../../util'); const Message = require('../message'); -const { TransformationError } = require('../../util/errorTypes'); // import mapping json using JSON.parse to preserve object key order const mapping = JSON.parse(fs.readFileSync(path.resolve(__dirname, './mapping.json'), 'utf-8')); diff --git a/src/v0/sources/canny/transform.js b/src/v0/sources/canny/transform.js index abc6f491b8..9188f5ac34 100644 --- a/src/v0/sources/canny/transform.js +++ b/src/v0/sources/canny/transform.js @@ -1,8 +1,8 @@ const sha256 = require('sha256'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const Message = require('../message'); const { voterMapping, authorMapping, checkForRequiredFields } = require('./util'); const { logger } = require('../../../logger'); -const { TransformationError } = require('../../util/errorTypes'); const CannyOperation = { VOTE_CREATED: 'vote.created', diff --git a/src/v0/sources/canny/util.js b/src/v0/sources/canny/util.js index cd92c0c2af..549b7dcbbc 100644 --- a/src/v0/sources/canny/util.js +++ b/src/v0/sources/canny/util.js @@ -1,6 +1,6 @@ const path = require('path'); const fs = require('fs'); -const { TransformationError } = require('../../util/errorTypes'); +const { TransformationError } = require('@rudderstack/integrations-lib'); // import mapping json using JSON.parse to preserve object key order const voterMapping = JSON.parse( diff --git a/src/v0/sources/customerio/transform.js b/src/v0/sources/customerio/transform.js index 51c353dd3b..a2e69388b9 100644 --- a/src/v0/sources/customerio/transform.js +++ b/src/v0/sources/customerio/transform.js @@ -8,7 +8,6 @@ const Message = require('../message'); const { mappingConfig } = require('./config'); const { isDefinedAndNotNull } = require('../../util'); -// const { TransformationError } = require("../../util/errorTypes"); function process(event) { const message = new Message(`Customer.io`); @@ -35,7 +34,6 @@ function process(event) { message.setProperty('sentAt', validTimestamp); } - // when customer.io does not pass an associated userId, set the email address as anonymousId if ( (message.userId === null || message.userId === undefined) && diff --git a/src/v0/sources/gainsightpx/transform.js b/src/v0/sources/gainsightpx/transform.js index ca91765fa6..92f0a07456 100644 --- a/src/v0/sources/gainsightpx/transform.js +++ b/src/v0/sources/gainsightpx/transform.js @@ -1,4 +1,5 @@ const md5 = require('md5'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const Message = require('../message'); const customMapping = require('./data/customMapping.json'); const identifyMapping = require('./data/identifyMapping.json'); @@ -9,7 +10,6 @@ const surveyMapping = require('./data/surveyMapping.json'); const featureMatchMapping = require('./data/featureMatchMapping.json'); const segmentIoMapping = require('./data/segmentIOMapping.json'); const { refinePayload, refineTraitPayload } = require('./utils'); -const { TransformationError } = require('../../util/errorTypes'); const buildIdentifyPayload = (event) => { let message = new Message(`GAINSIGHTPX`); diff --git a/src/v0/sources/iterable/transform.js b/src/v0/sources/iterable/transform.js index 275051815b..dc3fc72c3c 100644 --- a/src/v0/sources/iterable/transform.js +++ b/src/v0/sources/iterable/transform.js @@ -1,8 +1,8 @@ const path = require('path'); const fs = require('fs'); const md5 = require('md5'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const Message = require('../message'); -const { TransformationError } = require('../../util/errorTypes'); // import mapping json using JSON.parse to preserve object key order const mapping = JSON.parse(fs.readFileSync(path.resolve(__dirname, './mapping.json'), 'utf-8')); diff --git a/src/v0/sources/mailmodo/transform.js b/src/v0/sources/mailmodo/transform.js index 8b36eafa1a..a4383fb440 100644 --- a/src/v0/sources/mailmodo/transform.js +++ b/src/v0/sources/mailmodo/transform.js @@ -1,9 +1,9 @@ const path = require('path'); const fs = require('fs'); const sha256 = require('sha256'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const { flattenJson, removeUndefinedAndNullAndEmptyValues } = require('../../util'); const Message = require('../message'); -const { TransformationError } = require('../../util/errorTypes'); // import mapping json using JSON.parse to preserve object key order const mapping = JSON.parse(fs.readFileSync(path.resolve(__dirname, './mapping.json'), 'utf-8')); diff --git a/src/v0/sources/monday/transform.js b/src/v0/sources/monday/transform.js index 48cddec301..d63323605b 100644 --- a/src/v0/sources/monday/transform.js +++ b/src/v0/sources/monday/transform.js @@ -1,7 +1,7 @@ const sha256 = require('sha256'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const Message = require('../message'); const { mapping, formEventName } = require('./util'); -const { TransformationError } = require('../../util/errorTypes'); const { generateUUID, removeUndefinedAndNullValues } = require('../../util'); const { JSON_MIME_TYPE } = require('../../util/constant'); diff --git a/src/v0/sources/shopify/util.js b/src/v0/sources/shopify/util.js index 2521e9cb9d..1da75cba3d 100644 --- a/src/v0/sources/shopify/util.js +++ b/src/v0/sources/shopify/util.js @@ -2,6 +2,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ const { v5 } = require('uuid'); const sha256 = require('sha256'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const stats = require('../../../util/stats'); const { constructPayload, @@ -22,7 +23,6 @@ const { useRedisDatabase, maxTimeToIdentifyRSGeneratedCall, } = require('./config'); -const { TransformationError } = require('../../util/errorTypes'); const getDataFromRedis = async (key, metricMetadata) => { try { diff --git a/src/v0/util/errorTypes/abortedError.js b/src/v0/util/errorTypes/abortedError.js deleted file mode 100644 index bf5896c8be..0000000000 --- a/src/v0/util/errorTypes/abortedError.js +++ /dev/null @@ -1,15 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class AbortedError extends BaseError { - constructor(message, statusCode, destResponse, authErrorCategory) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.ABORTED, - }; - - super(message, statusCode || 400, finalStatTags, destResponse, authErrorCategory); - } -} - -module.exports = AbortedError; diff --git a/src/v0/util/errorTypes/configurationError.js b/src/v0/util/errorTypes/configurationError.js deleted file mode 100644 index 59df3718e7..0000000000 --- a/src/v0/util/errorTypes/configurationError.js +++ /dev/null @@ -1,16 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class ConfigurationError extends BaseError { - constructor(message) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.DATA_VALIDATION, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.CONFIGURATION, - }; - - // TODO: Change this to a retryable error - super(message, 400, finalStatTags); - } -} - -module.exports = ConfigurationError; diff --git a/src/v0/util/errorTypes/index.js b/src/v0/util/errorTypes/index.js index 2926306dcd..80268c3e77 100644 --- a/src/v0/util/errorTypes/index.js +++ b/src/v0/util/errorTypes/index.js @@ -1,37 +1,5 @@ -const { BaseError } = require('./base'); -const TransformationError = require('./transformationError'); -const ConfigurationError = require('./configurationError'); -const InstrumentationError = require('./instrumentationError'); -const PlatformError = require('./platformError'); -const OAuthSecretError = require('./oAuthSecretError'); -const NetworkError = require('./networkError'); -const ThrottledError = require('./throttledError'); -const RedisError = require('./redisError'); -const RetryableError = require('./retryableError'); -const InvalidAuthTokenError = require('./invalidAuthTokenError'); -const AbortedError = require('./abortedError'); -const UnhandledStatusCodeError = require('./unhandledStatusCodeError'); -const UnauthorizedError = require('./unauthorizedError'); -const NetworkInstrumentationError = require('./networkInstrumentationError'); -const UnsupportedEventError = require('./unsupportedEventError'); const FilteredEventsError = require('./filteredEventsError'); module.exports = { - BaseError, - TransformationError, - ConfigurationError, - InstrumentationError, - PlatformError, - OAuthSecretError, - NetworkError, - ThrottledError, - RetryableError, - InvalidAuthTokenError, - AbortedError, - UnhandledStatusCodeError, - UnauthorizedError, - NetworkInstrumentationError, - UnsupportedEventError, - RedisError, FilteredEventsError, }; diff --git a/src/v0/util/errorTypes/instrumentationError.js b/src/v0/util/errorTypes/instrumentationError.js deleted file mode 100644 index 74df966260..0000000000 --- a/src/v0/util/errorTypes/instrumentationError.js +++ /dev/null @@ -1,15 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class InstrumentationError extends BaseError { - constructor(message) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.DATA_VALIDATION, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.INSTRUMENTATION, - }; - - super(message, 400, finalStatTags); - } -} - -module.exports = InstrumentationError; diff --git a/src/v0/util/errorTypes/invalidAuthTokenError.js b/src/v0/util/errorTypes/invalidAuthTokenError.js deleted file mode 100644 index 6a78996c6e..0000000000 --- a/src/v0/util/errorTypes/invalidAuthTokenError.js +++ /dev/null @@ -1,16 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class InvalidAuthTokenError extends BaseError { - constructor(message, statusCode, destResponse, authErrorCategory) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.RETRYABLE, - [tags.TAG_NAMES.META]: tags.METADATA.INVALID_AUTH_TOKEN, - }; - - super(message, statusCode || 500, finalStatTags, destResponse, authErrorCategory); - } -} - -module.exports = InvalidAuthTokenError; diff --git a/src/v0/util/errorTypes/networkError.js b/src/v0/util/errorTypes/networkError.js deleted file mode 100644 index 3461efbbdd..0000000000 --- a/src/v0/util/errorTypes/networkError.js +++ /dev/null @@ -1,29 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -const errorTypes = Object.values(tags.ERROR_TYPES); -const metaTypes = Object.values(tags.METADATA); -// To throw error when error type (abort, retry or throttle) has to be dynamically deduced -class NetworkError extends BaseError { - constructor(message, statusCode, statTags, destResponse, authErrorCategory) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.ABORTED, - }; - - // Allow specifying only error type and meta tags - if (statTags && typeof statTags === 'object' && !Array.isArray(statTags)) { - if (errorTypes.includes(statTags[tags.TAG_NAMES.ERROR_TYPE])) { - finalStatTags[tags.TAG_NAMES.ERROR_TYPE] = statTags[tags.TAG_NAMES.ERROR_TYPE]; - } - - if (metaTypes.includes(statTags[tags.TAG_NAMES.META])) { - finalStatTags[tags.TAG_NAMES.META] = statTags[tags.TAG_NAMES.META]; - } - } - - super(message, statusCode || 400, finalStatTags, destResponse, authErrorCategory); - } -} - -module.exports = NetworkError; diff --git a/src/v0/util/errorTypes/networkInstrumentationError.js b/src/v0/util/errorTypes/networkInstrumentationError.js deleted file mode 100644 index fb9acdfeb4..0000000000 --- a/src/v0/util/errorTypes/networkInstrumentationError.js +++ /dev/null @@ -1,16 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class NetworkInstrumentationError extends BaseError { - constructor(message, destResponse) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.ABORTED, - [tags.TAG_NAMES.META]: tags.METADATA.INSTRUMENTATION, - }; - - super(message, 400, finalStatTags, destResponse); - } -} - -module.exports = NetworkInstrumentationError; diff --git a/src/v0/util/errorTypes/oAuthSecretError.js b/src/v0/util/errorTypes/oAuthSecretError.js deleted file mode 100644 index dd8c51eaac..0000000000 --- a/src/v0/util/errorTypes/oAuthSecretError.js +++ /dev/null @@ -1,15 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class OAuthSecretError extends BaseError { - constructor(message) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.PLATFORM, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.OAUTH_SECRET, - }; - - super(message, 500, finalStatTags); - } -} - -module.exports = OAuthSecretError; diff --git a/src/v0/util/errorTypes/platformError.js b/src/v0/util/errorTypes/platformError.js deleted file mode 100644 index b04ef50c16..0000000000 --- a/src/v0/util/errorTypes/platformError.js +++ /dev/null @@ -1,14 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class PlatformError extends BaseError { - constructor(message) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.PLATFORM, - }; - - super(message, 400, finalStatTags); - } -} - -module.exports = PlatformError; diff --git a/src/v0/util/errorTypes/redisError.js b/src/v0/util/errorTypes/redisError.js deleted file mode 100644 index ec3d49ff2b..0000000000 --- a/src/v0/util/errorTypes/redisError.js +++ /dev/null @@ -1,15 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class RedisError extends BaseError { - constructor(message, statusCode) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.TRANSFORMATION, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.REDIS, - }; - - super(message, statusCode || 500, finalStatTags); - } -} - -module.exports = RedisError; diff --git a/src/v0/util/errorTypes/retryableError.js b/src/v0/util/errorTypes/retryableError.js deleted file mode 100644 index ba18424c76..0000000000 --- a/src/v0/util/errorTypes/retryableError.js +++ /dev/null @@ -1,15 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class RetryableError extends BaseError { - constructor(message, statusCode, destResponse, authErrorCategory) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.RETRYABLE, - }; - - super(message, statusCode || 500, finalStatTags, destResponse, authErrorCategory); - } -} - -module.exports = RetryableError; diff --git a/src/v0/util/errorTypes/throttledError.js b/src/v0/util/errorTypes/throttledError.js deleted file mode 100644 index 0e873c7892..0000000000 --- a/src/v0/util/errorTypes/throttledError.js +++ /dev/null @@ -1,15 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class ThrottledError extends BaseError { - constructor(message, destResponse) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.THROTTLED, - }; - - super(message, 429, finalStatTags, destResponse); - } -} - -module.exports = ThrottledError; diff --git a/src/v0/util/errorTypes/transformationError.js b/src/v0/util/errorTypes/transformationError.js deleted file mode 100644 index 0b28b61984..0000000000 --- a/src/v0/util/errorTypes/transformationError.js +++ /dev/null @@ -1,14 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class TransformationError extends BaseError { - constructor(message, statusCode, destResponse, authErrorCategory) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.TRANSFORMATION, - }; - - super(message, statusCode || 400, finalStatTags, destResponse, authErrorCategory); - } -} - -module.exports = TransformationError; diff --git a/src/v0/util/errorTypes/unauthorizedError.js b/src/v0/util/errorTypes/unauthorizedError.js deleted file mode 100644 index c9c35795b8..0000000000 --- a/src/v0/util/errorTypes/unauthorizedError.js +++ /dev/null @@ -1,16 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class UnauthorizedError extends BaseError { - constructor(message, statusCode, destResponse, authErrorCategory) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.ABORTED, - [tags.TAG_NAMES.META]: tags.METADATA.UNAUTHORIZED, - }; - - super(message, statusCode || 400, finalStatTags, destResponse, authErrorCategory); - } -} - -module.exports = UnauthorizedError; diff --git a/src/v0/util/errorTypes/unhandledStatusCodeError.js b/src/v0/util/errorTypes/unhandledStatusCodeError.js deleted file mode 100644 index fe35c01c1a..0000000000 --- a/src/v0/util/errorTypes/unhandledStatusCodeError.js +++ /dev/null @@ -1,16 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class UnhandledStatusCodeError extends BaseError { - constructor(message, destResponse) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.NETWORK, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.ABORTED, - [tags.TAG_NAMES.META]: tags.METADATA.UNHANDLED_STATUS_CODE, - }; - - super(message, 400, finalStatTags, destResponse); - } -} - -module.exports = UnhandledStatusCodeError; diff --git a/src/v0/util/errorTypes/unsupportedEventError.js b/src/v0/util/errorTypes/unsupportedEventError.js deleted file mode 100644 index c2e965b620..0000000000 --- a/src/v0/util/errorTypes/unsupportedEventError.js +++ /dev/null @@ -1,14 +0,0 @@ -const tags = require('../tags'); -const { BaseError } = require('./base'); - -class UnsupportedEventError extends BaseError { - constructor(message) { - const finalStatTags = { - [tags.TAG_NAMES.ERROR_CATEGORY]: tags.ERROR_CATEGORIES.PLATFORM, - [tags.TAG_NAMES.ERROR_TYPE]: tags.ERROR_TYPES.UNSUPPORTED, - }; - super(message, 400, finalStatTags); - } -} - -module.exports = UnsupportedEventError; diff --git a/src/v0/util/facebookUtils/index.js b/src/v0/util/facebookUtils/index.js index d39d1c4ce9..4c09518559 100644 --- a/src/v0/util/facebookUtils/index.js +++ b/src/v0/util/facebookUtils/index.js @@ -1,4 +1,5 @@ const sha256 = require('sha256'); +const { InstrumentationError, TransformationError } = require('@rudderstack/integrations-lib'); const { isObject, getIntegrationsObj, @@ -9,7 +10,6 @@ const { getFieldValueFromMessage, formatTimeStamp, } = require('../index'); -const { InstrumentationError, TransformationError } = require('../errorTypes'); /** This function transforms the payloads according to the config settings and adds, removes or hashes pii data. @param message --> the rudder payload diff --git a/src/v0/util/facebookUtils/networkHandler.js b/src/v0/util/facebookUtils/networkHandler.js index 87c2ced2b4..9589d17255 100644 --- a/src/v0/util/facebookUtils/networkHandler.js +++ b/src/v0/util/facebookUtils/networkHandler.js @@ -1,11 +1,11 @@ const { isEmpty } = require('lodash'); const get = require('get-value'); +const { NetworkError } = require('@rudderstack/integrations-lib'); const { processAxiosResponse, getDynamicErrorType, } = require('../../../adapters/utils/networkUtils'); const { prepareProxyRequest, proxyRequest } = require('../../../adapters/network'); -const { NetworkError } = require('../errorTypes'); const tags = require('../tags'); const { ErrorDetailsExtractorBuilder } = require('../../../util/error-extractor'); diff --git a/src/v0/util/index.js b/src/v0/util/index.js index d6f6621220..0296895662 100644 --- a/src/v0/util/index.js +++ b/src/v0/util/index.js @@ -16,16 +16,16 @@ const uaParser = require('ua-parser-js'); const moment = require('moment-timezone'); const sha256 = require('sha256'); const crypto = require('crypto'); -const logger = require('../../logger'); -const stats = require('../../util/stats'); -const { DestCanonicalNames, DestHandlerMap } = require('../../constants/destinationCanonicalNames'); const { InstrumentationError, BaseError, PlatformError, TransformationError, OAuthSecretError, -} = require('./errorTypes'); +} = require('@rudderstack/integrations-lib'); +const logger = require('../../logger'); +const stats = require('../../util/stats'); +const { DestCanonicalNames, DestHandlerMap } = require('../../constants/destinationCanonicalNames'); const { client: errNotificationClient } = require('../../util/errorNotifier'); const { HTTP_STATUS_CODES } = require('./constant'); const { diff --git a/src/v0/util/regulation-api.js b/src/v0/util/regulation-api.js index 8a557858e0..238993ee81 100644 --- a/src/v0/util/regulation-api.js +++ b/src/v0/util/regulation-api.js @@ -1,4 +1,4 @@ -const { PlatformError } = require('./errorTypes'); +const { PlatformError } = require('@rudderstack/integrations-lib'); const RegulationApiUtils = { /** diff --git a/src/warehouse/identity.js b/src/warehouse/identity.js index 4326dddfc6..c34a66a481 100644 --- a/src/warehouse/identity.js +++ b/src/warehouse/identity.js @@ -1,5 +1,5 @@ const _ = require('lodash'); -const { InstrumentationError } = require('../v0/util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { getVersionedUtils } = require('./util'); const identityEnabledWarehouses = ['snowflake', 'bq']; diff --git a/src/warehouse/index.js b/src/warehouse/index.js index c12239c440..d88904b4a8 100644 --- a/src/warehouse/index.js +++ b/src/warehouse/index.js @@ -25,7 +25,7 @@ const whScreenColumnMappingRules = require('./config/WHScreenConfig.js'); const whGroupColumnMappingRules = require('./config/WHGroupConfig.js'); const whAliasColumnMappingRules = require('./config/WHAliasConfig.js'); const { isDataLakeProvider } = require('./config/helpers'); -const { InstrumentationError } = require('../v0/util/errorTypes'); +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const whExtractEventTableColumnMappingRules = require('./config/WHExtractEventTableConfig.js'); const maxColumnsInEvent = parseInt(process.env.WH_MAX_COLUMNS_IN_EVENT || '200', 10); diff --git a/src/warehouse/util.js b/src/warehouse/util.js index 91b49039f1..79981249e7 100644 --- a/src/warehouse/util.js +++ b/src/warehouse/util.js @@ -3,7 +3,7 @@ const get = require('get-value'); const v0 = require('./v0/util'); const v1 = require('./v1/util'); -const { PlatformError, InstrumentationError } = require('../v0/util/errorTypes'); +const { PlatformError, InstrumentationError } = require('@rudderstack/integrations-lib'); const minTimeInMs = Date.parse('0001-01-01T00:00:00Z'); const maxTimeInMs = Date.parse('9999-12-31T23:59:59.999Z'); diff --git a/src/warehouse/v1/util.js b/src/warehouse/v1/util.js index 8f44a17b8e..1c44a2385e 100644 --- a/src/warehouse/v1/util.js +++ b/src/warehouse/v1/util.js @@ -2,7 +2,7 @@ const _ = require('lodash'); const reservedANSIKeywordsMap = require('../config/ReservedKeywords.json'); const { isDataLakeProvider } = require('../config/helpers'); -const { TransformationError } = require('../../v0/util/errorTypes'); +const { TransformationError } = require('@rudderstack/integrations-lib'); function safeTableName(options, name = '') { const { provider } = options; diff --git a/test/integrations/destinations/pinterest_tag/processor/data.ts b/test/integrations/destinations/pinterest_tag/processor/data.ts index c7f482aadd..045ba53cd1 100644 --- a/test/integrations/destinations/pinterest_tag/processor/data.ts +++ b/test/integrations/destinations/pinterest_tag/processor/data.ts @@ -3474,4 +3474,89 @@ export const data = [ }, }, }, + { + name: 'pinterest_tag', + description: 'Test 26', + feature: 'processor', + module: 'destination', + version: 'v0', + input: { + request: { + body: [ + { + message: { + type: 'track', + channel: 'web', + sentAt: '2020-08-14T05:30:30.118Z', + context: { + source: 'test', + userAgent: 'chrome', + traits: { + anonymousId: '50be5c78-6c3f-4b60-be84-97805a316fb1', + email: 'abc@gmail.com', + phone: '+1234589947', + ge: 'male', + db: '19950715', + lastname: 'Rudderlabs', + firstName: 'Test', + address: { city: 'Kolkata', state: 'WB', zip: '700114', country: 'IN' }, + }, + device: { advertisingId: 'abc123' }, + library: { name: 'rudder-sdk-ruby-sync', version: '1.0.6' }, + }, + messageId: '7208bbb6-2c4e-45bb-bf5b-ad426f3593e9', + timestamp: '2020-08-14T05:30:30.118Z', + anonymousId: '50be5c78-6c3f-4b60-be84-97805a316fb1', + integrations: { All: true }, + }, + destination: { + DestinationDefinition: { Config: { cdkV2Enabled: true } }, + ID: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq', + Name: 'PINTEREST_TAG', + Config: { + sendAsTestEvent: false, + tagId: '123456789', + apiVersion: 'newApi', + adAccountId: 'accountId123', + conversionToken: 'conversionToken123', + appId: '429047995', + enhancedMatch: true, + enableDeduplication: true, + deduplicationKey: 'messageId', + sendingUnHashedData: true, + sendAsCustomEvent: false, + customProperties: [{ properties: 'presentclass' }, { properties: 'presentgrade' }], + eventsMapping: [{ from: 'ABC Searched', to: 'WatchVideo' }], + }, + Enabled: true, + Transformations: [], + }, + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, + }, + ], + method: 'POST', + }, + pathSuffix: '', + }, + output: { + response: { + status: 200, + body: [ + { + error: + 'event_name could not be mapped. Aborting.: Workflow: procWorkflow, Step: validateInputForTrack, ChildStep: undefined, OriginalError: event_name could not be mapped. Aborting.', + metadata: { destintionId: '1pYpzzvcn7AQ2W9GGIAZSsN6Mfq' }, + statTags: { + destType: 'PINTEREST_TAG', + errorCategory: 'platform', + feature: 'processor', + implementation: 'cdkV2', + module: 'destination', + }, + statusCode: 400, + }, + ], + }, + }, + }, ]; From 0996e816d3671c3e25561f76e3219be99225f24b Mon Sep 17 00:00:00 2001 From: Anant Jain <62471433+anantjain45823@users.noreply.github.com> Date: Fri, 10 Nov 2023 14:23:57 +0530 Subject: [PATCH 3/4] feat: introduce v1/source/sourceType endpoint (#2722) * source routing handle * migrate webhook to v1 * using folder structure to fetch varsionMap dynamically * small fix * update feature.json for v1 support boolean * temp commit * chore: comments addressed * chore: add test cases * chore: use map to store source version mapping * chore: resolve conflicts * chore: fix test cases and adressed comments * chore: fix test cases and adressed comments * chore: removed unnecessary types for source * chore: add test case for version v1 for webhook source means no alters in payload --- src/controllers/source.ts | 9 +- src/controllers/util/index.test.ts | 149 ++++++++++++++++++ src/controllers/util/index.ts | 48 ++++++ src/features.json | 3 +- src/types/index.ts | 29 ++++ src/{v0 => v1}/sources/webhook/transform.js | 5 +- .../source/{ => v0}/failure.json | 0 .../source/{ => v0}/response_to_caller.json | 0 .../source/{ => v0}/successful.json | 0 .../data_scenarios/source/v1/failure.json | 27 ++++ .../data_scenarios/source/v1/pipedream.json | 49 ++++++ .../data_scenarios/source/v1/successful.json | 38 +++++ test/apitests/service.api.test.ts | 38 ++++- 13 files changed, 387 insertions(+), 8 deletions(-) create mode 100644 src/controllers/util/index.test.ts rename src/{v0 => v1}/sources/webhook/transform.js (81%) rename test/apitests/data_scenarios/source/{ => v0}/failure.json (100%) rename test/apitests/data_scenarios/source/{ => v0}/response_to_caller.json (100%) rename test/apitests/data_scenarios/source/{ => v0}/successful.json (100%) create mode 100644 test/apitests/data_scenarios/source/v1/failure.json create mode 100644 test/apitests/data_scenarios/source/v1/pipedream.json create mode 100644 test/apitests/data_scenarios/source/v1/successful.json diff --git a/src/controllers/source.ts b/src/controllers/source.ts index efb6dc746e..b1e7e8fe12 100644 --- a/src/controllers/source.ts +++ b/src/controllers/source.ts @@ -16,10 +16,15 @@ export default class SourceController { const { version, source }: { version: string; source: string } = ctx.params; const integrationService = ServiceSelector.getNativeSourceService(); try { - const resplist = await integrationService.sourceTransformRoutine( - events, + const { implementationVersion, input } = ControllerUtility.adaptInputToVersion( source, version, + events, + ); + const resplist = await integrationService.sourceTransformRoutine( + input, + source, + implementationVersion, requestMetadata, ); ctx.body = resplist; diff --git a/src/controllers/util/index.test.ts b/src/controllers/util/index.test.ts new file mode 100644 index 0000000000..0bc5f174b0 --- /dev/null +++ b/src/controllers/util/index.test.ts @@ -0,0 +1,149 @@ +import ControllerUtility from './index'; + +describe('adaptInputToVersion', () => { + it('should return the input unchanged when the implementation version is not found', () => { + const sourceType = 'NA_SOURCE'; + const requestVersion = 'v0'; + const input = [ + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + ]; + const expected = { + implementationVersion: undefined, + input: [ + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + ], + }; + + const result = ControllerUtility.adaptInputToVersion(sourceType, requestVersion, input); + + expect(result).toEqual(expected); + }); + it('should return the input unchanged when the implementation version and request version are the same i.e. v0', () => { + const sourceType = 'pipedream'; + const requestVersion = 'v0'; + const input = [ + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + ]; + const expected = { + implementationVersion: 'v0', + input: [ + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + ], + }; + + const result = ControllerUtility.adaptInputToVersion(sourceType, requestVersion, input); + + expect(result).toEqual(expected); + }); + it('should return the input unchanged when the implementation version and request version are the same i.e. v1', () => { + const sourceType = 'webhook'; + const requestVersion = 'v1'; + const input = [ + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + ]; + const expected = { + implementationVersion: 'v1', + input: [ + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + ], + }; + + const result = ControllerUtility.adaptInputToVersion(sourceType, requestVersion, input); + + expect(result).toEqual(expected); + }); + it('should convert input from v0 to v1 when the request version is v0 and the implementation version is v1', () => { + const sourceType = 'webhook'; + const requestVersion = 'v0'; + const input = [ + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + ]; + const expected = { + implementationVersion: 'v1', + input: [ + { event: { key1: 'val1', key2: 'val2' }, source: undefined }, + { event: { key1: 'val1', key2: 'val2' }, source: undefined }, + { event: { key1: 'val1', key2: 'val2' }, source: undefined }, + ], + }; + + const result = ControllerUtility.adaptInputToVersion(sourceType, requestVersion, input); + + expect(result).toEqual(expected); + }); + + it('should convert input from v1 to v0 format when the request version is v1 and the implementation version is v0', () => { + const sourceType = 'pipedream'; + const requestVersion = 'v1'; + const input = [ + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + { + event: { key1: 'val1', key2: 'val2' }, + source: { id: 'source_id', config: { configField1: 'configVal1' } }, + }, + ]; + const expected = { + implementationVersion: 'v0', + input: [ + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + { key1: 'val1', key2: 'val2' }, + ], + }; + + const result = ControllerUtility.adaptInputToVersion(sourceType, requestVersion, input); + + expect(result).toEqual(expected); + }); + + // Should return an empty array when the input is an empty array + it('should return an empty array when the input is an empty array', () => { + const sourceType = 'pipedream'; + const requestVersion = 'v1'; + const input = []; + const expected = { implementationVersion: 'v0', input: [] }; + + const result = ControllerUtility.adaptInputToVersion(sourceType, requestVersion, input); + + expect(result).toEqual(expected); + }); +}); diff --git a/src/controllers/util/index.ts b/src/controllers/util/index.ts index e2071968d7..c52eb6899e 100644 --- a/src/controllers/util/index.ts +++ b/src/controllers/util/index.ts @@ -1,3 +1,5 @@ +import fs = require('fs'); +import path = require('path'); import { Context } from 'koa'; import isEmpty from 'lodash/isEmpty'; import get from 'get-value'; @@ -7,12 +9,15 @@ import { ProcessorTransformationRequest, RouterTransformationRequestData, RudderMessage, + SourceInput, } from '../../types'; import { getValueFromMessage } from '../../v0/util'; import genericFieldMap from '../../v0/util/data/GenericFieldMapping.json'; import { EventType, MappedToDestinationKey } from '../../constants'; export default class ControllerUtility { + private static sourceVersionMap: Map = new Map(); + public static timestampValsMap: Record = { [EventType.IDENTIFY]: [ `context.${RETL_TIMESTAMP}`, @@ -23,6 +28,49 @@ export default class ControllerUtility { [EventType.TRACK]: [`properties.${RETL_TIMESTAMP}`, ...genericFieldMap.timestamp], }; + private static getSourceVersionsMap(): Map { + if (this.sourceVersionMap?.size > 0) { + return this.sourceVersionMap; + } + const versions = ['v0', 'v1']; + versions.forEach((version) => { + const files = fs.readdirSync(path.resolve(__dirname, `../../${version}/sources`), { + withFileTypes: true, + }); + const sources = files.filter((file) => file.isDirectory()).map((folder) => folder.name); + sources.forEach((source) => { + this.sourceVersionMap.set(source, version); + }); + }); + return this.sourceVersionMap; + } + + private static convertSourceInputv1Tov0(sourceEvents: SourceInput[]): NonNullable[] { + return sourceEvents.map((sourceEvent) => sourceEvent.event); + } + + private static convertSourceInputv0Tov1(sourceEvents: unknown[]): SourceInput[] { + return sourceEvents.map( + (sourceEvent) => ({ event: sourceEvent, source: undefined } as SourceInput), + ); + } + + public static adaptInputToVersion( + sourceType: string, + requestVersion: string, + input: NonNullable[], + ): { implementationVersion: string; input: NonNullable[] } { + const sourceToVersionMap = this.getSourceVersionsMap(); + const implementationVersion = sourceToVersionMap.get(sourceType); + let updatedInput: NonNullable[] = input; + if (requestVersion === 'v0' && implementationVersion === 'v1') { + updatedInput = this.convertSourceInputv0Tov1(input); + } else if (requestVersion === 'v1' && implementationVersion === 'v0') { + updatedInput = this.convertSourceInputv1Tov0(input as SourceInput[]); + } + return { implementationVersion, input: updatedInput }; + } + private static getCompatibleStatusCode(status: number): number { return getCompatibleStatusCode(status); } diff --git a/src/features.json b/src/features.json index 9793f667e3..d3ea3e98a6 100644 --- a/src/features.json +++ b/src/features.json @@ -61,5 +61,6 @@ "ORTTO": true, "ONE_SIGNAL": true, "TIKTOK_AUDIENCE": true - } + }, + "supportSourceTransformV1": true } diff --git a/src/types/index.ts b/src/types/index.ts index 79efaecb40..9292fe2cc2 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -224,7 +224,34 @@ type ComparatorInput = { requestMetadata: object; feature: string; }; +type SourceDefinition = { + ID: string; + Name: string; + Category: string; + Type: string; +}; + +type Source = { + ID: string; + OriginalID: string; + Name: string; + SourceDefinition: SourceDefinition; + Config: object; + Enabled: boolean; + WorkspaceID: string; + WriteKey: string; + Transformations?: UserTransformationInput[]; + RevisionID?: string; + Destinations?: Destination[]; + Transient: boolean; + EventSchemasEnabled: boolean; + DgSourceTrackingPlanConfig: object; +}; +type SourceInput = { + event: NonNullable[]; + source?: Source; +}; export { Metadata, MessageIdMetadataMap, @@ -246,4 +273,6 @@ export { UserDeletionResponse, Destination, ComparatorInput, + SourceInput, + Source, }; diff --git a/src/v0/sources/webhook/transform.js b/src/v1/sources/webhook/transform.js similarity index 81% rename from src/v0/sources/webhook/transform.js rename to src/v1/sources/webhook/transform.js index 3a756ef63b..fc13424b8a 100644 --- a/src/v0/sources/webhook/transform.js +++ b/src/v1/sources/webhook/transform.js @@ -1,4 +1,4 @@ -const { removeUndefinedAndNullValues, generateUUID } = require('../../util'); +const { removeUndefinedAndNullValues, generateUUID } = require('../../../v0/util'); function processEvent(event) { const payload = { @@ -10,7 +10,8 @@ function processEvent(event) { return payload; } -function process(event) { +function process(inputEvent) { + const { event } = inputEvent; const response = processEvent(event); return removeUndefinedAndNullValues(response); } diff --git a/test/apitests/data_scenarios/source/failure.json b/test/apitests/data_scenarios/source/v0/failure.json similarity index 100% rename from test/apitests/data_scenarios/source/failure.json rename to test/apitests/data_scenarios/source/v0/failure.json diff --git a/test/apitests/data_scenarios/source/response_to_caller.json b/test/apitests/data_scenarios/source/v0/response_to_caller.json similarity index 100% rename from test/apitests/data_scenarios/source/response_to_caller.json rename to test/apitests/data_scenarios/source/v0/response_to_caller.json diff --git a/test/apitests/data_scenarios/source/successful.json b/test/apitests/data_scenarios/source/v0/successful.json similarity index 100% rename from test/apitests/data_scenarios/source/successful.json rename to test/apitests/data_scenarios/source/v0/successful.json diff --git a/test/apitests/data_scenarios/source/v1/failure.json b/test/apitests/data_scenarios/source/v1/failure.json new file mode 100644 index 0000000000..9bf77f9b53 --- /dev/null +++ b/test/apitests/data_scenarios/source/v1/failure.json @@ -0,0 +1,27 @@ +{ + "input": [ + { + "event": { + "anonymousId": "63767499ca6fb1b7c988d5bb", + "artist": "Gautam", + "genre": "Jazz", + "song": "Take Five" + }, + "source": { + "id": "source_id", + "config": { + "configField1": "configVal1" + } + } + } + ], + "output": [ + { + "statusCode": 500, + "error": "Cannot find module '../undefined/sources/NA_SOURCE/transform' from 'src/services/misc.ts'", + "statTags": { + "errorCategory": "transformation" + } + } + ] +} diff --git a/test/apitests/data_scenarios/source/v1/pipedream.json b/test/apitests/data_scenarios/source/v1/pipedream.json new file mode 100644 index 0000000000..4219f3f6b1 --- /dev/null +++ b/test/apitests/data_scenarios/source/v1/pipedream.json @@ -0,0 +1,49 @@ +{ + "input": [ + { + "event": { + "anonymousId": "63767499ca6fb1b7c988d5bb", + "artist": "Gautam", + "genre": "Jazz", + "song": "Take Five" + }, + "source": { + "id": "source_id", + "config": { + "configField1": "configVal1" + } + } + } + ], + "output": [ + { + "output": { + "batch": [ + { + "event": "pipedream_source_event", + "anonymousId": "63767499ca6fb1b7c988d5bb", + "context": { + "integration": { + "name": "PIPEDREAM" + }, + "library": { + "name": "unknown", + "version": "unknown" + } + }, + "integrations": { + "PIPEDREAM": false + }, + "type": "track", + "properties": { + "anonymousId": "63767499ca6fb1b7c988d5bb", + "artist": "Gautam", + "genre": "Jazz", + "song": "Take Five" + } + } + ] + } + } + ] +} \ No newline at end of file diff --git a/test/apitests/data_scenarios/source/v1/successful.json b/test/apitests/data_scenarios/source/v1/successful.json new file mode 100644 index 0000000000..c42d723800 --- /dev/null +++ b/test/apitests/data_scenarios/source/v1/successful.json @@ -0,0 +1,38 @@ +{ + "input": [ + { + "event": { + "event": "Fulfillments Update", + "data": { + "fulfillment_id": "1234567890", + "status": "pending" + } + }, + "source": { + "id": "source_id", + "config": { + "configField1": "configVal1" + } + } + } + ], + "output": [ + { + "output": { + "batch": [ + { + "type": "track", + "event": "webhook_source_event", + "properties": { + "event": "Fulfillments Update", + "data": { + "fulfillment_id": "1234567890", + "status": "pending" + } + } + } + ] + } + } + ] +} diff --git a/test/apitests/service.api.test.ts b/test/apitests/service.api.test.ts index dfe7e10dd6..ee534d7b37 100644 --- a/test/apitests/service.api.test.ts +++ b/test/apitests/service.api.test.ts @@ -177,7 +177,7 @@ describe('Destination api tests', () => { describe('Source api tests', () => { test('(shopify) successful source transform', async () => { - const data = getDataFromPath('./data_scenarios/source/successful.json'); + const data = getDataFromPath('./data_scenarios/source/v0/successful.json'); const response = await request(server) .post('/v0/sources/shopify') .set('Accept', 'application/json') @@ -189,7 +189,7 @@ describe('Source api tests', () => { }); test('(shopify) failure source transform (shopify)', async () => { - const data = getDataFromPath('./data_scenarios/source/failure.json'); + const data = getDataFromPath('./data_scenarios/source/v0/failure.json'); const response = await request(server) .post('/v0/sources/shopify') .set('Accept', 'application/json') @@ -199,7 +199,7 @@ describe('Source api tests', () => { }); test('(shopify) success source transform (monday)', async () => { - const data = getDataFromPath('./data_scenarios/source/response_to_caller.json'); + const data = getDataFromPath('./data_scenarios/source/v0/response_to_caller.json'); const response = await request(server) .post('/v0/sources/monday') .set('Accept', 'application/json') @@ -207,6 +207,38 @@ describe('Source api tests', () => { expect(response.status).toEqual(200); expect(JSON.parse(response.text)).toEqual(data.output); }); + + test('(webhook) successful source transform for source present in v1 and server providing v0 endpoint', async () => { + const data = getDataFromPath('./data_scenarios/source/v1/successful.json'); + const response = await request(server) + .post('/v1/sources/webhook') + .set('Accept', 'application/json') + .send(data.input); + const parsedResp = JSON.parse(response.text); + delete parsedResp[0].output.batch[0].anonymousId; + expect(response.status).toEqual(200); + expect(parsedResp).toEqual(data.output); + }); + + test('(NA_SOURCE) failure source transform ', async () => { + const data = getDataFromPath('./data_scenarios/source/v1/failure.json'); + const response = await request(server) + .post('/v0/sources/NA_SOURCE') + .set('Accept', 'application/json') + .send(data.input); + expect(response.status).toEqual(200); + expect(JSON.parse(response.text)).toEqual(data.output); + }); + + test('(pipedream) success source transform for source present in v0 and server providing v1 endpoint', async () => { + const data = getDataFromPath('./data_scenarios/source/v1/pipedream.json'); + const response = await request(server) + .post('/v1/sources/pipedream') + .set('Accept', 'application/json') + .send(data.input); + expect(response.status).toEqual(200); + expect(JSON.parse(response.text)).toEqual(data.output); + }); }); describe('CDK V1 api tests', () => { From 42bec546cc9159a8cc496a7b01a08a9171c02aff Mon Sep 17 00:00:00 2001 From: Gauravudia <60897972+Gauravudia@users.noreply.github.com> Date: Fri, 10 Nov 2023 15:46:08 +0530 Subject: [PATCH 4/4] chore: add error import from lib for missing integrations (#2818) --- src/legacy/router.js | 2 +- src/v0/destinations/facebook_conversions/transform.js | 3 +-- src/v0/destinations/facebook_conversions/utils.js | 2 +- src/v0/sources/appcenter/transform.js | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/legacy/router.js b/src/legacy/router.js index 99fb8570fb..f8deb3fe62 100644 --- a/src/legacy/router.js +++ b/src/legacy/router.js @@ -7,6 +7,7 @@ const Router = require('@koa/router'); const lodash = require('lodash'); const fs = require('fs'); const path = require('path'); +const { PlatformError } = require('@rudderstack/integrations-lib'); const logger = require('../logger'); const stats = require('../util/stats'); const { SUPPORTED_VERSIONS, API_VERSION } = require('../routes/utils/constants'); @@ -35,7 +36,6 @@ const { sendViolationMetrics, constructValidationErrors, } = require('../util/utils'); -const { PlatformError } = require('../v0/util/errorTypes'); const { processCdkV1 } = require('../cdk/v1/handler'); const { extractLibraries } = require('../util/customTransformer'); const { getCompatibleStatusCode } = require('../adapters/utils/networkUtils'); diff --git a/src/v0/destinations/facebook_conversions/transform.js b/src/v0/destinations/facebook_conversions/transform.js index dec1ef2e6c..cf11795605 100644 --- a/src/v0/destinations/facebook_conversions/transform.js +++ b/src/v0/destinations/facebook_conversions/transform.js @@ -1,6 +1,7 @@ /* eslint-disable no-param-reassign */ const get = require('get-value'); const moment = require('moment'); +const { InstrumentationError, ConfigurationError } = require('@rudderstack/integrations-lib'); const { CONFIG_CATEGORIES, MAPPING_CONFIG, @@ -34,8 +35,6 @@ const { formingFinalResponse, } = require('../../util/facebookUtils'); -const { InstrumentationError, ConfigurationError } = require('../../util/errorTypes'); - const responseBuilderSimple = (message, category, destination) => { const { Config, ID } = destination; let { categoryToContent } = Config; diff --git a/src/v0/destinations/facebook_conversions/utils.js b/src/v0/destinations/facebook_conversions/utils.js index 270fac8c45..32fafae3d0 100644 --- a/src/v0/destinations/facebook_conversions/utils.js +++ b/src/v0/destinations/facebook_conversions/utils.js @@ -1,3 +1,4 @@ +const { InstrumentationError } = require('@rudderstack/integrations-lib'); const { CONFIG_CATEGORIES, OTHER_STANDARD_EVENTS, @@ -8,7 +9,6 @@ const { } = require('./config'); const { constructPayload, isObject, isAppleFamily } = require('../../util'); const { getContentType, getContentCategory } = require('../../util/facebookUtils'); -const { InstrumentationError } = require('../../util/errorTypes'); const getActionSource = (payload, fallbackActionSource) => { let actionSource = fallbackActionSource; diff --git a/src/v0/sources/appcenter/transform.js b/src/v0/sources/appcenter/transform.js index 3a98a6db3e..40399d92e2 100644 --- a/src/v0/sources/appcenter/transform.js +++ b/src/v0/sources/appcenter/transform.js @@ -1,5 +1,6 @@ const path = require('path'); const fs = require('fs'); +const { TransformationError } = require('@rudderstack/integrations-lib'); const { generateUUID } = require('../../util'); const Message = require('../message'); @@ -7,7 +8,6 @@ const mappingJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, './mappin const { removeUndefinedAndNullValues } = require('../../util'); -const { TransformationError } = require('../../util/errorTypes'); const { JSON_MIME_TYPE } = require('../../util/constant'); const processNormalEvent = (event) => {