Skip to content

Commit 0575346

Browse files
committed
add useQuery to relevant props
1 parent 27daacf commit 0575346

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed

components/hubspot/actions/common/common-create.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,12 @@ export default {
7373
async makePropDefinition(property, requiredProperties) {
7474
let type = "string";
7575
let options = this.makeLabelValueOptions(property);
76+
let useQuery;
7677

7778
if (property.referencedObjectType) {
7879
const objectTypeName = this.hubspot.getObjectTypeName(property.referencedObjectType);
7980
options = getOptionsMethod(objectTypeName);
81+
useQuery = true;
8082
}
8183

8284
if (property.name === "hs_timestamp") {
@@ -109,6 +111,7 @@ export default {
109111
optional: !requiredProperties.includes(property.name),
110112
options,
111113
reloadProps,
114+
useQuery,
112115
};
113116
},
114117
},

components/hubspot/actions/common/common-get-object.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default {
1717
type: "string",
1818
label: "Object ID",
1919
description: "Hubspot's internal ID for the object",
20+
useQuery: true,
2021
async options(opts) {
2122
return this.hubspot.createOptions(this.getObjectType(), opts);
2223
},

components/hubspot/hubspot.app.mjs

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export default {
116116
type: "string",
117117
label: "Object ID",
118118
description: "Hubspot's internal ID for the contact",
119+
useQuery: true,
119120
async options({
120121
objectType, ...opts
121122
}) {
@@ -128,6 +129,7 @@ export default {
128129
type: "string[]",
129130
label: "Object",
130131
description: "Watch for new events concerning the objects selected.",
132+
useQuery: true,
131133
async options({
132134
objectType, ...opts
133135
}) {
@@ -195,12 +197,21 @@ export default {
195197
type: "string",
196198
label: "Contact Email",
197199
description: "Note - this needs to be a contact that already exists within HubSpot. You may need to add a Create or Update Contact step before this one. Then, use the email created in that step in this field.",
198-
async options({ prevContext }) {
200+
useQuery: true,
201+
async options({
202+
prevContext, query,
203+
}) {
199204
const { nextAfter } = prevContext;
200205
const {
201206
results: contacts,
202207
paging,
203-
} = await this.listObjectsInPage("contacts", nextAfter);
208+
} = await this.searchCRM({
209+
object: "contacts",
210+
data: {
211+
after: nextAfter,
212+
query,
213+
},
214+
});
204215
return {
205216
options: contacts
206217
.filter(({ properties }) => properties.email)
@@ -423,9 +434,16 @@ export default {
423434
type: "string",
424435
label: "Lead ID",
425436
description: "The identifier of the lead",
426-
async options() {
427-
const { results } = await this.listObjectsInPage("lead", undefined, {
428-
properties: "hs_lead_name",
437+
useQuery: true,
438+
async options({ query }) {
439+
const { results } = await this.searchCRM({
440+
object: "lead",
441+
data: {
442+
properties: [
443+
"hs_lead_name",
444+
],
445+
query,
446+
},
429447
});
430448
return results?.map(({
431449
id: value, properties,
@@ -811,6 +829,7 @@ export default {
811829
const {
812830
prevContext,
813831
page,
832+
query,
814833
} = opts;
815834
const { nextAfter } = prevContext;
816835
if (page !== 0 && !nextAfter) {
@@ -819,7 +838,13 @@ export default {
819838
const {
820839
paging,
821840
results,
822-
} = await this.listObjectsInPage(referencedObjectType, nextAfter);
841+
} = await this.searchCRM({
842+
object: referencedObjectType,
843+
data: {
844+
query,
845+
after: nextAfter,
846+
},
847+
});
823848
return {
824849
options: results.map((object) => ({
825850
label: this.getObjectLabel(object, referencedObjectType) ?? object.id,

components/hubspot/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/hubspot",
3-
"version": "1.7.14",
3+
"version": "1.7.15",
44
"description": "Pipedream Hubspot Components",
55
"main": "hubspot.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)