Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/boldsign/boldsign.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/calllerapi/calllerapi.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
File renamed without changes.
15 changes: 14 additions & 1 deletion components/hubspot/actions/common/common-create-object.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default {
propertyGroups: {
type: "string[]",
label: "Property Groups",
hidden: true,
reloadProps: true,
async options() {
const { results: groups } = await this.hubspot.getPropertyGroups({
Expand All @@ -20,6 +21,11 @@ export default {
}));
},
},
objectProperties: {
type: "object",
label: "Object Properties",
description: "Enter the object properties to create as a JSON object",
},
},
methods: {
...common.methods,
Expand All @@ -46,10 +52,17 @@ export default {
contactId,
$db,
updateIfExists,
...properties
objectProperties,
...otherProperties
} = this;
const objectType = this.getObjectType();

const properties = objectProperties
? typeof objectProperties === "string"
? JSON.parse(objectProperties)
: objectProperties
: otherProperties;

// checkbox (string[]) props must be semicolon separated strings
Object.keys(properties)
.forEach((key) => {
Expand Down
66 changes: 46 additions & 20 deletions components/hubspot/actions/common/common-create.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import hubspot from "../../hubspot.app.mjs";
import {
OBJECT_TYPE, HUBSPOT_OWNER,
} from "../../common/constants.mjs";
import appProp from "./common-app-prop.mjs";

/**
* Returns an options method for a CRM object type, intended to be used in
Expand Down Expand Up @@ -43,7 +43,7 @@ function getOptionsMethod(objectTypeName) {

export default {
props: {
hubspot,
...appProp.props,
},
methods: {
getObjectType() {
Expand Down Expand Up @@ -112,25 +112,51 @@ export default {
};
},
},
async additionalProps() {
async additionalProps(existingProps) {
const objectType = this.getObjectType();
const schema = await this.hubspot.getSchema({
objectType,
});
const { results: properties } = await this.hubspot.getProperties({
objectType,
});
const relevantProperties = properties.filter(this.isRelevantProperty);
const propDefinitions = [];
for (const property of relevantProperties) {
propDefinitions.push(await this.makePropDefinition(property, schema.requiredProperties));
try {
const schema = await this.hubspot.getSchema({
objectType,
});
const { results: properties } = await this.hubspot.getProperties({
objectType,
});
const relevantProperties = properties.filter(this.isRelevantProperty);

const propDefinitions = [];
if (this.propertyGroups && !relevantProperties?.length) {
propDefinitions.push({
type: "alert",
alertType: "info",
name: "infoAlert",
content: `No writable properties found for Property Group(s): ${this.propertyGroups.join(", ")}`,
});
}

for (const property of relevantProperties) {
propDefinitions.push(await this.makePropDefinition(property, schema.requiredProperties));
}

if (existingProps.objectProperties) {
existingProps.objectProperties.hidden = true;
existingProps.objectProperties.optional = true;
}
if (existingProps.propertyGroups) {
existingProps.propertyGroups.hidden = false;
}

return propDefinitions
.reduce((props, {
name, ...definition
}) => {
props[name] = definition;
return props;
}, {});
} catch {
if (existingProps.propertyGroups) {
existingProps.propertyGroups.optional = true;
}
return {};
}
return propDefinitions
.reduce((props, {
name, ...definition
}) => {
props[name] = definition;
return props;
}, {});
},
};
14 changes: 13 additions & 1 deletion components/hubspot/actions/common/common-update-object.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export default {
}));
},
},
objectProperties: {
type: "object",
label: "Object Properties",
description: "Enter the object properties to update as a JSON object",
},
},
methods: {
...common.methods,
Expand All @@ -35,10 +40,17 @@ export default {
customObjectType,
$db,
objectId,
...properties
objectProperties,
...otherProperties
} = this;
const objectType = this.getObjectType();

const properties = objectProperties
? typeof objectProperties === "string"
? JSON.parse(objectProperties)
: objectProperties
: otherProperties;

// checkbox (string[]) props must be semicolon separated strings
Object.keys(properties)
.forEach((key) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import common from "../common/common-create.mjs";
import appProp from "./common-app-prop.mjs";
import appProp from "../common/common-app-prop.mjs";
import { ConfigurationError } from "@pipedream/platform";
import { ASSOCIATION_CATEGORY } from "../../common/constants.mjs";

Expand All @@ -8,7 +8,7 @@ export default {
key: "hubspot-create-communication",
name: "Create Communication",
description: "Create a WhatsApp, LinkedIn, or SMS message. [See the documentation](https://developers.hubspot.com/beta-docs/reference/api/crm/engagements/communications/v3#post-%2Fcrm%2Fv3%2Fobjects%2Fcommunications)",
version: "0.0.3",
version: "0.0.4",
type: "action",
props: {
...appProp.props,
Expand Down Expand Up @@ -45,6 +45,11 @@ export default {
description: "A unique identifier to indicate the association type between the communication and the other object",
optional: true,
},
objectProperties: {
type: "object",
label: "Object Properties",
description: "Enter the `communication` properties as a JSON object",
},
},
methods: {
...common.methods,
Expand All @@ -60,13 +65,20 @@ export default {
toObjectId,
associationType,
getObjectType,
...properties
objectProperties,
...otherProperties
} = this;

if ((toObjectId && !associationType) || (!toObjectId && associationType)) {
throw new ConfigurationError("Both `toObjectId` and `associationType` must be entered");
}

const properties = objectProperties
? typeof objectProperties === "string"
? JSON.parse(objectProperties)
: objectProperties
: otherProperties;

const response = await hubspot.createObject({
$,
objectType: getObjectType(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-company",
name: "Create Company",
description: "Create a company in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/companies#endpoint?spec=POST-/crm/v3/objects/companies)",
version: "0.0.14",
version: "0.0.15",
type: "action",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import hubspot from "../../hubspot.app.mjs";
import common from "../common/common-create-object.mjs";
import appProp from "../common/common-app-prop.mjs";

export default {
...common,
key: "hubspot-create-custom-object",
name: "Create Custom Object",
description: "Create a new custom object in Hubspot. [See the documentation](https://developers.hubspot.com/beta-docs/guides/api/crm/objects/custom-objects#create-a-custom-object)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
hubspot,
...appProp.props,
customObjectType: {
propDefinition: [
hubspot,
appProp.props.hubspot,
"customObjectType",
],
},
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/create-deal/create-deal.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-deal",
name: "Create Deal",
description: "Create a deal in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/deals#endpoint?spec=POST-/crm/v3/objects/deals)",
version: "0.0.14",
version: "0.0.15",
type: "action",
props: {
...common.props,
Expand Down
16 changes: 14 additions & 2 deletions components/hubspot/actions/create-engagement/create-engagement.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
key: "hubspot-create-engagement",
name: "Create Engagement",
description: "Create a new engagement for a contact. [See the documentation](https://developers.hubspot.com/docs/api/crm/engagements)",
version: "0.0.13",
version: "0.0.14",
type: "action",
props: {
...common.props,
Expand Down Expand Up @@ -53,6 +53,11 @@ export default {
description: "A unique identifier to indicate the association type between the task and the other object",
optional: true,
},
objectProperties: {
type: "object",
label: "Object Properties",
description: "Enter the `engagement` properties as a JSON object",
},
},
methods: {
...common.methods,
Expand Down Expand Up @@ -82,13 +87,20 @@ export default {
toObjectId,
associationType,
$db,
...properties
objectProperties,
...otherProperties
} = this;

if ((toObjectId && !associationType) || (!toObjectId && associationType)) {
throw new ConfigurationError("Both `toObjectId` and `associationType` must be entered");
}

const properties = objectProperties
? typeof objectProperties === "string"
? JSON.parse(objectProperties)
: objectProperties
: otherProperties;

const objectType = this.getObjectType();

const associations = toObjectId
Expand Down
8 changes: 4 additions & 4 deletions components/hubspot/actions/create-lead/create-lead.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import {
OBJECT_TYPE, ASSOCIATION_CATEGORY,
} from "../../common/constants.mjs";
import common from "../common/common-create-object.mjs";
import hubspot from "../../hubspot.app.mjs";
import appProp from "../common/common-app-prop.mjs";

export default {
...common,
key: "hubspot-create-lead",
name: "Create Lead",
description: "Create a lead in Hubspot. [See the documentation](https://developers.hubspot.com/beta-docs/guides/api/crm/objects/leads#create-leads)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
hubspot,
...appProp.props,
contactId: {
propDefinition: [
hubspot,
appProp.props.hubspot,
"objectId",
() => ({
objectType: "contact",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-or-update-contact",
name: "Create or Update Contact",
description: "Create or update a contact in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/contacts#endpoint?spec=POST-/crm/v3/objects/contacts)",
version: "0.0.12",
version: "0.0.13",
type: "action",
props: {
...common.props,
Expand Down
2 changes: 1 addition & 1 deletion components/hubspot/actions/create-ticket/create-ticket.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "hubspot-create-ticket",
name: "Create Ticket",
description: "Create a ticket in Hubspot. [See the documentation](https://developers.hubspot.com/docs/api/crm/tickets)",
version: "0.0.5",
version: "0.0.6",
type: "action",
props: {
...common.props,
Expand Down
Loading
Loading