@scifeon/sdk 0.85.0 → 0.88.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.
@@ -238,18 +238,15 @@ class AppGenerator {
238
238
  }
239
239
  addElnStepSectionDecorators() {
240
240
  const builderRegex = /@scifeonElnStepSection\s*\(\s*(\{[^]*?\})\s*\)/i;
241
- const nameRegex = /name\s*:\s*('.*'|".*")/i;
242
241
  const idRegex = /id\s*:\s*('.*'|".*")/i;
243
242
  for (const file of this.tsFiles) {
244
243
  if (!this.fileIncludesDecorator(file.content, "@scifeonElnStepSection"))
245
244
  continue;
246
245
  const match = builderRegex.exec(file.content);
247
- const nameMatch = nameRegex.exec(match[1]);
248
246
  const idMatch = idRegex.exec(match[1]);
249
247
  const section = {
250
248
  id: idMatch[1].slice(1, -1),
251
249
  src: file.src,
252
- name: nameMatch[1].slice(1, -1),
253
250
  type: plugin_types_1.PLUGIN_TYPE.ELN_STEP_SECTION,
254
251
  };
255
252
  this.contributionsJson.plugins.push(section);
@@ -80,9 +80,15 @@ class AppPersist {
80
80
  }
81
81
  if (database.views && Array.isArray(database.views)) {
82
82
  for (const view of database.views) {
83
- const filename = "view_" + this.fileCounter++ + ".sql";
84
- fs.writeFileSync(path.resolve(this.jsonDir, "database", filename), fs.readFileSync(path.resolve(this.config.appPath, view.sql)).toString());
85
- view.sql = filename;
83
+ const filename = `view_${this.fileCounter++}.`;
84
+ const sqlFilename = filename + "sql";
85
+ fs.writeFileSync(path.resolve(this.jsonDir, "database", sqlFilename), fs.readFileSync(path.resolve(this.config.appPath, view.sql)).toString());
86
+ view.sql = sqlFilename;
87
+ if (view.fields) {
88
+ const fieldsFilename = filename + "fields.datamodel";
89
+ fs.writeFileSync(path.resolve(this.jsonDir, "database", fieldsFilename), fs.readFileSync(path.resolve(this.config.appPath, view.fields)).toString());
90
+ view.fields = fieldsFilename;
91
+ }
86
92
  }
87
93
  }
88
94
  if (database.datamodel) {
@@ -21,7 +21,7 @@ class BuildCommand {
21
21
  if (!fs.existsSync(config_1.config.wwwDir)) {
22
22
  yield download_utils_1.DownloadUtils.downloadZip("https://scifeon.azureedge.net/sdk/packages-types.zip", path.resolve("runtime", "scifeon", "generated"), "Downloading Scifeon Types");
23
23
  }
24
- webpack_runner_1.webpackRunner("build");
24
+ (0, webpack_runner_1.webpackRunner)("build");
25
25
  });
26
26
  }
27
27
  }
@@ -106,7 +106,7 @@ class NewCommand {
106
106
  fs.writeFileSync(path.resolve(packageJson.name, "contributions.json"), JSON.stringify(contributionsJson, null, 2));
107
107
  logger_1.LOGGER.msg("Installing node_modules...");
108
108
  const npmCmd = process.platform === "win32" ? "npm.cmd" : "npm";
109
- const proc = child_process_1.spawn(npmCmd, ["install --silent --prefer-offline --no-audit"], { cwd: path.resolve(packageJson.name) });
109
+ const proc = (0, child_process_1.spawn)(npmCmd, ["install --silent --prefer-offline --no-audit"], { cwd: path.resolve(packageJson.name) });
110
110
  proc.stderr.on("data", (data) => console.log(data.toString()));
111
111
  proc.stdout.on("data", (data) => console.log(data.toString()));
112
112
  proc.once("exit", () => logger_1.LOGGER.msg("App created in folder [" + packageJson.name + "]. Run 'scifeon-cli debug' in this directory to start development of your app."));
@@ -4,7 +4,7 @@ exports.PackageCommand = void 0;
4
4
  const webpack_runner_1 = require("../../webpack-runner");
5
5
  class PackageCommand {
6
6
  execute() {
7
- webpack_runner_1.webpackRunner("package");
7
+ (0, webpack_runner_1.webpackRunner)("package");
8
8
  }
9
9
  }
10
10
  exports.PackageCommand = PackageCommand;
@@ -5,7 +5,7 @@ const unit_test_runner_1 = require("../../../unit-test-runner");
5
5
  const config_1 = require("../../config");
6
6
  class TestCommand {
7
7
  execute(options) {
8
- unit_test_runner_1.unitTestRunner(options, config_1.config);
8
+ (0, unit_test_runner_1.unitTestRunner)(options, config_1.config);
9
9
  }
10
10
  }
11
11
  exports.TestCommand = TestCommand;
@@ -22,7 +22,7 @@ class WatchCommand {
22
22
  if (!fs.existsSync("./runtime")) {
23
23
  yield new download_1.DownloadCommand().execute();
24
24
  }
25
- const webpackConfig = webpack_app_config_1.webpackAppConfig({ watch: true }, config_1.config);
25
+ const webpackConfig = (0, webpack_app_config_1.webpackAppConfig)({ watch: true }, config_1.config);
26
26
  webpackConfig.output.publicPath = "http://localhost:9090" + webpackConfig.output.publicPath;
27
27
  webpackConfig.entry.app.unshift(require.resolve("webpack-dev-server/client") + "?http://localhost:9090", require.resolve("webpack/hot/dev-server"));
28
28
  const compiler = webpack(webpackConfig);
package/dist/cli/index.js CHANGED
@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
7
7
  o[k2] = m[k];
8
8
  }));
