From 22d987df7ac665ad9009d847ee75b8dd2dc5fc70 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 12 Sep 2024 12:30:05 -0400 Subject: [PATCH 1/5] nioleads init --- .../actions/find-email/find-email.mjs | 30 +++++ .../actions/verify-email/verify-email.mjs | 23 ++++ components/nioleads/nioleads.app.mjs | 104 +++++++++++++++++- components/nioleads/package.json | 2 +- .../new-contact-watch/new-contact-watch.mjs | 66 +++++++++++ .../sources/new-contact/new-contact.mjs | 91 +++++++++++++++ 6 files changed, 310 insertions(+), 6 deletions(-) create mode 100644 components/nioleads/actions/find-email/find-email.mjs create mode 100644 components/nioleads/actions/verify-email/verify-email.mjs create mode 100644 components/nioleads/sources/new-contact-watch/new-contact-watch.mjs create mode 100644 components/nioleads/sources/new-contact/new-contact.mjs diff --git a/components/nioleads/actions/find-email/find-email.mjs b/components/nioleads/actions/find-email/find-email.mjs new file mode 100644 index 0000000000000..6b4e0fe796610 --- /dev/null +++ b/components/nioleads/actions/find-email/find-email.mjs @@ -0,0 +1,30 @@ +import nioleads from "../../nioleads.app.mjs"; +import { axios } from "@pipedream/platform"; + +export default { + key: "nioleads-find-email", + name: "Find Email", + description: "Finds a business email address using a full name and a website domain.", + version: "0.0.{{ts}}", + type: "action", + props: { + nioleads, + fullName: { + propDefinition: [ + nioleads, + "fullName", + ], + }, + websiteDomain: { + propDefinition: [ + nioleads, + "websiteDomain", + ], + }, + }, + async run({ $ }) { + const response = await this.nioleads.findEmail(this.fullName, this.websiteDomain); + $.export("$summary", `Found email: ${response.email}`); + return response; + }, +}; diff --git a/components/nioleads/actions/verify-email/verify-email.mjs b/components/nioleads/actions/verify-email/verify-email.mjs new file mode 100644 index 0000000000000..b23ed384c8b54 --- /dev/null +++ b/components/nioleads/actions/verify-email/verify-email.mjs @@ -0,0 +1,23 @@ +import nioleads from "../../nioleads.app.mjs"; + +export default { + key: "nioleads-verify-email", + name: "Verify Email", + description: "Checks the deliverability of a specified email address. [See the documentation](https://apidoc.nioleads.com)", + version: "0.0.{{ts}}", + type: "action", + props: { + nioleads, + email: { + propDefinition: [ + nioleads, + "email", + ], + }, + }, + async run({ $ }) { + const response = await this.nioleads.verifyEmail(this.email); + $.export("$summary", `Verified email ${this.email}`); + return response; + }, +}; diff --git a/components/nioleads/nioleads.app.mjs b/components/nioleads/nioleads.app.mjs index 3f728a760cd4a..90ddf3f0aa8b7 100644 --- a/components/nioleads/nioleads.app.mjs +++ b/components/nioleads/nioleads.app.mjs @@ -1,11 +1,105 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "nioleads", - propDefinitions: {}, + propDefinitions: { + email: { + type: "string", + label: "Email", + description: "The email address of the contact", + }, + firstName: { + type: "string", + label: "First Name", + description: "The first name of the contact", + optional: true, + }, + lastName: { + type: "string", + label: "Last Name", + description: "The last name of the contact", + optional: true, + }, + fullName: { + type: "string", + label: "Full Name", + description: "The full name of the person", + }, + websiteDomain: { + type: "string", + label: "Website Domain", + description: "The domain of the website", + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.nioleads.com/v1/openapi"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, + method = "GET", + path, + data, + headers, + ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + method, + url: this._baseUrl() + path, + data, + headers: { + ...headers, + "Authorization": `Bearer ${this.$auth.oauth_access_token}`, + "Content-Type": "application/json", + "Accept": "application/json", + }, + }); + }, + async verifyEmail(email) { + return this._makeRequest({ + method: "POST", + path: "/verify_email", + data: { + email, + }, + }); + }, + async findEmail(fullName, websiteDomain) { + return this._makeRequest({ + method: "POST", + path: "/find_email", + data: { + name: fullName, + domain: websiteDomain, + }, + }); + }, + async emitNewContactData(email, firstName, lastName) { + return this.$emit( + { + email, + firstName, + lastName, + }, + { + summary: `New contact data found for ${email}`, + }, + ); + }, + async emitNewWatchedContact(email, firstName, lastName) { + return this.$emit( + { + email, + firstName, + lastName, + }, + { + summary: `New contact is watched for ${email}`, + }, + ); }, }, -}; \ No newline at end of file +}; diff --git a/components/nioleads/package.json b/components/nioleads/package.json index 3cb6f8a968aaf..e88c293cc83e5 100644 --- a/components/nioleads/package.json +++ b/components/nioleads/package.json @@ -12,4 +12,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/components/nioleads/sources/new-contact-watch/new-contact-watch.mjs b/components/nioleads/sources/new-contact-watch/new-contact-watch.mjs new file mode 100644 index 0000000000000..72aae21ed9a53 --- /dev/null +++ b/components/nioleads/sources/new-contact-watch/new-contact-watch.mjs @@ -0,0 +1,66 @@ +import nioleads from "../../nioleads.app.mjs"; + +export default { + type: "source", + key: "nioleads-new-contact-watch", + name: "New Contact Watch", + description: "Emit new event when a new contact is watched.", + version: "0.0.1", + dedupe: "unique", + props: { + nioleads, + db: "$.service.db", + timer: { + type: "$.interface.timer", + default: { + intervalSeconds: 60 * 15, // 15 minutes + }, + }, + email: { + propDefinition: [ + nioleads, + "email", + ], + }, + firstName: { + propDefinition: [ + nioleads, + "firstName", + ], + optional: true, + }, + lastName: { + propDefinition: [ + nioleads, + "lastName", + ], + optional: true, + }, + }, + hooks: { + async deploy() { + const email = this.email; + const firstName = this.firstName; + const lastName = this.lastName; + await this.nioleads.emitNewWatchedContact(email, firstName, lastName); + }, + }, + async run() { + const lastRunTime = this.db.get("lastRunTime") || this.timer.timestamp; + const currentTime = +new Date(); + const email = await this.nioleads.verifyEmail(this.email); + if (email && email.verified) { + const contactData = { + email: this.email, + firstName: this.firstName, + lastName: this.lastName, + }; + this.$emit(contactData, { + id: this.email, + summary: `New contact is watched for ${this.email}`, + ts: currentTime, + }); + } + this.db.set("lastRunTime", currentTime); + }, +}; diff --git a/components/nioleads/sources/new-contact/new-contact.mjs b/components/nioleads/sources/new-contact/new-contact.mjs new file mode 100644 index 0000000000000..0bfa5f5b40d04 --- /dev/null +++ b/components/nioleads/sources/new-contact/new-contact.mjs @@ -0,0 +1,91 @@ +import nioleads from "../../nioleads.app.mjs"; +import { axios } from "@pipedream/platform"; + +export default { + key: "nioleads-new-contact", + name: "New Contact", + description: "Emits a new event when a new contact data is found.", + version: "0.0.{{ts}}", + type: "source", + dedupe: "unique", + props: { + nioleads, + db: "$.service.db", + timer: { + type: "$.interface.timer", + default: { + intervalSeconds: 60 * 15, // 15 minutes + }, + }, + email: { + propDefinition: [ + nioleads, + "email", + ], + }, + firstName: { + propDefinition: [ + nioleads, + "firstName", + ], + optional: true, + }, + lastName: { + propDefinition: [ + nioleads, + "lastName", + ], + optional: true, + }, + }, + methods: { + _getPreviousEmail() { + return this.db.get("previousEmail") || null; + }, + _setPreviousEmail(email) { + this.db.set("previousEmail", email); + }, + }, + hooks: { + async deploy() { + // Emit the current email as an event on deploy + const email = this._getPreviousEmail(); + if (email) { + const { + firstName, lastName, + } = await this.nioleads.verifyEmail(email); + this.$emit( + { + email, + firstName, + lastName, + }, + { + summary: `Found contact data for ${email}`, + }, + ); + } + }, + }, + async run() { + const email = this.email; + const previousEmail = this._getPreviousEmail(); + + if (email !== previousEmail) { + const { + firstName, lastName, + } = await this.nioleads.verifyEmail(email); + this.$emit( + { + email, + firstName, + lastName, + }, + { + summary: `New contact data found for ${email}`, + }, + ); + this._setPreviousEmail(email); + } + }, +}; From 47fcad954f572b7a8b043ade8d65658ca886d4a4 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 12 Sep 2024 13:42:39 -0400 Subject: [PATCH 2/5] new components --- .../actions/find-email/find-email.mjs | 35 ++++--- .../actions/verify-email/verify-email.mjs | 18 ++-- components/nioleads/nioleads.app.mjs | 83 +++-------------- components/nioleads/package.json | 5 +- .../new-contact-added/new-contact-added.mjs | 63 +++++++++++++ .../sources/new-contact-added/test-event.mjs | 20 ++++ .../new-contact-watch/new-contact-watch.mjs | 66 -------------- .../sources/new-contact/new-contact.mjs | 91 ------------------- 8 files changed, 132 insertions(+), 249 deletions(-) create mode 100644 components/nioleads/sources/new-contact-added/new-contact-added.mjs create mode 100644 components/nioleads/sources/new-contact-added/test-event.mjs delete mode 100644 components/nioleads/sources/new-contact-watch/new-contact-watch.mjs delete mode 100644 components/nioleads/sources/new-contact/new-contact.mjs diff --git a/components/nioleads/actions/find-email/find-email.mjs b/components/nioleads/actions/find-email/find-email.mjs index 6b4e0fe796610..ba526887643d6 100644 --- a/components/nioleads/actions/find-email/find-email.mjs +++ b/components/nioleads/actions/find-email/find-email.mjs @@ -1,30 +1,35 @@ import nioleads from "../../nioleads.app.mjs"; -import { axios } from "@pipedream/platform"; export default { key: "nioleads-find-email", name: "Find Email", - description: "Finds a business email address using a full name and a website domain.", - version: "0.0.{{ts}}", + description: "Finds a business email address using a full name and a website domain. [See the documentation](https://apidoc.nioleads.com/?_gl=1*1288vdg*_ga*MTY1NzE1MjMzOC4xNzI1OTM5Njk1*_ga_ZVT2YHDDZG*MTcyNTk0Mzk5NC4yLjAuMTcyNTk0NDAyMy4wLjAuMA..#email-finder)", + version: "0.0.1", type: "action", props: { nioleads, - fullName: { - propDefinition: [ - nioleads, - "fullName", - ], + name: { + type: "string", + label: "Name", + description: "Full name of the person", }, - websiteDomain: { - propDefinition: [ - nioleads, - "websiteDomain", - ], + domain: { + type: "string", + label: "Domain", + description: "The company domain name. (e.g. `example.com`)", }, }, async run({ $ }) { - const response = await this.nioleads.findEmail(this.fullName, this.websiteDomain); - $.export("$summary", `Found email: ${response.email}`); + const response = await this.nioleads.findEmail({ + $, + data: { + name: this.name, + domain: this.domain, + }, + }); + if (response?.email) { + $.export("$summary", `Found email: ${response.email}`); + } return response; }, }; diff --git a/components/nioleads/actions/verify-email/verify-email.mjs b/components/nioleads/actions/verify-email/verify-email.mjs index b23ed384c8b54..01a1b0f5650b0 100644 --- a/components/nioleads/actions/verify-email/verify-email.mjs +++ b/components/nioleads/actions/verify-email/verify-email.mjs @@ -3,20 +3,24 @@ import nioleads from "../../nioleads.app.mjs"; export default { key: "nioleads-verify-email", name: "Verify Email", - description: "Checks the deliverability of a specified email address. [See the documentation](https://apidoc.nioleads.com)", - version: "0.0.{{ts}}", + description: "Checks the deliverability of a specified email address. [See the documentation](https://apidoc.nioleads.com/?_gl=1*1288vdg*_ga*MTY1NzE1MjMzOC4xNzI1OTM5Njk1*_ga_ZVT2YHDDZG*MTcyNTk0Mzk5NC4yLjAuMTcyNTk0NDAyMy4wLjAuMA..#email-verifier)", + version: "0.0.1", type: "action", props: { nioleads, email: { - propDefinition: [ - nioleads, - "email", - ], + type: "string", + label: "Email", + description: "The email address to verify", }, }, async run({ $ }) { - const response = await this.nioleads.verifyEmail(this.email); + const response = await this.nioleads.verifyEmail({ + $, + data: { + email: this.email, + }, + }); $.export("$summary", `Verified email ${this.email}`); return response; }, diff --git a/components/nioleads/nioleads.app.mjs b/components/nioleads/nioleads.app.mjs index 90ddf3f0aa8b7..85f79dac10593 100644 --- a/components/nioleads/nioleads.app.mjs +++ b/components/nioleads/nioleads.app.mjs @@ -3,103 +3,48 @@ import { axios } from "@pipedream/platform"; export default { type: "app", app: "nioleads", - propDefinitions: { - email: { - type: "string", - label: "Email", - description: "The email address of the contact", - }, - firstName: { - type: "string", - label: "First Name", - description: "The first name of the contact", - optional: true, - }, - lastName: { - type: "string", - label: "Last Name", - description: "The last name of the contact", - optional: true, - }, - fullName: { - type: "string", - label: "Full Name", - description: "The full name of the person", - }, - websiteDomain: { - type: "string", - label: "Website Domain", - description: "The domain of the website", - }, - }, + propDefinitions: {}, methods: { _baseUrl() { return "https://api.nioleads.com/v1/openapi"; }, - async _makeRequest(opts = {}) { + _makeRequest(opts = {}) { const { $ = this, - method = "GET", path, - data, headers, ...otherOpts } = opts; return axios($, { ...otherOpts, - method, - url: this._baseUrl() + path, - data, + url: `${this._baseUrl()}${path}`, headers: { ...headers, - "Authorization": `Bearer ${this.$auth.oauth_access_token}`, + "Authorization": `Bearer ${this.$auth.api_key}`, "Content-Type": "application/json", "Accept": "application/json", }, }); }, - async verifyEmail(email) { + listContacts(opts = {}) { + return this._makeRequest({ + path: "/new_contacts", + ...opts, + }); + }, + verifyEmail(opts = {}) { return this._makeRequest({ method: "POST", path: "/verify_email", - data: { - email, - }, + ...opts, }); }, - async findEmail(fullName, websiteDomain) { + findEmail(opts = {}) { return this._makeRequest({ method: "POST", path: "/find_email", - data: { - name: fullName, - domain: websiteDomain, - }, + ...opts, }); }, - async emitNewContactData(email, firstName, lastName) { - return this.$emit( - { - email, - firstName, - lastName, - }, - { - summary: `New contact data found for ${email}`, - }, - ); - }, - async emitNewWatchedContact(email, firstName, lastName) { - return this.$emit( - { - email, - firstName, - lastName, - }, - { - summary: `New contact is watched for ${email}`, - }, - ); - }, }, }; diff --git a/components/nioleads/package.json b/components/nioleads/package.json index e88c293cc83e5..6478ec2d01c2b 100644 --- a/components/nioleads/package.json +++ b/components/nioleads/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/nioleads", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream NioLeads Components", "main": "nioleads.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.1" } } diff --git a/components/nioleads/sources/new-contact-added/new-contact-added.mjs b/components/nioleads/sources/new-contact-added/new-contact-added.mjs new file mode 100644 index 0000000000000..28fd3ba8114a0 --- /dev/null +++ b/components/nioleads/sources/new-contact-added/new-contact-added.mjs @@ -0,0 +1,63 @@ +import nioleads from "../../nioleads.app.mjs"; +import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; +import sampleEmit from "./test-event.mjs"; + +export default { + key: "nioleads-new-contact-added", + name: "New Contact Added", + description: "Emit new event when a new contact is added. [See the documentation](https://apidoc.nioleads.com/?_gl=1*1288vdg*_ga*MTY1NzE1MjMzOC4xNzI1OTM5Njk1*_ga_ZVT2YHDDZG*MTcyNTk0Mzk5NC4yLjAuMTcyNTk0NDAyMy4wLjAuMA..#contacts)", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + nioleads, + db: "$.service.db", + timer: { + type: "$.interface.timer", + default: { + intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, + }, + }, + }, + hooks: { + async deploy() { + await this.processEvent(25); + }, + }, + methods: { + _getLastId() { + return this.db.get("lastId") || 0; + }, + _setLastId(lastId) { + this.db.set("lastId", lastId); + }, + generateMeta(contact) { + return { + id: contact.id, + summary: `New Contact: ${contact.name}`, + ts: Date.now(), + }; + }, + async processEvent(limit) { + const lastId = this._getLastId(); + const contacts = await this.nioleads.listContacts(); + if (!contacts?.length) { + return; + } + const newContacts = contacts.filter(({ id }) => id > lastId); + if (limit && newContacts.length > limit) { + newContacts.length = limit; + } + this._setLastId(newContacts[0].id); + newContacts.reverse().forEach((contact) => { + const meta = this.generateMeta(contact); + this.$emit(contact, meta); + }); + + }, + }, + async run() { + await this.processEvent(); + }, + sampleEmit, +}; diff --git a/components/nioleads/sources/new-contact-added/test-event.mjs b/components/nioleads/sources/new-contact-added/test-event.mjs new file mode 100644 index 0000000000000..be75f936ad620 --- /dev/null +++ b/components/nioleads/sources/new-contact-added/test-event.mjs @@ -0,0 +1,20 @@ +export default { + "id": 1, + "name": "Tom ********", + "company": "All We Have Is Now", + "domain": "allwehaveisnow.co", + "job_title": "Keynote Speaker", + "email": "********@allwehaveisnow.co", + "linkedin_url": "http://www.linkedin.com/in/tomfgoodwin", + "first_name": "Tom", + "last_name": "********", + "city": "New York", + "region": "New York", + "country": "United States", + "industry": "management consulting", + "company_city": "New York", + "company_region": "New York", + "company_country": "United States", + "company_linkedin_url": "http://www.linkedin.com/company/all-we-have-is-now", + "list": "Default list" +} \ No newline at end of file diff --git a/components/nioleads/sources/new-contact-watch/new-contact-watch.mjs b/components/nioleads/sources/new-contact-watch/new-contact-watch.mjs deleted file mode 100644 index 72aae21ed9a53..0000000000000 --- a/components/nioleads/sources/new-contact-watch/new-contact-watch.mjs +++ /dev/null @@ -1,66 +0,0 @@ -import nioleads from "../../nioleads.app.mjs"; - -export default { - type: "source", - key: "nioleads-new-contact-watch", - name: "New Contact Watch", - description: "Emit new event when a new contact is watched.", - version: "0.0.1", - dedupe: "unique", - props: { - nioleads, - db: "$.service.db", - timer: { - type: "$.interface.timer", - default: { - intervalSeconds: 60 * 15, // 15 minutes - }, - }, - email: { - propDefinition: [ - nioleads, - "email", - ], - }, - firstName: { - propDefinition: [ - nioleads, - "firstName", - ], - optional: true, - }, - lastName: { - propDefinition: [ - nioleads, - "lastName", - ], - optional: true, - }, - }, - hooks: { - async deploy() { - const email = this.email; - const firstName = this.firstName; - const lastName = this.lastName; - await this.nioleads.emitNewWatchedContact(email, firstName, lastName); - }, - }, - async run() { - const lastRunTime = this.db.get("lastRunTime") || this.timer.timestamp; - const currentTime = +new Date(); - const email = await this.nioleads.verifyEmail(this.email); - if (email && email.verified) { - const contactData = { - email: this.email, - firstName: this.firstName, - lastName: this.lastName, - }; - this.$emit(contactData, { - id: this.email, - summary: `New contact is watched for ${this.email}`, - ts: currentTime, - }); - } - this.db.set("lastRunTime", currentTime); - }, -}; diff --git a/components/nioleads/sources/new-contact/new-contact.mjs b/components/nioleads/sources/new-contact/new-contact.mjs deleted file mode 100644 index 0bfa5f5b40d04..0000000000000 --- a/components/nioleads/sources/new-contact/new-contact.mjs +++ /dev/null @@ -1,91 +0,0 @@ -import nioleads from "../../nioleads.app.mjs"; -import { axios } from "@pipedream/platform"; - -export default { - key: "nioleads-new-contact", - name: "New Contact", - description: "Emits a new event when a new contact data is found.", - version: "0.0.{{ts}}", - type: "source", - dedupe: "unique", - props: { - nioleads, - db: "$.service.db", - timer: { - type: "$.interface.timer", - default: { - intervalSeconds: 60 * 15, // 15 minutes - }, - }, - email: { - propDefinition: [ - nioleads, - "email", - ], - }, - firstName: { - propDefinition: [ - nioleads, - "firstName", - ], - optional: true, - }, - lastName: { - propDefinition: [ - nioleads, - "lastName", - ], - optional: true, - }, - }, - methods: { - _getPreviousEmail() { - return this.db.get("previousEmail") || null; - }, - _setPreviousEmail(email) { - this.db.set("previousEmail", email); - }, - }, - hooks: { - async deploy() { - // Emit the current email as an event on deploy - const email = this._getPreviousEmail(); - if (email) { - const { - firstName, lastName, - } = await this.nioleads.verifyEmail(email); - this.$emit( - { - email, - firstName, - lastName, - }, - { - summary: `Found contact data for ${email}`, - }, - ); - } - }, - }, - async run() { - const email = this.email; - const previousEmail = this._getPreviousEmail(); - - if (email !== previousEmail) { - const { - firstName, lastName, - } = await this.nioleads.verifyEmail(email); - this.$emit( - { - email, - firstName, - lastName, - }, - { - summary: `New contact data found for ${email}`, - }, - ); - this._setPreviousEmail(email); - } - }, -}; From 3121e428b9079230a798ae31443d79709ba7fee9 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Thu, 12 Sep 2024 13:43:44 -0400 Subject: [PATCH 3/5] pnpm-lock.yaml --- pnpm-lock.yaml | 107 +++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 52 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c60247f5bfb99..1d2b39da77029 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6331,7 +6331,10 @@ importers: '@pipedream/platform': 1.5.1 components/nioleads: - specifiers: {} + specifiers: + '@pipedream/platform': ^3.0.1 + dependencies: + '@pipedream/platform': 3.0.1 components/nocodb: specifiers: @@ -12662,6 +12665,55 @@ packages: - aws-crt dev: false + /@aws-sdk/client-sso-oidc/3.600.0_tdq3komn4zwyd65w7klbptsu34: + resolution: {integrity: sha512-7+I8RWURGfzvChyNQSyj5/tKrqRbzRl7H+BnTOf/4Vsw1nFOi5ROhlhD4X/Y0QCTacxnaoNcIrqnY7uGGvVRzw==} + engines: {node: '>=16.0.0'} + dependencies: + '@aws-crypto/sha256-browser': 5.2.0 + '@aws-crypto/sha256-js': 5.2.0 + '@aws-sdk/client-sts': 3.600.0 + '@aws-sdk/core': 3.598.0 + '@aws-sdk/credential-provider-node': 3.600.0_f7n47caigsrjd2lr2szmwfuee4 + '@aws-sdk/middleware-host-header': 3.598.0 + '@aws-sdk/middleware-logger': 3.598.0 + '@aws-sdk/middleware-recursion-detection': 3.598.0 + '@aws-sdk/middleware-user-agent': 3.598.0 + '@aws-sdk/region-config-resolver': 3.598.0 + '@aws-sdk/types': 3.598.0 + '@aws-sdk/util-endpoints': 3.598.0 + '@aws-sdk/util-user-agent-browser': 3.598.0 + '@aws-sdk/util-user-agent-node': 3.598.0 + '@smithy/config-resolver': 3.0.3 + '@smithy/core': 2.2.3 + '@smithy/fetch-http-handler': 3.2.1 + '@smithy/hash-node': 3.0.2 + '@smithy/invalid-dependency': 3.0.2 + '@smithy/middleware-content-length': 3.0.2 + '@smithy/middleware-endpoint': 3.0.4 + '@smithy/middleware-retry': 3.0.6 + '@smithy/middleware-serde': 3.0.3 + '@smithy/middleware-stack': 3.0.3 + '@smithy/node-config-provider': 3.1.3 + '@smithy/node-http-handler': 3.1.2 + '@smithy/protocol-http': 4.0.3 + '@smithy/smithy-client': 3.1.6 + '@smithy/types': 3.3.0 + '@smithy/url-parser': 3.0.3 + '@smithy/util-base64': 3.0.0 + '@smithy/util-body-length-browser': 3.0.0 + '@smithy/util-body-length-node': 3.0.0 + '@smithy/util-defaults-mode-browser': 3.0.6 + '@smithy/util-defaults-mode-node': 3.0.6 + '@smithy/util-endpoints': 2.0.3 + '@smithy/util-middleware': 3.0.3 + '@smithy/util-retry': 3.0.2 + '@smithy/util-utf8': 3.0.0 + tslib: 2.6.3 + transitivePeerDependencies: + - '@aws-sdk/client-sts' + - aws-crt + dev: false + /@aws-sdk/client-sso/3.423.0: resolution: {integrity: sha512-znIufHkwhCIePgaYciIs3x/+BpzR57CZzbCKHR9+oOvGyufEPPpUT5bFLvbwTgfiVkTjuk6sG/ES3U5Bc+xtrA==} engines: {node: '>=14.0.0'} @@ -12897,7 +12949,7 @@ packages: dependencies: '@aws-crypto/sha256-browser': 5.2.0 '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/client-sso-oidc': 3.600.0 + '@aws-sdk/client-sso-oidc': 3.600.0_tdq3komn4zwyd65w7klbptsu34 '@aws-sdk/core': 3.598.0 '@aws-sdk/credential-provider-node': 3.600.0_f7n47caigsrjd2lr2szmwfuee4 '@aws-sdk/middleware-host-header': 3.598.0 @@ -12939,55 +12991,6 @@ packages: - aws-crt dev: false - /@aws-sdk/client-sts/3.600.0_dseaa2p5u2yk67qiepewcq3hkq: - resolution: {integrity: sha512-KQG97B7LvTtTiGmjlrG1LRAY8wUvCQzrmZVV5bjrJ/1oXAU7DITYwVbSJeX9NWg6hDuSk0VE3MFwIXS2SvfLIA==} - engines: {node: '>=16.0.0'} - dependencies: - '@aws-crypto/sha256-browser': 5.2.0 - '@aws-crypto/sha256-js': 5.2.0 - '@aws-sdk/client-sso-oidc': 3.600.0 - '@aws-sdk/core': 3.598.0 - '@aws-sdk/credential-provider-node': 3.600.0_f7n47caigsrjd2lr2szmwfuee4 - '@aws-sdk/middleware-host-header': 3.598.0 - '@aws-sdk/middleware-logger': 3.598.0 - '@aws-sdk/middleware-recursion-detection': 3.598.0 - '@aws-sdk/middleware-user-agent': 3.598.0 - '@aws-sdk/region-config-resolver': 3.598.0 - '@aws-sdk/types': 3.598.0 - '@aws-sdk/util-endpoints': 3.598.0 - '@aws-sdk/util-user-agent-browser': 3.598.0 - '@aws-sdk/util-user-agent-node': 3.598.0 - '@smithy/config-resolver': 3.0.3 - '@smithy/core': 2.2.3 - '@smithy/fetch-http-handler': 3.2.1 - '@smithy/hash-node': 3.0.2 - '@smithy/invalid-dependency': 3.0.2 - '@smithy/middleware-content-length': 3.0.2 - '@smithy/middleware-endpoint': 3.0.4 - '@smithy/middleware-retry': 3.0.6 - '@smithy/middleware-serde': 3.0.3 - '@smithy/middleware-stack': 3.0.3 - '@smithy/node-config-provider': 3.1.3 - '@smithy/node-http-handler': 3.1.2 - '@smithy/protocol-http': 4.0.3 - '@smithy/smithy-client': 3.1.6 - '@smithy/types': 3.3.0 - '@smithy/url-parser': 3.0.3 - '@smithy/util-base64': 3.0.0 - '@smithy/util-body-length-browser': 3.0.0 - '@smithy/util-body-length-node': 3.0.0 - '@smithy/util-defaults-mode-browser': 3.0.6 - '@smithy/util-defaults-mode-node': 3.0.6 - '@smithy/util-endpoints': 2.0.3 - '@smithy/util-middleware': 3.0.3 - '@smithy/util-retry': 3.0.2 - '@smithy/util-utf8': 3.0.0 - tslib: 2.6.3 - transitivePeerDependencies: - - '@aws-sdk/client-sso-oidc' - - aws-crt - dev: false - /@aws-sdk/core/3.556.0: resolution: {integrity: sha512-vJaSaHw2kPQlo11j/Rzuz0gk1tEaKdz+2ser0f0qZ5vwFlANjt08m/frU17ctnVKC1s58bxpctO/1P894fHLrA==} engines: {node: '>=14.0.0'} @@ -17286,7 +17289,7 @@ packages: '@aws-sdk/client-sns': 3.423.0 '@aws-sdk/client-sqs': 3.423.0 '@aws-sdk/client-ssm': 3.423.0 - '@aws-sdk/client-sts': 3.600.0_dseaa2p5u2yk67qiepewcq3hkq + '@aws-sdk/client-sts': 3.600.0 '@aws-sdk/s3-request-presigner': 3.609.0 '@pipedream/helper_functions': 0.3.12 '@pipedream/platform': 1.6.6 From 51b0dba72f3e576eb7085bd18b47e15545e0a615 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Tue, 17 Sep 2024 11:39:24 -0400 Subject: [PATCH 4/5] error handling --- components/nioleads/actions/find-email/find-email.mjs | 5 +++-- components/nioleads/actions/verify-email/verify-email.mjs | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/nioleads/actions/find-email/find-email.mjs b/components/nioleads/actions/find-email/find-email.mjs index ba526887643d6..ca3bb6b2e3a0d 100644 --- a/components/nioleads/actions/find-email/find-email.mjs +++ b/components/nioleads/actions/find-email/find-email.mjs @@ -27,9 +27,10 @@ export default { domain: this.domain, }, }); - if (response?.email) { - $.export("$summary", `Found email: ${response.email}`); + if (response?.code) { + throw new Error(`${response.msg}`); } + $.export("$summary", `Found email: ${response.email}`); return response; }, }; diff --git a/components/nioleads/actions/verify-email/verify-email.mjs b/components/nioleads/actions/verify-email/verify-email.mjs index 01a1b0f5650b0..fe8e7d95991fc 100644 --- a/components/nioleads/actions/verify-email/verify-email.mjs +++ b/components/nioleads/actions/verify-email/verify-email.mjs @@ -21,6 +21,9 @@ export default { email: this.email, }, }); + if (response?.code) { + throw new Error(`${response.msg}`); + } $.export("$summary", `Verified email ${this.email}`); return response; }, From 2a681c412ffe6f8c4965e4bdcbb11828f92e3529 Mon Sep 17 00:00:00 2001 From: michelle0927 Date: Wed, 18 Sep 2024 13:19:35 -0400 Subject: [PATCH 5/5] minor updates --- components/nioleads/nioleads.app.mjs | 2 -- .../nioleads/sources/new-contact-added/new-contact-added.mjs | 1 - 2 files changed, 3 deletions(-) diff --git a/components/nioleads/nioleads.app.mjs b/components/nioleads/nioleads.app.mjs index 85f79dac10593..1cb59c5a80826 100644 --- a/components/nioleads/nioleads.app.mjs +++ b/components/nioleads/nioleads.app.mjs @@ -12,14 +12,12 @@ export default { const { $ = this, path, - headers, ...otherOpts } = opts; return axios($, { ...otherOpts, url: `${this._baseUrl()}${path}`, headers: { - ...headers, "Authorization": `Bearer ${this.$auth.api_key}`, "Content-Type": "application/json", "Accept": "application/json", diff --git a/components/nioleads/sources/new-contact-added/new-contact-added.mjs b/components/nioleads/sources/new-contact-added/new-contact-added.mjs index 28fd3ba8114a0..d28de5f58d550 100644 --- a/components/nioleads/sources/new-contact-added/new-contact-added.mjs +++ b/components/nioleads/sources/new-contact-added/new-contact-added.mjs @@ -53,7 +53,6 @@ export default { const meta = this.generateMeta(contact); this.$emit(contact, meta); }); - }, }, async run() {