diff --git a/flows.yaml b/flows.yaml index 822629ab..3f3b6b67 100644 --- a/flows.yaml +++ b/flows.yaml @@ -1,4 +1,39 @@ integrations: + aircall-basic: + actions: + create-user: + description: Creates a user in Aircall. + output: User + endpoint: POST /users + input: CreateUser + delete-user: + description: Deletes a user in Aircall + endpoint: DELETE /users + output: SuccessResponse + input: IdEntity + syncs: + users: + runs: every day + description: | + Fetches a list of users from Aircall. + output: User + track_deletes: true + sync_type: full + endpoint: GET /users + models: + SuccessResponse: + success: boolean + IdEntity: + id: string + User: + id: string + email: string + firstName: string + lastName: string + CreateUser: + firstName: string + lastName: string + email: string airtable: syncs: tables: @@ -1996,7 +2031,7 @@ integrations: description?: string ExactInvoiceCreateInput: customerId: string - journal: number + journal?: number currency?: EUR description?: string createdAt?: date diff --git a/integrations/aircall-basic/actions/create-user.ts b/integrations/aircall-basic/actions/create-user.ts new file mode 100644 index 00000000..485efe78 --- /dev/null +++ b/integrations/aircall-basic/actions/create-user.ts @@ -0,0 +1,43 @@ +import type { NangoAction, ProxyConfiguration, CreateUser, User } from '../../models'; +import { createUserSchema } from '../schema.zod.js'; +import type { AircallUser } from '../types'; + +export default async function runAction(nango: NangoAction, input: CreateUser): Promise { + const parsedInput = createUserSchema.safeParse(input); + + if (!parsedInput.success) { + for (const error of parsedInput.error.errors) { + await nango.log(`Invalid input provided to create a user: ${error.message} at path ${error.path.join('.')}`, { level: 'error' }); + } + throw new nango.ActionError({ + message: 'Invalid input provided to create a user' + }); + } + + const aInput = { + email: input.email, + first_name: input.firstName, + last_name: input.lastName + }; + + const config: ProxyConfiguration = { + // https://developer.aircall.io/api-references/#create-a-user + endpoint: '/v1/users', + data: aInput, + retries: 10 + }; + + const response = await nango.post<{ user: AircallUser }>(config); + + const { data } = response; + + const [firstName, lastName] = data.user.name.split(' '); + const user: User = { + id: data.user.id.toString(), + email: data.user.email, + firstName: firstName || '', + lastName: lastName || '' + }; + + return user; +} diff --git a/integrations/aircall-basic/actions/delete-user.ts b/integrations/aircall-basic/actions/delete-user.ts new file mode 100644 index 00000000..2d6a77c2 --- /dev/null +++ b/integrations/aircall-basic/actions/delete-user.ts @@ -0,0 +1,21 @@ +import type { NangoAction, ProxyConfiguration, SuccessResponse, IdEntity } from '../../models'; + +export default async function runAction(nango: NangoAction, input: IdEntity): Promise { + if (!input || !input.id) { + throw new nango.ActionError({ + message: 'Id is required' + }); + } + + const config: ProxyConfiguration = { + // https://developer.aircall.io/api-references/#delete-a-user + endpoint: `/v1/users/${input.id}`, + retries: 10 + }; + + await nango.delete(config); + + return { + success: true + }; +} diff --git a/integrations/aircall-basic/fixtures/create-user.json b/integrations/aircall-basic/fixtures/create-user.json new file mode 100644 index 00000000..37169069 --- /dev/null +++ b/integrations/aircall-basic/fixtures/create-user.json @@ -0,0 +1,5 @@ +{ + "firstName": "John", + "lastName": "Doe", + "email": "johndoe@test.dev" +} diff --git a/integrations/aircall-basic/mocks/create-user/input.json b/integrations/aircall-basic/mocks/create-user/input.json new file mode 100644 index 00000000..37169069 --- /dev/null +++ b/integrations/aircall-basic/mocks/create-user/input.json @@ -0,0 +1,5 @@ +{ + "firstName": "John", + "lastName": "Doe", + "email": "johndoe@test.dev" +} diff --git a/integrations/aircall-basic/mocks/create-user/output.json b/integrations/aircall-basic/mocks/create-user/output.json new file mode 100644 index 00000000..a771ce2f --- /dev/null +++ b/integrations/aircall-basic/mocks/create-user/output.json @@ -0,0 +1,6 @@ +{ + "id": "1435616", + "email": "johndoe@test.dev", + "firstName": "John", + "lastName": "Doe" +} diff --git a/integrations/aircall-basic/mocks/delete-user/input.json b/integrations/aircall-basic/mocks/delete-user/input.json new file mode 100644 index 00000000..11832566 --- /dev/null +++ b/integrations/aircall-basic/mocks/delete-user/input.json @@ -0,0 +1,3 @@ +{ + "id": "1435616" +} diff --git a/integrations/aircall-basic/mocks/delete-user/output.json b/integrations/aircall-basic/mocks/delete-user/output.json new file mode 100644 index 00000000..33c0c847 --- /dev/null +++ b/integrations/aircall-basic/mocks/delete-user/output.json @@ -0,0 +1,3 @@ +{ + "success": true +} diff --git a/integrations/aircall-basic/mocks/nango/delete/proxy/v1/users/1435616/delete-user.json b/integrations/aircall-basic/mocks/nango/delete/proxy/v1/users/1435616/delete-user.json new file mode 100644 index 00000000..e16c76df --- /dev/null +++ b/integrations/aircall-basic/mocks/nango/delete/proxy/v1/users/1435616/delete-user.json @@ -0,0 +1 @@ +"" diff --git a/integrations/aircall-basic/mocks/nango/get/proxy/v1/users/users.json b/integrations/aircall-basic/mocks/nango/get/proxy/v1/users/users.json new file mode 100644 index 00000000..0bf65829 --- /dev/null +++ b/integrations/aircall-basic/mocks/nango/get/proxy/v1/users/users.json @@ -0,0 +1,38 @@ +{ + "users": [ + { + "id": 1434499, + "direct_link": "https://api.aircall.io/v1/users/1434499", + "name": "Johnny Doeseph", + "email": "johnny@some-company.com", + "available": false, + "availability_status": "available", + "created_at": "2024-10-25T12:59:36.000Z", + "time_zone": "Etc/UTC", + "language": "en-US", + "state": "always_opened", + "wrap_up_time": 0 + }, + { + "id": 1435616, + "direct_link": "https://api.aircall.io/v1/users/1435616", + "name": "John Doe", + "email": "johndoe@test.dev", + "available": false, + "availability_status": "available", + "created_at": "2024-10-28T09:24:52.000Z", + "time_zone": "Etc/UTC", + "language": "en-US", + "state": "always_opened", + "wrap_up_time": 0 + } + ], + "meta": { + "count": 2, + "total": 2, + "current_page": 1, + "per_page": 20, + "next_page_link": null, + "previous_page_link": null + } +} diff --git a/integrations/aircall-basic/mocks/nango/post/proxy/v1/users/create-user.json b/integrations/aircall-basic/mocks/nango/post/proxy/v1/users/create-user.json new file mode 100644 index 00000000..4d729572 --- /dev/null +++ b/integrations/aircall-basic/mocks/nango/post/proxy/v1/users/create-user.json @@ -0,0 +1,18 @@ +{ + "user": { + "id": 1435616, + "direct_link": "https://api.aircall.io/v1/users/1435616", + "name": "John Doe", + "email": "johndoe@test.dev", + "available": false, + "availability_status": "available", + "created_at": "2024-10-28T09:24:52.000Z", + "time_zone": "Etc/UTC", + "language": "en-US", + "state": "always_opened", + "wrap_up_time": 0, + "default_number_id": null, + "numbers": [], + "substatus": "always_opened" + } +} diff --git a/integrations/aircall-basic/mocks/users/User/batchDelete.json b/integrations/aircall-basic/mocks/users/User/batchDelete.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/integrations/aircall-basic/mocks/users/User/batchDelete.json @@ -0,0 +1 @@ +[] diff --git a/integrations/aircall-basic/mocks/users/User/batchSave.json b/integrations/aircall-basic/mocks/users/User/batchSave.json new file mode 100644 index 00000000..02b4f0fd --- /dev/null +++ b/integrations/aircall-basic/mocks/users/User/batchSave.json @@ -0,0 +1,14 @@ +[ + { + "id": "1434499", + "firstName": "Johnny", + "lastName": "Doeseph", + "email": "johnny@some-company.com" + }, + { + "id": "1435616", + "firstName": "John", + "lastName": "Doe", + "email": "johndoe@test.dev" + } +] diff --git a/integrations/aircall-basic/nango.yaml b/integrations/aircall-basic/nango.yaml new file mode 100644 index 00000000..463c9473 --- /dev/null +++ b/integrations/aircall-basic/nango.yaml @@ -0,0 +1,40 @@ +integrations: + aircall-basic: + actions: + create-user: + description: Creates a user in Aircall. + output: User + endpoint: POST /users + input: CreateUser + delete-user: + description: Deletes a user in Aircall + endpoint: DELETE /users + output: SuccessResponse + input: IdEntity + syncs: + users: + runs: every day + description: | + Fetches a list of users from Aircall. + output: User + track_deletes: true + sync_type: full + endpoint: GET /users +models: + # Generic + SuccessResponse: + success: boolean + IdEntity: + id: string + + # User + User: + id: string + email: string + firstName: string + lastName: string + + CreateUser: + firstName: string + lastName: string + email: string diff --git a/integrations/aircall-basic/schema.zod.ts b/integrations/aircall-basic/schema.zod.ts new file mode 100644 index 00000000..7a9bd7fa --- /dev/null +++ b/integrations/aircall-basic/schema.zod.ts @@ -0,0 +1,23 @@ +// Generated by ts-to-zod +import { z } from 'zod'; + +export const successResponseSchema = z.object({ + success: z.boolean() +}); + +export const idEntitySchema = z.object({ + id: z.string() +}); + +export const userSchema = z.object({ + id: z.string(), + email: z.string(), + firstName: z.string(), + lastName: z.string() +}); + +export const createUserSchema = z.object({ + firstName: z.string(), + lastName: z.string(), + email: z.string() +}); diff --git a/integrations/aircall-basic/syncs/users.ts b/integrations/aircall-basic/syncs/users.ts new file mode 100644 index 00000000..8d45433c --- /dev/null +++ b/integrations/aircall-basic/syncs/users.ts @@ -0,0 +1,29 @@ +import type { NangoSync, ProxyConfiguration, User } from '../../models'; +import type { AircallUser } from '../types'; + +export default async function fetchData(nango: NangoSync) { + const config: ProxyConfiguration = { + // https://developer.aircall.io/api-references/#list-all-users + endpoint: '/v1/users', + retries: 10, + paginate: { + response_path: 'users' + } + }; + + for await (const aUsers of nango.paginate(config)) { + const users: User[] = aUsers.map((aUser: AircallUser) => { + const [firstName, lastName] = aUser.name.split(' '); + const user: User = { + id: aUser.id.toString(), + firstName: firstName || '', + lastName: lastName || '', + email: aUser.email + }; + + return user; + }); + + await nango.batchSave(users, 'User'); + } +} diff --git a/integrations/aircall-basic/tests/aircall-basic-create-user.test.ts b/integrations/aircall-basic/tests/aircall-basic-create-user.test.ts new file mode 100644 index 00000000..f7ffe174 --- /dev/null +++ b/integrations/aircall-basic/tests/aircall-basic-create-user.test.ts @@ -0,0 +1,19 @@ +import { vi, expect, it, describe } from "vitest"; + +import runAction from "../actions/create-user.js"; + +describe("aircall-basic create-user tests", () => { + const nangoMock = new global.vitest.NangoActionMock({ + dirname: __dirname, + name: "create-user", + Model: "User" + }); + + it('should output the action output that is expected', async () => { + const input = await nangoMock.getInput(); + const response = await runAction(nangoMock, input); + const output = await nangoMock.getOutput(); + + expect(response).toEqual(output); + }); +}); diff --git a/integrations/aircall-basic/tests/aircall-basic-delete-user.test.ts b/integrations/aircall-basic/tests/aircall-basic-delete-user.test.ts new file mode 100644 index 00000000..76791a71 --- /dev/null +++ b/integrations/aircall-basic/tests/aircall-basic-delete-user.test.ts @@ -0,0 +1,19 @@ +import { vi, expect, it, describe } from "vitest"; + +import runAction from "../actions/delete-user.js"; + +describe("aircall-basic delete-user tests", () => { + const nangoMock = new global.vitest.NangoActionMock({ + dirname: __dirname, + name: "delete-user", + Model: "SuccessResponse" + }); + + it('should output the action output that is expected', async () => { + const input = await nangoMock.getInput(); + const response = await runAction(nangoMock, input); + const output = await nangoMock.getOutput(); + + expect(response).toEqual(output); + }); +}); diff --git a/integrations/aircall-basic/tests/aircall-basic-users.test.ts b/integrations/aircall-basic/tests/aircall-basic-users.test.ts new file mode 100644 index 00000000..8e3dab6a --- /dev/null +++ b/integrations/aircall-basic/tests/aircall-basic-users.test.ts @@ -0,0 +1,53 @@ +import { vi, expect, it, describe } from "vitest"; + +import fetchData from "../syncs/users.js"; + +describe("aircall-basic users tests", () => { + const nangoMock = new global.vitest.NangoSyncMock({ + dirname: __dirname, + name: "users", + Model: "User" + }); + + const models = "User".split(','); + const batchSaveSpy = vi.spyOn(nangoMock, 'batchSave'); + + it("should get, map correctly the data and batchSave the result", async () => { + await fetchData(nangoMock); + + for (const model of models) { + const batchSaveData = await nangoMock.getBatchSaveData(model); + + const totalCalls = batchSaveSpy.mock.calls.length; + + if (totalCalls > models.length) { + const splitSize = Math.ceil(batchSaveData.length / totalCalls); + + const splitBatchSaveData = []; + for (let i = 0; i < totalCalls; i++) { + const chunk = batchSaveData.slice(i * splitSize, (i + 1) * splitSize); + splitBatchSaveData.push(chunk); + } + + splitBatchSaveData.forEach((data, index) => { + // @ts-ignore + expect(batchSaveSpy?.mock.calls[index][0]).toEqual(data); + }); + + } else { + expect(nangoMock.batchSave).toHaveBeenCalledWith(batchSaveData, model); + } + } + }); + + it('should get, map correctly the data and batchDelete the result', async () => { + await fetchData(nangoMock); + + for (const model of models) { + const batchDeleteData = await nangoMock.getBatchDeleteData(model); + if (batchDeleteData && batchDeleteData.length > 0) { + expect(nangoMock.batchDelete).toHaveBeenCalledWith(batchDeleteData, model); + } + } + }); +}); diff --git a/integrations/aircall-basic/types.ts b/integrations/aircall-basic/types.ts new file mode 100644 index 00000000..be9174ff --- /dev/null +++ b/integrations/aircall-basic/types.ts @@ -0,0 +1,13 @@ +export interface AircallUser { + id: number; + direct_link: string; + name: string; + email: string; + available: boolean; + availability_status: 'available' | 'unavailable' | 'offline'; + created_at: string; + time_zone: string; + language: string; + substatus: 'always_opened' | 'closed' | 'away'; + wrap_up_time: number; +} diff --git a/integrations/airtable/schema.zod.ts b/integrations/airtable/schema.zod.ts index 3cd7957d..73c1d93b 100644 --- a/integrations/airtable/schema.zod.ts +++ b/integrations/airtable/schema.zod.ts @@ -2,7 +2,7 @@ import { z } from 'zod'; export const successResponseSchema = z.object({ - response: z.boolean() + success: z.boolean() }); export const tableViewSchema = z.object({ diff --git a/integrations/box/schema.zod.ts b/integrations/box/schema.zod.ts index b99e49c4..be6b2aea 100644 --- a/integrations/box/schema.zod.ts +++ b/integrations/box/schema.zod.ts @@ -13,10 +13,7 @@ export const userSchema = z.object({ id: z.string(), email: z.string(), firstName: z.string(), - lastName: z.string(), - roleIds: z.array(z.string()), - primaryTeamId: z.union([z.string(), z.undefined()]).optional(), - superAdmin: z.boolean() + lastName: z.string() }); export const createUserSchema = z.object({ diff --git a/integrations/discourse/schema.zod.ts b/integrations/discourse/schema.zod.ts index 78f6ce51..cd0e30a8 100644 --- a/integrations/discourse/schema.zod.ts +++ b/integrations/discourse/schema.zod.ts @@ -7,3 +7,44 @@ export const userSchema = z.object({ name: z.string(), admin: z.boolean() }); + +export const createCategorySchema = z.object({ + name: z.string(), + color: z.string().optional(), + text_color: z.string().optional(), + parent_category_id: z.string().optional(), + slug: z.string().optional(), + search_priority: z.string().optional() +}); + +export const categorySchema = z.object({ + id: z.string(), + name: z.string(), + color: z.string(), + description: z.string().nullable(), + slug: z.string() +}); + +export const createTopicSchema = z.object({ + title: z.string(), + category: z.number(), + raw: z.string() +}); + +export const topicSchema = z.object({ + id: z.string(), + name: z.string(), + content: z.string() +}); + +export const topicStatusSchema = z.object({ + id: z.string(), + status: z.union([z.literal('closed'), z.literal('pinned'), z.literal('pinned_globally'), z.literal('archived'), z.literal('visible')]), + enabled: z.union([z.literal(true), z.literal(false)]), + until: z.string() +}); + +export const topicStatusUpdatedSchema = z.object({ + success: z.string(), + result: z.string() +}); diff --git a/integrations/exact-online/nango.yaml b/integrations/exact-online/nango.yaml index 7440b472..dc95ac34 100644 --- a/integrations/exact-online/nango.yaml +++ b/integrations/exact-online/nango.yaml @@ -128,7 +128,7 @@ models: ExactInvoiceCreateInput: customerId: string - journal: number + journal?: number currency?: EUR description?: string createdAt?: date diff --git a/integrations/exact-online/schema.zod.ts b/integrations/exact-online/schema.zod.ts index 925c257b..62d5ec82 100644 --- a/integrations/exact-online/schema.zod.ts +++ b/integrations/exact-online/schema.zod.ts @@ -1,5 +1,4 @@ // Generated by ts-to-zod -// eslint-disable-next-line import/no-extraneous-dependencies import { z } from 'zod'; export const exactCustomerSchema = z.object({ @@ -124,11 +123,3 @@ export const exactInvoiceAttachFileInputSchema = z.object({ export const exactInvoiceAttachFileOutputSchema = z.object({ success: z.boolean() }); - -export const exactInvoicePrintInputSchema = z.object({ - invoiceId: z.string() -}); - -export const exactInvoicePrintOutputSchema = z.object({ - success: z.boolean() -}); diff --git a/integrations/freshdesk/schema.zod.ts b/integrations/freshdesk/schema.zod.ts index 8cf22a87..04109f35 100644 --- a/integrations/freshdesk/schema.zod.ts +++ b/integrations/freshdesk/schema.zod.ts @@ -129,3 +129,17 @@ export const articleSchema = z.object({ description_text: z.string(), status: z.number() }); + +export const ticketSchema = z.object({ + id: z.string(), + type: z.string(), + priority: z.number(), + request_id: z.number(), + response_id: z.number(), + source: z.number(), + subject: z.string(), + to_emails: z.array(z.string()).nullable(), + created_at: z.string(), + updated_at: z.string(), + is_escalated: z.boolean() +}); diff --git a/integrations/google-mail/schema.zod.ts b/integrations/google-mail/schema.zod.ts index f8ad8b99..23b3a6a0 100644 --- a/integrations/google-mail/schema.zod.ts +++ b/integrations/google-mail/schema.zod.ts @@ -5,13 +5,21 @@ export const optionalBackfillSettingSchema = z.object({ backfillPeriodMs: z.number() }); +export const attachmentsSchema = z.object({ + filename: z.string(), + mimeType: z.string(), + size: z.number(), + attachmentId: z.string() +}); + export const gmailEmailSchema = z.object({ id: z.string(), sender: z.string(), - recipients: z.string(), - date: z.date(), + recipients: z.union([z.string(), z.undefined()]).optional(), + date: z.string(), subject: z.string(), body: z.string(), + attachments: z.array(attachmentsSchema), threadId: z.string() }); @@ -32,3 +40,10 @@ export const gmailEmailSentOutputSchema = z.object({ id: z.string(), threadId: z.string() }); + +export const documentInputSchema = z.object({ + threadId: z.string(), + attachmentId: z.string() +}); + +export const anonymousGooglemailActionFetchattachmentOutputSchema = z.string(); diff --git a/integrations/gusto/schema.zod.ts b/integrations/gusto/schema.zod.ts index 9584513f..cfa6eb93 100644 --- a/integrations/gusto/schema.zod.ts +++ b/integrations/gusto/schema.zod.ts @@ -33,56 +33,8 @@ export const gustoCreateUserSchema = z.object({ selfOnboarding: z.boolean().optional() }); -export const trackingCodeSchema = z.object({ - type: z.literal('tracking_code').optional(), - name: z.string().optional(), - value: z.string().optional() -}); - -export const enterpriseSchema = z.object({ - id: z.string(), - type: z.string(), - name: z.string() -}); - -export const notificationEmailSchema = z.object({ - email: z.string(), - is_confirmed: z.boolean() -}); - -export const createdUserSchema = z.object({ - id: z.string(), - type: z.string(), - address: z.string().optional(), - avatar_url: z.string().optional(), - can_see_managed_users: z.boolean(), - created_at: z.string(), - enterprise: enterpriseSchema, - external_app_user_id: z.string().optional(), - hostname: z.string(), - is_exempt_from_device_limits: z.boolean(), - is_exempt_from_login_verification: z.boolean(), - is_external_collab_restricted: z.boolean(), - is_platform_access_only: z.boolean(), - is_sync_enabled: z.boolean(), - job_title: z.string().optional(), - language: z.string().optional(), - login: z.string(), - max_upload_size: z.number(), - modified_at: z.string(), - name: z.string(), - notification_email: notificationEmailSchema, - phone: z.string().optional(), - role: z.string(), - space_amount: z.number(), - space_used: z.number(), - status: z.string(), - timezone: z.string().optional(), - tracking_codes: z.array(trackingCodeSchema).optional() -}); - -export const boxDeleteUserSchema = z.object({ +export const gustoDeleteUserSchema = z.object({ id: z.string(), - force: z.boolean().optional(), - notify: z.boolean().optional() + effectiveDate: z.string().optional(), + runTerminationPayroll: z.boolean().optional() }); diff --git a/integrations/hubspot/schema.zod.ts b/integrations/hubspot/schema.zod.ts index e0c26a20..98af0f53 100644 --- a/integrations/hubspot/schema.zod.ts +++ b/integrations/hubspot/schema.zod.ts @@ -18,6 +18,10 @@ export const timestampsSchema = z.object({ createdAt: z.string() }); +export const optionalObjectTypeSchema = z.object({ + objectType: z.string().optional() +}); + export const inputPropertySchema = z.object({ name: z.string() }); @@ -541,3 +545,31 @@ export const productSchema = z.object({ recurringBillingFrequency: z.number().nullable(), tax: z.number().nullable() }); + +export const stageSchema = z.object({ + updatedAt: z.string(), + createdAt: z.string(), + label: z.string(), + displayOrder: z.number(), + metadata: z.object({ + isClosed: z.boolean(), + probability: z.string() + }), + id: z.string(), + archived: z.boolean(), + writePermissions: z.string() +}); + +export const pipelineSchema = z.object({ + updatedAt: z.string(), + createdAt: z.string(), + label: z.string(), + displayOrder: z.number(), + id: z.string(), + archived: z.boolean(), + stages: z.array(stageSchema) +}); + +export const pipelineOutputSchema = z.object({ + pipelines: z.array(pipelineSchema) +}); diff --git a/integrations/jira/schema.zod.ts b/integrations/jira/schema.zod.ts index 3ec91eb2..0c7c6d01 100644 --- a/integrations/jira/schema.zod.ts +++ b/integrations/jira/schema.zod.ts @@ -7,8 +7,8 @@ export const jiraProjectIdSchema = z.object({ export const jiraIssueMetadataSchema = z.object({ projectIdsToSync: z.array(jiraProjectIdSchema), - cloudId: z.string(), - baseUrl: z.string() + cloudId: z.string().optional(), + baseUrl: z.string().optional() }); export const timestampsSchema = z.object({ diff --git a/integrations/netsuite-tba/actions/credit-note-create.ts b/integrations/netsuite-tba/actions/credit-note-create.ts index 561caddb..8530c55c 100644 --- a/integrations/netsuite-tba/actions/credit-note-create.ts +++ b/integrations/netsuite-tba/actions/credit-note-create.ts @@ -1,6 +1,6 @@ import type { NangoAction, NetsuiteCreditNoteCreateInput, NetsuiteCreditNoteCreateOutput } from '../../models'; import type { NS_CreditNote } from '../types'; -import { netsuiteCreditNoteCreateInputSchema } from '../schema.zod.js'; +import { netsuiteCreditNoteCreateInputSchema } from '../schema.js'; export default async function runAction(nango: NangoAction, input: NetsuiteCreditNoteCreateInput): Promise { const parsedInput = netsuiteCreditNoteCreateInputSchema.safeParse(input); diff --git a/integrations/netsuite-tba/actions/credit-note-update.ts b/integrations/netsuite-tba/actions/credit-note-update.ts index 87320200..0195d171 100644 --- a/integrations/netsuite-tba/actions/credit-note-update.ts +++ b/integrations/netsuite-tba/actions/credit-note-update.ts @@ -1,6 +1,6 @@ import type { NangoAction, NetsuiteCreditNoteUpdateInput, NetsuiteCreditNoteUpdateOutput } from '../../models'; import type { NS_CreditNote, NS_Item } from '../types'; -import { netsuiteCreditNoteUpdateInputSchema } from '../schema.zod.js'; +import { netsuiteCreditNoteUpdateInputSchema } from '../schema.js'; export default async function runAction(nango: NangoAction, input: NetsuiteCreditNoteUpdateInput): Promise { const parsedInput = netsuiteCreditNoteUpdateInputSchema.safeParse(input); diff --git a/integrations/netsuite-tba/actions/customer-create.ts b/integrations/netsuite-tba/actions/customer-create.ts index 54e69874..c2cbd2e0 100644 --- a/integrations/netsuite-tba/actions/customer-create.ts +++ b/integrations/netsuite-tba/actions/customer-create.ts @@ -1,6 +1,6 @@ import type { NangoAction, NetsuiteCustomerCreateInput, NetsuiteCustomerCreateOutput } from '../../models'; import type { NS_Customer, NS_Address } from '../types'; -import { netsuiteCustomerCreateInputSchema } from '../schema.zod.js'; +import { netsuiteCustomerCreateInputSchema } from '../schema.js'; export default async function runAction(nango: NangoAction, input: NetsuiteCustomerCreateInput): Promise { const parsedInput = netsuiteCustomerCreateInputSchema.safeParse(input); diff --git a/integrations/netsuite-tba/actions/customer-update.ts b/integrations/netsuite-tba/actions/customer-update.ts index ef267574..1a65e7e9 100644 --- a/integrations/netsuite-tba/actions/customer-update.ts +++ b/integrations/netsuite-tba/actions/customer-update.ts @@ -1,6 +1,6 @@ import type { NangoAction, NetsuiteCustomerUpdateInput, NetsuiteCustomerUpdateOutput } from '../../models'; import type { NS_Customer, NS_Address } from '../types'; -import { netsuiteCustomerUpdateInputSchema } from '../schema.zod.js'; +import { netsuiteCustomerUpdateInputSchema } from '../schema.js'; export default async function runAction(nango: NangoAction, input: NetsuiteCustomerUpdateInput): Promise { const parsedInput = netsuiteCustomerUpdateInputSchema.safeParse(input); diff --git a/integrations/netsuite-tba/actions/invoice-create.ts b/integrations/netsuite-tba/actions/invoice-create.ts index 88c9cd97..41a40eb3 100644 --- a/integrations/netsuite-tba/actions/invoice-create.ts +++ b/integrations/netsuite-tba/actions/invoice-create.ts @@ -1,6 +1,6 @@ import type { NangoAction, NetsuiteInvoiceCreateInput, NetsuiteInvoiceCreateOutput } from '../../models'; import type { NS_Invoice } from '../types'; -import { netsuiteInvoiceCreateInputSchema } from '../schema.zod.js'; +import { netsuiteInvoiceCreateInputSchema } from '../schema.js'; export default async function runAction(nango: NangoAction, input: NetsuiteInvoiceCreateInput): Promise { const parsedInput = netsuiteInvoiceCreateInputSchema.safeParse(input); diff --git a/integrations/netsuite-tba/actions/invoice-update.ts b/integrations/netsuite-tba/actions/invoice-update.ts index 66a5ca5b..a408d93f 100644 --- a/integrations/netsuite-tba/actions/invoice-update.ts +++ b/integrations/netsuite-tba/actions/invoice-update.ts @@ -1,6 +1,6 @@ import type { NangoAction, NetsuiteInvoiceUpdateInput, NetsuiteInvoiceUpdateOutput } from '../../models'; import type { NS_Invoice, NS_Item } from '../types'; -import { netsuiteInvoiceUpdateInputSchema } from '../schema.zod.js'; +import { netsuiteInvoiceUpdateInputSchema } from '../schema.js'; export default async function runAction(nango: NangoAction, input: NetsuiteInvoiceUpdateInput): Promise { const parsedInput = netsuiteInvoiceUpdateInputSchema.safeParse(input); diff --git a/integrations/netsuite-tba/actions/payment-create.ts b/integrations/netsuite-tba/actions/payment-create.ts index a31eebc8..3387d538 100644 --- a/integrations/netsuite-tba/actions/payment-create.ts +++ b/integrations/netsuite-tba/actions/payment-create.ts @@ -1,6 +1,6 @@ import type { NangoAction, NetsuitePaymentCreateInput, NetsuitePaymentCreateOutput } from '../../models'; import type { NS_Payment } from '../types'; -import { netsuitePaymentCreateInputSchema } from '../schema.zod.js'; +import { netsuitePaymentCreateInputSchema } from '../schema.js'; export default async function runAction(nango: NangoAction, input: NetsuitePaymentCreateInput): Promise { const parsedInput = netsuitePaymentCreateInputSchema.safeParse(input); diff --git a/integrations/netsuite-tba/actions/payment-update.ts b/integrations/netsuite-tba/actions/payment-update.ts index 40292d13..857b2fa9 100644 --- a/integrations/netsuite-tba/actions/payment-update.ts +++ b/integrations/netsuite-tba/actions/payment-update.ts @@ -1,6 +1,6 @@ import type { NangoAction, NetsuitePaymentUpdateInput, NetsuitePaymentUpdateOutput } from '../../models'; import type { NS_Payment } from '../types'; -import { netsuitePaymentUpdateInputSchema } from '../schema.zod.js'; +import { netsuitePaymentUpdateInputSchema } from '../schema.js'; export default async function runAction(nango: NangoAction, input: NetsuitePaymentUpdateInput): Promise { const parsedInput = netsuitePaymentUpdateInputSchema.safeParse(input); diff --git a/integrations/netsuite-tba/schema.ts b/integrations/netsuite-tba/schema.ts new file mode 100644 index 00000000..e64ff5f2 --- /dev/null +++ b/integrations/netsuite-tba/schema.ts @@ -0,0 +1,150 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import { z } from 'zod'; + +export const netsuiteCustomerCreateInputSchema = z.object({ + externalId: z.string().min(1), + name: z.string().min(1), + email: z.string().email(), + taxNumber: z.string().optional(), + phone: z.string().optional(), + addressLine1: z.string().optional(), + addressLine2: z.string().optional(), + city: z.string().optional(), + state: z.string().optional(), + zip: z.string().optional(), + country: z.string().optional() +}); + +export const netsuiteCustomerUpdateInputSchema = z.object({ + id: z.string().min(1), + externalId: z.string().optional(), + name: z.string().optional(), + email: z.string().email(), + taxNumber: z.string().optional(), + phone: z.string().optional(), + addressLine1: z.string().optional(), + addressLine2: z.string().optional(), + city: z.string().optional(), + state: z.string().optional(), + zip: z.string().optional(), + country: z.string().optional() +}); + +export const netsuiteCreditNoteCreateInputSchema = z.object({ + customerId: z.string().min(1), + currency: z.string().min(1), + description: z.string().optional(), + status: z.string().min(1), + lines: z.array( + z.object({ + itemId: z.string().min(1), + quantity: z.number().min(0), + amount: z.number().min(0), + vatCode: z.string().optional(), + description: z.string().optional() + }) + ) +}); +export const netsuiteCreditNoteUpdateInputSchema = z.object({ + id: z.string().min(1), + customerId: z.string().min(1).optional(), + currency: z.string().min(1).optional(), + description: z.string().optional(), + status: z.string().min(1).optional(), + lines: z + .array( + z.object({ + itemId: z.string().min(1), + quantity: z.number().min(0), + amount: z.number().min(0), + vatCode: z.string().optional(), + description: z.string().optional() + }) + ) + + .optional() +}); + +export const netsuiteInvoiceCreateInputSchema = z.object({ + customerId: z.string().min(1), + currency: z.string().min(1), + description: z.string().optional(), + status: z.string().min(1), + lines: z.array( + z.object({ + itemId: z.string().min(1), + quantity: z.number().min(0), + locationId: z.string().min(1), + amount: z.number().min(0), + vatCode: z.string().optional(), + description: z.string().optional() + }) + ) +}); +export const netsuiteInvoiceUpdateInputSchema = z.object({ + id: z.string().min(1), + customerId: z.string().min(1).optional(), + currency: z.string().min(1).optional(), + description: z.string().optional(), + status: z.string().min(1).optional(), + lines: z + .array( + z.object({ + itemId: z.string().min(1), + quantity: z.number().min(0), + amount: z.number().min(0), + locationId: z.string().optional(), + vatCode: z.string().optional(), + description: z.string().optional() + }) + ) + + .optional() +}); + +export const netsuitePaymentCreateInputSchema = z.object({ + customerId: z.string(), + amount: z.number().min(0), + currency: z.string(), + paymentReference: z.string(), + applyTo: z.array(z.string()), + status: z.string(), + description: z.string().optional() +}); + +export const netsuitePaymentUpdateInputSchema = z.object({ + id: z.string(), + customerId: z.string().optional(), + amount: z.number().min(0).optional(), + currency: z.string().optional(), + description: z.string().optional(), + paymentReference: z.string().optional(), + status: z.string().optional(), + applyTo: z.array(z.string()).optional() +}); + +export const netsuitePaymentUpdateOutputSchema = z.object({ + success: z.boolean() +}); + +export const netsuiteLocationSchema = z.object({ + id: z.string(), + isInactive: z.boolean(), + name: z.string(), + lastModifiedDate: z.string(), + address: z.object({ + address1: z.string(), + addressee: z.string(), + addressText: z.string(), + city: z.string(), + country: z.string(), + state: z.string(), + zip: z.string() + }), + returnAddress: z.object({ + addressText: z.string(), + country: z.string() + }), + timeZone: z.string(), + useBins: z.boolean() +}); diff --git a/integrations/netsuite-tba/schema.zod.ts b/integrations/netsuite-tba/schema.zod.ts index e64ff5f2..85411254 100644 --- a/integrations/netsuite-tba/schema.zod.ts +++ b/integrations/netsuite-tba/schema.zod.ts @@ -1,110 +1,172 @@ -// eslint-disable-next-line import/no-extraneous-dependencies +// Generated by ts-to-zod import { z } from 'zod'; +export const netsuiteAddressSchema = z.object({ + addressLine1: z.string().nullable(), + addressLine2: z.string().nullable(), + city: z.string().nullable(), + zip: z.string().nullable(), + country: z.string().nullable(), + state: z.string().nullable() +}); + +export const netsuiteCustomerSchema = z.object({ + id: z.string(), + externalId: z.string().nullable(), + name: z.string(), + email: z.string().nullable(), + taxNumber: z.string().nullable(), + phone: z.string().nullable(), + addressLine1: z.string().nullable(), + addressLine2: z.string().nullable(), + city: z.string().nullable(), + zip: z.string().nullable(), + country: z.string().nullable(), + state: z.string().nullable() +}); + export const netsuiteCustomerCreateInputSchema = z.object({ - externalId: z.string().min(1), - name: z.string().min(1), - email: z.string().email(), + externalId: z.string(), + name: z.string(), + email: z.string().optional(), taxNumber: z.string().optional(), - phone: z.string().optional(), addressLine1: z.string().optional(), addressLine2: z.string().optional(), city: z.string().optional(), - state: z.string().optional(), zip: z.string().optional(), - country: z.string().optional() + country: z.string().optional(), + state: z.string().optional(), + phone: z.string().optional() +}); + +export const netsuiteCustomerCreateOutputSchema = z.object({ + id: z.string() }); export const netsuiteCustomerUpdateInputSchema = z.object({ - id: z.string().min(1), externalId: z.string().optional(), name: z.string().optional(), - email: z.string().email(), + email: z.string().optional(), taxNumber: z.string().optional(), - phone: z.string().optional(), addressLine1: z.string().optional(), addressLine2: z.string().optional(), city: z.string().optional(), - state: z.string().optional(), zip: z.string().optional(), - country: z.string().optional() + country: z.string().optional(), + state: z.string().optional(), + phone: z.string().optional(), + id: z.string() +}); + +export const netsuiteCustomerUpdateOutputSchema = z.object({ + success: z.boolean() +}); + +export const netsuiteInvoiceLineSchema = z.object({ + itemId: z.string(), + quantity: z.number(), + amount: z.number(), + vatCode: z.string().optional(), + description: z.string().optional(), + locationId: z.string().optional() +}); + +export const netsuiteCreditNoteSchema = z.object({ + id: z.string(), + customerId: z.string(), + currency: z.string(), + description: z.string().nullable(), + createdAt: z.string(), + lines: z.array(netsuiteInvoiceLineSchema), + total: z.number(), + status: z.string() +}); + +export const netsuiteCreditNoteLineSchema = z.object({ + itemId: z.string(), + quantity: z.number(), + amount: z.number(), + vatCode: z.string().optional(), + description: z.string().optional() }); export const netsuiteCreditNoteCreateInputSchema = z.object({ - customerId: z.string().min(1), - currency: z.string().min(1), + customerId: z.string(), + status: z.string(), + currency: z.string(), description: z.string().optional(), - status: z.string().min(1), - lines: z.array( - z.object({ - itemId: z.string().min(1), - quantity: z.number().min(0), - amount: z.number().min(0), - vatCode: z.string().optional(), - description: z.string().optional() - }) - ) + lines: z.array(netsuiteCreditNoteLineSchema) +}); + +export const netsuiteCreditNoteCreateOutputSchema = z.object({ + id: z.string() }); + export const netsuiteCreditNoteUpdateInputSchema = z.object({ - id: z.string().min(1), - customerId: z.string().min(1).optional(), - currency: z.string().min(1).optional(), + customerId: z.string(), + status: z.string(), + currency: z.string(), description: z.string().optional(), - status: z.string().min(1).optional(), - lines: z - .array( - z.object({ - itemId: z.string().min(1), - quantity: z.number().min(0), - amount: z.number().min(0), - vatCode: z.string().optional(), - description: z.string().optional() - }) - ) + lines: z.array(netsuiteCreditNoteLineSchema), + id: z.string() +}); - .optional() +export const netsuiteCreditNoteUpdateOutputSchema = z.object({ + success: z.boolean() +}); + +export const netsuiteInvoiceSchema = z.object({ + id: z.string(), + customerId: z.string(), + currency: z.string(), + description: z.string().nullable(), + createdAt: z.string(), + lines: z.array(netsuiteInvoiceLineSchema), + total: z.number(), + status: z.string() }); export const netsuiteInvoiceCreateInputSchema = z.object({ - customerId: z.string().min(1), - currency: z.string().min(1), + customerId: z.string(), + currency: z.string(), description: z.string().optional(), - status: z.string().min(1), - lines: z.array( - z.object({ - itemId: z.string().min(1), - quantity: z.number().min(0), - locationId: z.string().min(1), - amount: z.number().min(0), - vatCode: z.string().optional(), - description: z.string().optional() - }) - ) + status: z.string(), + lines: z.array(netsuiteInvoiceLineSchema) }); + +export const netsuiteInvoiceCreateOutputSchema = z.object({ + id: z.string() +}); + export const netsuiteInvoiceUpdateInputSchema = z.object({ - id: z.string().min(1), - customerId: z.string().min(1).optional(), - currency: z.string().min(1).optional(), + customerId: z.string().optional(), + currency: z.string().optional(), description: z.string().optional(), - status: z.string().min(1).optional(), - lines: z - .array( - z.object({ - itemId: z.string().min(1), - quantity: z.number().min(0), - amount: z.number().min(0), - locationId: z.string().optional(), - vatCode: z.string().optional(), - description: z.string().optional() - }) - ) - - .optional() + status: z.string(), + lines: z.array(netsuiteInvoiceLineSchema), + id: z.string(), + locationId: z.string().optional() +}); + +export const netsuiteInvoiceUpdateOutputSchema = z.object({ + success: z.boolean() +}); + +export const netsuitePaymentSchema = z.object({ + id: z.string(), + description: z.string().optional(), + customerId: z.string().nullable(), + amount: z.number().nullable(), + createdAt: z.string().nullable(), + currency: z.string().nullable(), + paymentReference: z.string().nullable(), + status: z.string().nullable(), + applyTo: z.array(z.string()) }); export const netsuitePaymentCreateInputSchema = z.object({ customerId: z.string(), - amount: z.number().min(0), + amount: z.number(), currency: z.string(), paymentReference: z.string(), applyTo: z.array(z.string()), @@ -112,15 +174,19 @@ export const netsuitePaymentCreateInputSchema = z.object({ description: z.string().optional() }); +export const netsuitePaymentCreateOutputSchema = z.object({ + id: z.string() +}); + export const netsuitePaymentUpdateInputSchema = z.object({ - id: z.string(), - customerId: z.string().optional(), - amount: z.number().min(0).optional(), + customerId: z.string(), + amount: z.number().optional(), currency: z.string().optional(), - description: z.string().optional(), paymentReference: z.string().optional(), + applyTo: z.array(z.string()).optional(), status: z.string().optional(), - applyTo: z.array(z.string()).optional() + description: z.string().optional(), + id: z.string() }); export const netsuitePaymentUpdateOutputSchema = z.object({ diff --git a/integrations/notion/schema.zod.ts b/integrations/notion/schema.zod.ts index 699e7c23..b3f2319e 100644 --- a/integrations/notion/schema.zod.ts +++ b/integrations/notion/schema.zod.ts @@ -29,7 +29,10 @@ export const databaseInputSchema = z.object({ databaseId: z.string() }); -export const databaseEntrySchema = z.record(z.string()); +export const rowEntrySchema = z.object({ + id: z.string(), + row: z.record(z.any()) +}); export const databaseSchema = z.object({ id: z.string(), @@ -37,10 +40,29 @@ export const databaseSchema = z.object({ title: z.string(), meta: z.record(z.any()), last_modified: z.string(), - entries: z.array(databaseEntrySchema) + entries: z.array(rowEntrySchema) +}); + +export const notionCompleteDatabaseSchema = z.object({ + id: z.string(), + row: z.record(z.any()), + meta: z.object({ + databaseId: z.string(), + path: z.string(), + title: z.string(), + last_modified: z.string() + }) }); export const urlOrIdSchema = z.object({ url: z.string().optional(), id: z.string().optional() }); + +export const userSchema = z.object({ + id: z.string(), + email: z.string().nullable(), + firstName: z.string(), + lastName: z.string(), + isBot: z.boolean() +}); diff --git a/integrations/outlook/schema.zod.ts b/integrations/outlook/schema.zod.ts index 58ae23d0..5b9a8a47 100644 --- a/integrations/outlook/schema.zod.ts +++ b/integrations/outlook/schema.zod.ts @@ -14,7 +14,7 @@ export const attachmentsSchema = z.object({ export const outlookEmailSchema = z.object({ id: z.string(), - sender: z.string(), + sender: z.string().optional(), recipients: z.union([z.string(), z.undefined()]).optional(), date: z.string(), subject: z.string(), diff --git a/integrations/salesforce/schema.zod.ts b/integrations/salesforce/schema.zod.ts index ed2124dc..dd1a0d23 100644 --- a/integrations/salesforce/schema.zod.ts +++ b/integrations/salesforce/schema.zod.ts @@ -1,66 +1,67 @@ // Generated by ts-to-zod -// eslint-disable-next-line import/no-extraneous-dependencies import { z } from 'zod'; -export const salesforceAccountSchema = z.object({ +export const accountSchema = z.object({ id: z.string(), name: z.string(), - website: z.string(), - description: z.string(), - no_employees: z.number(), + website: z.string().nullable(), + description: z.string().nullable(), + no_employees: z.number().nullable(), last_modified_date: z.string() }); -export const salesforceContactSchema = z.object({ +export const contactSchema = z.object({ id: z.string(), - first_name: z.string(), + first_name: z.string().nullable(), last_name: z.string(), - email: z.string(), - account_id: z.string(), + email: z.string().nullable(), + account_id: z.string().nullable(), last_modified_date: z.string() }); -export const salesforceDealSchema = z.object({ +export const dealSchema = z.object({ id: z.string(), name: z.string(), - amount: z.number(), + amount: z.number().nullable(), stage: z.string(), account_id: z.string(), last_modified_date: z.string() }); -export const salesforceArticleSchema = z.object({ +export const articleSchema = z.object({ id: z.string(), title: z.string(), content: z.string(), last_modified_date: z.string() }); -export const salesforceTicketSchema = z.object({ +export const conversationSchema = z.object({ + id: z.string(), + body: z.string(), + created_date: z.string(), + created_by: z.string() +}); + +export const ticketSchema = z.object({ id: z.string(), case_number: z.string(), subject: z.string().nullable(), - account_id: z.string(), + account_id: z.string().nullable(), account_name: z.string().nullable(), - contact_id: z.string(), + contact_id: z.string().nullable(), contact_name: z.string().nullable(), owner_id: z.string(), owner_name: z.string().nullable(), priority: z.string(), status: z.string(), description: z.string().nullable(), - type: z.string(), + type: z.string().nullable(), created_date: z.string(), - closed_date: z.string(), - origin: z.string(), + closed_date: z.string().nullable(), + origin: z.string().nullable(), is_closed: z.boolean(), is_escalated: z.boolean(), - conversation: z.object({ - id: z.string(), - body: z.string(), - created_date: z.string(), - created_by: z.string() - }), + conversation: z.array(conversationSchema), last_modified_date: z.string() }); @@ -86,9 +87,17 @@ export const childFieldSchema = z.object({ field: z.string() }); +export const validationRuleSchema = z.object({ + id: z.string(), + name: z.string(), + errorConditionFormula: z.string(), + errorMessage: z.string() +}); + export const salesforceFieldSchemaSchema = z.object({ fields: z.array(fieldSchema), - childRelationships: z.array(childFieldSchema) + childRelationships: z.array(childFieldSchema), + validationRules: z.array(validationRuleSchema) }); export const actionResponseErrorDetailsSchema = z.object({ @@ -103,9 +112,6 @@ export const actionResponseErrorSchema = z.object({ details: actionResponseErrorDetailsSchema.optional() }); -export const validationRuleSchema = z.object({ - id: z.string(), - name: z.string(), - errorConditionFormula: z.string(), - errorMessage: z.string() +export const salesforceMetadataSchema = z.object({ + customFields: z.array(z.string()) }); diff --git a/integrations/sharepoint-online/schema.zod.ts b/integrations/sharepoint-online/schema.zod.ts index 80871248..57f5835f 100644 --- a/integrations/sharepoint-online/schema.zod.ts +++ b/integrations/sharepoint-online/schema.zod.ts @@ -17,6 +17,38 @@ export const fileMetadataSchema = z.object({ blob_size: z.number() }); +export const userFileMetadataSchema = z.object({ + siteId: z.string(), + id: z.string(), + name: z.string(), + etag: z.string(), + cTag: z.string(), + is_folder: z.boolean(), + mime_type: z.string().nullable(), + path: z.string(), + raw_source: z.record(z.any()), + updated_at: z.string(), + download_url: z.string().nullable(), + created_at: z.string(), + blob_size: z.number() +}); + +export const selectedUserFileMetadataSchema = z.object({ + siteId: z.string(), + id: z.string(), + name: z.string(), + etag: z.string(), + cTag: z.string(), + is_folder: z.boolean(), + mime_type: z.string().nullable(), + path: z.string(), + raw_source: z.record(z.any()), + updated_at: z.string(), + download_url: z.string().nullable(), + created_at: z.string(), + blob_size: z.number() +}); + export const siteSchema = z.object({ id: z.string(), name: z.string(), @@ -24,7 +56,17 @@ export const siteSchema = z.object({ webUrl: z.string() }); -export const sharePointMetadataSchema = z.object({ +export const pickedFileSchema = z.object({ + siteId: z.string(), + fileIds: z.array(z.string()) +}); + +export const sharepointMetadataSchema = z.object({ + sharedSites: z.array(z.string()), + pickedFiles: z.array(pickedFileSchema) +}); + +export const sharepointSitesSchema = z.object({ sitesToSync: z.array(siteSchema) }); diff --git a/integrations/slack/schema.zod.ts b/integrations/slack/schema.zod.ts index 99ba0569..d73ebca2 100644 --- a/integrations/slack/schema.zod.ts +++ b/integrations/slack/schema.zod.ts @@ -16,7 +16,7 @@ export const slackUserSchema = z.object({ real_name_normalized: z.string().nullable(), display_name_normalized: z.string().nullable(), email: z.string().nullable(), - image_original: z.string().nullable() + image_original: z.union([z.string(), z.undefined()]).nullable() }), is_admin: z.boolean(), is_owner: z.boolean(), diff --git a/scripts/generate-integration-template-zod.bash b/scripts/generate-integration-template-zod.bash index 41589164..226b0469 100755 --- a/scripts/generate-integration-template-zod.bash +++ b/scripts/generate-integration-template-zod.bash @@ -40,10 +40,7 @@ for d in "${integrations[@]}" ; do mv "$integration/nango.yaml" . - # if no zod file already then create it unless we want to explicitly override it - if [ ! -f "$integration/schema.zod.ts" ] || [ -n "$npm_config_force" ]; then - npx nango generate && npx ts-to-zod .nango/schema.ts $integration/schema.zod.ts - fi + npx nango generate && npx ts-to-zod .nango/schema.ts $integration/schema.zod.ts popd