@wocker/ws 1.0.2 → 1.0.4

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.
Files changed (107) hide show
  1. package/README.md +1 -1
  2. package/lib/App.d.ts +4 -3
  3. package/lib/App.js +98 -77
  4. package/lib/controllers/ImageController.d.ts +2 -2
  5. package/lib/controllers/ImageController.js +27 -27
  6. package/lib/controllers/PluginController.d.ts +2 -2
  7. package/lib/controllers/PluginController.js +78 -56
  8. package/lib/controllers/PresetController.d.ts +3 -1
  9. package/lib/controllers/PresetController.js +155 -136
  10. package/lib/controllers/ProjectController.d.ts +5 -5
  11. package/lib/controllers/ProjectController.js +653 -603
  12. package/lib/controllers/ProxyController.d.ts +4 -1
  13. package/lib/controllers/ProxyController.js +269 -245
  14. package/lib/controllers/index.js +19 -58
  15. package/lib/decorators/Inject.d.ts +1 -0
  16. package/lib/decorators/Inject.js +8 -0
  17. package/lib/decorators/Injectable.d.ts +4 -0
  18. package/lib/decorators/Injectable.js +17 -0
  19. package/lib/decorators/index.d.ts +1 -0
  20. package/lib/decorators/index.js +17 -0
  21. package/lib/env.js +33 -15
  22. package/lib/index.d.ts +3 -0
  23. package/lib/index.js +31 -16
  24. package/lib/makes/Controller.js +4 -8
  25. package/lib/makes/DI.d.ts +7 -0
  26. package/lib/makes/DI.js +27 -0
  27. package/lib/makes/Docker.js +298 -382
  28. package/lib/makes/FS.d.ts +3 -9
  29. package/lib/makes/FS.js +277 -305
  30. package/lib/makes/LineConvertStream.js +37 -40
  31. package/lib/makes/Logger.d.ts +9 -1
  32. package/lib/makes/Logger.js +22 -11
  33. package/lib/makes/Model.js +8 -12
  34. package/lib/makes/MySQL.js +6 -27
  35. package/lib/makes/Plugin.d.ts +1 -1
  36. package/lib/makes/Plugin.js +55 -37
  37. package/lib/makes/Preset.d.ts +46 -0
  38. package/lib/makes/Preset.js +33 -0
  39. package/lib/makes/Project.d.ts +45 -0
  40. package/lib/makes/Project.js +127 -0
  41. package/lib/makes/Repository.js +18 -21
  42. package/lib/makes/index.d.ts +3 -0
  43. package/lib/makes/index.js +23 -69
  44. package/lib/plugins/ElasticSearchPlugin.d.ts +3 -1
  45. package/lib/plugins/ElasticSearchPlugin.js +66 -66
  46. package/lib/plugins/LocaltunnelPlugin.d.ts +2 -2
  47. package/lib/plugins/LocaltunnelPlugin.js +256 -257
  48. package/lib/plugins/MaildevPlugin.d.ts +2 -2
  49. package/lib/plugins/MaildevPlugin.js +45 -44
  50. package/lib/plugins/MongodbPlugin.d.ts +2 -2
  51. package/lib/plugins/MongodbPlugin.js +303 -248
  52. package/lib/plugins/NgrokPlugin.d.ts +2 -2
  53. package/lib/plugins/NgrokPlugin.js +221 -231
  54. package/lib/plugins/PageKitePlugin.d.ts +2 -2
  55. package/lib/plugins/PageKitePlugin.js +150 -149
  56. package/lib/plugins/PostgresPlugin.d.ts +1 -1
  57. package/lib/plugins/PostgresPlugin.js +115 -89
  58. package/lib/plugins/ProxmoxPlugin.d.ts +1 -1
  59. package/lib/plugins/ProxmoxPlugin.js +50 -38
  60. package/lib/plugins/RedisPlugin.d.ts +3 -1
  61. package/lib/plugins/RedisPlugin.js +73 -72
  62. package/lib/plugins/index.js +25 -103
  63. package/lib/services/AppConfigService.d.ts +3 -3
  64. package/lib/services/AppConfigService.js +162 -157
  65. package/lib/services/AppEventsService.js +26 -24
  66. package/lib/services/DockerService.d.ts +37 -2
  67. package/lib/services/DockerService.js +185 -205
  68. package/lib/services/LogService.d.ts +3 -2
  69. package/lib/services/LogService.js +33 -34
  70. package/lib/services/PluginService.d.ts +2 -1
  71. package/lib/services/PluginService.js +11 -14
  72. package/lib/services/PresetService.d.ts +8 -3
  73. package/lib/services/PresetService.js +60 -59
  74. package/lib/services/ProjectService.d.ts +11 -4
  75. package/lib/services/ProjectService.js +140 -129
  76. package/lib/services/index.js +21 -80
  77. package/lib/types/Config.d.ts +4 -3
  78. package/lib/types/Config.js +1 -4
  79. package/lib/types/EnvConfig.js +1 -4
  80. package/lib/types/index.js +16 -25
  81. package/lib/utils/buildOptions.js +5 -8
  82. package/lib/utils/demuxOutput.js +16 -20
  83. package/lib/utils/escapeRegExp.js +4 -7
  84. package/lib/utils/exec.js +38 -39
  85. package/lib/utils/fetch.js +46 -30
  86. package/lib/utils/followProgress.js +66 -77
  87. package/lib/utils/format-size-units.js +16 -16
  88. package/lib/utils/get-config.d.ts +1 -1
  89. package/lib/utils/get-config.js +13 -16
  90. package/lib/utils/get-cursor-position.js +22 -29
  91. package/lib/utils/image-build.js +35 -23
  92. package/lib/utils/index.js +32 -191
  93. package/lib/utils/injectVariables.js +10 -13
  94. package/lib/utils/parse-table.js +20 -23
  95. package/lib/utils/set-config.d.ts +1 -1
  96. package/lib/utils/set-config.js +12 -15
  97. package/lib/utils/spawn.js +17 -20
  98. package/lib/utils/tty.js +2 -6
  99. package/lib/utils/volumeFormat.js +5 -12
  100. package/lib/utils/volumeParse.js +10 -13
  101. package/package.json +13 -39
  102. package/presets/bun/Dockerfile +11 -0
  103. package/presets/bun/config.json +3 -0
  104. package/presets/node/Dockerfile +4 -2
  105. package/presets/php-apache/Dockerfile +3 -2
  106. package/.github/workflows/publish.yml +0 -31
  107. package/plugins/mariadb/admin/conf/config.user.inc.php +0 -9
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Injectable = void 0;
4
+ const Injectable = () => {
5
+ return (Target) => {
6
+ return class extends Target {
7
+ constructor(di) {
8
+ const types = Reflect.getMetadata("design:paramtypes", Target);
9
+ const params = types.map((type) => {
10
+ return (di).resolveService(type);
11
+ });
12
+ super(...params);
13
+ }
14
+ };
15
+ };
16
+ };
17
+ exports.Injectable = Injectable;
@@ -0,0 +1 @@
1
+ export * from "./Injectable";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Injectable"), exports);
package/lib/env.js CHANGED
@@ -1,17 +1,35 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
5
17
  });
