@scifeon/sdk 0.106.0 → 0.108.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.
@@ -157,7 +157,7 @@ class AppGenerator {
157
157
  this.javascript.push(` id: '${plugin.id}',`);
158
158
  }
159
159
  const funcExt = fs.existsSync(`${path.resolve(this.config.appPath, plugin.src)}.ts`) ? "t" : "j";
160
- if (!plugin.chunk && plugin.types.length === 1) {
160
+ if (!plugin.chunk) {
161
161
  plugin.chunk = plugin.src;
162
162
  }
163
163
  if (plugin.chunk) {
@@ -335,6 +335,7 @@ class AppGenerator {
335
335
  const nameRegex = /name\s*:\s*('.*'|".*")/i;
336
336
  const idRegex = /id\s*:\s*('.*'|".*")/i;
337
337
  const descriptionRegex = /description\s*:\s*('.*'|".*")/i;
338
+ const pluginTypeRegex = /(PLUGIN_TYPE\.\w+)/g;
338
339
  for (const file of this.tsFiles) {
339
340
  if (!this.fileIncludesDecorator(file.content, "@scifeonDashboardWidget"))
340
341
  continue;
@@ -342,12 +343,21 @@ class AppGenerator {
342
343
  const nameMatch = nameRegex.exec(match[1]);
343
344
  const idMatch = idRegex.exec(match[1]);
344
345
  const descriptionMatch = descriptionRegex.exec(match[1]);
346
+ const types = [];
347
+ let type = pluginTypeRegex.exec(match[1]);
348
+ while (type) {
349
+ types.push(type[1]);
350
+ type = pluginTypeRegex.exec(match[1]);
351
+ }
352
+ if (types.length === 0) {
353
+ types.push("PLUGIN_TYPE.DASHBOARD_WIDGET");
354
+ }
345
355
  const dashboardWidget = {
346
356
  id: idMatch[1].slice(1, -1),
347
357
  src: file.src,
358
+ types: new Function("PLUGIN_TYPE", `return [${types.join(", ")}]`)(plugin_types_1.PLUGIN_TYPE),
348
359
  name: nameMatch !== null ? nameMatch[1].slice(1, -1) : file.name,
349
360
  description: descriptionMatch !== null ? descriptionMatch[1].slice(1, -1) : null,
350
- type: plugin_types_1.PLUGIN_TYPE.DASHBOARD_WIDGET,
351
361
  };
352
362
  this.contributionsJson.plugins.push(dashboardWidget);
353
363
  const configSrc = `${file.src}-config.ts`;
@@ -355,7 +365,7 @@ class AppGenerator {
355
365
  const config = JSON.parse(JSON.stringify(dashboardWidget));
356
366
  config.src = `${file.src}-config`;
357
367
  config.id += ".$CONFIG";
358
- config.type += ".$CONFIG";
368
+ config.types = config.types.map(t => `${t}.$CONFIG`);
359
369
  this.contributionsJson.plugins.push(config);
360
370
  }
361
371
  }
@@ -15,15 +15,16 @@ class DownloadUtils {
15
15
  if (!fs.existsSync(targetPath)) {
16
16
  file_utils_1.FileUtils.createDirRecurSync(targetPath);
17
17
  }
18
- const tmpFilePath = os.tmpdir() + path.sep + Date.now() + "-scifeon-temp.zip";
19
- https.get(url, (response) => {
18
+ const tmpFilePath = `${os.tmpdir() + path.sep + Date.now()}-scifeon-temp.zip`;
19
+ console.log(progressBarMsg);
20
+ https.get(url, response => {
20
21
  const len = parseInt(response.headers["content-length"], 10);
21
- const toMegabytes = (bytes) => {
22
+ const toMegabytes = bytes => {
22
23
  const mb = bytes / 1024 / 1024;
23
24
  return `${Math.round(mb * 10) / 10} Mb`;
24
25
  };
25
26
  console.log();
26
- const bar = new ProgressBar(progressBarMsg + ` - ${toMegabytes(len)} [:bar] :percent :etas`, {
27
+ const bar = new ProgressBar(`${progressBarMsg} - ${toMegabytes(len)} [:bar] :percent :etas`, {
27
28
  complete: "=",
28
29
  incomplete: " ",
29
30
  width: 20,
@@ -3,6 +3,7 @@ export declare enum PLUGIN_TYPE {
3
3
  PAGE = "page",
4
4
  DATA_LOADER = "data_loader",
5
5
  DASHBOARD_WIDGET = "dashboard.widget",
6
+ ANALYTICS_WIDGET = "analytics.widget",
6
7
  ENTITY_SIDEBAR = "entity.sidebar",
7
8
  ENTITY_PANEL = "entity.panel",
8
9
  ENTITY_RESULT_SET = "entity.result_set",
@@ -32,6 +33,7 @@ export declare enum PLUGIN_TYPE {
32
33
  ELN_STEP_SECTION = "eln.step.section",
33
34
  ELN_EXPERIMENT_COMPLETE = "eln.experiment.complete",
34
35
  ELN_EXPERIMENT_LOCK = "eln.experiment.lock",
36
+ ELN_EXPERIMENT_SECTION = "eln.experiment.section",
35
37
  ELN_STEP_FORM_MODE = "eln.step.form.mode",
36
38
  ELN_STEP_CONTROL = "eln.step.control",
37
39
  ELN_STEP_SELECT_PROCEDURE_FILTER = "eln.step.select_procedure_filter",
@@ -7,6 +7,7 @@ var PLUGIN_TYPE;
7
7
  PLUGIN_TYPE["PAGE"] = "page";
8
8
  PLUGIN_TYPE["DATA_LOADER"] = "data_loader";
9
9
  PLUGIN_TYPE["DASHBOARD_WIDGET"] = "dashboard.widget";
10
+ PLUGIN_TYPE["ANALYTICS_WIDGET"] = "analytics.widget";
10
11
  PLUGIN_TYPE["ENTITY_SIDEBAR"] = "entity.sidebar";
11
12
  PLUGIN_TYPE["ENTITY_PANEL"] = "entity.panel";
12
13
  PLUGIN_TYPE["ENTITY_RESULT_SET"] = "entity.result_set";
@@ -36,6 +37,7 @@ var PLUGIN_TYPE;
36
37
  PLUGIN_TYPE["ELN_STEP_SECTION"] = "eln.step.section";
37
38
  PLUGIN_TYPE["ELN_EXPERIMENT_COMPLETE"] = "eln.experiment.complete";
38
39
  PLUGIN_TYPE["ELN_EXPERIMENT_LOCK"] = "eln.experiment.lock";
40
+ PLUGIN_TYPE["ELN_EXPERIMENT_SECTION"] = "eln.experiment.section";
39
41
  PLUGIN_TYPE["ELN_STEP_FORM_MODE"] = "eln.step.form.mode";
40
42
  PLUGIN_TYPE["ELN_STEP_CONTROL"] = "eln.step.control";
41
43
  PLUGIN_TYPE["ELN_STEP_SELECT_PROCEDURE_FILTER"] = "eln.step.select_procedure_filter";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scifeon/sdk",
3
- "version": "0.106.0",
3
+ "version": "0.108.0",
4
4
  "description": "A tool for developing Apps for Scifeon.",
5
5
  "author": {
6
6
  "name": "Scifeon",
@@ -58,7 +58,7 @@
58
58
  "ts-loader": "8.3.0",
59
59
  "ts-node": "10.8.1",
60
60
  "tsconfig-paths-webpack-plugin": "3.2.0",
61
- "tslib": "2.4.0",
61
+ "tslib": "2.6.2",
62
62
  "typescript": "4.6.4",
63
63
  "url-loader": "4.1.0",
64
64
  "webpack": "4.43.0",