@zilliz/milvus2-sdk-node 2.3.4 → 2.4.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.
Files changed (122) hide show
  1. package/README.md +154 -35
  2. package/dist/milvus/HttpClient.d.ts +165 -2
  3. package/dist/milvus/HttpClient.js +17 -3
  4. package/dist/milvus/HttpClient.js.map +1 -1
  5. package/dist/milvus/MilvusClient.d.ts +3 -3
  6. package/dist/milvus/MilvusClient.js +42 -8
  7. package/dist/milvus/MilvusClient.js.map +1 -1
  8. package/dist/milvus/const/client.d.ts +4 -3
  9. package/dist/milvus/const/client.js +4 -3
  10. package/dist/milvus/const/client.js.map +1 -1
  11. package/dist/milvus/const/defaults.d.ts +5 -4
  12. package/dist/milvus/const/defaults.js +14 -13
  13. package/dist/milvus/const/defaults.js.map +1 -1
  14. package/dist/milvus/const/error.js +1 -1
  15. package/dist/milvus/const/error.js.map +1 -1
  16. package/dist/milvus/const/milvus.d.ts +45 -8
  17. package/dist/milvus/const/milvus.js +41 -3
  18. package/dist/milvus/const/milvus.js.map +1 -1
  19. package/dist/milvus/grpc/BaseClient.d.ts +11 -9
  20. package/dist/milvus/grpc/BaseClient.js +59 -21
  21. package/dist/milvus/grpc/BaseClient.js.map +1 -1
  22. package/dist/milvus/grpc/Collection.d.ts +311 -366
  23. package/dist/milvus/grpc/Collection.js +355 -387
  24. package/dist/milvus/grpc/Collection.js.map +1 -1
  25. package/dist/milvus/grpc/Data.d.ts +244 -291
  26. package/dist/milvus/grpc/Data.js +402 -539
  27. package/dist/milvus/grpc/Data.js.map +1 -1
  28. package/dist/milvus/grpc/Database.d.ts +29 -41
  29. package/dist/milvus/grpc/Database.js +32 -44
  30. package/dist/milvus/grpc/Database.js.map +1 -1
  31. package/dist/milvus/grpc/GrpcClient.d.ts +34 -13
  32. package/dist/milvus/grpc/GrpcClient.js +80 -70
  33. package/dist/milvus/grpc/GrpcClient.js.map +1 -1
  34. package/dist/milvus/grpc/MilvusIndex.d.ts +127 -67
  35. package/dist/milvus/grpc/MilvusIndex.js +166 -70
  36. package/dist/milvus/grpc/MilvusIndex.js.map +1 -1
  37. package/dist/milvus/grpc/Partition.d.ts +78 -113
  38. package/dist/milvus/grpc/Partition.js +109 -119
  39. package/dist/milvus/grpc/Partition.js.map +1 -1
  40. package/dist/milvus/grpc/Resource.d.ts +63 -92
  41. package/dist/milvus/grpc/Resource.js +69 -98
  42. package/dist/milvus/grpc/Resource.js.map +1 -1
  43. package/dist/milvus/grpc/User.d.ts +263 -295
  44. package/dist/milvus/grpc/User.js +287 -310
  45. package/dist/milvus/grpc/User.js.map +1 -1
  46. package/dist/milvus/http/Alias.d.ts +37 -0
  47. package/dist/milvus/http/Alias.js +62 -0
  48. package/dist/milvus/http/Alias.js.map +1 -0
  49. package/dist/milvus/http/Collection.d.ts +15 -1
  50. package/dist/milvus/http/Collection.js +55 -9
  51. package/dist/milvus/http/Collection.js.map +1 -1
  52. package/dist/milvus/http/Import.d.ts +33 -0
  53. package/dist/milvus/http/Import.js +48 -0
  54. package/dist/milvus/http/Import.js.map +1 -0
  55. package/dist/milvus/http/MilvusIndex.d.ts +35 -0
  56. package/dist/milvus/http/MilvusIndex.js +55 -0
  57. package/dist/milvus/http/MilvusIndex.js.map +1 -0
  58. package/dist/milvus/http/Partition.d.ts +41 -0
  59. package/dist/milvus/http/Partition.js +76 -0
  60. package/dist/milvus/http/Partition.js.map +1 -0
  61. package/dist/milvus/http/Role.d.ts +39 -0
  62. package/dist/milvus/http/Role.js +69 -0
  63. package/dist/milvus/http/Role.js.map +1 -0
  64. package/dist/milvus/http/User.d.ts +41 -0
  65. package/dist/milvus/http/User.js +76 -0
  66. package/dist/milvus/http/User.js.map +1 -0
  67. package/dist/milvus/http/Vector.d.ts +5 -3
  68. package/dist/milvus/http/Vector.js +10 -7
  69. package/dist/milvus/http/Vector.js.map +1 -1
  70. package/dist/milvus/http/index.d.ts +6 -0
  71. package/dist/milvus/http/index.js +6 -0
  72. package/dist/milvus/http/index.js.map +1 -1
  73. package/dist/milvus/index.d.ts +0 -1
  74. package/dist/milvus/index.js +0 -1
  75. package/dist/milvus/index.js.map +1 -1
  76. package/dist/milvus/types/Client.d.ts +5 -0
  77. package/dist/milvus/types/Collection.d.ts +34 -9
  78. package/dist/milvus/types/Common.d.ts +1 -3
  79. package/dist/milvus/types/Data.d.ts +79 -23
  80. package/dist/milvus/types/Data.js +1 -0
  81. package/dist/milvus/types/Data.js.map +1 -1
  82. package/dist/milvus/types/HighLevel.d.ts +6 -3
  83. package/dist/milvus/types/Http.d.ts +191 -9
  84. package/dist/milvus/types/MilvusIndex.d.ts +17 -3
  85. package/dist/milvus/types/User.d.ts +10 -9
  86. package/dist/milvus/utils/Bytes.d.ts +84 -0
  87. package/dist/milvus/utils/Bytes.js +261 -0
  88. package/dist/milvus/utils/Bytes.js.map +1 -0
  89. package/dist/milvus/utils/Format.d.ts +126 -68
  90. package/dist/milvus/utils/Format.js +375 -94
  91. package/dist/milvus/utils/Format.js.map +1 -1
  92. package/dist/milvus/utils/Function.d.ts +4 -2
  93. package/dist/milvus/utils/Function.js +58 -25
  94. package/dist/milvus/utils/Function.js.map +1 -1
  95. package/dist/milvus/utils/Grpc.d.ts +3 -2
  96. package/dist/milvus/utils/Grpc.js +65 -98
  97. package/dist/milvus/utils/Grpc.js.map +1 -1
  98. package/dist/milvus/utils/Validate.d.ts +18 -3
  99. package/dist/milvus/utils/Validate.js +38 -12
  100. package/dist/milvus/utils/Validate.js.map +1 -1
  101. package/dist/milvus/utils/index.d.ts +1 -1
  102. package/dist/milvus/utils/index.js +1 -1
  103. package/dist/milvus/utils/index.js.map +1 -1
  104. package/dist/proto/proto/common.proto +29 -1
  105. package/dist/proto/proto/google/protobuf/descriptor.proto +96 -34
  106. package/dist/proto/proto/milvus.proto +168 -2
  107. package/dist/proto/proto/rg.proto +28 -0
  108. package/dist/proto/proto/schema.proto +36 -0
  109. package/dist/sdk.json +1 -1
  110. package/package.json +8 -5
  111. package/dist/milvus/OrmClient.d.ts +0 -19
  112. package/dist/milvus/OrmClient.js +0 -51
  113. package/dist/milvus/OrmClient.js.map +0 -1
  114. package/dist/milvus/orm/Collection.d.ts +0 -43
  115. package/dist/milvus/orm/Collection.js +0 -165
  116. package/dist/milvus/orm/Collection.js.map +0 -1
  117. package/dist/milvus/orm/index.d.ts +0 -1
  118. package/dist/milvus/orm/index.js +0 -18
  119. package/dist/milvus/orm/index.js.map +0 -1
  120. package/dist/milvus/utils/Blob.d.ts +0 -4
  121. package/dist/milvus/utils/Blob.js +0 -18
  122. package/dist/milvus/utils/Blob.js.map +0 -1
