@wocker/core 1.0.8 → 1.0.9
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/decorators/Module.d.ts +7 -9
- package/lib/decorators/Module.js +8 -8
- package/lib/decorators/Plugin.d.ts +7 -0
- package/lib/decorators/Plugin.js +25 -0
- package/lib/decorators/index.d.ts +1 -0
- package/lib/decorators/index.js +1 -0
- package/lib/env.d.ts +1 -0
- package/lib/env.js +2 -1
- package/lib/makes/ApplicationContext.d.ts +9 -0
- package/lib/makes/ApplicationContext.js +34 -0
- package/lib/makes/Config.d.ts +26 -0
- package/lib/makes/Config.js +81 -0
- package/lib/makes/Factory.d.ts +4 -1
- package/lib/makes/Factory.js +7 -2
- package/lib/makes/Project.d.ts +2 -13
- package/lib/makes/Project.js +0 -39
- package/lib/makes/index.d.ts +1 -1
- package/lib/makes/index.js +1 -1
- package/lib/services/AppConfigService.d.ts +4 -10
- package/lib/services/AppConfigService.js +17 -0
- package/package.json +2 -2
- package/lib/makes/Plugin.d.ts +0 -4
- package/lib/makes/Plugin.js +0 -9
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { MODULE_METADATA } from "../env";
|
|
1
|
+
import { MODULE_METADATA, PLUGIN_NAME_METADATA } from "../env";
|
|
2
2
|
import { Provider } from "../types/Provider";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export type ModuleConfig = {
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
7
|
+
[PLUGIN_NAME_METADATA]?: string;
|
|
6
8
|
[MODULE_METADATA.CONTROLLERS]?: any[];
|
|
7
9
|
[MODULE_METADATA.PROVIDERS]?: Provider[];
|
|
8
10
|
[MODULE_METADATA.IMPORTS]?: any[];
|
|
9
11
|
[MODULE_METADATA.EXPORTS]?: any[];
|
|
10
12
|
};
|
|
11
|
-
export
|
|
12
|
-
providers?: any[];
|
|
13
|
-
};
|
|
14
|
-
export declare const Module: (config: Config) => <T extends Type>(Target: T) => void;
|
|
15
|
-
export {};
|
|
13
|
+
export declare const Module: (config: ModuleConfig) => ClassDecorator;
|
package/lib/decorators/Module.js
CHANGED
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Module = void 0;
|
|
4
4
|
const env_1 = require("../env");
|
|
5
5
|
const Module = (config) => {
|
|
6
|
-
const { [env_1.
|
|
7
|
-
return (
|
|
8
|
-
Reflect.defineMetadata("isModule", true,
|
|
9
|
-
Reflect.defineMetadata(env_1.
|
|
10
|
-
Reflect.defineMetadata(env_1.MODULE_METADATA.IMPORTS, imports,
|
|
11
|
-
Reflect.defineMetadata(env_1.MODULE_METADATA.CONTROLLERS, controllers,
|
|
12
|
-
Reflect.defineMetadata(env_1.MODULE_METADATA.PROVIDERS, providers,
|
|
13
|
-
Reflect.defineMetadata(env_1.MODULE_METADATA.EXPORTS, exports,
|
|
6
|
+
const { [env_1.PLUGIN_NAME_METADATA]: name, [env_1.MODULE_METADATA.CONTROLLERS]: controllers = [], [env_1.MODULE_METADATA.PROVIDERS]: providers = [], [env_1.MODULE_METADATA.IMPORTS]: imports = [], [env_1.MODULE_METADATA.EXPORTS]: exports = [] } = config;
|
|
7
|
+
return (target) => {
|
|
8
|
+
Reflect.defineMetadata("isModule", true, target);
|
|
9
|
+
Reflect.defineMetadata(env_1.PLUGIN_NAME_METADATA, name, target);
|
|
10
|
+
Reflect.defineMetadata(env_1.MODULE_METADATA.IMPORTS, imports, target);
|
|
11
|
+
Reflect.defineMetadata(env_1.MODULE_METADATA.CONTROLLERS, controllers, target);
|
|
12
|
+
Reflect.defineMetadata(env_1.MODULE_METADATA.PROVIDERS, providers, target);
|
|
13
|
+
Reflect.defineMetadata(env_1.MODULE_METADATA.EXPORTS, exports, target);
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
exports.Module = Module;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Plugin = void 0;
|
|
15
|
+
const Module_1 = require("./Module");
|
|
16
|
+
const env_1 = require("../env");
|
|
17
|
+
const Plugin = (config) => {
|
|
18
|
+
const { name } = config, rest = __rest(config, ["name"]);
|
|
19
|
+
return (target) => {
|
|
20
|
+
Reflect.defineMetadata("isPlugin", true, target);
|
|
21
|
+
Reflect.defineMetadata(env_1.PLUGIN_NAME_METADATA, true, target);
|
|
22
|
+
(0, Module_1.Module)(rest)(target);
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.Plugin = Plugin;
|
package/lib/decorators/index.js
CHANGED
package/lib/env.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare const PARAMTYPES_METADATA = "design:paramtypes";
|
|
|
9
9
|
export declare const SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
|
10
10
|
export declare const INJECT_TOKEN_METADATA = "INJECT_TOKEN";
|
|
11
11
|
export declare const PLUGIN_DIR_KEY = "PLUGIN_DIR";
|
|
12
|
+
export declare const PLUGIN_NAME_METADATA = "name";
|
|
12
13
|
export declare enum MODULE_METADATA {
|
|
13
14
|
NAME = "name",
|
|
14
15
|
IMPORTS = "imports",
|
package/lib/env.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MODULE_METADATA = exports.PLUGIN_DIR_KEY = exports.INJECT_TOKEN_METADATA = exports.SELF_DECLARED_DEPS_METADATA = exports.PARAMTYPES_METADATA = exports.OPTION_META = exports.ARGS_METADATA = exports.COMPLETION_METADATA = exports.COMMAND_METADATA = exports.ARGS_META = exports.INJECTABLE_WATERMARK = exports.IS_MODULE = void 0;
|
|
3
|
+
exports.MODULE_METADATA = exports.PLUGIN_NAME_METADATA = exports.PLUGIN_DIR_KEY = exports.INJECT_TOKEN_METADATA = exports.SELF_DECLARED_DEPS_METADATA = exports.PARAMTYPES_METADATA = exports.OPTION_META = exports.ARGS_METADATA = exports.COMPLETION_METADATA = exports.COMMAND_METADATA = exports.ARGS_META = exports.INJECTABLE_WATERMARK = exports.IS_MODULE = void 0;
|
|
4
4
|
exports.IS_MODULE = "IS_MODULE";
|
|
5
5
|
exports.INJECTABLE_WATERMARK = "__injectable__";
|
|
6
6
|
exports.ARGS_META = "__ARGS__";
|
|
@@ -12,6 +12,7 @@ exports.PARAMTYPES_METADATA = "design:paramtypes";
|
|
|
12
12
|
exports.SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
|
13
13
|
exports.INJECT_TOKEN_METADATA = "INJECT_TOKEN";
|
|
14
14
|
exports.PLUGIN_DIR_KEY = "PLUGIN_DIR";
|
|
15
|
+
exports.PLUGIN_NAME_METADATA = "name";
|
|
15
16
|
var MODULE_METADATA;
|
|
16
17
|
(function (MODULE_METADATA) {
|
|
17
18
|
MODULE_METADATA["NAME"] = "name";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Type } from "../types/Type";
|
|
2
|
+
import { Container } from "./Container";
|
|
3
|
+
export declare class ApplicationContext {
|
|
4
|
+
protected module: any;
|
|
5
|
+
protected container: Container;
|
|
6
|
+
constructor(module: any, container: Container);
|
|
7
|
+
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): TResult;
|
|
8
|
+
run(args: string[]): Promise<any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ApplicationContext = void 0;
|
|
13
|
+
const cli_1 = require("@kearisp/cli");
|
|
14
|
+
class ApplicationContext {
|
|
15
|
+
constructor(module, container) {
|
|
16
|
+
this.module = module;
|
|
17
|
+
this.container = container;
|
|
18
|
+
}
|
|
19
|
+
get(typeOrToken) {
|
|
20
|
+
var _a;
|
|
21
|
+
const res = (_a = this.container.getModule(this.module)) === null || _a === void 0 ? void 0 : _a.get(typeOrToken);
|
|
22
|
+
if (!res) {
|
|
23
|
+
throw new Error("Instance not found");
|
|
24
|
+
}
|
|
25
|
+
return res;
|
|
26
|
+
}
|
|
27
|
+
run(args) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const cli = this.get(cli_1.Cli);
|
|
30
|
+
return cli.run(args);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ApplicationContext = ApplicationContext;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EnvConfig, PickProperties } from "../types";
|
|
2
|
+
export type ConfigProperties = PickProperties<Config>;
|
|
3
|
+
export declare abstract class Config {
|
|
4
|
+
debug?: boolean;
|
|
5
|
+
logLevel: "off" | "info" | "warn" | "error";
|
|
6
|
+
plugins: string[];
|
|
7
|
+
projects: {
|
|
8
|
+
id: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
src: string;
|
|
11
|
+
}[];
|
|
12
|
+
meta?: EnvConfig;
|
|
13
|
+
env?: EnvConfig;
|
|
14
|
+
protected constructor(data: ConfigProperties);
|
|
15
|
+
addPlugin(plugin: string): void;
|
|
16
|
+
removePlugin(plugin: string): void;
|
|
17
|
+
setProject(id: string, path: string): void;
|
|
18
|
+
getMeta(name: string, defaultValue: string): string;
|
|
19
|
+
setMeta(name: string, value: string): void;
|
|
20
|
+
unsetMeta(name: string): void;
|
|
21
|
+
getEnv(name: string, defaultValue: string): string;
|
|
22
|
+
setEnv(name: string, value: string): void;
|
|
23
|
+
unsetEnv(name: string): void;
|
|
24
|
+
abstract save(): Promise<void>;
|
|
25
|
+
toJson(): ConfigProperties;
|
|
26
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Config = void 0;
|
|
4
|
+
class Config {
|
|
5
|
+
constructor(data) {
|
|
6
|
+
this.logLevel = "off";
|
|
7
|
+
this.plugins = [];
|
|
8
|
+
this.projects = [];
|
|
9
|
+
Object.assign(this, data);
|
|
10
|
+
}
|
|
11
|
+
addPlugin(plugin) {
|
|
12
|
+
this.plugins.push(plugin);
|
|
13
|
+
}
|
|
14
|
+
removePlugin(plugin) {
|
|
15
|
+
this.plugins = this.plugins.filter((plugin) => plugin !== plugin);
|
|
16
|
+
}
|
|
17
|
+
setProject(id, path) {
|
|
18
|
+
this.projects = [
|
|
19
|
+
...this.projects.filter((project) => {
|
|
20
|
+
return project.id !== id && project.src !== path;
|
|
21
|
+
}),
|
|
22
|
+
{
|
|
23
|
+
id,
|
|
24
|
+
src: path
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
getMeta(name, defaultValue) {
|
|
29
|
+
if (!this.meta || !(name in this.meta)) {
|
|
30
|
+
return defaultValue;
|
|
31
|
+
}
|
|
32
|
+
return this.meta[name];
|
|
33
|
+
}
|
|
34
|
+
setMeta(name, value) {
|
|
35
|
+
if (!this.meta) {
|
|
36
|
+
this.meta = {};
|
|
37
|
+
}
|
|
38
|
+
this.meta[name] = value;
|
|
39
|
+
}
|
|
40
|
+
unsetMeta(name) {
|
|
41
|
+
if (!this.meta || !(name in this.meta)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
delete this.meta[name];
|
|
45
|
+
if (Object.keys(this.meta).length === 0) {
|
|
46
|
+
delete this.meta;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
getEnv(name, defaultValue) {
|
|
50
|
+
if (!this.env || !(name in this.env)) {
|
|
51
|
+
return defaultValue;
|
|
52
|
+
}
|
|
53
|
+
return this.env[name];
|
|
54
|
+
}
|
|
55
|
+
setEnv(name, value) {
|
|
56
|
+
if (!this.env) {
|
|
57
|
+
this.env = {};
|
|
58
|
+
}
|
|
59
|
+
this.env[name] = value;
|
|
60
|
+
}
|
|
61
|
+
unsetEnv(name) {
|
|
62
|
+
if (!this.env || !(name in this.env)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
delete this.env[name];
|
|
66
|
+
if (Object.keys(this.env).length === 0) {
|
|
67
|
+
delete this.env;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
toJson() {
|
|
71
|
+
return {
|
|
72
|
+
debug: this.debug,
|
|
73
|
+
logLevel: this.logLevel,
|
|
74
|
+
plugins: this.plugins,
|
|
75
|
+
projects: this.projects,
|
|
76
|
+
meta: this.meta,
|
|
77
|
+
env: this.env
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.Config = Config;
|
package/lib/makes/Factory.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ApplicationContext } from "./ApplicationContext";
|
|
2
|
+
import { Container } from "./Container";
|
|
1
3
|
import { Module } from "./Module";
|
|
2
4
|
export declare class Factory {
|
|
3
5
|
private readonly cli;
|
|
@@ -13,5 +15,6 @@ export declare class Factory {
|
|
|
13
15
|
log(...args: any[]): void;
|
|
14
16
|
init(): Promise<void>;
|
|
15
17
|
run(args: string[]): Promise<any>;
|
|
16
|
-
|
|
18
|
+
getContainer(): Container;
|
|
19
|
+
static create(module: any): Promise<ApplicationContext>;
|
|
17
20
|
}
|
package/lib/makes/Factory.js
CHANGED
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Factory = void 0;
|
|
13
13
|
const cli_1 = require("@kearisp/cli");
|
|
14
|
+
const ApplicationContext_1 = require("./ApplicationContext");
|
|
14
15
|
const Container_1 = require("./Container");
|
|
15
16
|
const Module_1 = require("./Module");
|
|
16
17
|
const env_1 = require("../env");
|
|
@@ -98,7 +99,8 @@ class Factory {
|
|
|
98
99
|
continue;
|
|
99
100
|
}
|
|
100
101
|
const commandName = Reflect.getMetadata(env_1.COMMAND_METADATA, descriptor.value);
|
|
101
|
-
const completions = (Reflect.getMetadata(env_1.COMPLETION_METADATA, descriptor.value) || [])
|
|
102
|
+
const completions = (Reflect.getMetadata(env_1.COMPLETION_METADATA, descriptor.value) || [])
|
|
103
|
+
.map((completion) => {
|
|
102
104
|
return Object.assign(Object.assign({}, completion), { method: name });
|
|
103
105
|
});
|
|
104
106
|
if (completions.length > 0) {
|
|
@@ -190,11 +192,14 @@ class Factory {
|
|
|
190
192
|
return this.cli.run(args);
|
|
191
193
|
});
|
|
192
194
|
}
|
|
195
|
+
getContainer() {
|
|
196
|
+
return this.container;
|
|
197
|
+
}
|
|
193
198
|
static create(module) {
|
|
194
199
|
return __awaiter(this, void 0, void 0, function* () {
|
|
195
200
|
const factory = new this();
|
|
196
201
|
yield factory.scan(module);
|
|
197
|
-
return factory;
|
|
202
|
+
return new ApplicationContext_1.ApplicationContext(module, factory.getContainer());
|
|
198
203
|
});
|
|
199
204
|
}
|
|
200
205
|
}
|
package/lib/makes/Project.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { PickProperties, EnvConfig } from "../types";
|
|
2
|
-
|
|
3
|
-
type SearchOptions = {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
path: string;
|
|
7
|
-
};
|
|
8
|
-
export declare class Project {
|
|
2
|
+
export declare abstract class Project {
|
|
9
3
|
id: string;
|
|
10
4
|
name: string;
|
|
11
5
|
type: string;
|
|
@@ -33,12 +27,7 @@ export declare class Project {
|
|
|
33
27
|
getVolumeByDestination(destination: string): string | undefined;
|
|
34
28
|
volumeMount(...volumes: string[]): void;
|
|
35
29
|
volumeUnmount(...volumes: string[]): void;
|
|
36
|
-
save(): Promise<void>;
|
|
37
|
-
static install(di: DI): void;
|
|
38
|
-
static fromObject(data: any): Project;
|
|
39
|
-
static search(params?: Partial<SearchOptions>): Promise<Project[]>;
|
|
40
|
-
static searchOne(params: Partial<SearchOptions>): Promise<Project | null>;
|
|
30
|
+
abstract save(): Promise<void>;
|
|
41
31
|
}
|
|
42
32
|
export declare const PROJECT_TYPE_DOCKERFILE = "dockerfile";
|
|
43
33
|
export declare const PROJECT_TYPE_IMAGE = "image";
|
|
44
|
-
export {};
|
package/lib/makes/Project.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
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
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.PROJECT_TYPE_IMAGE = exports.PROJECT_TYPE_DOCKERFILE = exports.Project = void 0;
|
|
13
4
|
const volumeParse_1 = require("../utils/volumeParse");
|
|
14
|
-
const services_1 = require("../services");
|
|
15
|
-
let projectService;
|
|
16
5
|
class Project {
|
|
17
6
|
constructor(data) {
|
|
18
7
|
this.id = data.id;
|
|
@@ -117,34 +106,6 @@ class Project {
|
|
|
117
106
|
return !volumes.includes(mounted);
|
|
118
107
|
});
|
|
119
108
|
}
|
|
120
|
-
save() {
|
|
121
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
if (!projectService) {
|
|
123
|
-
throw new Error("Dependency is missing");
|
|
124
|
-
}
|
|
125
|
-
yield projectService.save(this);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
static install(di) {
|
|
129
|
-
projectService = di.resolveService(services_1.ProjectService);
|
|
130
|
-
}
|
|
131
|
-
static fromObject(data) {
|
|
132
|
-
return new Project(data);
|
|
133
|
-
}
|
|
134
|
-
static search() {
|
|
135
|
-
return __awaiter(this, arguments, void 0, function* (params = {}) {
|
|
136
|
-
if (!projectService) {
|
|
137
|
-
throw new Error("Dependency is missing");
|
|
138
|
-
}
|
|
139
|
-
return projectService.search(params);
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
static searchOne(params) {
|
|
143
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
const [project] = yield Project.search(params);
|
|
145
|
-
return project || null;
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
109
|
}
|
|
149
110
|
exports.Project = Project;
|
|
150
111
|
exports.PROJECT_TYPE_DOCKERFILE = "dockerfile";
|
package/lib/makes/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
export * from "./Config";
|
|
1
2
|
export * from "./Container";
|
|
2
3
|
export * from "./DI";
|
|
3
4
|
export * from "./FS";
|
|
4
5
|
export * from "./FSManager";
|
|
5
6
|
export * from "./Logger";
|
|
6
|
-
export * from "./Plugin";
|
|
7
7
|
export * from "./Preset";
|
|
8
8
|
export * from "./Project";
|
|
9
9
|
export * from "./Factory";
|
package/lib/makes/index.js
CHANGED
|
@@ -14,12 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Config"), exports);
|
|
17
18
|
__exportStar(require("./Container"), exports);
|
|
18
19
|
__exportStar(require("./DI"), exports);
|
|
19
20
|
__exportStar(require("./FS"), exports);
|
|
20
21
|
__exportStar(require("./FSManager"), exports);
|
|
21
22
|
__exportStar(require("./Logger"), exports);
|
|
22
|
-
__exportStar(require("./Plugin"), exports);
|
|
23
23
|
__exportStar(require("./Preset"), exports);
|
|
24
24
|
__exportStar(require("./Project"), exports);
|
|
25
25
|
__exportStar(require("./Factory"), exports);
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Config } from "../makes";
|
|
2
2
|
type TypeMap = {
|
|
3
3
|
[type: string]: string;
|
|
4
4
|
};
|
|
5
5
|
declare abstract class AppConfigService {
|
|
6
|
+
protected config?: Config;
|
|
6
7
|
abstract dataPath(...args: string[]): string;
|
|
7
8
|
abstract pluginsPath(...args: string[]): string;
|
|
8
9
|
abstract getPWD(): string;
|
|
9
10
|
abstract setPWD(pwd: string): void;
|
|
10
|
-
abstract getAppConfig(): Promise<AppConfig>;
|
|
11
|
-
abstract getMeta(name: string, defaultValue?: string): Promise<string | undefined>;
|
|
12
|
-
abstract setMeta(name: string, value: string | number | undefined): Promise<void>;
|
|
13
|
-
abstract getAllEnvVariables(): Promise<AppConfig["env"]>;
|
|
14
|
-
abstract getEnvVariable(name: string, defaultValue?: string): Promise<string | undefined>;
|
|
15
|
-
abstract setEnvVariable(name: string, value: string | number): Promise<void>;
|
|
16
|
-
abstract setProjectConfig(id: string, path: string): Promise<void>;
|
|
17
11
|
abstract getProjectTypes(): TypeMap;
|
|
18
12
|
abstract registerProjectType(name: string, title?: string): void;
|
|
19
|
-
abstract
|
|
20
|
-
|
|
13
|
+
protected abstract loadConfig(): Promise<Config>;
|
|
14
|
+
getConfig(): Promise<Config>;
|
|
21
15
|
}
|
|
22
16
|
export { AppConfigService };
|
|
@@ -5,10 +5,27 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
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
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
8
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
18
|
exports.AppConfigService = void 0;
|
|
10
19
|
const decorators_1 = require("../decorators");
|
|
11
20
|
let AppConfigService = class AppConfigService {
|
|
21
|
+
getConfig() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
if (!this.config) {
|
|
24
|
+
this.config = yield this.loadConfig();
|
|
25
|
+
}
|
|
26
|
+
return this.config;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
12
29
|
};
|
|
13
30
|
exports.AppConfigService = AppConfigService;
|
|
14
31
|
exports.AppConfigService = AppConfigService = __decorate([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wocker/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"author": "Kris Papercut <krispcut@gmail.com>",
|
|
5
5
|
"description": "Core of wocker",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/dockerode": "^3.3.23",
|
|
34
34
|
"@types/node": "^20.11.7",
|
|
35
|
-
"typescript": "^5.4.
|
|
35
|
+
"typescript": "^5.4.4"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/lib/makes/Plugin.d.ts
DELETED