diff --git a/.github/workflows/components-pr.yaml b/.github/workflows/components-pr.yaml index 58dfadcb6f4a0..f77d90826dbde 100644 --- a/.github/workflows/components-pr.yaml +++ b/.github/workflows/components-pr.yaml @@ -18,7 +18,7 @@ jobs: pull-requests: write steps: - - uses: actions/checkout@v4.1.6 + - uses: actions/checkout@v4.1.7 name: Checkout repo with: # See https://github.com/actions/checkout#checkout-v2 @@ -48,7 +48,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4.1.6 + uses: actions/checkout@v4.1.7 - uses: pnpm/action-setup@v4.0.0 with: version: 7.33.6 @@ -137,7 +137,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4.1.6 + uses: actions/checkout@v4.1.7 - uses: pnpm/action-setup@v4.0.0 with: version: 7.33.6 diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index ac0a7c969af23..9dfcdd96923de 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.6 + - uses: actions/checkout@v4.1.7 name: Checkout repo with: # See https://github.com/actions/checkout#checkout-v2 diff --git a/.github/workflows/publish-components.yaml b/.github/workflows/publish-components.yaml index 838b158390c3e..e47d661a9978b 100644 --- a/.github/workflows/publish-components.yaml +++ b/.github/workflows/publish-components.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v4.1.6 + uses: actions/checkout@v4.1.7 - uses: pnpm/action-setup@v4.0.0 with: version: 7.33.6 @@ -117,7 +117,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4.1.6 + uses: actions/checkout@v4.1.7 - uses: pnpm/action-setup@v4.0.0 with: version: 7.33.6 diff --git a/.github/workflows/publish-marketplace-content.yaml b/.github/workflows/publish-marketplace-content.yaml index 242cb8eb1c86b..f5ddfe1fee7e6 100644 --- a/.github/workflows/publish-marketplace-content.yaml +++ b/.github/workflows/publish-marketplace-content.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v4.1.6 + uses: actions/checkout@v4.1.7 - uses: pnpm/action-setup@v4.0.0 with: version: 7.33.6 diff --git a/.github/workflows/publish-packages.yaml b/.github/workflows/publish-packages.yaml index f2696bf7b6938..5939061bce8e8 100644 --- a/.github/workflows/publish-packages.yaml +++ b/.github/workflows/publish-packages.yaml @@ -20,7 +20,7 @@ jobs: concurrency: group: ${{ github.workflow }}-${{ github.ref }} steps: - - uses: actions/checkout@v4.1.6 + - uses: actions/checkout@v4.1.7 - uses: pnpm/action-setup@v4.0.0 with: version: 7.33.6 diff --git a/.github/workflows/pull-request-checks.yaml b/.github/workflows/pull-request-checks.yaml index 5c49f683e2ef8..cb86d493958fc 100644 --- a/.github/workflows/pull-request-checks.yaml +++ b/.github/workflows/pull-request-checks.yaml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.6 + - uses: actions/checkout@v4.1.7 name: Checkout - uses: Ana06/get-changed-files@v2.3.0 id: changed_files @@ -35,7 +35,7 @@ jobs: done echo "files=${files}" >> $GITHUB_ENV - - uses: rojopolis/spellcheck-github-actions@0.37.0 + - uses: rojopolis/spellcheck-github-actions@0.38.0 name: Spellcheck if: ${{ env.files }} with: @@ -48,7 +48,7 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v4.1.6 + uses: actions/checkout@v4.1.7 with: # Full git history is needed to get a proper list of changed files # within `super-linter` diff --git a/components/acymailing/actions/add-update-user/add-update-user.mjs b/components/acymailing/actions/add-update-user/add-update-user.mjs new file mode 100644 index 0000000000000..47852f70eb2d9 --- /dev/null +++ b/components/acymailing/actions/add-update-user/add-update-user.mjs @@ -0,0 +1,77 @@ +import acymailing from "../../acymailing.app.mjs"; +import { parseObject } from "../../common/utils.mjs"; + +export default { + key: "acymailing-add-update-user", + name: "Add or Update User", + description: "Creates a new user or updates an existing user in AcyMailing. If the user exists, will update the user's data with provided information. [See the documentation](https://docs.acymailing.com/v/rest-api/users#create-or-update-a-user)", + version: "0.0.1", + type: "action", + props: { + acymailing, + email: { + type: "string", + label: "Email", + description: "The email address is used when updating an existing user.", + }, + name: { + type: "string", + label: "Name", + description: "Any character should be available.", + optional: true, + }, + active: { + type: "boolean", + label: "Active", + description: "Defaults to true.", + optional: true, + }, + confirmed: { + type: "boolean", + label: "Confirmed", + description: "The confirmation is related to the \"Require confirmation\" option in the configuration, tab \"Subscription\".", + optional: true, + }, + cmsId: { + type: "integer", + label: "CMS Id", + description: "The cms_id must match the ID of the corresponding Joomla/WordPress user.", + optional: true, + }, + customFields: { + type: "object", + label: "Custom Fields", + description: "An object of field Ids and values.", + optional: true, + }, + triggers: { + type: "boolean", + label: "Triggers", + description: "Defaults to true. Defines if the saving of the user triggers automated tasks like follow-up campaigns and automations.", + optional: true, + }, + sendConf: { + type: "boolean", + label: "Send Conf", + description: "Defaults to true. Defines if the confirmation email should be sent when a new user is created.", + optional: true, + }, + }, + async run({ $ }) { + const response = await this.acymailing.createUserOrUpdate({ + $, + data: { + email: this.email, + name: this.name, + active: this.active, + confirmed: this.confirmed, + cmsId: this.cmsId, + customFields: parseObject(this.customFields), + triggers: this.triggers, + sendConf: this.sendConf, + }, + }); + $.export("$summary", `Successfully added or updated user with email with Id: ${response.userId}`); + return response; + }, +}; diff --git a/components/acymailing/actions/email-user/email-user.mjs b/components/acymailing/actions/email-user/email-user.mjs new file mode 100644 index 0000000000000..d5bb81c9006ff --- /dev/null +++ b/components/acymailing/actions/email-user/email-user.mjs @@ -0,0 +1,55 @@ +import acymailing from "../../acymailing.app.mjs"; +import { parseObject } from "../../common/utils.mjs"; + +export default { + key: "acymailing-email-user", + name: "Email User", + description: "Sends an email to a single AcyMailing user. The user must exist in the AcyMailing database. [See the documentation](https://docs.acymailing.com/v/rest-api/emails#send-an-email-to-a-user)", + version: "0.0.1", + type: "action", + props: { + acymailing, + email: { + type: "string", + label: "Email", + description: "The email address of the receiver.", + }, + autoAddUser: { + type: "boolean", + label: "Auto Add User", + description: "Defaults to false. If the email address doesn't match an existing AcyMailing user, one will be automatically created if this option is set to true.", + optional: true, + }, + emailId: { + type: "integer", + label: "Email Id", + description: "The mail ID to send. This is not a campaign ID but the mail ID of the table xxx_acym_mail in the database, or the mail_id of a campaign.", + }, + trackEmail: { + type: "boolean", + label: "Track Email", + description: "Defaults to true. If true, the open/click statistics will be collected for this email.", + optional: true, + }, + params: { + type: "object", + label: "Params", + description: "An object of shortcodes and values to replace in the body of the sent email. Example: { \"shortcode1\": \"value 1\" }. If the body of the sent email contains the text \"{shortcode1}\", it will be replaced by \"value 1\" in the sent version.", + optional: true, + }, + }, + async run({ $ }) { + const response = await this.acymailing.sendEmailToUser({ + $, + data: { + email: this.email, + autoAddUser: this.autoAddUser, + emailId: this.emailId, + trackEmail: this.trackEmail, + params: parseObject(this.params), + }, + }); + $.export("$summary", `Email successfully sent to ${this.email}`); + return response; + }, +}; diff --git a/components/acymailing/actions/subscribe-user/subscribe-user.mjs b/components/acymailing/actions/subscribe-user/subscribe-user.mjs new file mode 100644 index 0000000000000..f567a65d246e2 --- /dev/null +++ b/components/acymailing/actions/subscribe-user/subscribe-user.mjs @@ -0,0 +1,51 @@ +import acymailing from "../../acymailing.app.mjs"; +import { parseObject } from "../../common/utils.mjs"; + +export default { + key: "acymailing-subscribe-user", + name: "Subscribe User to Lists", + description: "Subscribes a user to one or more specified lists in AcyMailing. [See the documentation](https://docs.acymailing.com/v/rest-api/subscription#subscribe-users-to-lists)", + version: "0.0.1", + type: "action", + props: { + acymailing, + emails: { + propDefinition: [ + acymailing, + "emails", + ], + }, + listIds: { + propDefinition: [ + acymailing, + "listIds", + ], + }, + sendWelcomeEmail: { + type: "boolean", + label: "Send Welcome Email", + description: "Defaults to true. If true, the welcome emails will be sent if the lists have one.", + optional: true, + }, + trigger: { + type: "boolean", + label: "Trigger", + description: "Defaults to true. If you want to trigger or not the automation or follow-up when subscribing the user.", + optional: true, + }, + }, + async run({ $ }) { + const response = await this.acymailing.subscribeUserToLists({ + $, + data: { + emails: parseObject(this.emails), + listIds: parseObject(this.listIds), + sendWelcomeEmail: this.sendWelcomeEmail, + trigger: this.trigger, + }, + }); + + $.export("$summary", `Successfully subscribed ${this.emails.length} users to lists ${this.listIds.length} lists`); + return response; + }, +}; diff --git a/components/acymailing/acymailing.app.mjs b/components/acymailing/acymailing.app.mjs index 54c39141c9eeb..abd3af914826f 100644 --- a/components/acymailing/acymailing.app.mjs +++ b/components/acymailing/acymailing.app.mjs @@ -1,11 +1,146 @@ +import { axios } from "@pipedream/platform"; +import { LIMIT } from "./common/constants.mjs"; + export default { type: "app", app: "acymailing", - propDefinitions: {}, + propDefinitions: { + listIds: { + type: "integer[]", + label: "List Ids", + description: "Array of list IDs.", + async options({ page }) { + const lists = await this.listLists({ + params: { + limit: LIMIT, + offset: LIMIT * page, + }, + }); + + return lists.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, + emails: { + type: "string[]", + label: "Emails", + description: "The email addresses of users to subscribe to the lists. These must match already existing AcyMailing users.", + async options({ page }) { + const data = await this.listUsers({ + params: { + limit: LIMIT, + offset: LIMIT * page, + }, + }); + + return data.map(({ email }) => email); + }, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return `${this.$auth.url}`; + }, + _headers() { + return { + "Api-Key": `${this.$auth.api_key}`, + "Content-Type": "application/json", + }; + }, + _params(params) { + return { + page: "acymailing_front", + option: "com_acym", + ctrl: "api", + ...params, + }; + }, + _makeRequest({ + $ = this, params, task, ...opts + }) { + return axios($, { + url: `${this._baseUrl()}`, + params: this._params({ + ...params, + task, + }), + headers: this._headers(), + ...opts, + }); + }, + listUsers(opts = {}) { + return this._makeRequest({ + task: "getUsers", + ...opts, + }); + }, + listLists(opts = {}) { + return this._makeRequest({ + task: "getLists", + ...opts, + }); + }, + listSubscribersFromLists(opts = {}) { + return this._makeRequest({ + task: "getSubscribersFromLists", + ...opts, + }); + }, + listUnsubscribedUsersFromLists(opts = {}) { + return this._makeRequest({ + task: "getUnsubscribedUsersFromLists", + ...opts, + }); + }, + createUserOrUpdate(opts = {}) { + return this._makeRequest({ + method: "POST", + task: "createOrUpdateUser", + ...opts, + }); + }, + sendEmailToUser(opts = {}) { + return this._makeRequest({ + method: "POST", + task: "sendEmailToSingleUser", + ...opts, + }); + }, + subscribeUserToLists(opts = {}) { + return this._makeRequest({ + method: "POST", + task: "subscribeUsers", + ...opts, + }); + }, + async *paginate({ + fn, params = {}, ...opts + }) { + let hasMore = false; + let page = 0; + + do { + params.limit = LIMIT; + params.offset = LIMIT * page; + page++; + + const data = await fn({ + params, + ...opts, + }); + + for (const d of data) { + yield d; + } + + hasMore = data.length; + + } while (hasMore); }, }, -}; \ No newline at end of file + +}; diff --git a/components/acymailing/common/constants.mjs b/components/acymailing/common/constants.mjs new file mode 100644 index 0000000000000..ea830c15a04cb --- /dev/null +++ b/components/acymailing/common/constants.mjs @@ -0,0 +1 @@ +export const LIMIT = 100; diff --git a/components/acymailing/common/utils.mjs b/components/acymailing/common/utils.mjs new file mode 100644 index 0000000000000..dcc9cc61f6f41 --- /dev/null +++ b/components/acymailing/common/utils.mjs @@ -0,0 +1,24 @@ +export const parseObject = (obj) => { + if (!obj) return undefined; + + if (Array.isArray(obj)) { + return obj.map((item) => { + if (typeof item === "string") { + try { + return JSON.parse(item); + } catch (e) { + return item; + } + } + return item; + }); + } + if (typeof obj === "string") { + try { + return JSON.parse(obj); + } catch (e) { + return obj; + } + } + return obj; +}; diff --git a/components/acymailing/package.json b/components/acymailing/package.json index 0ea087cc9207a..ac757258cdc20 100644 --- a/components/acymailing/package.json +++ b/components/acymailing/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/acymailing", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream AcyMailing Components", "main": "acymailing.app.mjs", "keywords": [ @@ -11,5 +11,9 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^2.0.0" } -} \ No newline at end of file +} + diff --git a/components/acymailing/sources/common/base.mjs b/components/acymailing/sources/common/base.mjs new file mode 100644 index 0000000000000..3d96e5892d799 --- /dev/null +++ b/components/acymailing/sources/common/base.mjs @@ -0,0 +1,68 @@ +import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; +import acymailing from "../../acymailing.app.mjs"; + +export default { + props: { + acymailing, + db: "$.service.db", + timer: { + type: "$.interface.timer", + default: { + intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, + }, + }, + }, + methods: { + _getLastDate() { + return this.db.get("lastDate") || 0; + }, + _setLastDate(created) { + this.db.set("lastDate", created); + }, + generateMeta(item) { + return { + id: item.id, + summary: this.getSummary(item), + ts: item.createdAt, + }; + }, + async startEvent(maxResults = 0) { + const lastDate = this._getLastDate(); + + const response = this.acymailing.paginate({ + fn: this.getFn(), + params: this.getParams(), + }); + + const responseArray = []; + for await (const item of response) { + responseArray.push(item); + } + + const dateField = this.getDateField(); + + let filteredArray = responseArray + .sort((a, b) => Date.parse(b[dateField]) - Date.parse(a[dateField])); + + filteredArray = filteredArray.filter((item) => Date.parse(item[dateField]) > lastDate); + + if (maxResults && filteredArray.length > maxResults) { + filteredArray.length = maxResults; + } + + if (filteredArray.length) this._setLastDate(Date.parse(filteredArray[0][dateField])); + + for (const item of filteredArray.reverse()) { + this.$emit(item, this.generateMeta(item)); + } + }, + }, + hooks: { + async deploy() { + await this.startEvent(25); + }, + }, + async run() { + await this.startEvent(); + }, +}; diff --git a/components/acymailing/sources/new-confirmed-user/new-confirmed-user.mjs b/components/acymailing/sources/new-confirmed-user/new-confirmed-user.mjs new file mode 100644 index 0000000000000..26143fc507b4e --- /dev/null +++ b/components/acymailing/sources/new-confirmed-user/new-confirmed-user.mjs @@ -0,0 +1,30 @@ +import common from "../common/base.mjs"; + +export default { + ...common, + key: "acymailing-new-confirmed-user", + name: "New Confirmed User", + description: "Emit new event when a user confirms their email address.", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getSummary({ + email, confirmation_date, + }) { + return `User ${email} confirmed at ${confirmation_date}.`; + }, + getParams() { + return { + "filters[confirmed]": 1, + }; + }, + getFn() { + return this.acymailing.listUsers; + }, + getDateField() { + return "confirmation_date"; + }, + }, +}; diff --git a/components/acymailing/sources/new-subscribed-user/new-subscribed-user.mjs b/components/acymailing/sources/new-subscribed-user/new-subscribed-user.mjs new file mode 100644 index 0000000000000..77bf549c36e21 --- /dev/null +++ b/components/acymailing/sources/new-subscribed-user/new-subscribed-user.mjs @@ -0,0 +1,39 @@ +import common from "../common/base.mjs"; + +export default { + ...common, + key: "acymailing-new-subscribed-user", + name: "New Subscribed User", + description: "Emit new event when a user subscribes to a specified list.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + listIds: { + propDefinition: [ + common.props.acymailing, + "listIds", + ], + }, + }, + methods: { + ...common.methods, + getSummary({ + email, name, + }) { + return `New Subscriber: ${name} (${email})`; + }, + getParams() { + return { + "listIds[]": this.listIds, + }; + }, + getFn() { + return this.acymailing.listSubscribersFromLists; + }, + getDateField() { + return "subscription_date"; + }, + }, +}; diff --git a/components/acymailing/sources/new-unsubscribed-user/new-unsubscribed-user.mjs b/components/acymailing/sources/new-unsubscribed-user/new-unsubscribed-user.mjs new file mode 100644 index 0000000000000..8bfb7cdd774e4 --- /dev/null +++ b/components/acymailing/sources/new-unsubscribed-user/new-unsubscribed-user.mjs @@ -0,0 +1,37 @@ +import common from "../common/base.mjs"; + +export default { + ...common, + key: "acymailing-new-unsubscribed-user", + name: "New Unsubscribed User", + description: "Emit new event when a user unsubscribes from the specified mailing list.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + listIds: { + propDefinition: [ + common.props.acymailing, + "listIds", + ], + }, + }, + methods: { + ...common.methods, + getSummary({ email }) { + return `User ${email} unsubscribed`; + }, + getParams() { + return { + "listIds[]": this.listIds, + }; + }, + getFn() { + return this.acymailing.listUnsubscribedUsersFromLists; + }, + getDateField() { + return "unsubscribe_date"; + }, + }, +}; diff --git a/components/gmail/actions/send-email/send-email.mjs b/components/gmail/actions/send-email/send-email.mjs index 95eb2860e6114..09c0c37909382 100644 --- a/components/gmail/actions/send-email/send-email.mjs +++ b/components/gmail/actions/send-email/send-email.mjs @@ -5,7 +5,7 @@ export default { key: "gmail-send-email", name: "Send Email", description: "Send an email from your Google Workspace email account", - version: "0.1.1", + version: "0.1.2", type: "action", props: { gmail, diff --git a/components/gmail/gmail.app.mjs b/components/gmail/gmail.app.mjs index 2e633ff4c9530..241007a27cabb 100644 --- a/components/gmail/gmail.app.mjs +++ b/components/gmail/gmail.app.mjs @@ -140,7 +140,7 @@ export default { attachments: { type: "object", label: "Attachments", - description: "Add any attachments you'd like to include as objects. The `key` should be the **filename** and the `value` should be the **url** for the attachment. The **filename** must contain the file extension (i.e. `.jpeg`, `.txt`) and the **url** is the download link for the file.", + description: "Add any attachments you'd like to include as objects.\n- The `key` should be the filename and must contain the file extension (e.g. `.jpeg`, `.txt`).\n- The `value` should be a URL of the download link for the file, or the local path (e.g. `/tmp/my-file.txt`).", optional: true, }, inReplyTo: { diff --git a/components/gmail/package.json b/components/gmail/package.json index d8e1ec0a69022..5b07d50d4df2c 100644 --- a/components/gmail/package.json +++ b/components/gmail/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/gmail", - "version": "0.0.12", + "version": "0.0.13", "description": "Pipedream Gmail Components", "main": "gmail.app.mjs", "keywords": [ diff --git a/components/gmail_custom_oauth/actions/add-label-to-email/add-label-to-email.mjs b/components/gmail_custom_oauth/actions/add-label-to-email/add-label-to-email.mjs index b987e439a873b..14d2825f4f946 100644 --- a/components/gmail_custom_oauth/actions/add-label-to-email/add-label-to-email.mjs +++ b/components/gmail_custom_oauth/actions/add-label-to-email/add-label-to-email.mjs @@ -4,7 +4,7 @@ export default { key: "gmail_custom_oauth-add-label-to-email", name: "Add Label to Email", description: "Add a label to an email message. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/modify)", - version: "0.0.9", + version: "0.0.10", type: "action", props: { gmail, diff --git a/components/gmail_custom_oauth/actions/create-draft/create-draft.mjs b/components/gmail_custom_oauth/actions/create-draft/create-draft.mjs index 269850530b5c7..55161b10500af 100644 --- a/components/gmail_custom_oauth/actions/create-draft/create-draft.mjs +++ b/components/gmail_custom_oauth/actions/create-draft/create-draft.mjs @@ -5,7 +5,7 @@ export default { key: "gmail_custom_oauth-create-draft", name: "Create Draft", description: "Create a draft from your Google Workspace email account", - version: "0.0.5", + version: "0.0.6", type: "action", props: { gmail, diff --git a/components/gmail_custom_oauth/actions/download-attachment/download-attachment.mjs b/components/gmail_custom_oauth/actions/download-attachment/download-attachment.mjs index 444ca4384c90e..bbe56ca9cfc65 100644 --- a/components/gmail_custom_oauth/actions/download-attachment/download-attachment.mjs +++ b/components/gmail_custom_oauth/actions/download-attachment/download-attachment.mjs @@ -6,7 +6,7 @@ export default { key: "gmail_custom_oauth-download-attachment", name: "Download Attachement", description: "Download an attachment by attachmentId to the /tmp directory. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.messages.attachments/get)", - version: "0.0.3", + version: "0.0.4", type: "action", props: { gmail, diff --git a/components/gmail_custom_oauth/actions/find-email/find-email.mjs b/components/gmail_custom_oauth/actions/find-email/find-email.mjs index 877e0ad341612..2773bc8bbf477 100644 --- a/components/gmail_custom_oauth/actions/find-email/find-email.mjs +++ b/components/gmail_custom_oauth/actions/find-email/find-email.mjs @@ -4,7 +4,7 @@ export default { key: "gmail_custom_oauth-find-email", name: "Find Email", description: "Find an email using Google's Search Engine. [See the docs](https://developers.google.com/gmail/api/reference/rest/v1/users.messages/list)", - version: "0.0.10", + version: "0.0.11", type: "action", props: { gmail, diff --git a/components/gmail_custom_oauth/actions/send-email/send-email.mjs b/components/gmail_custom_oauth/actions/send-email/send-email.mjs index 7f8fc4ae7c07a..83befeafcd472 100644 --- a/components/gmail_custom_oauth/actions/send-email/send-email.mjs +++ b/components/gmail_custom_oauth/actions/send-email/send-email.mjs @@ -10,7 +10,7 @@ overrideApp(base); export default { ...base, key: "gmail_custom_oauth-send-email", - version: "0.1.2", + version: "0.1.3", props: { ...base.props, inReplyTo: { diff --git a/components/gmail_custom_oauth/actions/update-org-signature/update-org-signature.mjs b/components/gmail_custom_oauth/actions/update-org-signature/update-org-signature.mjs index 2e50f83ba6b5a..b116a9b0ab6d9 100644 --- a/components/gmail_custom_oauth/actions/update-org-signature/update-org-signature.mjs +++ b/components/gmail_custom_oauth/actions/update-org-signature/update-org-signature.mjs @@ -7,7 +7,7 @@ export default { name: "Update Signature for Email in Organization", description: `Update the signature for a specific email address in an organization. A Google Cloud service account with delegated domain-wide authority is required for this action. [See docs here](https://developers.google.com/gmail/api/reference/rest/v1/users.settings.sendAs/update)`, - version: "0.0.6", + version: "0.0.7", type: "action", props: { gmail: base.props.gmail, diff --git a/components/gmail_custom_oauth/actions/update-primary-signature/update-primary-signature.mjs b/components/gmail_custom_oauth/actions/update-primary-signature/update-primary-signature.mjs index 8d8bd63eec216..6dc93c4191cf1 100644 --- a/components/gmail_custom_oauth/actions/update-primary-signature/update-primary-signature.mjs +++ b/components/gmail_custom_oauth/actions/update-primary-signature/update-primary-signature.mjs @@ -4,7 +4,7 @@ export default { key: "gmail_custom_oauth-update-primary-signature", name: "Update Signature for Primary Email Address", description: "Update the signature for the primary email address. [See docs here](https://developers.google.com/gmail/api/reference/rest/v1/users.settings.sendAs/update)", - version: "0.0.6", + version: "0.0.7", type: "action", props: { gmail, diff --git a/components/gmail_custom_oauth/package.json b/components/gmail_custom_oauth/package.json index 46307aaa2d338..745fba5f30c33 100644 --- a/components/gmail_custom_oauth/package.json +++ b/components/gmail_custom_oauth/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/gmail_custom_oauth", - "version": "0.1.8", + "version": "0.1.9", "description": "Pipedream Gmail (Consumer) Components", "main": "gmail_custom_oauth.app.mjs", "keywords": [ diff --git a/components/gmail_custom_oauth/sources/new-attachment-received/new-attachment-received.mjs b/components/gmail_custom_oauth/sources/new-attachment-received/new-attachment-received.mjs index cc06f94b284b4..beade9bb4358d 100644 --- a/components/gmail_custom_oauth/sources/new-attachment-received/new-attachment-received.mjs +++ b/components/gmail_custom_oauth/sources/new-attachment-received/new-attachment-received.mjs @@ -5,7 +5,7 @@ export default { key: "gmail_custom_oauth-new-attachment-received", name: "New Attachment Received", description: "Emit new event for each attachment in a message received. This source is capped at 100 max new messages per run.", - version: "0.0.8", + version: "0.0.9", type: "source", dedupe: "unique", methods: { diff --git a/components/gmail_custom_oauth/sources/new-email-received/new-email-received.mjs b/components/gmail_custom_oauth/sources/new-email-received/new-email-received.mjs index 275a28d6705ff..cbf2bf938f528 100644 --- a/components/gmail_custom_oauth/sources/new-email-received/new-email-received.mjs +++ b/components/gmail_custom_oauth/sources/new-email-received/new-email-received.mjs @@ -5,7 +5,7 @@ export default { key: "gmail_custom_oauth-new-email-received", name: "New Email Received", description: "Emit new event when an email is received. This source is capped at 100 max new messages per run.", - version: "0.0.9", + version: "0.0.10", type: "source", dedupe: "unique", methods: { diff --git a/components/gmail_custom_oauth/sources/new-labeled-email/new-labeled-email.mjs b/components/gmail_custom_oauth/sources/new-labeled-email/new-labeled-email.mjs index cdc8acef8c6c1..a79d9046a6167 100644 --- a/components/gmail_custom_oauth/sources/new-labeled-email/new-labeled-email.mjs +++ b/components/gmail_custom_oauth/sources/new-labeled-email/new-labeled-email.mjs @@ -7,7 +7,7 @@ export default { name: "New Labeled Email", description: "Emit new event when a new email is labeled.", type: "source", - version: "0.0.6", + version: "0.0.7", dedupe: "unique", props: { gmail, diff --git a/components/gmail_custom_oauth/sources/new-sent-email/new-sent-email.mjs b/components/gmail_custom_oauth/sources/new-sent-email/new-sent-email.mjs index b7f324927ecfc..701bea2e363c3 100644 --- a/components/gmail_custom_oauth/sources/new-sent-email/new-sent-email.mjs +++ b/components/gmail_custom_oauth/sources/new-sent-email/new-sent-email.mjs @@ -5,7 +5,7 @@ export default { key: "gmail_custom_oauth-new-sent-email", name: "New Sent Email", description: "Emit new event for each new email sent. (Maximum of 300 events emited per execution)", - version: "0.0.5", + version: "0.0.6", type: "source", props: { app, diff --git a/components/repliq/actions/get-credits-count/get-credits-count.mjs b/components/repliq/actions/get-credits-count/get-credits-count.mjs new file mode 100644 index 0000000000000..774bd968f9af4 --- /dev/null +++ b/components/repliq/actions/get-credits-count/get-credits-count.mjs @@ -0,0 +1,19 @@ +import repliq from "../../repliq.app.mjs"; + +export default { + key: "repliq-get-credits-count", + name: "Get Credits Count", + description: "Retrieve the total number of credits left for the month. [See the documentation](https://developer.repliq.co/get/g1-credits-count)", + version: "0.0.1", + type: "action", + props: { + repliq, + }, + async run({ $ }) { + const response = await this.repliq.getCreditsCount({ + $, + }); + $.export("$summary", `Successfully retrieved credits count: ${response.creditsCount}`); + return response; + }, +}; diff --git a/components/repliq/actions/launch-template/launch-template.mjs b/components/repliq/actions/launch-template/launch-template.mjs new file mode 100644 index 0000000000000..fbe1e8d550da1 --- /dev/null +++ b/components/repliq/actions/launch-template/launch-template.mjs @@ -0,0 +1,57 @@ +import { predefinedProps } from "../../common/props.mjs"; +import repliq from "../../repliq.app.mjs"; + +export default { + key: "repliq-launch-template", + name: "Launch Repliq Template", + description: "Launch a Repliq process by deploying the selected template. [See the documentation](https://developer.repliq.co/)", + version: "0.0.1", + type: "action", + props: { + repliq, + templateId: { + propDefinition: [ + repliq, + "templateId", + ], + reloadProps: true, + }, + }, + async additionalProps() { + let props = {}; + if (this.templateId) { + const templates = await this.repliq.listTemplates(); + const template = templates.find((item) => item.id === this.templateId); + + props = { + ...predefinedProps[template.type], + email: { + type: "string", + label: "Email", + description: "The account email you want to send this result to.", + optional: true, + }, + webhook: { + type: "string", + label: "Webhook", + description: "Attach a webhook URL that will trigger when the process is ready for you to use. You cannot use multiple URLs.", + optional: true, + }, + }; + } + return props; + }, + async run({ $ }) { + const { + repliq, + ...data + } = this; + + const response = await repliq.launchTemplate({ + $, + data, + }); + $.export("$summary", `Successfully launched template with ID ${this.templateId}`); + return response; + }, +}; diff --git a/components/repliq/common/props.mjs b/components/repliq/common/props.mjs new file mode 100644 index 0000000000000..13ceef0f39436 --- /dev/null +++ b/components/repliq/common/props.mjs @@ -0,0 +1,109 @@ +const url = { + type: "string", + label: "URL", + description: "The url of the website you want to use.", +}; +const firstName = { + type: "string", + label: "First Name", + description: "The name of the person you create the process for.", +}; +const lastName = { + type: "string", + label: "Last Name", + description: "The last name of the person you create the process for.", + optional: true, +}; +const companyName = { + type: "string", + label: "Company Name", + description: "The name of the company you create the process for.", +}; +const jobTitle = { + type: "string", + label: "Job Title", + description: "The Job Title of the person you create the process for.", + optional: true, +}; +const icebreaker = { + type: "string", + label: "Icebreaker", + description: "Use an icebreaker as introduction for your process specific to the person you create the process for.", + optional: true, +}; +const yourCustomVariable = { + type: "string", + label: "Your Custom Variable", + description: "The yourCustomVariable you use for your process.", + optional: true, +}; + +export const predefinedProps = { + ai_image: { + firstName, + lastName, + jobTitle, + companyName: { + ...companyName, + optional: true, + }, + yourCustomVariable, + }, + ai_avatar: { + url, + companyName: { + ...companyName, + optional: true, + }, + firstName: { + ...firstName, + optional: true, + }, + jobTitle, + icebreaker, + }, + gpt_image: { + companyName, + firstName: { + ...firstName, + optional: true, + }, + lastName, + jobTitle, + competion: { + type: "string", + label: "Competion", + description: "The competion of the company you create an image for.", + optional: true, + }, + yourCustomVariable, + }, + icebreaker: { + url, + firstName, + }, + text_to_video: { + firstName, + prospectImgUrl: { + type: "string", + label: "Prospect Img URL", + description: "The linkedin profile url of the person you want to reach out to.", + optional: true, + }, + lastName, + companyName: { + ...companyName, + optional: true, + }, + jobTitle, + icebreaker, + }, + video_scale: { + url, + firstName: { + ...firstName, + optional: true, + }, + lastName, + }, +}; diff --git a/components/repliq/package.json b/components/repliq/package.json index ef9b003a5082c..1bb671ce35da6 100644 --- a/components/repliq/package.json +++ b/components/repliq/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/repliq", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream RepliQ Components", "main": "repliq.app.mjs", "keywords": [ @@ -11,5 +11,9 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^2.0.0" } -} \ No newline at end of file +} + diff --git a/components/repliq/repliq.app.mjs b/components/repliq/repliq.app.mjs index a892ed56397f6..771e9112b5da1 100644 --- a/components/repliq/repliq.app.mjs +++ b/components/repliq/repliq.app.mjs @@ -1,11 +1,63 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "repliq", - propDefinitions: {}, + propDefinitions: { + templateId: { + type: "string", + label: "Template ID", + description: "The ID of the template you want to deploy.", + async options() { + const templates = await this.listTemplates(); + if (templates.error) return []; + + return templates.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.repliq.co/v2"; + }, + _headers() { + return { + Authorization: `Bearer ${this.$auth.api_key}`, + }; + }, + _makeRequest({ + $ = this, + path, + ...opts + }) { + return axios($, { + url: this._baseUrl() + path, + headers: this._headers(), + ...opts, + }); + }, + getCreditsCount(opts = {}) { + return this._makeRequest({ + path: "/getCreditsCount", + ...opts, + }); + }, + listTemplates() { + return this._makeRequest({ + path: "/getTemplateList", + }); + }, + launchTemplate(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/launchTemplate", + ...opts, + }); }, }, -}; \ No newline at end of file +}; diff --git a/components/samsara/actions/create-address/create-address.mjs b/components/samsara/actions/create-address/create-address.mjs new file mode 100644 index 0000000000000..9cee5ee544c75 --- /dev/null +++ b/components/samsara/actions/create-address/create-address.mjs @@ -0,0 +1,109 @@ +import { ConfigurationError } from "@pipedream/platform"; +import { + cleanObject, + parseObject, +} from "../../common/utils.mjs"; +import samsara from "../../samsara.app.mjs"; + +export default { + key: "samsara-create-address", + name: "Create Address", + description: "Adds a new address to the organization. The user must provide the necessary props such as formatted address, geofence, and name. [See the documentation](https://developers.samsara.com/reference/createaddress)", + version: "0.0.1", + type: "action", + props: { + samsara, + addressTypes: { + type: "string[]", + label: "Address Types", + description: "Reporting location type associated with the address (used for ELD reporting purposes).", + options: [ + "yard", + "shortHaul", + "workforceSite", + "riskZone", + "industrialSite", + "alertsOnly", + ], + optional: true, + }, + contactIds: { + propDefinition: [ + samsara, + "contactIds", + ], + optional: true, + }, + externalIds: { + propDefinition: [ + samsara, + "externalIds", + ], + optional: true, + }, + formattedAddress: { + type: "string", + label: "Formatted Address", + description: "The full street address for this address/geofence, as it might be recognized by Google Maps.", + }, + geofence: { + type: "object", + label: "Geofence", + description: "The geofence that defines this address and its bounds. This can either be a circle or a polygon, but not both. [See the documentation](https://developers.samsara.com/reference/createaddress)", + }, + latitude: { + type: "string", + label: "Latitude", + description: "Latitude of the address. Will be geocoded from **Formatted Address** if not provided.", + optional: true, + }, + longitude: { + type: "string", + label: "Longitude", + description: "Longitude of the address. Will be geocoded from **Formatted Address** if not provided.", + optional: true, + }, + name: { + type: "string", + label: "Name", + description: "Name of the address.", + }, + notes: { + type: "string", + label: "Notes", + description: "Notes about the address.", + }, + tagIds: { + propDefinition: [ + samsara, + "tagIds", + ], + optional: true, + }, + }, + async run({ $ }) { + try { + const response = await this.samsara.createAddress({ + $, + data: cleanObject({ + addressTypes: parseObject(this.addressTypes), + contactIds: parseObject(this.contactIds), + externalIds: parseObject(this.externalIds), + formattedAddress: this.formattedAddress, + geofence: parseObject(this.geofence), + latitude: this.latitude, + longitude: this.longitude, + name: this.name, + notes: this.notes, + tagIds: parseObject(this.tagIds), + }), + }); + + $.export("$summary", `Successfully created address with name Id: ${response.data?.id}`); + return response; + + } catch (error) { + throw new ConfigurationError(JSON.parse(error.message).message); + } + }, +}; diff --git a/components/samsara/actions/create-contact/create-contact.mjs b/components/samsara/actions/create-contact/create-contact.mjs new file mode 100644 index 0000000000000..a7f26afcd70ea --- /dev/null +++ b/components/samsara/actions/create-contact/create-contact.mjs @@ -0,0 +1,54 @@ +import { ConfigurationError } from "@pipedream/platform"; +import samsara from "../../samsara.app.mjs"; + +export default { + key: "samsara-create-contact", + name: "Create Contact", + description: "Adds a new contact to the organization. [See the documentation](https://developers.samsara.com/reference/createcontact)", + version: "0.0.1", + type: "action", + props: { + samsara, + firstName: { + type: "string", + label: "First Name", + description: "First name of the contact.", + optional: true, + }, + lastName: { + type: "string", + label: "Last Name", + description: "Last name of the contact.", + optional: true, + }, + email: { + type: "string", + label: "Email", + description: "Email address of the contact.", + optional: true, + }, + phone: { + type: "string", + label: "Phone Number", + description: "Phone number of the contact.", + optional: true, + }, + }, + async run({ $ }) { + if (!this.email && !this.phone) { + throw new ConfigurationError("Either Email or Phone Number must be provided."); + } + + const response = await this.samsara.createContact({ + $, + data: { + firstName: this.firstName, + lastName: this.lastName, + email: this.email, + phone: this.phone, + }, + }); + $.export("$summary", `Successfully created contact ${this.firstName} ${this.lastName}`); + return response; + }, +}; diff --git a/components/samsara/actions/create-route/create-route.mjs b/components/samsara/actions/create-route/create-route.mjs new file mode 100644 index 0000000000000..ad3c23569dc8e --- /dev/null +++ b/components/samsara/actions/create-route/create-route.mjs @@ -0,0 +1,95 @@ +import { ConfigurationError } from "@pipedream/platform"; +import { parseObject } from "../../common/utils.mjs"; +import samsara from "../../samsara.app.mjs"; + +export default { + key: "samsara-create-route", + name: "Create Route", + description: "Generates a new route to an existing address. As a prerequisite, the user must create an address using the 'create-address' action if the location is not already available in the address book. The user must provide the necessary props such as destination address.", + version: "0.0.1", + type: "action", + props: { + samsara, + driverId: { + propDefinition: [ + samsara, + "driverId", + ], + optional: true, + }, + externalIds: { + propDefinition: [ + samsara, + "externalIds", + ], + optional: true, + }, + name: { + type: "string", + label: "Name", + description: "Name for the route", + }, + notes: { + type: "string", + label: "Notes", + description: "Notes about the route.", + optional: true, + }, + routeCompletionCondition: { + type: "string", + label: "Route Completion Condition", + description: "Defaults to 'arriveLastStop' which ends the route upon arriving at the final stop. The condition 'departLastStop' ends the route upon departing the last stop. If 'arriveLastStop' is set, then the departure time of the final stop should not be set.", + options: [ + "arriveLastStop", + "departLastStop", + ], + optional: true, + }, + routeStartingCondition: { + type: "string", + label: "Route Starting Condition", + description: "Defaults to 'departFirstStop' which starts the route upon departing the first stop in the route. The condition 'arriveFirstStop' starts the route upon arriving at the first stop in the route. If 'departFirstStop' is set, the arrival time of the first stop should not be set.", + options: [ + "departFirstStop", + "arriveFirstStop", + ], + optional: true, + }, + stops: { + type: "object", + label: "Stops", + description: "List of objects of stops along the route. For each stop, exactly one of addressId and singleUseLocation are required. Depending on the settings on your route, either a scheduledArrivalTime or scheduledDepartureTime must be specified for the first job. [See further information](https://developers.samsara.com/reference/createroute)", + }, + vehicleId: { + propDefinition: [ + samsara, + "vehicleId", + ], + optional: true, + }, + }, + async run({ $ }) { + try { + const response = await this.samsara.createRoute({ + $, + data: { + driverId: this.driverId, + externalIds: parseObject(this.externalIds), + name: this.name, + notes: this.notes, + settings: { + routeCompletionCondition: this.routeCompletionCondition, + routeStartingCondition: this.routeStartingCondition, + }, + stops: parseObject(this.stops), + vehicleId: this.vehicleId, + }, + }); + + $.export("$summary", `Successfully created a new route with Id: ${response.data?.id}`); + return response; + } catch ({ message }) { + throw new ConfigurationError(JSON.parse(message).message); + } + }, +}; diff --git a/components/samsara/common/utils.mjs b/components/samsara/common/utils.mjs new file mode 100644 index 0000000000000..2c8bb0118ddff --- /dev/null +++ b/components/samsara/common/utils.mjs @@ -0,0 +1,33 @@ +export const parseObject = (obj) => { + if (!obj) return undefined; + + if (Array.isArray(obj)) { + return obj.map((item) => { + if (typeof item === "string") { + try { + return JSON.parse(item); + } catch (e) { + return item; + } + } + return item; + }); + } + if (typeof obj === "string") { + try { + return JSON.parse(obj); + } catch (e) { + return obj; + } + } + return obj; +}; + +export const cleanObject = (o) => { + for (let k in o || {}) { + if (typeof o[k] === "undefined") { + delete o[k]; + } + } + return o; +}; diff --git a/components/samsara/package.json b/components/samsara/package.json index fdc071ac953c1..8d4907c30d35c 100644 --- a/components/samsara/package.json +++ b/components/samsara/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/samsara", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Samsara Components", "main": "samsara.app.mjs", "keywords": [ @@ -11,5 +11,9 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^2.0.0" } -} \ No newline at end of file +} + diff --git a/components/samsara/samsara.app.mjs b/components/samsara/samsara.app.mjs index c039cdfe418c9..15032a4b2dc1d 100644 --- a/components/samsara/samsara.app.mjs +++ b/components/samsara/samsara.app.mjs @@ -1,11 +1,164 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "samsara", - propDefinitions: {}, + propDefinitions: { + contactIds: { + type: "string[]", + label: "Contact Ids", + description: "An array of Contact IDs associated with this Address.", + async options({ page }) { + const { data } = await this.listContacts({ + params: { + page, + }, + }); + + return data.map((contact) => ({ + label: `${contact.firstName} ${contact.lastName}` || contact.email || contact.phone, + value: contact.id, + })); + }, + }, + driverId: { + type: "string", + label: "Driver Id", + description: "ID of the driver.", + async options({ page }) { + const { data } = await this.listDrivers({ + params: { + page, + }, + }); + + return data.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, + tagIds: { + type: "string[]", + label: "Tag Ids", + description: "An array of IDs of tags to associate with this address.", + async options({ page }) { + const { data } = await this.listTags({ + params: { + page, + }, + }); + + return data.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, + vehicleId: { + type: "string", + label: "Vehicle Id", + description: "ID of the vehicle.", + async options({ page }) { + const { data } = await this.listVehicles({ + params: { + page, + }, + }); + + return data.map(({ + id: value, name: label, + }) => ({ + label, + value, + })); + }, + }, + externalIds: { + type: "object", + label: "External Ids", + description: "The external IDs for the given object.", + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.samsara.com"; + }, + _headers() { + return { + Authorization: `Bearer ${this.$auth.api_token}`, + }; + }, + _makeRequest({ + $ = this, path, ...opts + }) { + return axios($, { + url: this._baseUrl() + path, + headers: this._headers(), + ...opts, + }); + }, + createContact(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/contacts", + ...opts, + }); + }, + listContacts(opts = {}) { + return this._makeRequest({ + path: "/contacts", + ...opts, + }); + }, + listDrivers(opts = {}) { + return this._makeRequest({ + path: "/fleet/drivers", + ...opts, + }); + }, + listTags(opts = {}) { + return this._makeRequest({ + path: "/tags", + ...opts, + }); + }, + listVehicles(opts = {}) { + return this._makeRequest({ + path: "/fleet/vehicles", + ...opts, + }); + }, + createAddress(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/addresses", + ...opts, + }); + }, + createRoute(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/fleet/routes", + ...opts, + }); + }, + createWebhook(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/webhooks", + ...opts, + }); + }, + deleteWebhook(webhookId) { + return this._makeRequest({ + method: "DELETE", + path: `/webhooks/${webhookId}`, + }); }, }, -}; \ No newline at end of file +}; diff --git a/components/samsara/sources/common/base.mjs b/components/samsara/sources/common/base.mjs new file mode 100644 index 0000000000000..4affd78e1fc37 --- /dev/null +++ b/components/samsara/sources/common/base.mjs @@ -0,0 +1,61 @@ +import samsara from "../../samsara.app.mjs"; + +export default { + props: { + samsara, + db: "$.service.db", + http: { + type: "$.interface.http", + customResponse: true, + }, + name: { + type: "string", + label: "Name", + description: "The name of the webhook. This will appear in both Samsara's cloud dashboard and the API. It can be set or updated through the Samsara Dashboard or through the API at any time.", + }, + }, + methods: { + getWebhookProps() { + return {}; + }, + _setHookId(hookId) { + this.db.set("hookId", hookId); + }, + _getHookId() { + return this.db.get("hookId"); + }, + checkEvent() { + return true; + }, + }, + hooks: { + async activate() { + const webhook = await this.samsara.createWebhook({ + data: { + name: this.name, + url: this.http.endpoint, + eventTypes: this.getEventTypes(), + }, + }); + this._setHookId(webhook.id); + }, + async deactivate() { + const hookId = this._getHookId(); + return await this.samsara.deleteWebhook(hookId); + }, + }, + async run({ body }) { + this.http.respond({ + status: 200, + }); + + if (this.checkEvent(body)) { + this.$emit(body, { + id: body.eventId, + summary: this.getSummary(body), + ts: body.eventTime, + }); + } + + }, +}; diff --git a/components/samsara/sources/new-document-submitted-instant/new-document-submitted-instant.mjs b/components/samsara/sources/new-document-submitted-instant/new-document-submitted-instant.mjs new file mode 100644 index 0000000000000..1a2f7f3091f96 --- /dev/null +++ b/components/samsara/sources/new-document-submitted-instant/new-document-submitted-instant.mjs @@ -0,0 +1,27 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "samsara-new-document-submitted-instant", + name: "New Document Submitted (Instant)", + description: "Emit new event when a document is submitted.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + }, + methods: { + ...common.methods, + getEventTypes() { + return [ + "DocumentSubmitted", + ]; + }, + getSummary({ data }) { + return `New document with Id: ${data.document.id} successfully submitted!`; + }, + }, + sampleEmit, +}; diff --git a/components/samsara/sources/new-document-submitted-instant/test-event.mjs b/components/samsara/sources/new-document-submitted-instant/test-event.mjs new file mode 100644 index 0000000000000..7a109ba9c7d1d --- /dev/null +++ b/components/samsara/sources/new-document-submitted-instant/test-event.mjs @@ -0,0 +1,224 @@ +export default { + "eventId": "017db07f-6e95-470e-8cc0-a371f9deed2b", + "eventTime": "1970-01-20T06:39:05.683Z", + "eventType": "DocumentSubmitted", + "orgId": 20936, + "webhookId": "1411751028848270", + "data": { + "document": { + "conditionalFieldSections": [ + { + "conditionalFieldFirstIndex": 5083143870897228000, + "conditionalFieldLastIndex": 2770896918544835600, + "triggeringFieldIndex": 8389989517472915000, + "triggeringFieldValue": "Optiona 1" + }, + { + "conditionalFieldFirstIndex": 5083143870897228000, + "conditionalFieldLastIndex": 2770896918544835600, + "triggeringFieldIndex": 8389989517472915000, + "triggeringFieldValue": "Optiona 1" + }, + { + "conditionalFieldFirstIndex": 5083143870897228000, + "conditionalFieldLastIndex": 2770896918544835600, + "triggeringFieldIndex": 8389989517472915000, + "triggeringFieldValue": "Optiona 1" + } + ], + "createdAtTime": "1976-03-06T08:22:53Z", + "documentType": { + "id": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7", + "name": "Fleet Truck List" + }, + "fields": [ + { + "label": "Load weight", + "type": "photo", + "value": { + "barcodeValue": [ + { + "barcodeType": "org.gs1.EAN-13", + "barcodeValue": "0853883003114" + }, + { + "barcodeType": "org.gs1.EAN-13", + "barcodeValue": "0853883003114" + }, + { + "barcodeType": "org.gs1.EAN-13", + "barcodeValue": "0853883003114" + }, + { + "barcodeType": "org.gs1.EAN-13", + "barcodeValue": "0853883003114" + } + ], + "dateTimeValue": { + "dateTime": "1984-10-23T07:14:29Z" + }, + "multipleChoiceValue": [ + { + "selected": false, + "value": "Yes" + }, + { + "selected": false, + "value": "Yes" + }, + { + "selected": false, + "value": "Yes" + } + ], + "numberValue": 123.456, + "photoValue": [ + { + "id": "f5271458-21f9-4a9f-a290-780c6d8840ff", + "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456" + }, + { + "id": "f5271458-21f9-4a9f-a290-780c6d8840ff", + "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456" + } + ], + "scannedDocumentValue": [ + { + "id": "f5271458-21f9-4a9f-a290-780c6d8840ff", + "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456" + }, + { + "id": "f5271458-21f9-4a9f-a290-780c6d8840ff", + "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456" + }, + { + "id": "f5271458-21f9-4a9f-a290-780c6d8840ff", + "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456" + } + ], + "signatureValue": { + "id": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7", + "name": "John Smith", + "signedAtTime": "1996-01-30T06:14:20Z", + "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456" + }, + "stringValue": "Red Truck" + } + }, + { + "label": "Load weight", + "type": "photo", + "value": { + "barcodeValue": [ + { + "barcodeType": "org.gs1.EAN-13", + "barcodeValue": "0853883003114" + }, + { + "barcodeType": "org.gs1.EAN-13", + "barcodeValue": "0853883003114" + }, + { + "barcodeType": "org.gs1.EAN-13", + "barcodeValue": "0853883003114" + }, + { + "barcodeType": "org.gs1.EAN-13", + "barcodeValue": "0853883003114" + } + ], + "dateTimeValue": { + "dateTime": "1984-10-23T07:14:29Z" + }, + "multipleChoiceValue": [ + { + "selected": false, + "value": "Yes" + }, + { + "selected": false, + "value": "Yes" + }, + { + "selected": false, + "value": "Yes" + } + ], + "numberValue": 123.456, + "photoValue": [ + { + "id": "f5271458-21f9-4a9f-a290-780c6d8840ff", + "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456" + }, + { + "id": "f5271458-21f9-4a9f-a290-780c6d8840ff", + "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456" + } + ], + "scannedDocumentValue": [ + { + "id": "f5271458-21f9-4a9f-a290-780c6d8840ff", + "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456" + }, + { + "id": "f5271458-21f9-4a9f-a290-780c6d8840ff", + "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456" + }, + { + "id": "f5271458-21f9-4a9f-a290-780c6d8840ff", + "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456" + } + ], + "signatureValue": { + "id": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7", + "name": "John Smith", + "signedAtTime": "1996-01-30T06:14:20Z", + "url": "https://samsara-driver-media-upload.s3.us-west-2.amazonaws.com/123456" + }, + "stringValue": "Red Truck" + } + } + ], + "id": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7", + "name": "Dropoff Slip 123", + "notes": "Missing a crate", + "route": { + "externalIds": { + "myRouteId": "abc" + }, + "id": "131313", + "name": "Pineapple delivery" + }, + "routeStop": { + "externalIds": { + "siteId": "54" + }, + "id": "494123", + "name": "Company Warehouse #1" + }, + "state": "submitted", + "updatedAtTime": "2009-01-10T02:28:18Z" + }, + "driver": { + "externalIds": { + "payrollId": "ABFS18600" + }, + "id": "45646", + "name": "Driver Bob" + }, + "vehicle": { + "assetType": "vehicle", + "externalIds": { + "maintenanceId": "250020" + }, + "gateway": { + "model": "VG34", + "serial": "GFRV-43N-VGX" + }, + "id": "494123", + "licensePlate": "6SAM123", + "name": "Fleet Truck #1", + "vin": "1GBJ6P1B2HV112765" + } + } +} \ No newline at end of file diff --git a/components/samsara/sources/new-route-job-completion-instant/new-route-job-completion-instant.mjs b/components/samsara/sources/new-route-job-completion-instant/new-route-job-completion-instant.mjs new file mode 100644 index 0000000000000..0f5dec5445e6a --- /dev/null +++ b/components/samsara/sources/new-route-job-completion-instant/new-route-job-completion-instant.mjs @@ -0,0 +1,35 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "samsara-new-route-job-completion-instant", + name: "New Route Job Completion (Instant)", + description: "Emit new event when a job is completed on a Samsara route.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + }, + methods: { + ...common.methods, + getEventTypes() { + return [ + "RouteStopDeparture", + "RouteStopArrival", + ]; + }, + getSummary({ data }) { + return `Route ${data.route.name} successfully completed.`; + }, + checkEvent({ data }) { + const filteredStops = data.route.stops.filter((stop) => { + return stop.state != "departed"; + }); + + return !filteredStops.length; + }, + }, + sampleEmit, +}; diff --git a/components/samsara/sources/new-route-job-completion-instant/test-event.mjs b/components/samsara/sources/new-route-job-completion-instant/test-event.mjs new file mode 100644 index 0000000000000..62de0100b98ae --- /dev/null +++ b/components/samsara/sources/new-route-job-completion-instant/test-event.mjs @@ -0,0 +1,217 @@ +export default { + "eventId": "017db07f-6e95-470e-8cc0-a371f9deed2b", + "eventTime": "1970-01-20T06:39:05.683Z", + "eventType": "RouteStopArrival", + "orgId": 20936, + "webhookId": "1411751028848270", + "data": { + "driver": { + "externalIds": { + "payrollId": "ABFS18600" + }, + "id": "45646", + "name": "Driver Bob" + }, + "operation": "stop arrived", + "route": { + "actualRouteEndTime": "2019-06-13T19:08:25Z", + "actualRouteStartTime": "2019-06-13T19:08:25Z", + "externalIds": { + "myRouteId": "abc" + }, + "id": "342341", + "name": "Bid 123", + "notes": "These are my notes", + "scheduledRouteEndTime": "2019-06-13T19:08:25Z", + "scheduledRouteStartTime": "2019-06-13T19:08:25Z", + "settings": { + "routeCompletionCondition": "arriveLastStop", + "routeStartingCondition": "departFirstStop" + }, + "stops": [ + { + "actualArrivalTime": "2006-01-02T15:04:05+07:00", + "actualDepartureTime": "2006-01-02T15:04:05+07:00", + "address": { + "externalIds": { + "siteId": "54" + }, + "id": "494123", + "name": "Company Office #1" + }, + "documents": [ + { + "id": "494123", + "name": "Fuel Receipt Wichita" + }, + { + "id": "494123", + "name": "Fuel Receipt Wichita" + } + ], + "enRouteTime": "2006-01-02T15:04:05+07:00", + "eta": "2006-01-02T15:04:05+07:00", + "externalIds": { + "siteId": "54" + }, + "id": "324231", + "liveSharingUrl": "https://cloud.samsara.com/fleet/viewer/job/fleet_viewer_token", + "locationLiveSharingLinks": [ + { + "expiresAtTime": "2020-01-27T07:06:25Z", + "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU", + "name": "Name" + }, + { + "expiresAtTime": "2020-01-27T07:06:25Z", + "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU", + "name": "Name" + } + ], + "name": "Stop #1", + "notes": "These are my notes", + "scheduledArrivalTime": "2019-06-13T19:08:25Z", + "scheduledDepartureTime": "2019-06-13T19:08:25Z", + "singleUseLocation": { + "address": "1234 Main St, San Jose, CA", + "latitude": 123.456, + "longitude": 37.459 + }, + "skippedTime": "2006-01-02T15:04:05+07:00", + "state": "scheduled" + }, + { + "actualArrivalTime": "2006-01-02T15:04:05+07:00", + "actualDepartureTime": "2006-01-02T15:04:05+07:00", + "address": { + "externalIds": { + "siteId": "54" + }, + "id": "494123", + "name": "Company Office #1" + }, + "documents": [ + { + "id": "494123", + "name": "Fuel Receipt Wichita" + }, + { + "id": "494123", + "name": "Fuel Receipt Wichita" + } + ], + "enRouteTime": "2006-01-02T15:04:05+07:00", + "eta": "2006-01-02T15:04:05+07:00", + "externalIds": { + "siteId": "54" + }, + "id": "324231", + "liveSharingUrl": "https://cloud.samsara.com/fleet/viewer/job/fleet_viewer_token", + "locationLiveSharingLinks": [ + { + "expiresAtTime": "2020-01-27T07:06:25Z", + "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU", + "name": "Name" + }, + { + "expiresAtTime": "2020-01-27T07:06:25Z", + "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU", + "name": "Name" + } + ], + "name": "Stop #1", + "notes": "These are my notes", + "scheduledArrivalTime": "2019-06-13T19:08:25Z", + "scheduledDepartureTime": "2019-06-13T19:08:25Z", + "singleUseLocation": { + "address": "1234 Main St, San Jose, CA", + "latitude": 123.456, + "longitude": 37.459 + }, + "skippedTime": "2006-01-02T15:04:05+07:00", + "state": "scheduled" + }, + { + "actualArrivalTime": "2006-01-02T15:04:05+07:00", + "actualDepartureTime": "2006-01-02T15:04:05+07:00", + "address": { + "externalIds": { + "siteId": "54" + }, + "id": "494123", + "name": "Company Office #1" + }, + "documents": [ + { + "id": "494123", + "name": "Fuel Receipt Wichita" + }, + { + "id": "494123", + "name": "Fuel Receipt Wichita" + } + ], + "enRouteTime": "2006-01-02T15:04:05+07:00", + "eta": "2006-01-02T15:04:05+07:00", + "externalIds": { + "siteId": "54" + }, + "id": "324231", + "liveSharingUrl": "https://cloud.samsara.com/fleet/viewer/job/fleet_viewer_token", + "locationLiveSharingLinks": [ + { + "expiresAtTime": "2020-01-27T07:06:25Z", + "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU", + "name": "Name" + }, + { + "expiresAtTime": "2020-01-27T07:06:25Z", + "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU", + "name": "Name" + } + ], + "name": "Stop #1", + "notes": "These are my notes", + "scheduledArrivalTime": "2019-06-13T19:08:25Z", + "scheduledDepartureTime": "2019-06-13T19:08:25Z", + "singleUseLocation": { + "address": "1234 Main St, San Jose, CA", + "latitude": 123.456, + "longitude": 37.459 + }, + "skippedTime": "2006-01-02T15:04:05+07:00", + "state": "scheduled" + } + ] + }, + "routeStopDetails": { + "actualArrivalTime": "2006-01-02T15:04:05+07:00", + "actualDepartureTime": "2006-01-02T15:04:05+07:00", + "enRouteTime": "2006-01-02T15:04:05+07:00", + "eta": "2006-01-02T15:04:05+07:00", + "externalIds": { + "siteId": "54" + }, + "id": "141414", + "liveSharingUrl": "https://cloud.samsara.com/fleet/viewer/job/fleet_viewer_token", + "skippedTime": "2006-01-02T15:04:05+07:00", + "state": "scheduled" + }, + "time": "2020-01-27T07:06:25Z", + "type": "route tracking", + "vehicle": { + "assetType": "vehicle", + "externalIds": { + "maintenanceId": "250020" + }, + "gateway": { + "model": "VG34", + "serial": "GFRV-43N-VGX" + }, + "id": "494123", + "licensePlate": "6SAM123", + "name": "Fleet Truck #1", + "vin": "1GBJ6P1B2HV112765" + } + } +} \ No newline at end of file diff --git a/components/samsara/sources/new-route-started-instant/new-route-started-instant.mjs b/components/samsara/sources/new-route-started-instant/new-route-started-instant.mjs new file mode 100644 index 0000000000000..2e51294d81204 --- /dev/null +++ b/components/samsara/sources/new-route-started-instant/new-route-started-instant.mjs @@ -0,0 +1,34 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "samsara-new-route-started-instant", + name: "New Route Started (Instant)", + description: "Emit new event when a new route is stated.", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + }, + methods: { + ...common.methods, + getEventTypes() { + return [ + "RouteStopDeparture", + ]; + }, + getSummary({ data }) { + return `New route with Id: ${data.route.id} successfully started!`; + }, + checkEvent({ data }) { + const filteredStops = data.route.stops.filter((stop) => { + return stop.state === "departed"; + }); + + return filteredStops.length === 1; + }, + }, + sampleEmit, +}; diff --git a/components/samsara/sources/new-route-started-instant/test-event.mjs b/components/samsara/sources/new-route-started-instant/test-event.mjs new file mode 100644 index 0000000000000..e868690baba6d --- /dev/null +++ b/components/samsara/sources/new-route-started-instant/test-event.mjs @@ -0,0 +1,217 @@ +export default { + "eventId": "017db07f-6e95-470e-8cc0-a371f9deed2b", + "eventTime": "1970-01-20T06:39:05.683Z", + "eventType": "RouteStopDeparture", + "orgId": 20936, + "webhookId": "1411751028848270", + "data": { + "driver": { + "externalIds": { + "payrollId": "ABFS18600" + }, + "id": "45646", + "name": "Driver Bob" + }, + "operation": "stop arrived", + "route": { + "actualRouteEndTime": "2019-06-13T19:08:25Z", + "actualRouteStartTime": "2019-06-13T19:08:25Z", + "externalIds": { + "myRouteId": "abc" + }, + "id": "342341", + "name": "Bid 123", + "notes": "These are my notes", + "scheduledRouteEndTime": "2019-06-13T19:08:25Z", + "scheduledRouteStartTime": "2019-06-13T19:08:25Z", + "settings": { + "routeCompletionCondition": "arriveLastStop", + "routeStartingCondition": "departFirstStop" + }, + "stops": [ + { + "actualArrivalTime": "2006-01-02T15:04:05+07:00", + "actualDepartureTime": "2006-01-02T15:04:05+07:00", + "address": { + "externalIds": { + "siteId": "54" + }, + "id": "494123", + "name": "Company Office #1" + }, + "documents": [ + { + "id": "494123", + "name": "Fuel Receipt Wichita" + }, + { + "id": "494123", + "name": "Fuel Receipt Wichita" + } + ], + "enRouteTime": "2006-01-02T15:04:05+07:00", + "eta": "2006-01-02T15:04:05+07:00", + "externalIds": { + "siteId": "54" + }, + "id": "324231", + "liveSharingUrl": "https://cloud.samsara.com/fleet/viewer/job/fleet_viewer_token", + "locationLiveSharingLinks": [ + { + "expiresAtTime": "2020-01-27T07:06:25Z", + "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU", + "name": "Name" + }, + { + "expiresAtTime": "2020-01-27T07:06:25Z", + "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU", + "name": "Name" + } + ], + "name": "Stop #1", + "notes": "These are my notes", + "scheduledArrivalTime": "2019-06-13T19:08:25Z", + "scheduledDepartureTime": "2019-06-13T19:08:25Z", + "singleUseLocation": { + "address": "1234 Main St, San Jose, CA", + "latitude": 123.456, + "longitude": 37.459 + }, + "skippedTime": "2006-01-02T15:04:05+07:00", + "state": "scheduled" + }, + { + "actualArrivalTime": "2006-01-02T15:04:05+07:00", + "actualDepartureTime": "2006-01-02T15:04:05+07:00", + "address": { + "externalIds": { + "siteId": "54" + }, + "id": "494123", + "name": "Company Office #1" + }, + "documents": [ + { + "id": "494123", + "name": "Fuel Receipt Wichita" + }, + { + "id": "494123", + "name": "Fuel Receipt Wichita" + } + ], + "enRouteTime": "2006-01-02T15:04:05+07:00", + "eta": "2006-01-02T15:04:05+07:00", + "externalIds": { + "siteId": "54" + }, + "id": "324231", + "liveSharingUrl": "https://cloud.samsara.com/fleet/viewer/job/fleet_viewer_token", + "locationLiveSharingLinks": [ + { + "expiresAtTime": "2020-01-27T07:06:25Z", + "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU", + "name": "Name" + }, + { + "expiresAtTime": "2020-01-27T07:06:25Z", + "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU", + "name": "Name" + } + ], + "name": "Stop #1", + "notes": "These are my notes", + "scheduledArrivalTime": "2019-06-13T19:08:25Z", + "scheduledDepartureTime": "2019-06-13T19:08:25Z", + "singleUseLocation": { + "address": "1234 Main St, San Jose, CA", + "latitude": 123.456, + "longitude": 37.459 + }, + "skippedTime": "2006-01-02T15:04:05+07:00", + "state": "scheduled" + }, + { + "actualArrivalTime": "2006-01-02T15:04:05+07:00", + "actualDepartureTime": "2006-01-02T15:04:05+07:00", + "address": { + "externalIds": { + "siteId": "54" + }, + "id": "494123", + "name": "Company Office #1" + }, + "documents": [ + { + "id": "494123", + "name": "Fuel Receipt Wichita" + }, + { + "id": "494123", + "name": "Fuel Receipt Wichita" + } + ], + "enRouteTime": "2006-01-02T15:04:05+07:00", + "eta": "2006-01-02T15:04:05+07:00", + "externalIds": { + "siteId": "54" + }, + "id": "324231", + "liveSharingUrl": "https://cloud.samsara.com/fleet/viewer/job/fleet_viewer_token", + "locationLiveSharingLinks": [ + { + "expiresAtTime": "2020-01-27T07:06:25Z", + "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU", + "name": "Name" + }, + { + "expiresAtTime": "2020-01-27T07:06:25Z", + "liveSharingUrl": "https://cloud.samsara.com/o/123456/fleet/viewer/address/gEAitEnnOwcv92cuPzcU", + "name": "Name" + } + ], + "name": "Stop #1", + "notes": "These are my notes", + "scheduledArrivalTime": "2019-06-13T19:08:25Z", + "scheduledDepartureTime": "2019-06-13T19:08:25Z", + "singleUseLocation": { + "address": "1234 Main St, San Jose, CA", + "latitude": 123.456, + "longitude": 37.459 + }, + "skippedTime": "2006-01-02T15:04:05+07:00", + "state": "scheduled" + } + ] + }, + "routeStopDetails": { + "actualArrivalTime": "2006-01-02T15:04:05+07:00", + "actualDepartureTime": "2006-01-02T15:04:05+07:00", + "enRouteTime": "2006-01-02T15:04:05+07:00", + "eta": "2006-01-02T15:04:05+07:00", + "externalIds": { + "siteId": "54" + }, + "id": "141414", + "liveSharingUrl": "https://cloud.samsara.com/fleet/viewer/job/fleet_viewer_token", + "skippedTime": "2006-01-02T15:04:05+07:00", + "state": "scheduled" + }, + "time": "2020-01-27T07:06:25Z", + "type": "route tracking", + "vehicle": { + "assetType": "vehicle", + "externalIds": { + "maintenanceId": "250020" + }, + "gateway": { + "model": "VG34", + "serial": "GFRV-43N-VGX" + }, + "id": "494123", + "licensePlate": "6SAM123", + "name": "Fleet Truck #1", + "vin": "1GBJ6P1B2HV112765" + } + } +} \ No newline at end of file diff --git a/components/signpath/package.json b/components/signpath/package.json new file mode 100644 index 0000000000000..df795c54de4e1 --- /dev/null +++ b/components/signpath/package.json @@ -0,0 +1,15 @@ +{ + "name": "@pipedream/signpath", + "version": "0.0.1", + "description": "Pipedream SignPath Components", + "main": "signpath.app.mjs", + "keywords": [ + "pipedream", + "signpath" + ], + "homepage": "https://pipedream.com/apps/signpath", + "author": "Pipedream (https://pipedream.com/)", + "publishConfig": { + "access": "public" + } +} \ No newline at end of file diff --git a/components/signpath/signpath.app.mjs b/components/signpath/signpath.app.mjs new file mode 100644 index 0000000000000..9163956c87574 --- /dev/null +++ b/components/signpath/signpath.app.mjs @@ -0,0 +1,11 @@ +export default { + type: "app", + app: "signpath", + 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/transifex/package.json b/components/transifex/package.json new file mode 100644 index 0000000000000..c518023c0dedd --- /dev/null +++ b/components/transifex/package.json @@ -0,0 +1,15 @@ +{ + "name": "@pipedream/transifex", + "version": "0.0.1", + "description": "Pipedream Transifex Components", + "main": "transifex.app.mjs", + "keywords": [ + "pipedream", + "transifex" + ], + "homepage": "https://pipedream.com/apps/transifex", + "author": "Pipedream (https://pipedream.com/)", + "publishConfig": { + "access": "public" + } +} \ No newline at end of file diff --git a/components/transifex/transifex.app.mjs b/components/transifex/transifex.app.mjs new file mode 100644 index 0000000000000..9f45fbaedd4ea --- /dev/null +++ b/components/transifex/transifex.app.mjs @@ -0,0 +1,11 @@ +export default { + type: "app", + app: "transifex", + propDefinitions: {}, + methods: { + // this.$auth contains connected account data + authKeys() { + console.log(Object.keys(this.$auth)); + }, + }, +}; \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 34679d91049ab..57fb5205736a3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -155,7 +155,10 @@ importers: specifiers: {} components/acymailing: - specifiers: {} + specifiers: + '@pipedream/platform': ^2.0.0 + dependencies: + '@pipedream/platform': 2.0.0 components/adafruit_io: specifiers: {} @@ -7261,7 +7264,10 @@ importers: '@pipedream/platform': 1.5.1 components/repliq: - specifiers: {} + specifiers: + '@pipedream/platform': ^2.0.0 + dependencies: + '@pipedream/platform': 2.0.0 components/reply_io: specifiers: @@ -7583,7 +7589,10 @@ importers: specifiers: {} components/samsara: - specifiers: {} + specifiers: + '@pipedream/platform': ^2.0.0 + dependencies: + '@pipedream/platform': 2.0.0 components/sapling: specifiers: {} @@ -8102,6 +8111,9 @@ importers: components/signaturit: specifiers: {} + components/signpath: + specifiers: {} + components/signrequest: specifiers: {} @@ -9200,6 +9212,9 @@ importers: dependencies: '@pipedream/platform': 1.5.1 + components/transifex: + specifiers: {} + components/transistor_fm: specifiers: '@pipedream/platform': ^1.1.1