6
- exports.SERVICES_DIR = exports.ROOT_DIR = exports.PRESETS_DIR = exports.PLUGINS_DIR = exports.NODE_ENV = exports.MAP_PATH = exports.DATA_DIR = void 0;
7
- var OS = _interopRequireWildcard(require("os"));
8
- var Path = _interopRequireWildcard(require("path"));
9
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
10
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
- const NODE_ENV = exports.NODE_ENV = process.env.NODE_ENV;
12
- const ROOT_DIR = exports.ROOT_DIR = Path.join(__dirname, "..");
13
- const PRESETS_DIR = exports.PRESETS_DIR = Path.join(ROOT_DIR, "presets");
14
- const SERVICES_DIR = exports.SERVICES_DIR = Path.join(ROOT_DIR, "services");
15
- const PLUGINS_DIR = exports.PLUGINS_DIR = Path.join(ROOT_DIR, "plugins");
16
- const DATA_DIR = exports.DATA_DIR = process.env.WS_DIR || Path.join(OS.homedir(), ".workspace");
17
- const MAP_PATH = exports.MAP_PATH = Path.join(DATA_DIR, "data.json");
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.MAP_PATH = exports.DATA_DIR = exports.PLUGINS_DIR = exports.SERVICES_DIR = exports.PRESETS_DIR = exports.ROOT_DIR = exports.NODE_ENV = void 0;
27
+ const OS = __importStar(require("os"));
28
+ const Path = __importStar(require("path"));
29
+ exports.NODE_ENV = process.env.NODE_ENV;
30
+ exports.ROOT_DIR = Path.join(__dirname, "..");
31
+ exports.PRESETS_DIR = Path.join(exports.ROOT_DIR, "presets");
32
+ exports.SERVICES_DIR = Path.join(exports.ROOT_DIR, "services");
33
+ exports.PLUGINS_DIR = Path.join(exports.ROOT_DIR, "plugins");
34
+ exports.DATA_DIR = process.env.WS_DIR || Path.join(OS.homedir(), ".workspace");
35
+ exports.MAP_PATH = Path.join(exports.DATA_DIR, "data.json");
package/lib/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
1
  import { App } from "./App";
