diff --git a/apps/cli/cli-utils.ts b/apps/cli/cli-utils.ts index bd527824..ba11383b 100644 --- a/apps/cli/cli-utils.ts +++ b/apps/cli/cli-utils.ts @@ -52,7 +52,11 @@ export async function printResult( }) } else { console.log(res) - const out = opts?.json ? JSON.stringify(await res) : await res + let out = opts?.json ? JSON.stringify(await res) : await res + if (out && typeof out === 'object' && 'data' in out) { + out = out.data + } + if (opts?.minimal || process.env['SILENT']) { // console.log('[printResult]') process.stdout.write(`${out}\n`) diff --git a/packages/airbyte/airbyte-sdk.ts b/packages/airbyte/airbyte-sdk.ts index 88d072ae..8287ca1f 100644 --- a/packages/airbyte/airbyte-sdk.ts +++ b/packages/airbyte/airbyte-sdk.ts @@ -9,32 +9,39 @@ import type {paths as streams} from './api/airbyte-api-streams.gen' import type {paths as workspaces} from './api/airbyte-api-workspaces.gen' import type {paths as internal} from './api/airbyte-private-api.gen' -interface paths { +interface PublicPaths { connections: connections destinations: destinations - health: health jobs: jobs sources: sources streams: streams workspaces: workspaces } +interface PrivatePaths { + health: health + internal: internal +} + export interface AirbyteSDKOptions { accessToken: string } -export function AirbytePublicSDK( +export function AirbytePublicSDK( opts: AirbyteSDKOptions, ) { - return createClient({ - baseUrl: 'https://api.airbyte.com', + return createClient({ + baseUrl: 'https://api.airbyte.com/v1', headers: {Authorization: `Bearer ${opts.accessToken}`}, }) } -export function AirbytePrivateSDK() { - return createClient({ +export function AirbytePrivateSDK( + opts: AirbyteSDKOptions, +) { + return createClient({ // TODO: Figure out the right path to the private api baseUrl: 'https://api.airbyte.com', + headers: {Authorization: `Bearer ${opts.accessToken}`}, }) }