Skip to content

Commit 4a47476

Browse files
authored
fix: outreach custom field validation error throws (#245)
1 parent 65fc396 commit 4a47476

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
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": "1.0.33",
3+
"version": "1.0.34",
44
"description": "Vessel integrations",
55
"main": "dist/index.js",
66
"module": "dist/index.mjs",

src/platforms/outreach/actions/prospects/create.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ export default action(
3535
schema: z.object({
3636
attributes: z
3737
.preprocess((input) => {
38-
const attributes = attributesSchema.parse(input);
39-
const customFields = customFieldsSchema.parse(
40-
omit(input as any, Object.keys(attributes)),
41-
);
38+
const attributes = attributesSchema.safeParse(input);
39+
40+
if (!attributes.success) {
41+
return input;
42+
}
43+
44+
const customFields = omit(input as any, Object.keys(attributes.data));
45+
4246
return { customFields, ...attributes };
4347
}, attributesSchema.extend({ customFields: customFieldsSchema }))
4448
.transform((attr) => ({

src/platforms/outreach/actions/prospects/update.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ export default action(
3535
id: z.number(),
3636
attributes: z
3737
.preprocess((input) => {
38-
const attributes = attributesSchema.parse(input);
39-
const customFields = customFieldsSchema.parse(
40-
omit(input as any, Object.keys(attributes)),
41-
);
38+
const attributes = attributesSchema.safeParse(input);
39+
40+
if (!attributes.success) {
41+
return input;
42+
}
43+
44+
const customFields = omit(input as any, Object.keys(attributes.data));
45+
4246
return { customFields, ...attributes };
4347
}, attributesSchema.extend({ customFields: customFieldsSchema }))
4448
.transform((attr) => ({

0 commit comments

Comments
 (0)