9
9
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
13
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -8,7 +8,7 @@ const config_1 = require("./config");
8
8
  function webpackRunner(mode) {
9
9
  const env = {};
10
10
  env[mode] = true;
11
- const compiler = webpack(webpack_app_config_1.webpackAppConfig(env, config_1.config));
11
+ const compiler = webpack((0, webpack_app_config_1.webpackAppConfig)(env, config_1.config));
12
12
  compiler.run(function (err, stats) {
13
13
  logger_1.LOGGER.info("Webpack output: ");
14
14
  const config = logger_1.LOGGER.verbose ? "verbose" : {
@@ -1,3 +1,3 @@
1
1
  export declare class DownloadUtils {
2
- static downloadZip(url: string, targetPath: string, progressBarMsg: string): Promise<unknown>;
2
+ static downloadZip(url: string, targetPath: string, progressBarMsg: string): Promise<void>;
3
3
  }
@@ -30,5 +30,8 @@ export declare enum PLUGIN_TYPE {
30
30
  ELN_SIDEBAR = "eln.sidebar",
31
31
  ELN_STEP_SECTION = "eln.step.section",
32
32
  ELN_EXPERIMENT_COMPLETE = "eln.experiment.complete",
33
- PRE_PROCESS_SAVE_ENTITY = "pre_process_save_entity"
33
+ ELN_EXPERIMENT_LOCK = "eln.experiment.lock",
34
+ ELN_STEP_FORM_MODE = "eln.step.form.mode",
35
+ PRE_PROCESS_SAVE_ENTITY = "pre_process_save_entity",
36
+ ADMINISTRATION_SETTINGS_ELN = "administration.settings.eln"
34
37
  }
@@ -34,5 +34,8 @@ var PLUGIN_TYPE;
34
34
  PLUGIN_TYPE["ELN_SIDEBAR"] = "eln.sidebar";
35
35
  PLUGIN_TYPE["ELN_STEP_SECTION"] = "eln.step.section";
36
36
  PLUGIN_TYPE["ELN_EXPERIMENT_COMPLETE"] = "eln.experiment.complete";
37
+ PLUGIN_TYPE["ELN_EXPERIMENT_LOCK"] = "eln.experiment.lock";
38
+ PLUGIN_TYPE["ELN_STEP_FORM_MODE"] = "eln.step.form.mode";
37
39
  PLUGIN_TYPE["PRE_PROCESS_SAVE_ENTITY"] = "pre_process_save_entity";
40
+ PLUGIN_TYPE["ADMINISTRATION_SETTINGS_ELN"] = "administration.settings.eln";
38
41
  })(PLUGIN_TYPE = exports.PLUGIN_TYPE || (exports.PLUGIN_TYPE = {}));
@@ -27,7 +27,7 @@ function unitTestRunner(options, config, appType = "sdk") {
27
27
  }
28
28
  file_utils_1.FileUtils.createDirRecurSync(path.resolve(config.tempDir));
29
29
  fs.writeFileSync(path.resolve(config.tempDir, "unit-tests.js"), unitTestsJs.join("\n"));
30
- const webpackConfig = webpack_app_config_1.webpackAppConfig({ test: true }, config, appType);
30
+ const webpackConfig = (0, webpack_app_config_1.webpackAppConfig)({ test: true }, config, appType);
31
31
  webpackConfig.target = "node";
32
32
  const compiler = webpack(webpackConfig);
33
33
  compiler.run(function (err, stats) {
@@ -20,7 +20,7 @@ const requireURL = (url) => __awaiter(void 0, void 0, void 0, function* () {
20
20
  script = requireCache[url];
21
21
  }
22
22
  else {
23
- const response = yield node_fetch_1.default(url);
23
+ const response = yield (0, node_fetch_1.default)(url);
24
24
  script = yield response.text();
25
25
  requireCache[url] = script;
26
26
  }
@@ -15,26 +15,6 @@ const logger_1 = require("./logger");
15
15
  const webpack_utils_1 = require("./webpack-utils");
16
16
  const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
17
17
  const TerserJSPlugin = require("terser-webpack-plugin");
18
- const ModuleDependencyWarning = require("webpack/lib/ModuleDependencyWarning");
19
- class IgnoreNotFoundExportPlugin {
20
- apply(compiler) {
21
- const messageRegExp = /export '.*'( \(reexported as '.*'\))? was not found in/;
22
- function doneHook(stats) {
23
- stats.compilation.warnings = stats.compilation.warnings.filter(function (warn) {
24
- if (warn instanceof ModuleDependencyWarning && messageRegExp.test(warn.message)) {
25
- return false;
26
- }
27
- return true;
28
- });
29
- }
30
- if (compiler.hooks) {
31
- compiler.hooks.done.tap("IgnoreNotFoundExportPlugin", doneHook);
32
- }
33
- else {
34
- compiler.plugin("done", doneHook);
35
- }
36
- }
37
- }
38
18
  function webpackAppConfig(env, config, appType = "sdk") {
39
19
  env = env || { debug: true };
40
20
  const DEBUG = env.debug;
@@ -67,7 +47,7 @@ function webpackAppConfig(env, config, appType = "sdk") {
67
47
  filename: "[name].[contenthash].css",
68
48
  chunkFilename: "[id].[contenthash].css",
69
49
  }),
70
- new IgnoreNotFoundExportPlugin(),
50
+ new webpack_utils_1.IgnoreNotFoundExportPlugin(),
71
51
  ]);
72
52
  if (PACKAGE) {
73
53
  plugins.push(webpack_utils_1.WebpackUtils.parseLogForAzureDevOps());
@@ -3,3 +3,6 @@ export declare class WebpackUtils {
3
3
  static getPublicPath(fallback: string, prefix: string, postfix?: string): string;
4
4
  static transformTsConfig(file: string): string;
5
5
  }
6
+ export declare class IgnoreNotFoundExportPlugin {
7
+ apply(compiler: any): void;
8
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebpackUtils = void 0;
3
+ exports.IgnoreNotFoundExportPlugin = exports.WebpackUtils = void 0;
4
4
  const FriendlyErrorsPlugin = require("friendly-errors-webpack-plugin");
5
5
  const fs = require("fs");
6
6
  const file_utils_1 = require("./file-utils");
@@ -59,3 +59,25 @@ function getFileDirectory(filePath) {
59
59
  return filePath.substring(0, filePath.lastIndexOf("/"));
60
60
  }
61
61
  }
62
+ const ModuleDependencyWarning = require("webpack/lib/ModuleDependencyWarning");
63
+ class IgnoreNotFoundExportPlugin {
64
+ apply(compiler) {
65
+ const messageRegExp = /export '.*'( \(reexported as '.*'\))? was not found in/;
66
+ const messageRegExp2 = /export 'default'( \(imported as '.*'\))? was not found in/;
67
+ function doneHook(stats) {
68
+ stats.compilation.warnings = stats.compilation.warnings.filter(function (warn) {
69
+ if (warn instanceof ModuleDependencyWarning && (messageRegExp.test(warn.message) || messageRegExp2.test(warn.message))) {
70
+ return false;
71
+ }
72
+ return true;
73
+ });
74
+ }
75
+ if (compiler.hooks) {
76
+ compiler.hooks.done.tap("IgnoreNotFoundExportPlugin", doneHook);
77
+ }
78
+ else {
79
+ compiler.plugin("done", doneHook);
80
+ }
81
+ }
82
+ }
83
+ exports.IgnoreNotFoundExportPlugin = IgnoreNotFoundExportPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scifeon/sdk",
3
- "version": "0.85.0",
3
+ "version": "0.88.0",
4
4
  "description": "A tool for developing Apps for Scifeon.",
5
5
  "author": {
6
6
  "name": "Scifeon",
@@ -55,11 +55,11 @@
55
55
  "semver": "7.3.2",
56
56
  "style-loader": "1.2.1",
57
57
  "terser-webpack-plugin": "2.3.6",
58
- "ts-loader": "7.0.2",
58
+ "ts-loader": "8.3.0",
59
59
  "ts-node": "8.9.1",
60
60
  "tsconfig-paths-webpack-plugin": "3.2.0",
61
- "tslib": "1.11.1",
62
- "typescript": "3.9.5",
61
+ "tslib": "2.3.1",
62
+ "typescript": "4.4.2",
63
63
  "url-loader": "4.1.0",
64
64
  "webpack": "4.43.0",
65
65
  "webpack-cli": "3.3.11",