Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
feat: Allow integration to override connector verticals
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyxiao committed Oct 31, 2024
1 parent 3a1f35a commit 21e388e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion connectors/connector-google/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const googleServer = {
},
}
}
if (context.integrationExternalId === 'drive') {
if (context.integrationExternalId === 'gmail') {
return {
authorization_params: {
scope: 'https://www.googleapis.com/auth/gmail.readonly',
Expand All @@ -71,20 +71,23 @@ export const googleServer = {
name: 'Google Drive',
// TODO: Differ oauth scope use in Connect based on which integration
raw_data: {} as any,
verticals: ['file-storage'],
updated_at: new Date().toISOString(),
logo_url: '/_assets/logo-google-drive.svg',
},
{
id: 'gmail',
name: 'Gmail',
raw_data: {} as any,
verticals: ['email'],
updated_at: new Date().toISOString(),
logo_url: '/_assets/logo-google-gmail.svg',
},
{
id: 'calendar',
name: 'Google Calendar',
raw_data: {} as any,
verticals: ['calendar'],
updated_at: new Date().toISOString(),
logo_url: '/_assets/logo-google-calendar.svg',
},
Expand Down
2 changes: 2 additions & 0 deletions kits/cdk/connector.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type {
import type {EndUserId, Id} from './id.types'
import {makeId} from './id.types'
import type {ZStandard} from './models'
import {VerticalKey} from './verticals'

/**
* Equivalent to to airbyte's low code connector spec,
Expand Down Expand Up @@ -226,6 +227,7 @@ export interface ConnectorServer<
name: string
logo_url?: string | null
updated_at: string
verticals?: VerticalKey[]
raw_data: T['_intOpType']['data']
}>
}>
Expand Down
1 change: 1 addition & 0 deletions kits/cdk/verticals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const _VERTICAL_BY_KEY = {
one-way with no impact on original data.`,
objects: ['job', 'offer', 'candidate', 'opening'],
},
email: {},
} satisfies Record<string, VerticalInfo>

// MARK: -
Expand Down
2 changes: 1 addition & 1 deletion packages/engine-frontend/components/IntegrationSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function IntegrationSearch({

const intsByCategory = ints?.reduce(
(acc, int) => {
int.ccfg.verticals.forEach((vertical) => {
;(int.verticals ?? int.ccfg.verticals).forEach((vertical) => {
acc[vertical] = (acc[vertical] || []).concat(int)
})
return acc
Expand Down

0 comments on commit 21e388e

Please sign in to comment.