diff --git a/components/cloze/actions/create-update-company/create-update-company.mjs b/components/cloze/actions/create-update-company/create-update-company.mjs index 06ed206a4bdfd..beccfab11c52c 100644 --- a/components/cloze/actions/create-update-company/create-update-company.mjs +++ b/components/cloze/actions/create-update-company/create-update-company.mjs @@ -1,3 +1,6 @@ +/* eslint-disable pipedream/props-description */ +/* eslint-disable pipedream/props-label */ +import { ConfigurationError } from "@pipedream/platform"; import app from "../../cloze.app.mjs"; import utils from "../../common/utils.mjs"; @@ -5,10 +8,15 @@ export default { key: "cloze-create-update-company", name: "Create Or Update Company", description: "Create a new company or enhance an existing company within Cloze. Companies can be created with just a domain name or both a name and another unique identifier such as a phone number and email address. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Companies/post_v1_companies_create).", - version: "0.0.1", + version: "0.0.2", type: "action", props: { app, + alert: { + type: "alert", + alertType: "info", + content: "Companies can be created with just a domain name, or both a name and another unique identifier such as a phone number and email address.", + }, name: { type: "string", label: "Company Name", @@ -127,6 +135,10 @@ export default { additionalData, } = this; + if (!name && !domains) { + throw new ConfigurationError("Either **Company Name** or **Domains** are required."); + } + const response = await createCompany({ $, data: { diff --git a/components/cloze/package.json b/components/cloze/package.json index 6c94bb0443f38..f7f7742e2654f 100644 --- a/components/cloze/package.json +++ b/components/cloze/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/cloze", - "version": "0.1.0", + "version": "0.1.1", "description": "Pipedream Cloze Components", "main": "cloze.app.mjs", "keywords": [ diff --git a/components/cloze/sources/common/webhook.mjs b/components/cloze/sources/common/webhook.mjs index 5ff0146bcff6f..c6d66871dfd5b 100644 --- a/components/cloze/sources/common/webhook.mjs +++ b/components/cloze/sources/common/webhook.mjs @@ -13,7 +13,7 @@ export default { scope: { type: "string", label: "Scope", - description: "Scope of subscription, changes to the user's local person, project, and company may be monitored, or team relations may be monitored, or team hierarchies can be monitored. Can be `local`, `team`, `hierarchy:/X/Y/Z` or `hierarchy:/X/Y/Z/*`", + description: "Scope of subscription.", options: [ "local", "team", diff --git a/components/cloze/sources/company-change-instant/company-change-instant.mjs b/components/cloze/sources/company-change-instant/company-change-instant.mjs index 416e3fa5c8f4b..dcbb4d2b565bd 100644 --- a/components/cloze/sources/company-change-instant/company-change-instant.mjs +++ b/components/cloze/sources/company-change-instant/company-change-instant.mjs @@ -7,7 +7,7 @@ export default { key: "cloze-company-change-instant", name: "Company Change (Instant)", description: "Emit new event when significant changes regarding a company are detected. [See the documentation](https://api.cloze.com/api-docs/#!/Webhooks/post_v1_subscribe).", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { @@ -16,10 +16,15 @@ export default { return events.COMPANY_CHANGE; }, generateMeta(event) { + const { + syncKey: id, + lastChanged: ts, + } = event.company; + return { - id: event?.company.syncKey, + id: `${id}-${ts}`, summary: "New Company Change", - ts: event?.company.lastChanged, + ts, }; }, }, diff --git a/components/cloze/sources/person-change-instant/person-change-instant.mjs b/components/cloze/sources/person-change-instant/person-change-instant.mjs index 7f7d88d0f0f05..2368aa55fd7d2 100644 --- a/components/cloze/sources/person-change-instant/person-change-instant.mjs +++ b/components/cloze/sources/person-change-instant/person-change-instant.mjs @@ -7,7 +7,7 @@ export default { key: "cloze-person-change-instant", name: "Person Change (Instant)", description: "Emit new event when significant changes happen to a person. [See the documentation](https://api.cloze.com/api-docs/#!/Webhooks/post_v1_subscribe).", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { @@ -16,10 +16,15 @@ export default { return events.PERSON_CHANGE; }, generateMeta(event) { + const { + syncKey: id, + lastChanged: ts, + } = event.person; + return { - id: event?.person.syncKey, + id: `${id}-${ts}`, summary: "New Person Change", - ts: event?.person.lastChanged, + ts, }; }, }, diff --git a/components/cloze/sources/project-change-instant/project-change-instant.mjs b/components/cloze/sources/project-change-instant/project-change-instant.mjs index d787091b2e2b9..a84485a53072c 100644 --- a/components/cloze/sources/project-change-instant/project-change-instant.mjs +++ b/components/cloze/sources/project-change-instant/project-change-instant.mjs @@ -7,7 +7,7 @@ export default { key: "cloze-project-change-instant", name: "Project Change (Instant)", description: "Emit new event when a significant change occurs in a project. [See the documentation](https://api.cloze.com/api-docs/#!/Webhooks/post_v1_subscribe).", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", methods: { @@ -16,10 +16,15 @@ export default { return events.PROJECT_CHANGE; }, generateMeta(event) { + const { + syncKey: id, + lastChanged: ts, + } = event.project; + return { - id: event?.project.syncKey, + id: `${id}-${ts}`, summary: "New Project Change", - ts: event?.project.lastChanged, + ts, }; }, },