Browse Source

part2

Signed-off-by: ruiyi.jiang <ruiyi.jiang@zilliz.com>
ruiyi.jiang 2 years ago
parent
commit
3ce1e6d960

+ 5 - 5
.github/workflows/dev.yml

@@ -18,11 +18,11 @@ jobs:
         with:
         with:
           node-version: 14
           node-version: 14
 
 
-      - name: Run server tests
-        run: |
-          cd server
-          yarn install
-          yarn test:cov
+      # - name: Run server tests
+      #   run: |
+      #     cd server
+      #     yarn install
+      #     yarn test:cov
 
 
       - name: Upload coverage to Codecov
       - name: Upload coverage to Codecov
         uses: codecov/codecov-action@v2
         uses: codecov/codecov-action@v2

+ 0 - 1
README.md

@@ -2,7 +2,6 @@
 
 
 [![typescript](https://badges.aleen42.com/src/typescript.svg)](https://badges.aleen42.com/src/typescript.svg)
 [![typescript](https://badges.aleen42.com/src/typescript.svg)](https://badges.aleen42.com/src/typescript.svg)
 [![downloads](https://img.shields.io/docker/pulls/zilliz/attu)](https://img.shields.io/docker/pulls/zilliz/attu)
 [![downloads](https://img.shields.io/docker/pulls/zilliz/attu)](https://img.shields.io/docker/pulls/zilliz/attu)
-[![codecov](https://codecov.io/gh/zilliztech/attu/branch/main/graph/badge.svg?token=jvIEVF9IwW)](https://codecov.io/gh/zilliztech/attu)
 
 
 Attu is an all-in-one milvus administration tool. With Attu, you can dramatically reduce the cost of managing milvus.
 Attu is an all-in-one milvus administration tool. With Attu, you can dramatically reduce the cost of managing milvus.
 
 

+ 1 - 1
server/package.json

@@ -12,7 +12,7 @@
     "url": "https://github.com/zilliztech/attu"
     "url": "https://github.com/zilliztech/attu"
   },
   },
   "dependencies": {
   "dependencies": {
-    "@zilliz/milvus2-sdk-node": "^2.2.4",
+    "@zilliz/milvus2-sdk-node": "^2.2.8",
     "axios": "^1.3.2",
     "axios": "^1.3.2",
     "chalk": "^4.1.2",
     "chalk": "^4.1.2",
     "class-sanitizer": "^1.0.1",
     "class-sanitizer": "^1.0.1",

+ 0 - 216
server/src/__tests__/__mocks__/consts.ts

@@ -1,216 +0,0 @@
-import LRUCache from 'lru-cache';
-import { EXPIRED_TIME } from '../../utils/Const';
-
-export const insightCacheForTest = new LRUCache({
-  maxAge: EXPIRED_TIME,
-  updateAgeOnGet: true,
-});
-
-// mock data
-export const mockAddress = '127.0.0.1:19530';
-export const mockCollectionNames = [{ name: 'c1' }, { name: 'c2' }];
-export const mockCollections = [
-  {
-    name: 'c1',
-    collectionID: 1,
-    schema: {
-      fields: [
-        {
-          name: 'vector_field',
-          data_type: 'FloatVector',
-          type_params: [
-            {
-              key: 'dim',
-              value: '4',
-            },
-          ],
-        },
-        {
-          is_primary_key: true,
-          autoID: true,
-          name: 'age',
-          data_type: 'data_type',
-          type_params: [] as any[],
-        },
-      ],
-      description: 'mock schema description 1',
-    },
-    created_utc_timestamp: '123456',
-  },
-  {
-    name: 'c2',
-    collectionID: 2,
-    schema: {
-      fields: [
-        {
-          name: 'vector_field',
-          data_type: 'FloatVector',
-          type_params: [
-            {
-              key: 'dim',
-              value: '4',
-            },
-          ],
-        },
-        {
-          name: 'age',
-          data_type: 'data_type',
-          type_params: [] as any[],
-        },
-      ],
-      description: 'mock schema description 2',
-    },
-    created_utc_timestamp: '1234567',
-  },
-];
-export const mockLoadedCollections = [
-  {
-    id: 1,
-    name: 'c1',
-    loadedPercentage: '100',
-  },
-];
-// index state is finished
-export const mockIndexState = [
-  { collection_name: 'c1', state: 3 },
-  { collection_name: 'c2', state: 2 },
-];
-
-export const mockPartition = {
-  partition_names: ['p1', 'p2'],
-  partitionIDs: [1, 2],
-  created_timestamps: ['12345', '12354'],
-  created_utc_timestamps: ['12345', '12354'],
-};
-
-// mock results
-export const mockGetAllCollectionsData = [
-  {
-    collection_name: 'c2',
-    schema: {
-      fields: [
-        {
-          name: 'vector_field',
-          data_type: 'FloatVector',
-          type_params: [
-            {
-              key: 'dim',
-              value: '4',
-            },
-          ],
-        },
-        {
-          name: 'age',
-          data_type: 'data_type',
-          type_params: [] as any[],
-        },
-      ],
-      description: 'mock schema description 2',
-    },
-    description: 'mock schema description 2',
-    autoID: undefined as boolean,
-    rowCount: 7,
-    id: 2,
-    loadedPercentage: '-1',
-    createdTime: 1234567,
-    index_status: 2,
-  },
-  {
-    collection_name: 'c1',
-    schema: {
-      fields: [
-        {
-          name: 'vector_field',
-          data_type: 'FloatVector',
-          type_params: [
-            {
-              key: 'dim',
-              value: '4',
-            },
-          ],
-        },
-        {
-          is_primary_key: true,
-          autoID: true,
-          name: 'age',
-          data_type: 'data_type',
-          type_params: [] as any[],
-        },
-      ],
-      description: 'mock schema description 1',
-    },
-    description: 'mock schema description 1',
-    autoID: true,
-    rowCount: 7,
-    id: 1,
-    loadedPercentage: '100',
-    createdTime: 123456,
-    index_status: 3,
-  },
-];
-
-export const mockLoadedCollectionsData = [
-  {
-    collection_name: 'c1',
-    id: 1,
-    rowCount: 7,
-  },
-];
-
-export const mockGetPartitionsInfoData = [
-  {
-    name: 'p1',
-    id: 1,
-    createdTime: '12345',
-    rowCount: 7,
-  },
-  {
-    name: 'p2',
-    id: 2,
-    createdTime: '12354',
-    rowCount: 7,
-  },
-];
-
-export const mockGetReplicasData = [
-  {
-    partition_ids: ['1'],
-    shard_replicas: [
-      {
-        node_ids: ['2'],
-        leaderID: '2',
-        leader_addr: '172.20.0.11:21123',
-        dm_channel_name: 'by-dev-rootcoord-dml_2_438207169419481300v0',
-      },
-      {
-        node_ids: ['2'],
-        leaderID: '2',
-        leader_addr: '172.20.0.11:21123',
-        dm_channel_name: 'by-dev-rootcoord-dml_3_438207169419481300v1',
-      },
-    ],
-    node_ids: ['2'],
-    replicaID: '438207185122754599',
-    collectionID: '438207169419481300',
-  },
-  {
-    partition_ids: [],
-    shard_replicas: [
-      {
-        node_ids: ['4'],
-        leaderID: '4',
-        leader_addr: '172.20.0.10:21123',
-        dm_channel_name: 'by-dev-rootcoord-dml_2_438207169419481300v0',
-      },
-      {
-        node_ids: ['4'],
-        leaderID: '4',
-        leader_addr: '172.20.0.10:21123',
-        dm_channel_name: 'by-dev-rootcoord-dml_3_438207169419481300v1',
-      },
-    ],
-    node_ids: ['4'],
-    replicaID: '438207185122754598',
-    collectionID: '438207169419481300',
-  },
-];

+ 0 - 371
server/src/__tests__/__mocks__/milvus/milvusClient.ts

@@ -1,371 +0,0 @@
-import {
-  AlterAliasReq,
-  CreateAliasReq,
-  CreateCollectionReq,
-  CreateIndexReq,
-  CreatePartitionReq,
-  DescribeCollectionReq,
-  DescribeIndexReq,
-  DropAliasReq,
-  DropCollectionReq,
-  DropIndexReq,
-  DropPartitionReq,
-  FlushReq,
-  GetCollectionStatisticsReq,
-  GetIndexBuildProgressReq,
-  GetIndexStateReq,
-  GetPartitionStatisticsReq,
-  InsertReq,
-  LoadCollectionReq,
-  LoadPartitionsReq,
-  ReleaseLoadCollectionReq,
-  ReleasePartitionsReq,
-  SearchReq,
-  ShowCollectionsReq,
-  ShowPartitionsReq,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types';
-import { DeleteEntitiesReq } from '@zilliz/milvus2-sdk-node/dist/milvus/types/Data';
-import { QueryDto } from '../../../collections/dto';
-import {
-  CodeEnum,
-  ERR_NO_ADDRESS,
-  ERR_NO_ALIAS,
-  ERR_NO_COLLECTION,
-  ERR_NO_INDEX,
-  ERR_NO_PARAM,
-} from '../../utils/constants';
-import { mockStatusInfo } from '../../utils/mock.util';
-import {
-  mockCollectionNames,
-  mockCollections,
-  mockIndexState,
-  mockLoadedCollections,
-  mockPartition,
-} from '../consts';
-
-const mockMilvusClient = jest.fn().mockImplementation((address: string) => {
-  return {
-    checkHealth: () => {
-      return Promise.resolve({ isHealthy: true });
-    },
-    collectionManager: {
-      hasCollection: (param: { collection_name: string }) => {
-        const { collection_name } = param;
-        if (address === '') {
-          throw new Error(ERR_NO_ADDRESS);
-        }
-        return collection_name;
-      },
-      showCollections: (param?: ShowCollectionsReq) => {
-        if (!param) {
-          return {
-            status: mockStatusInfo(CodeEnum.success),
-            data: mockCollectionNames,
-          };
-        }
-        const { collection_names, type } = param;
-        // loaded type
-        if (type === 1) {
-          return {
-            status: mockStatusInfo(CodeEnum.success),
-            data: mockLoadedCollections,
-          };
-        }
-        return collection_names && collection_names.length > 0
-          ? {
-              status: mockStatusInfo(CodeEnum.success),
-              data: collection_names,
-            }
-          : { status: mockStatusInfo(CodeEnum.error, ERR_NO_PARAM) };
-      },
-      createCollection: (param: CreateCollectionReq) => {
-        const { collection_name, fields } = param;
-        if (!collection_name) {
-          return mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION);
-        }
-        return { ...mockStatusInfo(CodeEnum.success), data: fields };
-      },
-      describeCollection: (param: DescribeCollectionReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return {
-            status: mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION),
-          };
-        }
-        const res = mockCollections.find(c => c.name === collection_name) || {};
-        return {
-          status: mockStatusInfo(CodeEnum.success),
-          ...res,
-        };
-      },
-      dropCollection: (param: DropCollectionReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION);
-        }
-        return { ...mockStatusInfo(CodeEnum.success), data: collection_name };
-      },
-      loadCollection: (param: LoadCollectionReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION);
-        }
-        return { ...mockStatusInfo(CodeEnum.success), data: collection_name };
-      },
-      releaseCollection: (param: ReleaseLoadCollectionReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION);
-        }
-
-        return { ...mockStatusInfo(CodeEnum.success), data: collection_name };
-      },
-      getCollectionStatistics: (param: GetCollectionStatisticsReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return { status: mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION) };
-        }
-        const data = {
-          name: collection_name,
-          stats: [{ key: 'row_count', value: 7 }],
-        };
-        return {
-          status: mockStatusInfo(CodeEnum.success),
-          ...data,
-        };
-      },
-      createAlias: (param: CreateAliasReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION);
-        }
-
-        return {
-          ...mockStatusInfo(CodeEnum.success),
-          data: param,
-        };
-      },
-      alterAlias: (param: AlterAliasReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION);
-        }
-
-        return {
-          ...mockStatusInfo(CodeEnum.success),
-          data: param,
-        };
-      },
-      dropAlias: (param: DropAliasReq) => {
-        const { alias } = param;
-        if (!alias) {
-          return mockStatusInfo(CodeEnum.error, ERR_NO_ALIAS);
-        }
-
-        return {
-          ...mockStatusInfo(CodeEnum.success),
-          data: alias,
-        };
-      },
-    },
-    partitionManager: {
-      createPartition: (param: CreatePartitionReq) => {
-        const { collection_name, partition_name } = param;
-        if (!collection_name) {
-          return mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION);
-        }
-        return { ...mockStatusInfo(CodeEnum.success), data: partition_name };
-      },
-      dropPartition: (param: DropPartitionReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION);
-        }
-        return { ...mockStatusInfo(CodeEnum.success), data: param };
-      },
-      loadPartitions: (param: LoadPartitionsReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION);
-        }
-        return { ...mockStatusInfo(CodeEnum.success), data: param };
-      },
-      releasePartitions: (param: ReleasePartitionsReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION);
-        }
-        return { ...mockStatusInfo(CodeEnum.success), data: param };
-      },
-      showPartitions: (param: ShowPartitionsReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return { status: mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION) };
-        }
-        return {
-          status: mockStatusInfo(CodeEnum.success),
-          ...mockPartition,
-        };
-      },
-      getPartitionStatistics: (param: GetPartitionStatisticsReq) => {
-        const { collection_name, partition_name } = param;
-        if (!collection_name) {
-          return { status: mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION) };
-        }
-
-        const data = {
-          name: partition_name,
-          stats: [{ key: 'row_count', value: 7 }],
-        };
-
-        return {
-          status: mockStatusInfo(CodeEnum.success),
-          ...data,
-        };
-      },
-    },
-    indexManager: {
-      getIndexState: (param: GetIndexStateReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return { status: mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION) };
-        }
-        const data =
-          mockIndexState.find(i => i.collection_name === collection_name) || {};
-        return {
-          status: mockStatusInfo(CodeEnum.success),
-          ...data,
-        };
-      },
-      createIndex: (param: CreateIndexReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION);
-        }
-
-        return {
-          ...mockStatusInfo(CodeEnum.success),
-          data: param,
-        };
-      },
-      describeIndex: (param: DescribeIndexReq) => {
-        const { collection_name, field_name } = param;
-        if (!collection_name) {
-          return { status: mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION) };
-        }
-        if (!field_name) {
-          return {
-            status: mockStatusInfo(CodeEnum.indexNoExist, ERR_NO_INDEX),
-          };
-        }
-
-        return {
-          status: mockStatusInfo(CodeEnum.success),
-          data: param,
-        };
-      },
-      dropIndex: (param: DropIndexReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION);
-        }
-
-        return {
-          ...mockStatusInfo(CodeEnum.success),
-          data: param,
-        };
-      },
-      getIndexBuildProgress: (param: GetIndexBuildProgressReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return { status: mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION) };
-        }
-
-        return {
-          status: mockStatusInfo(CodeEnum.success),
-          data: param,
-        };
-      },
-    },
-    dataManager: {
-      flush: (data: FlushReq) => ({
-        data,
-      }),
-      getMetric: (data: { request: { metric_type: string } }) => {
-        const {
-          request: { metric_type: type },
-        } = data;
-
-        return {
-          type,
-        };
-      },
-      insert: (param: InsertReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return { status: mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION) };
-        }
-
-        return {
-          status: mockStatusInfo(CodeEnum.success),
-          data: param,
-        };
-      },
-      search: (param: SearchReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return { status: mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION) };
-        }
-
-        return {
-          status: mockStatusInfo(CodeEnum.success),
-          data: param,
-        };
-      },
-      query: (
-        param: {
-          collection_name: string;
-        } & QueryDto
-      ) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return { status: mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION) };
-        }
-
-        return {
-          status: mockStatusInfo(CodeEnum.success),
-          data: param,
-        };
-      },
-      deleteEntities: (param: DeleteEntitiesReq) => {
-        const { collection_name } = param;
-        if (!collection_name) {
-          return { status: mockStatusInfo(CodeEnum.error, ERR_NO_COLLECTION) };
-        }
-        return {
-          status: mockStatusInfo(CodeEnum.success),
-          data: param,
-        };
-      },
-    },
-    userManager: {
-      listUsers: () => {
-        return {
-          status: { ...mockStatusInfo(CodeEnum.success) },
-          usernames: ['root'],
-        };
-      },
-      createUser: () => {
-        return { ...mockStatusInfo(CodeEnum.success) };
-      },
-      deleteUser: () => {
-        return { ...mockStatusInfo(CodeEnum.success) };
-      },
-      updateUser: () => {
-        return { ...mockStatusInfo(CodeEnum.success) };
-      },
-    },
-  };
-});
-
-export default mockMilvusClient;

