@wocker/core 1.0.22 → 1.0.23-beta.1
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/core/ApplicationContext.js +18 -17
- package/lib/core/ControllerWrapper.d.ts +0 -1
- package/lib/core/ControllerWrapper.js +1 -14
- package/lib/core/InstanceWrapper.d.ts +0 -1
- package/lib/core/InstanceWrapper.js +0 -1
- package/lib/decorators/Global.d.ts +0 -1
- package/lib/decorators/Global.js +0 -1
- package/lib/decorators/Injectable.d.ts +5 -1
- package/lib/decorators/Injectable.js +5 -1
- package/lib/exceptions/UsageException.d.ts +3 -0
- package/lib/exceptions/UsageException.js +10 -0
- package/lib/exceptions/index.d.ts +1 -0
- package/lib/exceptions/index.js +17 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/makes/AppConfig.d.ts +19 -30
- package/lib/makes/AppConfig.js +20 -20
- package/lib/makes/Config.d.ts +6 -0
- package/lib/makes/Config.js +4 -0
- package/lib/makes/ConfigCollection.d.ts +6 -0
- package/lib/makes/ConfigCollection.js +4 -0
- package/lib/makes/File.d.ts +32 -0
- package/lib/makes/File.js +140 -0
- package/lib/makes/FileSystem.d.ts +33 -13
- package/lib/makes/FileSystem.js +66 -51
- package/lib/makes/FileSystemManager.d.ts +7 -4
- package/lib/makes/FileSystemManager.js +20 -3
- package/lib/makes/Project.d.ts +9 -3
- package/lib/makes/Project.js +11 -3
- package/lib/makes/index.d.ts +0 -2
- package/lib/makes/index.js +0 -2
- package/lib/services/AppConfigService.d.ts +6 -1
- package/lib/services/AppConfigService.js +16 -5
- package/lib/services/DockerService.d.ts +3 -1
- package/lib/services/ModemService.d.ts +4 -0
- package/lib/services/ModemService.js +16 -0
- package/lib/services/index.d.ts +1 -0
- package/lib/services/index.js +1 -0
- package/lib/types/FileSystemDriver.d.ts +38 -0
- package/lib/types/FileSystemDriver.js +2 -0
- package/lib/types/PluginRef.d.ts +4 -0
- package/lib/types/PluginRef.js +2 -0
- package/lib/types/PresetRef.d.ts +6 -0
- package/lib/types/PresetRef.js +2 -0
- package/lib/types/ProjectRef.d.ts +16 -0
- package/lib/types/ProjectRef.js +2 -0
- package/lib/types/Provider.d.ts +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/package.json +8 -4
- package/lib/makes/FS.d.ts +0 -19
- package/lib/makes/FS.js +0 -170
- package/lib/makes/FSManager.d.ts +0 -14
- package/lib/makes/FSManager.js +0 -122
package/lib/makes/FileSystem.js
CHANGED
|
@@ -1,37 +1,4 @@
|
|
|
1
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
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -47,38 +14,58 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
47
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
15
|
exports.FileSystem = void 0;
|
|
49
16
|
const fs_1 = __importDefault(require("fs"));
|
|
50
|
-
const
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const File_1 = require("./File");
|
|
51
19
|
class FileSystem {
|
|
52
|
-
constructor(source) {
|
|
20
|
+
constructor(source, driver = fs_1.default) {
|
|
53
21
|
this.source = source;
|
|
22
|
+
this.driver = driver;
|
|
54
23
|
}
|
|
55
24
|
path(...parts) {
|
|
56
|
-
return
|
|
25
|
+
return path_1.default.join(this.source, ...parts);
|
|
26
|
+
}
|
|
27
|
+
cd(path) {
|
|
28
|
+
return new FileSystem(this.path(path), this.driver);
|
|
29
|
+
}
|
|
30
|
+
readBytes(path, position, size) {
|
|
31
|
+
const file = this.open(path, "r");
|
|
32
|
+
try {
|
|
33
|
+
return file.readBytes(position, size);
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
file.close();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
open(path, flags, mode) {
|
|
40
|
+
return new File_1.File(this.path(path), flags, mode, this.driver);
|
|
57
41
|
}
|
|
58
42
|
basename(...parts) {
|
|
59
|
-
return
|
|
43
|
+
return path_1.default.basename(this.path(...parts));
|
|
60
44
|
}
|
|
61
45
|
exists(...parts) {
|
|
62
46
|
const fullPath = this.path(...parts);
|
|
63
|
-
return
|
|
47
|
+
return this.driver.existsSync(fullPath);
|
|
64
48
|
}
|
|
65
49
|
stat(...parts) {
|
|
66
50
|
const fullPath = this.path(...parts);
|
|
67
|
-
return
|
|
51
|
+
return this.driver.statSync(fullPath);
|
|
68
52
|
}
|
|
69
53
|
mkdir(path = "", options) {
|
|
70
54
|
const fullPath = this.path(path);
|
|
71
|
-
|
|
55
|
+
this.driver.mkdirSync(fullPath, options);
|
|
72
56
|
}
|
|
73
|
-
readdir(path) {
|
|
57
|
+
readdir(path = "/", options) {
|
|
74
58
|
const fullPath = this.path(path);
|
|
75
|
-
return
|
|
59
|
+
return this.driver.readdirSync(fullPath, options);
|
|
76
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated
|
|
63
|
+
*/
|
|
77
64
|
readdirFiles() {
|
|
78
65
|
return __awaiter(this, arguments, void 0, function* (path = "", options) {
|
|
79
66
|
const fullPath = this.path(path);
|
|
80
67
|
return new Promise((resolve, reject) => {
|
|
81
|
-
|
|
68
|
+
this.driver.readdir(fullPath, options, (err, files) => {
|
|
82
69
|
if (err) {
|
|
83
70
|
reject(err);
|
|
84
71
|
return;
|
|
@@ -94,35 +81,63 @@ class FileSystem {
|
|
|
94
81
|
}
|
|
95
82
|
readFile(path) {
|
|
96
83
|
const filePath = this.path(path);
|
|
97
|
-
return
|
|
84
|
+
return this.driver.readFileSync(filePath);
|
|
98
85
|
}
|
|
99
86
|
readJSON(...paths) {
|
|
100
87
|
const filePath = this.path(...paths);
|
|
101
|
-
const res =
|
|
88
|
+
const res = this.driver.readFileSync(filePath);
|
|
102
89
|
return JSON.parse(res.toString());
|
|
103
90
|
}
|
|
104
91
|
writeFile(path, data, options) {
|
|
105
92
|
const fullPath = this.path(path);
|
|
106
|
-
|
|
93
|
+
this.driver.writeFileSync(fullPath, data, options);
|
|
107
94
|
}
|
|
108
95
|
writeJSON(path, data, options) {
|
|
109
96
|
const fullPath = this.path(path);
|
|
110
97
|
const json = JSON.stringify(data, null, 4);
|
|
111
|
-
|
|
98
|
+
this.driver.writeFileSync(fullPath, json, options);
|
|
112
99
|
}
|
|
113
100
|
appendFile(path, data, options) {
|
|
114
101
|
const fullPath = this.path(path);
|
|
115
|
-
|
|
102
|
+
this.driver.appendFileSync(fullPath, data, options);
|
|
116
103
|
}
|
|
117
104
|
rm(path, options) {
|
|
118
105
|
const fullPath = this.path(path);
|
|
119
|
-
|
|
106
|
+
this.driver.rmSync(fullPath, options);
|
|
120
107
|
}
|
|
121
108
|
createWriteStream(path, options) {
|
|
122
|
-
return
|
|
109
|
+
return this.driver.createWriteStream(this.path(path), options);
|
|
123
110
|
}
|
|
124
111
|
createReadStream(path, options) {
|
|
125
|
-
return
|
|
112
|
+
return this.driver.createReadStream(this.path(path), options);
|
|
113
|
+
}
|
|
114
|
+
createReadlineStream(path, options) {
|
|
115
|
+
let { encoding, start, end } = options || {};
|
|
116
|
+
const file = this.open(path, "r");
|
|
117
|
+
const stream = file.createReadlineStream({
|
|
118
|
+
encoding,
|
|
119
|
+
start,
|
|
120
|
+
end
|
|
121
|
+
});
|
|
122
|
+
stream.on("end", () => {
|
|
123
|
+
file.close();
|
|
124
|
+
});
|
|
125
|
+
stream.on("error", () => {
|
|
126
|
+
file.close();
|
|
127
|
+
});
|
|
128
|
+
return stream;
|
|
129
|
+
}
|
|
130
|
+
getLinePosition(path, line) {
|
|
131
|
+
const file = this.open(path, "r");
|
|
132
|
+
try {
|
|
133
|
+
return file.getLinePosition(line);
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
file.close();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
watch(path, options = {}) {
|
|
140
|
+
return this.driver.watch(this.path(path), options);
|
|
126
141
|
}
|
|
127
142
|
}
|
|
128
143
|
exports.FileSystem = FileSystem;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import FS from "fs";
|
|
2
2
|
import { FileSystem } from "./FileSystem";
|
|
3
|
+
import { FileSystemDriver } from "../types";
|
|
3
4
|
export declare class FileSystemManager {
|
|
5
|
+
protected readonly fs: FileSystemDriver;
|
|
4
6
|
readonly source: FileSystem;
|
|
5
7
|
readonly destination: FileSystem;
|
|
6
|
-
constructor(source: string, destination: string);
|
|
8
|
+
constructor(source: string, destination: string, fs?: FileSystemDriver);
|
|
7
9
|
exists(...parts: string[]): boolean;
|
|
8
|
-
mkdir(path: string, options?: MakeDirectoryOptions): void;
|
|
9
|
-
copy(path: string, options?: CopySyncOptions): void;
|
|
10
|
+
mkdir(path: string, options?: FS.MakeDirectoryOptions): void;
|
|
11
|
+
copy(path: string, options?: FS.CopySyncOptions): void;
|
|
12
|
+
copyFile(path: string): Promise<void>;
|
|
10
13
|
}
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
5
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
15
|
exports.FileSystemManager = void 0;
|
|
7
16
|
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const promises_1 = require("stream/promises");
|
|
8
18
|
const FileSystem_1 = require("./FileSystem");
|
|
9
19
|
class FileSystemManager {
|
|
10
|
-
constructor(source, destination) {
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
20
|
+
constructor(source, destination, fs = fs_1.default) {
|
|
21
|
+
this.fs = fs;
|
|
22
|
+
this.source = new FileSystem_1.FileSystem(source, this.fs);
|
|
23
|
+
this.destination = new FileSystem_1.FileSystem(destination, this.fs);
|
|
13
24
|
}
|
|
14
25
|
exists(...parts) {
|
|
15
26
|
return this.destination.exists(...parts);
|
|
@@ -20,5 +31,11 @@ class FileSystemManager {
|
|
|
20
31
|
copy(path, options) {
|
|
21
32
|
fs_1.default.cpSync(this.source.path(path), this.destination.path(path), options);
|
|
22
33
|
}
|
|
34
|
+
copyFile(path) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const readStream = this.source.createReadStream(path), writeStream = this.destination.createWriteStream(path);
|
|
37
|
+
yield (0, promises_1.pipeline)(readStream, writeStream);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
23
40
|
}
|
|
24
41
|
exports.FileSystemManager = FileSystemManager;
|
package/lib/makes/Project.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PickProperties, EnvConfig } from "../types";
|
|
2
|
-
export type ProjectType = typeof PROJECT_TYPE_DOCKERFILE | typeof PROJECT_TYPE_IMAGE | typeof PROJECT_TYPE_PRESET;
|
|
2
|
+
export type ProjectType = typeof PROJECT_TYPE_DOCKERFILE | typeof PROJECT_TYPE_IMAGE | typeof PROJECT_TYPE_PRESET | typeof PROJECT_TYPE_COMPOSE;
|
|
3
3
|
export type ProjectProperties = Omit<PickProperties<Project>, "containerName" | "domains">;
|
|
4
4
|
export declare abstract class Project {
|
|
5
5
|
id: string;
|
|
@@ -10,13 +10,14 @@ export declare abstract class Project {
|
|
|
10
10
|
presetMode?: "global" | "project";
|
|
11
11
|
imageName?: string;
|
|
12
12
|
dockerfile?: string;
|
|
13
|
+
composefile?: string;
|
|
13
14
|
scripts?: string[];
|
|
14
15
|
buildArgs?: EnvConfig;
|
|
15
16
|
env?: EnvConfig;
|
|
16
|
-
ports?: string[];
|
|
17
|
-
volumes?: string[];
|
|
18
17
|
extraHosts?: EnvConfig;
|
|
19
18
|
metadata?: EnvConfig;
|
|
19
|
+
ports?: string[];
|
|
20
|
+
volumes?: string[];
|
|
20
21
|
protected constructor(data: ProjectProperties);
|
|
21
22
|
get containerName(): string;
|
|
22
23
|
get domains(): string[];
|
|
@@ -44,8 +45,13 @@ export declare abstract class Project {
|
|
|
44
45
|
abstract getSecret(key: string, byDefault?: string): Promise<string | undefined>;
|
|
45
46
|
abstract setSecret(key: string, value: string): Promise<void>;
|
|
46
47
|
abstract save(): void;
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated
|
|
50
|
+
*/
|
|
47
51
|
toJSON(): ProjectProperties;
|
|
52
|
+
toObject(): ProjectProperties;
|
|
48
53
|
}
|
|
49
54
|
export declare const PROJECT_TYPE_DOCKERFILE = "dockerfile";
|
|
50
55
|
export declare const PROJECT_TYPE_IMAGE = "image";
|
|
51
56
|
export declare const PROJECT_TYPE_PRESET = "preset";
|
|
57
|
+
export declare const PROJECT_TYPE_COMPOSE = "compose";
|
package/lib/makes/Project.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PROJECT_TYPE_PRESET = exports.PROJECT_TYPE_IMAGE = exports.PROJECT_TYPE_DOCKERFILE = exports.Project = void 0;
|
|
3
|
+
exports.PROJECT_TYPE_COMPOSE = exports.PROJECT_TYPE_PRESET = exports.PROJECT_TYPE_IMAGE = exports.PROJECT_TYPE_DOCKERFILE = exports.Project = void 0;
|
|
4
4
|
const volumeParse_1 = require("../utils/volumeParse");
|
|
5
5
|
class Project {
|
|
6
6
|
constructor(data) {
|
|
@@ -187,7 +187,13 @@ class Project {
|
|
|
187
187
|
delete this.extraHosts;
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* @deprecated
|
|
192
|
+
*/
|
|
190
193
|
toJSON() {
|
|
194
|
+
return this.toObject();
|
|
195
|
+
}
|
|
196
|
+
toObject() {
|
|
191
197
|
return {
|
|
192
198
|
id: this.id,
|
|
193
199
|
name: this.name,
|
|
@@ -197,11 +203,12 @@ class Project {
|
|
|
197
203
|
presetMode: this.presetMode,
|
|
198
204
|
imageName: this.imageName,
|
|
199
205
|
dockerfile: this.dockerfile,
|
|
206
|
+
composefile: this.composefile,
|
|
200
207
|
scripts: this.scripts,
|
|
201
|
-
buildArgs: this.buildArgs,
|
|
202
|
-
env: this.env,
|
|
203
208
|
ports: this.ports,
|
|
204
209
|
volumes: this.volumes,
|
|
210
|
+
env: this.env,
|
|
211
|
+
buildArgs: this.buildArgs,
|
|
205
212
|
extraHosts: this.extraHosts,
|
|
206
213
|
metadata: this.metadata
|
|
207
214
|
};
|
|
@@ -211,3 +218,4 @@ exports.Project = Project;
|
|
|
211
218
|
exports.PROJECT_TYPE_DOCKERFILE = "dockerfile";
|
|
212
219
|
exports.PROJECT_TYPE_IMAGE = "image";
|
|
213
220
|
exports.PROJECT_TYPE_PRESET = "preset";
|
|
221
|
+
exports.PROJECT_TYPE_COMPOSE = "compose";
|
package/lib/makes/index.d.ts
CHANGED
|
@@ -3,8 +3,6 @@ export * from "./Config";
|
|
|
3
3
|
export * from "./ConfigCollection";
|
|
4
4
|
export * from "./FileSystem";
|
|
5
5
|
export * from "./FileSystemManager";
|
|
6
|
-
export * from "./FS";
|
|
7
|
-
export * from "./FSManager";
|
|
8
6
|
export * from "./KeystoreProvider";
|
|
9
7
|
export * from "./Logger";
|
|
10
8
|
export * from "./Preset";
|
package/lib/makes/index.js
CHANGED
|
@@ -19,8 +19,6 @@ __exportStar(require("./Config"), exports);
|
|
|
19
19
|
__exportStar(require("./ConfigCollection"), exports);
|
|
20
20
|
__exportStar(require("./FileSystem"), exports);
|
|
21
21
|
__exportStar(require("./FileSystemManager"), exports);
|
|
22
|
-
__exportStar(require("./FS"), exports);
|
|
23
|
-
__exportStar(require("./FSManager"), exports);
|
|
24
22
|
__exportStar(require("./KeystoreProvider"), exports);
|
|
25
23
|
__exportStar(require("./Logger"), exports);
|
|
26
24
|
__exportStar(require("./Preset"), exports);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AppConfig, PresetSource } from "../makes";
|
|
2
2
|
export declare abstract class AppConfigService {
|
|
3
|
+
get experimentalFeatures(): string[];
|
|
3
4
|
abstract get config(): AppConfig;
|
|
4
5
|
get version(): string;
|
|
5
6
|
isVersionGTE(version: string): boolean;
|
|
@@ -15,5 +16,9 @@ export declare abstract class AppConfigService {
|
|
|
15
16
|
removeProject(id: string): void;
|
|
16
17
|
registerPreset(name: string, source: PresetSource, path?: string): void;
|
|
17
18
|
unregisterPreset(name: string): void;
|
|
18
|
-
|
|
19
|
+
getMeta(name: string, byDefault?: string): string | undefined;
|
|
20
|
+
getMeta(name: string, byDefault: string): string;
|
|
21
|
+
setMeta(name: string, value: string): void;
|
|
22
|
+
unsetMeta(name: string): void;
|
|
23
|
+
abstract save(): void;
|
|
19
24
|
}
|
|
@@ -9,6 +9,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.AppConfigService = void 0;
|
|
10
10
|
const decorators_1 = require("../decorators");
|
|
11
11
|
let AppConfigService = class AppConfigService {
|
|
12
|
+
get experimentalFeatures() {
|
|
13
|
+
return [
|
|
14
|
+
"projectComposeType"
|
|
15
|
+
];
|
|
16
|
+
}
|
|
12
17
|
get version() {
|
|
13
18
|
return "0.0.0";
|
|
14
19
|
}
|
|
@@ -33,11 +38,11 @@ let AppConfigService = class AppConfigService {
|
|
|
33
38
|
}
|
|
34
39
|
addProject(id, name, path) {
|
|
35
40
|
this.config.addProject(id, name, path);
|
|
36
|
-
this.
|
|
41
|
+
this.save();
|
|
37
42
|
}
|
|
38
43
|
removeProject(id) {
|
|
39
44
|
this.config.removeProject(id);
|
|
40
|
-
this.
|
|
45
|
+
this.save();
|
|
41
46
|
}
|
|
42
47
|
registerPreset(name, source, path) {
|
|
43
48
|
this.config.registerPreset(name, source, path);
|
|
@@ -45,10 +50,16 @@ let AppConfigService = class AppConfigService {
|
|
|
45
50
|
}
|
|
46
51
|
unregisterPreset(name) {
|
|
47
52
|
this.config.unregisterPreset(name);
|
|
48
|
-
this.
|
|
53
|
+
this.save();
|
|
54
|
+
}
|
|
55
|
+
getMeta(name, byDefault) {
|
|
56
|
+
return this.config.getMeta(name, byDefault);
|
|
57
|
+
}
|
|
58
|
+
setMeta(name, value) {
|
|
59
|
+
this.config.setMeta(name, value);
|
|
49
60
|
}
|
|
50
|
-
|
|
51
|
-
this.config.
|
|
61
|
+
unsetMeta(name) {
|
|
62
|
+
this.config.unsetMeta(name);
|
|
52
63
|
}
|
|
53
64
|
};
|
|
54
65
|
exports.AppConfigService = AppConfigService;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type Docker from "dockerode";
|
|
2
|
+
import type { Container, ImageInfo, VolumeCreateResponse } from "dockerode";
|
|
2
3
|
import { Duplex } from "node:stream";
|
|
3
4
|
export declare namespace DockerServiceParams {
|
|
4
5
|
type CreateContainer = {
|
|
@@ -54,6 +55,7 @@ export declare namespace DockerServiceParams {
|
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
57
|
export declare abstract class DockerService {
|
|
58
|
+
abstract get docker(): Docker;
|
|
57
59
|
abstract createContainer(params: DockerServiceParams.CreateContainer): Promise<Container>;
|
|
58
60
|
abstract getContainer(name: string): Promise<Container | null>;
|
|
59
61
|
abstract removeContainer(name: string): Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ModemService = void 0;
|
|
10
|
+
const decorators_1 = require("../decorators");
|
|
11
|
+
let ModemService = class ModemService {
|
|
12
|
+
};
|
|
13
|
+
exports.ModemService = ModemService;
|
|
14
|
+
exports.ModemService = ModemService = __decorate([
|
|
15
|
+
(0, decorators_1.Injectable)("MODEM_SERVICE")
|
|
16
|
+
], ModemService);
|
package/lib/services/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./AppEventsService";
|
|
|
3
3
|
export * from "./DockerService";
|
|
4
4
|
export * from "./KeystoreService";
|
|
5
5
|
export * from "./LogService";
|
|
6
|
+
export * from "./ModemService";
|
|
6
7
|
export * from "./PluginConfigService";
|
|
7
8
|
export * from "./PresetService";
|
|
8
9
|
export * from "./ProjectService";
|
package/lib/services/index.js
CHANGED
|
@@ -19,6 +19,7 @@ __exportStar(require("./AppEventsService"), exports);
|
|
|
19
19
|
__exportStar(require("./DockerService"), exports);
|
|
20
20
|
__exportStar(require("./KeystoreService"), exports);
|
|
21
21
|
__exportStar(require("./LogService"), exports);
|
|
22
|
+
__exportStar(require("./ModemService"), exports);
|
|
22
23
|
__exportStar(require("./PluginConfigService"), exports);
|
|
23
24
|
__exportStar(require("./PresetService"), exports);
|
|
24
25
|
__exportStar(require("./ProjectService"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import FS from "fs";
|
|
2
|
+
type StreamOptions = {
|
|
3
|
+
flags?: string;
|
|
4
|
+
fd?: number;
|
|
5
|
+
mode?: number;
|
|
6
|
+
start?: number;
|
|
7
|
+
autoClose?: boolean;
|
|
8
|
+
emitClose?: boolean;
|
|
9
|
+
encoding?: BufferEncoding;
|
|
10
|
+
signal?: AbortSignal | null;
|
|
11
|
+
highWaterMark?: number;
|
|
12
|
+
};
|
|
13
|
+
export type WriteStreamOptions = StreamOptions & {
|
|
14
|
+
flush?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type ReadStreamOptions = StreamOptions & {
|
|
17
|
+
end?: number;
|
|
18
|
+
};
|
|
19
|
+
export interface FileSystemDriver {
|
|
20
|
+
openSync(path: string, flags: FS.OpenMode, mode?: FS.Mode | null): number;
|
|
21
|
+
closeSync(fd: number): void;
|
|
22
|
+
readSync(file: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: FS.ReadPosition | null): number;
|
|
23
|
+
existsSync(path: string): boolean;
|
|
24
|
+
statSync(path: string): FS.Stats;
|
|
25
|
+
fstatSync(fd: number): FS.Stats;
|
|
26
|
+
mkdirSync(path: string, options?: FS.MakeDirectoryOptions): void;
|
|
27
|
+
readdir(path: string, options: any, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void;
|
|
28
|
+
readdirSync(path: string, options?: any): string[];
|
|
29
|
+
readFileSync(path: string): string | Buffer;
|
|
30
|
+
writeFileSync(path: string, data: string | Buffer | NodeJS.ArrayBufferView, options?: FS.WriteFileOptions): void;
|
|
31
|
+
appendFileSync(path: FS.PathOrFileDescriptor, data: string | Uint8Array, options?: FS.WriteFileOptions): void;
|
|
32
|
+
rmSync(path: string, options?: FS.RmOptions): void;
|
|
33
|
+
createWriteStream(path: string, options?: WriteStreamOptions): FS.WriteStream;
|
|
34
|
+
createReadStream(path: string, options?: ReadStreamOptions): FS.ReadStream;
|
|
35
|
+
watch(file: string, options: FS.WatchOptions, listener?: FS.WatchListener<string | Buffer>): FS.FSWatcher;
|
|
36
|
+
watchFile(path: string, listener: FS.StatsListener): FS.StatWatcher;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
package/lib/types/Provider.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { InjectionToken } from "./InjectionToken";
|
|
2
2
|
import { Type } from "./Type";
|
|
3
|
-
export type Provider<T = any> = Type<T> | ClassProvider<T> | ValueProvider<T>;
|
|
4
3
|
type ClassProvider<T = any> = {
|
|
5
4
|
provide: InjectionToken;
|
|
6
5
|
useClass: Type<T>;
|
|
@@ -9,4 +8,5 @@ type ValueProvider<T = any> = {
|
|
|
9
8
|
provide: InjectionToken;
|
|
10
9
|
useValue: T;
|
|
11
10
|
};
|
|
11
|
+
export type Provider<T = any> = Type<T> | ClassProvider<T> | ValueProvider<T>;
|
|
12
12
|
export {};
|
package/lib/types/index.d.ts
CHANGED
package/lib/types/index.js
CHANGED
|
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./EnvConfig"), exports);
|
|
18
|
+
__exportStar(require("./FileSystemDriver"), exports);
|
|
18
19
|
__exportStar(require("./PickProperties"), exports);
|
|
19
20
|
__exportStar(require("./Volume"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wocker/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23-beta.1",
|
|
4
4
|
"author": "Kris Papercut <krispcut@gmail.com>",
|
|
5
5
|
"description": "Core of the Wocker",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,17 +29,21 @@
|
|
|
29
29
|
"@kearisp/cli": "^2.0.8",
|
|
30
30
|
"fs": "^0.0.1-security",
|
|
31
31
|
"path": "^0.12.7",
|
|
32
|
-
"
|
|
32
|
+
"readline": "^1.3.0",
|
|
33
|
+
"reflect-metadata": "^0.2.2",
|
|
34
|
+
"stream": "^0.0.3"
|
|
33
35
|
},
|
|
34
36
|
"devDependencies": {
|
|
37
|
+
"@types/docker-modem": "^3.0.6",
|
|
35
38
|
"@types/dockerode": "^3.3.23",
|
|
36
39
|
"@types/jest": "^29.5.14",
|
|
37
|
-
"@types/node": "^22.15.
|
|
40
|
+
"@types/node": "^22.15.17",
|
|
38
41
|
"jest": "^29.7.0",
|
|
39
42
|
"make-coverage-badge": "^1.2.0",
|
|
40
43
|
"memfs": "^4.17.1",
|
|
41
44
|
"ts-jest": "^29.3.2",
|
|
42
45
|
"ts-node": "^10.9.2",
|
|
43
|
-
"typescript": "^5.8.3"
|
|
46
|
+
"typescript": "^5.8.3",
|
|
47
|
+
"unionfs": "^4.5.4"
|
|
44
48
|
}
|
|
45
49
|
}
|
package/lib/makes/FS.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Abortable } from "node:events";
|
|
2
|
-
import { PathLike, PathOrFileDescriptor, WriteFileOptions, RmOptions, MakeDirectoryOptions } from "fs";
|
|
3
|
-
type ReadFileOptions = Abortable & {
|
|
4
|
-
encoding?: BufferEncoding;
|
|
5
|
-
flag?: string;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated
|
|
9
|
-
*/
|
|
10
|
-
export declare class FS {
|
|
11
|
-
static mkdir(path: PathLike, options?: MakeDirectoryOptions): Promise<unknown>;
|
|
12
|
-
static readFile(filePath: PathOrFileDescriptor, options?: ReadFileOptions): Promise<string | Buffer>;
|
|
13
|
-
static writeFile(filePath: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): Promise<unknown>;
|
|
14
|
-
static readJSON(...paths: string[]): Promise<any>;
|
|
15
|
-
static writeJSON(filePath: PathOrFileDescriptor, data: any, options?: WriteFileOptions): Promise<void>;
|
|
16
|
-
static readdir(path: PathLike): Promise<string[]>;
|
|
17
|
-
static rm(path: PathLike, options?: RmOptions): Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
export {};
|