From bef006380c51de6bf23feb64363b2063e514f9b7 Mon Sep 17 00:00:00 2001 From: ogzhanolguncu Date: Thu, 20 Jun 2024 12:09:25 +0300 Subject: [PATCH 1/7] feat: allow passing array when querying --- src/commands/client/query/index.test.ts | 64 +++++++++++++++++++++++++ src/commands/client/query/index.ts | 7 +-- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/src/commands/client/query/index.test.ts b/src/commands/client/query/index.test.ts index 6db777c..6e728dc 100644 --- a/src/commands/client/query/index.test.ts +++ b/src/commands/client/query/index.test.ts @@ -325,4 +325,68 @@ describe("QUERY with Index Client", () => { }, ]); }); + + test("should query in batches", async () => { + const ID = randomID(); + const initialData = [ + { + id: `1-${ID}`, + vector: range(0, 384), + metadata: { + animal: "elephant", + tags: ["mammal"], + diet: "herbivore", + }, + }, + { + id: `2-${ID}`, + vector: range(0, 384), + metadata: { + animal: "tiger", + tags: ["mammal"], + diet: "carnivore", + }, + }, + ]; + + await index.upsert(initialData); + + await awaitUntilIndexed(index); + + const res = await index.query<{ + animal: string; + tags: string[]; + diet: string; + }>([ + { + vector: initialData[0].vector, + topK: 1, + filter: "tags[0] = 'mammal' AND diet = 'carnivore'", + includeVectors: true, + includeMetadata: true, + }, + { + vector: initialData[1].vector, + topK: 1, + filter: "tags[0] = 'mammal' AND diet = 'herbivore'", + includeVectors: true, + includeMetadata: true, + }, + ]); + + expect(res).toEqual([ + { + id: `1-${ID}`, + score: 1, + vector: initialData[0].vector, + metadata: { animal: "tiger", tags: ["mammal"], diet: "carnivore" }, + }, + { + id: `2-${ID}`, + score: 1, + vector: initialData[1].vector, + metadata: { animal: "tiger", tags: ["mammal"], diet: "carnivore" }, + }, + ]); + }); }); diff --git a/src/commands/client/query/index.ts b/src/commands/client/query/index.ts index d4eeea7..c1631f6 100644 --- a/src/commands/client/query/index.ts +++ b/src/commands/client/query/index.ts @@ -27,11 +27,12 @@ type QueryEndpointVariants = | `query-data/${NAMESPACE}`; export class QueryCommand extends Command[]> { - constructor(payload: QueryCommandPayload, options?: QueryCommandOptions) { + constructor(payload: QueryCommandPayload[] | QueryCommandPayload, options?: QueryCommandOptions) { let endpoint: QueryEndpointVariants = "query"; - if ("data" in payload) { - endpoint = "query-data"; + if (Array.isArray(payload)) { + const hasData = payload.some((p) => p.data); + endpoint = hasData ? "query-data" : "query"; } if (options?.namespace) { From a26b20a3b44115d6738e68b9192c120c720ed1e5 Mon Sep 17 00:00:00 2001 From: ogzhanolguncu Date: Thu, 20 Jun 2024 14:46:48 +0300 Subject: [PATCH 2/7] feat: make two separate apis for querying --- src/commands/client/index.ts | 2 +- src/commands/client/query/index.ts | 46 +----- .../client/query/query-many/index.test.ts | 147 ++++++++++++++++++ src/commands/client/query/query-many/index.ts | 22 +++ .../query/{ => query-single}/index.test.ts | 64 -------- .../client/query/query-single/index.ts | 23 +++ src/commands/client/query/types.ts | 25 +++ src/commands/client/update/index.test.ts | 16 +- src/commands/types.ts | 2 +- src/vector.ts | 42 ++++- 10 files changed, 273 insertions(+), 116 deletions(-) create mode 100644 src/commands/client/query/query-many/index.test.ts create mode 100644 src/commands/client/query/query-many/index.ts rename src/commands/client/query/{ => query-single}/index.test.ts (84%) create mode 100644 src/commands/client/query/query-single/index.ts create mode 100644 src/commands/client/query/types.ts diff --git a/src/commands/client/index.ts b/src/commands/client/index.ts index 477414f..0815ee1 100644 --- a/src/commands/client/index.ts +++ b/src/commands/client/index.ts @@ -1,5 +1,5 @@ export * from "./delete"; -export * from "./query"; +export * from "./query/query-single"; export * from "./upsert"; export * from "./fetch"; export * from "./range"; diff --git a/src/commands/client/query/index.ts b/src/commands/client/query/index.ts index c1631f6..cc0c050 100644 --- a/src/commands/client/query/index.ts +++ b/src/commands/client/query/index.ts @@ -1,44 +1,2 @@ -import type { NAMESPACE } from "@commands/client/types"; -import { Dict } from "@commands/client/types"; -import { Command } from "@commands/command"; - -type QueryCommandPayload = { - topK: number; - filter?: string; - includeVectors?: boolean; - includeMetadata?: boolean; - includeData?: boolean; -} & ({ vector: number[]; data?: never } | { data: string; vector?: never }); - -export type QueryResult = { - id: number | string; - score: number; - vector?: number[]; - metadata?: TMetadata; - data?: string; -}; - -type QueryCommandOptions = { namespace?: string }; - -type QueryEndpointVariants = - | `query` - | `query-data` - | `query/${NAMESPACE}` - | `query-data/${NAMESPACE}`; - -export class QueryCommand extends Command[]> { - constructor(payload: QueryCommandPayload[] | QueryCommandPayload, options?: QueryCommandOptions) { - let endpoint: QueryEndpointVariants = "query"; - - if (Array.isArray(payload)) { - const hasData = payload.some((p) => p.data); - endpoint = hasData ? "query-data" : "query"; - } - - if (options?.namespace) { - endpoint = `${endpoint}/${options.namespace}`; - } - - super(payload, endpoint); - } -} +export * from "./query-many"; +export * from "./query-single"; diff --git a/src/commands/client/query/query-many/index.test.ts b/src/commands/client/query/query-many/index.test.ts new file mode 100644 index 0000000..d6a528c --- /dev/null +++ b/src/commands/client/query/query-many/index.test.ts @@ -0,0 +1,147 @@ +import { afterAll, describe, expect, test } from "bun:test"; +import { UpsertCommand } from "@commands/client/upsert"; +import { Index, awaitUntilIndexed, newHttpClient, randomID, range } from "@utils/test-utils"; +import { QueryManyCommand } from "."; + +const client = newHttpClient(); + +describe("QUERY", () => { + const index = new Index(); + + afterAll(async () => { + await index.reset(); + }); + test("should query in batches successfully", async () => { + const ID = randomID(); + const initialData = [ + { + id: `1-${ID}`, + vector: range(0, 384), + metadata: { + animal: "elephant", + tags: ["mammal"], + diet: "herbivore", + }, + }, + { + id: `2-${ID}`, + vector: range(0, 384), + metadata: { + animal: "tiger", + tags: ["mammal"], + diet: "carnivore", + }, + }, + ]; + await new UpsertCommand(initialData).exec(client); + + await awaitUntilIndexed(client); + + const res = await new QueryManyCommand<{ + animal: string; + tags: string[]; + diet: string; + }>([ + { + vector: initialData[0].vector, + topK: 1, + filter: "tags[0] = 'mammal' AND diet = 'herbivore'", + includeMetadata: true, + }, + { + vector: initialData[1].vector, + topK: 1, + filter: "tags[0] = 'mammal' AND diet = 'carnivore'", + includeMetadata: true, + }, + ]).exec(client); + + expect(res).toEqual([ + [ + { + id: `1-${ID}`, + score: 1, + metadata: { animal: "elephant", tags: ["mammal"], diet: "herbivore" }, + }, + ], + [ + { + id: `2-${ID}`, + score: 1, + metadata: { animal: "tiger", tags: ["mammal"], diet: "carnivore" }, + }, + ], + ]); + }); +}); + +describe("QUERY with Index Client", () => { + const index = new Index(); + + afterAll(async () => { + await index.reset(); + }); + test("should query in batches successfully", async () => { + const ID = randomID(); + const initialData = [ + { + id: `1-${ID}`, + vector: range(0, 384), + metadata: { + animal: "elephant", + tags: ["mammal"], + diet: "herbivore", + }, + }, + { + id: `2-${ID}`, + vector: range(0, 384), + metadata: { + animal: "tiger", + tags: ["mammal"], + diet: "carnivore", + }, + }, + ]; + + await index.upsert(initialData); + + await awaitUntilIndexed(index); + + const res = await index.queryMany<{ + animal: string; + tags: string[]; + diet: string; + }>([ + { + vector: initialData[0].vector, + topK: 1, + filter: "tags[0] = 'mammal' AND diet = 'herbivore'", + includeMetadata: true, + }, + { + vector: initialData[1].vector, + topK: 1, + filter: "tags[0] = 'mammal' AND diet = 'carnivore'", + includeMetadata: true, + }, + ]); + + expect(res).toEqual([ + [ + { + id: `1-${ID}`, + score: 1, + metadata: { animal: "elephant", tags: ["mammal"], diet: "herbivore" }, + }, + ], + [ + { + id: `2-${ID}`, + score: 1, + metadata: { animal: "tiger", tags: ["mammal"], diet: "carnivore" }, + }, + ], + ]); + }); +}); diff --git a/src/commands/client/query/query-many/index.ts b/src/commands/client/query/query-many/index.ts new file mode 100644 index 0000000..1b178da --- /dev/null +++ b/src/commands/client/query/query-many/index.ts @@ -0,0 +1,22 @@ +import { Command } from "@commands/command"; +import { + QueryCommandOptions, + QueryCommandPayload, + QueryEndpointVariants, + QueryResult, +} from "../types"; + +export class QueryManyCommand extends Command[][]> { + constructor(payload: QueryCommandPayload[], options?: QueryCommandOptions) { + let endpoint: QueryEndpointVariants = "query"; + + const hasData = payload.some((p) => p.data); + endpoint = hasData ? "query-data" : "query"; + + if (options?.namespace) { + endpoint = `${endpoint}/${options.namespace}`; + } + + super(payload, endpoint); + } +} diff --git a/src/commands/client/query/index.test.ts b/src/commands/client/query/query-single/index.test.ts similarity index 84% rename from src/commands/client/query/index.test.ts rename to src/commands/client/query/query-single/index.test.ts index 6e728dc..6db777c 100644 --- a/src/commands/client/query/index.test.ts +++ b/src/commands/client/query/query-single/index.test.ts @@ -325,68 +325,4 @@ describe("QUERY with Index Client", () => { }, ]); }); - - test("should query in batches", async () => { - const ID = randomID(); - const initialData = [ - { - id: `1-${ID}`, - vector: range(0, 384), - metadata: { - animal: "elephant", - tags: ["mammal"], - diet: "herbivore", - }, - }, - { - id: `2-${ID}`, - vector: range(0, 384), - metadata: { - animal: "tiger", - tags: ["mammal"], - diet: "carnivore", - }, - }, - ]; - - await index.upsert(initialData); - - await awaitUntilIndexed(index); - - const res = await index.query<{ - animal: string; - tags: string[]; - diet: string; - }>([ - { - vector: initialData[0].vector, - topK: 1, - filter: "tags[0] = 'mammal' AND diet = 'carnivore'", - includeVectors: true, - includeMetadata: true, - }, - { - vector: initialData[1].vector, - topK: 1, - filter: "tags[0] = 'mammal' AND diet = 'herbivore'", - includeVectors: true, - includeMetadata: true, - }, - ]); - - expect(res).toEqual([ - { - id: `1-${ID}`, - score: 1, - vector: initialData[0].vector, - metadata: { animal: "tiger", tags: ["mammal"], diet: "carnivore" }, - }, - { - id: `2-${ID}`, - score: 1, - vector: initialData[1].vector, - metadata: { animal: "tiger", tags: ["mammal"], diet: "carnivore" }, - }, - ]); - }); }); diff --git a/src/commands/client/query/query-single/index.ts b/src/commands/client/query/query-single/index.ts new file mode 100644 index 0000000..2a69181 --- /dev/null +++ b/src/commands/client/query/query-single/index.ts @@ -0,0 +1,23 @@ +import { Command } from "@commands/command"; +import { + QueryCommandOptions, + QueryCommandPayload, + QueryEndpointVariants, + QueryResult, +} from "../types"; + +export class QueryCommand extends Command[]> { + constructor(payload: QueryCommandPayload, options?: QueryCommandOptions) { + let endpoint: QueryEndpointVariants = "query"; + + if ("data" in payload) { + endpoint = "query-data"; + } + + if (options?.namespace) { + endpoint = `${endpoint}/${options.namespace}`; + } + + super(payload, endpoint); + } +} diff --git a/src/commands/client/query/types.ts b/src/commands/client/query/types.ts new file mode 100644 index 0000000..d154115 --- /dev/null +++ b/src/commands/client/query/types.ts @@ -0,0 +1,25 @@ +import { Dict, NAMESPACE } from "../types"; + +export type QueryCommandPayload = { + topK: number; + filter?: string; + includeVectors?: boolean; + includeMetadata?: boolean; + includeData?: boolean; +} & ({ vector: number[]; data?: never } | { data: string; vector?: never }); + +export type QueryResult = { + id: number | string; + score: number; + vector?: number[]; + metadata?: TMetadata; + data?: string; +}; + +export type QueryCommandOptions = { namespace?: string }; + +export type QueryEndpointVariants = + | `query` + | `query-data` + | `query/${NAMESPACE}` + | `query-data/${NAMESPACE}`; diff --git a/src/commands/client/update/index.test.ts b/src/commands/client/update/index.test.ts index f3a5607..83ce697 100644 --- a/src/commands/client/update/index.test.ts +++ b/src/commands/client/update/index.test.ts @@ -1,6 +1,12 @@ import { afterAll, describe, expect, test } from "bun:test"; import { FetchCommand, UpdateCommand, UpsertCommand } from "@commands/index"; -import { Index, awaitUntilIndexed, newHttpClient, range, resetIndexes } from "@utils/test-utils"; +import { + Index, + awaitUntilIndexed, + newHttpClient, + range, + resetIndexes, +} from "@utils/test-utils"; const client = newHttpClient(); @@ -50,7 +56,9 @@ test("should update vector data", async () => { expect(res.length).toEqual(1); expect(res[0]?.data).toEqual("hello"); - const updated = await new UpdateCommand({ id: "1", data: "there" }).exec(client); + const updated = await new UpdateCommand({ id: "1", data: "there" }).exec( + client + ); expect(updated).toEqual({ updated: 1 }); await awaitUntilIndexed(client, 5000); @@ -83,8 +91,6 @@ describe("UPDATE with Index Client", () => { metadata: { upstash: "test-simple" }, }); - await awaitUntilIndexed(index); - const res = await index.update({ id: 1, metadata: { upstash: "test-update" }, @@ -92,7 +98,7 @@ describe("UPDATE with Index Client", () => { expect(res).toEqual({ updated: 1 }); - await awaitUntilIndexed(client, 5000); + await awaitUntilIndexed(client); const fetchData = await index.fetch(["1"], { includeMetadata: true }); diff --git a/src/commands/types.ts b/src/commands/types.ts index 5e51d41..4ff9894 100644 --- a/src/commands/types.ts +++ b/src/commands/types.ts @@ -1,5 +1,5 @@ export { type Vector } from "./client/types"; export { type RangeResult } from "./client/range/index"; export { type FetchResult } from "./client/fetch/index"; -export { type QueryResult } from "./client/query/index"; +export { type QueryResult } from "./client/query/types"; export { type InfoResult } from "./client/info/index"; diff --git a/src/vector.ts b/src/vector.ts index 7fd7e1f..d6c31f0 100644 --- a/src/vector.ts +++ b/src/vector.ts @@ -12,6 +12,7 @@ import { import { Dict } from "@commands/client/types"; import { DeleteNamespaceCommand, ListNamespacesCommand } from "@commands/management"; import { Requester } from "@http"; +import { QueryManyCommand } from "./commands"; export type CommandArgs any> = ConstructorParameters[0]; @@ -73,14 +74,53 @@ export class Index { * @param {string} [args.filter] - An optional filter string to be used in the query. The filter string is used to narrow down the query results. * @param {boolean} [args.includeVectors=false] - When set to true, includes the feature vectors of the returned items in the response. * @param {boolean} [args.includeMetadata=false] - When set to true, includes additional metadata of the returned items in the response. + * @param {boolean} [args.includeData=false] - When set to true, includes data - string - of the returned items in the response. * - * @returns A promise that resolves with an array of query result objects when the request to query the index is completed. + * A promise that resolves with an array of query result objects when the request to query the index is completed. */ query = ( args: CommandArgs, options?: { namespace?: string } ) => new QueryCommand(args, options).exec(this.client); + /** + * Queries an index with specified parameters. + * This method creates and executes a query command on an index based on the provided arguments. + * + * @example + * ```js + * await index.queryMany([ + * { + * topK: 3, + * vector: [0.22, 0.66], + * filter: "age >= 23 and (type = 'turtle' OR type = 'cat')", + * }, + * { + * topK: 3, + * vector: [0.45, 0.52], + * filter: "age >= 27 and (type = 'rabbit' OR type = 'dog')", + * }, + * ]); + * + * ``` + * + * @param {Object} args - The arguments for the query command. + * @param {number[]} args.vector - An array of numbers representing the feature vector for the query. + * This vector is utilized to find the most relevant items in the index. + * @param {number} args.topK - The desired number of top results to be returned, based on relevance or similarity to the query vector. + * @param {string} [args.filter] - An optional filter string to be used in the query. The filter string is used to narrow down the query results. + * @param {boolean} [args.includeVectors=false] - When set to true, includes the feature vectors of the returned items in the response. + * @param {boolean} [args.includeMetadata=false] - When set to true, includes additional metadata of the returned items in the response. + * @param {boolean} [args.includeData=false] - When set to true, includes additional metadata of the returned items in the response. + * + * A promise that resolves with an array of arrays of query result objects, + * where each inner array represents a group of results matching a specific query condition. + */ + queryMany = ( + args: CommandArgs, + options?: { namespace?: string } + ) => new QueryManyCommand(args, options).exec(this.client); + /** * Upserts (Updates and Inserts) specific items into the index. * It's used for adding new items to the index or updating existing ones. From 0f616d6b97f9ab69daf1f1837ecdb684792f4de9 Mon Sep 17 00:00:00 2001 From: ogzhanolguncu Date: Thu, 20 Jun 2024 14:49:07 +0300 Subject: [PATCH 3/7] fix: broken test file --- src/commands/client/update/index.test.ts | 74 ++++++++++++------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/src/commands/client/update/index.test.ts b/src/commands/client/update/index.test.ts index 83ce697..94f9bca 100644 --- a/src/commands/client/update/index.test.ts +++ b/src/commands/client/update/index.test.ts @@ -27,7 +27,7 @@ describe("UPDATE", () => { expect(res).toEqual({ updated: 1 }); - await awaitUntilIndexed(client, 5000); + await awaitUntilIndexed(client); const fetchData = await new FetchCommand<{ upstash: string }>([ ["1"], @@ -36,43 +36,43 @@ describe("UPDATE", () => { expect(fetchData[0]?.metadata?.upstash).toBe("test-update"); }); -}); -test("should update vector data", async () => { - await new UpsertCommand({ - id: 1, - data: "hello", - metadata: { upstash: "test-simple" }, - }).exec(client); - await awaitUntilIndexed(client, 5000); - - const res = await new FetchCommand([ - [1], - { - includeData: true, - }, - ]).exec(client); - - expect(res.length).toEqual(1); - expect(res[0]?.data).toEqual("hello"); - - const updated = await new UpdateCommand({ id: "1", data: "there" }).exec( - client - ); - expect(updated).toEqual({ updated: 1 }); - await awaitUntilIndexed(client, 5000); - - const newRes = await new FetchCommand([ - [1], - { - includeData: true, - includeMetadata: true, - }, - ]).exec(client); - - expect(newRes.length).toEqual(1); - expect(newRes[0]?.data).toEqual("there"); - expect(newRes[0]?.metadata).toEqual({ upstash: "test-simple" }); + test("should update vector data", async () => { + await new UpsertCommand({ + id: 1, + data: "hello", + metadata: { upstash: "test-simple" }, + }).exec(client); + await awaitUntilIndexed(client); + + const res = await new FetchCommand([ + [1], + { + includeData: true, + }, + ]).exec(client); + + expect(res.length).toEqual(1); + expect(res[0]?.data).toEqual("hello"); + + const updated = await new UpdateCommand({ id: "1", data: "there" }).exec( + client + ); + expect(updated).toEqual({ updated: 1 }); + await awaitUntilIndexed(client); + + const newRes = await new FetchCommand([ + [1], + { + includeData: true, + includeMetadata: true, + }, + ]).exec(client); + + expect(newRes.length).toEqual(1); + expect(newRes[0]?.data).toEqual("there"); + expect(newRes[0]?.metadata).toEqual({ upstash: "test-simple" }); + }); }); describe("UPDATE with Index Client", () => { From b747142f2b116a928cea7d495706f95a58468d76 Mon Sep 17 00:00:00 2001 From: ogzhanolguncu Date: Thu, 20 Jun 2024 14:50:27 +0300 Subject: [PATCH 4/7] fix: broken test file --- src/commands/client/update/index.test.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/commands/client/update/index.test.ts b/src/commands/client/update/index.test.ts index 94f9bca..7253d0b 100644 --- a/src/commands/client/update/index.test.ts +++ b/src/commands/client/update/index.test.ts @@ -1,12 +1,6 @@ import { afterAll, describe, expect, test } from "bun:test"; import { FetchCommand, UpdateCommand, UpsertCommand } from "@commands/index"; -import { - Index, - awaitUntilIndexed, - newHttpClient, - range, - resetIndexes, -} from "@utils/test-utils"; +import { Index, awaitUntilIndexed, newHttpClient, range, resetIndexes } from "@utils/test-utils"; const client = newHttpClient(); @@ -55,9 +49,7 @@ describe("UPDATE", () => { expect(res.length).toEqual(1); expect(res[0]?.data).toEqual("hello"); - const updated = await new UpdateCommand({ id: "1", data: "there" }).exec( - client - ); + const updated = await new UpdateCommand({ id: "1", data: "there" }).exec(client); expect(updated).toEqual({ updated: 1 }); await awaitUntilIndexed(client); From 1b0599d75ab2243c4d20c3380e2e92a399cdbfb1 Mon Sep 17 00:00:00 2001 From: ogzhanolguncu Date: Thu, 20 Jun 2024 14:54:12 +0300 Subject: [PATCH 5/7] fix: typo --- src/vector.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vector.ts b/src/vector.ts index d6c31f0..9a02147 100644 --- a/src/vector.ts +++ b/src/vector.ts @@ -111,7 +111,7 @@ export class Index { * @param {string} [args.filter] - An optional filter string to be used in the query. The filter string is used to narrow down the query results. * @param {boolean} [args.includeVectors=false] - When set to true, includes the feature vectors of the returned items in the response. * @param {boolean} [args.includeMetadata=false] - When set to true, includes additional metadata of the returned items in the response. - * @param {boolean} [args.includeData=false] - When set to true, includes additional metadata of the returned items in the response. + * @param {boolean} [args.includeData=false] - When set to true, includes data - string - of the returned items in the response. * * A promise that resolves with an array of arrays of query result objects, * where each inner array represents a group of results matching a specific query condition. From dc15c7fe422e726d400e3171d758f8ed3bd5a4fc Mon Sep 17 00:00:00 2001 From: ogzhanolguncu Date: Thu, 20 Jun 2024 17:00:54 +0300 Subject: [PATCH 6/7] fix: import typo --- src/commands/client/index.ts | 2 +- src/vector.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/client/index.ts b/src/commands/client/index.ts index 0815ee1..477414f 100644 --- a/src/commands/client/index.ts +++ b/src/commands/client/index.ts @@ -1,5 +1,5 @@ export * from "./delete"; -export * from "./query/query-single"; +export * from "./query"; export * from "./upsert"; export * from "./fetch"; export * from "./range"; diff --git a/src/vector.ts b/src/vector.ts index 9a02147..8ae8991 100644 --- a/src/vector.ts +++ b/src/vector.ts @@ -4,6 +4,7 @@ import { InfoCommand, Namespace, QueryCommand, + QueryManyCommand, RangeCommand, ResetCommand, UpdateCommand, @@ -12,7 +13,6 @@ import { import { Dict } from "@commands/client/types"; import { DeleteNamespaceCommand, ListNamespacesCommand } from "@commands/management"; import { Requester } from "@http"; -import { QueryManyCommand } from "./commands"; export type CommandArgs any> = ConstructorParameters[0]; From 02dba26e8224c3ddf9a85f7abbb1477c61a19a25 Mon Sep 17 00:00:00 2001 From: ogzhanolguncu Date: Thu, 20 Jun 2024 17:29:52 +0300 Subject: [PATCH 7/7] chore: format --- src/commands/client/update/index.test.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/commands/client/update/index.test.ts b/src/commands/client/update/index.test.ts index b817f5b..7e989fb 100644 --- a/src/commands/client/update/index.test.ts +++ b/src/commands/client/update/index.test.ts @@ -1,12 +1,6 @@ import { afterAll, describe, expect, test } from "bun:test"; import { FetchCommand, UpdateCommand, UpsertCommand } from "@commands/index"; -import { - Index, - awaitUntilIndexed, - newHttpClient, - range, - resetIndexes, -} from "@utils/test-utils"; +import { Index, awaitUntilIndexed, newHttpClient, range, resetIndexes } from "@utils/test-utils"; const client = newHttpClient(); @@ -77,9 +71,7 @@ describe("UPDATE", () => { expect(res.length).toEqual(1); expect(res[0]?.data).toEqual("hello"); - const updated = await new UpdateCommand({ id: "1", data: "there" }).exec( - client - ); + const updated = await new UpdateCommand({ id: "1", data: "there" }).exec(client); await awaitUntilIndexed(client, 5000); expect(updated).toEqual({ updated: 1 });