@ejfdelgado/ejflab-common 1.11.3 → 1.12.1

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.11.3",
4
+ "version": "1.12.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ejfdelgado/ejflab-common.git"
@@ -20,25 +20,35 @@ 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
+ const 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 == "introspect") {
38
+ response = await milvusSrv.introspect(client);
39
+ } else if (action == "database.destroy") {
40
+ response = await milvusSrv.dropDatabase(client, dataBaseName);
41
+ } else if (action == "database.destroy_temp") {
42
+ response = await milvusSrv.dropDatabaseTemp(client);
43
+ } else if (action == "database.exists") {
44
+ response = await milvusSrv.existsDatabase(client, dataBaseName);
34
45
  }
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);
46
+ } catch (err) {
47
+ throw err;
48
+ } finally {
49
+ await milvusSrv.releaseConnection(client);
41
50
  }
51
+ return response;
42
52
  }
43
53
  }
44
54
 
@@ -120,7 +120,8 @@ class StepProcess extends StepBasic {
120
120
  }
121
121
 
122
122
  const room = this.context.getRoom();
123
- const dbData = SimpleObj.getValue(this.context.data, `args.db`, null);
123
+ const dbData = SimpleObj.getValue(this.context.data, `args.db`, {});
124
+ const general = SimpleObj.getValue(this.context.data, `args.general`, {});
124
125
  //console.log(`StepProcess processorName:${processorName} processorInstance:${processorInstance} processorMethod:${processorMethod} in room ${room}`);
125
126
  this.messageUID = IdGen.num2ord(new Date().getTime());
126
127
  this.pendingCall = `${room}-${this.id}-${this.messageUID}`;
@@ -136,7 +137,8 @@ class StepProcess extends StepBasic {
136
137
  id: this.pendingCall,
137
138
  data: this.configuration[instanceNumber],
138
139
  room,
139
- dbData
140
+ dbData,
141
+ general
140
142
  };
141
143
  //console.log("dbData="+JSON.stringify(dbData));
142
144