Skip to content

Commit

Permalink
chore: Fix up sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyxiao committed Nov 26, 2023
1 parent 1d5fd23 commit b27f12f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions kits/connect/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@usevenice/connect",
"version": "0.0.6",
"version": "0.1.4",
"sideEffects": false,
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc -p ./tsconfig.json",
"clean": "rm -rf ./dist",
"prepack": "pnpm run build"
"pub": "pnpm publish --no-git-checks"
},
"dependencies": {
"@usevenice/sdk": "workspace:*",
Expand Down
10 changes: 9 additions & 1 deletion kits/sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export interface VeniceClientOptions {
apiKey?: string
/** `reso_xxx` */
resourceId?: string
/** For end user authentication */
accessToken?: string
/** For using things like self hosting and staging env */
apiHost?: string
}

// This is necessary because we cannot publish inferred type otherwise
Expand All @@ -19,11 +23,15 @@ export type VeniceClient = ReturnType<typeof createClient<paths>> & {

export function createVeniceClient(opts: VeniceClientOptions): VeniceClient {
const client = createClient<paths>({
baseUrl: 'https://app.venice.is/api/v0',
baseUrl: new URL(
'/api/v0',
opts.apiHost ?? 'https://app.venice.is',
).toString(),
headers: {
// NOTE: Centralize reference to these headers
...(opts.apiKey && {'x-apikey': opts.apiKey}),
...(opts.resourceId && {'x-resource-id': opts.resourceId}),
...(opts.accessToken && {Authorization: `Bearer ${opts.accessToken}`}),
},
})
return {...client, oas}
Expand Down
6 changes: 3 additions & 3 deletions kits/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@usevenice/sdk",
"version": "0.0.0",
"version": "0.0.3",
"private": false,
"sideEffects": false,
"module": "./index.ts",
Expand All @@ -12,10 +12,10 @@
"pub": "pnpm publish --no-git-checks --access public"
},
"dependencies": {
"@usevenice/openapi-client": "workspace:*",
"@usevenice/zod": "workspace:*"
"@usevenice/openapi-client": "workspace:*"
},
"devDependencies": {
"@usevenice/zod": "workspace:*",
"openapi-typescript": "7.0.0-next.3"
}
}
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

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

1 comment on commit b27f12f

@vercel
Copy link

@vercel vercel bot commented on b27f12f Nov 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

venice – ./

venice-venice.vercel.app
venice-git-production-venice.vercel.app
usevenice.vercel.app
app.venice.is

Please sign in to comment.