@webtypen/webframez-core 0.3.53 → 0.3.55

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.
@@ -5,6 +5,7 @@ declare class BackupOutputDriversFacade {
5
5
  };
6
6
  constructor();
7
7
  register(name: string, driver: any): this;
8
+ private registerCommands;
8
9
  get(name: string): BaseBackupOutputDriver;
9
10
  keys(): string[];
10
11
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BackupOutputDrivers = void 0;
4
4
  const LocalBackupOutputDriver_1 = require("./OutputDrivers/LocalBackupOutputDriver");
5
+ const SystemCommands_1 = require("../Commands/SystemCommands");
5
6
  class BackupOutputDriversFacade {
6
7
  constructor() {
7
8
  this.drivers = {};
@@ -9,8 +10,16 @@ class BackupOutputDriversFacade {
9
10
  }
10
11
  register(name, driver) {
11
12
  this.drivers[name] = driver;
13
+ this.registerCommands(driver);
12
14
  return this;
13
15
  }
16
+ registerCommands(driver) {
17
+ const commands = (driver === null || driver === void 0 ? void 0 : driver.commands) || (driver === null || driver === void 0 ? void 0 : driver.consoleCommands);
18
+ if (!commands) {
19
+ return;
20
+ }
21
+ SystemCommands_1.SystemCommands.register(commands);
22
+ }
14
23
  get(name) {
15
24
  const driverClass = this.drivers[name];
16
25
  if (!driverClass) {
@@ -5,11 +5,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.backupTimestampId = exports.formatBackupFilename = exports.resolveProjectPath = exports.normalizeBackupPath = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
+ const FileFunctions_1 = require("../../Functions/FileFunctions");
8
9
  function normalizeBackupPath(value) {
9
10
  return value.replace(/\\/g, "/").replace(/^\/+/, "");
10
11
  }
11
12
  exports.normalizeBackupPath = normalizeBackupPath;
12
13
  function resolveProjectPath(value, projectRoot = process.cwd()) {
14
+ const normalized = normalizeBackupPath(value);
15
+ if (process.env.STORAGE_DIR && process.env.STORAGE_DIR.trim() !== "" && normalized === "storage") {
16
+ return (0, FileFunctions_1.storageDir)();
17
+ }
18
+ if (process.env.STORAGE_DIR && process.env.STORAGE_DIR.trim() !== "" && normalized.startsWith("storage/")) {
19
+ return (0, FileFunctions_1.storageDir)(normalized.substring("storage/".length));
20
+ }
13
21
  return path_1.default.isAbsolute(value) ? value : path_1.default.resolve(projectRoot, value);
14
22
  }
15
23
  exports.resolveProjectPath = resolveProjectPath;
@@ -0,0 +1,8 @@
1
+ declare class SystemCommandsFacade {
2
+ private commands;
3
+ private registered;
4
+ register(data: any): this;
5
+ getCommands(): any[];
6
+ }
7
+ export declare const SystemCommands: SystemCommandsFacade;
8
+ export {};
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SystemCommands = void 0;
4
+ class SystemCommandsFacade {
5
+ constructor() {
6
+ this.commands = [];
7
+ this.registered = {};
8
+ }
9
+ register(data) {
10
+ const commands = Array.isArray(data) ? data : [data];
11
+ for (const command of commands) {
12
+ if (!command || !command.signature || this.registered[command.signature]) {
13
+ continue;
14
+ }
15
+ this.registered[command.signature] = true;
16
+ this.commands.push(command);
17
+ }
18
+ return this;
19
+ }
20
+ getCommands() {
21
+ return this.commands;
22
+ }
23
+ }
24
+ exports.SystemCommands = new SystemCommandsFacade();
@@ -2,6 +2,7 @@ import { ModulesLoader } from "./Modules/ModulesLoader";
2
2
  export declare class ConsoleApplication {
3
3
  modulesLoader: ModulesLoader | null;
4
4
  systemCommands: any;
5
+ constructor();
5
6
  /**
6
7
  * Init the routes and start the http-server
7
8
  */
@@ -29,6 +29,7 @@ const BackupRunCommand_1 = require("./Commands/BackupRunCommand");
29
29
  const BackupQueueCommand_1 = require("./Commands/BackupQueueCommand");
30
30
  const BackupCleanupCommand_1 = require("./Commands/BackupCleanupCommand");
31
31
  const BackupRunJob_1 = require("./Backup/Jobs/BackupRunJob");
32
+ const SystemCommands_1 = require("./Commands/SystemCommands");
32
33
  const ModulesLoader_1 = require("./Modules/ModulesLoader");
33
34
  class ConsoleApplication {
34
35
  constructor() {
@@ -46,6 +47,7 @@ class ConsoleApplication {
46
47
  QueueWorkerAutorestartCommand_1.QueueWorkerAutorestartCommand,
47
48
  BuildFinishCommand_1.BuildFinishCommand,
48
49
  ];
50
+ SystemCommands_1.SystemCommands.register(this.systemCommands);
49
51
  }
50
52
  /**
51
53
  * Init the routes and start the http-server
@@ -120,7 +122,7 @@ class ConsoleApplication {
120
122
  getCommand(signature, options) {
121
123
  if (!signature || signature.trim() === "")
122
124
  return null;
123
- for (let command of this.systemCommands) {
125
+ for (let command of SystemCommands_1.SystemCommands.getCommands()) {
124
126
  if (command.signature === signature) {
125
127
  return command;
126
128
  }
@@ -174,7 +176,7 @@ class ConsoleApplication {
174
176
  let maxSignatureLength = 15;
175
177
  const groups = {};
176
178
  // Load system commands
177
- for (let command of this.systemCommands) {
179
+ for (let command of SystemCommands_1.SystemCommands.getCommands()) {
178
180
  if (!command || !command.signature || command.hidden)
179
181
  continue;
180
182
  let groupKey = " ";
package/dist/index.d.ts CHANGED
@@ -37,6 +37,7 @@ export * from "./Backup/Jobs/BackupRunJob";
37
37
  export * from "./Backup/OutputDrivers/BaseBackupOutputDriver";
38
38
  export * from "./Backup/OutputDrivers/LocalBackupOutputDriver";
39
39
  export * from "./Commands/ConsoleOutputHelper";
40
+ export * from "./Commands/SystemCommands";
40
41
  export * from "./Modules/ModuleProvider";
41
42
  export * from "./ErrorHandling/ErrorHandler";
42
43
  export * from "./Hooks/WebframezHooks";
package/dist/index.js CHANGED
@@ -53,6 +53,7 @@ __exportStar(require("./Backup/Jobs/BackupRunJob"), exports);
53
53
  __exportStar(require("./Backup/OutputDrivers/BaseBackupOutputDriver"), exports);
54
54
  __exportStar(require("./Backup/OutputDrivers/LocalBackupOutputDriver"), exports);
55
55
  __exportStar(require("./Commands/ConsoleOutputHelper"), exports);
56
+ __exportStar(require("./Commands/SystemCommands"), exports);
56
57
  __exportStar(require("./Modules/ModuleProvider"), exports);
57
58
  __exportStar(require("./ErrorHandling/ErrorHandler"), exports);
58
59
  __exportStar(require("./Hooks/WebframezHooks"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-core",
3
- "version": "0.3.53",
3
+ "version": "0.3.55",
4
4
  "description": "The core package of the typescript based webframez (web-framework) by webtypen.de",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "license": "MIT",