Skip to content

Commit 2d0edfe

Browse files
authored
Adding native support to hubspot (#117)
1 parent 818e982 commit 2d0edfe

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vesselapi/integrations",
3-
"version": "0.0.84",
3+
"version": "0.0.85",
44
"description": "Vessel integrations",
55
"main": "dist/index.js",
66
"module": "dist/index.mjs",

src/platforms/hubspot/client.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ const makeClient = () => {
134134
hs_timestamp: properties?.includes('hs_timestamp')
135135
? new Date().toISOString()
136136
: undefined,
137-
...shake(body),
137+
...shake(omit(body, ['$native'])),
138+
...(body.$native ? body.$native : {}),
138139
}),
139140
},
140141
}));
@@ -148,7 +149,10 @@ const makeClient = () => {
148149
method: 'PATCH',
149150
schema,
150151
json: {
151-
properties: shake(omit(body, ['id'])),
152+
properties: {
153+
...shake(omit(body, ['id', '$native'])),
154+
...(body.$native ? body.$native : {}),
155+
},
152156
},
153157
}));
154158

src/platforms/hubspot/schemas.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ export const hubspotContactUpsertSchema = z
145145
mobilephone: z.string(),
146146
company: z.string().optional(),
147147
hubspot_owner_id: z.string().optional(),
148+
$native: z.any(),
148149
})
149-
.partial()
150-
.passthrough();
150+
.partial();
151151
export type HubspotContactCreate = z.infer<typeof hubspotContactUpsertSchema>;
152152
export type HubspotContactUpdate = z.infer<
153153
typeof hubspotContactUpsertSchema
@@ -183,6 +183,7 @@ export const hubspotDealUpsertSchema = z
183183
closedate: custom.date(),
184184
hs_deal_stage_probability: z.string(),
185185
dealstage: z.string().optional(),
186+
$native: z.any(),
186187
})
187188
.partial();
188189
export type HubspotDealCreate = z.infer<typeof hubspotDealUpsertSchema>;
@@ -233,6 +234,7 @@ export const hubspotCompanyUpsertSchema = z
233234
description: z.string(),
234235
phone: z.string(),
235236
hubspot_owner_id: z.string(),
237+
$native: z.any(),
236238
})
237239
.partial();
238240
export type HubspotCompanyCreate = z.infer<typeof hubspotCompanyUpsertSchema>;
@@ -262,6 +264,7 @@ export const hubspotNoteUpsertSchema = z
262264
hs_note_body: z.string(),
263265
hubspot_owner_id: z.string(),
264266
hs_timestamp: z.string().optional(),
267+
$native: z.any(),
265268
})
266269
.partial();
267270
export type HubspotNoteUpdate = z.infer<typeof hubspotNoteUpsertSchema> & {
@@ -297,6 +300,7 @@ export const hubspotTaskUpsertSchema = z
297300
hs_task_priority: z.string(),
298301
hs_timestamp: z.string().optional(),
299302
hubspot_owner_id: z.string(),
303+
$native: z.any(),
300304
})
301305
.partial();
302306
export type HubspotTaskUpdate = z.infer<typeof hubspotTaskUpsertSchema> & {
@@ -335,6 +339,7 @@ export const hubspotMeetingUpsertSchema = z
335339
hs_meeting_start_time: z.string(),
336340
hs_meeting_end_time: z.string(),
337341
hubspot_owner_id: z.string(),
342+
$native: z.any(),
338343
})
339344
.partial();
340345
export type HubspotMeetingUpdate = z.infer<

0 commit comments

Comments
 (0)