@wocker/core 1.0.21-beta.1 → 1.0.21-beta.3
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/makes/AppConfig.d.ts +1 -0
- package/lib/makes/AppConfig.js +6 -0
- package/lib/makes/FS.d.ts +3 -0
- package/lib/makes/FS.js +3 -0
- package/lib/makes/FSManager.d.ts +6 -9
- package/lib/makes/FSManager.js +5 -39
- package/lib/makes/FileSystem.d.ts +4 -3
- package/lib/makes/FileSystem.js +6 -18
- package/lib/makes/FileSystemManager.d.ts +10 -0
- package/lib/makes/FileSystemManager.js +24 -0
- package/lib/makes/index.d.ts +1 -0
- package/lib/makes/index.js +1 -0
- package/lib/services/DockerService.d.ts +3 -1
- package/lib/services/PluginConfigService.d.ts +4 -1
- package/lib/services/PluginConfigService.js +11 -3
- package/lib/services/PluginFileSystem.d.ts +4 -0
- package/lib/services/PluginFileSystem.js +29 -0
- package/package.json +1 -1
package/lib/makes/AppConfig.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare abstract class AppConfig {
|
|
|
31
31
|
removeProject(id: string): void;
|
|
32
32
|
registerPreset(name: string, source: PresetType, path?: string): void;
|
|
33
33
|
unregisterPreset(name: string): void;
|
|
34
|
+
hasMeta(name: string): boolean;
|
|
34
35
|
getMeta(name: string): string | undefined;
|
|
35
36
|
getMeta(name: string, defaultValue: string): string;
|
|
36
37
|
setMeta(name: string, value: string): void;
|
package/lib/makes/AppConfig.js
CHANGED
|
@@ -99,6 +99,12 @@ class AppConfig {
|
|
|
99
99
|
delete this.presets;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
+
hasMeta(name) {
|
|
103
|
+
if (!this.meta) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
return name in this.meta;
|
|
107
|
+
}
|
|
102
108
|
getMeta(name, defaultValue) {
|
|
103
109
|
if (!this.meta || !(name in this.meta)) {
|
|
104
110
|
return defaultValue;
|
package/lib/makes/FS.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ type ReadFileOptions = Abortable & {
|
|
|
4
4
|
encoding?: BufferEncoding;
|
|
5
5
|
flag?: string;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
7
10
|
export declare class FS {
|
|
8
11
|
static mkdir(path: PathLike, options?: MakeDirectoryOptions): Promise<unknown>;
|
|
9
12
|
static readFile(filePath: PathOrFileDescriptor, options?: ReadFileOptions): Promise<string | Buffer>;
|
package/lib/makes/FS.js
CHANGED
|
@@ -48,6 +48,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
48
48
|
exports.FS = void 0;
|
|
49
49
|
const fs_1 = __importDefault(require("fs"));
|
|
50
50
|
const Path = __importStar(require("path"));
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated
|
|
53
|
+
*/
|
|
51
54
|
class FS {
|
|
52
55
|
static mkdir(path, options) {
|
|
53
56
|
return __awaiter(this, void 0, void 0, function* () {
|
package/lib/makes/FSManager.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import fs, { createReadStream,
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import fs, { createReadStream, RmOptions } from "fs";
|
|
2
|
+
import { FileSystemManager } from "./FileSystemManager";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated
|
|
5
|
+
*/
|
|
6
|
+
export declare class FSManager extends FileSystemManager {
|
|
7
7
|
path(...parts: string[]): string;
|
|
8
|
-
mkdir(path: string, options?: MakeDirectoryOptions): Promise<unknown>;
|
|
9
8
|
readdir(path: string): Promise<string[]>;
|
|
10
|
-
exists(path: string): boolean;
|
|
11
|
-
copy(path: string): Promise<void>;
|
|
12
9
|
readJSON(path: string): Promise<any>;
|
|
13
10
|
writeJSON(path: string, data: any): Promise<void>;
|
|
14
11
|
rm(path: string, options?: RmOptions): Promise<unknown>;
|
package/lib/makes/FSManager.js
CHANGED
|
@@ -44,29 +44,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.FSManager = void 0;
|
|
46
46
|
const fs_1 = __importStar(require("fs"));
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
47
|
+
const FileSystemManager_1 = require("./FileSystemManager");
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated
|
|
50
|
+
*/
|
|
51
|
+
class FSManager extends FileSystemManager_1.FileSystemManager {
|
|
53
52
|
path(...parts) {
|
|
54
53
|
return this.destination.path(...parts);
|
|
55
54
|
}
|
|
56
|
-
mkdir(path_1) {
|
|
57
|
-
return __awaiter(this, arguments, void 0, function* (path, options = {}) {
|
|
58
|
-
const fullPath = this.path(path);
|
|
59
|
-
return new Promise((resolve, reject) => {
|
|
60
|
-
(0, fs_1.mkdir)(fullPath, options, (err) => {
|
|
61
|
-
if (err) {
|
|
62
|
-
reject(err);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
resolve(undefined);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
55
|
readdir(path) {
|
|
71
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
57
|
const filePath = this.path(path);
|
|
@@ -81,25 +66,6 @@ class FSManager {
|
|
|
81
66
|
});
|
|
82
67
|
});
|
|
83
68
|
}
|
|
84
|
-
exists(path) {
|
|
85
|
-
const fullPath = this.path(path);
|
|
86
|
-
return (0, fs_1.existsSync)(fullPath);
|
|
87
|
-
}
|
|
88
|
-
copy(path) {
|
|
89
|
-
const destination = this.path(path);
|
|
90
|
-
if ((0, fs_1.existsSync)(destination)) {
|
|
91
|
-
return Promise.resolve();
|
|
92
|
-
}
|
|
93
|
-
return new Promise((resolve, reject) => {
|
|
94
|
-
(0, fs_1.copyFile)(this.source.path(path), destination, (err) => {
|
|
95
|
-
if (err) {
|
|
96
|
-
reject(err);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
resolve(undefined);
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
69
|
readJSON(path) {
|
|
104
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
71
|
const filePath = this.path(path);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import fs, { RmOptions, Stats, WriteFileOptions } from "fs";
|
|
1
|
+
import fs, { RmOptions, Stats, WriteFileOptions, MakeDirectoryOptions } from "fs";
|
|
2
2
|
type ReaddirOptions = fs.ObjectEncodingOptions & {
|
|
3
3
|
recursive?: boolean | undefined;
|
|
4
4
|
};
|
|
@@ -9,13 +9,14 @@ export declare class FileSystem {
|
|
|
9
9
|
basename(...parts: string[]): string;
|
|
10
10
|
exists(...parts: string[]): boolean;
|
|
11
11
|
stat(...parts: string[]): Stats;
|
|
12
|
-
mkdir(path?: string, options?:
|
|
12
|
+
mkdir(path?: string, options?: MakeDirectoryOptions): void;
|
|
13
13
|
readdir(...parts: string[]): Promise<string[]>;
|
|
14
14
|
readdirFiles(path?: string, options?: ReaddirOptions): Promise<string[]>;
|
|
15
|
+
readFile(path: string): Buffer;
|
|
15
16
|
readJSON(...paths: string[]): any;
|
|
16
17
|
writeFile(path: string, data: string | Buffer | NodeJS.ArrayBufferView, options?: fs.WriteFileOptions): Promise<void>;
|
|
17
18
|
writeJSON(path: string, data: any, options?: WriteFileOptions): void;
|
|
18
|
-
rm(path: string, options?: RmOptions):
|
|
19
|
+
rm(path: string, options?: RmOptions): void;
|
|
19
20
|
createWriteStream(path: string, options?: BufferEncoding): fs.WriteStream;
|
|
20
21
|
createReadStream(path: string, options?: BufferEncoding): fs.ReadStream;
|
|
21
22
|
}
|
package/lib/makes/FileSystem.js
CHANGED
|
@@ -103,6 +103,10 @@ class FileSystem {
|
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
+
readFile(path) {
|
|
107
|
+
const filePath = this.path(path);
|
|
108
|
+
return fs_1.default.readFileSync(filePath);
|
|
109
|
+
}
|
|
106
110
|
readJSON(...paths) {
|
|
107
111
|
const filePath = this.path(...paths);
|
|
108
112
|
const res = fs_1.default.readFileSync(filePath);
|
|
@@ -132,24 +136,8 @@ class FileSystem {
|
|
|
132
136
|
fs_1.default.writeFileSync(fullPath, json, options);
|
|
133
137
|
}
|
|
134
138
|
rm(path, options) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return new Promise((resolve, reject) => {
|
|
138
|
-
const callback = (err) => {
|
|
139
|
-
if (err) {
|
|
140
|
-
reject(err);
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
resolve(undefined);
|
|
144
|
-
};
|
|
145
|
-
if (options) {
|
|
146
|
-
fs_1.default.rm(fullPath, options, callback);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
fs_1.default.rm(fullPath, callback);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
});
|
|
139
|
+
const fullPath = this.path(path);
|
|
140
|
+
fs_1.default.rmdirSync(fullPath, options);
|
|
153
141
|
}
|
|
154
142
|
createWriteStream(path, options) {
|
|
155
143
|
return fs_1.default.createWriteStream(this.path(path), options);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MakeDirectoryOptions, CopySyncOptions } from "fs";
|
|
2
|
+
import { FileSystem } from "./FileSystem";
|
|
3
|
+
export declare class FileSystemManager {
|
|
4
|
+
readonly source: FileSystem;
|
|
5
|
+
readonly destination: FileSystem;
|
|
6
|
+
constructor(source: string, destination: string);
|
|
7
|
+
exists(...parts: string[]): boolean;
|
|
8
|
+
mkdir(path: string, options?: MakeDirectoryOptions): void;
|
|
9
|
+
copy(path: string, options?: CopySyncOptions): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FileSystemManager = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const FileSystem_1 = require("./FileSystem");
|
|
9
|
+
class FileSystemManager {
|
|
10
|
+
constructor(source, destination) {
|
|
11
|
+
this.source = new FileSystem_1.FileSystem(source);
|
|
12
|
+
this.destination = new FileSystem_1.FileSystem(destination);
|
|
13
|
+
}
|
|
14
|
+
exists(...parts) {
|
|
15
|
+
return this.destination.exists(...parts);
|
|
16
|
+
}
|
|
17
|
+
mkdir(path, options) {
|
|
18
|
+
this.destination.mkdir(path, options);
|
|
19
|
+
}
|
|
20
|
+
copy(path, options) {
|
|
21
|
+
fs_1.default.cpSync(this.source.path(path), this.destination.path(path), options);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.FileSystemManager = FileSystemManager;
|
package/lib/makes/index.d.ts
CHANGED
package/lib/makes/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __exportStar(require("./AppConfig"), exports);
|
|
|
18
18
|
__exportStar(require("./Config"), exports);
|
|
19
19
|
__exportStar(require("./ConfigCollection"), exports);
|
|
20
20
|
__exportStar(require("./FileSystem"), exports);
|
|
21
|
+
__exportStar(require("./FileSystemManager"), exports);
|
|
21
22
|
__exportStar(require("./FS"), exports);
|
|
22
23
|
__exportStar(require("./FSManager"), exports);
|
|
23
24
|
__exportStar(require("./Logger"), exports);
|
|
@@ -9,6 +9,8 @@ export declare namespace DockerServiceParams {
|
|
|
9
9
|
entrypoint?: string | string[];
|
|
10
10
|
projectId?: string;
|
|
11
11
|
tty?: boolean;
|
|
12
|
+
memory?: number;
|
|
13
|
+
memorySwap?: number;
|
|
12
14
|
ulimits?: {
|
|
13
15
|
[key: string]: {
|
|
14
16
|
hard?: number;
|
|
@@ -64,7 +66,7 @@ export declare abstract class DockerService {
|
|
|
64
66
|
abstract imageRm(tag: string, force?: boolean): Promise<void>;
|
|
65
67
|
abstract pullImage(tag: string): Promise<void>;
|
|
66
68
|
abstract attach(name: string | Container): Promise<NodeJS.ReadWriteStream>;
|
|
67
|
-
abstract attachStream(stream: NodeJS.ReadWriteStream): Promise<
|
|
69
|
+
abstract attachStream(stream: NodeJS.ReadWriteStream): Promise<NodeJS.ReadWriteStream>;
|
|
68
70
|
abstract exec(name: string, command?: DockerServiceParams.Exec | string[], tty?: boolean): Promise<Duplex>;
|
|
69
71
|
abstract logs(containerOrName: string | Container): Promise<NodeJS.ReadableStream>;
|
|
70
72
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { WriteFileOptions, MakeDirectoryOptions, RmOptions, WriteStream, ReadStream } from "fs";
|
|
2
|
+
import { AppConfigService } from "./AppConfigService";
|
|
2
3
|
import { FileSystem } from "../makes";
|
|
3
4
|
export declare class PluginConfigService {
|
|
5
|
+
protected readonly appConfigService: AppConfigService;
|
|
4
6
|
protected readonly pluginDir: string;
|
|
5
7
|
protected _fs?: FileSystem;
|
|
6
|
-
constructor(pluginDir: string);
|
|
8
|
+
constructor(appConfigService: AppConfigService, pluginDir: string);
|
|
7
9
|
get fs(): FileSystem;
|
|
10
|
+
isVersionGTE(version: string): boolean;
|
|
8
11
|
/** @deprecated */
|
|
9
12
|
dataPath(...parts: string[]): string;
|
|
10
13
|
/** @deprecated */
|
|
@@ -22,11 +22,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.PluginConfigService = void 0;
|
|
25
|
+
const AppConfigService_1 = require("./AppConfigService");
|
|
25
26
|
const makes_1 = require("../makes");
|
|
26
27
|
const decorators_1 = require("../decorators");
|
|
27
28
|
const env_1 = require("../env");
|
|
28
29
|
let PluginConfigService = class PluginConfigService {
|
|
29
|
-
constructor(pluginDir) {
|
|
30
|
+
constructor(appConfigService, pluginDir) {
|
|
31
|
+
this.appConfigService = appConfigService;
|
|
30
32
|
this.pluginDir = pluginDir;
|
|
31
33
|
}
|
|
32
34
|
get fs() {
|
|
@@ -41,6 +43,12 @@ let PluginConfigService = class PluginConfigService {
|
|
|
41
43
|
}
|
|
42
44
|
return this._fs;
|
|
43
45
|
}
|
|
46
|
+
isVersionGTE(version) {
|
|
47
|
+
if (!this.appConfigService.isVersionGTE) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return this.appConfigService.isVersionGTE(version);
|
|
51
|
+
}
|
|
44
52
|
/** @deprecated */
|
|
45
53
|
dataPath(...parts) {
|
|
46
54
|
return this.fs.path(...parts);
|
|
@@ -91,6 +99,6 @@ let PluginConfigService = class PluginConfigService {
|
|
|
91
99
|
exports.PluginConfigService = PluginConfigService;
|
|
92
100
|
exports.PluginConfigService = PluginConfigService = __decorate([
|
|
93
101
|
(0, decorators_1.Injectable)(),
|
|
94
|
-
__param(
|
|
95
|
-
__metadata("design:paramtypes", [String])
|
|
102
|
+
__param(1, (0, decorators_1.Inject)(env_1.PLUGIN_DIR_KEY)),
|
|
103
|
+
__metadata("design:paramtypes", [AppConfigService_1.AppConfigService, String])
|
|
96
104
|
], PluginConfigService);
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PluginFileSystem = void 0;
|
|
16
|
+
const decorators_1 = require("../decorators");
|
|
17
|
+
const env_1 = require("../env");
|
|
18
|
+
const makes_1 = require("../makes");
|
|
19
|
+
let PluginFileSystem = class PluginFileSystem extends makes_1.FileSystem {
|
|
20
|
+
constructor(pluginDir) {
|
|
21
|
+
super(pluginDir);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.PluginFileSystem = PluginFileSystem;
|
|
25
|
+
exports.PluginFileSystem = PluginFileSystem = __decorate([
|
|
26
|
+
(0, decorators_1.Injectable)(),
|
|
27
|
+
__param(0, (0, decorators_1.Inject)(env_1.PLUGIN_DIR_KEY)),
|
|
28
|
+
__metadata("design:paramtypes", [String])
|
|
29
|
+
], PluginFileSystem);
|