@zilliz/milvus2-sdk-node 2.2.4 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -21
- package/dist/milvus/BaseClient.d.ts +17 -0
- package/dist/milvus/BaseClient.js +58 -0
- package/dist/milvus/BaseClient.js.map +1 -0
- package/dist/milvus/Collection.d.ts +116 -65
- package/dist/milvus/Collection.js +200 -125
- package/dist/milvus/Collection.js.map +1 -1
- package/dist/milvus/Data.d.ts +14 -18
- package/dist/milvus/Data.js +82 -94
- package/dist/milvus/Data.js.map +1 -1
- package/dist/milvus/MilvusClient.d.ts +17 -0
- package/dist/milvus/MilvusClient.js +163 -0
- package/dist/milvus/MilvusClient.js.map +1 -0
- package/dist/milvus/MilvusIndex.d.ts +8 -8
- package/dist/milvus/MilvusIndex.js +19 -20
- package/dist/milvus/MilvusIndex.js.map +1 -1
- package/dist/milvus/Partition.d.ts +10 -10
- package/dist/milvus/Partition.js +27 -29
- package/dist/milvus/Partition.js.map +1 -1
- package/dist/milvus/Resource.d.ts +10 -11
- package/dist/milvus/Resource.js +18 -18
- package/dist/milvus/Resource.js.map +1 -1
- package/dist/milvus/User.d.ts +20 -20
- package/dist/milvus/User.js +45 -47
- package/dist/milvus/User.js.map +1 -1
- package/dist/milvus/Utils.d.ts +1 -1
- package/dist/milvus/Utils.js +1 -1
- package/dist/milvus/Utils.js.map +1 -1
- package/dist/milvus/const/ErrorReason.d.ts +9 -9
- package/dist/milvus/const/ErrorReason.js +9 -9
- package/dist/milvus/const/ErrorReason.js.map +1 -1
- package/dist/milvus/const/Milvus.d.ts +23 -19
- package/dist/milvus/const/Milvus.js +25 -31
- package/dist/milvus/const/Milvus.js.map +1 -1
- package/dist/milvus/index.d.ts +11 -48
- package/dist/milvus/index.js +16 -188
- package/dist/milvus/index.js.map +1 -1
- package/dist/milvus/types/Collection.d.ts +33 -16
- package/dist/milvus/types/Collection.js.map +1 -1
- package/dist/milvus/types/Common.d.ts +1 -1
- package/dist/milvus/types/User.d.ts +3 -3
- package/dist/proto/proto/common.proto +7 -1
- package/dist/proto/proto/feder.proto +40 -0
- package/dist/proto/proto/google/protobuf/descriptor.proto +41 -3
- package/dist/proto/proto/milvus.proto +61 -0
- package/dist/proto/proto/schema.proto +21 -22
- package/dist/sdk.json +1 -1
- package/dist/utils/Blob.js.map +1 -0
- package/dist/{milvus/utils → utils}/Format.d.ts +21 -1
- package/dist/{milvus/utils → utils}/Format.js +48 -11
- package/dist/utils/Format.js.map +1 -0
- package/dist/utils/Function.d.ts +4 -0
- package/dist/utils/Function.js +33 -0
- package/dist/utils/Function.js.map +1 -0
- package/dist/utils/Grpc.d.ts +19 -0
- package/dist/utils/Grpc.js +64 -0
- package/dist/utils/Grpc.js.map +1 -0
- package/dist/{milvus/utils → utils}/Validate.d.ts +1 -1
- package/dist/{milvus/utils → utils}/Validate.js +2 -2
- package/dist/utils/Validate.js.map +1 -0
- package/dist/utils/index.d.ts +5 -1
- package/dist/utils/index.js +19 -24
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/test.d.ts +14 -0
- package/dist/utils/test.js +68 -0
- package/dist/utils/test.js.map +1 -0
- package/package.json +4 -4
- package/dist/milvus/Client.d.ts +0 -4
- package/dist/milvus/Client.js +0 -11
- package/dist/milvus/Client.js.map +0 -1
- package/dist/milvus/utils/Blob.js.map +0 -1
- package/dist/milvus/utils/Format.js.map +0 -1
- package/dist/milvus/utils/Validate.js.map +0 -1
- package/dist/milvus/utils/index.d.ts +0 -3
- package/dist/milvus/utils/index.js +0 -10
- package/dist/milvus/utils/index.js.map +0 -1
- /package/dist/{milvus/utils → utils}/Blob.d.ts +0 -0
- /package/dist/{milvus/utils → utils}/Blob.js +0 -0
|
@@ -12,6 +12,7 @@ option csharp_namespace = "IO.Milvus.Grpc";
|
|
|
12
12
|
|
|
13
13
|
import "common.proto";
|
|
14
14
|
import "schema.proto";
|
|
15
|
+
import "feder.proto";
|
|
15
16
|
import "google/protobuf/descriptor.proto";
|
|
16
17
|
|
|
17
18
|
service MilvusService {
|
|
@@ -39,6 +40,8 @@ service MilvusService {
|
|
|
39
40
|
rpc CreateAlias(CreateAliasRequest) returns (common.Status) {}
|
|
40
41
|
rpc DropAlias(DropAliasRequest) returns (common.Status) {}
|
|
41
42
|
rpc AlterAlias(AlterAliasRequest) returns (common.Status) {}
|
|
43
|
+
rpc DescribeAlias(DescribeAliasRequest) returns (DescribeAliasResponse) {}
|
|
44
|
+
rpc ListAliases(ListAliasesRequest) returns (ListAliasesResponse) {}
|
|
42
45
|
|
|
43
46
|
rpc CreateIndex(CreateIndexRequest) returns (common.Status) {}
|
|
44
47
|
rpc DescribeIndex(DescribeIndexRequest) returns (DescribeIndexResponse) {}
|
|
@@ -55,8 +58,10 @@ service MilvusService {
|
|
|
55
58
|
rpc Flush(FlushRequest) returns (FlushResponse) {}
|
|
56
59
|
rpc Query(QueryRequest) returns (QueryResults) {}
|
|
57
60
|
rpc CalcDistance(CalcDistanceRequest) returns (CalcDistanceResults) {}
|
|
61
|
+
rpc FlushAll(FlushAllRequest) returns (FlushAllResponse) {}
|
|
58
62
|
|
|
59
63
|
rpc GetFlushState(GetFlushStateRequest) returns (GetFlushStateResponse) {}
|
|
64
|
+
rpc GetFlushAllState(GetFlushAllStateRequest) returns (GetFlushAllStateResponse) {}
|
|
60
65
|
rpc GetPersistentSegmentInfo(GetPersistentSegmentInfoRequest) returns (GetPersistentSegmentInfoResponse) {}
|
|
61
66
|
rpc GetQuerySegmentInfo(GetQuerySegmentInfoRequest) returns (GetQuerySegmentInfoResponse) {}
|
|
62
67
|
rpc GetReplicas(GetReplicasRequest) returns (GetReplicasResponse) {}
|
|
@@ -106,6 +111,9 @@ service MilvusService {
|
|
|
106
111
|
rpc DescribeResourceGroup(DescribeResourceGroupRequest) returns (DescribeResourceGroupResponse) {}
|
|
107
112
|
|
|
108
113
|
rpc RenameCollection(RenameCollectionRequest) returns (common.Status) {}
|
|
114
|
+
|
|
115
|
+
rpc ListIndexedSegment(feder.ListIndexedSegmentRequest) returns(feder.ListIndexedSegmentResponse) {}
|
|
116
|
+
rpc DescribeSegmentIndexData(feder.DescribeSegmentIndexDataRequest) returns(feder.DescribeSegmentIndexDataResponse) {}
|
|
109
117
|
}
|
|
110
118
|
|
|
111
119
|
message CreateAliasRequest {
|
|
@@ -128,6 +136,40 @@ message AlterAliasRequest{
|
|
|
128
136
|
string alias = 4;
|
|
129
137
|
}
|
|
130
138
|
|
|
139
|
+
message DescribeAliasRequest{
|
|
140
|
+
common.MsgBase base = 1;
|
|
141
|
+
string db_name = 2;
|
|
142
|
+
string alias = 3;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/*
|
|
146
|
+
* Describe alias response
|
|
147
|
+
*/
|
|
148
|
+
message DescribeAliasResponse {
|
|
149
|
+
// Response status
|
|
150
|
+
common.Status status = 1;
|
|
151
|
+
string db_name = 2;
|
|
152
|
+
string alias = 3;
|
|
153
|
+
string collection = 4;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
message ListAliasesRequest{
|
|
157
|
+
common.MsgBase base = 1;
|
|
158
|
+
string db_name = 2;
|
|
159
|
+
string collection_name = 3;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/*
|
|
163
|
+
* List aliases response
|
|
164
|
+
*/
|
|
165
|
+
message ListAliasesResponse {
|
|
166
|
+
// Response status
|
|
167
|
+
common.Status status = 1;
|
|
168
|
+
string db_name = 2;
|
|
169
|
+
string collection_name = 3;
|
|
170
|
+
repeated string aliases = 4;
|
|
171
|
+
}
|
|
172
|
+
|
|
131
173
|
/**
|
|
132
174
|
* Create collection in milvus
|
|
133
175
|
*/
|
|
@@ -877,6 +919,14 @@ message CalcDistanceResults {
|
|
|
877
919
|
}
|
|
878
920
|
}
|
|
879
921
|
|
|
922
|
+
message FlushAllRequest {
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
message FlushAllResponse {
|
|
926
|
+
common.Status status = 1;
|
|
927
|
+
uint64 flush_all_ts = 2;
|
|
928
|
+
}
|
|
929
|
+
|
|
880
930
|
message PersistentSegmentInfo {
|
|
881
931
|
int64 segmentID = 1;
|
|
882
932
|
int64 collectionID = 2;
|
|
@@ -1033,6 +1083,16 @@ message GetFlushStateResponse {
|
|
|
1033
1083
|
bool flushed = 2;
|
|
1034
1084
|
}
|
|
1035
1085
|
|
|
1086
|
+
message GetFlushAllStateRequest {
|
|
1087
|
+
common.MsgBase base = 1;
|
|
1088
|
+
uint64 flush_all_ts = 2;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
message GetFlushAllStateResponse {
|
|
1092
|
+
common.Status status = 1;
|
|
1093
|
+
bool flushed = 2;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1036
1096
|
message ImportRequest {
|
|
1037
1097
|
option (common.privilege_ext_obj) = {
|
|
1038
1098
|
object_type: Collection
|
|
@@ -1370,6 +1430,7 @@ message GetLoadingProgressRequest {
|
|
|
1370
1430
|
message GetLoadingProgressResponse {
|
|
1371
1431
|
common.Status status = 1;
|
|
1372
1432
|
int64 progress = 2;
|
|
1433
|
+
int64 refresh_progress = 3;
|
|
1373
1434
|
}
|
|
1374
1435
|
|
|
1375
1436
|
message GetLoadStateRequest {
|
|
@@ -28,6 +28,8 @@ enum DataType {
|
|
|
28
28
|
|
|
29
29
|
String = 20;
|
|
30
30
|
VarChar = 21; // variable-length strings with a specified maximum length
|
|
31
|
+
Array = 22;
|
|
32
|
+
JSON = 23;
|
|
31
33
|
|
|
32
34
|
BinaryVector = 100;
|
|
33
35
|
FloatVector = 101;
|
|
@@ -52,7 +54,10 @@ message FieldSchema {
|
|
|
52
54
|
repeated common.KeyValuePair type_params = 6;
|
|
53
55
|
repeated common.KeyValuePair index_params = 7;
|
|
54
56
|
bool autoID = 8;
|
|
55
|
-
FieldState state = 9; // To keep compatible with older version, the default
|
|
57
|
+
FieldState state = 9; // To keep compatible with older version, the default
|
|
58
|
+
// state is `Created`.
|
|
59
|
+
DataType element_type = 10; // For array type, the element type is stored here
|
|
60
|
+
ScalarField default_value = 11; // default_value only support scalars for now
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
/**
|
|
@@ -65,35 +70,28 @@ message CollectionSchema {
|
|
|
65
70
|
repeated FieldSchema fields = 4;
|
|
66
71
|
}
|
|
67
72
|
|
|
68
|
-
message BoolArray {
|
|
69
|
-
repeated bool data = 1;
|
|
70
|
-
}
|
|
73
|
+
message BoolArray { repeated bool data = 1; }
|
|
71
74
|
|
|
72
|
-
message IntArray {
|
|
73
|
-
repeated int32 data = 1;
|
|
74
|
-
}
|
|
75
|
+
message IntArray { repeated int32 data = 1; }
|
|
75
76
|
|
|
76
|
-
message LongArray {
|
|
77
|
-
repeated int64 data = 1;
|
|
78
|
-
}
|
|
77
|
+
message LongArray { repeated int64 data = 1; }
|
|
79
78
|
|
|
80
|
-
message FloatArray {
|
|
81
|
-
repeated float data = 1;
|
|
82
|
-
}
|
|
79
|
+
message FloatArray { repeated float data = 1; }
|
|
83
80
|
|
|
84
|
-
message DoubleArray {
|
|
85
|
-
repeated double data = 1;
|
|
86
|
-
}
|
|
81
|
+
message DoubleArray { repeated double data = 1; }
|
|
87
82
|
|
|
88
83
|
// For special fields such as bigdecimal, array...
|
|
89
|
-
message BytesArray {
|
|
90
|
-
|
|
91
|
-
}
|
|
84
|
+
message BytesArray { repeated bytes data = 1; }
|
|
85
|
+
|
|
86
|
+
message StringArray { repeated string data = 1; }
|
|
92
87
|
|
|
93
|
-
message
|
|
94
|
-
repeated
|
|
88
|
+
message ArrayArray {
|
|
89
|
+
repeated ScalarField data = 1;
|
|
90
|
+
DataType element_type = 2;
|
|
95
91
|
}
|
|
96
92
|
|
|
93
|
+
message JSONArray { repeated bytes data = 1; }
|
|
94
|
+
|
|
97
95
|
message ScalarField {
|
|
98
96
|
oneof data {
|
|
99
97
|
BoolArray bool_data = 1;
|
|
@@ -103,6 +101,8 @@ message ScalarField {
|
|
|
103
101
|
DoubleArray double_data = 5;
|
|
104
102
|
StringArray string_data = 6;
|
|
105
103
|
BytesArray bytes_data = 7;
|
|
104
|
+
ArrayArray array_data = 8;
|
|
105
|
+
JSONArray json_data = 9;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -139,4 +139,3 @@ message SearchResultData {
|
|
|
139
139
|
IDs ids = 5;
|
|
140
140
|
repeated int64 topks = 6;
|
|
141
141
|
}
|
|
142
|
-
|
package/dist/sdk.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.2.
|
|
1
|
+
{"version":"2.2.6","milvusVersion":"v2.2.5"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Blob.js","sourceRoot":"","sources":["../../utils/Blob.ts"],"names":[],"mappings":";;;AAAO,IAAM,uBAAuB,GAAG,UAAC,KAAe;IACrD,sBAAsB;IACtB,IAAM,CAAC,GAAG,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;IAClC,oCAAoC;IACpC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AALW,QAAA,uBAAuB,2BAKlC;AAEK,IAAM,wBAAwB,GAAG,UAAC,KAAe;IACtD,sBAAsB;IACtB,IAAM,CAAC,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IAChC,oCAAoC;IACpC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AALW,QAAA,wBAAwB,4BAKnC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KeyValuePair } from '../
|
|
1
|
+
import { KeyValuePair, FieldType } from '../milvus';
|
|
2
2
|
/**
|
|
3
3
|
* parse [{key:"row_count",value:4}] to {row_count:4}
|
|
4
4
|
* @param data key value pair array
|
|
@@ -23,6 +23,7 @@ export declare const parseToKeyValue: (data?: {
|
|
|
23
23
|
* @returns
|
|
24
24
|
*/
|
|
25
25
|
export declare const formatNumberPrecision: (number: number, precision: number) => number;
|
|
26
|
+
export declare const checkTimeParam: (ts: any) => boolean;
|
|
26
27
|
/**
|
|
27
28
|
* Convert a hybrid timestamp to UNIX Epoch time ignoring the logic part.
|
|
28
29
|
*
|
|
@@ -92,5 +93,24 @@ export declare const unixtimeToHybridts: (unixtime: bigint | string) => string;
|
|
|
92
93
|
* ```
|
|
93
94
|
*/
|
|
94
95
|
export declare const datetimeToHybrids: (datetime: Date) => string;
|
|
96
|
+
/**
|
|
97
|
+
* Converts a string to base64 encoding.
|
|
98
|
+
* @param str The string to convert.
|
|
99
|
+
* @returns The base64 encoded string.
|
|
100
|
+
*/
|
|
95
101
|
export declare const stringToBase64: (str: string) => string;
|
|
102
|
+
/**
|
|
103
|
+
* Formats the given address by removing the http or https prefix and appending the default Milvus port if necessary.
|
|
104
|
+
* @param address The address to format.
|
|
105
|
+
* @returns The formatted address.
|
|
106
|
+
*/
|
|
96
107
|
export declare const formatAddress: (address: string) => string;
|
|
108
|
+
/**
|
|
109
|
+
* Assigns properties with keys `dim` or `max_length` to the `type_params` object of a `FieldType` object.
|
|
110
|
+
* If the property exists in the `field` object, it is converted to a string and then deleted from the `field` object.
|
|
111
|
+
* If the property already exists in the `type_params` object, it is also converted to a string.
|
|
112
|
+
*
|
|
113
|
+
* @param field The `FieldType` object to modify.
|
|
114
|
+
* @returns The modified `FieldType` object.
|
|
115
|
+
*/
|
|
116
|
+
export declare const assignTypeParams: (field: FieldType, typeParamKeys?: string[]) => any;
|
|
@@ -9,10 +9,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
9
9
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.formatAddress = exports.stringToBase64 = exports.datetimeToHybrids = exports.unixtimeToHybridts = exports.hybridtsToUnixtime = exports.formatNumberPrecision = exports.parseToKeyValue = exports.formatKeyValueData = void 0;
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var ErrorReason_1 = require("../const/ErrorReason");
|
|
12
|
+
exports.assignTypeParams = exports.formatAddress = exports.stringToBase64 = exports.datetimeToHybrids = exports.unixtimeToHybridts = exports.hybridtsToUnixtime = exports.checkTimeParam = exports.formatNumberPrecision = exports.parseToKeyValue = exports.formatKeyValueData = void 0;
|
|
13
|
+
var _1 = require("./");
|
|
14
|
+
var milvus_1 = require("../milvus");
|
|
16
15
|
/**
|
|
17
16
|
* parse [{key:"row_count",value:4}] to {row_count:4}
|
|
18
17
|
* @param data key value pair array
|
|
@@ -22,7 +21,7 @@ var ErrorReason_1 = require("../const/ErrorReason");
|
|
|
22
21
|
var formatKeyValueData = function (data, keys) {
|
|
23
22
|
var result = {};
|
|
24
23
|
keys.forEach(function (k) {
|
|
25
|
-
var value = (0,
|
|
24
|
+
var value = (0, _1.findKeyValue)(data, k);
|
|
26
25
|
result[k] = value;
|
|
27
26
|
});
|
|
28
27
|
return result;
|
|
@@ -70,6 +69,7 @@ var checkTimeParam = function (ts) {
|
|
|
70
69
|
return false;
|
|
71
70
|
}
|
|
72
71
|
};
|
|
72
|
+
exports.checkTimeParam = checkTimeParam;
|
|
73
73
|
/**
|
|
74
74
|
* Convert a hybrid timestamp to UNIX Epoch time ignoring the logic part.
|
|
75
75
|
*
|
|
@@ -93,8 +93,8 @@ var checkTimeParam = function (ts) {
|
|
|
93
93
|
* ```
|
|
94
94
|
*/
|
|
95
95
|
var hybridtsToUnixtime = function (hybridts) {
|
|
96
|
-
if (!checkTimeParam(hybridts)) {
|
|
97
|
-
throw new Error("hybridts ".concat(
|
|
96
|
+
if (!(0, exports.checkTimeParam)(hybridts)) {
|
|
97
|
+
throw new Error("hybridts ".concat(milvus_1.ERROR_REASONS.TIMESTAMP_PARAM_CHECK));
|
|
98
98
|
}
|
|
99
99
|
var timestamp = typeof hybridts === 'bigint' ? hybridts : BigInt(hybridts);
|
|
100
100
|
var physical = timestamp >> LOGICAL_BITS;
|
|
@@ -124,8 +124,8 @@ exports.hybridtsToUnixtime = hybridtsToUnixtime;
|
|
|
124
124
|
* ```
|
|
125
125
|
*/
|
|
126
126
|
var unixtimeToHybridts = function (unixtime) {
|
|
127
|
-
if (!checkTimeParam(unixtime)) {
|
|
128
|
-
throw new Error("hybridts ".concat(
|
|
127
|
+
if (!(0, exports.checkTimeParam)(unixtime)) {
|
|
128
|
+
throw new Error("hybridts ".concat(milvus_1.ERROR_REASONS.TIMESTAMP_PARAM_CHECK));
|
|
129
129
|
}
|
|
130
130
|
var timestamp = typeof unixtime === 'bigint' ? unixtime : BigInt(unixtime);
|
|
131
131
|
var physical = (timestamp * BigInt(1000)) << LOGICAL_BITS;
|
|
@@ -156,19 +156,56 @@ exports.unixtimeToHybridts = unixtimeToHybridts;
|
|
|
156
156
|
*/
|
|
157
157
|
var datetimeToHybrids = function (datetime) {
|
|
158
158
|
if (!(datetime instanceof Date)) {
|
|
159
|
-
throw new Error("hybridts ".concat(
|
|
159
|
+
throw new Error("hybridts ".concat(milvus_1.ERROR_REASONS.DATE_TYPE_CHECK));
|
|
160
160
|
}
|
|
161
161
|
return (0, exports.unixtimeToHybridts)((datetime.getTime() / 1000).toString());
|
|
162
162
|
};
|
|
163
163
|
exports.datetimeToHybrids = datetimeToHybrids;
|
|
164
|
+
/**
|
|
165
|
+
* Converts a string to base64 encoding.
|
|
166
|
+
* @param str The string to convert.
|
|
167
|
+
* @returns The base64 encoded string.
|
|
168
|
+
*/
|
|
164
169
|
var stringToBase64 = function (str) {
|
|
165
170
|
return Buffer.from(str, 'utf-8').toString('base64');
|
|
166
171
|
};
|
|
167
172
|
exports.stringToBase64 = stringToBase64;
|
|
173
|
+
/**
|
|
174
|
+
* Formats the given address by removing the http or https prefix and appending the default Milvus port if necessary.
|
|
175
|
+
* @param address The address to format.
|
|
176
|
+
* @returns The formatted address.
|
|
177
|
+
*/
|
|
168
178
|
var formatAddress = function (address) {
|
|
169
179
|
// remove http or https prefix from address
|
|
170
180
|
var ip = address.replace(/(http|https)*:\/\//, '');
|
|
171
|
-
return ip.includes(':') ? ip : "".concat(ip, ":").concat(
|
|
181
|
+
return ip.includes(':') ? ip : "".concat(ip, ":").concat(milvus_1.DEFAULT_MILVUS_PORT);
|
|
172
182
|
};
|
|
173
183
|
exports.formatAddress = formatAddress;
|
|
184
|
+
/**
|
|
185
|
+
* Assigns properties with keys `dim` or `max_length` to the `type_params` object of a `FieldType` object.
|
|
186
|
+
* If the property exists in the `field` object, it is converted to a string and then deleted from the `field` object.
|
|
187
|
+
* If the property already exists in the `type_params` object, it is also converted to a string.
|
|
188
|
+
*
|
|
189
|
+
* @param field The `FieldType` object to modify.
|
|
190
|
+
* @returns The modified `FieldType` object.
|
|
191
|
+
*/
|
|
192
|
+
var assignTypeParams = function (field, typeParamKeys) {
|
|
193
|
+
if (typeParamKeys === void 0) { typeParamKeys = ['dim', 'max_length']; }
|
|
194
|
+
var newField = JSON.parse(JSON.stringify(field));
|
|
195
|
+
typeParamKeys.forEach(function (key) {
|
|
196
|
+
if (newField.hasOwnProperty(key)) {
|
|
197
|
+
// if the property exists in the field object, assign it to the type_params object
|
|
198
|
+
newField.type_params = newField.type_params || {};
|
|
199
|
+
newField.type_params[key] = String(newField[key]);
|
|
200
|
+
// delete the property from the field object
|
|
201
|
+
delete newField[key];
|
|
202
|
+
}
|
|
203
|
+
if (newField.type_params && newField.type_params[key]) {
|
|
204
|
+
// if the property already exists in the type_params object, convert it to a string
|
|
205
|
+
newField.type_params[key] = String(newField.type_params[key]);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
return newField;
|
|
209
|
+
};
|
|
210
|
+
exports.assignTypeParams = assignTypeParams;
|
|
174
211
|
//# sourceMappingURL=Format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Format.js","sourceRoot":"","sources":["../../utils/Format.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uBAAkC;AACl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AC;IACjD,aAAa,CAAC,OAAO,CAAC,UAAA,GAAG;QACvB,IAAI,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;YAChC,kFAAkF;YAClF,QAAQ,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,IAAI,EAAE,CAAC;YAClD,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YAClD,4CAA4C;YAC5C,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;SACtB;QAED,IAAI,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE;YACrD,mFAAmF;YACnF,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;SAC/D;IACH,CAAC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AApBW,QAAA,gBAAgB,oBAoB3B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { KeyValuePair } from '../milvus/types/Common';
|
|
2
|
+
export declare function promisify(obj: any, target: string, params: any, timeout?: number): Promise<any>;
|
|
3
|
+
export declare const findKeyValue: (obj: KeyValuePair[], key: string) => string | number | undefined;
|
|
4
|
+
export declare const sleep: (time: number) => Promise<unknown>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sleep = exports.findKeyValue = exports.promisify = void 0;
|
|
4
|
+
var Milvus_1 = require("../milvus/const/Milvus");
|
|
5
|
+
function promisify(obj, target, params, timeout) {
|
|
6
|
+
var deadline = timeout
|
|
7
|
+
? new Date(Date.now() + timeout)
|
|
8
|
+
: new Date(Date.now() + Milvus_1.DEFAULT_CONNECT_TIMEOUT);
|
|
9
|
+
var res = new Promise(function (resolve, reject) {
|
|
10
|
+
try {
|
|
11
|
+
obj[target](params, { deadline: deadline }, function (err, result) {
|
|
12
|
+
if (err) {
|
|
13
|
+
reject(err);
|
|
14
|
+
}
|
|
15
|
+
resolve(result);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
throw new Error(e);
|
|
20
|
+
}
|
|
21
|
+
}).catch(function (err) {
|
|
22
|
+
throw new Error(err);
|
|
23
|
+
});
|
|
24
|
+
return res;
|
|
25
|
+
}
|
|
26
|
+
exports.promisify = promisify;
|
|
27
|
+
var findKeyValue = function (obj, key) { var _a; return (_a = obj.find(function (v) { return v.key === key; })) === null || _a === void 0 ? void 0 : _a.value; };
|
|
28
|
+
exports.findKeyValue = findKeyValue;
|
|
29
|
+
var sleep = function (time) {
|
|
30
|
+
return new Promise(function (resolve) { return setTimeout(resolve, time); });
|
|
31
|
+
};
|
|
32
|
+
exports.sleep = sleep;
|
|
33
|
+
//# sourceMappingURL=Function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Function.js","sourceRoot":"","sources":["../../utils/Function.ts"],"names":[],"mappings":";;;AAAA,iDAAiE;AAGjE,SAAgB,SAAS,CACvB,GAAQ,EACR,MAAc,EACd,MAAW,EACX,OAAgB;IAEhB,IAAM,QAAQ,GAAG,OAAO;QACtB,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC;QAChC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,gCAAuB,CAAC,CAAC;IAEnD,IAAM,GAAG,GAAG,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QACtC,IAAI;YACF,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,QAAQ,UAAA,EAAE,EAAE,UAAC,GAAQ,EAAE,MAAW;gBACtD,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC,CAAC;iBACb;gBACD,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;SACJ;QAAC,OAAO,CAAM,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;SACpB;IACH,CAAC,CAAC,CAAC,KAAK,CAAC,UAAA,GAAG;QACV,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC;AA1BD,8BA0BC;AAEM,IAAM,YAAY,GAAG,UAAC,GAAmB,EAAE,GAAW,YAC3D,OAAA,MAAA,GAAG,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,GAAG,KAAK,GAAG,EAAb,CAAa,CAAC,0CAAE,KAAK,CAAA,EAAA,CAAC;AADzB,QAAA,YAAY,gBACa;AAE/B,IAAM,KAAK,GAAG,UAAC,IAAY;IAChC,OAAO,IAAI,OAAO,CAAC,UAAA,OAAO,IAAI,OAAA,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,EAAzB,CAAyB,CAAC,CAAC;AAC3D,CAAC,CAAC;AAFW,QAAA,KAAK,SAEhB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ServiceClientConstructor, InterceptingCall } from '@grpc/grpc-js';
|
|
2
|
+
interface IServiceDetails {
|
|
3
|
+
protoPath: string;
|
|
4
|
+
serviceName: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Returns a gRPC service client constructor for the given proto file and service name.
|
|
8
|
+
* @param proto An object containing the proto file path and service name.
|
|
9
|
+
* @returns A gRPC service client constructor.
|
|
10
|
+
*/
|
|
11
|
+
export declare const getGRPCService: (proto: IServiceDetails) => ServiceClientConstructor;
|
|
12
|
+
/**
|
|
13
|
+
* Returns an interceptor function that adds an authorization header to the metadata of a gRPC call.
|
|
14
|
+
* @param username - The username to use for authentication.
|
|
15
|
+
* @param password - The password to use for authentication.
|
|
16
|
+
* @returns An interceptor function.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getAuthInterceptor: (username: string, password: string) => (options: any, nextCall: any) => InterceptingCall;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getAuthInterceptor = exports.getGRPCService = void 0;
|
|
7
|
+
var path_1 = __importDefault(require("path"));
|
|
8
|
+
var proto_loader_1 = require("@grpc/proto-loader");
|
|
9
|
+
var grpc_js_1 = require("@grpc/grpc-js");
|
|
10
|
+
var PROTO_OPTIONS = {
|
|
11
|
+
keepCase: true,
|
|
12
|
+
longs: String,
|
|
13
|
+
enums: String,
|
|
14
|
+
defaults: true,
|
|
15
|
+
oneofs: true,
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Returns a gRPC service client constructor for the given proto file and service name.
|
|
19
|
+
* @param proto An object containing the proto file path and service name.
|
|
20
|
+
* @returns A gRPC service client constructor.
|
|
21
|
+
*/
|
|
22
|
+
var getGRPCService = function (proto) {
|
|
23
|
+
// Resolve the proto file path.
|
|
24
|
+
var PROTO_PATH = path_1.default.resolve(__dirname, proto.protoPath);
|
|
25
|
+
// Load the proto file.
|
|
26
|
+
var packageDefinition = (0, proto_loader_1.loadSync)(PROTO_PATH, PROTO_OPTIONS);
|
|
27
|
+
// Load the gRPC object.
|
|
28
|
+
var grpcObj = (0, grpc_js_1.loadPackageDefinition)(packageDefinition);
|
|
29
|
+
// Get the service object from the gRPC object.
|
|
30
|
+
var service = proto.serviceName
|
|
31
|
+
.split('.')
|
|
32
|
+
.reduce(function (a, b) { return a[b]; }, grpcObj);
|
|
33
|
+
// Check that the service object is valid.
|
|
34
|
+
if ((service === null || service === void 0 ? void 0 : service.name) !== 'ServiceClientImpl') {
|
|
35
|
+
throw new Error("Unable to load service: ".concat(proto.serviceName, " from ").concat(proto.protoPath));
|
|
36
|
+
}
|
|
37
|
+
// Return the service client constructor.
|
|
38
|
+
return service;
|
|
39
|
+
};
|
|
40
|
+
exports.getGRPCService = getGRPCService;
|
|
41
|
+
/**
|
|
42
|
+
* Returns an interceptor function that adds an authorization header to the metadata of a gRPC call.
|
|
43
|
+
* @param username - The username to use for authentication.
|
|
44
|
+
* @param password - The password to use for authentication.
|
|
45
|
+
* @returns An interceptor function.
|
|
46
|
+
*/
|
|
47
|
+
var getAuthInterceptor = function (username, password) {
|
|
48
|
+
return function (options, nextCall) {
|
|
49
|
+
// Create a new InterceptingCall object with nextCall(options) as its first parameter.
|
|
50
|
+
return new grpc_js_1.InterceptingCall(nextCall(options), {
|
|
51
|
+
// Define the start method of the InterceptingCall object.
|
|
52
|
+
start: function (metadata, listener, next) {
|
|
53
|
+
// Encode the username and password as a base64 string.
|
|
54
|
+
var auth = Buffer.from("".concat(username, ":").concat(password), 'utf-8').toString('base64');
|
|
55
|
+
// Add the authorization header to the metadata object with the key 'authorization'.
|
|
56
|
+
metadata.add('authorization', auth);
|
|
57
|
+
// Call next(metadata, listener) to continue the call with the modified metadata.
|
|
58
|
+
next(metadata, listener);
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
exports.getAuthInterceptor = getAuthInterceptor;
|
|
64
|
+
//# sourceMappingURL=Grpc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grpc.js","sourceRoot":"","sources":["../../utils/Grpc.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAwB;AACxB,mDAA8C;AAC9C,yCAKuB;AAEvB,IAAM,aAAa,GAAG;IACpB,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;CACb,C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CAAC;gBACF,oFAAoF;gBACpF,QAAQ,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;gBAEpC,iFAAiF;gBACjF,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC3B,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AAhBD,CAgBC,CAAC;AAjBS,QAAA,kBAAkB,sBAiB3B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkCollectionAndPartitionName = exports.checkCollectionName = exports.checkCollectionFields = void 0;
|
|
4
|
-
var ErrorReason_1 = require("../const/ErrorReason");
|
|
5
|
-
var Milvus_1 = require("../const/Milvus");
|
|
4
|
+
var ErrorReason_1 = require("../milvus/const/ErrorReason");
|
|
5
|
+
var Milvus_1 = require("../milvus/const/Milvus");
|
|
6
6
|
/**
|
|
7
7
|
* when create collection, field must contain 2 Fields.
|
|
8
8
|
* Type is int64 or varchar and primary_key = true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Validate.js","sourceRoot":"","sources":["../../utils/Validate.ts"],"names":[],"mappings":";;;AAAA,2DAA4D;AAE5D,iDAAkD;AAElD;;;;;;GAMG;AACI,IAAM,qBAAqB,GAAG,UAAC,MAAmB;IACvD,IAAM,WAAW,GAAG,CAAC,iBAAQ,CAAC,YAAY,EAAE,iBAAQ,CAAC,WAAW,CAAC,CAAC;IAClE,sDAAsD;IACtD,IAAM,YAAY,GAAG,CAAC,iBAAQ,CAAC,KAAK,EAAE,iBAAQ,CAAC,OAAO,CAAC,CAAC;IACxD,IACE,CAAC,MAAM,CAAC,IAAI,CACV,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,SAAS,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,cAAc,EAArE,CAAqE,CAC3E,EACD;QACA,MAAM,IAAI,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BAA+B,GAAG,UAAC,IAAS;IACvD,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;QAC1D,MAAM,IAAI,KAAK,CAAC,2BAAa,CAAC,sCAAsC,CAAC,CAAC;KACvE;AACH,CAAC,CAAC;AAJW,QAAA,+BAA+B,mCAI1C"}
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
: new Date(Date.now() + Milvus_1.DEFAULT_CONNECT_TIMEOUT);
|
|
9
|
-
var res = new Promise(function (resolve, reject) {
|
|
10
|
-
try {
|
|
11
|
-
obj[target](params, { deadline: deadline }, function (err, result) {
|
|
12
|
-
if (err) {
|
|
13
|
-
reject(err);
|
|
14
|
-
}
|
|
15
|
-
resolve(result);
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
catch (e) {
|
|
19
|
-
throw new Error(e);
|
|
20
|
-
}
|
|
21
|
-
}).catch(function (err) {
|
|
22
|
-
throw new Error(err);
|
|
23
|
-
});
|
|
24
|
-
return res;
|
|
25
|
-
}
|
|
26
|
-
exports.promisify = promisify;
|
|
17
|
+
__exportStar(require("./Grpc"), exports);
|
|
18
|
+
__exportStar(require("./Blob"), exports);
|
|
19
|
+
__exportStar(require("./Format"), exports);
|
|
20
|
+
__exportStar(require("./Validate"), exports);
|
|
21
|
+
__exportStar(require("./Function"), exports);
|
|
27
22
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,yCAAuB;AACvB,2CAAyB;AACzB,6CAA2B;AAC3B,6CAA2B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DataType } from '../milvus/const/Milvus';
|
|
2
|
+
export declare const VECTOR_FIELD_NAME = "vector_field";
|
|
3
|
+
export declare const INDEX_NAME = "index_name";
|
|
4
|
+
export declare const genCollectionParams: (collectionName: string, dim: string | number, vectorType?: DataType.FloatVector | DataType.BinaryVector, autoID?: boolean, fields?: any[]) => {
|
|
5
|
+
collection_name: string;
|
|
6
|
+
fields: any[];
|
|
7
|
+
};
|
|
8
|
+
export declare const GENERATE_NAME: (pre?: string) => string;
|
|
9
|
+
export declare function generateInsertData(fields: {
|
|
10
|
+
isVector: boolean;
|
|
11
|
+
dim?: number;
|
|
12
|
+
name: string;
|
|
13
|
+
isBool?: boolean;
|
|
14
|
+
}[], count: number): any;
|