diff --git a/components/highergov/highergov.app.mjs b/components/highergov/highergov.app.mjs index 48582999a9bfa..c79c7ff168aa2 100644 --- a/components/highergov/highergov.app.mjs +++ b/components/highergov/highergov.app.mjs @@ -1,11 +1,41 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "highergov", - propDefinitions: {}, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://www.highergov.com/zapier"; + }, + _headers() { + return { + "Content-Type": "application/json", + "Accept": "application/json", + "X-API-KEY": this.$auth.api_key, + }; + }, + _makeRequest({ + $ = this, path, ...opts + }) { + return axios($, { + url: this._baseUrl() + path, + headers: this._headers(), + ...opts, + }); + }, + subscribeWebhook(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/pipeline/subscribe/", + ...opts, + }); + }, + unsubscribeWebhook(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/pipeline/unsubscribe/", + ...opts, + }); }, }, -}; \ No newline at end of file +}; diff --git a/components/highergov/package.json b/components/highergov/package.json index fd07c5831ab44..4ab0fa38e5339 100644 --- a/components/highergov/package.json +++ b/components/highergov/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/highergov", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream HigherGov Components", "main": "highergov.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.1" } -} \ No newline at end of file +} diff --git a/components/highergov/sources/new-pursuit-added-instant/new-pursuit-added-instant.mjs b/components/highergov/sources/new-pursuit-added-instant/new-pursuit-added-instant.mjs new file mode 100644 index 0000000000000..e4fd077cdfe72 --- /dev/null +++ b/components/highergov/sources/new-pursuit-added-instant/new-pursuit-added-instant.mjs @@ -0,0 +1,39 @@ +import highergov from "../../highergov.app.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + key: "highergov-new-pursuit-added-instant", + name: "New Pursuit Added (Instant)", + description: "Emit new event when a pursuit is added to the pipeline.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + highergov, + http: { + type: "$.interface.http", + customResponse: true, + }, + db: "$.service.db", + }, + hooks: { + async activate() { + await this.highergov.subscribeWebhook({ + data: { + target_url: this.http.endpoint, + }, + }); + }, + async deactivate() { + await this.highergov.unsubscribeWebhook(); + }, + }, + async run({ body }) { + this.$emit(body, { + id: body.opp_key, + summary: `New pursuit added: ${body.title}`, + ts: Date.parse(body.current_datetime), + }); + }, + sampleEmit, +}; diff --git a/components/highergov/sources/new-pursuit-added-instant/test-event.mjs b/components/highergov/sources/new-pursuit-added-instant/test-event.mjs new file mode 100644 index 0000000000000..9ea44899fda07 --- /dev/null +++ b/components/highergov/sources/new-pursuit-added-instant/test-event.mjs @@ -0,0 +1,46 @@ +export default { + "title": "string", + "description_text": "string", + "source_id": "string", + "source_id_version": "string", + "captured_date": "string", + "posted_date": "string", + "due_date": "string", + "agency": { + "agency_key": "string", + "agency_name": "string", + "agency_abbreviation": "string", + "agency_type": "string", + "path": "string" + }, + "naics_code": { + "naics_code": "string" + }, + "psc_code": { + "psc_code": "string" + }, + "primary_contact_email": { + "contact_title": "string", + "contact_name": "string", + "contact_first_name": "string", + "contact_last_name": "string", + "contact_email": "string", + "contact_phone": "string" + }, + "secondary_contact_email": { + "contact_title": "string", + "contact_name": "string", + "contact_first_name": "string", + "contact_last_name": "string", + "contact_email": "string", + "contact_phone": "string" + }, + "set_aside": "string", + "opp_key": "string", + "version_key": "string", + "source_type": "string", + "unweighted_value": "string", + "current_datetime": "string", + "user_email": "string", + "path": "string" +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 256498568ef5f..af787c081519b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4438,7 +4438,10 @@ importers: '@pipedream/platform': 3.0.0 components/highergov: - specifiers: {} + specifiers: + '@pipedream/platform': ^3.0.1 + dependencies: + '@pipedream/platform': 3.0.3 components/highlevel_oauth: specifiers: @@ -12794,6 +12797,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'} @@ -13029,7 +13081,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 @@ -13071,55 +13123,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'} @@ -17446,7 +17449,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 @@ -17624,8 +17627,8 @@ packages: - debug dev: false - /@pipedream/platform/3.0.3: - resolution: {integrity: sha512-7elalas41lnT8i6EAFkqB7fT/+hkLGEQ1njS6A7CVguTrEswaIYk/seKmkfkRY7+O6qncgnXswYIKCBML9Co7w==} + /@pipedream/platform/3.0.2: + resolution: {integrity: sha512-q/BYGJoNXOVaRlNTDWD7Gjgkcu114gbPrxQ5KCOFbuYfqnJu8AeDGMyMvEPaGPbrWUVwgxjvOnxw4EWqce8ZNQ==} dependencies: axios: 1.7.7 fp-ts: 2.16.9 @@ -17635,8 +17638,8 @@ packages: - debug dev: false - /@pipedream/platform/3.0.2: - resolution: {integrity: sha512-q/BYGJoNXOVaRlNTDWD7Gjgkcu114gbPrxQ5KCOFbuYfqnJu8AeDGMyMvEPaGPbrWUVwgxjvOnxw4EWqce8ZNQ==} + /@pipedream/platform/3.0.3: + resolution: {integrity: sha512-7elalas41lnT8i6EAFkqB7fT/+hkLGEQ1njS6A7CVguTrEswaIYk/seKmkfkRY7+O6qncgnXswYIKCBML9Co7w==} dependencies: axios: 1.7.7 fp-ts: 2.16.9 @@ -23298,7 +23301,7 @@ packages: dev: false /concat-map/0.0.1: - resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} /concat-stream/2.0.0: resolution: {integrity: sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==} @@ -35378,7 +35381,7 @@ packages: dev: false /verror/1.10.0: - resolution: {integrity: sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=} + resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==} engines: {'0': node >=0.6.0} dependencies: assert-plus: 1.0.0