2
2
  declare const app: App;
3
3
  export { app };
4
+ export * from "./decorators";
5
+ export * from "./makes";
6
+ export * from "./services";
package/lib/index.js CHANGED
@@ -1,18 +1,33 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
6
17
  exports.app = void 0;
7
- var _App = require("./App");
8
- var _plugins = require("./plugins");
9
- const app = exports.app = new _App.App();
10
- app.use(_plugins.ElasticSearchPlugin);
11
- app.use(_plugins.LocaltunnelPlugin);
12
- app.use(_plugins.MaildevPlugin);
13
- app.use(_plugins.MongodbPlugin);
14
- app.use(_plugins.NgrokPlugin);
15
- app.use(_plugins.PageKitePlugin);
16
- app.use(_plugins.PostgresPlugin);
17
- app.use(_plugins.ProxmoxPlugin);
18
- app.use(_plugins.RedisPlugin);
18
+ const App_1 = require("./App");
19
+ const plugins_1 = require("./plugins");
20
+ const app = new App_1.App();
21
+ exports.app = app;
22
+ app.use(plugins_1.ElasticSearchPlugin);
23
+ app.use(plugins_1.LocaltunnelPlugin);
24
+ app.use(plugins_1.MaildevPlugin);
25
+ app.use(plugins_1.MongodbPlugin);
26
+ app.use(plugins_1.NgrokPlugin);
27
+ app.use(plugins_1.PageKitePlugin);
28
+ app.use(plugins_1.PostgresPlugin);
29
+ app.use(plugins_1.ProxmoxPlugin);
30
+ app.use(plugins_1.RedisPlugin);
31
+ __exportStar(require("./decorators"), exports);
32
+ __exportStar(require("./makes"), exports);
33
+ __exportStar(require("./services"), exports);
@@ -1,12 +1,8 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.Controller = void 0;
7
4
  class Controller {
8
- install() {
9
- // TODO: Do something on install
10
- }
5
+ install() {
6
+ }
11
7
  }
12
- exports.Controller = Controller;
8
+ exports.Controller = Controller;
@@ -0,0 +1,7 @@
1
+ import "reflect-metadata";
2
+ declare class DI {
3
+ private services;
4
+ resolveService<T>(key: any): T;
5
+ registerService(key: any, service: any): void;
6
+ }
7
+ export { DI };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DI = void 0;
4
+ require("reflect-metadata");
5
+ class DI {
6
+ constructor() {
7
+ this.services = new Map();
8
+ }
9
+ resolveService(key) {
10
+ let res = this.services.get(key);
11
+ if (!res) {
12
+ const types = Reflect.getMetadata("design:paramtypes", key);
13
+ if (types && types.length > 0) {
14
+ types.forEach((type) => {
15
+ this.resolveService(type);
16
+ });
17
+ }
18
+ res = new key(this);
19
+ this.services.set(key, res);
20
+ }
21
+ return res;
22
+ }
23
+ registerService(key, service) {
24
+ this.services.set(key, service);
25
+ }
26
+ }
27
+ exports.DI = DI;