From 74041969731edb7b00e8f1d99a14facbd85fc39c Mon Sep 17 00:00:00 2001 From: Lucas Caresia Date: Mon, 7 Jul 2025 16:59:31 -0300 Subject: [PATCH 1/3] Added actions --- .../actions/get-clients/get-clients.mjs | 56 ++++++++ .../actions/insert-note/insert-note.mjs | 93 +++++++++++++ components/momentum_ams/momentum_ams.app.mjs | 126 +++++++++++++++++- components/momentum_ams/package.json | 7 +- pnpm-lock.yaml | 18 +-- 5 files changed, 283 insertions(+), 17 deletions(-) create mode 100644 components/momentum_ams/actions/get-clients/get-clients.mjs create mode 100644 components/momentum_ams/actions/insert-note/insert-note.mjs diff --git a/components/momentum_ams/actions/get-clients/get-clients.mjs b/components/momentum_ams/actions/get-clients/get-clients.mjs new file mode 100644 index 0000000000000..d003d4fc08236 --- /dev/null +++ b/components/momentum_ams/actions/get-clients/get-clients.mjs @@ -0,0 +1,56 @@ +import app from "../../momentum_ams.app.mjs"; + +export default { + key: "momentum_ams-get-clients", + name: "Get Clients", + description: "Get a list of the clients. [See the documentation](https://docs.google.com/document/d/11Xk7TviRujq806pLK8pQTcdzDF2ClmPvkfnVmdh1bGc/edit?tab=t.0)", + version: "0.0.1", + type: "action", + props: { + app, + count: { + propDefinition: [ + app, + "count", + ], + }, + orderby: { + propDefinition: [ + app, + "orderby", + ], + }, + skip: { + propDefinition: [ + app, + "skip", + ], + }, + top: { + propDefinition: [ + app, + "top", + ], + }, + id: { + propDefinition: [ + app, + "id", + (c) => ({ + count: c.count, + orderby: c.orderby, + skip: c.skip, + top: c.top, + }), + ], + }, + }, + async run({ $ }) { + const response = await this.app.getClient({ + $, + id: this.id, + }); + $.export("$summary", "Successfully retrieved the client with ID: " + this.id); + return response; + }, +}; diff --git a/components/momentum_ams/actions/insert-note/insert-note.mjs b/components/momentum_ams/actions/insert-note/insert-note.mjs new file mode 100644 index 0000000000000..8a76930acbe04 --- /dev/null +++ b/components/momentum_ams/actions/insert-note/insert-note.mjs @@ -0,0 +1,93 @@ +import app from "../../momentum_ams.app.mjs"; + +export default { + key: "momentum_ams-insert-note", + name: "Insert Note", + description: "Description for insert-note. [See the documentation](https://docs.google.com/document/d/11Xk7TviRujq806pLK8pQTcdzDF2ClmPvkfnVmdh1bGc/edit?tab=t.0)", + version: "0.0.1", + type: "action", + props: { + app, + count: { + propDefinition: [ + app, + "count", + ], + }, + orderby: { + propDefinition: [ + app, + "orderby", + ], + }, + skip: { + propDefinition: [ + app, + "skip", + ], + }, + top: { + propDefinition: [ + app, + "top", + ], + }, + id: { + propDefinition: [ + app, + "id", + (c) => ({ + count: c.count, + orderby: c.orderby, + skip: c.skip, + top: c.top, + }), + ], + }, + subject: { + propDefinition: [ + app, + "subject", + ], + }, + creatorName: { + propDefinition: [ + app, + "creatorName", + ], + }, + type: { + propDefinition: [ + app, + "type", + ], + }, + isStickyNote: { + propDefinition: [ + app, + "isStickyNote", + ], + }, + hide: { + propDefinition: [ + app, + "hide", + ], + }, + }, + async run({ $ }) { + const response = await this.app.insertNote({ + $, + data: { + insured_database_id: this.insuredDatabaseId, + subject: this.subject, + creator_name: this.creatorName, + type: this.type, + is_sticky_note: this.isStickyNote, + hide: this.hide, + }, + }); + $.export("$summary", "Successfully inserted note with subject: " + this.subject); + return response; + }, +}; diff --git a/components/momentum_ams/momentum_ams.app.mjs b/components/momentum_ams/momentum_ams.app.mjs index a9a13189e1115..6eb8265ad378c 100644 --- a/components/momentum_ams/momentum_ams.app.mjs +++ b/components/momentum_ams/momentum_ams.app.mjs @@ -1,11 +1,129 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "momentum_ams", - propDefinitions: {}, + propDefinitions: { + subject: { + type: "string", + label: "Subject", + description: "The subject or title for the note", + }, + creatorName: { + type: "string", + label: "Creator Name", + description: "The name of the user creating the note", + optional: true, + }, + type: { + type: "string", + label: "Type", + description: "A category to classify the note", + optional: true, + }, + isStickyNote: { + type: "boolean", + label: "Is Sticky Note", + description: "Set to true to make this note a sticky note for higher visibility", + optional: true, + }, + hide: { + type: "boolean", + label: "Hide", + description: "Set to true to archive or hide the note from the default view", + optional: true, + }, + id: { + type: "string", + label: "Client ID", + description: "The ID of the client", + async options({ + count, orderby, skip, top, + }) { + const response = await this.getClients({ + count, + orderby, + skip, + top, + }); + const ids = response.value; + return ids.map(({ + id, commercialName, + }) => ({ + value: id, + label: commercialName, + })); + }, + }, + count: { + type: "boolean", + label: "Count", + description: "Returns the total number of records that exist in nowcerts database", + }, + orderby: { + type: "string", + label: "Order By", + description: "The parameter used to sort the results, e.g.: `firstName`, `changeDate`)", + }, + skip: { + type: "integer", + label: "Skip", + description: "The number of records to skip for pagination purposes", + }, + top: { + type: "integer", + label: "Top", + description: "The maximum number of records to retrieve for pagination purposes", + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.nowcerts.com/api"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, + path, + headers, + ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + url: this._baseUrl() + path, + headers: { + Authorization: `Bearer ${this.$auth.oauth_access_token}`, + ...headers, + }, + }); + }, + + async insertNote(args = {}) { + return this._makeRequest({ + path: "/InsertNote", + ...args, + }); + }, + async getClient({ + id, ...args + }) { + return this._makeRequest({ + path: `/InsuredList(${id})`, + ...args, + }); + }, + async getClients({ + count, orderby, skip, top, ...args + }) { + return this._makeRequest({ + path: "/InsuredDetailList", + params: { + "$count": count, + "$orderby": orderby, + "$skip": skip, + "$top": top, + }, + ...args, + }); }, }, }; diff --git a/components/momentum_ams/package.json b/components/momentum_ams/package.json index 5a68fe61fd9ad..e647c48637a19 100644 --- a/components/momentum_ams/package.json +++ b/components/momentum_ams/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/momentum_ams", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Momentum AMS Components", "main": "momentum_ams.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.1.0" } -} \ No newline at end of file +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e1b833f216ee4..771b84b0553b5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8538,7 +8538,11 @@ importers: components/mollie: {} - components/momentum_ams: {} + components/momentum_ams: + dependencies: + '@pipedream/platform': + specifier: ^3.1.0 + version: 3.1.0 components/monday: dependencies: @@ -15832,14 +15836,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': @@ -36156,7 +36152,7 @@ snapshots: '@pipedream/ramp@0.1.2': dependencies: - '@pipedream/platform': 3.0.3 + '@pipedream/platform': 3.1.0 uuid: 10.0.0 transitivePeerDependencies: - debug @@ -36200,7 +36196,7 @@ snapshots: '@pipedream/shopify@0.7.0': dependencies: - '@pipedream/platform': 3.0.3 + '@pipedream/platform': 3.1.0 async-retry: 1.3.3 bottleneck: 2.19.5 form-data: 4.0.2 From b6a2c8ef49515491935d7ac2fa384533d4e566d0 Mon Sep 17 00:00:00 2001 From: Lucas Caresia Date: Tue, 15 Jul 2025 11:07:02 -0300 Subject: [PATCH 2/3] Added actions --- .../actions/get-client/get-client.mjs | 26 ++++++++++ .../actions/insert-note/insert-note.mjs | 34 +------------ components/momentum_ams/momentum_ams.app.mjs | 51 +++++-------------- 3 files changed, 40 insertions(+), 71 deletions(-) create mode 100644 components/momentum_ams/actions/get-client/get-client.mjs diff --git a/components/momentum_ams/actions/get-client/get-client.mjs b/components/momentum_ams/actions/get-client/get-client.mjs new file mode 100644 index 0000000000000..0440eae8a20c5 --- /dev/null +++ b/components/momentum_ams/actions/get-client/get-client.mjs @@ -0,0 +1,26 @@ +import app from "../../momentum_ams.app.mjs"; + +export default { + key: "momentum_ams-get-client", + name: "Get Client", + description: "Get data for the client with the specified ID. [See the documentation](https://support.momentumamp.com/nowcerts-rest-api-search-insureds)", + version: "0.0.1", + type: "action", + props: { + app, + id: { + propDefinition: [ + app, + "id", + ], + }, + }, + async run({ $ }) { + const response = await this.app.getClient({ + $, + id: this.id, + }); + $.export("$summary", "Successfully retrieved the client with ID: " + this.id); + return response; + }, +}; diff --git a/components/momentum_ams/actions/insert-note/insert-note.mjs b/components/momentum_ams/actions/insert-note/insert-note.mjs index 8a76930acbe04..e6a85ce21d598 100644 --- a/components/momentum_ams/actions/insert-note/insert-note.mjs +++ b/components/momentum_ams/actions/insert-note/insert-note.mjs @@ -3,45 +3,15 @@ import app from "../../momentum_ams.app.mjs"; export default { key: "momentum_ams-insert-note", name: "Insert Note", - description: "Description for insert-note. [See the documentation](https://docs.google.com/document/d/11Xk7TviRujq806pLK8pQTcdzDF2ClmPvkfnVmdh1bGc/edit?tab=t.0)", + description: "Insert note . [See the documentation](https://docs.google.com/document/d/11Xk7TviRujq806pLK8pQTcdzDF2ClmPvkfnVmdh1bGc/edit?tab=t.0)", version: "0.0.1", type: "action", props: { app, - count: { - propDefinition: [ - app, - "count", - ], - }, - orderby: { - propDefinition: [ - app, - "orderby", - ], - }, - skip: { - propDefinition: [ - app, - "skip", - ], - }, - top: { - propDefinition: [ - app, - "top", - ], - }, id: { propDefinition: [ app, "id", - (c) => ({ - count: c.count, - orderby: c.orderby, - skip: c.skip, - top: c.top, - }), ], }, subject: { @@ -79,7 +49,7 @@ export default { const response = await this.app.insertNote({ $, data: { - insured_database_id: this.insuredDatabaseId, + insured_database_id: this.id, subject: this.subject, creator_name: this.creatorName, type: this.type, diff --git a/components/momentum_ams/momentum_ams.app.mjs b/components/momentum_ams/momentum_ams.app.mjs index 6eb8265ad378c..b507cd44cc013 100644 --- a/components/momentum_ams/momentum_ams.app.mjs +++ b/components/momentum_ams/momentum_ams.app.mjs @@ -37,17 +37,15 @@ export default { type: "string", label: "Client ID", description: "The ID of the client", - async options({ - count, orderby, skip, top, - }) { + async options({ page }) { const response = await this.getClients({ - count, - orderby, - skip, - top, + params: { + "$top": 10, + "$skip": page * 10, + "$orderby": "id", + }, }); - const ids = response.value; - return ids.map(({ + return response.value.map(({ id, commercialName, }) => ({ value: id, @@ -55,26 +53,6 @@ export default { })); }, }, - count: { - type: "boolean", - label: "Count", - description: "Returns the total number of records that exist in nowcerts database", - }, - orderby: { - type: "string", - label: "Order By", - description: "The parameter used to sort the results, e.g.: `firstName`, `changeDate`)", - }, - skip: { - type: "integer", - label: "Skip", - description: "The number of records to skip for pagination purposes", - }, - top: { - type: "integer", - label: "Top", - description: "The maximum number of records to retrieve for pagination purposes", - }, }, methods: { _baseUrl() { @@ -99,10 +77,12 @@ export default { async insertNote(args = {}) { return this._makeRequest({ - path: "/InsertNote", + path: "/Zapier/InsertNote", + method: "post", ...args, }); }, + async getClient({ id, ...args }) { @@ -111,17 +91,10 @@ export default { ...args, }); }, - async getClients({ - count, orderby, skip, top, ...args - }) { + + async getClients(args = {}) { return this._makeRequest({ path: "/InsuredDetailList", - params: { - "$count": count, - "$orderby": orderby, - "$skip": skip, - "$top": top, - }, ...args, }); }, From 405fa12f7f9537df9eb3c473c986737e588cceb9 Mon Sep 17 00:00:00 2001 From: Lucas Caresia Date: Tue, 15 Jul 2025 15:28:01 -0300 Subject: [PATCH 3/3] Added actions --- .../actions/get-clients/get-clients.mjs | 56 ------------------- pnpm-lock.yaml | 15 ++--- 2 files changed, 5 insertions(+), 66 deletions(-) delete mode 100644 components/momentum_ams/actions/get-clients/get-clients.mjs diff --git a/components/momentum_ams/actions/get-clients/get-clients.mjs b/components/momentum_ams/actions/get-clients/get-clients.mjs deleted file mode 100644 index d003d4fc08236..0000000000000 --- a/components/momentum_ams/actions/get-clients/get-clients.mjs +++ /dev/null @@ -1,56 +0,0 @@ -import app from "../../momentum_ams.app.mjs"; - -export default { - key: "momentum_ams-get-clients", - name: "Get Clients", - description: "Get a list of the clients. [See the documentation](https://docs.google.com/document/d/11Xk7TviRujq806pLK8pQTcdzDF2ClmPvkfnVmdh1bGc/edit?tab=t.0)", - version: "0.0.1", - type: "action", - props: { - app, - count: { - propDefinition: [ - app, - "count", - ], - }, - orderby: { - propDefinition: [ - app, - "orderby", - ], - }, - skip: { - propDefinition: [ - app, - "skip", - ], - }, - top: { - propDefinition: [ - app, - "top", - ], - }, - id: { - propDefinition: [ - app, - "id", - (c) => ({ - count: c.count, - orderby: c.orderby, - skip: c.skip, - top: c.top, - }), - ], - }, - }, - async run({ $ }) { - const response = await this.app.getClient({ - $, - id: this.id, - }); - $.export("$summary", "Successfully retrieved the client with ID: " + this.id); - return response; - }, -}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab04a54bd3e7e..ac86f49759fa4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1872,8 +1872,7 @@ importers: specifier: ^3.0.0 version: 3.0.3 - components/bright_data: - specifiers: {} + components/bright_data: {} components/brilliant_directories: dependencies: @@ -2646,14 +2645,11 @@ importers: specifier: ^1.0.1 version: 1.0.1 - components/clio_australia: - specifiers: {} + components/clio_australia: {} - components/clio_canada: - specifiers: {} + components/clio_canada: {} - components/clio_eu: - specifiers: {} + components/clio_eu: {} components/clockify: dependencies: @@ -11474,8 +11470,7 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/rhombus: - specifiers: {} + components/rhombus: {} components/richpanel: dependencies: