From 8abcb0b7a5416d1bd42be3844c81d3fb9e510800 Mon Sep 17 00:00:00 2001 From: Lucas Caresia Date: Wed, 21 May 2025 10:38:11 -0300 Subject: [PATCH 1/6] Added actions --- components/tubular/.gitignore | 3 - .../actions/create-lead/create-lead.mjs | 62 +++++++++++++++++ .../get-deals-by-date/get-deals-by-date.mjs | 41 ++++++++++++ .../tubular/actions/get-leads/get-leads.mjs | 37 +++++++++++ components/tubular/app/tubular.app.ts | 13 ---- components/tubular/tubular.app.mjs | 66 +++++++++++++++++++ pnpm-lock.yaml | 14 ++-- 7 files changed, 211 insertions(+), 25 deletions(-) delete mode 100644 components/tubular/.gitignore create mode 100644 components/tubular/actions/create-lead/create-lead.mjs create mode 100644 components/tubular/actions/get-deals-by-date/get-deals-by-date.mjs create mode 100644 components/tubular/actions/get-leads/get-leads.mjs delete mode 100644 components/tubular/app/tubular.app.ts create mode 100644 components/tubular/tubular.app.mjs diff --git a/components/tubular/.gitignore b/components/tubular/.gitignore deleted file mode 100644 index ec761ccab7595..0000000000000 --- a/components/tubular/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.js -*.mjs -dist \ No newline at end of file diff --git a/components/tubular/actions/create-lead/create-lead.mjs b/components/tubular/actions/create-lead/create-lead.mjs new file mode 100644 index 0000000000000..97d215e1e2f81 --- /dev/null +++ b/components/tubular/actions/create-lead/create-lead.mjs @@ -0,0 +1,62 @@ +import app from "../../tubular.app.mjs"; + +export default { + key: "tubular-create-lead", + name: "Create Lead", + description: "Create lead and return its ID. [See the documentation](https://developer.tubular.io/examples/#create-lead-and-return-its-id)", + version: "0.0.1", + type: "action", + props: { + app, + firstName: { + propDefinition: [ + app, + "firstName", + ], + }, + lastName: { + propDefinition: [ + app, + "lastName", + ], + }, + note: { + propDefinition: [ + app, + "note", + ], + }, + lead: { + propDefinition: [ + app, + "lead", + ], + }, + }, + async run({ $ }) { + const query = ` + mutation { + addContact(input: { + firstName: "${this.firstName}", + lastName: "${this.lastName}", + note: "${this.note}", + lead: ${this.lead} + }) { + contact { + id + } + } + } + `; + + const response = await this.app.createLead({ + $, + data: { + query, + }, + }); + + $.export("$summary", "Successfully created Lead with ID: " + response.data.addContact.contact.id); + return response; + }, +}; diff --git a/components/tubular/actions/get-deals-by-date/get-deals-by-date.mjs b/components/tubular/actions/get-deals-by-date/get-deals-by-date.mjs new file mode 100644 index 0000000000000..ebcb78f8f0aa7 --- /dev/null +++ b/components/tubular/actions/get-deals-by-date/get-deals-by-date.mjs @@ -0,0 +1,41 @@ +import app from "../../tubular.app.mjs"; + +export default { + key: "tubular-get-deals-by-date", + name: "Get Deals By Date", + description: "Get deals ordered by date of creation. [See the documentation](https://developer.tubular.io/examples/#get-deals-ordered-by-date-of-creation)", + version: "0.0.1", + type: "action", + props: { + app, + }, + async run({ $ }) { + const query = `{ + viewer{ + pipelines(first:100){ + edges{ + node{ + deals(orderBy:CREATED_AT, direction: DESC){ + edges{ + node{ + id + name + currency + } + } + } + } + } + } + } + }`; + const response = await this.app.getDealsByDate({ + $, + data: { + query, + }, + }); + $.export("$summary", "Successfully fetched Deals"); + return response; + }, +}; diff --git a/components/tubular/actions/get-leads/get-leads.mjs b/components/tubular/actions/get-leads/get-leads.mjs new file mode 100644 index 0000000000000..57b027c0e5df7 --- /dev/null +++ b/components/tubular/actions/get-leads/get-leads.mjs @@ -0,0 +1,37 @@ +import app from "../../tubular.app.mjs"; + +export default { + key: "tubular-get-leads", + name: "Get Leads", + description: "Get leads ordered by date of creation. [See the documentation](https://developer.tubular.io/examples/#get-first-10-leads)", + version: "0.0.1", + type: "action", + props: { + app, + + }, + async run({ $ }) { + const query = `{ + viewer{ + leads(first: 100){ + edges{ + node{ + id + fullName + email + lead + } + } + } + } + }`; + const response = await this.app.getLeads({ + $, + data: { + query, + }, + }); + $.export("$summary", "Successfully fetched Leads"); + return response; + }, +}; diff --git a/components/tubular/app/tubular.app.ts b/components/tubular/app/tubular.app.ts deleted file mode 100644 index 392856a14ac57..0000000000000 --- a/components/tubular/app/tubular.app.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineApp } from "@pipedream/types"; - -export default defineApp({ - type: "app", - app: "tubular", - propDefinitions: {}, - methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); - }, - }, -}); \ No newline at end of file diff --git a/components/tubular/tubular.app.mjs b/components/tubular/tubular.app.mjs new file mode 100644 index 0000000000000..7b68e2c55de76 --- /dev/null +++ b/components/tubular/tubular.app.mjs @@ -0,0 +1,66 @@ +import { axios } from "@pipedream/platform"; + +export default { + type: "app", + app: "tubular", + propDefinitions: { + firstName: { + type: "string", + label: "First Name", + description: "The contact's first name", + }, + lastName: { + type: "string", + label: "Last Name", + description: "The contact's last name", + }, + note: { + type: "string", + label: "Note", + description: "A note about the contact", + }, + lead: { + type: "boolean", + label: "Lead", + description: "Indicates whether the contact is a lead", + }, + }, + methods: { + _baseUrl() { + return "https://api.tubular.io/graphql"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, + headers, + ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + url: this._baseUrl(), + headers: { + "Authorization": `${this.$auth.api_token}`, + ...headers, + }, + }); + }, + async createLead(args = {}) { + return this._makeRequest({ + method: "POST", + ...args, + }); + }, + async getDealsByDate(args = {}) { + return this._makeRequest({ + method: "POST", + ...args, + }); + }, + async getLeads(args = {}) { + return this._makeRequest({ + method: "POST", + ...args, + }); + }, + }, +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1fa7a92823dd6..8fe405d957faa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1224,7 +1224,11 @@ importers: components/aylien_news_api: {} - components/ayrshare: {} + components/ayrshare: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 components/azure_ai_vision: dependencies: @@ -15440,14 +15444,6 @@ importers: specifier: ^6.0.0 version: 6.2.0 - modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/cjs: {} - - modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/esm: {} - - modelcontextprotocol/node_modules2/zod-to-json-schema/dist/cjs: {} - - modelcontextprotocol/node_modules2/zod-to-json-schema/dist/esm: {} - packages/ai: dependencies: '@pipedream/sdk': From aea41da19884c302a8475047b871f633f1ea621e Mon Sep 17 00:00:00 2001 From: Lucas Caresia Date: Wed, 21 May 2025 10:52:34 -0300 Subject: [PATCH 2/6] Added actions --- components/tubular/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/tubular/package.json b/components/tubular/package.json index a5e6e753b4996..c6427bc7f02d2 100644 --- a/components/tubular/package.json +++ b/components/tubular/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/tubular", - "version": "0.0.2", + "version": "0.1.0", "description": "Pipedream Tubular Components", "main": "dist/app/tubular.app.mjs", "keywords": [ From 6d53435fe082ff6b30c2ffcc2198e66488021e26 Mon Sep 17 00:00:00 2001 From: Lucas Caresia Date: Wed, 21 May 2025 10:56:29 -0300 Subject: [PATCH 3/6] Added actions --- components/tubular/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/tubular/package.json b/components/tubular/package.json index c6427bc7f02d2..32fb72cf7c1e8 100644 --- a/components/tubular/package.json +++ b/components/tubular/package.json @@ -2,12 +2,11 @@ "name": "@pipedream/tubular", "version": "0.1.0", "description": "Pipedream Tubular Components", - "main": "dist/app/tubular.app.mjs", + "main": "app/tubular.app.mjs", "keywords": [ "pipedream", "tubular" ], - "files": ["dist"], "homepage": "https://pipedream.com/apps/tubular", "author": "Pipedream (https://pipedream.com/)", "publishConfig": { From d6aca0f76e389f628d5be7c876e1ed8c64410873 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 21 May 2025 11:18:11 -0400 Subject: [PATCH 4/6] updates --- .../tubular/actions/create-lead/create-lead.mjs | 2 +- .../get-deals-by-date/get-deals-by-date.mjs | 2 +- components/tubular/actions/get-leads/get-leads.mjs | 3 +-- components/tubular/package.json | 3 +++ components/tubular/tubular.app.mjs | 14 +------------- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/components/tubular/actions/create-lead/create-lead.mjs b/components/tubular/actions/create-lead/create-lead.mjs index 97d215e1e2f81..d83c9eaf236f2 100644 --- a/components/tubular/actions/create-lead/create-lead.mjs +++ b/components/tubular/actions/create-lead/create-lead.mjs @@ -49,7 +49,7 @@ export default { } `; - const response = await this.app.createLead({ + const response = await this.app.post({ $, data: { query, diff --git a/components/tubular/actions/get-deals-by-date/get-deals-by-date.mjs b/components/tubular/actions/get-deals-by-date/get-deals-by-date.mjs index ebcb78f8f0aa7..54f7f7ad523ea 100644 --- a/components/tubular/actions/get-deals-by-date/get-deals-by-date.mjs +++ b/components/tubular/actions/get-deals-by-date/get-deals-by-date.mjs @@ -29,7 +29,7 @@ export default { } } }`; - const response = await this.app.getDealsByDate({ + const response = await this.app.post({ $, data: { query, diff --git a/components/tubular/actions/get-leads/get-leads.mjs b/components/tubular/actions/get-leads/get-leads.mjs index 57b027c0e5df7..eeb44608e9424 100644 --- a/components/tubular/actions/get-leads/get-leads.mjs +++ b/components/tubular/actions/get-leads/get-leads.mjs @@ -8,7 +8,6 @@ export default { type: "action", props: { app, - }, async run({ $ }) { const query = `{ @@ -25,7 +24,7 @@ export default { } } }`; - const response = await this.app.getLeads({ + const response = await this.app.post({ $, data: { query, diff --git a/components/tubular/package.json b/components/tubular/package.json index 32fb72cf7c1e8..8487af737fc9c 100644 --- a/components/tubular/package.json +++ b/components/tubular/package.json @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } } diff --git a/components/tubular/tubular.app.mjs b/components/tubular/tubular.app.mjs index 7b68e2c55de76..07be3d92f9b10 100644 --- a/components/tubular/tubular.app.mjs +++ b/components/tubular/tubular.app.mjs @@ -44,19 +44,7 @@ export default { }, }); }, - async createLead(args = {}) { - return this._makeRequest({ - method: "POST", - ...args, - }); - }, - async getDealsByDate(args = {}) { - return this._makeRequest({ - method: "POST", - ...args, - }); - }, - async getLeads(args = {}) { + async post(args = {}) { return this._makeRequest({ method: "POST", ...args, From 2c7e1a77aeeaaa1f0885db0097c02c0d1cb9199a Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 21 May 2025 11:18:43 -0400 Subject: [PATCH 5/6] pnpm-lock.yaml --- pnpm-lock.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8fe405d957faa..aa743930f5801 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1224,11 +1224,7 @@ importers: components/aylien_news_api: {} - components/ayrshare: - dependencies: - '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + components/ayrshare: {} components/azure_ai_vision: dependencies: @@ -13656,7 +13652,11 @@ importers: components/trustpilot: {} - components/tubular: {} + components/tubular: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 components/tuesday: {} From 2cea9b69dde88fe5e6c679f36b8bbc09e8fcb9c4 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Wed, 21 May 2025 11:21:40 -0400 Subject: [PATCH 6/6] update --- components/tubular/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/tubular/package.json b/components/tubular/package.json index 8487af737fc9c..26d9f5b604cf1 100644 --- a/components/tubular/package.json +++ b/components/tubular/package.json @@ -2,7 +2,7 @@ "name": "@pipedream/tubular", "version": "0.1.0", "description": "Pipedream Tubular Components", - "main": "app/tubular.app.mjs", + "main": "tubular.app.mjs", "keywords": [ "pipedream", "tubular"