@wocker/ws 1.0.7 → 1.0.8

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 (96) hide show
  1. package/bin/ws.js +1 -1
  2. package/lib/App.d.ts +1 -6
  3. package/lib/App.js +1 -27
  4. package/lib/AppModule.d.ts +6 -0
  5. package/lib/AppModule.js +97 -0
  6. package/lib/controllers/CompletionController.d.ts +6 -0
  7. package/lib/controllers/CompletionController.js +32 -0
  8. package/lib/controllers/ImageController.d.ts +5 -8
  9. package/lib/controllers/ImageController.js +27 -12
  10. package/lib/controllers/PluginController.d.ts +9 -13
  11. package/lib/controllers/PluginController.js +56 -18
  12. package/lib/controllers/PresetController.d.ts +9 -15
  13. package/lib/controllers/PresetController.js +41 -22
  14. package/lib/controllers/ProjectController.d.ts +27 -69
  15. package/lib/controllers/ProjectController.js +336 -261
  16. package/lib/controllers/ProxyController.d.ts +15 -25
  17. package/lib/controllers/ProxyController.js +142 -96
  18. package/lib/controllers/index.d.ts +1 -0
  19. package/lib/controllers/index.js +1 -0
  20. package/lib/index.d.ts +0 -1
  21. package/lib/index.js +0 -11
  22. package/lib/main.d.ts +3 -0
  23. package/lib/main.js +11 -0
  24. package/lib/makes/Logger.d.ts +2 -2
  25. package/lib/makes/Logger.js +19 -8
  26. package/lib/makes/Preset.d.ts +3 -4
  27. package/lib/makes/Preset.js +19 -8
  28. package/lib/makes/index.d.ts +0 -6
  29. package/lib/makes/index.js +0 -6
  30. package/lib/plugins/ElasticSearchPlugin.d.ts +5 -6
  31. package/lib/plugins/ElasticSearchPlugin.js +19 -8
  32. package/lib/plugins/LocaltunnelPlugin.d.ts +8 -8
  33. package/lib/plugins/LocaltunnelPlugin.js +25 -10
  34. package/lib/plugins/MaildevPlugin.d.ts +5 -6
  35. package/lib/plugins/MaildevPlugin.js +21 -8
  36. package/lib/plugins/MongodbPlugin.d.ts +5 -5
  37. package/lib/plugins/MongodbPlugin.js +26 -11
  38. package/lib/plugins/NgrokPlugin.d.ts +7 -6
  39. package/lib/plugins/NgrokPlugin.js +32 -17
  40. package/lib/plugins/PageKitePlugin.d.ts +10 -8
  41. package/lib/plugins/PageKitePlugin.js +36 -20
  42. package/lib/plugins/ProxmoxPlugin.d.ts +8 -5
  43. package/lib/plugins/ProxmoxPlugin.js +25 -9
  44. package/lib/plugins/RedisPlugin.d.ts +4 -6
  45. package/lib/plugins/RedisPlugin.js +19 -8
  46. package/lib/plugins/index.d.ts +0 -2
  47. package/lib/plugins/index.js +0 -2
  48. package/lib/services/AppConfigService.d.ts +3 -3
  49. package/lib/services/AppConfigService.js +16 -2
  50. package/lib/services/AppEventsService.d.ts +1 -2
  51. package/lib/services/AppEventsService.js +11 -2
  52. package/lib/services/DockerService.d.ts +9 -39
  53. package/lib/services/DockerService.js +122 -4
  54. package/lib/services/LogService.d.ts +3 -5
  55. package/lib/services/LogService.js +19 -4
  56. package/lib/services/PluginService.d.ts +4 -9
  57. package/lib/services/PluginService.js +18 -8
  58. package/lib/services/PresetService.d.ts +5 -5
  59. package/lib/services/PresetService.js +11 -2
  60. package/lib/services/ProjectService.d.ts +9 -6
  61. package/lib/services/ProjectService.js +62 -31
  62. package/lib/utils/get-config.d.ts +2 -2
  63. package/lib/utils/index.d.ts +0 -1
  64. package/lib/utils/index.js +0 -1
  65. package/lib/utils/set-config.d.ts +2 -2
  66. package/package.json +4 -4
  67. package/presets/node/config.json +1 -1
  68. package/presets/php-fpm/Dockerfile +1 -1
  69. package/lib/decorators/Inject.d.ts +0 -1
  70. package/lib/decorators/Inject.js +0 -8
  71. package/lib/decorators/Injectable.d.ts +0 -4
  72. package/lib/decorators/Injectable.js +0 -17
  73. package/lib/decorators/index.d.ts +0 -1
  74. package/lib/decorators/index.js +0 -17
  75. package/lib/makes/Controller.d.ts +0 -5
  76. package/lib/makes/Controller.js +0 -8
  77. package/lib/makes/DI.d.ts +0 -7
  78. package/lib/makes/DI.js +0 -27
  79. package/lib/makes/Docker.d.ts +0 -58
  80. package/lib/makes/Docker.js +0 -320
  81. package/lib/makes/Plugin.d.ts +0 -13
  82. package/lib/makes/Plugin.js +0 -61
  83. package/lib/makes/Project.d.ts +0 -45
  84. package/lib/makes/Project.js +0 -127
  85. package/lib/makes/Repository.d.ts +0 -11
  86. package/lib/makes/Repository.js +0 -22
  87. package/lib/plugins/PostgresPlugin.d.ts +0 -16
  88. package/lib/plugins/PostgresPlugin.js +0 -121
  89. package/lib/types/Config.d.ts +0 -12
  90. package/lib/types/Config.js +0 -2
  91. package/lib/types/EnvConfig.d.ts +0 -3
  92. package/lib/types/EnvConfig.js +0 -2
  93. package/lib/types/index.d.ts +0 -2
  94. package/lib/types/index.js +0 -18
  95. package/lib/utils/demuxOutput.d.ts +0 -2
  96. package/lib/utils/demuxOutput.js +0 -19
