Skip to content

Commit

Permalink
Change name of class
Browse files Browse the repository at this point in the history
  • Loading branch information
ogzhanolguncu committed Jan 11, 2024
1 parent 43db231 commit 61e71df
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

bun run fmt && bun run test
6 changes: 3 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type VectorConfig = {
/**
* Serverless vector client for upstash.
*/
export class Vector extends core.Vector {
export class Index extends core.Index {
/**
* Create a new vector client by providing the url and token
*
Expand Down Expand Up @@ -105,7 +105,7 @@ export class Vector extends core.Vector {
* This tries to load `UPSTASH_VECTOR_REST_URL` and `UPSTASH_VECTOR_REST_TOKEN` from
* your environment using `process.env`.
*/
static fromEnv(config?: Omit<VectorConfig, "url" | "token">): Vector {
static fromEnv(config?: Omit<VectorConfig, "url" | "token">): Index {
const url = process?.env.UPSTASH_VECTOR_REST_URL;
if (!url) {
throw new Error("Unable to find environment variable: `UPSTASH_VECTOR_REST_URL`");
Expand All @@ -114,6 +114,6 @@ export class Vector extends core.Vector {
if (!token) {
throw new Error("Unable to find environment variable: `UPSTASH_VECTOR_REST_TOKEN`");
}
return new Vector({ ...config, url, token });
return new Index({ ...config, url, token });
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"url": "https://github.com/upstash/vector/issues"
},
"scripts": {
"test": "bun test src --coverage --bail",
"test": "bun test src --coverage --bail --coverageSkipTestFiles=[test-utils.ts]",
"fmt": "bunx biome check --apply ./src",
"build": "tsup",
"prepare": "husky install"
Expand Down
8 changes: 4 additions & 4 deletions src/vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ export type CommandArgs<TCommand extends new (_args: any) => any> =
/**
* Serverless vector client for upstash vector db.
*/
export class Vector {
export class Index {
protected client: Requester;

/**
* Create a new vector db client
*
* @example
* ```typescript
* const redis = new Vector({
* url: "<UPSTASH_REDIS_REST_URL>",
* token: "<UPSTASH_REDIS_REST_TOKEN>",
* const index = new Index({
* url: "<UPSTASH_VECTOR_REST_URL>",
* token: "<UPSTASH_VECTOR_REST_TOKEN>",
* });
* ```
*/
Expand Down

0 comments on commit 61e71df

Please sign in to comment.