@wocker/ws 1.0.22 → 1.0.24
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.d.ts → RootModule.d.ts} +1 -1
- package/lib/RootModule.js +93 -0
- package/lib/controllers/DebugController.d.ts +1 -1
- package/lib/controllers/DebugController.js +7 -9
- package/lib/controllers/ExperimentalController.d.ts +8 -0
- package/lib/controllers/ExperimentalController.js +76 -0
- package/lib/controllers/PluginController.d.ts +2 -1
- package/lib/controllers/PluginController.js +3 -3
- package/lib/controllers/ProjectController.d.ts +8 -7
- package/lib/controllers/ProjectController.js +123 -240
- package/lib/controllers/index.d.ts +1 -4
- package/lib/controllers/index.js +1 -4
- package/lib/env.d.ts +2 -3
- package/lib/env.js +3 -4
- package/lib/main.js +8 -8
- package/lib/makes/Plugin.d.ts +0 -1
- package/lib/makes/Plugin.js +0 -1
- package/lib/makes/index.d.ts +0 -2
- package/lib/makes/index.js +0 -2
- package/lib/modules/app/index.d.ts +2 -0
- package/lib/modules/app/index.js +32 -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 +15 -0
- package/lib/modules/docker/services/ModemService.js +138 -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 +6 -0
- package/lib/{keystore → modules}/index.js +6 -1
- package/lib/{controllers → modules/keystore/controllers}/KeystoreController.d.ts +2 -2
- package/lib/{controllers → modules/keystore/controllers}/KeystoreController.js +4 -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 +3 -4
- package/lib/{keystore → modules/keystore}/providers/FileKeystoreProvider.js +4 -5
- package/lib/{keystore → modules/keystore}/providers/KeytarKeystoreProvider.js +1 -1
- package/lib/{keystore → modules/keystore/services}/KeystoreService.d.ts +4 -3
- package/lib/{keystore → modules/keystore/services}/KeystoreService.js +9 -6
- package/lib/modules/preset/controllers/PresetController.d.ts +18 -0
- package/lib/modules/preset/controllers/PresetController.js +157 -0
- package/lib/modules/preset/controllers/PresetListener.d.ts +14 -0
- package/lib/modules/preset/controllers/PresetListener.js +140 -0
- package/lib/modules/preset/index.d.ts +5 -0
- package/lib/modules/preset/index.js +39 -0
- package/lib/modules/preset/repositories/PresetRepository.d.ts +16 -0
- package/lib/{repositories → modules/preset/repositories}/PresetRepository.js +9 -11
- package/lib/{services → modules/preset/services}/PresetService.d.ts +4 -12
- package/lib/{services → modules/preset/services}/PresetService.js +22 -27
- package/lib/modules/project/controllers/ProjectController.d.ts +13 -0
- package/lib/modules/project/controllers/ProjectController.js +127 -0
- package/lib/modules/project/index.d.ts +5 -0
- package/lib/modules/project/index.js +39 -0
- package/lib/modules/project/repositories/ProjectRepository.d.ts +13 -0
- package/lib/modules/project/repositories/ProjectRepository.js +90 -0
- package/lib/modules/project/services/ProjectService.d.ts +21 -0
- package/lib/modules/project/services/ProjectService.js +211 -0
- 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 +5 -4
- package/lib/{controllers → modules/proxy/controllers}/ProxyController.js +12 -11
- package/lib/modules/proxy/index.d.ts +5 -0
- package/lib/modules/proxy/index.js +41 -0
- package/lib/{services → modules/proxy/services}/CertService.d.ts +5 -6
- package/lib/{services → modules/proxy/services}/CertService.js +13 -14
- package/lib/{services → modules/proxy/services}/ProxyService.d.ts +4 -4
- package/lib/{services → modules/proxy/services}/ProxyService.js +27 -20
- package/lib/services/PluginService.d.ts +1 -3
- package/lib/services/PluginService.js +12 -18
- 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 +7 -8
- package/proto/buildkit.proto +55 -0
- package/proto/solver/pb/ops.proto +443 -0
- package/lib/AppModule.js +0 -84
- package/lib/controllers/PresetController.d.ts +0 -23
- package/lib/controllers/PresetController.js +0 -361
- 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/makes/Logger.d.ts +0 -9
- package/lib/makes/Logger.js +0 -34
- 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/repositories/PresetRepository.d.ts +0 -23
- package/lib/repositories/index.d.ts +0 -1
- package/lib/repositories/index.js +0 -17
- package/lib/services/AppConfigService.d.ts +0 -35
- package/lib/services/AppConfigService.js +0 -163
- package/lib/services/AppEventsService.d.ts +0 -9
- package/lib/services/AppEventsService.js +0 -43
- package/lib/services/LogService.d.ts +0 -15
- package/lib/services/LogService.js +0 -67
- package/lib/services/ProjectService.d.ts +0 -27
- package/lib/services/ProjectService.js +0 -207
- 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/presets/go/Dockerfile +0 -19
- package/presets/go/config.json +0 -14
- package/presets/php-fpm/Dockerfile +0 -173
- package/presets/php-fpm/bin/compare-version +0 -3
- package/presets/php-fpm/config.json +0 -55
- package/presets/php-fpm/etc/nginx/sites-available/default.conf +0 -36
- /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,361 +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
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
45
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
46
|
-
};
|
|
47
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
-
};
|
|
50
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
exports.PresetController = void 0;
|
|
52
|
-
const core_1 = require("@wocker/core");
|
|
53
|
-
const utils_1 = require("@wocker/utils");
|
|
54
|
-
const utils_2 = require("@wocker/utils");
|
|
55
|
-
const Path = __importStar(require("path"));
|
|
56
|
-
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
57
|
-
const env_1 = require("../env");
|
|
58
|
-
const utils_3 = require("../utils");
|
|
59
|
-
const repositories_1 = require("../repositories");
|
|
60
|
-
const services_1 = require("../services");
|
|
61
|
-
let PresetController = class PresetController {
|
|
62
|
-
constructor(appConfigService, appEventsService, projectService, presetService, presetRepository, dockerService) {
|
|
63
|
-
this.appConfigService = appConfigService;
|
|
64
|
-
this.appEventsService = appEventsService;
|
|
65
|
-
this.projectService = projectService;
|
|
66
|
-
this.presetService = presetService;
|
|
67
|
-
this.presetRepository = presetRepository;
|
|
68
|
-
this.dockerService = dockerService;
|
|
69
|
-
this.appEventsService.on("project:init", (project) => this.onInit(project));
|
|
70
|
-
this.appEventsService.on("project:beforeStart", (project) => this.onBeforeStart(project));
|
|
71
|
-
this.appEventsService.on("project:rebuild", (project) => this.onRebuild(project));
|
|
72
|
-
}
|
|
73
|
-
async presets() {
|
|
74
|
-
const presets = this.presetRepository.search();
|
|
75
|
-
return presets.map((preset) => {
|
|
76
|
-
return preset.name;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
async onInit(project) {
|
|
80
|
-
if (project.type !== core_1.PROJECT_TYPE_PRESET) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const presets = this.presetRepository.search();
|
|
84
|
-
if (presets.length === 0) {
|
|
85
|
-
throw new Error("No presets");
|
|
86
|
-
}
|
|
87
|
-
project.preset = await (0, utils_1.promptSelect)({
|
|
88
|
-
message: "Choose preset",
|
|
89
|
-
options: presets.map((preset) => {
|
|
90
|
-
return {
|
|
91
|
-
label: preset.name,
|
|
92
|
-
value: preset.name
|
|
93
|
-
};
|
|
94
|
-
}),
|
|
95
|
-
default: project.preset
|
|
96
|
-
});
|
|
97
|
-
project.presetMode = await (0, utils_1.promptSelect)({
|
|
98
|
-
message: "Preset mode",
|
|
99
|
-
options: [
|
|
100
|
-
{
|
|
101
|
-
label: "For project only",
|
|
102
|
-
value: "project"
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
label: "Global usage",
|
|
106
|
-
value: "global"
|
|
107
|
-
}
|
|
108
|
-
],
|
|
109
|
-
default: project.presetMode
|
|
110
|
-
});
|
|
111
|
-
const preset = this.presetService.get(project.preset);
|
|
112
|
-
if (!preset) {
|
|
113
|
-
throw new Error("Preset not found");
|
|
114
|
-
}
|
|
115
|
-
if (preset.buildArgsOptions) {
|
|
116
|
-
project.buildArgs = await this.presetService.prompt(preset.buildArgsOptions, project.buildArgs);
|
|
117
|
-
}
|
|
118
|
-
if (preset.envOptions) {
|
|
119
|
-
project.env = await this.presetService.prompt(preset.envOptions, project.env);
|
|
120
|
-
}
|
|
121
|
-
if (preset.volumeOptions) {
|
|
122
|
-
for (let volume of preset.volumeOptions) {
|
|
123
|
-
volume = (0, utils_3.injectVariables)(volume, {
|
|
124
|
-
...project.buildArgs || {},
|
|
125
|
-
...project.env || {}
|
|
126
|
-
});
|
|
127
|
-
const { source, destination, options } = (0, utils_2.volumeParse)(volume);
|
|
128
|
-
let projectVolume = project.getVolumeByDestination(destination);
|
|
129
|
-
const newSource = await (0, utils_1.promptInput)({
|
|
130
|
-
message: "Volume",
|
|
131
|
-
required: true,
|
|
132
|
-
suffix: `:${destination}`,
|
|
133
|
-
default: projectVolume ? (0, utils_2.volumeParse)(projectVolume).source : source
|
|
134
|
-
});
|
|
135
|
-
projectVolume = (0, utils_2.volumeFormat)({
|
|
136
|
-
source: newSource,
|
|
137
|
-
destination,
|
|
138
|
-
options
|
|
139
|
-
});
|
|
140
|
-
project.volumeMount(projectVolume);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (preset.dockerfile) {
|
|
144
|
-
project.imageName = this.presetService.getImageNameForProject(project, preset);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
async onRebuild(project) {
|
|
148
|
-
if (project.type !== core_1.PROJECT_TYPE_PRESET) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
const preset = this.presetService.get(project.preset);
|
|
152
|
-
if (!preset) {
|
|
153
|
-
throw new Error(`Preset ${project.preset} not found`);
|
|
154
|
-
}
|
|
155
|
-
const imageName = this.presetService.getImageNameForProject(project, preset);
|
|
156
|
-
const exists = await this.dockerService.imageExists(imageName);
|
|
157
|
-
if (exists) {
|
|
158
|
-
console.info(`Removing image: ${imageName}`);
|
|
159
|
-
await this.dockerService.imageRm(imageName);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
async onBeforeStart(project) {
|
|
163
|
-
if (project.type !== core_1.PROJECT_TYPE_PRESET) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
const preset = this.presetService.get(project.preset);
|
|
167
|
-
if (preset.dockerfile) {
|
|
168
|
-
project.imageName = this.presetService.getImageNameForProject(project, preset);
|
|
169
|
-
if (!await this.dockerService.imageExists(project.imageName)) {
|
|
170
|
-
await this.dockerService.buildImage({
|
|
171
|
-
tag: project.imageName,
|
|
172
|
-
labels: {
|
|
173
|
-
presetName: preset.name
|
|
174
|
-
},
|
|
175
|
-
buildArgs: project.buildArgs,
|
|
176
|
-
context: preset.path,
|
|
177
|
-
src: preset.dockerfile
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
async init() {
|
|
183
|
-
await this.presetService.init();
|
|
184
|
-
}
|
|
185
|
-
async destroy() {
|
|
186
|
-
await this.presetService.deinit();
|
|
187
|
-
}
|
|
188
|
-
async add(name, version) {
|
|
189
|
-
await this.presetService.addPreset(name, version);
|
|
190
|
-
}
|
|
191
|
-
async list() {
|
|
192
|
-
const presets = this.presetRepository.search();
|
|
193
|
-
const table = new cli_table3_1.default({
|
|
194
|
-
head: [
|
|
195
|
-
"Name",
|
|
196
|
-
"Source",
|
|
197
|
-
"Path"
|
|
198
|
-
]
|
|
199
|
-
});
|
|
200
|
-
for (const preset of presets) {
|
|
201
|
-
table.push([
|
|
202
|
-
preset.name,
|
|
203
|
-
preset.source,
|
|
204
|
-
preset.source === core_1.PRESET_SOURCE_EXTERNAL ? preset.path : ""
|
|
205
|
-
]);
|
|
206
|
-
}
|
|
207
|
-
return table.toString();
|
|
208
|
-
}
|
|
209
|
-
async delete(name, confirm) {
|
|
210
|
-
const preset = this.presetService.get(name);
|
|
211
|
-
if (typeof confirm === "undefined" || confirm === null) {
|
|
212
|
-
confirm = await (0, utils_2.promptConfirm)({
|
|
213
|
-
message: `Delete preset ${name}?`,
|
|
214
|
-
default: false
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
if (!confirm) {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
console.info("Deleting...");
|
|
221
|
-
preset.delete();
|
|
222
|
-
}
|
|
223
|
-
async eject(name) {
|
|
224
|
-
if (name) {
|
|
225
|
-
this.projectService.cdProject(name);
|
|
226
|
-
}
|
|
227
|
-
const project = this.projectService.get();
|
|
228
|
-
const preset = this.presetService.get(project.preset);
|
|
229
|
-
if (!preset) {
|
|
230
|
-
throw new Error("Preset not found");
|
|
231
|
-
}
|
|
232
|
-
const confirm = await (0, utils_2.promptConfirm)({
|
|
233
|
-
message: "Confirm eject",
|
|
234
|
-
default: false
|
|
235
|
-
});
|
|
236
|
-
if (!confirm) {
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
const copier = new core_1.FileSystemManager(this.appConfigService.presetPath(preset.name), this.appConfigService.pwd());
|
|
240
|
-
if (preset.dockerfile) {
|
|
241
|
-
if (!copier.destination.exists(preset.dockerfile)) {
|
|
242
|
-
copier.copy(preset.dockerfile);
|
|
243
|
-
}
|
|
244
|
-
project.type = "dockerfile";
|
|
245
|
-
project.dockerfile = preset.dockerfile;
|
|
246
|
-
}
|
|
247
|
-
const files = await copier.source.readdirFiles("", {
|
|
248
|
-
recursive: true
|
|
249
|
-
});
|
|
250
|
-
for (const path of files) {
|
|
251
|
-
const stat = copier.source.stat(path), dir = Path.dirname(path);
|
|
252
|
-
if (stat.isFile() && path === "config.json") {
|
|
253
|
-
continue;
|
|
254
|
-
}
|
|
255
|
-
if (stat.isFile() && path === preset.dockerfile) {
|
|
256
|
-
continue;
|
|
257
|
-
}
|
|
258
|
-
if (copier.destination.exists(path)) {
|
|
259
|
-
continue;
|
|
260
|
-
}
|
|
261
|
-
if (!copier.destination.exists(dir)) {
|
|
262
|
-
copier.destination.mkdir(dir, {
|
|
263
|
-
recursive: true
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
copier.copy(path);
|
|
267
|
-
}
|
|
268
|
-
delete project.preset;
|
|
269
|
-
delete project.imageName;
|
|
270
|
-
project.save();
|
|
271
|
-
}
|
|
272
|
-
async build(presetName, rebuild) {
|
|
273
|
-
const preset = this.presetService.get(presetName);
|
|
274
|
-
let buildArgs = {};
|
|
275
|
-
if (preset.buildArgsOptions) {
|
|
276
|
-
buildArgs = await this.presetService.prompt(preset.buildArgsOptions);
|
|
277
|
-
}
|
|
278
|
-
const imageName = this.presetService.getImageName(preset, buildArgs);
|
|
279
|
-
if (rebuild) {
|
|
280
|
-
await this.dockerService.imageRm(imageName);
|
|
281
|
-
}
|
|
282
|
-
await this.dockerService.buildImage({
|
|
283
|
-
tag: imageName,
|
|
284
|
-
labels: {
|
|
285
|
-
presetName: preset.name
|
|
286
|
-
},
|
|
287
|
-
buildArgs: buildArgs,
|
|
288
|
-
context: Path.join(env_1.PRESETS_DIR, preset.name),
|
|
289
|
-
src: preset.dockerfile
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
exports.PresetController = PresetController;
|
|
294
|
-
__decorate([
|
|
295
|
-
(0, core_1.Command)("preset:init"),
|
|
296
|
-
(0, core_1.Description)("Creates preset config for current dir"),
|
|
297
|
-
__metadata("design:type", Function),
|
|
298
|
-
__metadata("design:paramtypes", []),
|
|
299
|
-
__metadata("design:returntype", Promise)
|
|
300
|
-
], PresetController.prototype, "init", null);
|
|
301
|
-
__decorate([
|
|
302
|
-
(0, core_1.Command)("preset:destroy"),
|
|
303
|
-
__metadata("design:type", Function),
|
|
304
|
-
__metadata("design:paramtypes", []),
|
|
305
|
-
__metadata("design:returntype", Promise)
|
|
306
|
-
], PresetController.prototype, "destroy", null);
|
|
307
|
-
__decorate([
|
|
308
|
-
(0, core_1.Command)("preset:install <preset>"),
|
|
309
|
-
(0, core_1.Command)("preset:install <preset>@<version>"),
|
|
310
|
-
(0, core_1.Description)("Adding preset from github repository"),
|
|
311
|
-
__param(0, (0, core_1.Param)("preset")),
|
|
312
|
-
__param(1, (0, core_1.Param)("version")),
|
|
313
|
-
__metadata("design:type", Function),
|
|
314
|
-
__metadata("design:paramtypes", [String, String]),
|
|
315
|
-
__metadata("design:returntype", Promise)
|
|
316
|
-
], PresetController.prototype, "add", null);
|
|
317
|
-
__decorate([
|
|
318
|
-
(0, core_1.Command)("preset:ls"),
|
|
319
|
-
(0, core_1.Description)("List of all available presets"),
|
|
320
|
-
__metadata("design:type", Function),
|
|
321
|
-
__metadata("design:paramtypes", []),
|
|
322
|
-
__metadata("design:returntype", Promise)
|
|
323
|
-
], PresetController.prototype, "list", null);
|
|
324
|
-
__decorate([
|
|
325
|
-
(0, core_1.Command)("preset:delete <preset>"),
|
|
326
|
-
__param(0, (0, core_1.Param)("preset")),
|
|
327
|
-
__param(1, (0, core_1.Option)("yes", "y")),
|
|
328
|
-
__param(1, (0, core_1.Description)("Confirm deletion")),
|
|
329
|
-
__metadata("design:type", Function),
|
|
330
|
-
__metadata("design:paramtypes", [String, Boolean]),
|
|
331
|
-
__metadata("design:returntype", Promise)
|
|
332
|
-
], PresetController.prototype, "delete", null);
|
|
333
|
-
__decorate([
|
|
334
|
-
(0, core_1.Command)("preset:eject"),
|
|
335
|
-
(0, core_1.Description)("Eject preset files into the project"),
|
|
336
|
-
__param(0, (0, core_1.Option)("name", "n")),
|
|
337
|
-
__param(0, (0, core_1.Description)("The name of the project")),
|
|
338
|
-
__metadata("design:type", Function),
|
|
339
|
-
__metadata("design:paramtypes", [String]),
|
|
340
|
-
__metadata("design:returntype", Promise)
|
|
341
|
-
], PresetController.prototype, "eject", null);
|
|
342
|
-
__decorate([
|
|
343
|
-
(0, core_1.Command)("preset:build <preset>"),
|
|
344
|
-
(0, core_1.Description)("Build docker image form a preset"),
|
|
345
|
-
__param(0, (0, core_1.Param)("preset")),
|
|
346
|
-
__param(1, (0, core_1.Option)("rebuild", "r")),
|
|
347
|
-
__param(1, (0, core_1.Description)("Rebuild image")),
|
|
348
|
-
__metadata("design:type", Function),
|
|
349
|
-
__metadata("design:paramtypes", [String, Boolean]),
|
|
350
|
-
__metadata("design:returntype", Promise)
|
|
351
|
-
], PresetController.prototype, "build", null);
|
|
352
|
-
exports.PresetController = PresetController = __decorate([
|
|
353
|
-
(0, core_1.Controller)(),
|
|
354
|
-
(0, core_1.Description)("Preset commands"),
|
|
355
|
-
__metadata("design:paramtypes", [services_1.AppConfigService,
|
|
356
|
-
services_1.AppEventsService,
|
|
357
|
-
services_1.ProjectService,
|
|
358
|
-
services_1.PresetService,
|
|
359
|
-
repositories_1.PresetRepository,
|
|
360
|
-
services_1.DockerService])
|
|
361
|
-
], PresetController);
|
package/lib/keystore/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./KeystoreService";
|
|
@@ -1,81 +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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.Encryption = void 0;
|
|
37
|
-
const crypto = __importStar(require("crypto"));
|
|
38
|
-
const fs = __importStar(require("fs"));
|
|
39
|
-
const path = __importStar(require("path"));
|
|
40
|
-
const util_1 = require("util");
|
|
41
|
-
const fsReadFile = (0, util_1.promisify)(fs.readFile);
|
|
42
|
-
const fsWriteFile = (0, util_1.promisify)(fs.writeFile);
|
|
43
|
-
const fsMkdir = (0, util_1.promisify)(fs.mkdir);
|
|
44
|
-
const fsAccess = (0, util_1.promisify)(fs.access);
|
|
45
|
-
class Encryption {
|
|
46
|
-
constructor() {
|
|
47
|
-
this.algorithm = 'aes-256-gcm';
|
|
48
|
-
this.keyLength = 32;
|
|
49
|
-
this.ivLength = 16;
|
|
50
|
-
this.saltLength = 64;
|
|
51
|
-
this.tagLength = 16;
|
|
52
|
-
}
|
|
53
|
-
async getEncryptionKey(keyPath, masterPassword) {
|
|
54
|
-
try {
|
|
55
|
-
await fsAccess(path.dirname(keyPath));
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
await fsMkdir(path.dirname(keyPath), { recursive: true });
|
|
59
|
-
}
|
|
60
|
-
let salt;
|
|
61
|
-
try {
|
|
62
|
-
salt = await fsReadFile(keyPath);
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
salt = crypto.randomBytes(this.saltLength);
|
|
66
|
-
await fsWriteFile(keyPath, salt);
|
|
67
|
-
}
|
|
68
|
-
return this.deriveKey(masterPassword, salt);
|
|
69
|
-
}
|
|
70
|
-
async deriveKey(password, salt) {
|
|
71
|
-
return new Promise((resolve, reject) => {
|
|
72
|
-
crypto.scrypt(password, salt, this.keyLength, (err, derivedKey) => {
|
|
73
|
-
if (err)
|
|
74
|
-
reject(err);
|
|
75
|
-
else
|
|
76
|
-
resolve(derivedKey);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.Encryption = Encryption;
|
|
@@ -1,59 +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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.Encryptor = void 0;
|
|
37
|
-
const crypto = __importStar(require("crypto"));
|
|
38
|
-
class Encryptor {
|
|
39
|
-
constructor(hash, salt) {
|
|
40
|
-
this._hash = hash;
|
|
41
|
-
this._salt = salt
|
|
42
|
-
? Buffer.from(salt, "hex")
|
|
43
|
-
: crypto.randomBytes(16);
|
|
44
|
-
}
|
|
45
|
-
get hash() {
|
|
46
|
-
return this._hash;
|
|
47
|
-
}
|
|
48
|
-
get salt() {
|
|
49
|
-
return this._salt.toString("hex");
|
|
50
|
-
}
|
|
51
|
-
setPassword(password) {
|
|
52
|
-
return this;
|
|
53
|
-
}
|
|
54
|
-
encrypt() {
|
|
55
|
-
}
|
|
56
|
-
decrypt() {
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.Encryptor = Encryptor;
|
package/lib/makes/FS.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { FS as CoreFS } from "@wocker/core";
|
|
2
|
-
import * as fs from "fs";
|
|
3
|
-
import { Stats, BigIntStats, PathLike, PathOrFileDescriptor, WriteFileOptions, MakeDirectoryOptions } from "fs";
|
|
4
|
-
import { PassThrough } from "readable-stream";
|
|
5
|
-
type ReaddirFilesOptions = {
|
|
6
|
-
recursive?: boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare class FS extends CoreFS {
|
|
9
|
-
static access(path: PathLike): Promise<any>;
|
|
10
|
-
static existsSync(path: PathLike): boolean;
|
|
11
|
-
static mkdir(dirPath: string, options?: MakeDirectoryOptions): Promise<void>;
|
|
12
|
-
static mkdirSync(path: string, options?: MakeDirectoryOptions): string;
|
|
13
|
-
static readdirFiles(path: string, options?: ReaddirFilesOptions): Promise<string[]>;
|
|
14
|
-
static appendFile(path: PathOrFileDescriptor, data: any, options?: WriteFileOptions): Promise<void>;
|
|
15
|
-
static appendFileSync(path: PathOrFileDescriptor, data: any, options?: WriteFileOptions): void;
|
|
16
|
-
static readBytes(filePath: PathLike, position?: number | bigint, size?: number | bigint): Promise<Buffer>;
|
|
17
|
-
static readFileSync(filePath: PathLike): NonSharedBuffer;
|
|
18
|
-
static writeFileSync(path: PathLike, data: any, options?: WriteFileOptions): void;
|
|
19
|
-
static createWriteStream(path: PathLike): fs.WriteStream;
|
|
20
|
-
static unlink(filePath: PathLike): Promise<void>;
|
|
21
|
-
static watch(filename: PathLike, options?: any): fs.FSWatcher;
|
|
22
|
-
static stat(filename: PathLike, options?: Parameters<typeof fs.stat>[1]): Promise<Stats | BigIntStats>;
|
|
23
|
-
static createReadStream(path: PathLike, options?: Parameters<typeof fs.createReadStream>[1]): fs.ReadStream;
|
|
24
|
-
static createReadLinesStream(path: PathLike, count?: number): PassThrough;
|
|
25
|
-
static copyFile(src: PathLike, dest: PathLike): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
export {};
|