@@ -1,121 +0,0 @@
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 __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;
17
- });
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.PostgresPlugin = void 0;
27
- const Path = __importStar(require("path"));
28
- const env_1 = require("../env");
29
- const makes_1 = require("../makes");
30
- class PostgresPlugin extends makes_1.Plugin {
31
- constructor() {
32
- super("postgres");
33
- this.container = "postgres.workspace";
34
- this.adminContainer = "dbadmin-postgres.workspace";
35
- this.dataDir = Path.join(env_1.DATA_DIR, "db/postgres");
36
- }
37
- install(cli) {
38
- super.install(cli);
39
- cli.command("postgres:start")
40
- .action(() => this.start());
41
- cli.command("postgres:stop")
42
- .action(() => this.stop());
43
- cli.command("postgres:restart")
44
- .action(() => this.restart());
45
- }
46
- async start() {
47
- await this.startDB();
48
- await this.startAdmin();
49
- }
50
- async startDB() {
51
- console.log("Postgres starting...");
52
- await makes_1.Docker.pullImage("postgres:latest");
53
- const container = await makes_1.Docker.createContainer({
54
- name: this.container,
55
- restart: "always",
56
- image: "postgres:latest",
57
- volumes: [
58
- `${this.dataPath()}:/var/lib/postgresql/data`
59
- ],
60
- ports: ["5432:5432"],
61
- env: {
62
- POSTGRES_USER: "root",
63
- POSTGRES_PASSWORD: "toor"
64
- }
65
- });
66
- await container.start();
67
- }
68
- async startAdmin() {
69
- console.log("Postgres Admin starting...");
70
- await makes_1.Docker.pullImage("dpage/pgadmin4:latest");
71
- const container = await makes_1.Docker.createContainer({
72
- name: this.adminContainer,
73
- restart: "always",
74
- links: [
75
- `${this.container}:postgres`
76
- ],
77
- env: {
78
- PGADMIN_DEFAULT_EMAIL: "postgres@workspace.com.ua",
79
- PGADMIN_DEFAULT_PASSWORD: "toor",
80
- VIRTUAL_HOST: this.adminContainer
81
- },
82
- image: "dpage/pgadmin4:latest"
83
- });
84
- await container.start();
85
- }
86
- async stop() {
87
- await this.stopDB();
88
- await this.stopAdmin();
89
- }
90
- async stopDB() {
91
- console.log("Postgres stopping...");
92
- const container = await makes_1.Docker.getContainer(this.container);
93
- if (container) {
94
- try {
95
- await container.stop();
96
- await container.remove();
97
- }
98
- catch (err) {
99
- makes_1.Logger.error(err.message);
100
- }
101
- }
102
- }
103
- async stopAdmin() {
104
- console.log("Stopping postgres admin...");
105
- const container = await makes_1.Docker.getContainer(this.adminContainer);
106
- if (container) {
107
- try {
108
- await container.stop();
109
- await container.remove();
110
- }
111
- catch (err) {
112
- makes_1.Logger.error(err.message);
113
- }
114
- }
115
- }
116
- async restart() {
117
- await this.stop();
118
- await this.start();
119
- }
120
- }
121
- exports.PostgresPlugin = PostgresPlugin;
@@ -1,12 +0,0 @@
1
- import { EnvConfig } from "./EnvConfig";
2
- export type Config = {
3
- debug?: boolean;
4
- meta: EnvConfig;
5
- env: EnvConfig;
6
- plugins: string[];
7
- projects: {
8
- id: string;
9
- name?: string;
10
- src: string;
11
- }[];
12
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +0,0 @@
1
- export type EnvConfig = {
2
- [key: string]: string;
3
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- export * from "./Config";
2
- export * from "./EnvConfig";
@@ -1,18 +0,0 @@
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("./Config"), exports);
18
- __exportStar(require("./EnvConfig"), exports);
@@ -1,2 +0,0 @@
1
- /// <reference types="node" />
2
- export declare const demuxOutput: (buffer: any) => Buffer;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.demuxOutput = void 0;
4
- const demuxOutput = (buffer) => {
5
- let nextDataLength = null, output = Buffer.from([]);
6
- while (buffer.length > 0) {
7
- const header = bufferSlice(8);
8
- nextDataLength = header.readUInt32BE(4);
9
- const content = bufferSlice(nextDataLength);
10
- output = Buffer.concat([output, content]);
11
- }
12
- function bufferSlice(end) {
13
- const out = buffer.slice(0, end);
14
- buffer = Buffer.from(buffer.slice(end, buffer.length));
15
- return out;
16
- }
17
- return output;
18
- };
19
- exports.demuxOutput = demuxOutput;