@wocker/ws 1.0.22 → 1.0.23
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.
- package/lib/AppModule.js +36 -29
- package/lib/controllers/DebugController.d.ts +2 -1
- package/lib/controllers/DebugController.js +7 -7
- package/lib/controllers/ExperimentalController.d.ts +8 -0
- package/lib/controllers/ExperimentalController.js +77 -0
- package/lib/controllers/PluginController.d.ts +2 -1
- package/lib/controllers/PluginController.js +4 -3
- package/lib/controllers/PresetController.d.ts +5 -1
- package/lib/controllers/PresetController.js +11 -8
- package/lib/controllers/ProjectController.d.ts +6 -2
- package/lib/controllers/ProjectController.js +80 -59
- package/lib/controllers/index.d.ts +1 -3
- package/lib/controllers/index.js +1 -3
- package/lib/env.d.ts +1 -2
- package/lib/env.js +2 -3
- package/lib/main.js +7 -3
- package/lib/makes/Logger.d.ts +1 -1
- package/lib/makes/Plugin.d.ts +0 -1
- package/lib/makes/Plugin.js +0 -1
- package/lib/makes/index.d.ts +0 -1
- package/lib/makes/index.js +0 -1
- package/lib/modules/app/index.d.ts +2 -0
- package/lib/modules/app/index.js +16 -0
- package/lib/modules/docker/index.d.ts +8 -0
- package/lib/modules/docker/index.js +41 -0
- package/lib/modules/docker/services/ContainerService.d.ts +14 -0
- package/lib/modules/docker/services/ContainerService.js +115 -0
- package/lib/{services → modules/docker/services}/DockerService.d.ts +12 -5
- package/lib/{services → modules/docker/services}/DockerService.js +27 -114
- package/lib/modules/docker/services/ImageService.d.ts +18 -0
- package/lib/modules/docker/services/ImageService.js +68 -0
- package/lib/modules/docker/services/ModemService.d.ts +14 -0
- package/lib/modules/docker/services/ModemService.js +137 -0
- package/lib/modules/docker/services/ProtoService.d.ts +6 -0
- package/lib/modules/docker/services/ProtoService.js +20 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/{keystore → modules}/index.js +3 -1
- package/lib/{controllers → modules/keystore/controllers}/KeystoreController.d.ts +2 -2
- package/lib/{controllers → modules/keystore/controllers}/KeystoreController.js +5 -5
- package/lib/modules/keystore/index.d.ts +4 -0
- package/lib/modules/keystore/index.js +29 -0
- package/lib/{keystore → modules/keystore}/providers/FileKeystoreProvider.d.ts +1 -1
- package/lib/{keystore → modules/keystore}/providers/FileKeystoreProvider.js +1 -1
- package/lib/{keystore → modules/keystore}/providers/KeytarKeystoreProvider.js +1 -1
- package/lib/{keystore → modules/keystore/services}/KeystoreService.d.ts +1 -1
- package/lib/{keystore → modules/keystore/services}/KeystoreService.js +3 -3
- package/lib/{controllers → modules/proxy/controllers}/CertController.d.ts +2 -1
- package/lib/{controllers → modules/proxy/controllers}/CertController.js +4 -3
- package/lib/{controllers → modules/proxy/controllers}/ProxyController.d.ts +4 -1
- package/lib/{controllers → modules/proxy/controllers}/ProxyController.js +9 -6
- package/lib/modules/proxy/index.d.ts +5 -0
- package/lib/modules/proxy/index.js +39 -0
- package/lib/{services → modules/proxy/services}/CertService.d.ts +3 -3
- package/lib/{services → modules/proxy/services}/CertService.js +9 -9
- package/lib/{services → modules/proxy/services}/ProxyService.d.ts +2 -2
- package/lib/{services → modules/proxy/services}/ProxyService.js +15 -7
- package/lib/services/AppConfigService.d.ts +2 -13
- package/lib/services/AppConfigService.js +17 -26
- package/lib/services/PluginService.js +6 -8
- package/lib/services/PresetService.js +2 -3
- package/lib/services/ProjectService.d.ts +4 -4
- package/lib/services/ProjectService.js +9 -10
- package/lib/utils/followProgress2.d.ts +1 -0
- package/lib/utils/followProgress2.js +63 -0
- package/lib/utils/index.d.ts +1 -2
- package/lib/utils/index.js +1 -2
- package/package.json +5 -6
- package/proto/buildkit.proto +55 -0
- package/proto/solver/pb/ops.proto +443 -0
- package/lib/keystore/index.d.ts +0 -1
- package/lib/keystore/types/Encryption.d.ts +0 -9
- package/lib/keystore/types/Encryption.js +0 -81
- package/lib/keystore/types/Encryptor.d.ts +0 -10
- package/lib/keystore/types/Encryptor.js +0 -59
- package/lib/makes/FS.d.ts +0 -27
- package/lib/makes/FS.js +0 -284
- package/lib/makes/LineConvertStream.d.ts +0 -11
- package/lib/makes/LineConvertStream.js +0 -42
- package/lib/plugins/MongodbPlugin.d.ts +0 -20
- package/lib/plugins/MongodbPlugin.js +0 -288
- package/lib/plugins/index.d.ts +0 -1
- package/lib/plugins/index.js +0 -17
- package/lib/services/index.d.ts +0 -10
- package/lib/services/index.js +0 -26
- package/lib/utils/followProgress.d.ts +0 -1
- package/lib/utils/followProgress.js +0 -73
- /package/lib/{utils/format-size-units.d.ts → modules/docker/utils/formatSizeUnits.d.ts} +0 -0
- /package/lib/{utils/format-size-units.js → modules/docker/utils/formatSizeUnits.js} +0 -0
- /package/lib/{keystore → modules/keystore}/providers/KeytarKeystoreProvider.d.ts +0 -0
- /package/lib/{keystore → modules/keystore}/types/FileKeystore.d.ts +0 -0
- /package/lib/{keystore → modules/keystore}/types/FileKeystore.js +0 -0
- /package/lib/{keystore → modules/keystore}/types/Keytar.d.ts +0 -0
- /package/lib/{keystore → modules/keystore}/types/Keytar.js +0 -0
- /package/lib/{keystore → modules/keystore}/utils/createEncryptionKey.d.ts +0 -0
- /package/lib/{keystore → modules/keystore}/utils/createEncryptionKey.js +0 -0
- /package/lib/{keystore → modules/keystore}/utils/createPasswordHash.d.ts +0 -0
- /package/lib/{keystore → modules/keystore}/utils/createPasswordHash.js +0 -0
- /package/lib/{keystore → modules/keystore}/utils/decrypt.d.ts +0 -0
- /package/lib/{keystore → modules/keystore}/utils/decrypt.js +0 -0
- /package/lib/{keystore → modules/keystore}/utils/encrypt.d.ts +0 -0
- /package/lib/{keystore → modules/keystore}/utils/encrypt.js +0 -0
- /package/lib/{keystore → modules/keystore}/utils/index.d.ts +0 -0
- /package/lib/{keystore → modules/keystore}/utils/index.js +0 -0
- /package/lib/{keystore → modules/keystore}/utils/verifyPasswordHash.d.ts +0 -0
- /package/lib/{keystore → modules/keystore}/utils/verifyPasswordHash.js +0 -0
|
@@ -1,288 +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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
-
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
-
};
|
|
44
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.MongodbPlugin = void 0;
|
|
46
|
-
const core_1 = require("@wocker/core");
|
|
47
|
-
const utils_1 = require("@wocker/utils");
|
|
48
|
-
const Path = __importStar(require("path"));
|
|
49
|
-
const dateFns = __importStar(require("date-fns"));
|
|
50
|
-
const env_1 = require("../env");
|
|
51
|
-
const makes_1 = require("../makes");
|
|
52
|
-
const services_1 = require("../services");
|
|
53
|
-
let MongodbPlugin = class MongodbPlugin {
|
|
54
|
-
constructor(dockerService) {
|
|
55
|
-
this.dockerService = dockerService;
|
|
56
|
-
this.container = "mongodb.workspace";
|
|
57
|
-
this.adminContainer = "dbadmin-mongodb.workspace";
|
|
58
|
-
this.dataDir = Path.join(env_1.DATA_DIR, "db/mongodb");
|
|
59
|
-
}
|
|
60
|
-
dataPath(...parts) {
|
|
61
|
-
return Path.join(this.dataDir, ...parts);
|
|
62
|
-
}
|
|
63
|
-
async getDatabases() {
|
|
64
|
-
const stream = await this.dockerService.exec(this.container, [
|
|
65
|
-
"mongosh",
|
|
66
|
-
"--username", "root",
|
|
67
|
-
"--password", "toor",
|
|
68
|
-
"--quiet",
|
|
69
|
-
"--eval", "db.getMongo().getDBNames().forEach(function(i){print(i)})"
|
|
70
|
-
], false);
|
|
71
|
-
let res = "";
|
|
72
|
-
stream.on("data", (data) => {
|
|
73
|
-
res += (0, utils_1.demuxOutput)(data).toString();
|
|
74
|
-
});
|
|
75
|
-
await new Promise((resolve, reject) => {
|
|
76
|
-
stream.on("end", resolve);
|
|
77
|
-
stream.on("error", reject);
|
|
78
|
-
});
|
|
79
|
-
return res.split(/\r?\n/).filter((database) => {
|
|
80
|
-
return !!database;
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
async getDatabasesDumps() {
|
|
84
|
-
const dumpDir = this.dataPath("dump");
|
|
85
|
-
return makes_1.FS.readdir(dumpDir);
|
|
86
|
-
}
|
|
87
|
-
async start() {
|
|
88
|
-
console.log("Mongidb starting...");
|
|
89
|
-
await this.dockerService.pullImage("mongo:latest");
|
|
90
|
-
const container = await this.dockerService.createContainer({
|
|
91
|
-
name: this.container,
|
|
92
|
-
restart: "always",
|
|
93
|
-
image: "mongo:latest",
|
|
94
|
-
volumes: [
|
|
95
|
-
`${this.dataPath()}:/data/db`
|
|
96
|
-
],
|
|
97
|
-
ports: ["27017:27017"],
|
|
98
|
-
env: {
|
|
99
|
-
MONGO_INITDB_ROOT_USERNAME: "root",
|
|
100
|
-
MONGO_INITDB_ROOT_PASSWORD: "toor",
|
|
101
|
-
MONGO_ROOT_USER: "root",
|
|
102
|
-
MONGO_ROOT_PASSWORD: "toor"
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
await container.start();
|
|
106
|
-
await this.startAdmin();
|
|
107
|
-
}
|
|
108
|
-
async startAdmin() {
|
|
109
|
-
console.log("Mongodb Admin starting...");
|
|
110
|
-
await this.dockerService.pullImage("mongo-express:latest");
|
|
111
|
-
const container = await this.dockerService.createContainer({
|
|
112
|
-
name: this.adminContainer,
|
|
113
|
-
restart: "always",
|
|
114
|
-
env: {
|
|
115
|
-
ME_CONFIG_MONGODB_SERVER: this.container,
|
|
116
|
-
ME_CONFIG_MONGODB_PORT: "27017",
|
|
117
|
-
MONGO_ROOT_USER: "root",
|
|
118
|
-
MONGO_ROOT_PASSWORD: "toor",
|
|
119
|
-
ME_CONFIG_MONGODB_ADMINUSERNAME: "root",
|
|
120
|
-
ME_CONFIG_MONGODB_ADMINPASSWORD: "toor",
|
|
121
|
-
ME_CONFIG_MONGODB_ENABLE_ADMIN: "true",
|
|
122
|
-
ME_CONFIG_MONGODB_AUTH_DATABASE: "admin",
|
|
123
|
-
ME_CONFIG_MONGODB_AUTH_USERNAME: "root",
|
|
124
|
-
ME_CONFIG_MONGODB_AUTH_PASSWORD: "toor",
|
|
125
|
-
VIRTUAL_HOST: this.adminContainer,
|
|
126
|
-
VIRTUAL_PORT: "8081"
|
|
127
|
-
},
|
|
128
|
-
image: "mongo-express:latest"
|
|
129
|
-
});
|
|
130
|
-
await container.start();
|
|
131
|
-
}
|
|
132
|
-
async stop() {
|
|
133
|
-
await this.stopDB();
|
|
134
|
-
await this.stopAdmin();
|
|
135
|
-
}
|
|
136
|
-
async stopDB() {
|
|
137
|
-
console.log("Mongodb stopping...");
|
|
138
|
-
const container = await this.dockerService.getContainer(this.container);
|
|
139
|
-
if (container) {
|
|
140
|
-
try {
|
|
141
|
-
await container.stop();
|
|
142
|
-
await container.remove();
|
|
143
|
-
}
|
|
144
|
-
catch (err) {
|
|
145
|
-
makes_1.Logger.error(err.message);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
async stopAdmin() {
|
|
150
|
-
console.log("Mongodb Admin stopping...");
|
|
151
|
-
await this.dockerService.removeContainer(this.adminContainer);
|
|
152
|
-
}
|
|
153
|
-
async restart() {
|
|
154
|
-
await this.stop();
|
|
155
|
-
await this.start();
|
|
156
|
-
}
|
|
157
|
-
async backup(database) {
|
|
158
|
-
if (!database) {
|
|
159
|
-
database = await (0, utils_1.promptSelect)({
|
|
160
|
-
message: "Database",
|
|
161
|
-
options: await this.getDatabases()
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
const date = dateFns.format(new Date(), "yyyy-MM-dd HH-mm");
|
|
165
|
-
const dirPath = this.dataPath("dump", database);
|
|
166
|
-
const filePath = this.dataPath("dump", database, `${date}.gz`);
|
|
167
|
-
if (!makes_1.FS.existsSync(dirPath)) {
|
|
168
|
-
makes_1.FS.mkdirSync(dirPath, {
|
|
169
|
-
recursive: true
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
const stream = await this.dockerService.exec(this.container, [
|
|
173
|
-
"mongodump",
|
|
174
|
-
"--authenticationDatabase", "admin",
|
|
175
|
-
"--host", `${this.container}:27017`,
|
|
176
|
-
"--username", "root",
|
|
177
|
-
"--password", "toor",
|
|
178
|
-
"--db", database,
|
|
179
|
-
"--archive",
|
|
180
|
-
"--gzip"
|
|
181
|
-
], false);
|
|
182
|
-
const file = makes_1.FS.createWriteStream(filePath);
|
|
183
|
-
stream.on("data", (data) => {
|
|
184
|
-
file.write((0, utils_1.demuxOutput)(data));
|
|
185
|
-
});
|
|
186
|
-
await new Promise((resolve, reject) => {
|
|
187
|
-
stream.on("end", resolve);
|
|
188
|
-
stream.on("error", reject);
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
async deleteBackup(database, filename, yes) {
|
|
192
|
-
if (!database) {
|
|
193
|
-
database = await (0, utils_1.promptSelect)({
|
|
194
|
-
message: "Database",
|
|
195
|
-
options: await this.getDatabasesDumps()
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
if (!database) {
|
|
199
|
-
throw new Error("No database");
|
|
200
|
-
}
|
|
201
|
-
const dirPath = this.dataPath("dump", database);
|
|
202
|
-
if (!makes_1.FS.existsSync(dirPath)) {
|
|
203
|
-
throw new Error(`Backups dir for database "${database}" not found`);
|
|
204
|
-
}
|
|
205
|
-
if (!filename) {
|
|
206
|
-
const files = await makes_1.FS.readdirFiles(dirPath);
|
|
207
|
-
if (files.length === 0) {
|
|
208
|
-
throw new Error(`No backups for ${database}`);
|
|
209
|
-
}
|
|
210
|
-
filename = await (0, utils_1.promptSelect)({
|
|
211
|
-
message: "File",
|
|
212
|
-
options: files
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
const filePath = this.dataPath("dump", database, filename);
|
|
216
|
-
if (!makes_1.FS.existsSync(filePath)) {
|
|
217
|
-
throw new Error(`Backup "${filename}" not found`);
|
|
218
|
-
}
|
|
219
|
-
if (!yes) {
|
|
220
|
-
yes = await (0, utils_1.promptConfirm)({
|
|
221
|
-
message: `Delete ${filename}?`,
|
|
222
|
-
default: false
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
if (!yes) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
await makes_1.FS.rm(filePath);
|
|
229
|
-
const otherFiles = await makes_1.FS.readdir(dirPath);
|
|
230
|
-
if (otherFiles.length === 0) {
|
|
231
|
-
await makes_1.FS.rm(dirPath, {
|
|
232
|
-
force: true,
|
|
233
|
-
recursive: true
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
async restore(database, filename) {
|
|
238
|
-
if (!database) {
|
|
239
|
-
const dumps = await makes_1.FS.readdir(this.dataPath("dump"));
|
|
240
|
-
if (dumps.length === 0) {
|
|
241
|
-
throw new Error("No dumps found");
|
|
242
|
-
}
|
|
243
|
-
database = await (0, utils_1.promptSelect)({
|
|
244
|
-
message: "Database",
|
|
245
|
-
options: dumps
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
if (!database) {
|
|
249
|
-
throw new Error("Need database name");
|
|
250
|
-
}
|
|
251
|
-
if (!filename) {
|
|
252
|
-
const filenames = await makes_1.FS.readdir(this.dataPath("dump", database));
|
|
253
|
-
filename = await (0, utils_1.promptSelect)({
|
|
254
|
-
message: "File",
|
|
255
|
-
options: filenames
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
const path = this.dataPath("dump", database, filename);
|
|
259
|
-
const file = makes_1.FS.createReadStream(path);
|
|
260
|
-
const stream = await this.dockerService.exec(this.container, [
|
|
261
|
-
"mongorestore",
|
|
262
|
-
"--authenticationDatabase", "admin",
|
|
263
|
-
"--host", `${this.container}:27017`,
|
|
264
|
-
"--username", "root",
|
|
265
|
-
"--password", "toor",
|
|
266
|
-
"--db", database,
|
|
267
|
-
"--drop",
|
|
268
|
-
"--gzip",
|
|
269
|
-
"--archive"
|
|
270
|
-
], false);
|
|
271
|
-
file.on("data", (data) => {
|
|
272
|
-
stream.write(data);
|
|
273
|
-
});
|
|
274
|
-
file.on("end", () => {
|
|
275
|
-
throw new Error("File end");
|
|
276
|
-
});
|
|
277
|
-
stream.on("error", (err) => {
|
|
278
|
-
file.close();
|
|
279
|
-
throw err;
|
|
280
|
-
});
|
|
281
|
-
console.log(path);
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
exports.MongodbPlugin = MongodbPlugin;
|
|
285
|
-
exports.MongodbPlugin = MongodbPlugin = __decorate([
|
|
286
|
-
(0, core_1.Controller)(),
|
|
287
|
-
__metadata("design:paramtypes", [services_1.DockerService])
|
|
288
|
-
], MongodbPlugin);
|
package/lib/plugins/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./MongodbPlugin";
|
package/lib/plugins/index.js
DELETED
|
@@ -1,17 +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("./MongodbPlugin"), exports);
|
package/lib/services/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./AppConfigService";
|
|
2
|
-
export * from "./AppEventsService";
|
|
3
|
-
export * from "./CertService";
|
|
4
|
-
export * from "./DockerService";
|
|
5
|
-
export * from "./LogService";
|
|
6
|
-
export * from "./NpmService";
|
|
7
|
-
export * from "./PluginService";
|
|
8
|
-
export * from "./PresetService";
|
|
9
|
-
export * from "./ProjectService";
|
|
10
|
-
export * from "./ProxyService";
|
package/lib/services/index.js
DELETED
|
@@ -1,26 +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("./AppConfigService"), exports);
|
|
18
|
-
__exportStar(require("./AppEventsService"), exports);
|
|
19
|
-
__exportStar(require("./CertService"), exports);
|
|
20
|
-
__exportStar(require("./DockerService"), exports);
|
|
21
|
-
__exportStar(require("./LogService"), exports);
|
|
22
|
-
__exportStar(require("./NpmService"), exports);
|
|
23
|
-
__exportStar(require("./PluginService"), exports);
|
|
24
|
-
__exportStar(require("./PresetService"), exports);
|
|
25
|
-
__exportStar(require("./ProjectService"), exports);
|
|
26
|
-
__exportStar(require("./ProxyService"), exports);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const followProgress: (stream: NodeJS.ReadableStream) => Promise<unknown>;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.followProgress = void 0;
|
|
4
|
-
const LineConvertStream_1 = require("../makes/LineConvertStream");
|
|
5
|
-
const format_size_units_1 = require("./format-size-units");
|
|
6
|
-
const makes_1 = require("../makes");
|
|
7
|
-
const followProgress = async (stream) => {
|
|
8
|
-
const lineStream = new LineConvertStream_1.LineConvertStream(stream);
|
|
9
|
-
let line = 0;
|
|
10
|
-
const mapLines = {};
|
|
11
|
-
return new Promise((resolve, reject) => {
|
|
12
|
-
let isEnded = false;
|
|
13
|
-
const handleEnd = () => {
|
|
14
|
-
if (!isEnded) {
|
|
15
|
-
resolve(null);
|
|
16
|
-
}
|
|
17
|
-
isEnded = true;
|
|
18
|
-
};
|
|
19
|
-
lineStream.on("data", (chunk) => {
|
|
20
|
-
const data = JSON.parse(chunk.toString());
|
|
21
|
-
const { stream, id, status, progressDetail: { current, total } = {}, aux, error, errorDetail } = data;
|
|
22
|
-
if (stream) {
|
|
23
|
-
process.stdout.write(`${stream}`);
|
|
24
|
-
line += stream.split("\n").length - 1;
|
|
25
|
-
}
|
|
26
|
-
else if (id) {
|
|
27
|
-
if (typeof mapLines[id] === "undefined") {
|
|
28
|
-
mapLines[id] = line;
|
|
29
|
-
}
|
|
30
|
-
const targetLine = typeof mapLines[id] !== "undefined" ? mapLines[id] : line;
|
|
31
|
-
const dy = line - targetLine;
|
|
32
|
-
if (dy > 0) {
|
|
33
|
-
process.stdout.write("\x1b[s");
|
|
34
|
-
process.stdout.write(`\x1b[${dy}A`);
|
|
35
|
-
}
|
|
36
|
-
process.stdout.write("\x1b[2K");
|
|
37
|
-
let str = `${id}: ${status}\n`;
|
|
38
|
-
if (status === "Downloading") {
|
|
39
|
-
const width = process.stdout.columns;
|
|
40
|
-
const sizeWidth = 19, totalWidth = width - id.length - status.length - sizeWidth - 7, currentWidth = Math.floor(totalWidth * (current / total)), formatSize = `${(0, format_size_units_1.formatSizeUnits)(current)}/${(0, format_size_units_1.formatSizeUnits)(total)}`;
|
|
41
|
-
str = `${id}: ${status} [${"█".repeat(currentWidth)}${"░".repeat(totalWidth - currentWidth)}] ${formatSize}\n`;
|
|
42
|
-
}
|
|
43
|
-
process.stdout.write(str);
|
|
44
|
-
if (dy > 0) {
|
|
45
|
-
process.stdout.write("\x1b[u");
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
line++;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else if (status) {
|
|
52
|
-
process.stdout.write(`${status}\n`);
|
|
53
|
-
line += Math.ceil(status.length / process.stdout.columns);
|
|
54
|
-
}
|
|
55
|
-
else if (aux) {
|
|
56
|
-
const str = `auxID: ${aux.ID}`;
|
|
57
|
-
process.stdout.write(`${str}\n`);
|
|
58
|
-
line += Math.ceil(str.length / process.stdout.columns);
|
|
59
|
-
}
|
|
60
|
-
else if (error) {
|
|
61
|
-
reject(new Error(error));
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
makes_1.Logger.warn("followProgress: unexpected data", data);
|
|
65
|
-
reject(new Error(`(followProgress) unexpected data: ${JSON.stringify(data)}`));
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
lineStream.on("end", handleEnd);
|
|
69
|
-
lineStream.on("close", handleEnd);
|
|
70
|
-
lineStream.on("error", reject);
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
exports.followProgress = followProgress;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|