Skip to content

Commit

Permalink
Merge pull request #39 from upstash/DX-1051
Browse files Browse the repository at this point in the history
feat: add includeData support to range
  • Loading branch information
ogzhanolguncu authored Jul 5, 2024
2 parents 10b7792 + 401b88a commit fcd01c9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/commands/client/fetch/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ describe("FETCH", () => {
});

describe("FETCH with Index Client", () => {
afterAll(async () => await resetIndexes());
const index = new Index({
token: process.env.UPSTASH_VECTOR_REST_TOKEN!,
url: process.env.UPSTASH_VECTOR_REST_URL!,
Expand Down
6 changes: 3 additions & 3 deletions src/commands/client/range/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("RANGE", () => {
test("should paginate records successfully", async () => {
const randomizedData = new Array(20)
.fill("")
.map(() => ({ id: randomID(), vector: range(0, 384) }));
.map(() => ({ id: randomID(), data: "Test data" }));

const payloads = randomizedData.map((data) => new UpsertCommand(data).exec(client));
await Promise.all(payloads);
Expand All @@ -27,9 +27,9 @@ describe("RANGE", () => {
const res = await new RangeCommand({
cursor: 0,
limit: 5,
includeVectors: true,
includeData: true,
}).exec(client);
expect(res.nextCursor).toBe("5");
expect(res.vectors[0].data).toEqual("Test data");
});
});

Expand Down
1 change: 1 addition & 0 deletions src/commands/client/range/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type RangeCommandPayload = {
limit: number;
includeVectors?: boolean;
includeMetadata?: boolean;
includeData?: boolean;
};

type RangeCommandOptions = { namespace?: string };
Expand Down
1 change: 1 addition & 0 deletions src/commands/client/upsert/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ describe("UPSERT with Index Client", () => {
});

describe("Upsert with new data field", () => {
afterAll(async () => await resetIndexes());
test("should add data to data field - /upsert-data", async () => {
const id = randomID();
const data = "testing data";
Expand Down

0 comments on commit fcd01c9

Please sign in to comment.