Skip to content

Commit

Permalink
chore: Switch to the new approach for listing categories
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyxiao committed Feb 10, 2024
1 parent d642afb commit 8bfce07
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 659 deletions.
10 changes: 0 additions & 10 deletions connectors/connector-qbo/def.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ export const qboSchemas = {
sourceOutputEntities: R.mapValues(QBO_ENTITY_NAME, () => z.unknown()),

verticals: {
banking: {
account: zCast<QBO['Account']>(),
transaction: zCast<QBO['Purchase']>(),
category: zCast<QBO['Account']>(),
merchant: zCast<QBO['Vendor']>(),
},
accounting: {
account: zCast<QBO['Account']>(),
expense: zCast<QBO['Purchase']>(),
Expand Down Expand Up @@ -124,10 +118,6 @@ export const qboDef = {
primaryKey: 'Id',
cursorField: 'Metadata.LastUpdatedTime',
},
// @ts-expect-error TODO: Fix me
banking: {
category: (c) => ({id: c.Id, name: c.Name}),
},
accounting: {
account: (a) => ({
name: a.Name,
Expand Down
1 change: 1 addition & 0 deletions connectors/connector-qbo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
export * from './def'
export * from './server'
// codegen:end
export * from '@opensdks/sdk-qbo'
17 changes: 2 additions & 15 deletions connectors/connector-qbo/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ function initQBOSdk(options: QBOSDKTypes['options']) {
return {realmId: options.realmId, ...sdk}
}

export type QBOSDK = ReturnType<typeof initQBOSdk>

export const qboServer = {
newInstance: ({config, settings, fetchLinks}) => {
const qbo = initQBOSdk({
Expand Down Expand Up @@ -63,21 +65,6 @@ export const qboServer = {
},

verticals: {
banking: {
list: async (qbo, type, _opts) => {
switch (type) {
case 'category': {
const res = await qbo.query(
// QBO API does not support OR in SQL query...
"SELECT * FROM Account WHERE Classification IN ('Revenue', 'Expense')",
)
return {hasNextPage: false, items: res.Account ?? []}
}
default:
throw new Error(`Not implemented: ${type}`)
}
},
},
accounting: {
list: async (qbo, type, _opts) => {
switch (type) {
Expand Down
6 changes: 0 additions & 6 deletions kits/cdk/connector.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ import type {
} from './protocol'
import type {
AccountingMethods,
BankingMethods,
InvestmentMethods,
PtaMethods,
ZAccounting,
ZBanking,
ZInvestment,
ZPta,
} from './verticals'
Expand All @@ -47,10 +45,6 @@ export interface Verticals<
models: ZInvestment
methods: InvestmentMethods<TDef, TInstance>
}
banking: {
models: ZBanking
methods: BankingMethods<TDef, TInstance>
}
/** plain text accounting */
pta: {
models: ZPta
Expand Down
246 changes: 7 additions & 239 deletions kits/sdk/venice.oas.d.ts

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

Loading

0 comments on commit 8bfce07

Please sign in to comment.