Skip to content

Commit

Permalink
fix: Outreach template schema (#235)
Browse files Browse the repository at this point in the history
* fix schema

* version bump

* fix template types

* fix template schema... again

* fix outreach formatting

* revert bad formatting

* version fix
  • Loading branch information
zkirby authored Jul 15, 2023
1 parent c345482 commit ebe1687
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vesselapi/integrations",
"version": "1.0.24",
"version": "1.0.25",
"description": "Vessel integrations",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
1 change: 1 addition & 0 deletions src/platforms/outreach/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ export const client = {
schema: z.intersection(
z.object({
data: z.array(outreachSequenceTemplate),
included: z.array(outreachTemplate).optional(),
}),
outreachPaginatedResponse,
),
Expand Down
24 changes: 15 additions & 9 deletions src/platforms/outreach/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@ import { z } from 'zod';

const outreachRelationship = z.object({
data: z.object({
id: z.string(),
id: z.string().or(z.number()),
}),
});
const outreachMultiRelationship = z.object({
data: z.array(
z.object({
id: z.string().or(z.number()),
}),
),
});
export const outreachPaginatedResponse = z.object({
links: z
.object({
next: z.string().nullish(),
})

.nullish(),
});

Expand Down Expand Up @@ -170,14 +176,14 @@ export const outreachSequenceStep = custom.object({
positiveReplyCount: z.number().nullable(),
replyCount: z.number().nullable(),
scheduleCount: z.number().nullable(),
stepType: z.string().nullable(),
stepType: z.string(),
taskAutoskipDelay: z.number().nullable(),
taskNote: z.string().nullable(),
updatedAt: custom.date().nullable(),
}),
relationships: z.object({
sequence: outreachRelationship.nullable(),
sequenceTemplates: outreachRelationship.nullable(),
sequenceTemplates: outreachMultiRelationship.nullable(),
}),
});

Expand All @@ -186,11 +192,11 @@ export const outreachTemplate = custom.object({
attributes: z.object({
archived: z.boolean().nullable(),
archivedAt: custom.date().nullable(),
bccRecipients: z.string().nullable(),
bccRecipients: z.array(z.string()).nullable(),
bodyHtml: z.string().nullable(),
bodyText: z.string().nullable(),
bounceCount: z.number().nullable(),
ccRecipients: z.string().nullable(),
ccRecipients: z.array(z.string()).nullable(),
clickCount: z.number().nullable(),
createdAt: custom.date().nullable(),
deliverCount: z.number().nullable(),
Expand All @@ -206,8 +212,8 @@ export const outreachTemplate = custom.object({
scheduleCount: z.number().nullable(),
shareType: z.string().nullable(),
subject: z.string().nullable(),
tags: z.string().nullable(),
toRecipients: z.string().nullable(),
tags: z.array(z.string()).nullable(),
toRecipients: z.array(z.string()).nullable(),
trackLinks: z.boolean().nullable(),
trackOpens: z.boolean().nullable(),
updatedAt: custom.date().nullable(),
Expand Down Expand Up @@ -235,7 +241,7 @@ export const outreachSequenceTemplate = custom.object({
updatedAt: custom.date().nullable(),
}),
relationships: z.object({
template: outreachTemplate.nullable(),
template: outreachRelationship.nullable(),
}),
});

Expand Down

0 comments on commit ebe1687

Please sign in to comment.