@ejfdelgado/ejflab-common 1.12.0 → 1.12.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ejfdelgado/ejflab-common",
3
3
  "type": "commonjs",
4
- "version": "1.12.0",
4
+ "version": "1.12.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ejfdelgado/ejflab-common.git"
@@ -20,25 +20,41 @@ class CommandMilvus extends CommandBasic {
20
20
 
21
21
  const milvusSrv = this.context.getSuperContext().getMilvusClient();
22
22
  const { client } = milvusSrv.connect();
23
- if (action == "database.create") {
24
- await this.dataBaseCreate(milvusSrv, client, dataBaseName);
25
- } else if (action == "database.recreate") {
26
- await this.dataBaseRecreate(milvusSrv, client, dataBaseName);
27
- } else if (action == "collection.create") {
28
- const collectionConfig = this.args[2];
29
- const configuration = SimpleObj.getValue(this.context.data, collectionConfig, null);
30
- if (configuration) {
31
- await this.collectionCreate(milvusSrv, client, dataBaseName, configuration);
32
- } else {
33
- throw new Error(`No MILVUS configuration in ${collectionConfig}`);
23
+ let response = null;
24
+ try {
25
+ if (action == "database.create") {
26
+ response = await this.dataBaseCreate(milvusSrv, client, dataBaseName);
27
+ } else if (action == "database.recreate") {
28
+ response = await this.dataBaseRecreate(milvusSrv, client, dataBaseName);
29
+ } else if (action == "collection.create") {
30
+ const collectionConfig = this.args[2];
31
+ const configuration = SimpleObj.getValue(this.context.data, collectionConfig, null);
32
+ if (configuration) {
33
+ response = await this.collectionCreate(milvusSrv, client, dataBaseName, configuration);
34
+ } else {
35
+ throw new Error(`No MILVUS configuration in ${collectionConfig}`);
36
+ }
37
+ } else if (action == "collection.destroy") {
38
+ const collectionName = this.args[2];
39
+ response = await milvusSrv.dropCollectionOfDatabase(client, dataBaseName, collectionName);
40
+ } else if (action == "collection.describe") {
41
+ const collectionName = this.args[2];
42
+ response = await milvusSrv.describeCollectionOfDatabase(client, dataBaseName, collectionName);
43
+ } else if (action == "introspect") {
44
+ response = await milvusSrv.introspect(client);
45
+ } else if (action == "database.destroy") {
46
+ response = await milvusSrv.dropDatabase(client, dataBaseName);
47
+ } else if (action == "database.destroy_temp") {
48
+ response = await milvusSrv.dropDatabaseTemp(client);
49
+ } else if (action == "database.exists") {
50
+ response = await milvusSrv.existsDatabase(client, dataBaseName);
34
51
  }
35
- } else if (action == "introspect") {
36
- await milvusSrv.introspect(client);
37
- } else if (action == "database.destroy") {
38
- await milvusSrv.dropDatabase(client, dataBaseName);
39
- } else if (action == "database.destroy_temp") {
40
- await milvusSrv.dropDatabaseTemp(client);
52
+ } catch (err) {
53
+ throw err;
54
+ } finally {
55
+ await milvusSrv.releaseConnection(client);
41
56
  }
57
+ return response;
42
58
  }
43
59
  }
44
60