+ 0 - 9
server/src/__tests__/__mocks__/milvus/milvusService.ts

@@ -1,9 +0,0 @@
-const mockMivusService = jest.fn().mockImplementation(() => {
-  return {
-    connectMilvus: (address: string) => new Promise(() => !!address),
-    checkConnect: (address: string) => new Promise(() => address),
-    flush: (collectionName: string) => new Promise(() => collectionName),
-  };
-});
-
-export default mockMivusService;

+ 0 - 335
server/src/__tests__/collections/collections.service.test.ts

@@ -1,335 +0,0 @@
-import mockMilvusClient from '../__mocks__/milvus/milvusClient';
-import { CollectionsService } from '../../collections/collections.service';
-import { MilvusService } from '../../milvus/milvus.service';
-import {
-  ERR_NO_ALIAS,
-  ERR_NO_COLLECTION,
-  ERR_NO_PARAM,
-} from '../utils/constants';
-import {
-  insightCacheForTest,
-  mockAddress,
-  mockCollectionNames,
-  mockCollections,
-  mockGetAllCollectionsData,
-  mockLoadedCollections,
-  mockLoadedCollectionsData,
-  mockGetReplicasData,
-} from '../__mocks__/consts';
-import { MilvusClient } from '@zilliz/milvus2-sdk-node/dist/milvus';
-
-// mock Milvus client
-jest.mock('@zilliz/milvus2-sdk-node', () => {
-  return {
-    MilvusClient: mockMilvusClient,
-  };
-});
-
-describe('Test collections service', () => {
-  let milvusService: any;
-  let service: any;
-
-  beforeAll(async () => {
-    // setup Milvus service and connect to mock Milvus client
-    milvusService = new MilvusService();
-    MilvusService.activeAddress = mockAddress;
-    MilvusService.activeMilvusClient = new MilvusClient(mockAddress);
-
-    await milvusService.connectMilvus(
-      { address: mockAddress },
-      insightCacheForTest
-    );
-    service = new CollectionsService(milvusService);
-    // mock getReplicas
-    service.getReplicas = async () => {
-      return new Promise<any>(resolve => {
-        resolve(mockGetReplicasData);
-      });
-    };
-  });
-
-  afterAll(() => {
-    milvusService = null;
-    service = null;
-  });
-
-  test('test managers after connected to Milvus', () => {
-    expect(service.collectionManager).toBeDefined();
-    expect(service.dataManager).toBeDefined();
-    expect(service.indexManager).toBeDefined();
-  });
-
-  test('test getCollections method', async () => {
-    const res = await service.getCollections({
-      collection_names: ['c1', 'c2'],
-    });
-    expect(res.data.length).toBe(2);
-
-    const defaultRes = await service.getCollections();
-    expect(defaultRes.data).toEqual(mockCollectionNames);
-
-    const loadedRes = await service.getCollections({ type: 1 });
-    expect(loadedRes.data).toEqual(mockLoadedCollections);
-
-    try {
-      await service.getCollections({ collection_names: [] });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_PARAM);
-    }
-  });
-
-  test('test createCollection method', async () => {
-    const res = await service.createCollection({
-      collection_name: 'c1',
-      fields: [],
-    });
-    expect(res.data.length).toBe(0);
-
-    try {
-      await service.createCollection({ collection_name: '', fields: [] });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test describeCollection method', async () => {
-    const res = await service.describeCollection({
-      collection_name: 'c1',
-    });
-    const { status, ...result } = res;
-    const [mockRes] = mockCollections;
-    expect(result).toEqual(mockRes);
-
-    try {
-      await service.describeCollection({ collection_name: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test dropCollection method', async () => {
-    const res = await service.dropCollection({ collection_name: 'c1' });
-    expect(res.data).toBe('c1');
-
-    try {
-      await service.dropCollection({ collection_name: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test loadCollection method', async () => {
-    const res = await service.loadCollection({ collection_name: 'c1' });
-    expect(res.data).toBe('c1');
-
-    try {
-      await service.loadCollection({ collection_name: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test releaseCollection method', async () => {
-    const res = await service.releaseCollection({ collection_name: 'c1' });
-    expect(res.data).toBe('c1');
-
-    try {
-      await service.releaseCollection({ collection_name: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test getCollectionStatistics method', async () => {
-    const res = await service.getCollectionStatistics({
-      collection_name: 'c1',
-    });
-    const { status, ...data } = res;
-    expect(data.name).toBe('c1');
-    expect(data.stats.length).toBe(1);
-
-    try {
-      await service.getCollectionStatistics({ collection_name: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test insert method', async () => {
-    const mockParam = {
-      collection_name: 'c1',
-      fields_data: {
-        vector_field: [1, 2, 3, 4],
-        age: 7,
-      },
-    };
-    const res = await service.insert(mockParam);
-    expect(res.data).toEqual(mockParam);
-
-    try {
-      await service.insert({
-        collection_name: '',
-        fields_data: {
-          vector_field: [1, 2, 3, 4],
-        },
-      });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test importSample method', async () => {
-    const mockParam = {
-      collection_name: 'c1',
-      size: 2,
-    };
-    const res = await service.importSample(mockParam);
-    expect(res.data.fields_data.length).toEqual(2);
-
-    try {
-      await service.importSample({
-        collection_name: '',
-        size: 20,
-      });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test vectorSearch method', async () => {
-    const mockParam = {
-      collection_name: 'c1',
-      search_params: {
-        anns_field: 'float_vector',
-        topk: '10',
-        metric_type: 'L2',
-        params: JSON.stringify({ nprobe: 1024 }),
-      },
-      vectors: [[1, 2, 3, 4]],
-      vector_type: 101,
-    };
-
-    const res = await service.vectorSearch(mockParam);
-    expect(res.data).toEqual(mockParam);
-
-    try {
-      await service.vectorSearch({ ...mockParam, collection_name: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test createAlias method', async () => {
-    const mockParam = {
-      collection_name: 'c1',
-      alias: 'alias',
-    };
-
-    const res = await service.createAlias(mockParam);
-    expect(res.data).toEqual(mockParam);
-
-    try {
-      await service.createAlias({ collection_name: '', alias: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test alterAlias method', async () => {
-    const mockParam = {
-      collection_name: 'c1',
-      alias: 'alias',
-    };
-
-    const res = await service.alterAlias(mockParam);
-    expect(res.data).toEqual(mockParam);
-
-    try {
-      await service.alterAlias({ collection_name: '', alias: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test dropAlias method', async () => {
-    const res = await service.dropAlias({ alias: 'alias' });
-    expect(res.data).toBe('alias');
-
-    try {
-      await service.dropAlias({ alias: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_ALIAS);
-    }
-  });
-
-  test('test query method', async () => {
-    const mockParam = {
-      collection_name: 'c1',
-      expr: 'age > 7',
-    };
-    const res = await service.query(mockParam);
-    expect(res.data).toEqual(mockParam);
-
-    try {
-      await service.query({ collection_name: '', expr: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test getIndexStatus method', async () => {
-    const res = await service.getIndexStatus({ collection_name: 'c1' });
-    const { status, ...data } = res;
-    expect(data).toEqual({ collection_name: 'c1', state: 3 });
-  });
-
-  test('test getAllCollections method', async () => {
-    const res = await service.getAllCollections();
-    expect(res).toEqual(mockGetAllCollectionsData);
-  });
-
-  test('test getLoadedCollections method', async () => {
-    const res = await service.getLoadedColletions();
-    expect(res).toEqual(mockLoadedCollectionsData);
-  });
-
-  test('test getStatistics method', async () => {
-    const res = await service.getStatistics();
-    expect(res).toEqual({
-      // 2 collections
-      collectionCount: 2,
-      // each collection 7 row counts
-      totalData: 14,
-    });
-  });
-
-  test('test getCollectionIndexStatus method', async () => {
-    const res = await service.getCollectionsIndexStatus();
-    expect(res).toEqual([
-      {
-        collection_name: 'c1',
-        index_status: 3,
-      },
-      {
-        collection_name: 'c2',
-        index_status: 2,
-      },
-    ]);
-  });
-
-  test('test deleteEntities method', async () => {
-    const mockParam = {
-      collection_name: 'c1',
-      expr: 'age > 7',
-    };
-
-    const res = await service.deleteEntities(mockParam);
-    expect(res.data).toEqual(mockParam);
-
-    try {
-      await service.deleteEntities({ collection_name: '', expr: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-});

+ 0 - 183
server/src/__tests__/crons/crons.service.test.ts

@@ -1,183 +0,0 @@
-import mockMilvusClient from '../__mocks__/milvus/milvusClient';
-import { schedule } from 'node-cron';
-import { CollectionsService } from '../../collections/collections.service';
-import { CronsService, SchedulerRegistry } from '../../crons/crons.service';
-import { MilvusService } from '../../milvus/milvus.service';
-import { WS_EVENTS, WS_EVENTS_TYPE } from '../../utils/Const';
-import {
-  insightCacheForTest,
-  mockAddress,
-  mockGetReplicasData,
-} from '../__mocks__/consts';
-import { MilvusClient } from '@zilliz/milvus2-sdk-node/dist/milvus';
-
-// mock Milvus client
-jest.mock('@zilliz/milvus2-sdk-node', () => {
-  return {
-    MilvusClient: mockMilvusClient,
-  };
-});
-
-// mock node-cron
-jest.mock('node-cron', () => {
-  return {
-    schedule: jest.fn(),
-  };
-});
-
-// mock variable
-const mockCronFrequency = '30 00 * * *';
-const mockCronEveryFiveSec = '*/5 * * * * *';
-const mockCb = jest.fn();
-const mockErrCb = jest.fn(() => {
-  throw new Error('error');
-});
-const mockName = 'j1';
-const mockSecName = 'everySec';
-
-describe('test crons service', () => {
-  let milvusService: any;
-  let collectionService: any;
-  let cronsService: any;
-  let schedulerRegistry: any;
-
-  const handleStartTask = jest.fn();
-  const handleEndTask = jest.fn();
-
-  const setup = async () => {
-    milvusService = new MilvusService();
-    MilvusService.activeAddress = mockAddress;
-    MilvusService.activeMilvusClient = new MilvusClient(mockAddress);
-
-    await milvusService.connectMilvus(
-      { address: mockAddress },
-      insightCacheForTest
-    );
-
-    collectionService = new CollectionsService(milvusService);
-    collectionService.getReplicas = async () => {
-      return new Promise<any>(resolve => {
-        resolve(mockGetReplicasData);
-      });
-    };
-
-    schedulerRegistry = new SchedulerRegistry([]);
-    cronsService = new CronsService(collectionService, schedulerRegistry);
-  };
-
-  beforeAll(async () => {
-    // setup Milvus service and connect to mock Milvus client
-    await setup();
-  });
-
-  beforeEach(() => {
-    // mock schedule
-    (schedule as jest.Mock).mockImplementationOnce((frequency, callback) => {
-      callback();
-      return {
-        start: handleStartTask,
-        stop: handleEndTask,
-      };
-    });
-  });
-
-  afterAll(() => {
-    milvusService = null;
-    collectionService = null;
-    schedulerRegistry = null;
-    cronsService = null;
-  });
-
-  test('test SchedulerRegistry related methods', async () => {
-    schedulerRegistry.setCronJob(mockName, mockCronFrequency, () => mockCb());
-    expect(mockCb).toBeCalledTimes(1);
-    expect(schedule).toBeCalledWith(mockCronFrequency, expect.any(Function));
-
-    const job = schedulerRegistry.getCronJob(mockName);
-    expect(job).toEqual({
-      start: handleStartTask,
-      stop: handleEndTask,
-    });
-
-    schedulerRegistry.setCronJob(mockName, mockCronFrequency, () => mockCb());
-    expect(handleEndTask).toBeCalled();
-
-    schedulerRegistry.setCronJobEveryFiveSecond(mockSecName, () => mockCb());
-    expect(schedule).toBeCalledWith(mockCronEveryFiveSec, expect.any(Function));
-
-    schedulerRegistry.setCronJob(mockName, mockCronFrequency, () => mockCb());
-    expect(handleEndTask).toBeCalled();
-
-    schedulerRegistry.setCronJob(mockName, mockCronFrequency, () =>
-      mockErrCb()
-    );
-    expect(() => {
-      mockErrCb();
-    }).toThrow();
-  });
-
-  test('test CronService related methods', async () => {
-    try {
-      await cronsService.toggleCronJobByName({
-        name: WS_EVENTS.COLLECTION,
-        type: WS_EVENTS_TYPE.STOP,
-      });
-    } catch (err) {
-      expect(err.message).toBe('No existed job entity');
-    }
-
-    await cronsService.toggleCronJobByName({
-      name: WS_EVENTS.COLLECTION,
-      type: WS_EVENTS_TYPE.START,
-    });
-    expect(schedule).toBeCalledWith(mockCronEveryFiveSec, expect.any(Function));
-
-    schedulerRegistry.setCronJob(WS_EVENTS.COLLECTION, mockCronFrequency, () =>
-      mockCb()
-    );
-    await cronsService.toggleCronJobByName({
-      name: WS_EVENTS.COLLECTION,
-      type: WS_EVENTS_TYPE.START,
-    });
-
-    expect(handleStartTask).toBeCalled();
-    await cronsService.toggleCronJobByName({
-      name: WS_EVENTS.COLLECTION,
-      type: WS_EVENTS_TYPE.STOP,
-    });
-    expect(handleStartTask).toBeCalled();
-
-    try {
-      await cronsService.toggleCronJobByName({
-        name: mockName,
-        type: WS_EVENTS_TYPE.STOP,
-      });
-    } catch (err) {
-      expect(err.message).toBe('Unsupported event type');
-    }
-  });
-
-  test('test getCollections error', async () => {
-    // reset setup to trigger error
-    const newCollectionService = new CollectionsService(milvusService);
-    const newSchedulerRegistry = new SchedulerRegistry([]);
-
-    newCollectionService.getReplicas = async () => {
-      return new Promise<any>(resolve => {
-        resolve(mockGetReplicasData);
-      });
-    };
-
-    const newCronsService = new CronsService(
-      newCollectionService,
-      newSchedulerRegistry
-    );
-
-    await newCronsService.getCollections(
-      WS_EVENTS.COLLECTION,
-      '127.0.0.1:19530'
-    );
-    expect(schedule).toBeCalledWith(mockCronEveryFiveSec, expect.any(Function));
-    expect(handleEndTask).toBeCalled();
-  });
-});

+ 0 - 54
server/src/__tests__/milvus/milvus.controller.test.ts

@@ -1,54 +0,0 @@
-import express from 'express';
-import http from 'http';
-import supertest from 'supertest';
-import { TransformResMiddlerware } from '../../middlewares';
-import { router as connectRouter } from '../../milvus/index';
-import { mockAddress } from '../__mocks__/consts';
-
-import MilvusService from '../__mocks__/milvus/milvusService';
-
-// mock Milvus client service
-jest.mock('../__mocks__/milvus/milvusService');
-
-describe('Test Milvus Module', () => {
-  let app: any;
-  let server: any;
-  let request: any;
-
-  // setup app and server
-  beforeAll((done) => {
-    app = express();
-    const router = express.Router();
-    router.use('/milvus', connectRouter);
-    app.use(TransformResMiddlerware);
-    app.use('/api/v1', router);
-    server = http.createServer(app);
-    server.listen(done);
-    request = supertest(server);
-  });
-
-  beforeEach(() => {
-    // Clear all instances and calls to constructor and all methods:
-    MilvusService.mockClear();
-  });
-
-  // close server
-  afterAll((done) => {
-    server.close(done);
-  });
-
-  test('check whether connected to Milvus with address', () => {
-    // with address param
-    request.get('/check').query({ address: mockAddress }).expect(200);
-    // without address param
-    request.get('/check').expect(404);
-  });
-
-  test('check request to connect to Milvus', () => {
-    request
-      .post('/connect')
-      .send({ address: mockAddress })
-      .set('Accept', 'application/json')
-      .expect(200);
-  });
-});

+ 0 - 73
server/src/__tests__/milvus/milvus.service.test.ts

@@ -1,73 +0,0 @@
-import mockMilvusClient from '../__mocks__/milvus/milvusClient';
-import { MilvusService } from '../../milvus/milvus.service';
-import { insightCacheForTest, mockAddress } from '../__mocks__/consts';
-import { MilvusClient } from '@zilliz/milvus2-sdk-node/dist/milvus';
-
-// mock Milvus client
-jest.mock('@zilliz/milvus2-sdk-node', () => {
-  return {
-    MilvusClient: mockMilvusClient,
-  };
-});
-
-describe('Test Milvus service', () => {
-  let service: any;
-
-  // init service
-  beforeEach(() => {
-    service = new MilvusService();
-    MilvusService.activeAddress = mockAddress;
-    MilvusService.activeMilvusClient = new MilvusClient(mockAddress);
-  });
-
-  afterEach(() => {
-    service = null;
-  });
-
-  test('test connectMilvus method', async () => {
-    const res = await service.connectMilvus(
-      { address: mockAddress },
-      insightCacheForTest
-    );
-    expect(res.address).toBe(mockAddress);
-  });
-
-  test('test checkMilvus when not connect to Milvus', () => {
-    try {
-      service.checkMilvus();
-    } catch (err) {
-      expect(err.message).toBe('Please connect milvus first');
-    }
-  });
-
-  test('test checkConnect method', async () => {
-    // mock connect first
-    await service.connectMilvus({ address: mockAddress }, insightCacheForTest);
-    // different address
-    const errorRes = await service.checkConnect('123', insightCacheForTest);
-    expect(errorRes.connected).toBeFalsy();
-    const res = await service.checkConnect(mockAddress, insightCacheForTest);
-    expect(res.connected).toBeTruthy();
-  });
-
-  test('test managers after connected', async () => {
-    await service.connectMilvus({ address: mockAddress }, insightCacheForTest);
-    expect(service.collectionManager).toBeDefined();
-    expect(service.partitionManager).toBeDefined();
-    expect(service.indexManager).toBeDefined();
-    expect(service.dataManager).toBeDefined();
-  });
-
-  test('test flush method', async () => {
-    await service.connectMilvus({ address: mockAddress }, insightCacheForTest);
-    const res = await service.flush({ collection_names: ['c1', 'c2'] });
-    const data = res.data.collection_names;
-    expect(data.length).toBe(2);
-  });
-
-  test('test getMetrics method', async () => {
-    await service.connectMilvus({ address: mockAddress }, insightCacheForTest);
-    const res = await service.getMetrics();
-    expect(res.type).toBe('system_info');
-  });
-});

+ 0 - 152
server/src/__tests__/partitions/partitions.service.test.ts

@@ -1,152 +0,0 @@
-import mockMilvusClient from '../__mocks__/milvus/milvusClient';
-import { MilvusService } from '../../milvus/milvus.service';
-import { ERR_NO_COLLECTION } from '../utils/constants';
-import { PartitionsService } from '../../partitions/partitions.service';
-import {
-  insightCacheForTest,
-  mockAddress,
-  mockGetPartitionsInfoData,
-  mockPartition,
-} from '../__mocks__/consts';
-import { MilvusClient } from '@zilliz/milvus2-sdk-node/dist/milvus';
-
-// mock Milvus client
-jest.mock('@zilliz/milvus2-sdk-node', () => {
-  return {
-    MilvusClient: mockMilvusClient,
-  };
-});
-
-describe('Test partitions service', () => {
-  let milvusService: any;
-  let service: any;
-
-  beforeAll(async () => {
-    // setup Milvus service and connect to mock Milvus client
-    milvusService = new MilvusService();
-    MilvusService.activeAddress = mockAddress;
-    MilvusService.activeMilvusClient = new MilvusClient(mockAddress);
-
-    await milvusService.connectMilvus(
-      { address: mockAddress },
-      insightCacheForTest
-    );
-    service = new PartitionsService(milvusService);
-  });
-
-  afterAll(() => {
-    milvusService = null;
-    service = null;
-  });
-
-  test('test manager after connected to Milvus', () => {
-    expect(service.partitionManager).toBeDefined();
-  });
-
-  test('test createPartition method', async () => {
-    const res = await service.createPartition({
-      collection_name: 'c1',
-      partition_name: 'p1',
-    });
-    expect(res.data).toBe('p1');
-
-    try {
-      await service.createPartition({
-        collection_name: '',
-        partition_name: 'p1',
-      });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test deletePartition method', async () => {
-    const mockParam = {
-      collection_name: 'c1',
-      partition_name: 'p1',
-    };
-    const res = await service.deletePartition(mockParam);
-    expect(res.data).toEqual(mockParam);
-
-    try {
-      await service.deletePartition({
-        collection_name: '',
-        partition_name: '',
-      });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test loadPartitions method', async () => {
-    const mockParam = {
-      collection_name: 'c1',
-      partition_names: ['p1', 'p2'],
-    };
-    const res = await service.loadPartitions(mockParam);
-    expect(res.data).toEqual(mockParam);
-
-    try {
-      await service.loadPartitions({
-        collection_name: '',
-        partition_names: [],
-      });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test releasePartitions method', async () => {
-    const mockParam = {
-      collection_name: 'c1',
-      partition_names: ['p1', 'p2'],
-    };
-    const res = await service.releasePartitions(mockParam);
-    expect(res.data).toEqual(mockParam);
-
-    try {
-      await service.releasePartitions({
-        collection_name: '',
-        partition_names: [],
-      });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test getPartitions method', async () => {
-    const res = await service.getPartitions({ collection_name: 'c1' });
-    const { status, ...data } = res;
-    expect(data).toEqual(mockPartition);
-
-    try {
-      await service.getPartitions({ collection_name: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test getPartitionStatistics method', async () => {
-    const res = await service.getPartitionStatistics({
-      collection_name: 'c1',
-      partition_name: 'p1',
-    });
-    const { status, ...data } = res;
-    expect(data.name).toBe('p1');
-    expect(data.stats.length).toBe(1);
-
-    try {
-      await service.getPartitionStatistics({
-        collection_name: '',
-        partition_name: '',
-      });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test getPartitionsInfo method', async () => {
-    const res = await service.getPartitionsInfo({ collection_name: 'c1' });
-    expect(res).toEqual(mockGetPartitionsInfoData);
-  });
-});

+ 0 - 121
server/src/__tests__/schema/schema.service.test.ts

@@ -1,121 +0,0 @@
-import mockMilvusClient from '../__mocks__/milvus/milvusClient';
-import { MilvusService } from '../../milvus/milvus.service';
-import { CodeEnum, ERR_NO_COLLECTION } from '../utils/constants';
-import { SchemaService } from '../../schema/schema.service';
-import { insightCacheForTest, mockAddress } from '../__mocks__/consts';
-import { MilvusClient } from '@zilliz/milvus2-sdk-node/dist/milvus';
-
-// mock Milvus client
-jest.mock('@zilliz/milvus2-sdk-node', () => {
-  return {
-    MilvusClient: mockMilvusClient,
-  };
-});
-
-describe('Test schema service', () => {
-  let milvusService: any;
-  let service: any;
-
-  beforeAll(async () => {
-    // setup Milvus service and connect to mock Milvus client
-    milvusService = new MilvusService();
-    MilvusService.activeAddress = mockAddress;
-    MilvusService.activeMilvusClient = new MilvusClient(mockAddress);
-
-    await milvusService.connectMilvus(
-      { address: mockAddress },
-      insightCacheForTest
-    );
-    service = new SchemaService(milvusService);
-  });
-
-  afterAll(() => {
-    milvusService = null;
-    service = null;
-  });
-
-  test('test manager after connected to Milvus', () => {
-    expect(service.indexManager).toBeDefined();
-  });
-
-  test('test createIndex method', async () => {
-    const mockParam = {
-      collection_name: 'c1',
-      field_name: 'vector_field',
-      extra_params: {
-        index_type: 'BIN_FLAT',
-        metric_type: 'HAMMING',
-        params: JSON.stringify({ nlist: 1024 }),
-      },
-    };
-    const res = await service.createIndex(mockParam);
-    expect(res.data).toEqual(mockParam);
-
-    try {
-      await service.createIndex({ ...mockParam, collection_name: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test describeIndex method', async () => {
-    const res = await service.describeIndex({
-      collection_name: 'c1',
-      field_name: 'f1',
-    });
-    expect(res.data).toEqual({ collection_name: 'c1', field_name: 'f1' });
-
-    const noExistRes = await service.describeIndex({ collection_name: 'c1' });
-    expect(noExistRes.status.error_code).toBe(CodeEnum.indexNoExist);
-
-    try {
-      await service.describeIndex({ collection_name: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test dropIndex method', async () => {
-    const res = await service.dropIndex({
-      collection_name: 'c1',
-    });
-    expect(res.data).toEqual({ collection_name: 'c1' });
-
-    try {
-      await service.dropIndex({ collection_name: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test getIndexState method', async () => {
-    const res = await service.getIndexState({ collection_name: 'c1' });
-    const { status, ...data } = res;
-    expect(data).toEqual({ collection_name: 'c1', state: 3 });
-
-    try {
-      await service.getIndexState({ collection_name: '' });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-
-  test('test getIndexBuildProgress method', async () => {
-    const mockParam = {
-      collection_name: 'c1',
-      field_name: 'f1',
-      index_name: 'i1',
-    };
-    const res = await service.getIndexBuildProgress(mockParam);
-    expect(res.data).toEqual(mockParam);
-
-    try {
-      await service.getIndexBuildProgress({
-        ...mockParam,
-        collection_name: '',
-      });
-    } catch (err) {
-      expect(err).toBe(ERR_NO_COLLECTION);
-    }
-  });
-});

+ 0 - 64
server/src/__tests__/users/users.service.test.ts

@@ -1,64 +0,0 @@
-import mockMilvusClient from '../__mocks__/milvus/milvusClient';
-import { MilvusService } from '../../milvus/milvus.service';
-import { CodeEnum } from '../utils/constants';
-import { insightCacheForTest, mockAddress } from '../__mocks__/consts';
-import { MilvusClient } from '@zilliz/milvus2-sdk-node/dist/milvus';
-import { UserService } from '../../users/users.service';
-
-// mock Milvus client
-jest.mock('@zilliz/milvus2-sdk-node', () => {
-  return {
-    MilvusClient: mockMilvusClient,
-  };
-});
-
-describe('Test user service', () => {
-  let milvusService: any;
-  let service: UserService;
-
-  beforeAll(async () => {
-    // setup Milvus service and connect to mock Milvus client
-    milvusService = new MilvusService();
-    MilvusService.activeAddress = mockAddress;
-    MilvusService.activeMilvusClient = new MilvusClient(mockAddress);
-
-    await milvusService.connectMilvus(
-      { address: mockAddress },
-      insightCacheForTest
-    );
-    service = new UserService(milvusService);
-  });
-
-  afterAll(() => {
-    milvusService = null;
-    service = null;
-  });
-
-  test('test user manager after connected to Milvus', () => {
-    expect(service.userManager).toBeDefined();
-  });
-
-  test('test getUsers method', async () => {
-    const res = await service.getUsers();
-    expect(res.usernames.length).toEqual(1);
-  });
-
-  test('test create user method', async () => {
-    const res = await service.createUser({ username: '1', password: '2' });
-    expect(res.error_code).toEqual(CodeEnum.success);
-  });
-
-  test('test delete user method', async () => {
-    const res = await service.deleteUser({ username: '1' });
-    expect(res.error_code).toEqual(CodeEnum.success);
-  });
-
-  test('test update user method', async () => {
-    const res = await service.updateUser({
-      username: '1',
-      oldPassword: '1',
-      newPassword: '2',
-    });
-    expect(res.error_code).toEqual(CodeEnum.success);
-  });
-});

+ 0 - 17
server/src/__tests__/utils/constants.ts

@@ -1,17 +0,0 @@
-export enum CodeEnum {
-  success = 'Success',
-  error = 'Error',
-  indexNoExist = 'IndexNotExist',
-}
-
-export type CodeStatus = {
-  error_code: CodeEnum;
-  reason?: string;
-};
-
-// error msgs
-export const ERR_NO_COLLECTION = 'collection name is invalid';
-export const ERR_NO_ADDRESS = 'no address';
-export const ERR_NO_PARAM = 'no valid param';
-export const ERR_NO_ALIAS = 'no valid alias';
-export const ERR_NO_INDEX = 'index not exist';

+ 0 - 14
server/src/__tests__/utils/mock.util.ts

@@ -1,14 +0,0 @@
-import { CodeEnum, CodeStatus } from './constants';
-
-export const mockStatusInfo = (type: CodeEnum, msg?: string): CodeStatus => {
-  if (type === CodeEnum.success) {
-    return {
-      error_code: type,
-      reason: 'success',
-    };
-  }
-  return {
-    error_code: type,
-    reason: msg,
-  };
-};

+ 3 - 3
server/src/collections/collections.controller.ts

@@ -11,7 +11,7 @@ import {
   QueryDto,
   QueryDto,
   RenameCollectionDto,
   RenameCollectionDto,
 } from './dto';
 } from './dto';
-import { LoadCollectionReq } from '@zilliz/milvus2-sdk-node/dist/milvus/types';
+import { LoadCollectionReq } from '@zilliz/milvus2-sdk-node';
 
 
 export class CollectionController {
 export class CollectionController {
   private collectionsService: CollectionsService;
   private collectionsService: CollectionsService;
@@ -268,11 +268,11 @@ export class CollectionController {
   async query(req: Request, res: Response, next: NextFunction) {
   async query(req: Request, res: Response, next: NextFunction) {
     const name = req.params?.name;
     const name = req.params?.name;
     const data = req.body;
     const data = req.body;
-    const resultiLmit: any = req.query?.limit;
+    const resultLimit: any = req.query?.limit;
     const resultPage: any = req.query?.page;
     const resultPage: any = req.query?.page;
 
 
     try {
     try {
-      const limit = isNaN(resultiLmit) ? 100 : parseInt(resultiLmit, 10);
+      const limit = isNaN(resultLimit) ? 100 : parseInt(resultLimit, 10);
       const page = isNaN(resultPage) ? 0 : parseInt(resultPage, 10);
       const page = isNaN(resultPage) ? 0 : parseInt(resultPage, 10);
       // TODO: add page and limit to node SDK
       // TODO: add page and limit to node SDK
       // Here may raise "Error: 8 RESOURCE_EXHAUSTED: Received message larger than max"
       // Here may raise "Error: 8 RESOURCE_EXHAUSTED: Received message larger than max"

+ 22 - 36
server/src/collections/collections.service.ts

@@ -10,121 +10,107 @@ import {
   ReleaseLoadCollectionReq,
   ReleaseLoadCollectionReq,
   SearchReq,
   SearchReq,
   RenameCollectionReq,
   RenameCollectionReq,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types';
-import { throwErrorFromSDK } from '../utils/Error';
-import { findKeyValue, genRows } from '../utils/Helper';
-import { ROW_COUNT } from '../utils/Const';
-import {
   AlterAliasReq,
   AlterAliasReq,
   CreateAliasReq,
   CreateAliasReq,
   DropAliasReq,
   DropAliasReq,
   ShowCollectionsReq,
   ShowCollectionsReq,
   ShowCollectionsType,
   ShowCollectionsType,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types/Collection';
+  DeleteEntitiesReq,
+} from '@zilliz/milvus2-sdk-node';
+import { throwErrorFromSDK } from '../utils/Error';
+import { findKeyValue, genRows } from '../utils/Helper';
+import { ROW_COUNT } from '../utils/Const';
 import { QueryDto, ImportSampleDto, GetReplicasDto } from './dto';
 import { QueryDto, ImportSampleDto, GetReplicasDto } from './dto';
-import { DeleteEntitiesReq } from '@zilliz/milvus2-sdk-node/dist/milvus/types/Data';
 
 
 export class CollectionsService {
 export class CollectionsService {
   constructor(private milvusService: MilvusService) {}
   constructor(private milvusService: MilvusService) {}
 
 
-  get collectionManager() {
-    return this.milvusService.collectionManager;
-  }
-
-  get dataManager() {
-    return this.milvusService.dataManager;
-  }
-
-  get indexManager() {
-    return this.milvusService.indexManager;
-  }
-
   async getCollections(data?: ShowCollectionsReq) {
   async getCollections(data?: ShowCollectionsReq) {
-    const res = await this.collectionManager.showCollections(data);
+    const res = await this.milvusService.client.showCollections(data);
     throwErrorFromSDK(res.status);
     throwErrorFromSDK(res.status);
     return res;
     return res;
   }
   }
 
 
   async createCollection(data: CreateCollectionReq) {
   async createCollection(data: CreateCollectionReq) {
-    const res = await this.collectionManager.createCollection(data);
+    const res = await this.milvusService.client.createCollection(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }
 
 
   async describeCollection(data: DescribeCollectionReq) {
   async describeCollection(data: DescribeCollectionReq) {
-    const res = await this.collectionManager.describeCollection(data);
+    const res = await this.milvusService.client.describeCollection(data);
     throwErrorFromSDK(res.status);
     throwErrorFromSDK(res.status);
     return res;
     return res;
   }
   }
 
 
   async renameCollection(data: RenameCollectionReq) {
   async renameCollection(data: RenameCollectionReq) {
-    const res = await this.collectionManager.renameCollection(data);
+    const res = await this.milvusService.client.renameCollection(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }
 
 
   async dropCollection(data: DropCollectionReq) {
   async dropCollection(data: DropCollectionReq) {
-    const res = await this.collectionManager.dropCollection(data);
+    const res = await this.milvusService.client.dropCollection(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }
 
 
   async loadCollection(data: LoadCollectionReq) {
   async loadCollection(data: LoadCollectionReq) {
-    const res = await this.collectionManager.loadCollection(data);
+    const res = await this.milvusService.client.loadCollection(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }
 
 
   async releaseCollection(data: ReleaseLoadCollectionReq) {
   async releaseCollection(data: ReleaseLoadCollectionReq) {
-    const res = await this.collectionManager.releaseCollection(data);
+    const res = await this.milvusService.client.releaseCollection(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }
 
 
   async getCollectionStatistics(data: GetCollectionStatisticsReq) {
   async getCollectionStatistics(data: GetCollectionStatisticsReq) {
-    const res = await this.collectionManager.getCollectionStatistics(data);
+    const res = await this.milvusService.client.getCollectionStatistics(data);
     throwErrorFromSDK(res.status);
     throwErrorFromSDK(res.status);
     return res;
     return res;
   }
   }
 
 
   async insert(data: InsertReq) {
   async insert(data: InsertReq) {
-    const res = await this.dataManager.insert(data);
+    const res = await this.milvusService.client.insert(data);
     throwErrorFromSDK(res.status);
     throwErrorFromSDK(res.status);
     return res;
     return res;
   }
   }
 
 
   async deleteEntities(data: DeleteEntitiesReq) {
   async deleteEntities(data: DeleteEntitiesReq) {
-    const res = await this.dataManager.deleteEntities(data);
+    const res = await this.milvusService.client.deleteEntities(data);
     throwErrorFromSDK(res.status);
     throwErrorFromSDK(res.status);
     return res;
     return res;
   }
   }
 
 
   async vectorSearch(data: SearchReq) {
   async vectorSearch(data: SearchReq) {
-    const res = await this.dataManager.search(data);
+    const res = await this.milvusService.client.search(data);
     throwErrorFromSDK(res.status);
     throwErrorFromSDK(res.status);
     return res;
     return res;
   }
   }
 
 
   async createAlias(data: CreateAliasReq) {
   async createAlias(data: CreateAliasReq) {
-    const res = await this.collectionManager.createAlias(data);
+    const res = await this.milvusService.client.createAlias(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }
 
 
   async alterAlias(data: AlterAliasReq) {
   async alterAlias(data: AlterAliasReq) {
-    const res = await this.collectionManager.alterAlias(data);
+    const res = await this.milvusService.client.alterAlias(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }
 
 
   async dropAlias(data: DropAliasReq) {
   async dropAlias(data: DropAliasReq) {
-    const res = await this.collectionManager.dropAlias(data);
+    const res = await this.milvusService.client.dropAlias(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }
 
 
   async getReplicas(data: GetReplicasDto) {
   async getReplicas(data: GetReplicasDto) {
-    const res = await this.collectionManager.getReplicas(data);
+    const res = await this.milvusService.client.getReplicas(data);
     return res;
     return res;
   }
   }
 
 
@@ -133,7 +119,7 @@ export class CollectionsService {
       collection_name: string;
       collection_name: string;
     } & QueryDto
     } & QueryDto
   ) {
   ) {
-    const res = await this.dataManager.query(data);
+    const res = await this.milvusService.client.query(data);
     throwErrorFromSDK(res.status);
     throwErrorFromSDK(res.status);
     return res;
     return res;
   }
   }
@@ -146,7 +132,7 @@ export class CollectionsService {
    * @returns
    * @returns
    */
    */
   async getIndexStatus(data: GetIndexStateReq) {
   async getIndexStatus(data: GetIndexStateReq) {
-    const res = await this.indexManager.getIndexState(data);
+    const res = await this.milvusService.client.getIndexState(data);
     return res;
     return res;
   }
   }
 
 

+ 16 - 31
server/src/milvus/milvus.service.ts

@@ -1,8 +1,8 @@
-import { MilvusClient } from '@zilliz/milvus2-sdk-node';
 import {
 import {
+  MilvusClient,
   FlushReq,
   FlushReq,
   GetMetricsResponse,
   GetMetricsResponse,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types';
+} from '@zilliz/milvus2-sdk-node';
 import HttpErrors from 'http-errors';
 import HttpErrors from 'http-errors';
 import LruCache from 'lru-cache';
 import LruCache from 'lru-cache';
 import { HTTP_STATUS_CODE } from '../utils/Error';
 import { HTTP_STATUS_CODE } from '../utils/Error';
@@ -18,29 +18,8 @@ export class MilvusService {
     return MilvusClient.sdkInfo;
     return MilvusClient.sdkInfo;
   }
   }
 
 
-  get collectionManager() {
-    this.checkMilvus();
-    return MilvusService.activeMilvusClient.collectionManager;
-  }
-
-  get partitionManager() {
-    this.checkMilvus();
-    return MilvusService.activeMilvusClient.partitionManager;
-  }
-
-  get indexManager() {
-    this.checkMilvus();
-    return MilvusService.activeMilvusClient.indexManager;
-  }
-
-  get dataManager() {
-    this.checkMilvus();
-    return MilvusService.activeMilvusClient.dataManager;
-  }
-
-  get userManager() {
-    this.checkMilvus();
-    return MilvusService.activeMilvusClient.userManager;
+  get client() {
+    return MilvusService.activeMilvusClient;
   }
   }
 
 
   static formatAddress(address: string) {
   static formatAddress(address: string) {
@@ -73,24 +52,30 @@ export class MilvusService {
     // grpc only need address without http
     // grpc only need address without http
     const milvusAddress = MilvusService.formatAddress(address);
     const milvusAddress = MilvusService.formatAddress(address);
     const hasAuth = username !== undefined && password !== undefined;
     const hasAuth = username !== undefined && password !== undefined;
+
     try {
     try {
       const milvusClient: MilvusClient = hasAuth
       const milvusClient: MilvusClient = hasAuth
-        ? new MilvusClient(milvusAddress, ssl, username, password)
-        : new MilvusClient(milvusAddress, ssl);
+        ? new MilvusClient({
+            address: milvusAddress,
+            ssl,
+            username,
+            password,
+          })
+        : new MilvusClient({ address, ssl });
 
 
       // check healthy
       // check healthy
       const res = await milvusClient.checkHealth();
       const res = await milvusClient.checkHealth();
 
 
       if (res.isHealthy) {
       if (res.isHealthy) {
         MilvusService.activeAddress = address;
         MilvusService.activeAddress = address;
-        cache.set(milvusAddress, milvusClient);
+        cache.set(address, milvusClient);
         return { address };
         return { address };
       } else {
       } else {
         throw new Error('Milvus is not ready yet.');
         throw new Error('Milvus is not ready yet.');
       }
       }
     } catch (error) {
     } catch (error) {
       // if milvus is not working, delete connection.
       // if milvus is not working, delete connection.
-      cache.del(milvusAddress);
+      cache.del(address);
       throw HttpErrors(HTTP_STATUS_CODE.BAD_REQUEST, error);
       throw HttpErrors(HTTP_STATUS_CODE.BAD_REQUEST, error);
     }
     }
   }
   }
@@ -101,12 +86,12 @@ export class MilvusService {
   }
   }
 
 
   async flush(data: FlushReq) {
   async flush(data: FlushReq) {
-    const res = await MilvusService.activeMilvusClient.dataManager.flush(data);
+    const res = await MilvusService.activeMilvusClient.flush(data);
     return res;
     return res;
   }
   }
 
 
   async getMetrics(): Promise<GetMetricsResponse> {
   async getMetrics(): Promise<GetMetricsResponse> {
-    const res = await MilvusService.activeMilvusClient.dataManager.getMetric({
+    const res = await MilvusService.activeMilvusClient.getMetric({
       request: { metric_type: 'system_info' },
       request: { metric_type: 'system_info' },
     });
     });
     return res;
     return res;

+ 7 - 11
server/src/partitions/partitions.service.ts

@@ -6,7 +6,7 @@ import {
   LoadPartitionsReq,
   LoadPartitionsReq,
   ReleasePartitionsReq,
   ReleasePartitionsReq,
   ShowPartitionsReq,
   ShowPartitionsReq,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types';
+} from '@zilliz/milvus2-sdk-node';
 import { throwErrorFromSDK } from '../utils/Error';
 import { throwErrorFromSDK } from '../utils/Error';
 import { findKeyValue } from '../utils/Helper';
 import { findKeyValue } from '../utils/Helper';
 import { ROW_COUNT } from '../utils/Const';
 import { ROW_COUNT } from '../utils/Const';
@@ -14,10 +14,6 @@ import { ROW_COUNT } from '../utils/Const';
 export class PartitionsService {
 export class PartitionsService {
   constructor(private milvusService: MilvusService) {}
   constructor(private milvusService: MilvusService) {}
 
 
-  get partitionManager() {
-    return this.milvusService.partitionManager;
-  }
-
   async getPartitionsInfo(data: ShowPartitionsReq) {
   async getPartitionsInfo(data: ShowPartitionsReq) {
     const result = [];
     const result = [];
     const res = await this.getPartitions(data);
     const res = await this.getPartitions(data);
@@ -39,37 +35,37 @@ export class PartitionsService {
   }
   }
 
 
   async getPartitions(data: ShowPartitionsReq) {
   async getPartitions(data: ShowPartitionsReq) {
-    const res = await this.partitionManager.showPartitions(data);
+    const res = await this.milvusService.client.showPartitions(data);
     throwErrorFromSDK(res.status);
     throwErrorFromSDK(res.status);
     return res;
     return res;
   }
   }
 
 
   async createPartition(data: CreatePartitionReq) {
   async createPartition(data: CreatePartitionReq) {
-    const res = await this.partitionManager.createPartition(data);
+    const res = await this.milvusService.client.createPartition(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }
 
 
   async deletePartition(data: DropPartitionReq) {
   async deletePartition(data: DropPartitionReq) {
-    const res = await this.partitionManager.dropPartition(data);
+    const res = await this.milvusService.client.dropPartition(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }
 
 
   async getPartitionStatistics(data: GetPartitionStatisticsReq) {
   async getPartitionStatistics(data: GetPartitionStatisticsReq) {
-    const res = await this.partitionManager.getPartitionStatistics(data);
+    const res = await this.milvusService.client.getPartitionStatistics(data);
     throwErrorFromSDK(res.status);
     throwErrorFromSDK(res.status);
     return res;
     return res;
   }
   }
 
 
   async loadPartitions(data: LoadPartitionsReq) {
   async loadPartitions(data: LoadPartitionsReq) {
-    const res = await this.partitionManager.loadPartitions(data);
+    const res = await this.milvusService.client.loadPartitions(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }
 
 
   async releasePartitions(data: ReleasePartitionsReq) {
   async releasePartitions(data: ReleasePartitionsReq) {
-    const res = await this.partitionManager.releasePartitions(data);
+    const res = await this.milvusService.client.releasePartitions(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }

+ 6 - 10
server/src/schema/schema.service.ts

@@ -4,25 +4,21 @@ import {
   DropIndexReq,
   DropIndexReq,
   GetIndexBuildProgressReq,
   GetIndexBuildProgressReq,
   GetIndexStateReq,
   GetIndexStateReq,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types';
+} from '@zilliz/milvus2-sdk-node';
 import { throwErrorFromSDK } from '../utils/Error';
 import { throwErrorFromSDK } from '../utils/Error';
 import { MilvusService } from '../milvus/milvus.service';
 import { MilvusService } from '../milvus/milvus.service';
 
 
 export class SchemaService {
 export class SchemaService {
   constructor(private milvusService: MilvusService) {}
   constructor(private milvusService: MilvusService) {}
 
 
-  get indexManager() {
-    return this.milvusService.indexManager;
-  }
-
   async createIndex(data: CreateIndexReq) {
   async createIndex(data: CreateIndexReq) {
-    const res = await this.indexManager.createIndex(data);
+    const res = await this.milvusService.client.createIndex(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }
 
 
   async describeIndex(data: DescribeIndexReq) {
   async describeIndex(data: DescribeIndexReq) {
-    const res = await this.indexManager.describeIndex(data);
+    const res = await this.milvusService.client.describeIndex(data);
     if (res.status.error_code === 'IndexNotExist') {
     if (res.status.error_code === 'IndexNotExist') {
       return res;
       return res;
     }
     }
@@ -31,19 +27,19 @@ export class SchemaService {
   }
   }
 
 
   async dropIndex(data: DropIndexReq) {
   async dropIndex(data: DropIndexReq) {
-    const res = await this.indexManager.dropIndex(data);
+    const res = await this.milvusService.client.dropIndex(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }
 
 
   async getIndexState(data: GetIndexStateReq) {
   async getIndexState(data: GetIndexStateReq) {
-    const res = await this.indexManager.getIndexState(data);
+    const res = await this.milvusService.client.getIndexState(data);
     throwErrorFromSDK(res.status);
     throwErrorFromSDK(res.status);
     return res;
     return res;
   }
   }
 
 
   async getIndexBuildProgress(data: GetIndexBuildProgressReq) {
   async getIndexBuildProgress(data: GetIndexBuildProgressReq) {
-    const res = await this.indexManager.getIndexBuildProgress(data);
+    const res = await this.milvusService.client.getIndexBuildProgress(data);
     throwErrorFromSDK(res.status);
     throwErrorFromSDK(res.status);
     return res;
     return res;
   }
   }

+ 5 - 9
server/src/users/users.service.ts

@@ -3,39 +3,35 @@ import {
   CreateUserReq,
   CreateUserReq,
   UpdateUserReq,
   UpdateUserReq,
   DeleteUserReq,
   DeleteUserReq,
-} from '@zilliz/milvus2-sdk-node/dist/milvus/types/User';
+} from '@zilliz/milvus2-sdk-node';
 import { throwErrorFromSDK } from '../utils/Error';
 import { throwErrorFromSDK } from '../utils/Error';
 
 
 export class UserService {
 export class UserService {
   constructor(private milvusService: MilvusService) {}
   constructor(private milvusService: MilvusService) {}
 
 
-  get userManager() {
-    return this.milvusService.userManager;
-  }
-
   async getUsers() {
   async getUsers() {
-    const res = await this.userManager.listUsers();
+    const res = await this.milvusService.client.listUsers();
     throwErrorFromSDK(res.status);
     throwErrorFromSDK(res.status);
 
 
     return res;
     return res;
   }
   }
 
 
   async createUser(data: CreateUserReq) {
   async createUser(data: CreateUserReq) {
-    const res = await this.userManager.createUser(data);
+    const res = await this.milvusService.client.createUser(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
 
 
     return res;
     return res;
   }
   }
 
 
   async updateUser(data: UpdateUserReq) {
   async updateUser(data: UpdateUserReq) {
-    const res = await this.userManager.updateUser(data);
+    const res = await this.milvusService.client.updateUser(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
 
 
     return res;
     return res;
   }
   }
 
 
   async deleteUser(data: DeleteUserReq) {
   async deleteUser(data: DeleteUserReq) {
-    const res = await this.userManager.deleteUser(data);
+    const res = await this.milvusService.client.deleteUser(data);
     throwErrorFromSDK(res);
     throwErrorFromSDK(res);
     return res;
     return res;
   }
   }

+ 26 - 38
server/yarn.lock

@@ -404,29 +404,18 @@
     minimatch "^3.0.4"
     minimatch "^3.0.4"
     plist "^3.0.4"
     plist "^3.0.4"
 
 
-"@grpc/grpc-js@^1.2.12":
-  version "1.4.2"
-  resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.4.2.tgz#273e9b81990b95fb9f3b043847e6861246a491a9"
-  integrity sha512-aUN6oGk9un8rfYWz73nQgFxPCYJQYd8LpIGguZHBsNduBMyqG6EWANrsVBuTG+nl/l4dKb3x+qi1l9+oxDxqGg==
+"@grpc/grpc-js@^1.8.14":
+  version "1.8.14"
+  resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.8.14.tgz#4fe0f9917d6f094cf59245763c275442b182e9ad"
+  integrity sha512-w84maJ6CKl5aApCMzFll0hxtFNT6or9WwMslobKaqWUEf1K+zhlL43bSQhFreyYWIWR+Z0xnVFC1KtLm4ZpM/A==
   dependencies:
   dependencies:
-    "@grpc/proto-loader" "^0.6.4"
+    "@grpc/proto-loader" "^0.7.0"
     "@types/node" ">=12.12.47"
     "@types/node" ">=12.12.47"
 
 
-"@grpc/proto-loader@^0.6.4":
-  version "0.6.6"
-  resolved "https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.6.6.tgz#d8e51ea808ec5fa54d9defbecbf859336fb2da71"
-  integrity sha512-cdMaPZ8AiFz6ua6PUbP+LKbhwJbFXnrQ/mlnKGUyzDUZ3wp7vPLksnmLCBX6SHgSmjX7CbNVNLFYD5GmmjO4GQ==
-  dependencies:
-    "@types/long" "^4.0.1"
-    lodash.camelcase "^4.3.0"
-    long "^4.0.0"
-    protobufjs "^6.10.0"
-    yargs "^16.1.1"
-
-"@grpc/proto-loader@^0.7.3":
-  version "0.7.3"
-  resolved "https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.7.3.tgz#75a6f95b51b85c5078ac7394da93850c32d36bb8"
-  integrity sha512-5dAvoZwna2Py3Ef96Ux9jIkp3iZ62TUsV00p3wVBPNX5K178UbNi8Q7gQVqwXT1Yq9RejIGG9G2IPEo93T6RcA==
+"@grpc/proto-loader@^0.7.0", "@grpc/proto-loader@^0.7.6":
+  version "0.7.6"
+  resolved "https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.7.6.tgz#b71fdf92b184af184b668c4e9395a5ddc23d61de"
+  integrity sha512-QyAXR8Hyh7uMDmveWxDSUcJr9NAWaZ2I6IXgAYvQmfflwouTM+rArE2eEaCtLlRqO81j7pRLCt81IefUei6Zbw==
   dependencies:
   dependencies:
     "@types/long" "^4.0.1"
     "@types/long" "^4.0.1"
     lodash.camelcase "^4.3.0"
     lodash.camelcase "^4.3.0"
@@ -1064,14 +1053,14 @@
   dependencies:
   dependencies:
     "@types/node" "*"
     "@types/node" "*"
 
 
-"@zilliz/milvus2-sdk-node@^2.2.4":
-  version "2.2.4"
-  resolved "https://registry.yarnpkg.com/@zilliz/milvus2-sdk-node/-/milvus2-sdk-node-2.2.4.tgz#617cc97a405c0a56f7ab33ee379022e77b46c291"
-  integrity sha512-1DRZhuWDpjzKo6zYVr8wK4cfhIFMrnDwc+D6sfQR4KxXmYZikTTFxLJBtvzyFw1TgVmXRZ6UUQ3JgerzwOcxQg==
+"@zilliz/milvus2-sdk-node@^2.2.8":
+  version "2.2.8"
+  resolved "https://registry.yarnpkg.com/@zilliz/milvus2-sdk-node/-/milvus2-sdk-node-2.2.8.tgz#d62a0f6072ee4fe3c4f87718e7ac5e81636df043"
+  integrity sha512-7JsDS+ORPtUulOpWO9MFGsiyHaqFmyLDWlGXLV6Dv1KIV/zC2cSt8Cf9wfyys/lKfyv5+JFfugerzlhkLYiz1Q==
   dependencies:
   dependencies:
-    "@grpc/grpc-js" "^1.2.12"
-    "@grpc/proto-loader" "^0.7.3"
-    protobufjs "^7.1.2"
+    "@grpc/grpc-js" "^1.8.14"
+    "@grpc/proto-loader" "^0.7.6"
+    protobufjs "^7.2.3"
 
 
 abab@^2.0.3, abab@^2.0.5:
 abab@^2.0.3, abab@^2.0.5:
   version "2.0.5"
   version "2.0.5"
@@ -4185,10 +4174,10 @@ proto-list@~1.2.1:
   resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"
   resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"
   integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=
   integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=
 
 
-protobufjs@^6.10.0:
-  version "6.11.2"
-  resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.2.tgz#de39fabd4ed32beaa08e9bb1e30d08544c1edf8b"
-  integrity sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw==
+protobufjs@^7.0.0:
+  version "7.1.2"
+  resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.1.2.tgz#a0cf6aeaf82f5625bffcf5a38b7cd2a7de05890c"
+  integrity sha512-4ZPTPkXCdel3+L81yw3dG6+Kq3umdWKh7Dc7GW/CpNk4SX3hK58iPCWeCyhVTDrbkNeKrYNZ7EojM5WDaEWTLQ==
   dependencies:
   dependencies:
     "@protobufjs/aspromise" "^1.1.2"
     "@protobufjs/aspromise" "^1.1.2"
     "@protobufjs/base64" "^1.1.2"
     "@protobufjs/base64" "^1.1.2"
@@ -4200,14 +4189,13 @@ protobufjs@^6.10.0:
     "@protobufjs/path" "^1.1.2"
     "@protobufjs/path" "^1.1.2"
     "@protobufjs/pool" "^1.1.0"
     "@protobufjs/pool" "^1.1.0"
     "@protobufjs/utf8" "^1.1.0"
     "@protobufjs/utf8" "^1.1.0"
-    "@types/long" "^4.0.1"
     "@types/node" ">=13.7.0"
     "@types/node" ">=13.7.0"
-    long "^4.0.0"
+    long "^5.0.0"
 
 
-protobufjs@^7.0.0, protobufjs@^7.1.2:
-  version "7.1.2"
-  resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.1.2.tgz#a0cf6aeaf82f5625bffcf5a38b7cd2a7de05890c"
-  integrity sha512-4ZPTPkXCdel3+L81yw3dG6+Kq3umdWKh7Dc7GW/CpNk4SX3hK58iPCWeCyhVTDrbkNeKrYNZ7EojM5WDaEWTLQ==
+protobufjs@^7.2.3:
+  version "7.2.3"
+  resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.2.3.tgz#01af019e40d9c6133c49acbb3ff9e30f4f0f70b2"
+  integrity sha512-TtpvOqwB5Gdz/PQmOjgsrGH1nHjAQVCN7JG4A6r1sXRWESL5rNMAiRcBQlCAdKxZcAbstExQePYG8xof/JVRgg==
   dependencies:
   dependencies:
     "@protobufjs/aspromise" "^1.1.2"
     "@protobufjs/aspromise" "^1.1.2"
     "@protobufjs/base64" "^1.1.2"
     "@protobufjs/base64" "^1.1.2"
@@ -5301,7 +5289,7 @@ yargs-parser@^21.1.1:
   resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
   resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
   integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==
   integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==
 
 
-yargs@^16.1.1, yargs@^16.2.0:
+yargs@^16.2.0:
   version "16.2.0"
   version "16.2.0"
   resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"
   resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"
   integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==
   integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==