From 3d805fcb40c981ba88cbafc829de182794f8e3dd Mon Sep 17 00:00:00 2001 From: hlts2 Date: Mon, 25 Dec 2023 13:52:02 +0900 Subject: [PATCH 01/10] feat: add ts e2e test Signed-off-by: hlts2 --- tests/e2e.test.ts | 1678 ++++++++++++++++++++++----------------------- 1 file changed, 839 insertions(+), 839 deletions(-) diff --git a/tests/e2e.test.ts b/tests/e2e.test.ts index 8d2ecbc..00a4b34 100644 --- a/tests/e2e.test.ts +++ b/tests/e2e.test.ts @@ -17,7 +17,6 @@ import { UpsertClient } from "../src/vald/v1/vald/upsert_pb.grpc-client"; import { ObjectClient } from "../src/vald/v1/vald/object_pb.grpc-client"; import { AgentClient } from "../src/vald/v1/agent/core/agent_pb.grpc-client"; import data = require("./wordvecs1000.json"); -import { v1_payload } from ".."; const address = "localhost:8081"; const connectDeadlineMs = 10000; @@ -66,7 +65,7 @@ describe("Tests for node client", () => { client.insert(req, (err, resp) => { try { expect(err).toBeFalsy(); - expect(payload.Object_Location.is(resp)).toBe(true) + expect(payload.Object_Location.is(resp)).toBe(true); done(); } catch (e) { @@ -75,842 +74,843 @@ describe("Tests for node client", () => { }); }); - // test("MultiInsert", (done) => { - // const requests: Array = []; - // const cfg = payload.Insert_Config?.create({ - // skip_strict_exist_check: true, - // }); - // - // for (let i = 1; i < 11; i++) { - // const vec = payload.Object_Vector?.create({ - // id: data[i].id, - // vector: data[i].vector, - // }); - // - // const r = payload.Insert_Request?.create({ - // vector: vec, - // config: cfg, - // }); - // - // requests.push(r); - // } - // - // const req = payload.Insert_MultiRequest?.create({ - // requests: requests, - // }); - // - // client.multiInsert(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Object_Locations); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("StreamInsert", (done) => { - // const cfg = payload.Insert_Config?.create({ - // skip_strict_exist_check: true, - // }); - // - // const channel = client.streamInsert(); - // channel.on("data", (message) => { - // try { - // expect(message).toBeInstanceOf(payload.Object_StreamLocation); - // if (message.hasStatus()) { - // const status = message.getStatus(); - // if (status) { - // expect(status.getCode()).toEqual(0); - // } - // } - // } catch (e) { - // done(e); - // } - // }); - // channel.on("end", () => { - // done(); - // }); - // channel.on("error", (e) => { - // done(e); - // }); - // - // for (let i = 11; i < 101; i++) { - // const vec = payload.Object_Vector?.create({ - // id: data[i].id, - // vector: data[i].vector, - // }); - // - // const r = payload.Insert_Request?.create({ - // vector: vec, - // config: cfg, - // }); - // channel.write(r); - // } - // - // channel.end(); - // }); - // }); - // - // describe("Tests for creating indices operations", () => { - // let client: AgentClient; - // - // beforeAll((done) => { - // client = new agent_grpc.AgentClient( - // address, - // grpc.credentials?.createInsecure(), - // ); - // client.waitForReady(Date.now() + connectDeadlineMs, (e) => { - // if (e) { - // done(e); - // } else { - // done(); - // } - // }); - // }); - // - // afterAll(() => { - // client.close(); - // }); - // - // test("CreateIndex", (done) => { - // const req = payload.Control_CreateIndexRequest?.create({ - // pool_size: 10000, - // }); - // - // client?.createIndex(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Empty); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("SaveIndex", (done) => { - // const req = payload.Empty?.create(); - // - // client.saveIndex(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Empty); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("IndexInfo", (done) => { - // const req = payload.Empty?.create(); - // - // client.indexInfo(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Info_Index_Count); - // expect(resp?.stored).toEqual(101); - // expect(resp?.uncommitted).toEqual(0); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // }); - // - // describe("Test for object operations", () => { - // let client: ObjectClient; - // - // beforeAll((done) => { - // client = new object_grpc.ObjectClient( - // address, - // grpc.credentials?.createInsecure(), - // ); - // client.waitForReady(Date.now() + connectDeadlineMs, (e) => { - // if (e) { - // done(e); - // } else { - // done(); - // } - // }); - // }); - // - // afterAll(() => { - // client.close(); - // }); - // - // test("Exists", (done) => { - // const req = payload.Object_ID?.create({ - // id: data[0].id, - // }); - // - // client.exists(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Object_ID); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("GetObject", (done) => { - // const id = payload.Object_ID?.create({ - // id: data[0].id, - // }); - // - // const req = payload.Object_VectorRequest?.create({ - // id: id, - // }); - // - // client.getObject(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Object_Vector); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("StreamGetObject", (done) => { - // const channel = client.streamGetObject(); - // channel.on("data", (message) => { - // try { - // expect(message).toBeInstanceOf(payload.Object_StreamVector); - // if (message.hasStatus()) { - // const status = message.getStatus(); - // if (status) { - // expect(status.getCode()).toEqual(0); - // } - // } - // } catch (e) { - // done(e); - // } - // }); - // channel.on("end", () => { - // done(); - // }); - // channel.on("error", (e) => { - // done(e); - // }); - // - // for (let i = 0; i < 11; i++) { - // const id = payload.Object_ID?.create({ - // id: data[i].id, - // }); - // - // const req = payload.Object_VectorRequest?.create({ - // id: id, - // }); - // - // channel.write(req); - // } - // - // channel.end(); - // }); - // }); - // - // describe("Tests for search operations", () => { - // let client: SearchClient; - // - // beforeAll((done) => { - // client = new search_grpc.SearchClient( - // address, - // grpc.credentials?.createInsecure(), - // ); - // client.waitForReady(Date.now() + connectDeadlineMs, (e) => { - // if (e) { - // done(e); - // } else { - // done(); - // } - // }); - // }); - // - // afterAll(() => { - // client.close(); - // }); - // - // test("Search", (done) => { - // const cfg = payload.Search_Config?.create({ - // num: 3, - // radius: -1.0, - // epsilon: 0.1, - // timeout: BigInt(3000000000), - // }); - // - // const req = payload.Search_Request?.create({ - // vector: data[0].vector, - // config: cfg, - // }); - // - // client.search(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Search_Response); - // expect(resp?.results.length).toEqual(3); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("MultiSearch", (done) => { - // const requests: Array = []; - // const cfg = payload.Search_Config?.create({ - // num: 3, - // radius: -1.0, - // epsilon: 0.1, - // timeout: BigInt(3000000000), - // }); - // - // for (let i = 1; i < 11; i++) { - // const r = payload.Search_Request?.create({ - // vector: data[i].vector, - // config: cfg, - // }); - // requests.push(r); - // } - // - // const req = payload.Search_MultiRequest?.create({ - // requests: requests, - // }); - // - // client.multiSearch(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Search_Responses); - // for (var response of resp?.responses ?? []) { - // expect(response).toBeInstanceOf(payload.Search_Response); - // expect(response.results.length).toEqual(3); - // } - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("StreamSearch", (done) => { - // const cfg = payload.Search_Config?.create({ - // num: 3, - // radius: -1.0, - // epsilon: 0.1, - // timeout: BigInt(3000000000), - // }); - // - // const channel = client.streamSearch(); - // channel.on("data", (message) => { - // try { - // expect(message).toBeInstanceOf(payload.Search_StreamResponse); - // if (message.hasStatus()) { - // const status = message.getStatus(); - // if (status) { - // expect(status.getCode()).toEqual(0); - // } - // } - // } catch (e) { - // done(e); - // } - // }); - // channel.on("end", () => { - // done(); - // }); - // channel.on("error", (e) => { - // done(e); - // }); - // - // for (let i = 11; i < 21; i++) { - // const r = payload.Search_Request?.create({ - // vector: data[i].vector, - // config: cfg, - // }); - // - // channel.write(r); - // } - // - // channel.end(); - // }); - // - // test("SearchByID", (done) => { - // const cfg = payload.Search_Config?.create({ - // num: 3, - // radius: -1.0, - // epsilon: 0.1, - // timeout: BigInt(3000000000), - // }); - // - // const req = payload.Search_IDRequest?.create({ - // id: data[0].id, - // config: cfg, - // }); - // - // client.searchByID(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Search_Response); - // expect(resp?.results.length).toEqual(3); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("MultiSearchByID", (done) => { - // const requests: Array = []; - // const cfg = payload.Search_Config?.create({ - // num: 3, - // radius: -1.0, - // epsilon: 0.1, - // timeout: BigInt(3000000000), - // }); - // - // for (let i = 1; i < 11; i++) { - // const r = payload.Search_IDRequest?.create({ - // id: data[i].id, - // config: cfg, - // }); - // - // requests.push(r); - // } - // - // const req = payload.Search_MultiIDRequest?.create({ - // requests: requests, - // }); - // - // client.multiSearchByID(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Search_Responses); - // for (var response of resp?.responses ?? []) { - // expect(response).toBeInstanceOf(payload.Search_Response); - // expect(response.results.length).toEqual(3); - // } - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("StreamSearchByID", (done) => { - // const cfg = payload.Search_Config?.create({ - // num: 3, - // radius: -1.0, - // epsilon: 0.1, - // timeout: BigInt(3000000000), - // }); - // - // const channel = client.streamSearchByID(); - // channel.on("data", (message) => { - // try { - // expect(message).toBeInstanceOf(payload.Search_StreamResponse); - // if (message.hasStatus()) { - // const status = message.getStatus(); - // if (status) { - // expect(status.getCode()).toEqual(0); - // } - // } - // } catch (e) { - // done(e); - // } - // }); - // channel.on("end", () => { - // done(); - // }); - // channel.on("error", (e) => { - // done(e); - // }); - // - // for (let i = 11; i < 21; i++) { - // const r = payload.Search_IDRequest?.create({ - // id: data[i].id, - // config: cfg, - // }); - // channel.write(r); - // } - // - // channel.end(); - // }); - // }); - // - // describe("Tests for update operations", () => { - // let client: UpdateClient; - // - // beforeAll((done) => { - // client = new update_grpc.UpdateClient( - // address, - // grpc.credentials?.createInsecure(), - // ); - // client.waitForReady(Date.now() + connectDeadlineMs, (e) => { - // if (e) { - // done(e); - // } else { - // done(); - // } - // }); - // }); - // - // afterAll(() => { - // client.close(); - // }); - // - // test("Update", (done) => { - // const vec = payload.Object_Vector?.create({ - // id: data[0].id, - // vector: data[1].vector, - // }); - // const cfg = payload.Update_Config?.create({ - // skip_strict_exist_check: true, - // }); - // - // const req = payload.Update_Request?.create({ - // vector: vec, - // config: cfg, - // }); - // - // client.update(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Object_Location); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("MultiUpdate", (done) => { - // const requests: Array = []; - // const cfg = payload.Update_Config?.create({ - // skip_strict_exist_check: true, - // }); - // - // for (let i = 1; i < 11; i++) { - // const vec = payload.Object_Vector?.create({ - // id: data[i].id, - // vector: data[i + 1].vector, - // }); - // - // const r = payload.Update_Request?.create({ - // vector: vec, - // config: cfg, - // }); - // - // requests.push(r); - // } - // - // const req = payload.Update_MultiRequest?.create({ - // requests: requests, - // }); - // - // client.multiUpdate(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Object_Locations); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("StreamUpdate", (done) => { - // const cfg = payload.Update_Config?.create({ - // skip_strict_exist_check: true, - // }); - // - // const channel = client.streamUpdate(); - // channel.on("data", (message) => { - // try { - // expect(message).toBeInstanceOf(payload.Object_StreamLocation); - // if (message.hasStatus()) { - // const status = message.getStatus(); - // if (status) { - // expect(status.getCode()).toEqual(0); - // } - // } - // } catch (e) { - // done(e); - // } - // }); - // channel.on("end", () => { - // done(); - // }); - // channel.on("error", (e) => { - // done(e); - // }); - // - // for (let i = 11; i < 21; i++) { - // const vec = payload.Object_Vector?.create({ - // id: data[i].id, - // vector: data[i + 1].vector, - // }); - // - // const r = payload.Update_Request?.create({ - // vector: vec, - // config: cfg, - // }); - // channel.write(r); - // } - // - // channel.end(); - // }); - // }); - // - // describe("Tests for upsert operations", () => { - // let client: UpsertClient; - // - // beforeAll((done) => { - // client = new upsert_grpc.UpsertClient( - // address, - // grpc.credentials?.createInsecure(), - // ); - // client.waitForReady(Date.now() + connectDeadlineMs, (e) => { - // if (e) { - // done(e); - // } else { - // done(); - // } - // }); - // }); - // - // afterAll(() => { - // client.close(); - // }); - // - // test("Upsert", (done) => { - // const vec = payload.Object_Vector?.create({ - // id: data[0].id, - // vector: data[0].vector, - // }); - // - // const cfg = payload.Upsert_Config?.create({ - // skip_strict_exist_check: true, - // }); - // - // const req = payload.Upsert_Request?.create({ - // vector: vec, - // config: cfg - // }); - // - // client.upsert(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Object_Location); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("MultiUpsert", (done) => { - // const requests: Array = []; - // const cfg = payload.Upsert_Config?.create({ - // skip_strict_exist_check: true, - // }); - // - // for (let i = 1; i < 11; i++) { - // const vec = payload.Object_Vector?.create({ - // id: data[i].id, - // vector: data[i].vector, - // }); - // - // const r = payload.Upsert_Request?.create({ - // vector: vec, - // config: cfg, - // }); - // - // requests.push(r); - // } - // - // const req = payload.Upsert_MultiRequest?.create({ - // requests: requests, - // }); - // - // client.multiUpsert(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Object_Locations); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("StreamUpsert", (done) => { - // const cfg = payload.Upsert_Config?.create({ - // skip_strict_exist_check: true, - // }); - // - // const channel = client.streamUpsert(); - // channel.on("data", (message) => { - // try { - // expect(message).toBeInstanceOf(payload.Object_StreamLocation); - // if (message.hasStatus()) { - // const status = message.getStatus(); - // if (status) { - // expect(status.getCode()).toEqual(0); - // } - // } - // } catch (e) { - // done(e); - // } - // }); - // channel.on("end", () => { - // done(); - // }); - // channel.on("error", (e) => { - // done(e); - // }); - // - // for (let i = 11; i < 21; i++) { - // const vec = payload.Object_Vector?.create({ - // id: data[i].id, - // vector: data[i].vector, - // }); - // const r = payload.Upsert_Request?.create({ - // vector: vec, - // config: cfg, - // }); - // - // channel.write(r); - // } - // - // channel.end(); - // }); - // }); - // - // describe("Tests for remove operations", () => { - // let client: RemoveClient; - // - // beforeAll((done) => { - // client = new remove_grpc.RemoveClient( - // address, - // grpc.credentials?.createInsecure(), - // ); - // client.waitForReady(Date.now() + connectDeadlineMs, (e) => { - // if (e) { - // done(e); - // } else { - // done(); - // } - // }); - // }); - // - // afterAll(() => { - // client.close(); - // }); - // - // test("Remove", (done) => { - // const id = payload.Object_ID?.create({ - // id: data[0].id, - // }); - // - // const cfg = payload.Remove_Config?.create({ - // skip_strict_exist_check: true, - // }); - // - // const req = payload.Remove_Request?.create({ - // id: id, - // config: cfg, - // }); - // - // client.remove(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Object_Location); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("MultiRemove", (done) => { - // const requests: Array = []; - // const cfg = payload.Insert_Config?.create({ - // skip_strict_exist_check: true, - // }); - // - // for (let i = 1; i < 11; i++) { - // const id = payload.Object_ID?.create({ - // id: data[i].id, - // }); - // - // const r = payload.Remove_Request?.create({ - // id: id, - // config: cfg, - // }); - // - // requests.push(r); - // } - // - // const req = payload.Remove_MultiRequest?.create({ - // requests: requests, - // }); - // - // client.multiRemove(req, (err, resp) => { - // try { - // expect(err).toBeFalsy(); - // expect(resp).toBeInstanceOf(payload.Object_Locations); - // done(); - // } catch (e) { - // done(e); - // } - // }); - // }); - // - // test("StreamRemove", (done) => { - // const cfg = payload.Remove_Config?.create({ - // skip_strict_exist_check: true, - // }); - // - // const channel = client.streamRemove(); - // channel.on("data", (message) => { - // try { - // expect(message).toBeInstanceOf(payload.Object_StreamLocation); - // if (message.hasStatus()) { - // const status = message.getStatus(); - // if (status) { - // expect(status.getCode()).toEqual(0); - // } - // } - // } catch (e) { - // done(e); - // } - // }); - // channel.on("end", () => { - // done(); - // }); - // channel.on("error", (e) => { - // done(e); - // }); - // - // for (let i = 11; i < 21; i++) { - // const id = payload.Object_ID?.create({ - // id: data[i].id, - // }); - // - // const r = payload.Remove_Request?.create({ - // id: id, - // config: cfg, - // }); - // - // channel.write(r); - // } - // - // channel.end(); - // }); + test("MultiInsert", (done) => { + const requests: Array = []; + const cfg = payload.Insert_Config?.create({ + skip_strict_exist_check: true, + }); + + for (let i = 1; i < 11; i++) { + const vec = payload.Object_Vector?.create({ + id: data[i].id, + vector: data[i].vector, + }); + + const r = payload.Insert_Request?.create({ + vector: vec, + config: cfg, + }); + + requests.push(r); + } + + const req = payload.Insert_MultiRequest?.create({ + requests: requests, + }); + + client.multiInsert(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Object_Locations.is(resp)).toBe(true); + done(); + } catch (e) { + done(e); + } + }); + }); + + test("StreamInsert", (done) => { + const cfg = payload.Insert_Config?.create({ + skip_strict_exist_check: true, + }); + + const channel = client.streamInsert(); + channel.on("data", (message) => { + try { + expect(message).toBeInstanceOf(payload.Object_StreamLocation); + if (message.hasStatus()) { + const status = message.getStatus(); + if (status) { + expect(status.getCode()).toEqual(0); + } + } + } catch (e) { + done(e); + } + }); + channel.on("end", () => { + done(); + }); + channel.on("error", (e) => { + done(e); + }); + + for (let i = 11; i < 101; i++) { + const vec = payload.Object_Vector?.create({ + id: data[i].id, + vector: data[i].vector, + }); + + const r = payload.Insert_Request?.create({ + vector: vec, + config: cfg, + }); + channel.write(r); + } + + channel.end(); + }); + }); + + describe("Tests for creating indices operations", () => { + let client: AgentClient; + + beforeAll((done) => { + client = new agent_grpc.AgentClient( + address, + grpc.credentials?.createInsecure(), + ); + client.waitForReady(Date.now() + connectDeadlineMs, (e) => { + if (e) { + done(e); + } else { + done(); + } + }); + }); + + afterAll(() => { + client.close(); + }); + + test("CreateIndex", (done) => { + const req = payload.Control_CreateIndexRequest?.create({ + pool_size: 10000, + }); + + client?.createIndex(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Empty.is(resp)).toBe(true) + done(); + } catch (e) { + done(e); + } + }); + }); + + test("SaveIndex", (done) => { + const req = payload.Empty?.create(); + + client.saveIndex(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Empty.is(resp)).toBe(true); + done(); + } catch (e) { + done(e); + } + }); + }); + + test("IndexInfo", (done) => { + const req = payload.Empty?.create(); + + client.indexInfo(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Info_Index_Count.is(resp)).toBe(true); + expect(resp?.stored).toEqual(101); + expect(resp?.uncommitted).toEqual(0); + done(); + } catch (e) { + done(e); + } + }); + }); + }); + + describe("Test for object operations", () => { + let client: ObjectClient; + + beforeAll((done) => { + client = new object_grpc.ObjectClient( + address, + grpc.credentials?.createInsecure(), + ); + client.waitForReady(Date.now() + connectDeadlineMs, (e) => { + if (e) { + done(e); + } else { + done(); + } + }); + }); + + afterAll(() => { + client.close(); + }); + + test("Exists", (done) => { + const req = payload.Object_ID?.create({ + id: data[0].id, + }); + + client.exists(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Object_ID.is(resp)).toBe(true); + done(); + } catch (e) { + done(e); + } + }); + }); + + test("GetObject", (done) => { + const id = payload.Object_ID?.create({ + id: data[0].id, + }); + + const req = payload.Object_VectorRequest?.create({ + id: id, + }); + + client.getObject(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Object_Vector.is(resp)).toBe(true); + done(); + } catch (e) { + done(e); + } + }); + }); + + test("StreamGetObject", (done) => { + const channel = client.streamGetObject(); + channel.on("data", (message) => { + try { + expect(payload.Object_StreamVector.is(message)).toBe(true); + if (message.hasStatus()) { + const status = message.getStatus(); + if (status) { + expect(status.getCode()).toEqual(0); + } + } + } catch (e) { + done(e); + } + }); + channel.on("end", () => { + done(); + }); + channel.on("error", (e) => { + done(e); + }); + + for (let i = 0; i < 11; i++) { + const id = payload.Object_ID?.create({ + id: data[i].id, + }); + + const req = payload.Object_VectorRequest?.create({ + id: id, + }); + + channel.write(req); + } + + channel.end(); + }); + }); + + describe("Tests for search operations", () => { + let client: SearchClient; + + beforeAll((done) => { + client = new search_grpc.SearchClient( + address, + grpc.credentials?.createInsecure(), + ); + client.waitForReady(Date.now() + connectDeadlineMs, (e) => { + if (e) { + done(e); + } else { + done(); + } + }); + }); + + afterAll(() => { + client.close(); + }); + + test("Search", (done) => { + const cfg = payload.Search_Config?.create({ + num: 3, + radius: -1.0, + epsilon: 0.1, + timeout: BigInt(3000000000), + }); + + const req = payload.Search_Request?.create({ + vector: data[0].vector, + config: cfg, + }); + + client.search(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Search_Response.is(resp)).toBe(true); + expect(resp?.results.length).toEqual(3); + done(); + } catch (e) { + done(e); + } + }); + }); + + test("MultiSearch", (done) => { + const requests: Array = []; + const cfg = payload.Search_Config?.create({ + num: 3, + radius: -1.0, + epsilon: 0.1, + timeout: BigInt(3000000000), + }); + + for (let i = 1; i < 11; i++) { + const r = payload.Search_Request?.create({ + vector: data[i].vector, + config: cfg, + }); + requests.push(r); + } + + const req = payload.Search_MultiRequest?.create({ + requests: requests, + }); + + client.multiSearch(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Search_Response.is(resp)).toBe(true); + for (var response of resp?.responses ?? []) { + expect(response).toBeInstanceOf(payload.Search_Response); + expect(response.results.length).toEqual(3); + } + done(); + } catch (e) { + done(e); + } + }); + }); + + test("StreamSearch", (done) => { + const cfg = payload.Search_Config?.create({ + num: 3, + radius: -1.0, + epsilon: 0.1, + timeout: BigInt(3000000000), + }); + + const channel = client.streamSearch(); + channel.on("data", (message) => { + try { + expect(payload.Search_Response.is(message)).toBe(true); + if (message.hasStatus()) { + const status = message.getStatus(); + if (status) { + expect(status.getCode()).toEqual(0); + } + } + } catch (e) { + done(e); + } + }); + channel.on("end", () => { + done(); + }); + channel.on("error", (e) => { + done(e); + }); + + for (let i = 11; i < 21; i++) { + const r = payload.Search_Request?.create({ + vector: data[i].vector, + config: cfg, + }); + + channel.write(r); + } + + channel.end(); + }); + + test("SearchByID", (done) => { + const cfg = payload.Search_Config?.create({ + num: 3, + radius: -1.0, + epsilon: 0.1, + timeout: BigInt(3000000000), + }); + + const req = payload.Search_IDRequest?.create({ + id: data[0].id, + config: cfg, + }); + + client.searchByID(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Search_Response.is(resp)).toBe(true); + expect(resp?.results.length).toEqual(3); + done(); + } catch (e) { + done(e); + } + }); + }); + + test("MultiSearchByID", (done) => { + const requests: Array = []; + const cfg = payload.Search_Config?.create({ + num: 3, + radius: -1.0, + epsilon: 0.1, + timeout: BigInt(3000000000), + }); + + for (let i = 1; i < 11; i++) { + const r = payload.Search_IDRequest?.create({ + id: data[i].id, + config: cfg, + }); + + requests.push(r); + } + + const req = payload.Search_MultiIDRequest?.create({ + requests: requests, + }); + + client.multiSearchByID(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Search_Response.is(resp)).toBe(true); + for (var response of resp?.responses ?? []) { + expect(response).toBeInstanceOf(payload.Search_Response); + expect(response.results.length).toEqual(3); + } + done(); + } catch (e) { + done(e); + } + }); + }); + + test("StreamSearchByID", (done) => { + const cfg = payload.Search_Config?.create({ + num: 3, + radius: -1.0, + epsilon: 0.1, + timeout: BigInt(3000000000), + }); + + const channel = client.streamSearchByID(); + channel.on("data", (message) => { + try { + expect(payload.Search_StreamResponse.is(message)).toBe(true); + if (message.hasStatus()) { + const status = message.getStatus(); + if (status) { + expect(status.getCode()).toEqual(0); + } + } + } catch (e) { + done(e); + } + }); + channel.on("end", () => { + done(); + }); + channel.on("error", (e) => { + done(e); + }); + + for (let i = 11; i < 21; i++) { + const r = payload.Search_IDRequest?.create({ + id: data[i].id, + config: cfg, + }); + channel.write(r); + } + + channel.end(); + }); + }); + + describe("Tests for update operations", () => { + let client: UpdateClient; + + beforeAll((done) => { + client = new update_grpc.UpdateClient( + address, + grpc.credentials?.createInsecure(), + ); + client.waitForReady(Date.now() + connectDeadlineMs, (e) => { + if (e) { + done(e); + } else { + done(); + } + }); + }); + + afterAll(() => { + client.close(); + }); + + test("Update", (done) => { + const vec = payload.Object_Vector?.create({ + id: data[0].id, + vector: data[1].vector, + }); + const cfg = payload.Update_Config?.create({ + skip_strict_exist_check: true, + }); + + const req = payload.Update_Request?.create({ + vector: vec, + config: cfg, + }); + + client.update(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Object_Location.is(resp)).toBe(true); + done(); + } catch (e) { + done(e); + } + }); + }); + + test("MultiUpdate", (done) => { + const requests: Array = []; + const cfg = payload.Update_Config?.create({ + skip_strict_exist_check: true, + }); + + for (let i = 1; i < 11; i++) { + const vec = payload.Object_Vector?.create({ + id: data[i].id, + vector: data[i + 1].vector, + }); + + const r = payload.Update_Request?.create({ + vector: vec, + config: cfg, + }); + + requests.push(r); + } + + const req = payload.Update_MultiRequest?.create({ + requests: requests, + }); + + client.multiUpdate(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Object_Locations.is(resp)).toBe(true); + done(); + } catch (e) { + done(e); + } + }); + }); + + test("StreamUpdate", (done) => { + const cfg = payload.Update_Config?.create({ + skip_strict_exist_check: true, + }); + + const channel = client.streamUpdate(); + channel.on("data", (message) => { + try { + expect(payload.Object_StreamLocation.is(message)).toBe(true); + if (message.hasStatus()) { + const status = message.getStatus(); + if (status) { + expect(status.getCode()).toEqual(0); + } + } + } catch (e) { + done(e); + } + }); + channel.on("end", () => { + done(); + }); + channel.on("error", (e) => { + done(e); + }); + + for (let i = 11; i < 21; i++) { + const vec = payload.Object_Vector?.create({ + id: data[i].id, + vector: data[i + 1].vector, + }); + + const r = payload.Update_Request?.create({ + vector: vec, + config: cfg, + }); + channel.write(r); + } + + channel.end(); + }); + }); + + describe("Tests for upsert operations", () => { + let client: UpsertClient; + + beforeAll((done) => { + client = new upsert_grpc.UpsertClient( + address, + grpc.credentials?.createInsecure(), + ); + client.waitForReady(Date.now() + connectDeadlineMs, (e) => { + if (e) { + done(e); + } else { + done(); + } + }); + }); + + afterAll(() => { + client.close(); + }); + + test("Upsert", (done) => { + const vec = payload.Object_Vector?.create({ + id: data[0].id, + vector: data[0].vector, + }); + + const cfg = payload.Upsert_Config?.create({ + skip_strict_exist_check: true, + }); + + const req = payload.Upsert_Request?.create({ + vector: vec, + config: cfg + }); + + client.upsert(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Object_Location.is(resp)).toBe(true); + expect(resp).toBeInstanceOf(payload.Object_Location); + done(); + } catch (e) { + done(e); + } + }); + }); + + test("MultiUpsert", (done) => { + const requests: Array = []; + const cfg = payload.Upsert_Config?.create({ + skip_strict_exist_check: true, + }); + + for (let i = 1; i < 11; i++) { + const vec = payload.Object_Vector?.create({ + id: data[i].id, + vector: data[i].vector, + }); + + const r = payload.Upsert_Request?.create({ + vector: vec, + config: cfg, + }); + + requests.push(r); + } + + const req = payload.Upsert_MultiRequest?.create({ + requests: requests, + }); + + client.multiUpsert(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Object_Locations.is(resp)).toBe(true); + done(); + } catch (e) { + done(e); + } + }); + }); + + test("StreamUpsert", (done) => { + const cfg = payload.Upsert_Config?.create({ + skip_strict_exist_check: true, + }); + + const channel = client.streamUpsert(); + channel.on("data", (message) => { + try { + expect(payload.Object_StreamLocation.is(message)).toBe(true); + if (message.hasStatus()) { + const status = message.getStatus(); + if (status) { + expect(status.getCode()).toEqual(0); + } + } + } catch (e) { + done(e); + } + }); + channel.on("end", () => { + done(); + }); + channel.on("error", (e) => { + done(e); + }); + + for (let i = 11; i < 21; i++) { + const vec = payload.Object_Vector?.create({ + id: data[i].id, + vector: data[i].vector, + }); + const r = payload.Upsert_Request?.create({ + vector: vec, + config: cfg, + }); + + channel.write(r); + } + + channel.end(); + }); + }); + + describe("Tests for remove operations", () => { + let client: RemoveClient; + + beforeAll((done) => { + client = new remove_grpc.RemoveClient( + address, + grpc.credentials?.createInsecure(), + ); + client.waitForReady(Date.now() + connectDeadlineMs, (e) => { + if (e) { + done(e); + } else { + done(); + } + }); + }); + + afterAll(() => { + client.close(); + }); + + test("Remove", (done) => { + const id = payload.Object_ID?.create({ + id: data[0].id, + }); + + const cfg = payload.Remove_Config?.create({ + skip_strict_exist_check: true, + }); + + const req = payload.Remove_Request?.create({ + id: id, + config: cfg, + }); + + client.remove(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Object_Location.is(resp)).toBe(true); + done(); + } catch (e) { + done(e); + } + }); + }); + + test("MultiRemove", (done) => { + const requests: Array = []; + const cfg = payload.Insert_Config?.create({ + skip_strict_exist_check: true, + }); + + for (let i = 1; i < 11; i++) { + const id = payload.Object_ID?.create({ + id: data[i].id, + }); + + const r = payload.Remove_Request?.create({ + id: id, + config: cfg, + }); + + requests.push(r); + } + + const req = payload.Remove_MultiRequest?.create({ + requests: requests, + }); + + client.multiRemove(req, (err, resp) => { + try { + expect(err).toBeFalsy(); + expect(payload.Object_Locations.is(resp)).toBe(true); + done(); + } catch (e) { + done(e); + } + }); + }); + + test("StreamRemove", (done) => { + const cfg = payload.Remove_Config?.create({ + skip_strict_exist_check: true, + }); + + const channel = client.streamRemove(); + channel.on("data", (message) => { + try { + expect(payload.Object_StreamLocation.is(message)).toBe(true); + if (message.hasStatus()) { + const status = message.getStatus(); + if (status) { + expect(status.getCode()).toEqual(0); + } + } + } catch (e) { + done(e); + } + }); + channel.on("end", () => { + done(); + }); + channel.on("error", (e) => { + done(e); + }); + + for (let i = 11; i < 21; i++) { + const id = payload.Object_ID?.create({ + id: data[i].id, + }); + + const r = payload.Remove_Request?.create({ + id: id, + config: cfg, + }); + + channel.write(r); + } + + channel.end(); + }); }); }); From 5750a666579acfdbc9c54e10d28280bd8c407567 Mon Sep 17 00:00:00 2001 From: hlts2 Date: Mon, 25 Dec 2023 14:27:45 +0900 Subject: [PATCH 02/10] fix: fails test for assertion Signed-off-by: hlts2 --- tests/e2e.test.ts | 73 +++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 44 deletions(-) diff --git a/tests/e2e.test.ts b/tests/e2e.test.ts index 00a4b34..2bfdb22 100644 --- a/tests/e2e.test.ts +++ b/tests/e2e.test.ts @@ -117,12 +117,10 @@ describe("Tests for node client", () => { const channel = client.streamInsert(); channel.on("data", (message) => { try { - expect(message).toBeInstanceOf(payload.Object_StreamLocation); - if (message.hasStatus()) { - const status = message.getStatus(); - if (status) { - expect(status.getCode()).toEqual(0); - } + expect(payload.Object_StreamLocation.is(message)).toBe(true); + const cloneRes = payload.Object_StreamLocation.clone(message); + if (cloneRes.payload.oneofKind === "status") { + expect(cloneRes.payload.status.code).toEqual(0); } } catch (e) { done(e); @@ -282,11 +280,9 @@ describe("Tests for node client", () => { channel.on("data", (message) => { try { expect(payload.Object_StreamVector.is(message)).toBe(true); - if (message.hasStatus()) { - const status = message.getStatus(); - if (status) { - expect(status.getCode()).toEqual(0); - } + const cloneRes = payload.Object_StreamVector.clone(message); + if (cloneRes.payload.oneofKind === "status") { + expect(cloneRes.payload.status.code).toEqual(0); } } catch (e) { done(e); @@ -385,9 +381,9 @@ describe("Tests for node client", () => { client.multiSearch(req, (err, resp) => { try { expect(err).toBeFalsy(); - expect(payload.Search_Response.is(resp)).toBe(true); - for (var response of resp?.responses ?? []) { - expect(response).toBeInstanceOf(payload.Search_Response); + expect(payload.Search_Responses.is(resp)).toBe(true); + for (const response of resp?.responses ?? []) { + expect(payload.Search_Response.is(response)).toBe(true); expect(response.results.length).toEqual(3); } done(); @@ -408,12 +404,10 @@ describe("Tests for node client", () => { const channel = client.streamSearch(); channel.on("data", (message) => { try { - expect(payload.Search_Response.is(message)).toBe(true); - if (message.hasStatus()) { - const status = message.getStatus(); - if (status) { - expect(status.getCode()).toEqual(0); - } + expect(payload.Search_StreamResponse.is(message)).toBe(true); + const cloneRes = payload.Search_StreamResponse.clone(message); + if (cloneRes.payload.oneofKind === "status") { + expect(cloneRes.payload.status.code).toEqual(0); } } catch (e) { done(e); @@ -488,9 +482,9 @@ describe("Tests for node client", () => { client.multiSearchByID(req, (err, resp) => { try { expect(err).toBeFalsy(); - expect(payload.Search_Response.is(resp)).toBe(true); - for (var response of resp?.responses ?? []) { - expect(response).toBeInstanceOf(payload.Search_Response); + expect(payload.Search_Responses.is(resp)).toBe(true); + for (const response of resp?.responses ?? []) { + expect(payload.Search_Response.is(response)).toBe(true); expect(response.results.length).toEqual(3); } done(); @@ -512,11 +506,9 @@ describe("Tests for node client", () => { channel.on("data", (message) => { try { expect(payload.Search_StreamResponse.is(message)).toBe(true); - if (message.hasStatus()) { - const status = message.getStatus(); - if (status) { - expect(status.getCode()).toEqual(0); - } + const cloneRes = payload.Search_StreamResponse.clone(message); + if (cloneRes.payload.oneofKind === "status") { + expect(cloneRes.payload.status.code).toEqual(0); } } catch (e) { done(e); @@ -631,11 +623,9 @@ describe("Tests for node client", () => { channel.on("data", (message) => { try { expect(payload.Object_StreamLocation.is(message)).toBe(true); - if (message.hasStatus()) { - const status = message.getStatus(); - if (status) { - expect(status.getCode()).toEqual(0); - } + const cloneRes = payload.Object_StreamLocation.clone(message); + if (cloneRes.payload.oneofKind === "status") { + expect(cloneRes.payload.status.code).toEqual(0); } } catch (e) { done(e); @@ -705,7 +695,6 @@ describe("Tests for node client", () => { try { expect(err).toBeFalsy(); expect(payload.Object_Location.is(resp)).toBe(true); - expect(resp).toBeInstanceOf(payload.Object_Location); done(); } catch (e) { done(e); @@ -757,11 +746,9 @@ describe("Tests for node client", () => { channel.on("data", (message) => { try { expect(payload.Object_StreamLocation.is(message)).toBe(true); - if (message.hasStatus()) { - const status = message.getStatus(); - if (status) { - expect(status.getCode()).toEqual(0); - } + const cloneRes = payload.Object_StreamLocation.clone(message); + if (cloneRes.payload.oneofKind === "status") { + expect(cloneRes.payload.status.code).toEqual(0); } } catch (e) { done(e); @@ -880,11 +867,9 @@ describe("Tests for node client", () => { channel.on("data", (message) => { try { expect(payload.Object_StreamLocation.is(message)).toBe(true); - if (message.hasStatus()) { - const status = message.getStatus(); - if (status) { - expect(status.getCode()).toEqual(0); - } + const cloneRes = payload.Object_StreamLocation.clone(message); + if (cloneRes.payload.oneofKind === "status") { + expect(cloneRes.payload.status.code).toEqual(0); } } catch (e) { done(e); From f301813d8cbc2ec0c1c9b79b019a82e77be1cef9 Mon Sep 17 00:00:00 2001 From: hlts2 Date: Mon, 25 Dec 2023 14:32:34 +0900 Subject: [PATCH 03/10] feat: add step to verify example ts Signed-off-by: hlts2 --- .github/workflows/release.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eabd5ad..5d5c675 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -61,6 +61,19 @@ jobs: run: | npm install npm pack + - name: verify example codes (ts) + run: | + kubectl port-forward statefulset/vald-agent-ngt 8081:8081 & + pid=$! + + version=`make vald/client/node/version/print` + npm install -g ts-node + + cd example-ts + npm install ../vald-client-node-${version}.tgz -s -f + DIM=300 ts-node example.ts + + kill $pid - name: verify example codes (js) run: | version=`make vald/client/node/version/print` @@ -71,19 +84,6 @@ jobs: DIM=300 node example.js kill $pid - # - name: verify example codes (ts) - # run: | - # kubectl port-forward statefulset/vald-agent-ngt 8081:8081 & - # pid=$! - # - # version=`make vald/client/node/version/print` - # npm install -g ts-node - # - # cd example-ts - # npm install ../vald-client-node-${version}.tgz -s -f - # DIM=300 ts-node example.ts - # - # kill $pid publish: if: startsWith( github.ref, 'refs/tags/') needs: From 2dc08787143cee89d0670d6b7ee9a404d917bfe6 Mon Sep 17 00:00:00 2001 From: hlts2 Date: Mon, 25 Dec 2023 14:35:56 +0900 Subject: [PATCH 04/10] feat: add tsconfig Signed-off-by: hlts2 --- example-ts/tsconfig.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 example-ts/tsconfig.json diff --git a/example-ts/tsconfig.json b/example-ts/tsconfig.json new file mode 100644 index 0000000..574e785 --- /dev/null +++ b/example-ts/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "es2020", + "module": "commonjs", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "resolveJsonModule": true + } +} From 5d4443110275264c78ae1c5ada8a391d1f939c71 Mon Sep 17 00:00:00 2001 From: hlts2 Date: Mon, 25 Dec 2023 14:39:00 +0900 Subject: [PATCH 05/10] fix: debug log message Signed-off-by: hlts2 --- example-ts/example.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example-ts/example.ts b/example-ts/example.ts index ca367ba..38ef2ba 100644 --- a/example-ts/example.ts +++ b/example-ts/example.ts @@ -51,7 +51,7 @@ const main = async () => { }; insertFunc(ireq) .then(async (res) => { - console.log("resp: ", res); + console.log("insert resp: ", res); }) .catch((e) => { console.log("err: ", e); @@ -92,7 +92,7 @@ const main = async () => { }; searchFunc(sreq) .then((res: any) => { - console.log("res: ", res, "\n"); + console.log("search res: ", res, "\n"); }) .catch((e) => { console.log("err: ", e); @@ -130,7 +130,7 @@ const main = async () => { }; removeFunc(rreq) .then((res: any) => { - console.log("res: ", res, "\n"); + console.log("remove res: ", res, "\n"); }) .catch((e) => { console.log("err: ", e); From 3bf8d400ccb17cf7d847258ec8943db5eb7309f7 Mon Sep 17 00:00:00 2001 From: hlts2 Date: Mon, 25 Dec 2023 14:57:37 +0900 Subject: [PATCH 06/10] fix: delete any keyword Signed-off-by: hlts2 --- example-ts/example.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/example-ts/example.ts b/example-ts/example.ts index 38ef2ba..43ed846 100644 --- a/example-ts/example.ts +++ b/example-ts/example.ts @@ -1,5 +1,6 @@ import * as grpc from "@grpc/grpc-js"; import { v1_vald, v1_payload } from "vald-client-node"; +import type { Insert_Request, Search_Request, Remove_Request } from "vald-client-node/src/vald/v1/payload/payload_pb"; const addr = "localhost:8081"; const DIM = process.env.DIM || 4; @@ -38,7 +39,7 @@ const main = async () => { grpc.credentials.createInsecure() ); - const insertFunc = (req: any) => { + const insertFunc = (req: Insert_Request) => { return new Promise((resolve, reject) => { iclient.insert(req, (err, resp) => { if (err) { @@ -79,7 +80,7 @@ const main = async () => { grpc.credentials.createInsecure() ); - const searchFunc = (req: any) => { + const searchFunc = (req: Search_Request) => { return new Promise((resolve, reject) => { sclient.search(req, (err, resp) => { if (err) { @@ -117,7 +118,7 @@ const main = async () => { grpc.credentials.createInsecure() ); - const removeFunc = (req: any) => { + const removeFunc = (req: Remove_Request) => { return new Promise((resolve, reject) => { rclient.remove(req, (err, resp) => { if (err) { From c7a2213343a734ffcd95ee1d4169294c0b740cf3 Mon Sep 17 00:00:00 2001 From: hlts2 Date: Mon, 25 Dec 2023 15:04:42 +0900 Subject: [PATCH 07/10] fix: delete any keyword Signed-off-by: hlts2 --- example-ts/example.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example-ts/example.ts b/example-ts/example.ts index 43ed846..b424ffa 100644 --- a/example-ts/example.ts +++ b/example-ts/example.ts @@ -51,7 +51,7 @@ const main = async () => { }); }; insertFunc(ireq) - .then(async (res) => { + .then((res) => { console.log("insert resp: ", res); }) .catch((e) => { @@ -92,7 +92,7 @@ const main = async () => { }); }; searchFunc(sreq) - .then((res: any) => { + .then((res) => { console.log("search res: ", res, "\n"); }) .catch((e) => { @@ -130,7 +130,7 @@ const main = async () => { }); }; removeFunc(rreq) - .then((res: any) => { + .then((res) => { console.log("remove res: ", res, "\n"); }) .catch((e) => { From 4a1b36c1130bb979e4f0876d271fd90f757f08a7 Mon Sep 17 00:00:00 2001 From: hlts2 Date: Mon, 25 Dec 2023 15:13:41 +0900 Subject: [PATCH 08/10] fix: use process exit when an error occurs Signed-off-by: hlts2 --- example-ts/example.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/example-ts/example.ts b/example-ts/example.ts index b424ffa..3cc6cf4 100644 --- a/example-ts/example.ts +++ b/example-ts/example.ts @@ -39,7 +39,7 @@ const main = async () => { grpc.credentials.createInsecure() ); - const insertFunc = (req: Insert_Request) => { + const insertFunc = async (req: Insert_Request) => { return new Promise((resolve, reject) => { iclient.insert(req, (err, resp) => { if (err) { @@ -50,13 +50,13 @@ const main = async () => { }); }); }; - insertFunc(ireq) + await insertFunc(ireq) .then((res) => { console.log("insert resp: ", res); }) .catch((e) => { console.log("err: ", e); - return -1; + process.exit(1); }); const second = 100; @@ -80,7 +80,7 @@ const main = async () => { grpc.credentials.createInsecure() ); - const searchFunc = (req: Search_Request) => { + const searchFunc = async (req: Search_Request) => { return new Promise((resolve, reject) => { sclient.search(req, (err, resp) => { if (err) { @@ -91,13 +91,13 @@ const main = async () => { }); }); }; - searchFunc(sreq) + await searchFunc(sreq) .then((res) => { console.log("search res: ", res, "\n"); }) .catch((e) => { console.log("err: ", e); - return -1; + process.exit(1); }); // remove @@ -118,7 +118,7 @@ const main = async () => { grpc.credentials.createInsecure() ); - const removeFunc = (req: Remove_Request) => { + const removeFunc = async (req: Remove_Request) => { return new Promise((resolve, reject) => { rclient.remove(req, (err, resp) => { if (err) { @@ -129,14 +129,15 @@ const main = async () => { }); }); }; - removeFunc(rreq) + await removeFunc(rreq) .then((res) => { console.log("remove res: ", res, "\n"); }) .catch((e) => { console.log("err: ", e); - return -1; + process.exit(1); }); + process.exit(0); }; main(); From 17450c0302497a22a0439b214e45cca6dd545f9e Mon Sep 17 00:00:00 2001 From: hlts2 Date: Mon, 25 Dec 2023 15:22:42 +0900 Subject: [PATCH 09/10] fix: package updatge Signed-off-by: hlts2 --- buf.gen.yaml | 20 --- index.d.ts | 4 +- index.js | 2 +- package-lock.json | 432 +--------------------------------------------- package.json | 7 +- 5 files changed, 5 insertions(+), 460 deletions(-) diff --git a/buf.gen.yaml b/buf.gen.yaml index 66bbed5..ecf58a8 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -2,13 +2,6 @@ version: v1 managed: enabled: true plugins: - # - plugin: buf.build/protocolbuffers/js - # out: src/ - # opt: import_style=commonjs - # - plugin: buf.build/grpc/node - # out: src - # opt: grpc_js,import_style=commonjs - - plugin: buf.build/community/timostamm-protobuf-ts out: src # https://github.com/timostamm/protobuf-ts/blob/main/MANUAL.md#the-protoc-plugin @@ -22,16 +15,3 @@ plugins: - output_javascript - output_legacy_commonjs - eslint_disable - - # Failed because timeout type changed - # opt: - # - add_pb_suffix - # - client_grpc1 - # - generate_dependencies - # - keep_enum_prefix - # - ts_nocheck - # - use_proto_field_name - # - output_javascript - # - optimize_code_size - # - long_type_string - # - eslint_disable diff --git a/index.d.ts b/index.d.ts index 1d7ea59..886bb7f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,9 +1,9 @@ import v1_agent_core = require("./src/vald/v1/agent/core"); -import v1_payload = require("./src/vald/v1/payload"); import v1_vald = require("./src/vald/v1/vald"); +import v1_payload = require("./src/vald/v1/payload"); declare const _default: { v1_agent_core: typeof v1_agent_core, - v1_payload: typeof v1_payload, v1_vald: typeof v1_vald, + v1_payload: typeof v1_payload, }; export = _default; diff --git a/index.js b/index.js index 11e01e5..19afa58 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,3 @@ module.exports.v1_agent_core = require("./src/vald/v1/agent/core"); -module.exports.v1_payload = require("./src/vald/v1/payload"); module.exports.v1_vald = require("./src/vald/v1/vald"); +module.exports.v1_payload = require("./src/vald/v1/payload"); diff --git a/package-lock.json b/package-lock.json index e8a03f0..0b5621d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,20 +9,15 @@ "version": "1.7.9", "license": "Apache-2.0", "dependencies": { - "@grpc/grpc-js": "^1.9.13", - "@protobuf-ts/runtime": "^2.9.3", - "@protobuf-ts/runtime-rpc": "^2.9.3", - "google-protobuf": "^3.21.2" + "@grpc/grpc-js": "^1.9.13" }, "devDependencies": { "@bufbuild/buf": "^1.28.1", "@bufbuild/protobuf": "^1.6.0", "@types/jest": "^27.5.2", - "grpc-tools": "^1.12.4", "jest": "^27.5.1", "ts-jest": "^27.1.5", "ts-node": "^10.9.2", - "ts-protoc-gen": "0.15.0", "typescript": "^4.9.5" }, "engines": { @@ -1162,39 +1157,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@mapbox/node-pre-gyp": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", - "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", - "dev": true, - "dependencies": { - "detect-libc": "^2.0.0", - "https-proxy-agent": "^5.0.0", - "make-dir": "^3.1.0", - "node-fetch": "^2.6.7", - "nopt": "^5.0.0", - "npmlog": "^5.0.1", - "rimraf": "^3.0.2", - "semver": "^7.3.5", - "tar": "^6.1.11" - }, - "bin": { - "node-pre-gyp": "bin/node-pre-gyp" - } - }, - "node_modules/@protobuf-ts/runtime": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.3.tgz", - "integrity": "sha512-nivzCpg/qYD0RX2OmHOahJALb8ndjGmUhNBcTJ0BbXoqKwCSM6vYA+vegzS3rhuaPgbyC7Ec8idlnizzUfIRuw==" - }, - "node_modules/@protobuf-ts/runtime-rpc": { - "version": "2.9.3", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.3.tgz", - "integrity": "sha512-WelHpctvZeG8yhbb7tnsrLzotq9xjMCXuGuhJ8qMyEdNoBBEodbXseofAYFTebo2/PN2LzyEq3X6vwr5f8jqTA==", - "dependencies": { - "@protobuf-ts/runtime": "^2.9.3" - } - }, "node_modules/@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", @@ -1426,12 +1388,6 @@ "deprecated": "Use your platform's native atob() and btoa() methods instead", "dev": true }, - "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true - }, "node_modules/acorn": { "version": "8.11.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", @@ -1537,25 +1493,6 @@ "node": ">= 8" } }, - "node_modules/aproba": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", - "dev": true - }, - "node_modules/are-we-there-yet": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", - "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", - "dev": true, - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", @@ -1825,15 +1762,6 @@ "node": ">=10" } }, - "node_modules/chownr": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", - "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/ci-info": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", @@ -1900,15 +1828,6 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, - "node_modules/color-support": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", - "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true, - "bin": { - "color-support": "bin.js" - } - }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -1927,12 +1846,6 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", - "dev": true - }, "node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", @@ -2044,21 +1957,6 @@ "node": ">=0.4.0" } }, - "node_modules/delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", - "dev": true - }, - "node_modules/detect-libc": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", - "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -2310,36 +2208,6 @@ "node": ">= 6" } }, - "node_modules/fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "dev": true, - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/fs-minipass/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/fs-minipass/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2369,26 +2237,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/gauge": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", - "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", - "dev": true, - "dependencies": { - "aproba": "^1.0.3 || ^2.0.0", - "color-support": "^1.1.2", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.1", - "object-assign": "^4.1.1", - "signal-exit": "^3.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1", - "wide-align": "^1.1.2" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -2456,31 +2304,12 @@ "node": ">=4" } }, - "node_modules/google-protobuf": { - "version": "3.21.2", - "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.2.tgz", - "integrity": "sha512-3MSOYFO5U9mPGikIYCzK0SaThypfGgS6bHqrUGXG3DPHCrb+txNqeEcns1W0lkGfk0rCyNXm7xB9rMxnCiZOoA==" - }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, - "node_modules/grpc-tools": { - "version": "1.12.4", - "resolved": "https://registry.npmjs.org/grpc-tools/-/grpc-tools-1.12.4.tgz", - "integrity": "sha512-5+mLAJJma3BjnW/KQp6JBjUMgvu7Mu3dBvBPd1dcbNIb+qiR0817zDpgPjS7gRb+l/8EVNIa3cB02xI9JLToKg==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "@mapbox/node-pre-gyp": "^1.0.5" - }, - "bin": { - "grpc_tools_node_protoc": "bin/protoc.js", - "grpc_tools_node_protoc_plugin": "bin/protoc_plugin.js" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2490,12 +2319,6 @@ "node": ">=8" } }, - "node_modules/has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", - "dev": true - }, "node_modules/hasown": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", @@ -3586,30 +3409,6 @@ "yallist": "^3.0.2" } }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -3686,58 +3485,6 @@ "node": "*" } }, - "node_modules/minipass": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/minizlib": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", - "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", - "dev": true, - "dependencies": { - "minipass": "^3.0.0", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/minizlib/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/minizlib/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true, - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -3750,48 +3497,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/node-fetch/node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true - }, - "node_modules/node-fetch/node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true - }, - "node_modules/node-fetch/node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dev": true, - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -3804,21 +3509,6 @@ "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", "dev": true }, - "node_modules/nopt": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", - "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", - "dev": true, - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -3840,33 +3530,12 @@ "node": ">=8" } }, - "node_modules/npmlog": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", - "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", - "dev": true, - "dependencies": { - "are-we-there-yet": "^2.0.0", - "console-control-strings": "^1.1.0", - "gauge": "^3.0.0", - "set-blocking": "^2.0.0" - } - }, "node_modules/nwsapi": { "version": "2.2.7", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", "integrity": "sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==", "dev": true }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -4112,20 +3781,6 @@ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -4202,26 +3857,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -4273,12 +3908,6 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", - "dev": true - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -4358,15 +3987,6 @@ "node": ">=10" } }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -4477,29 +4097,6 @@ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", "dev": true }, - "node_modules/tar": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", - "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", - "dev": true, - "dependencies": { - "chownr": "^2.0.0", - "fs-minipass": "^2.0.0", - "minipass": "^5.0.0", - "minizlib": "^2.1.1", - "mkdirp": "^1.0.3", - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/tar/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "node_modules/terminal-link": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", @@ -4685,18 +4282,6 @@ "node": ">=0.4.0" } }, - "node_modules/ts-protoc-gen": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/ts-protoc-gen/-/ts-protoc-gen-0.15.0.tgz", - "integrity": "sha512-TycnzEyrdVDlATJ3bWFTtra3SCiEP0W0vySXReAuEygXCUr1j2uaVyL0DhzjwuUdQoW5oXPwk6oZWeA0955V+g==", - "dev": true, - "dependencies": { - "google-protobuf": "^3.15.5" - }, - "bin": { - "protoc-gen-ts": "bin/protoc-gen-ts" - } - }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -4794,12 +4379,6 @@ "requires-port": "^1.0.0" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true - }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", @@ -4913,15 +4492,6 @@ "node": ">= 8" } }, - "node_modules/wide-align": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", - "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "dev": true, - "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/package.json b/package.json index 2c3a9ef..b82c9c0 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,9 @@ "@bufbuild/buf": "^1.28.1", "@bufbuild/protobuf": "^1.6.0", "@types/jest": "^27.5.2", - "grpc-tools": "^1.12.4", "jest": "^27.5.1", "ts-jest": "^27.1.5", "ts-node": "^10.9.2", - "ts-protoc-gen": "0.15.0", "typescript": "^4.9.5" }, "scripts": { @@ -32,10 +30,7 @@ }, "homepage": "https://github.com/vdaas/vald-client-node", "dependencies": { - "@grpc/grpc-js": "^1.9.13", - "@protobuf-ts/runtime": "^2.9.3", - "@protobuf-ts/runtime-rpc": "^2.9.3", - "google-protobuf": "^3.21.2" + "@grpc/grpc-js": "^1.9.13" }, "engines": { "node": ">=18.16.0" From ef06f5cc64fc860054c27f9c36f6d31f0be1fe73 Mon Sep 17 00:00:00 2001 From: hlts2 Date: Mon, 25 Dec 2023 15:31:15 +0900 Subject: [PATCH 10/10] fix: add new package for build error Signed-off-by: hlts2 --- package-lock.json | 17 ++++++++++++++++- package.json | 4 +++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0b5621d..1d3ad86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,9 @@ "version": "1.7.9", "license": "Apache-2.0", "dependencies": { - "@grpc/grpc-js": "^1.9.13" + "@grpc/grpc-js": "^1.9.13", + "@protobuf-ts/runtime": "^2.9.3", + "@protobuf-ts/runtime-rpc": "^2.9.3" }, "devDependencies": { "@bufbuild/buf": "^1.28.1", @@ -1157,6 +1159,19 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@protobuf-ts/runtime": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.3.tgz", + "integrity": "sha512-nivzCpg/qYD0RX2OmHOahJALb8ndjGmUhNBcTJ0BbXoqKwCSM6vYA+vegzS3rhuaPgbyC7Ec8idlnizzUfIRuw==" + }, + "node_modules/@protobuf-ts/runtime-rpc": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.3.tgz", + "integrity": "sha512-WelHpctvZeG8yhbb7tnsrLzotq9xjMCXuGuhJ8qMyEdNoBBEodbXseofAYFTebo2/PN2LzyEq3X6vwr5f8jqTA==", + "dependencies": { + "@protobuf-ts/runtime": "^2.9.3" + } + }, "node_modules/@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", diff --git a/package.json b/package.json index b82c9c0..61cee1a 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,9 @@ }, "homepage": "https://github.com/vdaas/vald-client-node", "dependencies": { - "@grpc/grpc-js": "^1.9.13" + "@grpc/grpc-js": "^1.9.13", + "@protobuf-ts/runtime": "^2.9.3", + "@protobuf-ts/runtime-rpc": "^2.9.3" }, "engines": { "node": ">=18.16.0"