From 9c96f4c87bdbfaf679a1d8b91b00dac5accb4e76 Mon Sep 17 00:00:00 2001 From: Sayan Das <109198085+sayan-das-in@users.noreply.github.com> Date: Thu, 13 Feb 2025 17:37:49 +0530 Subject: [PATCH] Update Linter and fix linting issues (#2737) --- .eslintrc.js | 4 +- package.json | 4 +- .../src/engage/utils/MessageSendPerformer.ts | 2 +- packages/actions-shared/src/friendbuy/util.ts | 2 +- .../trackCustomEvent/__tests__/index.test.ts | 8 +- .../src/trackCustomer/__tests__/index.test.ts | 12 +- .../src/trackPage/__tests__/index.test.ts | 4 +- .../src/trackPurchase/__tests__/index.test.ts | 22 +-- .../src/trackSignUp/__tests__/index.test.ts | 4 +- .../__tests__/index.test.ts | 93 +++++----- .../src/trackEvent/__tests__/index.test.ts | 4 +- .../src/trackGoal/__tests__/index.test.ts | 12 +- .../src/trackPage/__tests__/index.test.ts | 6 +- .../mapping-kit/__tests__/validate.test.ts | 4 +- .../amazon-amc/__tests__/index.test.ts | 1 + .../destinations/display-video-360/shared.ts | 6 +- .../__tests__/send-email.test.ts | 2 +- .../src/destinations/pipedrive/utils.ts | 2 +- .../destinations/salesforce/sf-operations.ts | 2 +- yarn.lock | 169 +++++++++++------- 20 files changed, 210 insertions(+), 153 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index be72d66a9f..2206005002 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -45,7 +45,9 @@ module.exports = { '@typescript-eslint/require-await': 'off', '@typescript-eslint/restrict-plus-operands': 'off', '@typescript-eslint/restrict-template-expressions': 'off', - '@typescript-eslint/unbound-method': 'off' + '@typescript-eslint/unbound-method': 'off', + '@typescript-eslint/no-unsafe-argument': 'warn', + '@typescript-eslint/no-misused-promises': 'warn' }, overrides: [ { diff --git a/package.json b/package.json index 2288c2256b..b2d0906fa3 100644 --- a/package.json +++ b/package.json @@ -43,8 +43,8 @@ "@types/express": "^4.17.16", "@types/jest": "^27.0.0", "@types/ws": "^8.5.1", - "@typescript-eslint/eslint-plugin": "^4.14.0", - "@typescript-eslint/parser": "^4.14.0", + "@typescript-eslint/eslint-plugin": "^5.1.0", + "@typescript-eslint/parser": "^5.1.0", "cors": "^2.8.5", "eslint": "^7.25.0", "eslint-config-prettier": "^6.15.0", diff --git a/packages/actions-shared/src/engage/utils/MessageSendPerformer.ts b/packages/actions-shared/src/engage/utils/MessageSendPerformer.ts index 0cbc669801..cf9f8c3f10 100644 --- a/packages/actions-shared/src/engage/utils/MessageSendPerformer.ts +++ b/packages/actions-shared/src/engage/utils/MessageSendPerformer.ts @@ -316,7 +316,7 @@ export abstract class MessageSendPerformer< * populate the logDetails object with the data that should be logged for every message */ beforePerform() { - super.beforePerform?.() + void super.beforePerform?.() //adding common tags to the the tags that will be added to every single metric added via this.stats* if (this.executeInput.statsContext) diff --git a/packages/actions-shared/src/friendbuy/util.ts b/packages/actions-shared/src/friendbuy/util.ts index 50a116eb6a..1e3fbd133f 100644 --- a/packages/actions-shared/src/friendbuy/util.ts +++ b/packages/actions-shared/src/friendbuy/util.ts @@ -51,7 +51,7 @@ type NotUndefined = T extends undefined ? never : T /** * Returns true if the argument is undefined or an empty string, object, or array. */ -export function isNonEmpty(o: T): o is NotUndefined { +export function isNonEmpty(o: T): o is NotUndefined { if (o === undefined || o === '') { return false } diff --git a/packages/browser-destinations/destinations/friendbuy/src/trackCustomEvent/__tests__/index.test.ts b/packages/browser-destinations/destinations/friendbuy/src/trackCustomEvent/__tests__/index.test.ts index 203d5148c7..7ca88d05ae 100644 --- a/packages/browser-destinations/destinations/friendbuy/src/trackCustomEvent/__tests__/index.test.ts +++ b/packages/browser-destinations/destinations/friendbuy/src/trackCustomEvent/__tests__/index.test.ts @@ -17,7 +17,7 @@ describe('Friendbuy.trackCustomEvent', () => { enabled: true, subscribe: 'type = "track" and event = "download"', mapping: Object.fromEntries( - Object.entries(browserTrackCustomEventFields).map(([name, value]) => [name, value.default]) + Object.entries(browserTrackCustomEventFields).map(([name, value]) => [name, value.default as any]) ) } ] @@ -45,7 +45,7 @@ describe('Friendbuy.trackCustomEvent', () => { properties: { type: 'application', fileId: 'MyApp', deduplicationId: '1234' } }) - trackCustomEvent.track?.(context1) + await trackCustomEvent.track?.(context1) expect(window.friendbuyAPI?.push).not.toHaveBeenCalled() } @@ -58,7 +58,7 @@ describe('Friendbuy.trackCustomEvent', () => { properties: { type: 'application', fileId: 'MyApp', deduplicationId: '1234' } }) - trackCustomEvent.track?.(context2) + await trackCustomEvent.track?.(context2) expect(window.friendbuyAPI?.push).toHaveBeenNthCalledWith(1, [ 'track', @@ -82,7 +82,7 @@ describe('Friendbuy.trackCustomEvent', () => { properties: { type: 'application', fileId: 'MyApp', email, firstName, lastName } }) - trackCustomEvent.track?.(context3) + await trackCustomEvent.track?.(context3) expect(window.friendbuyAPI?.push).toHaveBeenNthCalledWith(2, [ 'track', diff --git a/packages/browser-destinations/destinations/friendbuy/src/trackCustomer/__tests__/index.test.ts b/packages/browser-destinations/destinations/friendbuy/src/trackCustomer/__tests__/index.test.ts index 869a37040e..8fd939faa0 100644 --- a/packages/browser-destinations/destinations/friendbuy/src/trackCustomer/__tests__/index.test.ts +++ b/packages/browser-destinations/destinations/friendbuy/src/trackCustomer/__tests__/index.test.ts @@ -86,7 +86,7 @@ describe('Friendbuy.trackCustomer', () => { }) // console.log('context1', JSON.stringify(context1, null, 2)) - trackCustomer.identify?.(context1) + await trackCustomer.identify?.(context1) // console.log('trackCustomer request', JSON.stringify(window.friendbuyAPI.push.mock.calls[0], null, 2)) expect(window.friendbuyAPI?.push).toHaveBeenNthCalledWith(1, [ @@ -126,7 +126,7 @@ describe('Friendbuy.trackCustomer', () => { } }) - trackCustomer.identify?.(context2) + await trackCustomer.identify?.(context2) expect(window.friendbuyAPI?.push).toHaveBeenNthCalledWith(2, [ 'track', @@ -152,7 +152,7 @@ describe('Friendbuy.trackCustomer', () => { } }) - trackCustomer.identify?.(context3) + await trackCustomer.identify?.(context3) expect(window.friendbuyAPI?.push).toHaveBeenNthCalledWith(3, [ 'track', @@ -170,15 +170,15 @@ describe('Friendbuy.trackCustomer', () => { // enjoined fields are converted const context4 = new Context({ type: 'identify', - userId: 12345, + userId: 12345 as any, traits: { email, age: '44', - address: { postalCode: 90210 } + address: { postalCode: 90210 } as any } }) - trackCustomer.identify?.(context4) + await trackCustomer.identify?.(context4) expect(window.friendbuyAPI?.push).toHaveBeenNthCalledWith(4, [ 'track', diff --git a/packages/browser-destinations/destinations/friendbuy/src/trackPage/__tests__/index.test.ts b/packages/browser-destinations/destinations/friendbuy/src/trackPage/__tests__/index.test.ts index 92a6ed9f46..ea43295601 100644 --- a/packages/browser-destinations/destinations/friendbuy/src/trackPage/__tests__/index.test.ts +++ b/packages/browser-destinations/destinations/friendbuy/src/trackPage/__tests__/index.test.ts @@ -16,7 +16,7 @@ describe('Friendbuy.trackPage', () => { name: trackPageObject.title, enabled: true, subscribe: trackPageDefaultSubscription, - mapping: Object.fromEntries(Object.entries(trackPageFields).map(([name, value]) => [name, value.default])) + mapping: Object.fromEntries(Object.entries(trackPageFields).map(([name, value]) => [name, value.default as any])) } ] @@ -46,7 +46,7 @@ describe('Friendbuy.trackPage', () => { }) // console.log('context', JSON.stringify(context, null, 2)) - trackPage.page?.(context) + await trackPage.page?.(context) // console.log('trackSignUp request', JSON.stringify(window.friendbuyAPI.push.mock.calls[0], null, 2)) expect(window.friendbuyAPI?.push).toHaveBeenCalledWith([ diff --git a/packages/browser-destinations/destinations/friendbuy/src/trackPurchase/__tests__/index.test.ts b/packages/browser-destinations/destinations/friendbuy/src/trackPurchase/__tests__/index.test.ts index b36d6ccc58..3db1520ce7 100644 --- a/packages/browser-destinations/destinations/friendbuy/src/trackPurchase/__tests__/index.test.ts +++ b/packages/browser-destinations/destinations/friendbuy/src/trackPurchase/__tests__/index.test.ts @@ -10,14 +10,14 @@ beforeEach(async () => { }) describe('Friendbuy.trackPurchase', () => { - const subscriptions = [ + const subscriptions: JSONValue = [ { partnerAction: 'trackPurchase', name: trackPurchaseObject.title, enabled: true, subscribe: trackPurchaseDefaultSubscription, mapping: Object.fromEntries( - Object.entries(browserTrackPurchaseFields).map(([name, value]) => [name, value.default]) + Object.entries(browserTrackPurchaseFields).map(([name, value]) => [name, value.default as any]) ) } ] @@ -62,7 +62,7 @@ describe('Friendbuy.trackPurchase', () => { // console.log(window.friendbuyAPI) jest.spyOn(window.friendbuyAPI as any, 'push') - const expectedProducts = products.map((p) => { + const expectedProducts = products.map((p: Record) => { p = { sku: 'unknown', name: 'unknown', quantity: 1, ...p } if (p.image_url) { p.imageUrl = p.image_url @@ -70,7 +70,7 @@ describe('Friendbuy.trackPurchase', () => { } return p }) - const amount = expectedProducts.reduce((acc, p) => acc + p.price * p.quantity, 0) + const amount = expectedProducts.reduce((acc, p) => acc + (p.price as number) * (p.quantity as number), 0) { // all fields @@ -89,7 +89,7 @@ describe('Friendbuy.trackPurchase', () => { attributionId, referralCode, giftCardCodes, - products: products as JSONValue, + products: products as unknown as JSONValue, email, name, friendbuyAttributes @@ -97,7 +97,7 @@ describe('Friendbuy.trackPurchase', () => { }) // console.log('context1', JSON.stringify(context1, null, 2)) - trackPurchase.track?.(context1) + await trackPurchase.track?.(context1) // console.log('trackPurchase request', JSON.stringify(window.friendbuyAPI.push.mock.calls[0], null, 2)) expect(window.friendbuyAPI?.push).toHaveBeenNthCalledWith(1, [ @@ -117,8 +117,8 @@ describe('Friendbuy.trackPurchase', () => { }, true ]) - expect(window.friendbuyAPI.push.mock.calls[0][0][2].products[1].quantity).toBe(1) - expect(window.friendbuyAPI.push.mock.calls[0][0][2].products[2].imageUrl).toBe(products[2].image_url) + expect((window.friendbuyAPI?.push as any).mock.calls[0][0][2].products[1].quantity).toBe(1) + expect((window.friendbuyAPI?.push as any).mock.calls[0][0][2].products[2].imageUrl).toBe(products[2].image_url) } { @@ -133,7 +133,7 @@ describe('Friendbuy.trackPurchase', () => { } }) - trackPurchase.track?.(context2) + await trackPurchase.track?.(context2) expect(window.friendbuyAPI?.push).toHaveBeenNthCalledWith(2, [ 'track', @@ -163,7 +163,7 @@ describe('Friendbuy.trackPurchase', () => { } }) - trackPurchase.track?.(context3) + await trackPurchase.track?.(context3) expect(window.friendbuyAPI?.push).toHaveBeenNthCalledWith(3, [ 'track', @@ -192,7 +192,7 @@ describe('Friendbuy.trackPurchase', () => { } }) - trackPurchase.track?.(context4) + await trackPurchase.track?.(context4) expect(window.friendbuyAPI?.push).toHaveBeenNthCalledWith(4, [ 'track', diff --git a/packages/browser-destinations/destinations/friendbuy/src/trackSignUp/__tests__/index.test.ts b/packages/browser-destinations/destinations/friendbuy/src/trackSignUp/__tests__/index.test.ts index 9d7c046178..2a3a807378 100644 --- a/packages/browser-destinations/destinations/friendbuy/src/trackSignUp/__tests__/index.test.ts +++ b/packages/browser-destinations/destinations/friendbuy/src/trackSignUp/__tests__/index.test.ts @@ -39,7 +39,7 @@ describe('Friendbuy.trackSignUp', () => { const [trackSignUp] = await friendbuyDestination({ merchantId, subscriptions - }) + } as any) // console.log('trackSignUp', JSON.stringify(trackSignUp, null, 2), trackSignUp) expect(trackSignUp).toBeDefined() @@ -67,7 +67,7 @@ describe('Friendbuy.trackSignUp', () => { }) // console.log('context', JSON.stringify(context, null, 2)) - trackSignUp.track?.(context) + await trackSignUp.track?.(context) // console.log('trackSignUp request', JSON.stringify(window.friendbuyAPI.push.mock.calls[0], null, 2)) expect(window.friendbuyAPI?.push).toHaveBeenCalledWith([ diff --git a/packages/browser-destinations/destinations/wisepops/src/setCustomProperties/__tests__/index.test.ts b/packages/browser-destinations/destinations/wisepops/src/setCustomProperties/__tests__/index.test.ts index 14aefece9f..11abf657ed 100644 --- a/packages/browser-destinations/destinations/wisepops/src/setCustomProperties/__tests__/index.test.ts +++ b/packages/browser-destinations/destinations/wisepops/src/setCustomProperties/__tests__/index.test.ts @@ -25,7 +25,7 @@ describe('Wisepops.setCustomProperties', () => { id: { '@path': '$.userId' }, - idProperty: 'userId', + idProperty: 'userId' } } ] @@ -33,7 +33,7 @@ describe('Wisepops.setCustomProperties', () => { const [setCustomProperties] = await wisepopsDestination({ websiteId: '1234567890', subscriptions - }) + } as any) expect(setCustomProperties).toBeDefined() @@ -44,15 +44,18 @@ describe('Wisepops.setCustomProperties', () => { const context = new Context({ type: 'identify', traits: { - firstName: 'John', + firstName: 'John' } - }); + }) - setCustomProperties.identify?.(context) + await setCustomProperties.identify?.(context) - expect(window.wisepops.q.push).toHaveBeenCalledWith(['properties', { - firstName: 'John', - }]) + expect(window.wisepops.q.push).toHaveBeenCalledWith([ + 'properties', + { + firstName: 'John' + } + ]) } { @@ -67,19 +70,22 @@ describe('Wisepops.setCustomProperties', () => { country: 'France' } } - }); + }) - setCustomProperties.identify?.(context) + await setCustomProperties.identify?.(context) - expect(window.wisepops.q.push).toHaveBeenCalledWith(['properties', { - userId: '42', - email: 'test@example.com', - firstName: 'John', - address: { - city: 'Paris', - country: 'France' + expect(window.wisepops.q.push).toHaveBeenCalledWith([ + 'properties', + { + userId: '42', + email: 'test@example.com', + firstName: 'John', + address: { + city: 'Paris', + country: 'France' + } } - }]) + ]) } }) @@ -98,7 +104,7 @@ describe('Wisepops.setCustomProperties', () => { id: { '@path': '$.userId' }, - idProperty: 'userId', + idProperty: 'userId' } } ] @@ -106,7 +112,7 @@ describe('Wisepops.setCustomProperties', () => { const [setCustomProperties] = await wisepopsDestination({ websiteId: '1234567890', subscriptions - }) + } as any) expect(setCustomProperties).toBeDefined() @@ -117,17 +123,20 @@ describe('Wisepops.setCustomProperties', () => { const context = new Context({ type: 'identify', traits: { - firstName: 'John', + firstName: 'John' } - }); + }) - setCustomProperties.identify?.(context) + await setCustomProperties.identify?.(context) - expect(window.wisepops.q.push).toHaveBeenCalledWith(['properties', { - user: { - firstName: 'John', + expect(window.wisepops.q.push).toHaveBeenCalledWith([ + 'properties', + { + user: { + firstName: 'John' + } } - }]) + ]) } { @@ -142,22 +151,24 @@ describe('Wisepops.setCustomProperties', () => { country: 'France' } } - }); - - setCustomProperties.identify?.(context) - - expect(window.wisepops.q.push).toHaveBeenCalledWith(['properties', { - user: { - userId: '42', - email: 'test@example.com', - firstName: 'John', - address: { - city: 'Paris', - country: 'France' + }) + + await setCustomProperties.identify?.(context) + + expect(window.wisepops.q.push).toHaveBeenCalledWith([ + 'properties', + { + user: { + userId: '42', + email: 'test@example.com', + firstName: 'John', + address: { + city: 'Paris', + country: 'France' + } } } - }]) + ]) } - }) }) diff --git a/packages/browser-destinations/destinations/wisepops/src/trackEvent/__tests__/index.test.ts b/packages/browser-destinations/destinations/wisepops/src/trackEvent/__tests__/index.test.ts index 0325cb4195..e6601b40c0 100644 --- a/packages/browser-destinations/destinations/wisepops/src/trackEvent/__tests__/index.test.ts +++ b/packages/browser-destinations/destinations/wisepops/src/trackEvent/__tests__/index.test.ts @@ -29,7 +29,7 @@ describe('Wisepops.trackEvent', () => { const [trackEvent] = await wisepopsDestination({ websiteId: '1234567890', subscriptions - }) + } as any) expect(trackEvent).toBeDefined() @@ -43,7 +43,7 @@ describe('Wisepops.trackEvent', () => { eventParam: 'An event parameter' } }) - trackEvent.track?.(context) + await trackEvent.track?.(context) expect(window.wisepops.q.push).toHaveBeenCalledWith(['event', 'Something happens']) }) diff --git a/packages/browser-destinations/destinations/wisepops/src/trackGoal/__tests__/index.test.ts b/packages/browser-destinations/destinations/wisepops/src/trackGoal/__tests__/index.test.ts index 80fd63b865..d7178de061 100644 --- a/packages/browser-destinations/destinations/wisepops/src/trackGoal/__tests__/index.test.ts +++ b/packages/browser-destinations/destinations/wisepops/src/trackGoal/__tests__/index.test.ts @@ -23,7 +23,7 @@ describe('Wisepops.trackGoal', () => { }, goalRevenue: { '@path': '$.properties.revenue' - }, + } } } ] @@ -32,7 +32,7 @@ describe('Wisepops.trackGoal', () => { const [trackGoal] = await wisepopsDestination({ websiteId: '1234567890', subscriptions - }) + } as any) expect(trackGoal).toBeDefined() await trackGoal.load(Context.system(), {} as Analytics) @@ -46,7 +46,7 @@ describe('Wisepops.trackGoal', () => { revenue: 15 } }) - trackGoal.track?.(context) + await trackGoal.track?.(context) expect(window.wisepops.q.push).toHaveBeenCalledWith(['goal', 'Order Completed', 15]) }) @@ -55,7 +55,7 @@ describe('Wisepops.trackGoal', () => { const [trackGoal] = await wisepopsDestination({ websiteId: '1234567890', subscriptions - }) + } as any) expect(trackGoal).toBeDefined() await trackGoal.load(Context.system(), {} as Analytics) @@ -69,8 +69,8 @@ describe('Wisepops.trackGoal', () => { revenue: 15 } }) - trackGoal.track?.(context) + await trackGoal.track?.(context) - expect(window.wisepops.q.push).toHaveBeenCalledWith(['goal', 'yhqnj9RTF3Fk6TnTmRW6vhxiugipbUKc', {revenue: 15}]) + expect(window.wisepops.q.push).toHaveBeenCalledWith(['goal', 'yhqnj9RTF3Fk6TnTmRW6vhxiugipbUKc', { revenue: 15 }]) }) }) diff --git a/packages/browser-destinations/destinations/wisepops/src/trackPage/__tests__/index.test.ts b/packages/browser-destinations/destinations/wisepops/src/trackPage/__tests__/index.test.ts index 71e669809f..d051564fe6 100644 --- a/packages/browser-destinations/destinations/wisepops/src/trackPage/__tests__/index.test.ts +++ b/packages/browser-destinations/destinations/wisepops/src/trackPage/__tests__/index.test.ts @@ -25,15 +25,15 @@ describe('Wisepops.trackPage', () => { const [trackPage] = await wisepopsDestination({ websiteId: '1234567890', subscriptions - }) + } as any) expect(trackPage).toBeDefined() await trackPage.load(Context.system(), {} as Analytics) jest.spyOn(window.wisepops.q as any, 'push') - const context = new Context({type: 'page'}) - trackPage.page?.(context) + const context = new Context({ type: 'page' }) + await trackPage.page?.(context) expect(window.wisepops.q.push).toHaveBeenCalledWith(['pageview']) }) diff --git a/packages/core/src/mapping-kit/__tests__/validate.test.ts b/packages/core/src/mapping-kit/__tests__/validate.test.ts index 9c4a4dd12b..0527f585fe 100644 --- a/packages/core/src/mapping-kit/__tests__/validate.test.ts +++ b/packages/core/src/mapping-kit/__tests__/validate.test.ts @@ -44,9 +44,9 @@ describe('validation', () => { } catch (error) { hasError = true if (typeof fixture.expectError === 'string') { - expect(error.message).toMatch(fixture.expectError) + expect((error as Error).message).toMatch(fixture.expectError) } else { - for (const err of error) { + for (const err of error as Error[]) { expect(fixture.expectError).toContain(err.message) } } diff --git a/packages/destination-actions/src/destinations/amazon-amc/__tests__/index.test.ts b/packages/destination-actions/src/destinations/amazon-amc/__tests__/index.test.ts index e17cec346e..e064ff5ab0 100644 --- a/packages/destination-actions/src/destinations/amazon-amc/__tests__/index.test.ts +++ b/packages/destination-actions/src/destinations/amazon-amc/__tests__/index.test.ts @@ -195,6 +195,7 @@ describe('Amazon-Ads (actions)', () => { nock(`${settings.region}/amc/audiences/metadata`) .get(`/${externalId}`) .reply(200, { + // eslint-disable-next-line @typescript-eslint/no-loss-of-precision advertiserId: 1234567893456754321, audienceId: 1234549079612618, countryCode: 'US', diff --git a/packages/destination-actions/src/destinations/display-video-360/shared.ts b/packages/destination-actions/src/destinations/display-video-360/shared.ts index 546665bfc2..69287e58b9 100644 --- a/packages/destination-actions/src/destinations/display-video-360/shared.ts +++ b/packages/destination-actions/src/destinations/display-video-360/shared.ts @@ -198,11 +198,7 @@ export const sendUpdateRequest = async ( await bulkUploaderResponseHandler(response, statsName, statsContext) } catch (error) { if ((error as HTTPError).response?.status === 500) { - throw new IntegrationError( - (error as unknown as any).response?.message ?? (error as HTTPError).message, - 'INTERNAL_SERVER_ERROR', - 500 - ) + throw new IntegrationError(error.response?.message ?? (error as HTTPError).message, 'INTERNAL_SERVER_ERROR', 500) } await bulkUploaderResponseHandler((error as HTTPError).response, statsName, statsContext) diff --git a/packages/destination-actions/src/destinations/engage-messaging-sendgrid/__tests__/send-email.test.ts b/packages/destination-actions/src/destinations/engage-messaging-sendgrid/__tests__/send-email.test.ts index 7e4f51d349..c83ff0a361 100644 --- a/packages/destination-actions/src/destinations/engage-messaging-sendgrid/__tests__/send-email.test.ts +++ b/packages/destination-actions/src/destinations/engage-messaging-sendgrid/__tests__/send-email.test.ts @@ -416,7 +416,7 @@ describe.each([ }) fail('Test should throw an error') } catch (e) { - expect((e as unknown as any).message).toBe( + expect((e as Error).message).toBe( 'Emails with gmailx.com, yahoox.com, aolx.com, and hotmailx.com domains are blocked.' ) expectErrorLogged(`Emails with gmailx.com, yahoox.com, aolx.com, and hotmailx.com domains are blocked`) diff --git a/packages/destination-actions/src/destinations/pipedrive/utils.ts b/packages/destination-actions/src/destinations/pipedrive/utils.ts index 2073839cd6..581966830b 100644 --- a/packages/destination-actions/src/destinations/pipedrive/utils.ts +++ b/packages/destination-actions/src/destinations/pipedrive/utils.ts @@ -1,6 +1,6 @@ type PayloadWithCustomFields = { custom_fields?: { [k: string]: unknown } } -export function addCustomFieldsFromPayloadToEntity(payload: PayloadWithCustomFields, entity: E) { +export function addCustomFieldsFromPayloadToEntity(payload: PayloadWithCustomFields, entity: E) { if (!payload.custom_fields) { return } diff --git a/packages/destination-actions/src/destinations/salesforce/sf-operations.ts b/packages/destination-actions/src/destinations/salesforce/sf-operations.ts index 5e56a7a252..7d729f8b67 100644 --- a/packages/destination-actions/src/destinations/salesforce/sf-operations.ts +++ b/packages/destination-actions/src/destinations/salesforce/sf-operations.ts @@ -496,7 +496,7 @@ export default class Salesforce { private removeInvalidChars = (value: string) => value.replace(/[^a-zA-Z0-9_]/g, '') // Pre-formats trait values based on datatypes for correct SOQL syntax - private typecast = (value: any) => { + private typecast = (value: unknown) => { switch (typeof value) { case 'boolean': return value diff --git a/yarn.lock b/yarn.lock index eaa27ffe57..75e2568e22 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1827,6 +1827,18 @@ resolved "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz#c57c8afbb4054a3ab8317591a0b7320360b444ae" integrity sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA== +"@eslint-community/eslint-utils@^4.2.0": + version "4.4.1" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz#d1145bf2c20132d6400495d6df4bf59362fd9d56" + integrity sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA== + dependencies: + eslint-visitor-keys "^3.4.3" + +"@eslint-community/regexpp@^4.4.0": + version "4.12.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.12.1.tgz#cfc6cffe39df390a3841cde2abccf92eaa7ae0e0" + integrity sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ== + "@eslint/eslintrc@^0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" @@ -5055,6 +5067,11 @@ "@types/glob" "*" "@types/node" "*" +"@types/semver@^7.3.12": + version "7.5.8" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" + integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== + "@types/send@*": version "0.17.1" resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.1.tgz#ed4932b8a2a805f1fe362a70f4e62d0ac994e301" @@ -5191,31 +5208,22 @@ dependencies: "@types/node" "*" -"@typescript-eslint/eslint-plugin@^4.14.0": - version "4.29.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.29.1.tgz#808d206e2278e809292b5de752a91105da85860b" - integrity sha512-AHqIU+SqZZgBEiWOrtN94ldR3ZUABV5dUG94j8Nms9rQnHFc8fvDOue/58K4CFz6r8OtDDc35Pw9NQPWo0Ayrw== +"@typescript-eslint/eslint-plugin@^5.1.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz#aeef0328d172b9e37d9bab6dbc13b87ed88977db" + integrity sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag== dependencies: - "@typescript-eslint/experimental-utils" "4.29.1" - "@typescript-eslint/scope-manager" "4.29.1" - debug "^4.3.1" - functional-red-black-tree "^1.0.1" - regexpp "^3.1.0" - semver "^7.3.5" + "@eslint-community/regexpp" "^4.4.0" + "@typescript-eslint/scope-manager" "5.62.0" + "@typescript-eslint/type-utils" "5.62.0" + "@typescript-eslint/utils" "5.62.0" + debug "^4.3.4" + graphemer "^1.4.0" + ignore "^5.2.0" + natural-compare-lite "^1.4.0" + semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/experimental-utils@4.29.1": - version "4.29.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.29.1.tgz#0af2b17b0296b60c6b207f11062119fa9c5a8994" - integrity sha512-kl6QG6qpzZthfd2bzPNSJB2YcZpNOrP6r9jueXupcZHnL74WiuSjaft7WSu17J9+ae9zTlk0KJMXPUj0daBxMw== - dependencies: - "@types/json-schema" "^7.0.7" - "@typescript-eslint/scope-manager" "4.29.1" - "@typescript-eslint/types" "4.29.1" - "@typescript-eslint/typescript-estree" "4.29.1" - eslint-scope "^5.1.1" - eslint-utils "^3.0.0" - "@typescript-eslint/experimental-utils@^5.0.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.1.0.tgz#918a1a3d30404cc1f8edcfdf0df200804ef90d31" @@ -5228,23 +5236,15 @@ eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/parser@^4.14.0": - version "4.29.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.29.1.tgz#17dfbb45c9032ffa0fe15881d20fbc2a4bdeb02d" - integrity sha512-3fL5iN20hzX3Q4OkG7QEPFjZV2qsVGiDhEwwh+EkmE/w7oteiOvUNzmpu5eSwGJX/anCryONltJ3WDmAzAoCMg== +"@typescript-eslint/parser@^5.1.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.62.0.tgz#1b63d082d849a2fcae8a569248fbe2ee1b8a56c7" + integrity sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA== dependencies: - "@typescript-eslint/scope-manager" "4.29.1" - "@typescript-eslint/types" "4.29.1" - "@typescript-eslint/typescript-estree" "4.29.1" - debug "^4.3.1" - -"@typescript-eslint/scope-manager@4.29.1": - version "4.29.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.29.1.tgz#f25da25bc6512812efa2ce5ebd36619d68e61358" - integrity sha512-Hzv/uZOa9zrD/W5mftZa54Jd5Fed3tL6b4HeaOpwVSabJK8CJ+2MkDasnX/XK4rqP5ZTWngK1ZDeCi6EnxPQ7A== - dependencies: - "@typescript-eslint/types" "4.29.1" - "@typescript-eslint/visitor-keys" "4.29.1" + "@typescript-eslint/scope-manager" "5.62.0" + "@typescript-eslint/types" "5.62.0" + "@typescript-eslint/typescript-estree" "5.62.0" + debug "^4.3.4" "@typescript-eslint/scope-manager@5.1.0": version "5.1.0" @@ -5254,28 +5254,33 @@ "@typescript-eslint/types" "5.1.0" "@typescript-eslint/visitor-keys" "5.1.0" -"@typescript-eslint/types@4.29.1": - version "4.29.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.29.1.tgz#94cce6cf7cc83451df03339cda99d326be2feaf5" - integrity sha512-Jj2yu78IRfw4nlaLtKjVaGaxh/6FhofmQ/j8v3NXmAiKafbIqtAPnKYrf0sbGjKdj0hS316J8WhnGnErbJ4RCA== +"@typescript-eslint/scope-manager@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz#d9457ccc6a0b8d6b37d0eb252a23022478c5460c" + integrity sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w== + dependencies: + "@typescript-eslint/types" "5.62.0" + "@typescript-eslint/visitor-keys" "5.62.0" + +"@typescript-eslint/type-utils@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz#286f0389c41681376cdad96b309cedd17d70346a" + integrity sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew== + dependencies: + "@typescript-eslint/typescript-estree" "5.62.0" + "@typescript-eslint/utils" "5.62.0" + debug "^4.3.4" + tsutils "^3.21.0" "@typescript-eslint/types@5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.1.0.tgz#a8a75ddfc611660de6be17d3ad950302385607a9" integrity sha512-sEwNINVxcB4ZgC6Fe6rUyMlvsB2jvVdgxjZEjQUQVlaSPMNamDOwO6/TB98kFt4sYYfNhdhTPBEQqNQZjMMswA== -"@typescript-eslint/typescript-estree@4.29.1": - version "4.29.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.29.1.tgz#7b32a25ff8e51f2671ccc6b26cdbee3b1e6c5e7f" - integrity sha512-lIkkrR9E4lwZkzPiRDNq0xdC3f2iVCUjw/7WPJ4S2Sl6C3nRWkeE1YXCQ0+KsiaQRbpY16jNaokdWnm9aUIsfw== - dependencies: - "@typescript-eslint/types" "4.29.1" - "@typescript-eslint/visitor-keys" "4.29.1" - debug "^4.3.1" - globby "^11.0.3" - is-glob "^4.0.1" - semver "^7.3.5" - tsutils "^3.21.0" +"@typescript-eslint/types@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f" + integrity sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ== "@typescript-eslint/typescript-estree@5.1.0": version "5.1.0" @@ -5290,13 +5295,32 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/visitor-keys@4.29.1": - version "4.29.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.29.1.tgz#0615be8b55721f5e854f3ee99f1a714f2d093e5d" - integrity sha512-zLqtjMoXvgdZY/PG6gqA73V8BjqPs4af1v2kiiETBObp+uC6gRYnJLmJHxC0QyUrrHDLJPIWNYxoBV3wbcRlag== +"@typescript-eslint/typescript-estree@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz#7d17794b77fabcac615d6a48fb143330d962eb9b" + integrity sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA== dependencies: - "@typescript-eslint/types" "4.29.1" - eslint-visitor-keys "^2.0.0" + "@typescript-eslint/types" "5.62.0" + "@typescript-eslint/visitor-keys" "5.62.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" + +"@typescript-eslint/utils@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86" + integrity sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@types/json-schema" "^7.0.9" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.62.0" + "@typescript-eslint/types" "5.62.0" + "@typescript-eslint/typescript-estree" "5.62.0" + eslint-scope "^5.1.1" + semver "^7.3.7" "@typescript-eslint/visitor-keys@5.1.0": version "5.1.0" @@ -5306,6 +5330,14 @@ "@typescript-eslint/types" "5.1.0" eslint-visitor-keys "^3.0.0" +"@typescript-eslint/visitor-keys@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz#2174011917ce582875954ffe2f6912d5931e353e" + integrity sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw== + dependencies: + "@typescript-eslint/types" "5.62.0" + eslint-visitor-keys "^3.3.0" + "@typescript/vfs@^1.4.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@typescript/vfs/-/vfs-1.5.0.tgz#ed942922724f9ace8c07c80b006c47e5e3833218" @@ -7628,7 +7660,7 @@ debug@2.6.9, debug@^2.6.9: dependencies: ms "2.0.0" -debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0, debug@^4.3.1, debug@^4.3.2: +debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0, debug@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b" integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw== @@ -8555,6 +8587,11 @@ eslint-visitor-keys@^3.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz#e32e99c6cdc2eb063f204eda5db67bfe58bb4186" integrity sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q== +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== + eslint@^7.25.0: version "7.32.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" @@ -9827,6 +9864,11 @@ grapheme-splitter@^1.0.2: resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + gzip-size@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462" @@ -12861,6 +12903,11 @@ nanospinner@^1.1.0: dependencies: picocolors "^1.0.0" +natural-compare-lite@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4" + integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"