Skip to content

Commit

Permalink
feat: add xero connector with open-sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinsandilya committed Mar 30, 2024
1 parent 1918021 commit 01d2a9d
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 3 deletions.
2 changes: 2 additions & 0 deletions apps/app-config/connectors/connectors.def.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {default as connectorTwenty} from '@usevenice/connector-twenty/def'
import {default as connectorVenmo} from '@usevenice/connector-venmo/def'
import {default as connectorWebhook} from '@usevenice/connector-webhook/def'
import {default as connectorWise} from '@usevenice/connector-wise/def'
import {default as connectorXero} from '@usevenice/connector-xero/def'
import {default as connectorYodlee} from '@usevenice/connector-yodlee/def'

export const defConnectors = {
Expand Down Expand Up @@ -66,5 +67,6 @@ export const defConnectors = {
venmo: connectorVenmo,
webhook: connectorWebhook,
wise: connectorWise,
xero: connectorXero,
yodlee: connectorYodlee,
}
8 changes: 8 additions & 0 deletions apps/app-config/connectors/connectors.merged.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ import {default as connectorWebhook_def} from '@usevenice/connector-webhook/def'
import {default as connectorWebhook_server} from '@usevenice/connector-webhook/server'
import {default as connectorWise_def} from '@usevenice/connector-wise/def'
import {default as connectorWise_server} from '@usevenice/connector-wise/server'
import {default as connectorXero_def} from '@usevenice/connector-xero/def'
import {default as connectorXero_server} from '@usevenice/connector-xero/server'
import {default as connectorYodlee_def} from '@usevenice/connector-yodlee/def'
import {default as connectorYodlee_server} from '@usevenice/connector-yodlee/server'

Expand Down Expand Up @@ -222,6 +224,11 @@ const connectorWise = {
...connectorWise_server,
}

const connectorXero = {
...connectorXero_def,
...connectorXero_server,
}

const connectorYodlee = {
...connectorYodlee_def,
...connectorYodlee_server,
Expand Down Expand Up @@ -260,5 +267,6 @@ export const mergedConnectors = {
venmo: connectorVenmo,
webhook: connectorWebhook,
wise: connectorWise,
xero: connectorXero,
yodlee: connectorYodlee,
}
2 changes: 2 additions & 0 deletions apps/app-config/connectors/connectors.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {default as connectorToggl} from '@usevenice/connector-toggl/server'
import {default as connectorTwenty} from '@usevenice/connector-twenty/server'
import {default as connectorWebhook} from '@usevenice/connector-webhook/server'
import {default as connectorWise} from '@usevenice/connector-wise/server'
import {default as connectorXero} from '@usevenice/connector-xero/server'
import {default as connectorYodlee} from '@usevenice/connector-yodlee/server'

export const serverConnectors = {
Expand Down Expand Up @@ -62,5 +63,6 @@ export const serverConnectors = {
twenty: connectorTwenty,
webhook: connectorWebhook,
wise: connectorWise,
xero: connectorXero,
yodlee: connectorYodlee,
}
9 changes: 9 additions & 0 deletions apps/app-config/connectors/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,15 @@ module.exports = [
server: '@usevenice/connector-wise/server',
},
},
{
name: 'xero',
dirName: 'connector-xero',
varName: 'connectorXero',
imports: {
def: '@usevenice/connector-xero/def',
server: '@usevenice/connector-xero/server',
},
},
{
name: 'yodlee',
dirName: 'connector-yodlee',
Expand Down
2 changes: 1 addition & 1 deletion apps/app-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"scripts": {
"generate:docs": "pnpm tsx watch ./_generateDocs.bin.ts",
"generate:lists": "node --loader tsx ./_generateConnectorLists.ts"
"generate:lists": "npx tsx ./_generateConnectorLists.ts"
},
"dependencies": {
"@clerk/nextjs": "4.29.3",
Expand Down
1 change: 1 addition & 0 deletions connectors/connector-xero/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"sideEffects": [],
"module": "./index.ts",
"dependencies": {
"@opensdks/sdk-xero": "^0.0.2",
"@opensdks/util-zod": "^0.0.15",
"@usevenice/cdk": "workspace:*",
"@usevenice/util": "workspace:*"
Expand Down
13 changes: 11 additions & 2 deletions connectors/connector-xero/server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
// import {initXeroSDK} from '@opensdks/sdk-xero' // FIXME: ensure SDK exists
import {initXeroSDK} from '@opensdks/sdk-xero'
import type {ConnectorServer} from '@usevenice/cdk'
import type {xeroSchemas} from './def'

export const xeroServer = {} satisfies ConnectorServer<typeof xeroSchemas>
export const xeroServer = {
newInstance: ({settings}) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const xero = initXeroSDK({
headers: {authorization: `Bearer ${settings.access_token}`},
})
// TODO(@jatin): Add logic here to handle sync.
return xero
},
} satisfies ConnectorServer<typeof xeroSchemas>

export default xeroServer
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 01d2a9d

Please sign in to comment.