From 2b563ffd5d1c23e5eb3f16089bf0dc293643b708 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 13 Mar 2025 18:49:59 -0300 Subject: [PATCH 1/8] pnpm --- pnpm-lock.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f247fe651b2bf..a12c89353c164 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8563,8 +8563,7 @@ importers: components/nusii_proposals: {} - components/nutrient_document_web_services_api: - specifiers: {} + components/nutrient_document_web_services_api: {} components/nutshell: dependencies: @@ -10777,8 +10776,7 @@ importers: components/runpod: {} - components/runsignup: - specifiers: {} + components/runsignup: {} components/runware: dependencies: @@ -13653,8 +13651,7 @@ importers: specifier: ^1.6.0 version: 1.6.6 - components/wafrow: - specifiers: {} + components/wafrow: {} components/waitless: {} @@ -34204,6 +34201,8 @@ snapshots: '@putout/operator-filesystem': 5.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3)) '@putout/operator-json': 2.2.0 putout: 36.13.1(eslint@8.57.1)(typescript@5.6.3) + transitivePeerDependencies: + - supports-color '@putout/operator-regexp@1.0.0(putout@36.13.1(eslint@8.57.1)(typescript@5.6.3))': dependencies: From 286225b22a78cdd47a202336ec32036aac8d2b82 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 13 Mar 2025 18:56:05 -0300 Subject: [PATCH 2/8] CalendarHero app/package --- components/calendarhero/.gitignore | 3 --- .../calendarhero/app/calendarhero.app.ts | 13 ------------ components/calendarhero/calendarhero.app.mjs | 21 +++++++++++++++++++ components/calendarhero/package.json | 10 ++++----- 4 files changed, 26 insertions(+), 21 deletions(-) delete mode 100644 components/calendarhero/.gitignore delete mode 100644 components/calendarhero/app/calendarhero.app.ts create mode 100644 components/calendarhero/calendarhero.app.mjs diff --git a/components/calendarhero/.gitignore b/components/calendarhero/.gitignore deleted file mode 100644 index ec761ccab7595..0000000000000 --- a/components/calendarhero/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.js -*.mjs -dist \ No newline at end of file diff --git a/components/calendarhero/app/calendarhero.app.ts b/components/calendarhero/app/calendarhero.app.ts deleted file mode 100644 index cb8324d949b42..0000000000000 --- a/components/calendarhero/app/calendarhero.app.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineApp } from "@pipedream/types"; - -export default defineApp({ - type: "app", - app: "calendarhero", - propDefinitions: {}, - methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); - }, - }, -}); diff --git a/components/calendarhero/calendarhero.app.mjs b/components/calendarhero/calendarhero.app.mjs new file mode 100644 index 0000000000000..85f22ed68d85b --- /dev/null +++ b/components/calendarhero/calendarhero.app.mjs @@ -0,0 +1,21 @@ +import { axios } from "@pipedream/platform"; + +export default { + type: "app", + app: "calendarhero", + propDefinitions: {}, + methods: { + async _makeRequest({ + $ = this, headers, ...args + } = {}) { + return axios($, { + baseURL: "https://api.calendarhero.com", + headers: { + ...headers, + Authorization: `${this.calendarhero.api_key}`, + }, + ...args, + }); + }, + }, +}; diff --git a/components/calendarhero/package.json b/components/calendarhero/package.json index 095518b53d39b..4cfb5bc9fb1d2 100644 --- a/components/calendarhero/package.json +++ b/components/calendarhero/package.json @@ -1,18 +1,18 @@ { "name": "@pipedream/calendarhero", - "version": "0.0.3", + "version": "0.1.0", "description": "Pipedream CalendarHero Components", - "main": "dist/app/calendarhero.app.mjs", + "main": "calendarhero.app.mjs", "keywords": [ "pipedream", "calendarhero" ], - "files": [ - "dist" - ], "homepage": "https://pipedream.com/apps/calendarhero", "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } } From e4c4bab231d18a8439cc694c66d52d3496baa652 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 13 Mar 2025 18:56:54 -0300 Subject: [PATCH 3/8] pnpm --- pnpm-lock.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a12c89353c164..a37cad3ea33e2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1930,7 +1930,11 @@ importers: specifier: ^1.3.3 version: 1.3.3 - components/calendarhero: {} + components/calendarhero: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 components/calendly_v2: dependencies: From 88c841295d793886ef8154d6e44559168e676651 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 13 Mar 2025 19:07:21 -0300 Subject: [PATCH 4/8] Adding 'List Meetings' action --- .../actions/list-meetings/list-meetings.mjs | 36 +++++++++++++++++++ components/calendarhero/calendarhero.app.mjs | 8 ++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 components/calendarhero/actions/list-meetings/list-meetings.mjs diff --git a/components/calendarhero/actions/list-meetings/list-meetings.mjs b/components/calendarhero/actions/list-meetings/list-meetings.mjs new file mode 100644 index 0000000000000..345faee5a1ccd --- /dev/null +++ b/components/calendarhero/actions/list-meetings/list-meetings.mjs @@ -0,0 +1,36 @@ +import app from "../../calendarhero.app.mjs"; + +export default { + key: "calendarhero-list-meetings", + name: "List Meetings", + description: "Get the user's meetings within a timeframe. [See the documentation](https://api.calendarhero.com/documentation#/meeting/getMeeting).", + version: "0.0.1", + type: "action", + props: { + app, + start: { + type: "string", + label: "Start Date/Time", + description: "Initial date/time of the period to list events, in ISO 8601 format, e.g. `2025-03-10T09:00:00Z`", + }, + end: { + type: "string", + label: "End Date/Time", + description: "End date/time of the period to list events, in ISO 8601 format, e.g. `2025-03-14T18:00:00Z`", + }, + }, + async run({ $ }) { + const { + app, ...params + } = this; + const response = await app.listMeetings({ + $, + params, + }); + const { length } = response; + $.export("$summary", `Successfully listed ${length} meeting${length === 1 + ? "" + : "s"}`); + return response; + }, +}; diff --git a/components/calendarhero/calendarhero.app.mjs b/components/calendarhero/calendarhero.app.mjs index 85f22ed68d85b..b60e4c25586ea 100644 --- a/components/calendarhero/calendarhero.app.mjs +++ b/components/calendarhero/calendarhero.app.mjs @@ -12,10 +12,16 @@ export default { baseURL: "https://api.calendarhero.com", headers: { ...headers, - Authorization: `${this.calendarhero.api_key}`, + Authorization: `${this.$auth.api_key}`, }, ...args, }); }, + listMeetings(args) { + return this._makeRequest({ + url: "/meeting", + ...args, + }); + }, }, }; From 8efadb0800c499b52249275ef8c9a1047e57c48b Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 13 Mar 2025 19:15:28 -0300 Subject: [PATCH 5/8] Adding 'List Meeting Types' action --- .../list-meeting-types/list-meeting-types.mjs | 22 +++++++++++++++++++ components/calendarhero/calendarhero.app.mjs | 6 +++++ 2 files changed, 28 insertions(+) create mode 100644 components/calendarhero/actions/list-meeting-types/list-meeting-types.mjs diff --git a/components/calendarhero/actions/list-meeting-types/list-meeting-types.mjs b/components/calendarhero/actions/list-meeting-types/list-meeting-types.mjs new file mode 100644 index 0000000000000..d6e6b2c643ad5 --- /dev/null +++ b/components/calendarhero/actions/list-meeting-types/list-meeting-types.mjs @@ -0,0 +1,22 @@ +import app from "../../calendarhero.app.mjs"; + +export default { + key: "calendarhero-list-meeting-types", + name: "List Meeting Types", + description: "Get the user's meeting types. [See the documentation](https://api.calendarhero.com/documentation#/user/getUserMeeting).", + version: "0.0.1", + type: "action", + props: { + app, + }, + async run({ $ }) { + const response = await this.app.listMeetingTypes({ + $, + }); + const { length } = Object.keys(response ?? {}); + $.export("$summary", `Successfully listed ${length} meeting type${length === 1 + ? "" + : "s"}`); + return response; + }, +}; diff --git a/components/calendarhero/calendarhero.app.mjs b/components/calendarhero/calendarhero.app.mjs index b60e4c25586ea..5facba3ad3fca 100644 --- a/components/calendarhero/calendarhero.app.mjs +++ b/components/calendarhero/calendarhero.app.mjs @@ -23,5 +23,11 @@ export default { ...args, }); }, + listMeetingTypes(args) { + return this._makeRequest({ + url: "/user/meeting", + ...args, + }); + }, }, }; From 13eaccc3655aa5f56938e707dc2264d2d1ea9b83 Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Thu, 13 Mar 2025 19:41:25 -0300 Subject: [PATCH 6/8] Adding 'new event' webhook source --- components/calendarhero/calendarhero.app.mjs | 15 +++++ components/calendarhero/common/constants.mjs | 34 +++++++++++ .../new-event-instant/new-event-instant.mjs | 60 +++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 components/calendarhero/common/constants.mjs create mode 100644 components/calendarhero/sources/new-event-instant/new-event-instant.mjs diff --git a/components/calendarhero/calendarhero.app.mjs b/components/calendarhero/calendarhero.app.mjs index 5facba3ad3fca..34b325ed500d3 100644 --- a/components/calendarhero/calendarhero.app.mjs +++ b/components/calendarhero/calendarhero.app.mjs @@ -29,5 +29,20 @@ export default { ...args, }); }, + createWebhook({ + event, ...args + }) { + return this._makeRequest({ + method: "post", + url: `webhook/${event}`, + ...args, + }); + }, + deleteWebhook(event) { + return this._makeRequest({ + method: "delete", + url: `webhook/${event}`, + }); + }, }, }; diff --git a/components/calendarhero/common/constants.mjs b/components/calendarhero/common/constants.mjs new file mode 100644 index 0000000000000..0e1cfb5aaa550 --- /dev/null +++ b/components/calendarhero/common/constants.mjs @@ -0,0 +1,34 @@ +export const WEBHOOK_EVENT_TYPE_OPTIONS = [ + { + label: "New Meeting Request", + value: "new_meeting_request", + }, + { + label: "Meeting Request Succeeded", + value: "meeting_request_success", + }, + { + label: "Meeting Request Expired", + value: "meeting_request_expired", + }, + { + label: "Meeting Request Cancelled", + value: "meeting_request_cancelled", + }, + { + label: "Meeting Rescheduled", + value: "meeting_rescheduled", + }, + { + label: "Meeting Started", + value: "meeting_started", + }, + { + label: "Meeting Completed", + value: "meeting_completed", + }, + { + label: "New Contact Added", + value: "new_contact_added", + }, +]; diff --git a/components/calendarhero/sources/new-event-instant/new-event-instant.mjs b/components/calendarhero/sources/new-event-instant/new-event-instant.mjs new file mode 100644 index 0000000000000..9fa3e27fd88ca --- /dev/null +++ b/components/calendarhero/sources/new-event-instant/new-event-instant.mjs @@ -0,0 +1,60 @@ +import app from "../../calendarhero.app.mjs"; +import { WEBHOOK_EVENT_TYPE_OPTIONS } from "../../common/constants.mjs"; + +export default { + key: "calendarhero-new-event-instant", + name: "New Event (Instant)", + description: + "Emit new event when a selected type of CalendarHero event occurs. [See the documentation](https://api.calendarhero.com/documentation#/webhook/postWebhookEvent)", + type: "source", + version: "0.0.{{ts}}", + dedupe: "unique", + props: { + app, + http: "$.interface.http", + event: { + type: "string", + label: "Event Type", + description: "Select the type of event that will trigger this source", + options: WEBHOOK_EVENT_TYPE_OPTIONS, + }, + }, + hooks: { + async activate() { + const { + app, + event, + http: { endpoint: hookUrl }, + } = this; + await app.createWebhook({ + event, + data: { + hookUrl, + }, + }); + }, + async deactivate() { + const { + app, + event, + http: { endpoint: hookUrl }, + } = this; + await app.deleteWebhook({ + event, + data: { + hookUrl, + }, + }); + }, + }, + async run(event) { + const { body } = event; + const ts = Date.now(); + this.$emit(body, { + id: ts, + summary: "New event", + ts, + }); + }, + // sampleEmit, +}; From 701bd16c30dce8356cab5ff6afc5b7d6a16b213a Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Fri, 14 Mar 2025 02:27:09 -0300 Subject: [PATCH 7/8] Small adjustments --- .../sources/new-event-instant/new-event-instant.mjs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/components/calendarhero/sources/new-event-instant/new-event-instant.mjs b/components/calendarhero/sources/new-event-instant/new-event-instant.mjs index 9fa3e27fd88ca..6ef157603c442 100644 --- a/components/calendarhero/sources/new-event-instant/new-event-instant.mjs +++ b/components/calendarhero/sources/new-event-instant/new-event-instant.mjs @@ -7,7 +7,7 @@ export default { description: "Emit new event when a selected type of CalendarHero event occurs. [See the documentation](https://api.calendarhero.com/documentation#/webhook/postWebhookEvent)", type: "source", - version: "0.0.{{ts}}", + version: "0.0.1", dedupe: "unique", props: { app, @@ -47,14 +47,15 @@ export default { }); }, }, - async run(event) { - const { body } = event; + async run({ body }) { const ts = Date.now(); + const id = body.id ?? ts; this.$emit(body, { - id: ts, - summary: "New event", + id, + summary: `New event${id + ? ` (ID ${id})` + : ""}`, ts, }); }, - // sampleEmit, }; From a3745b1071d5f92fed2aa2d0cd60b2355f551c1f Mon Sep 17 00:00:00 2001 From: GTFalcao Date: Fri, 14 Mar 2025 03:03:43 -0300 Subject: [PATCH 8/8] adjustment --- components/calendarhero/calendarhero.app.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/calendarhero/calendarhero.app.mjs b/components/calendarhero/calendarhero.app.mjs index 34b325ed500d3..7da9fd166443a 100644 --- a/components/calendarhero/calendarhero.app.mjs +++ b/components/calendarhero/calendarhero.app.mjs @@ -38,10 +38,13 @@ export default { ...args, }); }, - deleteWebhook(event) { + deleteWebhook({ + event, ...args + }) { return this._makeRequest({ method: "delete", url: `webhook/${event}`, + ...args, }); }, },