@@ -13,28 +13,40 @@ exports.User = void 0;
13
13
  const Resource_1 = require("./Resource");
14
14
  const __1 = require("../");
15
15
  class User extends Resource_1.Resource {
16
+ constructor() {
17
+ super(...arguments);
18
+ // alias
19
+ this.updatePassword = this.updateUser;
20
+ this.dropUser = this.deleteUser;
21
+ // alias
22
+ this.grantRole = this.addUserToRole;
23
+ // alias
24
+ this.revokeRole = this.removeUserFromRole;
25
+ // alias
26
+ this.selectRole = this.describeRole;
27
+ // alias
28
+ this.selectUser = this.describeUser;
29
+ // alias
30
+ this.grantRolePrivilege = this.grantPrivilege;
31
+ this.revokeRolePrivilege = this.revokePrivilege;
32
+ }
16
33
  /**
17
- * Create user in milvus
18
- *
19
- * @param data
20
- * | Property | Type | Description |
21
- * | :-- | :-- | :-- |
22
- * | username | String | username |
23
- * | password | String | user password |
24
- * | 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 |
34
+ * Creates a new user in Milvus.
25
35
  *
26
- * @returns
27
- * | Property | Description |
28
- * | :-- | :-- |
29
- * | error_code | Error code number |
30
- * | reason | Error cause|
36
+ * @param {CreateUserReq} data - The user data.
37
+ * @param {string} data.username - The username of the new user.
38
+ * @param {string} data.password - The password for the new user.
39
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
31
40
  *
32
- * #### Example
41
+ * @returns {Promise<ResStatus>} The response status.
42
+ * @returns {number} ResStatus.error_code - The error code number.
43
+ * @returns {string} ResStatus.reason - The cause of the error, if any.
33
44
  *
34
- * ```
45
+ * @example
46
+ * ```javascript
35
47
  * milvusClient.createUser({
36
- * username: NAME,
37
- * password: PASSWORD,
48
+ * username: 'exampleUser',
49
+ * password: 'examplePassword',
38
50
  * });
39
51
  * ```
40
52
  */
@@ -44,7 +56,7 @@ class User extends Resource_1.Resource {
44
56
  throw new Error(__1.ERROR_REASONS.USERNAME_PWD_ARE_REQUIRED);
45
57
  }
46
58
  const encryptedPassword = (0, __1.stringToBase64)(data.password);
47
- const promise = yield (0, __1.promisify)(this.client, 'CreateCredential', {
59
+ const promise = yield (0, __1.promisify)(this.channelPool, 'CreateCredential', {
48
60
  username: data.username,
49
61
  password: encryptedPassword,
50
62
  }, data.timeout || this.timeout);
@@ -52,28 +64,24 @@ class User extends Resource_1.Resource {
52
64
  });
53
65
  }
54
66
  /**
55
- * Update user in milvus
56
- *
57
- * @param data
58
- * | Property | Type | Description |
59
- * | :-- | :-- | :-- |
60
- * | username | String | username |
61
- * | password | String | user password |
62
- * | 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 |
67
+ * Update user in Milvus.
63
68
  *
64
- * @returns
65
- * | Property | Description |
66
- * | :-- | :-- |
67
- * | error_code | Error code number |
68
- * | reason | Error cause|
69
+ * @param {UpdateUserReq} data - The user data.
70
+ * @param {string} data.username - The username of the user to be updated.
71
+ * @param {string} data.newPassword - The new password for the user.
72
+ * @param {string} data.oldPassword - The old password of the user.
73
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
69
74
  *
70
- * #### Example
75
+ * @returns {Promise<ResStatus>} The response status.
76
+ * @returns {number} ResStatus.error_code - The error code number.
77
+ * @returns {string} ResStatus.reason - The cause of the error, if any.
71
78
  *
72
- * ```
79
+ * @example
80
+ * ```javascript
73
81
  * milvusClient.updateUser({
74
- * username: NAME,
75
- * newPassword: PASSWORD,
76
- * oldPassword: PASSWORD,
82
+ * username: 'exampleUser',
83
+ * newPassword: 'newPassword',
84
+ * oldPassword: 'oldPassword',
77
85
  * });
78
86
  * ```
79
87
  */
@@ -86,7 +94,7 @@ class User extends Resource_1.Resource {
86
94
  }
87
95
  const encryptedOldPwd = (0, __1.stringToBase64)(data.oldPassword);
88
96
  const encryptedNewPwd = (0, __1.stringToBase64)(data.newPassword);
89
- const promise = yield (0, __1.promisify)(this.client, 'UpdateCredential', {
97
+ const promise = yield (0, __1.promisify)(this.channelPool, 'UpdateCredential', {
90
98
  username: data.username,
91
99
  oldPassword: encryptedOldPwd,
92
100
  newPassword: encryptedNewPwd,
@@ -95,26 +103,20 @@ class User extends Resource_1.Resource {
95
103
  });
96
104
  }
97
105
  /**
98
- * Delete user in milvus
99
- *
100
- * @param data
101
- * | Property | Type | Description |
102
- * | :-- | :-- | :-- |
103
- * | username | String | username |
104
- * | 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 |
106
+ * Lists all users in Milvus.
105
107
  *
106
- * @returns
107
- * | Property | Description |
108
- * | :-- | :-- |
109
- * | error_code | Error code number |
110
- * | reason | Error cause|
108
+ * @param {Object} data - The data object.
109
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
111
110
  *
112
- * #### Example
111
+ * @returns {Promise<Object>} The response object.
112
+ * @returns {Object} response.status - The response status.
113
+ * @returns {number} response.status.error_code - The error code number.
114
+ * @returns {string} response.status.reason - The cause of the error, if any.
115
+ * @returns {string[]} response.usernames - An array of usernames.
113
116
  *
114
- * ```
115
- * milvusClient.deleteUser({
116
- * username: NAME,
117
- * });
117
+ * @example
118
+ * ```javascript
119
+ * milvusClient.listUsers();
118
120
  * ```
119
121
  */
120
122
  deleteUser(data) {
@@ -122,121 +124,110 @@ class User extends Resource_1.Resource {
122
124
  if (!data.username) {
123
125
  throw new Error(__1.ERROR_REASONS.USERNAME_IS_REQUIRED);
124
126
  }
125
- const promise = yield (0, __1.promisify)(this.client, 'DeleteCredential', {
127
+ const promise = yield (0, __1.promisify)(this.channelPool, 'DeleteCredential', {
126
128
  username: data.username,
127
129
  }, data.timeout || this.timeout);
128
130
  return promise;
129
131
  });
130
132
  }
131
133
  /**
132
- * List user in milvus
133
- *
134
- * @param data
135
- * | Property | Type | Description |
136
- * | :-- | :-- | :-- |
137
- * | 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 |
134
+ * Lists all users in Milvus.
138
135
  *
139
- * @returns
140
- * | Property | Description |
141
- * | :-- | :-- |
142
- * | status | { error_code: number, reason: string } |
143
- * | usernames | string[] |
136
+ * @param {ListUsersReq} data - The data object.
137
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
144
138
  *
145
- * #### Example
139
+ * @returns {Promise<ListCredUsersResponse>} The response object.
140
+ * @returns {ResStatus} response.status - The response status.
141
+ * @returns {number} response.status.error_code - The error code number.
142
+ * @returns {string} response.status.reason - The cause of the error, if any.
143
+ * @returns {string[]} response.usernames - An array of usernames.
146
144
  *
147
- * ```
145
+ * @example
146
+ * ```javascript
148
147
  * milvusClient.listUsers();
149
148
  * ```
150
149
  */
151
150
  listUsers(data) {
152
151
  return __awaiter(this, void 0, void 0, function* () {
153
- const promise = yield (0, __1.promisify)(this.client, 'ListCredUsers', {}, (data === null || data === void 0 ? void 0 : data.timeout) || this.timeout);
152
+ const promise = yield (0, __1.promisify)(this.channelPool, 'ListCredUsers', {}, (data === null || data === void 0 ? void 0 : data.timeout) || this.timeout);
154
153
  return promise;
155
154
  });
156
155
  }
157
156
  /**
158
- * Create user role
159
- *
160
- * @param data
161
- * | Property | Type | Description |
162
- * | :-- | :-- | :-- |
163
- * | roleName | String | role name |
164
- * | 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 |
157
+ * Create a new role in Milvus.
165
158
  *
166
- * @returns
167
- * | Property | Description |
168
- * | :-- | :-- |
169
- * | status | { error_code: number, reason: string } |
170
- * | reason | '' |
159
+ * @param {CreateRoleReq} data - The role data.
160
+ * @param {string} data.roleName - The name of the new role.
161
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
171
162
  *
172
- * #### Example
163
+ * @returns {Promise<ResStatus>} The response status.
164
+ * @returns {number} ResStatus.error_code - The error code number.
165
+ * @returns {string} ResStatus.reason - The cause of the error, if any.
173
166
  *
174
- * ```
175
- * milvusClient.createRole({roleName: 'myrole'});
167
+ * @example
168
+ * ```javascript
169
+ * milvusClient.createRole({
170
+ * roleName: 'exampleRole',
171
+ * });
176
172
  * ```
177
173
  */
178
174
  createRole(data) {
179
175
  return __awaiter(this, void 0, void 0, function* () {
180
- const promise = yield (0, __1.promisify)(this.client, 'CreateRole', {
176
+ const promise = yield (0, __1.promisify)(this.channelPool, 'CreateRole', {
181
177
  entity: { name: data.roleName },
182
178
  }, data.timeout || this.timeout);
183
179
  return promise;
184
180
  });
185
181
  }
186
182
  /**
187
- * Drop user role
183
+ * Drops a user role in Milvus.
188
184
  *
189
- * @param data
190
- * | Property | Type | Description |
191
- * | :-- | :-- | :-- |
192
- * | roleName | String | User name |
193
- * | 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 |
185
+ * @param {DropRoleReq} data - The data object.
186
+ * @param {string} data.roleName - The name of the role to be dropped.
187
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
194
188
  *
195
- * @returns
196
- * | Property | Description |
197
- * | :-- | :-- |
198
- * | status | { error_code: number, reason: string } |
199
- * | reason | '' |
189
+ * @returns {Promise<ResStatus>} The response status.
190
+ * @returns {number} ResStatus.error_code - The error code number.
191
+ * @returns {string} ResStatus.reason - The cause of the error, if any.
200
192
  *
201
- * #### Example
202
- *
203
- * ```
204
- * milvusClient.dropRole({roleName: 'myrole'});
193
+ * @example
194
+ * ```javascript
195
+ * milvusClient.dropRole({
196
+ * roleName: 'exampleRole',
197
+ * });
205
198
  * ```
206
199
  */
207
200
  dropRole(data) {
208
201
  return __awaiter(this, void 0, void 0, function* () {
209
- const promise = yield (0, __1.promisify)(this.client, 'DropRole', {
202
+ const promise = yield (0, __1.promisify)(this.channelPool, 'DropRole', {
210
203
  role_name: data.roleName,
211
204
  }, data.timeout || this.timeout);
212
205
  return promise;
213
206
  });
214
207
  }
215
208
  /**
216
- * add user to role
217
- *
218
- * @param data
219
- * | Property | Type | Description |
220
- * | :-- | :-- | :-- |
221
- * | username | String | User name |
222
- * | roleName | String | Role name |
223
- * | 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 |
224
- *
225
- * @returns
226
- * | Property | Description |
227
- * | :-- | :-- |
228
- * | status | { error_code: number, reason: string } |
229
- * | reason | '' |
230
- *
231
- * #### Example
232
- *
233
- * ```
234
- * milvusClient.addUserToRole({username: 'my', roleName: 'myrole'});
209
+ * Adds a user to a role.
210
+ *
211
+ * @param {AddUserToRoleReq} data - The data object.
212
+ * @param {string} data.username - The username of the user to be added to the role.
213
+ * @param {string} data.roleName - The name of the role to which the user will be added.
214
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
215
+ *
216
+ * @returns {Promise<ResStatus>} The response status.
217
+ * @returns {number} ResStatus.error_code - The error code number.
218
+ * @returns {string} ResStatus.reason - The cause of the error, if any.
219
+ *
220
+ * @example
221
+ * ```javascript
222
+ * milvusClient.addUserToRole({
223
+ * username: 'my',
224
+ * roleName: 'myrole'
225
+ * });
235
226
  * ```
236
227
  */
237
228
  addUserToRole(data) {
238
229
  return __awaiter(this, void 0, void 0, function* () {
239
- const promise = yield (0, __1.promisify)(this.client, 'OperateUserRole', {
230
+ const promise = yield (0, __1.promisify)(this.channelPool, 'OperateUserRole', {
240
231
  username: data.username,
241
232
  role_name: data.roleName,
242
233
  type: __1.OperateUserRoleType.AddUserToRole,
@@ -245,30 +236,28 @@ class User extends Resource_1.Resource {
245
236
  });
246
237
  }
247
238
  /**
248
- * remove user from role
249
- *
250
- * @param data
251
- * | Property | Type | Description |
252
- * | :-- | :-- | :-- |
253
- * | username | String | User name |
254
- * | roleName | String | Role name |
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
- *
257
- * @returns
258
- * | Property | Description |
259
- * | :-- | :-- |
260
- * | status | { error_code: number, reason: string } |
261
- * | reason | '' |
262
- *
263
- * #### Example
264
- *
265
- * ```
266
- * milvusClient.removeUserFromRole({username: 'my', roleName: 'myrole'});
239
+ * Removes a user from a role.
240
+ *
241
+ * @param {RemoveUserFromRoleReq} data - The data object.
242
+ * @param {string} data.username - The username of the user to be removed from the role.
243
+ * @param {string} data.roleName - The name of the role from which the user will be removed.
244
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
245
+ *
246
+ * @returns {Promise<ResStatus>} The response status.
247
+ * @returns {number} ResStatus.error_code - The error code number.
248
+ * @returns {string} ResStatus.reason - The cause of the error, if any.
249
+ *
250
+ * @example
251
+ * ```javascript
252
+ * milvusClient.removeUserFromRole({
253
+ * username: 'my',
254
+ * roleName: 'myrole'
255
+ * });
267
256
  * ```
268
257
  */
269
258
  removeUserFromRole(data) {
270
259
  return __awaiter(this, void 0, void 0, function* () {
271
- const promise = yield (0, __1.promisify)(this.client, 'OperateUserRole', {
260
+ const promise = yield (0, __1.promisify)(this.channelPool, 'OperateUserRole', {
272
261
  username: data.username,
273
262
  role_name: data.roleName,
274
263
  type: __1.OperateUserRoleType.RemoveUserFromRole,
@@ -277,30 +266,31 @@ class User extends Resource_1.Resource {
277
266
  });
278
267
  }
279
268
  /**
280
- * gets all users that belong to a specified role
281
- *
282
- * @param data
283
- * | Property | Type | Description |
284
- * | :-- | :-- | :-- |
285
- * | roleName | String | Role name |
286
- * | includeUserInfo? | boolean | should result including user info, by default: true |
287
- * | 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 |
288
-
289
- * @returns
290
- * | Property | Description |
291
- * | :-- | :-- |
292
- * | status | { error_code: number, reason: string } |
293
- * | results | { users: {name: string}[]; role: {name: string} }[] |
294
- *
295
- * #### Example
296
- *
297
- * ```
298
- * milvusClient.selectRole({roleName: 'myrole'});
269
+ * Gets all users that belong to a specified role.
270
+ *
271
+ * @param {Object} data - The data object.
272
+ * @param {string} data.roleName - The name of the role.
273
+ * @param {boolean} [data.includeUserInfo=true] - Determines whether the result should include user info.
274
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
275
+ *
276
+ * @returns {Promise<Object>} The response object.
277
+ * @returns {Object} response.status - The response status.
278
+ * @returns {number} response.status.error_code - The error code number.
279
+ * @returns {string} response.status.reason - The cause of the error, if any.
280
+ * @returns {Object[]} response.results - An array of objects, each containing a list of users and a role.
281
+ * @returns {Object[]} response.results.users - An array of user objects.
282
+ * @returns {string} response.results.users.name - The name of the user.
283
+ * @returns {Object} response.results.role - The role object.
284
+ * @returns {string} response.results.role.name - The name of the role.
285
+ *
286
+ * @example
287
+ * ```javascript
288
+ * milvusClient.describeRole({roleName: 'myrole'});
299
289
  * ```
300
290
  */
301
- selectRole(data) {
291
+ describeRole(data) {
302
292
  return __awaiter(this, void 0, void 0, function* () {
303
- const promise = yield (0, __1.promisify)(this.client, 'SelectRole', {
293
+ const promise = yield (0, __1.promisify)(this.channelPool, 'SelectRole', {
304
294
  role: { name: data.roleName },
305
295
  include_user_info: data.includeUserInfo || true,
306
296
  }, data.timeout || this.timeout);
@@ -308,58 +298,57 @@ class User extends Resource_1.Resource {
308
298
  });
309
299
  }
310
300
  /**
311
- * list all roles
301
+ * Lists all roles in Milvus.
312
302
  *
313
- * @param data
314
- * | Property | Type | Description |
315
- * | :-- | :-- | :-- |
316
- * | 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 |
303
+ * @param {Object} data - The data object.
304
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
317
305
  *
318
- * @returns
319
- * | Property | Description |
320
- * | :-- | :-- |
321
- * | status | { error_code: number, reason: string } |
322
- * | reason | '' |
306
+ * @returns {Promise<Object>} The response object.
307
+ * @returns {Object} response.status - The response status.
308
+ * @returns {number} response.status.error_code - The error code number.
309
+ * @returns {string} response.status.reason - The cause of the error, if any.
310
+ * @returns {Object[]} response.results - An array of objects, each containing a role.
311
+ * @returns {string} response.results.role.name - The name of the role.
323
312
  *
324
- * #### Example
325
- *
326
- * ```
313
+ * @example
314
+ * ```javascript
327
315
  * milvusClient.listRoles();
328
316
  * ```
329
317
  */
330
318
  listRoles(data) {
331
319
  return __awaiter(this, void 0, void 0, function* () {
332
- const promise = yield (0, __1.promisify)(this.client, 'SelectRole', {
320
+ const promise = yield (0, __1.promisify)(this.channelPool, 'SelectRole', {
333
321
  include_user_info: (data === null || data === void 0 ? void 0 : data.includeUserInfo) || true,
334
322
  }, (data === null || data === void 0 ? void 0 : data.timeout) || this.timeout);
335
323
  return promise;
336
324
  });
337
325
  }
338
326
  /**
339
- * gets all users that belong to a specified role
340
- *
341
- * @param data
342
- * | Property | Type | Description |
343
- * | :-- | :-- | :-- |
344
- * | userName | String | User name |
345
- * | includeUserInfo? | boolean | should result including user info, by default: true |
346
- * | 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 |
347
- *
348
- * @returns
349
- * | Property | Description |
350
- * | :-- | :-- |
351
- * | status | { error_code: number, reason: string } |
352
- * | results | user: {name: string}; roles: {name: string}[] |
353
- *
354
- * #### Example
355
- *
356
- * ```
357
- * milvusClient.selectUser({username: 'name'});
327
+ * Gets all users that belong to a specified role.
328
+ *
329
+ * @param {Object} data - The data object.
330
+ * @param {string} data.userName - The username of the user.
331
+ * @param {boolean} [data.includeUserInfo=true] - Determines whether the result should include user info.
332
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
333
+ *
334
+ * @returns {Promise<Object>} The response object.
335
+ * @returns {Object} response.status - The response status.
336
+ * @returns {number} response.status.error_code - The error code number.
337
+ * @returns {string} response.status.reason - The cause of the error, if any.
338
+ * @returns {Object[]} response.results - An array of objects, each containing a user and a list of roles.
339
+ * @returns {Object} response.results.user - The user object.
340
+ * @returns {string} response.results.user.name - The name of the user.
341
+ * @returns {Object[]} response.results.roles - An array of role objects.
342
+ * @returns {string} response.results.roles.name - The name of the role.
343
+ *
344
+ * @example
345
+ * ```javascript
346
+ * milvusClient.describeUser({username: 'name'});
358
347
  * ```
359
348
  */
360
- selectUser(data) {
349
+ describeUser(data) {
361
350
  return __awaiter(this, void 0, void 0, function* () {
362
- const promise = yield (0, __1.promisify)(this.client, 'SelectUser', {
351
+ const promise = yield (0, __1.promisify)(this.channelPool, 'SelectUser', {
363
352
  user: { name: data.username },
364
353
  include_role_info: data.includeRoleInfo || true,
365
354
  }, data.timeout || this.timeout);
@@ -367,37 +356,33 @@ class User extends Resource_1.Resource {
367
356
  });
368
357
  }
369
358
  /**
370
- * grant privileges to a role
371
- *
372
- * @param data
373
- * | Property | Type | Description |
374
- * | :-- | :-- | :-- |
375
- * | roleName | String | Role name |
376
- * | object | string | Type of the operational object to which the specified privilege belongs, such as Collection, Index, Partition, etc. This parameter is case-sensitive.|
377
- * | objectName | string | Name of the object to which the role is granted the specified prvilege. |
378
- * | privilegeName | string | Name of the privilege to be granted to the role. This parameter is case-sensitive. |
379
- * | 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 |
380
- *
381
- * @returns
382
- * | Property | Description |
383
- * | :-- | :-- |
384
- * | status | { error_code: number, reason: string } |
385
- * | reason | '' |
386
- *
387
- * #### Example
388
- *
389
- * ```
390
- * milvusClient.grantRolePrivilege({
359
+ * Grants privileges to a role.
360
+ *
361
+ * @param {Object} data - The data object.
362
+ * @param {string} data.roleName - The name of the role.
363
+ * @param {string} data.object - The type of the operational object to which the specified privilege belongs, such as Collection, Index, Partition, etc. This parameter is case-sensitive.
364
+ * @param {string} data.objectName - The name of the object to which the role is granted the specified privilege.
365
+ * @param {string} data.privilegeName - The name of the privilege to be granted to the role. This parameter is case-sensitive.
366
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
367
+ *
368
+ * @returns {Promise<Object>} The response object.
369
+ * @returns {Object} response.status - The response status.
370
+ * @returns {number} response.status.error_code - The error code number.
371
+ * @returns {string} response.status.reason - The cause of the error, if any.
372
+ *
373
+ * @example
374
+ * ```javascript
375
+ * milvusClient.grantPrivilege({
391
376
  * roleName: 'roleName',
392
377
  * object: '*',
393
378
  * objectName: 'Collection',
394
379
  * privilegeName: 'CreateIndex'
395
- * });
380
+ * });
396
381
  * ```
397
382
  */
398
- grantRolePrivilege(data) {
383
+ grantPrivilege(data) {
399
384
  return __awaiter(this, void 0, void 0, function* () {
400
- const promise = yield (0, __1.promisify)(this.client, 'OperatePrivilege', {
385
+ const promise = yield (0, __1.promisify)(this.channelPool, 'OperatePrivilege', {
401
386
  entity: {
402
387
  role: { name: data.roleName },
403
388
  object: { name: data.object },
@@ -412,37 +397,33 @@ class User extends Resource_1.Resource {
412
397
  });
413
398
  }
414
399
  /**
415
- * revoke privileges to a role
416
- *
417
- * @param data
418
- * | Property | Type | Description |
419
- * | :-- | :-- | :-- |
420
- * | roleName | String | Role name |
421
- * | object | string | Type of the operational object to which the specified privilege belongs, such as Collection, Index, Partition, etc. This parameter is case-sensitive.|
422
- * | objectName | string | Name of the object to which the role is granted the specified prvilege. |
423
- * | privilegeName | string | Name of the privilege to be granted to the role. This parameter is case-sensitive. |
424
- * | 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 |
425
- *
426
- * @returns
427
- * | Property | Description |
428
- * | :------------- | :-------- |
429
- * | status | { error_code: number, reason: string } |
430
- * | reason | '' |
431
- *
432
- * #### Example
433
- *
434
- * ```
435
- * milvusClient.grantRolePrivilege({
400
+ * Revokes privileges from a role.
401
+ *
402
+ * @param {Object} data - The data object.
403
+ * @param {string} data.roleName - The name of the role.
404
+ * @param {string} data.object - The type of the operational object from which the specified privilege is revoked, such as Collection, Index, Partition, etc. This parameter is case-sensitive.
405
+ * @param {string} data.objectName - The name of the object from which the role's specified privilege is revoked.
406
+ * @param {string} data.privilegeName - The name of the privilege to be revoked from the role. This parameter is case-sensitive.
407
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
408
+ *
409
+ * @returns {Promise<Object>} The response object.
410
+ * @returns {Object} response.status - The response status.
411
+ * @returns {number} response.status.error_code - The error code number.
412
+ * @returns {string} response.status.reason - The cause of the error, if any.
413
+ *
414
+ * @example
415
+ * ```javascript
416
+ * milvusClient.revokePrivilege({
436
417
  * roleName: 'roleName',
437
418
  * object: '*',
438
419
  * objectName: 'Collection',
439
420
  * privilegeName: 'CreateIndex'
440
- * });
421
+ * });
441
422
  * ```
442
423
  */
443
- revokeRolePrivilege(data) {
424
+ revokePrivilege(data) {
444
425
  return __awaiter(this, void 0, void 0, function* () {
445
- const promise = yield (0, __1.promisify)(this.client, 'OperatePrivilege', {
426
+ const promise = yield (0, __1.promisify)(this.channelPool, 'OperatePrivilege', {
446
427
  entity: {
447
428
  role: { name: data.roleName },
448
429
  object: { name: data.object },
@@ -457,21 +438,17 @@ class User extends Resource_1.Resource {
457
438
  });
458
439
  }
459
440
  /**
460
- * revoke all roles priviledges
461
- * @param data
462
- * | Property | Type | Description |
463
- * | :-- | :-- | :-- |
464
- * | 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 |
441
+ * Revokes all privileges from all roles.
465
442
  *
466
- * @returns
467
- * | Property | Description |
468
- * | :-- | :-- |
469
- * | status | { error_code: number, reason: string } |
470
- * | reason | '' |
443
+ * @param {Object} data - The data object.
444
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
471
445
  *
472
- * #### Example
446
+ * @returns {Promise<ResStatus[]>} - An array of response statuses for each role.
447
+ * @returns {number} ResStatus.error_code - The error code number for each role.
448
+ * @returns {string} ResStatus.reason - The cause of the error, if any, for each role.
473
449
  *
474
- * ```
450
+ * @example
451
+ * ```javascript
475
452
  * milvusClient.revokeAllRolesPrivileges();
476
453
  * ```
477
454
  */
@@ -511,36 +488,33 @@ class User extends Resource_1.Resource {
511
488
  });
512
489
  }
513
490
  /**
514
- * select a grant
515
- * @param data
516
- * | Property | Type | Description |
517
- * | :-- | :-- | :-- |
518
- * | roleName | String | Role name |
519
- * | object | string | Type of the operational object to which the specified privilege belongs, such as Collection, Index, Partition, etc. This parameter is case-sensitive.|
520
- * | objectName | string | Name of the object to which the role is granted the specified prvilege. |
521
- * | privilegeName | string | Name of the privilege to be granted to the role. This parameter is case-sensitive. |
522
- * | 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 |
523
- *
524
- * @returns
525
- * | Property | Description |
526
- * | :-- | :-- |
527
- * | status | { error_code: number, reason: string } |
528
- * | reason | '' |
529
- *
530
- * #### Example
531
- *
532
- * ```
491
+ * Selects a grant for a specific role.
492
+ *
493
+ * @param {Object} data - The data object.
494
+ * @param {string} data.roleName - The name of the role.
495
+ * @param {string} data.object - The type of the operational object to which the specified privilege belongs, such as Collection, Index, Partition, etc. This parameter is case-sensitive.
496
+ * @param {string} data.objectName - The name of the object to which the role is granted the specified privilege.
497
+ * @param {string} data.privilegeName - The name of the privilege to be granted to the role. This parameter is case-sensitive.
498
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
499
+ *
500
+ * @returns {Promise<Object>} The response object.
501
+ * @returns {Object} response.status - The response status.
502
+ * @returns {number} response.status.error_code - The error code number.
503
+ * @returns {string} response.status.reason - The cause of the error, if any.
504
+ *
505
+ * @example
506
+ * ```javascript
533
507
  * milvusClient.selectGrant({
534
508
  * roleName: 'roleName',
535
509
  * object: '*',
536
510
  * objectName: 'Collection',
537
511
  * privilegeName: 'CreateIndex'
538
- * });
512
+ * });
539
513
  * ```
540
514
  */
541
515
  selectGrant(data) {
542
516
  return __awaiter(this, void 0, void 0, function* () {
543
- const promise = yield (0, __1.promisify)(this.client, 'SelectGrant', {
517
+ const promise = yield (0, __1.promisify)(this.channelPool, 'SelectGrant', {
544
518
  entity: {
545
519
  role: { name: data.roleName },
546
520
  object: { name: data.object },
@@ -554,30 +528,35 @@ class User extends Resource_1.Resource {
554
528
  });
555
529
  }
556
530
  /**
557
- * list all grants for a role
558
- * @param data
559
- * | Property | Type | Description |
560
- * | :-- | :-- | :-- |
561
- * | roleName | String | Role name |
562
- * | 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 |
563
- *
564
- * @returns
565
- * | Property | Description |
566
- * | :-- | :-- |
567
- * | status | { error_code: number, reason: string } |
568
- * | reason | '' |
569
- *
570
- * #### Example
571
- *
572
- * ```
531
+ * Lists all grants for a specific role.
532
+ *
533
+ * @param {Object} data - The data object.
534
+ * @param {string} data.roleName - The name of the role.
535
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
536
+ *
537
+ * @returns {Promise<SelectGrantResponse>} The response object.
538
+ * @returns {Object} response.status - The response status.
539
+ * @returns {number} response.status.error_code - The error code number.
540
+ * @returns {string} response.status.reason - The cause of the error, if any.
541
+ * @returns {Object[]} response.entities - An array of entities, each containing a role, an object, an object name, and a grantor.
542
+ * @returns {Object} response.entities.role - The role object.
543
+ * @returns {string} response.entities.role.name - The name of the role.
544
+ * @returns {Object} response.entities.object - The object to which the specified privilege belongs.
545
+ * @returns {string} response.entities.object.name - The name of the object.
546
+ * @returns {string} response.entities.object_name - The name of the object to which the role is granted the specified privilege.
547
+ * @returns {Object} response.entities.grantor - The grantor object.
548
+ * @returns {string} response.entities.grantor.privilege.name - The name of the privilege granted to the role.
549
+ *
550
+ * @example
551
+ * ```javascript
573
552
  * milvusClient.listGrants({
574
553
  * roleName: 'roleName',
575
- * });
554
+ * });
576
555
  * ```
577
556
  */
578
557
  listGrants(data) {
579
558
  return __awaiter(this, void 0, void 0, function* () {
580
- const promise = yield (0, __1.promisify)(this.client, 'SelectGrant', {
559
+ const promise = yield (0, __1.promisify)(this.channelPool, 'SelectGrant', {
581
560
  entity: {
582
561
  role: { name: data.roleName },
583
562
  },
@@ -586,25 +565,23 @@ class User extends Resource_1.Resource {
586
565
  });
587
566
  }
588
567
  /**
589
- * check if the role is existing
590
- * @param data
591
- * | Property | Type | Description |
592
- * | :-- | :-- | :-- |
593
- * | roleName | String | Role name |
594
- * | 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 |
568
+ * Checks if a role exists.
595
569
  *
596
- * @returns
597
- * | Property | Description |
598
- * | :-- | :-- |
599
- * | status | { error_code: number, reason: string } |
600
- * | reason | '' |
570
+ * @param {HasRoleReq} data - The data object.
571
+ * @param {string} data.roleName - The name of the role.
572
+ * @param {number} [data.timeout] - An optional duration of time in milliseconds 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.
601
573
  *
602
- * #### Example
574
+ * @returns {Promise<HasRoleResponse>} The response object.
575
+ * @returns {ResStatus} response.status - The response status.
576
+ * @returns {number} response.status.error_code - The error code number.
577
+ * @returns {string} response.status.reason - The cause of the error, if any.
578
+ * @returns {boolean} response.hasRole - A boolean indicating whether the role exists.
603
579
  *
604
- * ```
580
+ * @example
581
+ * ```javascript
605
582
  * milvusClient.hasRole({
606
583
  * roleName: 'roleName',
607
- * });
584
+ * });
608
585
  * ```
609
586
  */
610
587
  hasRole(data) {