@zilliz/milvus2-sdk-node 2.2.3 → 2.2.5
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 +263 -171
- package/dist/milvus/Collection.js +328 -233
- package/dist/milvus/Collection.js.map +1 -1
- package/dist/milvus/Data.d.ts +142 -142
- package/dist/milvus/Data.js +211 -216
- 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 +64 -60
- package/dist/milvus/MilvusIndex.js +74 -69
- package/dist/milvus/MilvusIndex.js.map +1 -1
- package/dist/milvus/Partition.d.ts +95 -88
- package/dist/milvus/Partition.js +108 -101
- package/dist/milvus/Partition.js.map +1 -1
- package/dist/milvus/Resource.d.ts +172 -0
- package/dist/milvus/Resource.js +356 -0
- package/dist/milvus/Resource.js.map +1 -0
- package/dist/milvus/User.d.ts +136 -110
- package/dist/milvus/User.js +171 -140
- 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/Milvus.d.ts +270 -0
- package/dist/milvus/const/Milvus.js +370 -1
- package/dist/milvus/const/Milvus.js.map +1 -1
- package/dist/milvus/index.d.ts +11 -46
- package/dist/milvus/index.js +16 -186
- package/dist/milvus/index.js.map +1 -1
- package/dist/milvus/types/Collection.d.ts +88 -8
- package/dist/milvus/types/Collection.js +1 -9
- package/dist/milvus/types/Collection.js.map +1 -1
- package/dist/milvus/types/Common.d.ts +11 -267
- package/dist/milvus/types/Common.js +1 -369
- package/dist/milvus/types/Common.js.map +1 -1
- package/dist/milvus/types/Data.d.ts +154 -1
- package/dist/milvus/types/Index.d.ts +20 -1
- package/dist/milvus/types/Partition.d.ts +8 -1
- package/dist/milvus/types/Resource.d.ts +44 -0
- package/dist/milvus/types/{Search.js → Resource.js} +1 -1
- package/dist/milvus/types/Resource.js.map +1 -0
- package/dist/milvus/types/Response.d.ts +0 -246
- package/dist/milvus/types/Response.js.map +1 -1
- package/dist/milvus/types/User.d.ts +54 -2
- package/dist/milvus/types.d.ts +8 -7
- package/dist/milvus/types.js +2 -1
- package/dist/milvus/types.js.map +1 -1
- package/dist/proto/proto/common.proto +23 -2
- package/dist/proto/proto/feder.proto +40 -0
- package/dist/proto/proto/google/protobuf/descriptor.proto +31 -1
- package/dist/proto/proto/milvus.proto +101 -0
- package/dist/proto/proto/msg.proto +107 -0
- package/dist/proto/proto/schema.proto +18 -23
- package/dist/sdk.json +1 -1
- package/dist/utils/Blob.js.map +1 -0
- package/dist/{milvus/utils → utils}/Format.d.ts +12 -11
- package/dist/{milvus/utils → utils}/Format.js +18 -17
- 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/utils/Validate.d.ts +21 -0
- package/dist/{milvus/utils → utils}/Validate.js +28 -6
- package/dist/utils/Validate.js.map +1 -0
- package/dist/utils/index.d.ts +5 -7
- package/dist/utils/index.js +17 -52
- 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 +7 -12
- package/dist/milvus/Client.d.ts +0 -12
- package/dist/milvus/Client.js +0 -28
- package/dist/milvus/Client.js.map +0 -1
- package/dist/milvus/types/Search.d.ts +0 -81
- package/dist/milvus/types/Search.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.d.ts +0 -9
- 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
package/dist/milvus/Data.js
CHANGED
|
@@ -40,7 +40,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
40
40
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
41
|
function step(op) {
|
|
42
42
|
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
-
while (_) try {
|
|
43
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
44
44
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
45
45
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
46
|
switch (op[0]) {
|
|
@@ -70,56 +70,44 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
70
70
|
}
|
|
71
71
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
72
72
|
};
|
|
73
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
74
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
75
|
-
};
|
|
76
73
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
74
|
exports.Data = void 0;
|
|
78
|
-
var protobufjs_1 = __importDefault(require("protobufjs"));
|
|
79
75
|
var utils_1 = require("../utils");
|
|
80
|
-
var
|
|
81
|
-
var
|
|
82
|
-
var Common_1 = require("./types/Common");
|
|
83
|
-
var Response_1 = require("./types/Response");
|
|
84
|
-
var index_1 = require("./utils/index");
|
|
85
|
-
var Blob_1 = require("./utils/Blob");
|
|
86
|
-
var path_1 = __importDefault(require("path"));
|
|
87
|
-
var Format_1 = require("./utils/Format");
|
|
88
|
-
var protoPath = path_1.default.resolve(__dirname, '../proto/proto/milvus.proto');
|
|
76
|
+
var _1 = require(".");
|
|
77
|
+
var Collection_1 = require("./Collection");
|
|
89
78
|
var Data = /** @class */ (function (_super) {
|
|
90
79
|
__extends(Data, _super);
|
|
91
|
-
function Data(
|
|
92
|
-
var _this = _super.
|
|
93
|
-
_this.vectorTypes = [
|
|
94
|
-
_this.collectionManager = collectionManager;
|
|
95
|
-
_this._protoRoot = protobufjs_1.default.loadSync(protoPath);
|
|
80
|
+
function Data() {
|
|
81
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
82
|
+
_this.vectorTypes = [_1.DataType.BinaryVector, _1.DataType.FloatVector];
|
|
96
83
|
return _this;
|
|
97
84
|
}
|
|
98
85
|
/**
|
|
99
86
|
* Insert data into Milvus.
|
|
100
87
|
*
|
|
101
88
|
* @param data
|
|
102
|
-
* | Property
|
|
103
|
-
* |
|
|
104
|
-
* | collection_name
|
|
105
|
-
* | partition_name(optional)| String
|
|
106
|
-
* | fields_data
|
|
107
|
-
* | hash_keys(optional)
|
|
108
|
-
* | timeout
|
|
109
|
-
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* |
|
|
114
|
-
* |
|
|
115
|
-
* |
|
|
116
|
-
* |
|
|
89
|
+
* | Property | Type | Description |
|
|
90
|
+
* | :--- | :-- | :-- |
|
|
91
|
+
* | collection_name | String | Collection name |
|
|
92
|
+
* | partition_name(optional)| String | Partition name |
|
|
93
|
+
* | fields_data | { [x: string]: any }[] | If the field type is binary, the vector data length needs to be dimension / 8 |
|
|
94
|
+
* | hash_keys(optional) | Number[] | The hash value depends on the primarykey value |
|
|
95
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
96
|
+
|
|
97
|
+
*
|
|
98
|
+
* @returns
|
|
99
|
+
* | Property | Description |
|
|
100
|
+
* | :-- | :-- |
|
|
101
|
+
* | status | { error_code: number, reason: string } |
|
|
102
|
+
* | succ_index | Index array of the successfully inserted data |
|
|
103
|
+
* | err_index | Index array of the unsuccessfully inserted data |
|
|
104
|
+
* | IDs | ID array of the successfully inserted data |
|
|
117
105
|
*
|
|
118
106
|
*
|
|
119
107
|
* #### Example
|
|
120
108
|
*
|
|
121
109
|
* ```
|
|
122
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
110
|
+
* new milvusClient(MILUVS_ADDRESS).insert({
|
|
123
111
|
* collection_name: COLLECTION_NAME,
|
|
124
112
|
* fields_data: [{
|
|
125
113
|
* vector_field: [1,2,2,4],
|
|
@@ -135,19 +123,19 @@ var Data = /** @class */ (function (_super) {
|
|
|
135
123
|
return __generator(this, function (_a) {
|
|
136
124
|
switch (_a.label) {
|
|
137
125
|
case 0:
|
|
138
|
-
|
|
126
|
+
(0, utils_1.checkCollectionName)(data);
|
|
139
127
|
if (!data.fields_data ||
|
|
140
128
|
!Array.isArray(data.fields_data) ||
|
|
141
129
|
!data.fields_data.length) {
|
|
142
|
-
throw new Error(
|
|
130
|
+
throw new Error(_1.ERROR_REASONS.INSERT_CHECK_FILEDS_DATA_IS_REQUIRED);
|
|
143
131
|
}
|
|
144
132
|
collection_name = data.collection_name;
|
|
145
|
-
return [4 /*yield*/, this.
|
|
133
|
+
return [4 /*yield*/, this.describeCollection({
|
|
146
134
|
collection_name: collection_name,
|
|
147
135
|
})];
|
|
148
136
|
case 1:
|
|
149
137
|
collectionInfo = _a.sent();
|
|
150
|
-
if (collectionInfo.status.error_code !==
|
|
138
|
+
if (collectionInfo.status.error_code !== _1.ErrorCode.SUCCESS) {
|
|
151
139
|
throw new Error(collectionInfo.status.reason);
|
|
152
140
|
}
|
|
153
141
|
fieldsData = collectionInfo.schema.fields
|
|
@@ -155,7 +143,7 @@ var Data = /** @class */ (function (_super) {
|
|
|
155
143
|
.map(function (v) { return ({
|
|
156
144
|
name: v.name,
|
|
157
145
|
type: v.data_type,
|
|
158
|
-
dim: Number((0,
|
|
146
|
+
dim: Number((0, utils_1.findKeyValue)(v.type_params, 'dim')),
|
|
159
147
|
value: [],
|
|
160
148
|
}); });
|
|
161
149
|
params = __assign(__assign({}, data), { num_rows: data.fields_data.length });
|
|
@@ -166,13 +154,13 @@ var Data = /** @class */ (function (_super) {
|
|
|
166
154
|
fieldNames.forEach(function (name) {
|
|
167
155
|
var target = fieldsData.find(function (item) { return item.name === name; });
|
|
168
156
|
if (!target) {
|
|
169
|
-
throw new Error("".concat(
|
|
157
|
+
throw new Error("".concat(_1.ERROR_REASONS.INSERT_CHECK_WRONG_FIELD, " ").concat(i));
|
|
170
158
|
}
|
|
171
|
-
var isVector = _this.vectorTypes.includes(
|
|
159
|
+
var isVector = _this.vectorTypes.includes(_1.DataTypeMap[target.type.toLowerCase()]);
|
|
172
160
|
// Check if the dimension is matched when the data type is BinaryVector.
|
|
173
|
-
if (
|
|
161
|
+
if (_1.DataTypeMap[target.type.toLowerCase()] === _1.DataType.BinaryVector &&
|
|
174
162
|
v[name].length !== target.dim / 8) {
|
|
175
|
-
throw new Error(
|
|
163
|
+
throw new Error(_1.ERROR_REASONS.INSERT_CHECK_WRONG_DIM);
|
|
176
164
|
}
|
|
177
165
|
// Value in vector field should be array. Therefore you need concat it.
|
|
178
166
|
// but array.concat is slow, we need for loop to push the value one by one
|
|
@@ -191,55 +179,55 @@ var Data = /** @class */ (function (_super) {
|
|
|
191
179
|
var _a, _b, _c, _d;
|
|
192
180
|
// milvus return string for field type, so we define the DataTypeMap to the value we need.
|
|
193
181
|
// but if milvus change the string, may casue we cant find value.
|
|
194
|
-
var type =
|
|
182
|
+
var type = _1.DataTypeMap[v.type.toLowerCase()];
|
|
195
183
|
var key = _this.vectorTypes.includes(type) ? 'vectors' : 'scalars';
|
|
196
184
|
var dataKey = 'float_vector';
|
|
197
185
|
switch (type) {
|
|
198
|
-
case
|
|
186
|
+
case _1.DataType.FloatVector:
|
|
199
187
|
dataKey = 'float_vector';
|
|
200
188
|
break;
|
|
201
|
-
case
|
|
189
|
+
case _1.DataType.BinaryVector:
|
|
202
190
|
dataKey = 'binary_vector';
|
|
203
191
|
break;
|
|
204
|
-
case
|
|
192
|
+
case _1.DataType.Double:
|
|
205
193
|
dataKey = 'double_data';
|
|
206
194
|
break;
|
|
207
|
-
case
|
|
195
|
+
case _1.DataType.Float:
|
|
208
196
|
dataKey = 'float_data';
|
|
209
197
|
break;
|
|
210
|
-
case
|
|
198
|
+
case _1.DataType.Int64:
|
|
211
199
|
dataKey = 'long_data';
|
|
212
200
|
break;
|
|
213
|
-
case
|
|
214
|
-
case
|
|
215
|
-
case
|
|
201
|
+
case _1.DataType.Int32:
|
|
202
|
+
case _1.DataType.Int16:
|
|
203
|
+
case _1.DataType.Int8:
|
|
216
204
|
dataKey = 'int_data';
|
|
217
205
|
break;
|
|
218
|
-
case
|
|
206
|
+
case _1.DataType.Bool:
|
|
219
207
|
dataKey = 'bool_data';
|
|
220
208
|
break;
|
|
221
|
-
case
|
|
209
|
+
case _1.DataType.VarChar:
|
|
222
210
|
dataKey = 'string_data';
|
|
223
211
|
break;
|
|
224
212
|
default:
|
|
225
|
-
throw new Error(
|
|
213
|
+
throw new Error(_1.ERROR_REASONS.INSERT_CHECK_WRONG_DATA_TYPE);
|
|
226
214
|
}
|
|
227
215
|
return _a = {
|
|
228
216
|
type: type,
|
|
229
217
|
field_name: v.name
|
|
230
218
|
},
|
|
231
|
-
_a[key] = type ===
|
|
219
|
+
_a[key] = type === _1.DataType.FloatVector
|
|
232
220
|
? (_b = {
|
|
233
221
|
dim: v.dim
|
|
234
222
|
},
|
|
235
223
|
_b[dataKey] = {
|
|
236
224
|
data: v.value,
|
|
237
225
|
},
|
|
238
|
-
_b) : type ===
|
|
226
|
+
_b) : type === _1.DataType.BinaryVector
|
|
239
227
|
? (_c = {
|
|
240
228
|
dim: v.dim
|
|
241
229
|
},
|
|
242
|
-
_c[dataKey] = (0,
|
|
230
|
+
_c[dataKey] = (0, utils_1.parseBinaryVectorToBytes)(v.value),
|
|
243
231
|
_c) : (_d = {},
|
|
244
232
|
_d[dataKey] = {
|
|
245
233
|
data: v.value,
|
|
@@ -247,7 +235,7 @@ var Data = /** @class */ (function (_super) {
|
|
|
247
235
|
_d),
|
|
248
236
|
_a;
|
|
249
237
|
});
|
|
250
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
238
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'Insert', params, data.timeout)];
|
|
251
239
|
case 2:
|
|
252
240
|
promise = _a.sent();
|
|
253
241
|
return [2 /*return*/, promise];
|
|
@@ -259,24 +247,25 @@ var Data = /** @class */ (function (_super) {
|
|
|
259
247
|
* Delete entities in Milvus
|
|
260
248
|
*
|
|
261
249
|
* @param data
|
|
262
|
-
* | Property
|
|
263
|
-
* |
|
|
264
|
-
* | collection_name
|
|
265
|
-
* | partition_name(optional)| String
|
|
266
|
-
* | expr
|
|
267
|
-
* | timeout
|
|
250
|
+
* | Property | Type | Description |
|
|
251
|
+
* | :--- | :-- | :-- |
|
|
252
|
+
* | collection_name | String | Collection name |
|
|
253
|
+
* | partition_name(optional)| String | Partition name |
|
|
254
|
+
* | expr | String | Boolean expression used to filter attribute. |
|
|
255
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
256
|
+
|
|
268
257
|
*
|
|
269
|
-
* @
|
|
270
|
-
*
|
|
271
|
-
* |
|
|
272
|
-
* | status
|
|
273
|
-
* | IDs
|
|
258
|
+
* @returns
|
|
259
|
+
* | Property | Description |
|
|
260
|
+
* | :-- | :-- |
|
|
261
|
+
* | status | { error_code: number, reason: string } |
|
|
262
|
+
* | IDs | ID array of the successfully deleted data |
|
|
274
263
|
*
|
|
275
264
|
*
|
|
276
265
|
* #### Example
|
|
277
266
|
*
|
|
278
267
|
* ```
|
|
279
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
268
|
+
* new milvusClient(MILUVS_ADDRESS).deleteEntities({
|
|
280
269
|
* collection_name: COLLECTION_NAME,
|
|
281
270
|
* expr: 'id in [1,2,3,4]'
|
|
282
271
|
* });
|
|
@@ -289,9 +278,9 @@ var Data = /** @class */ (function (_super) {
|
|
|
289
278
|
switch (_a.label) {
|
|
290
279
|
case 0:
|
|
291
280
|
if (!data || !data.collection_name || !data.expr) {
|
|
292
|
-
throw new Error(
|
|
281
|
+
throw new Error(_1.ERROR_REASONS.DELETE_PARAMS_CHECK);
|
|
293
282
|
}
|
|
294
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
283
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'Delete', data, data.timeout)];
|
|
295
284
|
case 1:
|
|
296
285
|
promise = _a.sent();
|
|
297
286
|
return [2 /*return*/, promise];
|
|
@@ -303,30 +292,31 @@ var Data = /** @class */ (function (_super) {
|
|
|
303
292
|
* Perform vector similarity search.
|
|
304
293
|
*
|
|
305
294
|
* @param data
|
|
306
|
-
* | Property
|
|
307
|
-
* |
|
|
308
|
-
* | collection_name
|
|
309
|
-
* | partition_names(optional)| String[]
|
|
310
|
-
* | expr(optional)
|
|
311
|
-
* | search_params
|
|
312
|
-
* | vectors
|
|
313
|
-
* | output_fields(optional)
|
|
314
|
-
* | vector_type
|
|
315
|
-
* | travel_timestamp
|
|
316
|
-
* | timeout
|
|
317
|
-
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
* |
|
|
322
|
-
* |
|
|
295
|
+
* | Property | Type | Description |
|
|
296
|
+
* | :--- | :-- | :-- |
|
|
297
|
+
* | collection_name | String | Collection name |
|
|
298
|
+
* | partition_names(optional)| String[] | Array of partition names |
|
|
299
|
+
* | expr(optional) | String | Scalar field filter expression |
|
|
300
|
+
* | search_params | Object | anns_field: vector field name <br/> topk: search result counts <br/> [metric_type](https://milvus.io/docs/v2.0.0/metric.md#floating#Similarity-Metrics) <br/>params: search params |
|
|
301
|
+
* | vectors | Number[][] | Original vector to search with |
|
|
302
|
+
* | output_fields(optional) | String[] | Support scalar field |
|
|
303
|
+
* | vector_type | enum | Binary field -> 100, Float field -> 101 |
|
|
304
|
+
* | travel_timestamp | number | We can get timestamp after insert success. Use this timestamp we can time travel in vector search.|
|
|
305
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
306
|
+
|
|
307
|
+
*
|
|
308
|
+
* @returns
|
|
309
|
+
* | Property | Description |
|
|
310
|
+
* | :-- | :-- |
|
|
311
|
+
* | status | { error_code: number, reason: string } |
|
|
312
|
+
* | results | {score:number,id:string}[]; |
|
|
323
313
|
*
|
|
324
314
|
*
|
|
325
315
|
*
|
|
326
316
|
* #### Example
|
|
327
317
|
*
|
|
328
318
|
* ```
|
|
329
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
319
|
+
* new milvusClient(MILUVS_ADDRESS).search({
|
|
330
320
|
* collection_name: COLLECTION_NAME,
|
|
331
321
|
* expr: "",
|
|
332
322
|
* vectors: [[1, 2, 3, 4]],
|
|
@@ -348,54 +338,54 @@ var Data = /** @class */ (function (_super) {
|
|
|
348
338
|
return __generator(this, function (_c) {
|
|
349
339
|
switch (_c.label) {
|
|
350
340
|
case 0:
|
|
351
|
-
|
|
341
|
+
(0, utils_1.checkCollectionName)(data);
|
|
352
342
|
if (!data.search_params ||
|
|
353
343
|
!data.search_params.anns_field ||
|
|
354
344
|
!data.search_params.metric_type ||
|
|
355
345
|
!data.search_params.topk ||
|
|
356
346
|
!data.search_params.params) {
|
|
357
|
-
throw new Error(
|
|
347
|
+
throw new Error(_1.ERROR_REASONS.SEARCH_PARAMS_IS_REQUIRED);
|
|
358
348
|
}
|
|
359
349
|
if (!this.vectorTypes.includes(data.vector_type))
|
|
360
|
-
throw new Error(
|
|
361
|
-
return [4 /*yield*/, this.
|
|
350
|
+
throw new Error(_1.ERROR_REASONS.SEARCH_MISS_VECTOR_TYPE);
|
|
351
|
+
return [4 /*yield*/, this.describeCollection({
|
|
362
352
|
collection_name: data.collection_name,
|
|
363
353
|
})];
|
|
364
354
|
case 1:
|
|
365
355
|
collectionInfo = _c.sent();
|
|
366
356
|
targetField = collectionInfo.schema.fields.find(function (v) { return v.name === data.search_params.anns_field; });
|
|
367
357
|
if (!targetField) {
|
|
368
|
-
throw new Error(
|
|
358
|
+
throw new Error(_1.ERROR_REASONS.SEARCH_NOT_FIND_VECTOR_FIELD);
|
|
369
359
|
}
|
|
370
|
-
dim = (0,
|
|
371
|
-
vectorType =
|
|
372
|
-
dimension = vectorType ===
|
|
360
|
+
dim = (0, utils_1.findKeyValue)(targetField.type_params, 'dim');
|
|
361
|
+
vectorType = _1.DataTypeMap[targetField.data_type.toLowerCase()];
|
|
362
|
+
dimension = vectorType === _1.DataType.BinaryVector ? Number(dim) / 8 : Number(dim);
|
|
373
363
|
if (!data.vectors[0] || data.vectors[0].length !== dimension) {
|
|
374
|
-
throw new Error(
|
|
364
|
+
throw new Error(_1.ERROR_REASONS.SEARCH_DIM_NOT_MATCH);
|
|
375
365
|
}
|
|
376
366
|
round_decimal = data.search_params.round_decimal;
|
|
377
367
|
if (round_decimal !== undefined &&
|
|
378
368
|
(!Number.isInteger(round_decimal) ||
|
|
379
369
|
round_decimal < -1 ||
|
|
380
370
|
round_decimal > 6)) {
|
|
381
|
-
throw new Error(
|
|
371
|
+
throw new Error(_1.ERROR_REASONS.SEARCH_ROUND_DECIMAL_NOT_VALID);
|
|
382
372
|
}
|
|
383
|
-
PlaceholderGroup = this.
|
|
373
|
+
PlaceholderGroup = this.milvusProto.lookupType('milvus.proto.common.PlaceholderGroup');
|
|
384
374
|
placeholderGroupParams = PlaceholderGroup.create({
|
|
385
375
|
placeholders: [
|
|
386
376
|
{
|
|
387
377
|
tag: '$0',
|
|
388
378
|
type: data.vector_type,
|
|
389
379
|
values: data.vectors.map(function (v) {
|
|
390
|
-
return data.vector_type ===
|
|
391
|
-
? (0,
|
|
392
|
-
: (0,
|
|
380
|
+
return data.vector_type === _1.DataType.BinaryVector
|
|
381
|
+
? (0, utils_1.parseBinaryVectorToBytes)(v)
|
|
382
|
+
: (0, utils_1.parseFloatVectorToBytes)(v);
|
|
393
383
|
}),
|
|
394
384
|
},
|
|
395
385
|
],
|
|
396
386
|
});
|
|
397
387
|
placeholderGroupBytes = PlaceholderGroup.encode(placeholderGroupParams).finish();
|
|
398
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
388
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'Search', __assign(__assign({}, data), { nq: data.nq || data.vectors.length, dsl: data.expr || '', dsl_type: _1.DslType.BoolExprV1, placeholder_group: placeholderGroupBytes, search_params: (0, utils_1.parseToKeyValue)(data.search_params) }), data.timeout)];
|
|
399
389
|
case 2:
|
|
400
390
|
promise = _c.sent();
|
|
401
391
|
results = [];
|
|
@@ -429,7 +419,7 @@ var Data = /** @class */ (function (_super) {
|
|
|
429
419
|
var i = index === 0 ? scoreIndex : scoreIndex + topk;
|
|
430
420
|
var fixedScore = typeof round_decimal === 'undefined' || round_decimal === -1
|
|
431
421
|
? score
|
|
432
|
-
: (0,
|
|
422
|
+
: (0, utils_1.formatNumberPrecision)(score, round_decimal);
|
|
433
423
|
var result = {
|
|
434
424
|
score: fixedScore,
|
|
435
425
|
id: idData_1 ? idData_1[i] : '',
|
|
@@ -453,20 +443,21 @@ var Data = /** @class */ (function (_super) {
|
|
|
453
443
|
* Milvus temporarily buffers the newly inserted vectors in the cache. Call `flush()` to persist them to the object storage.
|
|
454
444
|
* It's async function, so it's will take some times to excute.
|
|
455
445
|
* @param data
|
|
456
|
-
* | Property
|
|
457
|
-
* |
|
|
458
|
-
* | collection_names
|
|
459
|
-
* | timeout
|
|
446
|
+
* | Property | Type | Description |
|
|
447
|
+
* | :--- | :-- | :-- |
|
|
448
|
+
* | collection_names | String[] | Array of collection names |
|
|
449
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
450
|
+
|
|
460
451
|
*
|
|
461
|
-
* @
|
|
462
|
-
*
|
|
463
|
-
* |
|
|
464
|
-
* | status
|
|
452
|
+
* @returns
|
|
453
|
+
* | Property | Description |
|
|
454
|
+
* | :-- | :-- |
|
|
455
|
+
* | status | { error_code: number, reason: string } |
|
|
465
456
|
*
|
|
466
457
|
* #### Example
|
|
467
458
|
*
|
|
468
459
|
* ```
|
|
469
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
460
|
+
* new milvusClient(MILUVS_ADDRESS).flush({
|
|
470
461
|
* collection_names: ['my_collection'],
|
|
471
462
|
* });
|
|
472
463
|
* ```
|
|
@@ -480,9 +471,9 @@ var Data = /** @class */ (function (_super) {
|
|
|
480
471
|
if (!data ||
|
|
481
472
|
!Array.isArray(data.collection_names) ||
|
|
482
473
|
!data.collection_names.length) {
|
|
483
|
-
throw new Error(
|
|
474
|
+
throw new Error(_1.ERROR_REASONS.COLLECTION_NAME_IS_REQUIRED);
|
|
484
475
|
}
|
|
485
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
476
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'Flush', data, data.timeout)];
|
|
486
477
|
case 1:
|
|
487
478
|
res = _a.sent();
|
|
488
479
|
return [2 /*return*/, res];
|
|
@@ -495,20 +486,21 @@ var Data = /** @class */ (function (_super) {
|
|
|
495
486
|
* So you can ensure it's flushed after function return the result.
|
|
496
487
|
*
|
|
497
488
|
* @param data
|
|
498
|
-
* | Property
|
|
499
|
-
* |
|
|
500
|
-
* | collection_names
|
|
501
|
-
* | timeout
|
|
489
|
+
* | Property | Type | Description |
|
|
490
|
+
* | :--- | :-- | :-- |
|
|
491
|
+
* | collection_names | String[] | Array of collection names |
|
|
492
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
493
|
+
|
|
502
494
|
*
|
|
503
|
-
* @
|
|
504
|
-
*
|
|
505
|
-
* |
|
|
506
|
-
* | status
|
|
495
|
+
* @returns
|
|
496
|
+
* | Property | Description |
|
|
497
|
+
* | :-- | :-- |
|
|
498
|
+
* | status | { error_code: number, reason: string } |
|
|
507
499
|
*
|
|
508
500
|
* #### Example
|
|
509
501
|
*
|
|
510
502
|
* ```
|
|
511
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
503
|
+
* new milvusClient(MILUVS_ADDRESS).flushSync({
|
|
512
504
|
* collection_names: ['my_collection'],
|
|
513
505
|
* });
|
|
514
506
|
* ```
|
|
@@ -522,9 +514,9 @@ var Data = /** @class */ (function (_super) {
|
|
|
522
514
|
if (!data ||
|
|
523
515
|
!Array.isArray(data.collection_names) ||
|
|
524
516
|
!data.collection_names.length) {
|
|
525
|
-
throw new Error(
|
|
517
|
+
throw new Error(_1.ERROR_REASONS.COLLECTION_NAME_IS_REQUIRED);
|
|
526
518
|
}
|
|
527
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
519
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'Flush', data, data.timeout)];
|
|
528
520
|
case 1:
|
|
529
521
|
res = _a.sent();
|
|
530
522
|
segIDs = Object.keys(res.coll_segIDs)
|
|
@@ -538,7 +530,7 @@ var Data = /** @class */ (function (_super) {
|
|
|
538
530
|
return [4 /*yield*/, this.getFlushState({ segmentIDs: segIDs })];
|
|
539
531
|
case 3:
|
|
540
532
|
flushRes = _a.sent();
|
|
541
|
-
return [4 /*yield*/, (0,
|
|
533
|
+
return [4 /*yield*/, (0, utils_1.sleep)(100)];
|
|
542
534
|
case 4:
|
|
543
535
|
_a.sent();
|
|
544
536
|
isFlushed = flushRes.flushed;
|
|
@@ -554,26 +546,27 @@ var Data = /** @class */ (function (_super) {
|
|
|
554
546
|
* Query vector data in Milvus. Current release of Milvus only supports expression as fieldname in [id1,id2,id3]
|
|
555
547
|
*
|
|
556
548
|
* @param data
|
|
557
|
-
* | Property
|
|
558
|
-
* |
|
|
559
|
-
* | collection_name
|
|
560
|
-
* | expr
|
|
561
|
-
* | partitions_names(optional)
|
|
562
|
-
* | output_fields
|
|
563
|
-
* | timeout
|
|
549
|
+
* | Property | Type | Description |
|
|
550
|
+
* | :--- | :-- | :-- |
|
|
551
|
+
* | collection_name | String | Collection name |
|
|
552
|
+
* | expr | String | Scalar field filter expression |
|
|
553
|
+
* | partitions_names(optional) | String[] | Array of partition names |
|
|
554
|
+
* | output_fields | String[] | Vector or scalar field to be returned |
|
|
555
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
556
|
+
|
|
564
557
|
* | params | {key: value}[] | An optional key pair json array
|
|
565
558
|
*
|
|
566
|
-
* @
|
|
567
|
-
*
|
|
568
|
-
* |
|
|
569
|
-
* | status
|
|
570
|
-
* | data
|
|
559
|
+
* @returns
|
|
560
|
+
* | Property | Description |
|
|
561
|
+
* | :-- | :-- |
|
|
562
|
+
* | status | { error_code: number,reason:string } |
|
|
563
|
+
* | data | Data of all fields that you defined in `output_fields`, {field_name: value}[] |
|
|
571
564
|
*
|
|
572
565
|
*
|
|
573
566
|
* #### Example
|
|
574
567
|
*
|
|
575
568
|
* ```
|
|
576
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
569
|
+
* new milvusClient(MILUVS_ADDRESS).query({
|
|
577
570
|
* collection_name: 'my_collection',
|
|
578
571
|
* expr: "age in [1,2,3,4,5,6,7,8]",
|
|
579
572
|
* output_fields: ["age"],
|
|
@@ -586,14 +579,14 @@ var Data = /** @class */ (function (_super) {
|
|
|
586
579
|
return __generator(this, function (_a) {
|
|
587
580
|
switch (_a.label) {
|
|
588
581
|
case 0:
|
|
589
|
-
|
|
582
|
+
(0, utils_1.checkCollectionName)(data);
|
|
590
583
|
if (typeof data.limit === 'number') {
|
|
591
584
|
limits = { limit: data.limit };
|
|
592
585
|
}
|
|
593
586
|
if (typeof data.offset === 'number') {
|
|
594
587
|
offset = { offset: data.offset };
|
|
595
588
|
}
|
|
596
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
589
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'Query', __assign(__assign({}, data), { query_params: (0, utils_1.parseToKeyValue)(__assign(__assign({}, limits), offset)) }), data.timeout)];
|
|
597
590
|
case 1:
|
|
598
591
|
promise = _a.sent();
|
|
599
592
|
results = [];
|
|
@@ -654,9 +647,9 @@ var Data = /** @class */ (function (_super) {
|
|
|
654
647
|
/**
|
|
655
648
|
* @ignore
|
|
656
649
|
* @param data
|
|
657
|
-
* | Property
|
|
658
|
-
* |
|
|
659
|
-
* | request
|
|
650
|
+
* | Property | Type | Description |
|
|
651
|
+
* | :--- | :-- | :-- |
|
|
652
|
+
* | request | object | Only allow "system_info" for now |
|
|
660
653
|
*/
|
|
661
654
|
Data.prototype.getMetric = function (data) {
|
|
662
655
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -665,9 +658,9 @@ var Data = /** @class */ (function (_super) {
|
|
|
665
658
|
switch (_a.label) {
|
|
666
659
|
case 0:
|
|
667
660
|
if (!data || !data.request || !data.request.metric_type) {
|
|
668
|
-
throw new Error(
|
|
661
|
+
throw new Error(_1.ERROR_REASONS.GET_METRIC_CHECK_PARAMS);
|
|
669
662
|
}
|
|
670
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
663
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'GetMetrics', {
|
|
671
664
|
request: JSON.stringify(data.request),
|
|
672
665
|
}, data.timeout)];
|
|
673
666
|
case 1:
|
|
@@ -681,23 +674,24 @@ var Data = /** @class */ (function (_super) {
|
|
|
681
674
|
* Get flush state by segment ids
|
|
682
675
|
*
|
|
683
676
|
* @param data
|
|
684
|
-
* | Property
|
|
685
|
-
* |
|
|
686
|
-
* | segmentIDs
|
|
687
|
-
* | timeout
|
|
677
|
+
* | Property | Type | Description |
|
|
678
|
+
* | :--- | :-- | :-- |
|
|
679
|
+
* | segmentIDs | Array | The segment ids |
|
|
680
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
681
|
+
|
|
688
682
|
*
|
|
689
683
|
*
|
|
690
|
-
* @
|
|
691
|
-
*
|
|
692
|
-
* |
|
|
693
|
-
* | status
|
|
694
|
-
* | flushed
|
|
684
|
+
* @returns
|
|
685
|
+
* | Property | Description |
|
|
686
|
+
* | :--- | :-- |
|
|
687
|
+
* | status | { error_code: number,reason:string } |
|
|
688
|
+
* | flushed | segments flushed or not |
|
|
695
689
|
*
|
|
696
690
|
*
|
|
697
691
|
* #### Example
|
|
698
692
|
*
|
|
699
693
|
* ```
|
|
700
|
-
* const res = await milvusClient.
|
|
694
|
+
* const res = await milvusClient.getFlushState({
|
|
701
695
|
* segmentIDs: segIds,
|
|
702
696
|
* });
|
|
703
697
|
* ```
|
|
@@ -709,9 +703,9 @@ var Data = /** @class */ (function (_super) {
|
|
|
709
703
|
switch (_a.label) {
|
|
710
704
|
case 0:
|
|
711
705
|
if (!data || !data.segmentIDs) {
|
|
712
|
-
throw new Error(
|
|
706
|
+
throw new Error(_1.ERROR_REASONS.GET_FLUSH_STATE_CHECK_PARAMS);
|
|
713
707
|
}
|
|
714
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
708
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'GetFlushState', data, data.timeout)];
|
|
715
709
|
case 1:
|
|
716
710
|
res = _a.sent();
|
|
717
711
|
return [2 /*return*/, res];
|
|
@@ -724,24 +718,24 @@ var Data = /** @class */ (function (_super) {
|
|
|
724
718
|
* Only work in cluster milvus.
|
|
725
719
|
*
|
|
726
720
|
* @param data
|
|
727
|
-
* | Property
|
|
728
|
-
* |
|
|
729
|
-
* | src_nodeID
|
|
730
|
-
* | dst_nodeIDs
|
|
731
|
-
* | sealed_segmentIDs
|
|
732
|
-
* | timeout
|
|
721
|
+
* | Property | Type | Description |
|
|
722
|
+
* | :--- | :-- | :-- |
|
|
723
|
+
* | src_nodeID | number | The source query node id to balance. |
|
|
724
|
+
* | dst_nodeIDs | number[] | The destination query node ids to balance.(optional) |
|
|
725
|
+
* | sealed_segmentIDs | number[] | Sealed segment ids to balance.(optional) |
|
|
726
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
733
727
|
*
|
|
734
|
-
* @
|
|
735
|
-
*
|
|
736
|
-
* |
|
|
737
|
-
* | status
|
|
738
|
-
* | infos
|
|
728
|
+
* @returns
|
|
729
|
+
* | Property | Description |
|
|
730
|
+
* | :--- | :-- |
|
|
731
|
+
* | status | { error_code: number,reason:string } |
|
|
732
|
+
* | infos | segments infomations |
|
|
739
733
|
*
|
|
740
734
|
*
|
|
741
735
|
* #### Example
|
|
742
736
|
*
|
|
743
737
|
* ```
|
|
744
|
-
* const res = await
|
|
738
|
+
* const res = await loadBalance({
|
|
745
739
|
* src_nodeID: 31,
|
|
746
740
|
* });
|
|
747
741
|
* ```
|
|
@@ -753,9 +747,9 @@ var Data = /** @class */ (function (_super) {
|
|
|
753
747
|
switch (_a.label) {
|
|
754
748
|
case 0:
|
|
755
749
|
if (!data || !data.src_nodeID) {
|
|
756
|
-
throw new Error(
|
|
750
|
+
throw new Error(_1.ERROR_REASONS.LOAD_BALANCE_CHECK_PARAMS);
|
|
757
751
|
}
|
|
758
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
752
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'LoadBalance', data, data.timeout)];
|
|
759
753
|
case 1:
|
|
760
754
|
res = _a.sent();
|
|
761
755
|
return [2 /*return*/, res];
|
|
@@ -767,23 +761,23 @@ var Data = /** @class */ (function (_super) {
|
|
|
767
761
|
* Notifies Proxy to return segments information from query nodes.
|
|
768
762
|
*
|
|
769
763
|
* @param data
|
|
770
|
-
* | Property
|
|
771
|
-
* |
|
|
772
|
-
* | collectionName
|
|
773
|
-
* | timeout
|
|
764
|
+
* | Property | Type | Description |
|
|
765
|
+
* | :--- | :-- | :-- |
|
|
766
|
+
* | collectionName | String | The name of the collection to get segments info. |
|
|
767
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
774
768
|
*
|
|
775
769
|
*
|
|
776
|
-
* @
|
|
777
|
-
*
|
|
778
|
-
* |
|
|
779
|
-
* | status
|
|
780
|
-
* | infos
|
|
770
|
+
* @returns
|
|
771
|
+
* | Property | Description |
|
|
772
|
+
* | :--- | :-- |
|
|
773
|
+
* | status | { error_code: number,reason:string } |
|
|
774
|
+
* | infos | QuerySegmentInfo is the growing segments's information in query cluster. |
|
|
781
775
|
*
|
|
782
776
|
*
|
|
783
777
|
* #### Example
|
|
784
778
|
*
|
|
785
779
|
* ```
|
|
786
|
-
* const res = await
|
|
780
|
+
* const res = await getQuerySegmentInfo({
|
|
787
781
|
* collectionName: COLLECTION,
|
|
788
782
|
* });
|
|
789
783
|
* ```
|
|
@@ -795,9 +789,9 @@ var Data = /** @class */ (function (_super) {
|
|
|
795
789
|
switch (_a.label) {
|
|
796
790
|
case 0:
|
|
797
791
|
if (!data || !data.collectionName) {
|
|
798
|
-
throw new Error(
|
|
792
|
+
throw new Error(_1.ERROR_REASONS.COLLECTION_NAME_IS_REQUIRED);
|
|
799
793
|
}
|
|
800
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
794
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'GetQuerySegmentInfo', data, data.timeout)];
|
|
801
795
|
case 1:
|
|
802
796
|
res = _a.sent();
|
|
803
797
|
return [2 /*return*/, res];
|
|
@@ -809,28 +803,29 @@ var Data = /** @class */ (function (_super) {
|
|
|
809
803
|
* Import data from files
|
|
810
804
|
*
|
|
811
805
|
* @param data
|
|
812
|
-
* | Property
|
|
813
|
-
* |
|
|
814
|
-
* | collection_name
|
|
815
|
-
* | files
|
|
806
|
+
* | Property | Type | Description |
|
|
807
|
+
* | :--- | :-- | :-- |
|
|
808
|
+
* | collection_name | String | The name of the collection |
|
|
809
|
+
* | files | string[] | File path array |
|
|
816
810
|
*
|
|
817
811
|
*
|
|
818
|
-
* @
|
|
819
|
-
*
|
|
820
|
-
* |
|
|
821
|
-
* | status
|
|
822
|
-
* | tasks
|
|
812
|
+
* @returns
|
|
813
|
+
* | Property | Description |
|
|
814
|
+
* | :--- | :-- |
|
|
815
|
+
* | status | { error_code: number,reason:string } |
|
|
816
|
+
* | tasks | taskId array |
|
|
823
817
|
*
|
|
824
818
|
*
|
|
825
819
|
* #### Example
|
|
826
820
|
*
|
|
827
821
|
* ```
|
|
828
|
-
* const res = await
|
|
822
|
+
* const res = await bulkInsert({
|
|
829
823
|
* collection_name: COLLECTION,
|
|
830
824
|
* files: [`path-to-data-file.json`]
|
|
831
825
|
* });
|
|
832
826
|
* ```
|
|
833
827
|
*/
|
|
828
|
+
/* istanbul ignore next */
|
|
834
829
|
Data.prototype.bulkInsert = function (data) {
|
|
835
830
|
return __awaiter(this, void 0, void 0, function () {
|
|
836
831
|
var res;
|
|
@@ -838,12 +833,12 @@ var Data = /** @class */ (function (_super) {
|
|
|
838
833
|
switch (_a.label) {
|
|
839
834
|
case 0:
|
|
840
835
|
if (!data || !data.collection_name) {
|
|
841
|
-
throw new Error(
|
|
836
|
+
throw new Error(_1.ERROR_REASONS.COLLECTION_NAME_IS_REQUIRED);
|
|
842
837
|
}
|
|
843
838
|
if (!data || !data.files) {
|
|
844
|
-
throw new Error(
|
|
839
|
+
throw new Error(_1.ERROR_REASONS.IMPORT_FILE_CHECK);
|
|
845
840
|
}
|
|
846
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
841
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'Import', __assign(__assign({}, data), { options: data.options || [] }), data.timeout)];
|
|
847
842
|
case 1:
|
|
848
843
|
res = _a.sent();
|
|
849
844
|
return [2 /*return*/, res];
|
|
@@ -855,32 +850,32 @@ var Data = /** @class */ (function (_super) {
|
|
|
855
850
|
* List import tasks
|
|
856
851
|
*
|
|
857
852
|
* @param data
|
|
858
|
-
* | Property
|
|
859
|
-
* |
|
|
860
|
-
* | collection_name
|
|
861
|
-
* | limit
|
|
853
|
+
* | Property | Type | Description |
|
|
854
|
+
* | :--- | :-- | :-- |
|
|
855
|
+
* | collection_name | String | The name of the collection |
|
|
856
|
+
* | limit | number | optional, maximum number of tasks returned, list all tasks if the value is 0 |
|
|
862
857
|
*
|
|
863
858
|
*
|
|
864
|
-
* @
|
|
865
|
-
*
|
|
866
|
-
* |
|
|
867
|
-
* | status
|
|
859
|
+
* @returns
|
|
860
|
+
* | Property | Description |
|
|
861
|
+
* | :--- | :-- |
|
|
862
|
+
* | status | { error_code: number,reason:string } |
|
|
868
863
|
* | state | import state |
|
|
869
864
|
* | row_count | how many rows to import|
|
|
870
865
|
* | id_list| id lists |
|
|
871
866
|
* | collection_id | collection to be imported to |
|
|
872
|
-
* |
|
|
873
|
-
* | tasks | taskId array |
|
|
867
|
+
* | tasks | taskId array |
|
|
874
868
|
*
|
|
875
869
|
*
|
|
876
870
|
* #### Example
|
|
877
871
|
*
|
|
878
872
|
* ```
|
|
879
|
-
* const res = await
|
|
873
|
+
* const res = await listImportTasks({
|
|
880
874
|
* collection_name: COLLECTION
|
|
881
875
|
* });
|
|
882
876
|
* ```
|
|
883
877
|
*/
|
|
878
|
+
/* istanbul ignore next */
|
|
884
879
|
Data.prototype.listImportTasks = function (data) {
|
|
885
880
|
return __awaiter(this, void 0, void 0, function () {
|
|
886
881
|
var res;
|
|
@@ -888,9 +883,9 @@ var Data = /** @class */ (function (_super) {
|
|
|
888
883
|
switch (_a.label) {
|
|
889
884
|
case 0:
|
|
890
885
|
if (!data || !data.collection_name) {
|
|
891
|
-
throw new Error(
|
|
886
|
+
throw new Error(_1.ERROR_REASONS.COLLECTION_NAME_IS_REQUIRED);
|
|
892
887
|
}
|
|
893
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
888
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'ListImportTasks', __assign(__assign({}, data), { limit: data.limit || 0 }), data.timeout)];
|
|
894
889
|
case 1:
|
|
895
890
|
res = _a.sent();
|
|
896
891
|
return [2 /*return*/, res];
|
|
@@ -899,6 +894,6 @@ var Data = /** @class */ (function (_super) {
|
|
|
899
894
|
});
|
|
900
895
|
};
|
|
901
896
|
return Data;
|
|
902
|
-
}(
|
|
897
|
+
}(Collection_1.Collection));
|
|
903
898
|
exports.Data = Data;
|
|
904
899
|
//# sourceMappingURL=Data.js.map
|