@zilliz/milvus2-sdk-node 2.0.1 → 2.1.0
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 +5 -0
- package/dist/milvus/Collection.d.ts +1 -0
- package/dist/milvus/Collection.js +9 -8
- package/dist/milvus/Collection.js.map +1 -1
- package/dist/milvus/Data.d.ts +5 -5
- package/dist/milvus/Data.js +31 -31
- package/dist/milvus/Data.js.map +1 -1
- package/dist/milvus/Partition.js.map +1 -1
- package/dist/milvus/User.d.ts +100 -0
- package/dist/milvus/User.js +236 -0
- package/dist/milvus/User.js.map +1 -0
- package/dist/milvus/const/ErrorReason.d.ts +3 -0
- package/dist/milvus/const/ErrorReason.js +3 -0
- package/dist/milvus/const/ErrorReason.js.map +1 -1
- package/dist/milvus/index.d.ts +15 -7
- package/dist/milvus/index.js +30 -5
- package/dist/milvus/index.js.map +1 -1
- package/dist/milvus/types/Collection.d.ts +8 -0
- package/dist/milvus/types/Collection.js +9 -1
- package/dist/milvus/types/Collection.js.map +1 -1
- package/dist/milvus/types/Response.d.ts +7 -1
- package/dist/milvus/types/Response.js.map +1 -1
- package/dist/milvus/types/User.d.ts +12 -0
- package/dist/milvus/types/User.js +3 -0
- package/dist/milvus/types/User.js.map +1 -0
- package/dist/milvus/types.d.ts +7 -7
- package/dist/milvus/types.js +17 -0
- package/dist/milvus/types.js.map +1 -1
- package/dist/milvus/utils/Format.d.ts +3 -2
- package/dist/milvus/utils/Format.js +3 -1
- package/dist/milvus/utils/Format.js.map +1 -1
- package/dist/{grpc-proto → proto/proto}/common.proto +107 -1
- package/dist/proto/proto/google/protobuf/descriptor.proto +918 -0
- package/dist/{grpc-proto → proto/proto}/milvus.proto +390 -33
- package/dist/{grpc-proto → proto/proto}/schema.proto +9 -2
- package/dist/sdk.json +1 -1
- package/package.json +6 -4
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
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;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.User = void 0;
|
|
55
|
+
var utils_1 = require("../utils");
|
|
56
|
+
var Client_1 = require("./Client");
|
|
57
|
+
var ErrorReason_1 = require("./const/ErrorReason");
|
|
58
|
+
var Format_1 = require("./utils/Format");
|
|
59
|
+
/**
|
|
60
|
+
* See all [collection operation examples](https://github.com/milvus-io/milvus-sdk-node/blob/main/example/Collection.ts).
|
|
61
|
+
*/
|
|
62
|
+
var User = /** @class */ (function (_super) {
|
|
63
|
+
__extends(User, _super);
|
|
64
|
+
function User() {
|
|
65
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Create user in milvus
|
|
69
|
+
*
|
|
70
|
+
* @param data
|
|
71
|
+
* | Property | Type | Description |
|
|
72
|
+
* | :-------------- | :---- | :------------------------------- |
|
|
73
|
+
* | username | String | username |
|
|
74
|
+
* | password | String | user password |
|
|
75
|
+
*
|
|
76
|
+
*
|
|
77
|
+
* @return
|
|
78
|
+
* | Property | Description |
|
|
79
|
+
* | :-------------| :-------- |
|
|
80
|
+
* | error_code | Error code number |
|
|
81
|
+
* | reason | Error cause|
|
|
82
|
+
*
|
|
83
|
+
* #### Example
|
|
84
|
+
*
|
|
85
|
+
* ```
|
|
86
|
+
* milvusClient.userManager.createUser({
|
|
87
|
+
* username: NAME,
|
|
88
|
+
* password: PASSWORD,
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
User.prototype.createUser = function (data) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
+
var encryptedPassword, promise;
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
switch (_a.label) {
|
|
97
|
+
case 0:
|
|
98
|
+
if (data.username === undefined || data.password === undefined) {
|
|
99
|
+
throw new Error(ErrorReason_1.ERROR_REASONS.USERNAME_PWD_ARE_REQUIRED);
|
|
100
|
+
}
|
|
101
|
+
encryptedPassword = Format_1.stringToBase64(data.password);
|
|
102
|
+
return [4 /*yield*/, utils_1.promisify(this.client, 'CreateCredential', {
|
|
103
|
+
username: data.username,
|
|
104
|
+
password: encryptedPassword,
|
|
105
|
+
})];
|
|
106
|
+
case 1:
|
|
107
|
+
promise = _a.sent();
|
|
108
|
+
return [2 /*return*/, promise];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Update user in milvus
|
|
115
|
+
*
|
|
116
|
+
* @param data
|
|
117
|
+
* | Property | Type | Description |
|
|
118
|
+
* | :-------------- | :---- | :------------------------------- |
|
|
119
|
+
* | username | String | username |
|
|
120
|
+
* | password | String | user password |
|
|
121
|
+
*
|
|
122
|
+
*
|
|
123
|
+
* @return
|
|
124
|
+
* | Property | Description |
|
|
125
|
+
* | :-------------| :-------- |
|
|
126
|
+
* | error_code | Error code number |
|
|
127
|
+
* | reason | Error cause|
|
|
128
|
+
*
|
|
129
|
+
* #### Example
|
|
130
|
+
*
|
|
131
|
+
* ```
|
|
132
|
+
* milvusClient.userManager.createUser({
|
|
133
|
+
* username: NAME,
|
|
134
|
+
* password: PASSWORD,
|
|
135
|
+
* });
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
User.prototype.updateUser = function (data) {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
+
var encryptedOldPwd, encryptedNewPwd, promise;
|
|
141
|
+
return __generator(this, function (_a) {
|
|
142
|
+
switch (_a.label) {
|
|
143
|
+
case 0:
|
|
144
|
+
if (data.username === undefined ||
|
|
145
|
+
data.newPassword === undefined ||
|
|
146
|
+
data.oldPassword === undefined) {
|
|
147
|
+
throw new Error(ErrorReason_1.ERROR_REASONS.USERNAME_PWD_ARE_REQUIRED);
|
|
148
|
+
}
|
|
149
|
+
encryptedOldPwd = Format_1.stringToBase64(data.oldPassword);
|
|
150
|
+
encryptedNewPwd = Format_1.stringToBase64(data.newPassword);
|
|
151
|
+
return [4 /*yield*/, utils_1.promisify(this.client, 'UpdateCredential', {
|
|
152
|
+
username: data.username,
|
|
153
|
+
oldPassword: encryptedOldPwd,
|
|
154
|
+
newPassword: encryptedNewPwd,
|
|
155
|
+
})];
|
|
156
|
+
case 1:
|
|
157
|
+
promise = _a.sent();
|
|
158
|
+
return [2 /*return*/, promise];
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Delete user in milvus
|
|
165
|
+
*
|
|
166
|
+
* @param data
|
|
167
|
+
* | Property | Type | Description |
|
|
168
|
+
* | :-------------- | :---- | :------------------------------- |
|
|
169
|
+
* | username | String | username |
|
|
170
|
+
*
|
|
171
|
+
*
|
|
172
|
+
* @return
|
|
173
|
+
* | Property | Description |
|
|
174
|
+
* | :-------------| :-------- |
|
|
175
|
+
* | error_code | Error code number |
|
|
176
|
+
* | reason | Error cause|
|
|
177
|
+
*
|
|
178
|
+
* #### Example
|
|
179
|
+
*
|
|
180
|
+
* ```
|
|
181
|
+
* milvusClient.userManager.createUser({
|
|
182
|
+
* username: NAME,
|
|
183
|
+
* });
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
User.prototype.deleteUser = function (data) {
|
|
187
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
188
|
+
var promise;
|
|
189
|
+
return __generator(this, function (_a) {
|
|
190
|
+
switch (_a.label) {
|
|
191
|
+
case 0:
|
|
192
|
+
if (!data.username) {
|
|
193
|
+
throw new Error(ErrorReason_1.ERROR_REASONS.USERNAME_IS_REQUIRED);
|
|
194
|
+
}
|
|
195
|
+
return [4 /*yield*/, utils_1.promisify(this.client, 'DeleteCredential', {
|
|
196
|
+
username: data.username,
|
|
197
|
+
})];
|
|
198
|
+
case 1:
|
|
199
|
+
promise = _a.sent();
|
|
200
|
+
return [2 /*return*/, promise];
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* List user in milvus
|
|
207
|
+
*
|
|
208
|
+
* @return
|
|
209
|
+
* | Property | Description |
|
|
210
|
+
* | :-------------| :-------- |
|
|
211
|
+
* | status | { error_code: number, reason: string }|
|
|
212
|
+
* | usernames | string[] |
|
|
213
|
+
*
|
|
214
|
+
* #### Example
|
|
215
|
+
*
|
|
216
|
+
* ```
|
|
217
|
+
* milvusClient.userManager.listUsers();
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
User.prototype.listUsers = function () {
|
|
221
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
222
|
+
var promise;
|
|
223
|
+
return __generator(this, function (_a) {
|
|
224
|
+
switch (_a.label) {
|
|
225
|
+
case 0: return [4 /*yield*/, utils_1.promisify(this.client, 'ListCredUsers', {})];
|
|
226
|
+
case 1:
|
|
227
|
+
promise = _a.sent();
|
|
228
|
+
return [2 /*return*/, promise];
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
return User;
|
|
234
|
+
}(Client_1.Client));
|
|
235
|
+
exports.User = User;
|
|
236
|
+
//# sourceMappingURL=User.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../milvus/User.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kCAAqC;AACrC,mCAAkC;AAClC,mDAAoD;AAIpD,yCAAgD;AAEhD;;GAEG;AACH;IAA0B,wBAAM;IAAhC;;IAsIA,CAAC;IArIC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,yBAAU,GAAhB,UAAiB,IAAmB;;;;;;wBAClC,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;4BAC9D,MAAM,IAAI,KAAK,CAAC,2BAAa,CAAC,yBAAyB,CAAC,CAAC;yBAC1D;wBACK,iBAAiB,GAAG,uBAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;wBACxC,qBAAM,iBAAS,CAAC,IAAI,CAAC,MAAM,EAAE,kBAAkB,EAAE;gCAC/D,QAAQ,EAAE,IAAI,CAAC,QAAQ;gCACvB,QAAQ,EAAE,iBAAiB;6BAC5B,CAAC,EAAA;;wBAHI,OAAO,GAAG,SAGd;wBACF,sBAAO,OAAO,EAAC;;;;KAChB;IAED;;;;;;;;;;;;;;;;;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eAAM,GAsI/B;AAtIY,oBAAI"}
|
|
@@ -24,6 +24,9 @@ export declare enum ERROR_REASONS {
|
|
|
24
24
|
PARTITION_NAMES_IS_REQUIRED = "partition_names is required",
|
|
25
25
|
ALIAS_NAME_IS_REQUIRED = "alias is required",
|
|
26
26
|
COMPACTIONID_IS_REQUIRED = "compactionID is required",
|
|
27
|
+
USERNAME_PWD_ARE_REQUIRED = "username and password are required",
|
|
28
|
+
USERNAME_OLD_NEW_PWD_ARE_REQUIRED = "username, old password and new password are required",
|
|
29
|
+
USERNAME_IS_REQUIRED = "username is required",
|
|
27
30
|
TIMESTAMP_PARAM_CHECK = "type should be string (only contains number) or bigint",
|
|
28
31
|
DATE_TYPE_CHECK = "type should be Date"
|
|
29
32
|
}
|
|
@@ -28,6 +28,9 @@ var ERROR_REASONS;
|
|
|
28
28
|
ERROR_REASONS["PARTITION_NAMES_IS_REQUIRED"] = "partition_names is required";
|
|
29
29
|
ERROR_REASONS["ALIAS_NAME_IS_REQUIRED"] = "alias is required";
|
|
30
30
|
ERROR_REASONS["COMPACTIONID_IS_REQUIRED"] = "compactionID is required";
|
|
31
|
+
ERROR_REASONS["USERNAME_PWD_ARE_REQUIRED"] = "username and password are required";
|
|
32
|
+
ERROR_REASONS["USERNAME_OLD_NEW_PWD_ARE_REQUIRED"] = "username, old password and new password are required";
|
|
33
|
+
ERROR_REASONS["USERNAME_IS_REQUIRED"] = "username is required";
|
|
31
34
|
ERROR_REASONS["TIMESTAMP_PARAM_CHECK"] = "type should be string (only contains number) or bigint";
|
|
32
35
|
ERROR_REASONS["DATE_TYPE_CHECK"] = "type should be Date";
|
|
33
36
|
})(ERROR_REASONS = exports.ERROR_REASONS || (exports.ERROR_REASONS = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorReason.js","sourceRoot":"","sources":["../../../milvus/const/ErrorReason.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"ErrorReason.js","sourceRoot":"","sources":["../../../milvus/const/ErrorReason.ts"],"names":[],"mappings":";;;AAAA,IAAY,aA+CX;AA/CD,WAAY,aAAa;IACvB,0EAAyD,CAAA;IAEzD,wFAAuE,CAAA;IACvE,4HAA2G,CAAA;IAC3G,2GAA0F,CAAA;IAC1F,0FAAyE,CAAA;IACzE,kGAAiF,CAAA;IAEjF,4EAA2D,CAAA;IAC3D,sGAAqF,CAAA;IAErF,yGAAwF,CAAA;IACxF,2FAA0E,CAAA;IAC1E,8GAA6F,CAAA;IAC7F,iHAAgG,CAAA;IAChG,mHAAkG,CAAA;IAElG,4GAA2F,CAAA;IAC3F,iGAAgF,CAAA;IAChF,sGAAqF,CAAA;IACrF,oHAAmG,CAAA;IAEnG,8EAA6D,CAAA;IAE7D,6EAA4D,CAAA;IAE5D,iFAAgE,CAAA;IAEhE,qEAAoD,CAAA;IAEpD,0FAAyE,CAAA;IAEzE,4EAA2D,CAAA;IAE3D,6DAA4C,CAAA;IAE5C,sEAAqD,CAAA;IAErD,iFAAgE,CAAA;IAChE,2GAA0F,CAAA;IAE1F,8DAA6C,CAAA;IAE7C,iGAAgF,CAAA;IAEhF,wDAAuC,CAAA;AACzC,CAAC,EA/CW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QA+CxB"}
|
package/dist/milvus/index.d.ts
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
|
-
import { Client } from
|
|
2
|
-
import { Collection } from
|
|
3
|
-
import { Partition } from
|
|
4
|
-
import { Index } from
|
|
5
|
-
import { Data } from
|
|
6
|
-
import {
|
|
1
|
+
import { Client } from '@grpc/grpc-js';
|
|
2
|
+
import { Collection } from './Collection';
|
|
3
|
+
import { Partition } from './Partition';
|
|
4
|
+
import { Index } from './MilvusIndex';
|
|
5
|
+
import { Data } from './Data';
|
|
6
|
+
import { User } from './User';
|
|
7
|
+
import { ErrorCode } from './types/Response';
|
|
7
8
|
export declare class MilvusClient {
|
|
8
9
|
client: Client;
|
|
9
10
|
collectionManager: Collection;
|
|
10
11
|
partitionManager: Partition;
|
|
11
12
|
indexManager: Index;
|
|
12
13
|
dataManager: Data;
|
|
14
|
+
userManager: User;
|
|
13
15
|
/**
|
|
14
16
|
* Connect to milvus grpc client.
|
|
15
17
|
* CollectionManager: control collection crud api
|
|
16
18
|
* PartitionManager: control partition crud api
|
|
17
19
|
* IndexManager: control index crud api
|
|
18
20
|
* DataManager: Search | Query | Insert | Flush
|
|
21
|
+
* UserManager: control user crud api
|
|
22
|
+
*
|
|
19
23
|
* @param address milvus address like: 127.0.0.1:19530
|
|
24
|
+
* @param ssl ssl connect or not, default is false
|
|
25
|
+
* @param username After created user in Milvus, username is required
|
|
26
|
+
* @param password After created user in Milvus, password is required
|
|
27
|
+
*
|
|
20
28
|
*/
|
|
21
|
-
constructor(address: string);
|
|
29
|
+
constructor(address: string, ssl?: boolean, username?: string, password?: string);
|
|
22
30
|
static get sdkInfo(): {
|
|
23
31
|
version: string;
|
|
24
32
|
recommandMilvus: string;
|
package/dist/milvus/index.js
CHANGED
|
@@ -66,10 +66,11 @@ var Collection_1 = require("./Collection");
|
|
|
66
66
|
var Partition_1 = require("./Partition");
|
|
67
67
|
var MilvusIndex_1 = require("./MilvusIndex");
|
|
68
68
|
var Data_1 = require("./Data");
|
|
69
|
+
var User_1 = require("./User");
|
|
69
70
|
var sdk_json_1 = __importDefault(require("../sdk.json"));
|
|
70
71
|
var ErrorReason_1 = require("./const/ErrorReason");
|
|
71
72
|
var Response_1 = require("./types/Response");
|
|
72
|
-
var protoPath = path_1.default.resolve(__dirname,
|
|
73
|
+
var protoPath = path_1.default.resolve(__dirname, '../proto/proto/milvus.proto');
|
|
73
74
|
var MilvusClient = /** @class */ (function () {
|
|
74
75
|
/**
|
|
75
76
|
* Connect to milvus grpc client.
|
|
@@ -77,12 +78,30 @@ var MilvusClient = /** @class */ (function () {
|
|
|
77
78
|
* PartitionManager: control partition crud api
|
|
78
79
|
* IndexManager: control index crud api
|
|
79
80
|
* DataManager: Search | Query | Insert | Flush
|
|
81
|
+
* UserManager: control user crud api
|
|
82
|
+
*
|
|
80
83
|
* @param address milvus address like: 127.0.0.1:19530
|
|
84
|
+
* @param ssl ssl connect or not, default is false
|
|
85
|
+
* @param username After created user in Milvus, username is required
|
|
86
|
+
* @param password After created user in Milvus, password is required
|
|
87
|
+
*
|
|
81
88
|
*/
|
|
82
|
-
function MilvusClient(address) {
|
|
89
|
+
function MilvusClient(address, ssl, username, password) {
|
|
83
90
|
if (!address) {
|
|
84
91
|
throw new Error(ErrorReason_1.ERROR_REASONS.MILVUS_ADDRESS_IS_REQUIRED);
|
|
85
92
|
}
|
|
93
|
+
var authInterceptor = null;
|
|
94
|
+
if (username !== undefined && password !== undefined) {
|
|
95
|
+
authInterceptor = function (options, nextCall) {
|
|
96
|
+
return new grpc_js_1.InterceptingCall(nextCall(options), {
|
|
97
|
+
start: function (metadata, listener, next) {
|
|
98
|
+
var auth = Buffer.from(username + ":" + password, 'utf-8').toString('base64');
|
|
99
|
+
metadata.add('authorization', auth);
|
|
100
|
+
next(metadata, listener);
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
}
|
|
86
105
|
var packageDefinition = protoLoader.loadSync(protoPath, {
|
|
87
106
|
keepCase: true,
|
|
88
107
|
longs: String,
|
|
@@ -92,12 +111,18 @@ var MilvusClient = /** @class */ (function () {
|
|
|
92
111
|
});
|
|
93
112
|
var grpcObject = grpc_js_1.loadPackageDefinition(packageDefinition);
|
|
94
113
|
var milvusProto = grpcObject.milvus.proto.milvus;
|
|
95
|
-
var client = new milvusProto.MilvusService(address, grpc_js_1.credentials.createInsecure()
|
|
114
|
+
var client = new milvusProto.MilvusService(address, ssl ? grpc_js_1.credentials.createSsl() : grpc_js_1.credentials.createInsecure(), {
|
|
115
|
+
interceptors: [authInterceptor],
|
|
116
|
+
// Milvus default max_receive_message_length is 100MB, but Milvus support change max_receive_message_length .
|
|
117
|
+
// So SDK should support max_receive_message_length unlimited.
|
|
118
|
+
'grpc.max_receive_message_length': -1,
|
|
119
|
+
});
|
|
96
120
|
this.client = client;
|
|
97
121
|
this.collectionManager = new Collection_1.Collection(this.client);
|
|
98
122
|
this.partitionManager = new Partition_1.Partition(this.client);
|
|
99
123
|
this.indexManager = new MilvusIndex_1.Index(this.client);
|
|
100
124
|
this.dataManager = new Data_1.Data(this.client, this.collectionManager);
|
|
125
|
+
this.userManager = new User_1.User(this.client);
|
|
101
126
|
}
|
|
102
127
|
Object.defineProperty(MilvusClient, "sdkInfo", {
|
|
103
128
|
get: function () {
|
|
@@ -121,13 +146,13 @@ var MilvusClient = /** @class */ (function () {
|
|
|
121
146
|
return __generator(this, function (_d) {
|
|
122
147
|
switch (_d.label) {
|
|
123
148
|
case 0: return [4 /*yield*/, this.dataManager.getMetric({
|
|
124
|
-
request: { metric_type:
|
|
149
|
+
request: { metric_type: 'system_info' },
|
|
125
150
|
})];
|
|
126
151
|
case 1:
|
|
127
152
|
res = _d.sent();
|
|
128
153
|
curMilvusVersion = (_c = (_b = (_a = res.response.nodes_info[0]) === null || _a === void 0 ? void 0 : _a.infos) === null || _b === void 0 ? void 0 : _b.system_info) === null || _c === void 0 ? void 0 : _c.build_version;
|
|
129
154
|
if (curMilvusVersion !== MilvusClient.sdkInfo.recommandMilvus) {
|
|
130
|
-
console.warn(
|
|
155
|
+
console.warn('------- Warning ---------');
|
|
131
156
|
console.warn("Node sdk " + MilvusClient.sdkInfo.version + " recommend Milvus Version " + MilvusClient.sdkInfo.recommandMilvus + ".\nDifferent version may cause some error.");
|
|
132
157
|
return [2 /*return*/, { error_code: Response_1.ErrorCode.SUCCESS, match: false }];
|
|
133
158
|
}
|
package/dist/milvus/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../milvus/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAwB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AAW,CAAC,SAAS,CAAC;4BAC3C,OAAO,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE;yBACxC,CAAC,EAAA;;wBAFI,GAAG,GAAG,SAEV;wBAEI,gBAAgB,GACpB,MAAA,MAAA,MAAA,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,0CAAE,KAAK,0CAAE,WAAW,0CAAE,aAAa,CAAC;wBAChE,IAAI,gBAAgB,KAAK,YAAY,CAAC,OAAO,CAAC,eAAe,EAAE;4BAC7D,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;4BAC1C,OAAO,CAAC,IAAI,CACV,cAAY,YAAY,CAAC,OAAO,CAAC,OAAO,kCAA6B,YAAY,CAAC,OAAO,CAAC,eAAe,+CAA4C,CACtJ,CAAC;4BACF,sBAAO,EAAE,UAAU,EAAE,oBAAS,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAC;yBACxD;wBACD,sBAAO,EAAE,UAAU,EAAE,oBAAS,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAC;;;;KACvD;IAED,sCAAe,GAAf;QACE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,8BAA8B;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IACH,mBAAC;AAAD,CAAC,AA7GD,IA6GC;AA7GY,oCAAY"}
|
|
@@ -21,8 +21,16 @@ export interface CreateCollectionReq {
|
|
|
21
21
|
collection_name: string;
|
|
22
22
|
shards_num?: number;
|
|
23
23
|
description?: string;
|
|
24
|
+
consistency_level?: "Strong" | "Session" | "Bounded" | "Eventually" | "Customized";
|
|
24
25
|
fields: FieldType[];
|
|
25
26
|
}
|
|
27
|
+
export declare enum ConsistencyLevelEnum {
|
|
28
|
+
Strong = 0,
|
|
29
|
+
Session = 1,
|
|
30
|
+
Bounded = 2,
|
|
31
|
+
Eventually = 3,
|
|
32
|
+
Customized = 4
|
|
33
|
+
}
|
|
26
34
|
interface CollectionNameReq {
|
|
27
35
|
/**
|
|
28
36
|
* @param collection_name collection name string
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ShowCollectionsType = void 0;
|
|
3
|
+
exports.ConsistencyLevelEnum = exports.ShowCollectionsType = void 0;
|
|
4
4
|
var ShowCollectionsType;
|
|
5
5
|
(function (ShowCollectionsType) {
|
|
6
6
|
ShowCollectionsType[ShowCollectionsType["All"] = 0] = "All";
|
|
7
7
|
ShowCollectionsType[ShowCollectionsType["Loaded"] = 1] = "Loaded";
|
|
8
8
|
})(ShowCollectionsType = exports.ShowCollectionsType || (exports.ShowCollectionsType = {}));
|
|
9
|
+
var ConsistencyLevelEnum;
|
|
10
|
+
(function (ConsistencyLevelEnum) {
|
|
11
|
+
ConsistencyLevelEnum[ConsistencyLevelEnum["Strong"] = 0] = "Strong";
|
|
12
|
+
ConsistencyLevelEnum[ConsistencyLevelEnum["Session"] = 1] = "Session";
|
|
13
|
+
ConsistencyLevelEnum[ConsistencyLevelEnum["Bounded"] = 2] = "Bounded";
|
|
14
|
+
ConsistencyLevelEnum[ConsistencyLevelEnum["Eventually"] = 3] = "Eventually";
|
|
15
|
+
ConsistencyLevelEnum[ConsistencyLevelEnum["Customized"] = 4] = "Customized";
|
|
16
|
+
})(ConsistencyLevelEnum = exports.ConsistencyLevelEnum || (exports.ConsistencyLevelEnum = {}));
|
|
9
17
|
//# sourceMappingURL=Collection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collection.js","sourceRoot":"","sources":["../../../milvus/types/Collection.ts"],"names":[],"mappings":";;;AAaA,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,2DAAG,CAAA;IACH,iEAAM,CAAA;AACR,CAAC,EAHW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAG9B"}
|
|
1
|
+
{"version":3,"file":"Collection.js","sourceRoot":"","sources":["../../../milvus/types/Collection.ts"],"names":[],"mappings":";;;AAaA,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,2DAAG,CAAA;IACH,iEAAM,CAAA;AACR,CAAC,EAHW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAG9B;AAqBD,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC9B,mEAAU,CAAA;IACV,qEAAW,CAAA;IACX,qEAAW,CAAA;IACX,2EAAc,CAAA;IACd,2EAAc,CAAA;AAChB,CAAC,EANW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAM/B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConsistencyLevelEnum } from './Collection';
|
|
2
|
+
import { IndexState, KeyValuePair, NumberArrayId, SegmentState, StringArrayId, CompactionState } from './Common';
|
|
2
3
|
export declare enum ErrorCode {
|
|
3
4
|
SUCCESS = "Success",
|
|
4
5
|
INDEX_NOT_EXIST = "IndexNotExist",
|
|
@@ -48,6 +49,7 @@ export interface DescribeCollectionResponse extends TimeStamp {
|
|
|
48
49
|
status: ResStatus;
|
|
49
50
|
schema: CollectionSchema;
|
|
50
51
|
collectionID: string;
|
|
52
|
+
consistency_level: ConsistencyLevelEnum;
|
|
51
53
|
virtual_channel_names: string[];
|
|
52
54
|
physical_channel_names: string[];
|
|
53
55
|
}
|
|
@@ -159,4 +161,8 @@ export interface GetCompactionPlansResponse {
|
|
|
159
161
|
target: number;
|
|
160
162
|
}[];
|
|
161
163
|
}
|
|
164
|
+
export interface ListCredUsersResponse {
|
|
165
|
+
status: ResStatus;
|
|
166
|
+
usernames: string[];
|
|
167
|
+
}
|
|
162
168
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Response.js","sourceRoot":"","sources":["../../../milvus/types/Response.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Response.js","sourceRoot":"","sources":["../../../milvus/types/Response.ts"],"names":[],"mappings":";;;AAUA,IAAY,SA0BX;AA1BD,WAAY,SAAS;IACnB,gCAAmB,CAAA;IACnB,8CAAiC,CAAA;IACjC,iDAAoC,CAAA;IACpC,qCAAqC;IACrC,2CAA2C;IAC3C,mDAAmD;IACnD,yCAAyC;IACzC,2CAA2C;IAC3C,6CAA6C;IAC7C,uDAAuD;IACvD,iCAAiC;IACjC,2CAA2C;IAC3C,2CAA2C;IAC3C,mDAAmD;IACnD,qCAAqC;IACrC,+BAA+B;IAC/B,iCAAiC;IACjC,iDAAiD;IACjD,6CAA6C;IAC7C,iDAAiD;IACjD,6CAA6C;IAC7C,2CAA2C;IAC3C,mCAAmC;IACnC,+CAA+C;IAC/C,mCAAmC;AACrC,CAAC,EA1BW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QA0BpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../../milvus/types/User.ts"],"names":[],"mappings":""}
|
package/dist/milvus/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
1
|
+
export * from "./types/Collection";
|
|
2
|
+
export * from "./types/Data";
|
|
3
|
+
export * from "./types/Common";
|
|
4
|
+
export * from "./types/Index";
|
|
5
|
+
export * from "./types/Partition";
|
|
6
|
+
export * from "./types/Response";
|
|
7
|
+
export * from "./types/Search";
|
package/dist/milvus/types.js
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./types/Collection"), exports);
|
|
14
|
+
__exportStar(require("./types/Data"), exports);
|
|
15
|
+
__exportStar(require("./types/Common"), exports);
|
|
16
|
+
__exportStar(require("./types/Index"), exports);
|
|
17
|
+
__exportStar(require("./types/Partition"), exports);
|
|
18
|
+
__exportStar(require("./types/Response"), exports);
|
|
19
|
+
__exportStar(require("./types/Search"), exports);
|
|
3
20
|
//# sourceMappingURL=types.js.map
|
package/dist/milvus/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../milvus/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../milvus/types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmC;AAEnC,+CAA6B;AAE7B,iDAA+B;AAE/B,gDAA8B;AAE9B,oDAAkC;AAElC,mDAAiC;AAEjC,iDAA+B"}
|
|
@@ -45,7 +45,7 @@ export declare const formatNumberPrecision: (number: number, precision: number)
|
|
|
45
45
|
* const res = hybridtsToUnixtime("429642767925248000");
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
|
-
export declare const hybridtsToUnixtime: (hybridts:
|
|
48
|
+
export declare const hybridtsToUnixtime: (hybridts: bigint | string) => string;
|
|
49
49
|
/**
|
|
50
50
|
* Generate a hybrid timestamp based on Unix Epoch time, timedelta and incremental time internval.
|
|
51
51
|
*
|
|
@@ -68,7 +68,7 @@ export declare const hybridtsToUnixtime: (hybridts: BigInt | string) => string;
|
|
|
68
68
|
* const res = unixtimeToHybridts("429642767925248000");
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
|
-
export declare const unixtimeToHybridts: (unixtime:
|
|
71
|
+
export declare const unixtimeToHybridts: (unixtime: bigint | string) => string;
|
|
72
72
|
/**
|
|
73
73
|
* Generate a hybrid timestamp based on datetime。
|
|
74
74
|
*
|
|
@@ -92,3 +92,4 @@ export declare const unixtimeToHybridts: (unixtime: BigInt | string) => string;
|
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
94
|
export declare const datetimeToHybrids: (datetime: Date) => string;
|
|
95
|
+
export declare const stringToBase64: (str: string) => string;
|
|
@@ -5,7 +5,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
|
5
5
|
return to;
|
|
6
6
|
};
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.datetimeToHybrids = exports.unixtimeToHybridts = exports.hybridtsToUnixtime = exports.formatNumberPrecision = exports.parseToKeyValue = exports.formatKeyValueData = void 0;
|
|
8
|
+
exports.stringToBase64 = exports.datetimeToHybrids = exports.unixtimeToHybridts = exports.hybridtsToUnixtime = exports.formatNumberPrecision = exports.parseToKeyValue = exports.formatKeyValueData = void 0;
|
|
9
9
|
var index_1 = require("./index");
|
|
10
10
|
var ErrorReason_1 = require("../const/ErrorReason");
|
|
11
11
|
/**
|
|
@@ -156,4 +156,6 @@ var datetimeToHybrids = function (datetime) {
|
|
|
156
156
|
return exports.unixtimeToHybridts((datetime.getTime() / 1000).toString());
|
|
157
157
|
};
|
|
158
158
|
exports.datetimeToHybrids = datetimeToHybrids;
|
|
159
|
+
var stringToBase64 = function (str) { return Buffer.from(str, 'utf-8').toString('base64'); };
|
|
160
|
+
exports.stringToBase64 = stringToBase64;
|
|
159
161
|
//# sourceMappingURL=Format.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Format.js","sourceRoot":"","sources":["../../../milvus/utils/Format.ts"],"names":[],"mappings":";;;;;;;;AAAA,iCAAuC;AACvC,oDAAqD;AAGrD;;;;;GAKG;AACI,IAAM,kBAAkB,GAAG,UAAC,IAAoB,EAAE,IAAc;IACrE,IAAM,MAAM,GAAyB,EAAE,CAAC;IACxC,IAAI,CAAC,OAAO,CAAC,UAAC,CAAC;QACb,IAAM,KAAK,GAAG,oBAAY,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACpC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AARW,QAAA,kBAAkB,sBAQ7B;AAEF;;;;GAIG;AACI,IAAM,eAAe,GAAG,UAAC,IAE/B;IACC,OAAO,IAAI;QACT,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"Format.js","sourceRoot":"","sources":["../../../milvus/utils/Format.ts"],"names":[],"mappings":";;;;;;;;AAAA,iCAAuC;AACvC,oDAAqD;AAGrD;;;;;GAKG;AACI,IAAM,kBAAkB,GAAG,UAAC,IAAoB,EAAE,IAAc;IACrE,IAAM,MAAM,GAAyB,EAAE,CAAC;IACxC,IAAI,CAAC,OAAO,CAAC,UAAC,CAAC;QACb,IAAM,KAAK,GAAG,oBAAY,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACpC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AARW,QAAA,kBAAkB,sBAQ7B;AAEF;;;;GAIG;AACI,IAAM,eAAe,GAAG,UAAC,IAE/B;IACC,OAAO,IAAI;QACT,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CACxB,UAAC,GAAU,EAAE,GAAW,IAAK,uCAAI,GAAG,IAAE,EAAE,GAAG,E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