@ejfdelgado/ejflab-common 1.12.1 → 1.13.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ejfdelgado/ejflab-common",
3
3
  "type": "commonjs",
4
- "version": "1.12.1",
4
+ "version": "1.13.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ejfdelgado/ejflab-common.git"
package/src/MyDates.js CHANGED
@@ -136,44 +136,85 @@ class MyDates {
136
136
  deadline: (mananaInicio.getTime() - hoy.getTime()),
137
137
  };
138
138
  }
139
+ // MyDates.getDefaults(args)
140
+ static getDefaults(args, currentYear, nextYears, myDefault = "") {
141
+ if (args instanceof Array) {
142
+ if (args.lenght == 1) {
143
+ currentYear = args[0];
144
+ nextYears = args[0];
145
+ } else if (args.lenght == 2) {
146
+ currentYear = args[0];
147
+ nextYears = args[1];
148
+ }
149
+ if (args.lenght >= 3) {
150
+ myDefault = args[2];
151
+ }
152
+ }
153
+ return {
154
+ currentYear,
155
+ nextYears,
156
+ myDefault
157
+ };
158
+ }
159
+
139
160
  static formatDateBasic(dateformat, now, ...args) {
161
+ const {
162
+ currentYear,
163
+ nextYears,
164
+ myDefault
165
+ } = MyDates.getDefaults(args, "opcion2", "opcion1", "Día / Mes / Año");
140
166
  if (now instanceof Date) {
141
167
  if (new Date().getFullYear() == now.getFullYear()) {
142
- return dateformat(now, "opcion2");
168
+ return dateformat(now, currentYear);
143
169
  } else {
144
- return dateformat(now, "opcion1");
170
+ return dateformat(now, nextYears);
145
171
  }
146
172
  } else {
147
- return "Día / Mes / Año";
173
+ return myDefault;
148
174
  }
149
175
  }
150
176
  static formatDateSimpleBasic(dateformat, now, ...args) {
177
+ const {
178
+ currentYear,
179
+ nextYears,
180
+ myDefault
181
+ } = MyDates.getDefaults(args, "simple2", "simple1", "Día / Mes / Año");
151
182
  if (now instanceof Date) {
152
183
  if (new Date().getFullYear() == now.getFullYear()) {
153
- return dateformat(now, "simple2");
184
+ return dateformat(now, currentYear);
154
185
  } else {
155
- return dateformat(now, "simple1");
186
+ return dateformat(now, nextYears);
156
187
  }
157
188
  } else {
158
- return "Día / Mes / Año";
189
+ return myDefault;
159
190
  }
160
191
  }
161
192
  static formatDateCompletoBasic(dateformat, now, ...args) {
193
+ const {
194
+ currentYear,
195
+ nextYears,
196
+ myDefault
197
+ } = MyDates.getDefaults(args, "completo2", "completo1", "Día / Mes / Año Hora:Minutos:Segundos");
162
198
  if (now instanceof Date) {
163
199
  if (new Date().getFullYear() == now.getFullYear()) {
164
- return dateformat(now, "completo2");
200
+ return dateformat(now, currentYear);
165
201
  } else {
166
- return dateformat(now, "completo1");
202
+ return dateformat(now, nextYears);
167
203
  }
168
204
  } else {
169
- return "Día / Mes / Año Hora:Minutos:Segundos";
205
+ return myDefault;
170
206
  }
171
207
  }
172
208
  static formatTimeBasic(dateformat, now, ...args) {
209
+ const {
210
+ currentYear,
211
+ nextYears,
212
+ myDefault
213
+ } = MyDates.getDefaults(args, "opcion3", "opcion3", "Hora / Minuto");
173
214
  if (now instanceof Date) {
174
- return dateformat(now, "opcion3");
215
+ return dateformat(now, currentYear);
175
216
  } else {
176
- return "Hora / Minuto";
217
+ return myDefault;
177
218
  }
178
219
  }
179
220
  static formatPayu(dateformat, now) {
@@ -20,7 +20,7 @@ class CommandMilvus extends CommandBasic {
20
20
 
21
21
  const milvusSrv = this.context.getSuperContext().getMilvusClient();
22
22
  const { client } = milvusSrv.connect();
23
- const response = null;
23
+ let response = null;
24
24
  try {
25
25
  if (action == "database.create") {
26
26
  response = await this.dataBaseCreate(milvusSrv, client, dataBaseName);
@@ -34,6 +34,12 @@ class CommandMilvus extends CommandBasic {
34
34
  } else {
35
35
  throw new Error(`No MILVUS configuration in ${collectionConfig}`);
36
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);
37
43
  } else if (action == "introspect") {
38
44
  response = await milvusSrv.introspect(client);
39
45
  } else if (action == "database.destroy") {