@wocker/core 1.0.26-beta.4 → 1.0.26-beta.6
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.d.ts +2 -2
- package/lib/core/Container.d.ts +1 -2
- package/lib/core/Container.js +0 -5
- package/lib/core/ControllerWrapper.d.ts +1 -2
- package/lib/core/ControllerWrapper.js +1 -2
- package/lib/core/CoreModule.d.ts +2 -0
- package/lib/core/CoreModule.js +54 -0
- package/lib/core/Factory.js +2 -1
- package/lib/core/Scanner.d.ts +0 -1
- package/lib/core/Scanner.js +2 -3
- package/lib/env.d.ts +1 -0
- package/lib/env.js +2 -1
- package/lib/makes/AppConfig.d.ts +1 -5
- package/lib/makes/AppConfig.js +4 -4
- package/lib/services/AppConfigService.d.ts +1 -4
- package/lib/services/AppConfigService.js +2 -2
- package/lib/services/DockerService.d.ts +3 -3
- package/lib/types/PluginRef.d.ts +1 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/types/index.js +3 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Type } from "../types";
|
|
2
2
|
import { Container } from "./Container";
|
|
3
3
|
export declare class ApplicationContext {
|
|
4
|
-
protected readonly module:
|
|
4
|
+
protected readonly module: Type;
|
|
5
5
|
protected readonly container: Container;
|
|
6
|
-
constructor(module:
|
|
6
|
+
constructor(module: Type, container: Container);
|
|
7
7
|
get<TInput = any, TResult = TInput>(typeOrToken: Type<TInput> | Function | string | symbol): TResult;
|
|
8
8
|
run(args: string[]): Promise<string>;
|
|
9
9
|
}
|
package/lib/core/Container.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { Type, InjectionToken, ProviderType } from "../types";
|
|
1
2
|
import { InstanceWrapper } from "./InstanceWrapper";
|
|
2
3
|
import { ModuleWrapper } from "./ModuleWrapper";
|
|
3
|
-
import { Type, InjectionToken, ProviderType } from "../types";
|
|
4
4
|
export declare class Container {
|
|
5
5
|
readonly modules: Map<Type, ModuleWrapper>;
|
|
6
6
|
readonly moduleExportIndex: Map<InjectionToken, Set<ModuleWrapper>>;
|
|
7
7
|
readonly globalProviders: Map<InjectionToken, InstanceWrapper>;
|
|
8
|
-
constructor();
|
|
9
8
|
addModule<TInput = any>(type: Type<TInput>, module: ModuleWrapper): void;
|
|
10
9
|
hasModule<TInput = any>(type: Type<TInput>): boolean;
|
|
11
10
|
getModule<TInput = any>(type: Type<TInput>): ModuleWrapper<TInput>;
|
package/lib/core/Container.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Container = void 0;
|
|
4
|
-
const cli_1 = require("@kearisp/cli");
|
|
5
|
-
const InstanceWrapper_1 = require("./InstanceWrapper");
|
|
6
|
-
const ModuleWrapper_1 = require("./ModuleWrapper");
|
|
7
4
|
const env_1 = require("../env");
|
|
8
5
|
class Container {
|
|
9
6
|
constructor() {
|
|
10
7
|
this.modules = new Map();
|
|
11
8
|
this.moduleExportIndex = new Map();
|
|
12
9
|
this.globalProviders = new Map();
|
|
13
|
-
const cliWrapper = new InstanceWrapper_1.InstanceWrapper(new ModuleWrapper_1.ModuleWrapper(this, null), cli_1.Cli);
|
|
14
|
-
this.globalProviders.set(cli_1.Cli, cliWrapper);
|
|
15
10
|
}
|
|
16
11
|
addModule(type, module) {
|
|
17
12
|
this.modules.set(type, module);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import "reflect-metadata";
|
|
2
1
|
import { CommandInput } from "@kearisp/cli";
|
|
2
|
+
import { Type } from "../types";
|
|
3
3
|
import { InstanceWrapper } from "./InstanceWrapper";
|
|
4
4
|
import { ModuleWrapper } from "./ModuleWrapper";
|
|
5
|
-
import { Type } from "../types/Type";
|
|
6
5
|
import { Route } from "./Route";
|
|
7
6
|
export declare class ControllerWrapper<TInput = any> extends InstanceWrapper {
|
|
8
7
|
readonly _type: Type<TInput>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ControllerWrapper = void 0;
|
|
4
|
-
require("
|
|
4
|
+
const env_1 = require("../env");
|
|
5
5
|
const InstanceWrapper_1 = require("./InstanceWrapper");
|
|
6
6
|
const Route_1 = require("./Route");
|
|
7
|
-
const env_1 = require("../env");
|
|
8
7
|
class ControllerWrapper extends InstanceWrapper_1.InstanceWrapper {
|
|
9
8
|
constructor(module, type) {
|
|
10
9
|
super(module, type);
|
|
@@ -0,0 +1,54 @@
|
|
|
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.CoreModule = void 0;
|
|
10
|
+
const cli_1 = require("@kearisp/cli");
|
|
11
|
+
const decorators_1 = require("../decorators");
|
|
12
|
+
const AppService_1 = require("../services/AppService");
|
|
13
|
+
const AppConfigService_1 = require("../services/AppConfigService");
|
|
14
|
+
const AppFileSystemService_1 = require("../services/AppFileSystemService");
|
|
15
|
+
const ProcessService_1 = require("../services/ProcessService");
|
|
16
|
+
const EventService_1 = require("../services/EventService");
|
|
17
|
+
const LogService_1 = require("../services/LogService");
|
|
18
|
+
const env_1 = require("../env");
|
|
19
|
+
let CoreModule = class CoreModule {
|
|
20
|
+
};
|
|
21
|
+
exports.CoreModule = CoreModule;
|
|
22
|
+
exports.CoreModule = CoreModule = __decorate([
|
|
23
|
+
(0, decorators_1.Global)(),
|
|
24
|
+
(0, decorators_1.Module)({
|
|
25
|
+
providers: [
|
|
26
|
+
cli_1.Cli,
|
|
27
|
+
{
|
|
28
|
+
provide: env_1.WOCKER_VERSION_KEY,
|
|
29
|
+
useValue: env_1.WOCKER_VERSION
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
provide: env_1.WOCKER_DATA_DIR_KEY,
|
|
33
|
+
useValue: env_1.DATA_DIR
|
|
34
|
+
},
|
|
35
|
+
AppService_1.AppService,
|
|
36
|
+
AppConfigService_1.AppConfigService,
|
|
37
|
+
AppFileSystemService_1.AppFileSystemService,
|
|
38
|
+
ProcessService_1.ProcessService,
|
|
39
|
+
EventService_1.EventService,
|
|
40
|
+
LogService_1.LogService
|
|
41
|
+
],
|
|
42
|
+
exports: [
|
|
43
|
+
cli_1.Cli,
|
|
44
|
+
env_1.WOCKER_VERSION_KEY,
|
|
45
|
+
env_1.WOCKER_DATA_DIR_KEY,
|
|
46
|
+
AppService_1.AppService,
|
|
47
|
+
AppConfigService_1.AppConfigService,
|
|
48
|
+
AppFileSystemService_1.AppFileSystemService,
|
|
49
|
+
ProcessService_1.ProcessService,
|
|
50
|
+
EventService_1.EventService,
|
|
51
|
+
LogService_1.LogService
|
|
52
|
+
]
|
|
53
|
+
})
|
|
54
|
+
], CoreModule);
|
package/lib/core/Factory.js
CHANGED
|
@@ -11,11 +11,12 @@ 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 ApplicationContext_1 = require("./ApplicationContext");
|
|
14
|
+
const Container_1 = require("./Container");
|
|
14
15
|
const Scanner_1 = require("./Scanner");
|
|
15
16
|
class Factory {
|
|
16
17
|
static create(module) {
|
|
17
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const scanner = new Scanner_1.Scanner();
|
|
19
|
+
const container = new Container_1.Container(), scanner = new Scanner_1.Scanner(container);
|
|
19
20
|
yield scanner.scan(module);
|
|
20
21
|
return new ApplicationContext_1.ApplicationContext(module, scanner.container);
|
|
21
22
|
});
|
package/lib/core/Scanner.d.ts
CHANGED
package/lib/core/Scanner.js
CHANGED
|
@@ -10,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Scanner = void 0;
|
|
13
|
-
require("reflect-metadata");
|
|
14
13
|
const cli_1 = require("@kearisp/cli");
|
|
15
14
|
const Container_1 = require("./Container");
|
|
16
15
|
const ModuleWrapper_1 = require("./ModuleWrapper");
|
|
16
|
+
const CoreModule_1 = require("./CoreModule");
|
|
17
17
|
const env_1 = require("../env");
|
|
18
18
|
class Scanner {
|
|
19
19
|
constructor(container) {
|
|
@@ -21,6 +21,7 @@ class Scanner {
|
|
|
21
21
|
}
|
|
22
22
|
scan(moduleDefinition) {
|
|
23
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
this.scanModule(CoreModule_1.CoreModule);
|
|
24
25
|
this.scanModule(moduleDefinition);
|
|
25
26
|
yield this.scanDynamicModules();
|
|
26
27
|
this.scanRoutes();
|
|
@@ -82,13 +83,11 @@ class Scanner {
|
|
|
82
83
|
return module;
|
|
83
84
|
}
|
|
84
85
|
scanControllers(module, controllers) {
|
|
85
|
-
// const controllers = Reflect.getMetadata(MODULE_METADATA.CONTROLLERS, module.type) || [];
|
|
86
86
|
controllers.forEach((controller) => {
|
|
87
87
|
module.addController(controller);
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
scanProviders(module, providers) {
|
|
91
|
-
// const providers: ProviderType[] = Reflect.getMetadata(MODULE_METADATA.PROVIDERS, module.type) || [];
|
|
92
91
|
providers.forEach((provider) => {
|
|
93
92
|
module.addProvider(provider);
|
|
94
93
|
});
|
package/lib/env.d.ts
CHANGED
package/lib/env.js
CHANGED
|
@@ -3,9 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.WOCKER_DATA_DIR_KEY = exports.WOCKER_VERSION_KEY = exports.DATA_DIR = 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.ALIAS_METADATA = exports.ARGS_OLD_METADATA = exports.ARGS_METADATA = exports.COMPLETION_METADATA = exports.COMMAND_METADATA = exports.DESCRIPTION_METADATA = exports.INJECTABLE_WATERMARK = exports.IS_MODULE_METADATA = exports.IS_GLOBAL_METADATA = void 0;
|
|
6
|
+
exports.WOCKER_DATA_DIR_KEY = exports.WOCKER_VERSION_KEY = exports.DATA_DIR = 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.ALIAS_METADATA = exports.ARGS_OLD_METADATA = exports.ARGS_METADATA = exports.COMPLETION_METADATA = exports.COMMAND_METADATA = exports.DESCRIPTION_METADATA = exports.INJECTABLE_WATERMARK = exports.IS_MODULE_METADATA = exports.IS_GLOBAL_METADATA = exports.WOCKER_VERSION = void 0;
|
|
7
7
|
const os_1 = __importDefault(require("os"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
exports.WOCKER_VERSION = "1.0.26";
|
|
9
10
|
exports.IS_GLOBAL_METADATA = "IS_GLOBAL";
|
|
10
11
|
exports.IS_MODULE_METADATA = "isModule";
|
|
11
12
|
exports.INJECTABLE_WATERMARK = "__injectable__";
|
package/lib/makes/AppConfig.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { EnvConfig, PackageManagerType } from "../types";
|
|
2
|
-
import { PluginRef } from "../types/PluginRef";
|
|
3
|
-
import { PresetRef } from "../types/PresetRef";
|
|
4
|
-
import { ProjectRef, ProjectOldRef } from "../types/ProjectRef";
|
|
5
|
-
import { PresetSource } from "../types/PresetSource";
|
|
1
|
+
import { EnvConfig, PackageManagerType, PluginRef, PresetRef, ProjectRef, ProjectOldRef, PresetSource } from "../types";
|
|
6
2
|
export type AppConfigProperties = {
|
|
7
3
|
debug?: boolean;
|
|
8
4
|
pm?: PackageManagerType;
|
package/lib/makes/AppConfig.js
CHANGED
|
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.AppConfig = void 0;
|
|
15
|
-
const
|
|
15
|
+
const types_1 = require("../types");
|
|
16
16
|
class AppConfig {
|
|
17
17
|
constructor(data) {
|
|
18
18
|
this.logLevel = "off";
|
|
@@ -83,11 +83,11 @@ class AppConfig {
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
registerPreset(name, source, path) {
|
|
86
|
-
if (source ===
|
|
86
|
+
if (source === types_1.PRESET_SOURCE_INTERNAL) {
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
let presetData = this.presets.find((preset) => {
|
|
90
|
-
if (source ===
|
|
90
|
+
if (source === types_1.PRESET_SOURCE_EXTERNAL && preset.path === path) {
|
|
91
91
|
return true;
|
|
92
92
|
}
|
|
93
93
|
return preset.name === name;
|
|
@@ -100,7 +100,7 @@ class AppConfig {
|
|
|
100
100
|
this.presets.push(presetData);
|
|
101
101
|
}
|
|
102
102
|
presetData.source = source;
|
|
103
|
-
if (presetData.source ===
|
|
103
|
+
if (presetData.source === types_1.PRESET_SOURCE_EXTERNAL) {
|
|
104
104
|
presetData.path = path;
|
|
105
105
|
}
|
|
106
106
|
else if (presetData.path) {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { AppConfig } from "../makes/AppConfig";
|
|
2
|
-
import { PresetRef } from "../types
|
|
3
|
-
import { ProjectRef } from "../types/ProjectRef";
|
|
4
|
-
import { PluginRef } from "../types/PluginRef";
|
|
5
|
-
import { PresetSource } from "../types/PresetSource";
|
|
2
|
+
import { PresetSource, PresetRef, ProjectRef, PluginRef } from "../types";
|
|
6
3
|
import { AppFileSystemService } from "./AppFileSystemService";
|
|
7
4
|
import { ProcessService } from "./ProcessService";
|
|
8
5
|
type TypeMap = {
|
|
@@ -18,8 +18,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.AppConfigService = void 0;
|
|
19
19
|
const path_1 = __importDefault(require("path"));
|
|
20
20
|
const decorators_1 = require("../decorators");
|
|
21
|
-
const AppConfig_1 = require("../makes/AppConfig");
|
|
22
21
|
const modules_1 = require("../modules");
|
|
22
|
+
const AppConfig_1 = require("../makes/AppConfig");
|
|
23
23
|
const AppFileSystemService_1 = require("./AppFileSystemService");
|
|
24
24
|
const ProcessService_1 = require("./ProcessService");
|
|
25
25
|
const env_1 = require("../env");
|
|
@@ -155,7 +155,7 @@ let AppConfigService = class AppConfigService {
|
|
|
155
155
|
this.save();
|
|
156
156
|
}
|
|
157
157
|
addPlugin(name, env) {
|
|
158
|
-
this.config.addPlugin(name);
|
|
158
|
+
this.config.addPlugin(name, env);
|
|
159
159
|
}
|
|
160
160
|
removePlugin(name) {
|
|
161
161
|
this.config.removePlugin(name);
|
|
@@ -72,8 +72,8 @@ export declare abstract class DockerService {
|
|
|
72
72
|
abstract imageLs(options?: DockerServiceParams.ImageList): Promise<ImageInfo[]>;
|
|
73
73
|
abstract imageRm(tag: string, force?: boolean): Promise<void>;
|
|
74
74
|
abstract pullImage(tag: string): Promise<void>;
|
|
75
|
-
abstract attach(name: string | Container): Promise<NodeJS.ReadWriteStream>;
|
|
75
|
+
abstract attach(name: string | Container): Promise<NodeJS.ReadWriteStream | null | undefined>;
|
|
76
76
|
abstract attachStream(stream: NodeJS.ReadWriteStream): Promise<NodeJS.ReadWriteStream>;
|
|
77
|
-
abstract exec(name: string, command?: DockerServiceParams.Exec | string[], tty?: boolean): Promise<Duplex>;
|
|
78
|
-
abstract logs(containerOrName: string | Container): Promise<NodeJS.ReadableStream>;
|
|
77
|
+
abstract exec(name: string, command?: DockerServiceParams.Exec | string[], tty?: boolean): Promise<Duplex | null>;
|
|
78
|
+
abstract logs(containerOrName: string | Container): Promise<NodeJS.ReadableStream | null | undefined>;
|
|
79
79
|
}
|
package/lib/types/PluginRef.d.ts
CHANGED
package/lib/types/index.d.ts
CHANGED
|
@@ -6,11 +6,13 @@ export * from "./ModuleMetadata";
|
|
|
6
6
|
export * from "./PackageManagerType";
|
|
7
7
|
export * from "./PickProperties";
|
|
8
8
|
export * from "./PluginMetadata";
|
|
9
|
+
export * from "./PluginRef";
|
|
9
10
|
export * from "./PresetRef";
|
|
10
11
|
export * from "./PresetSource";
|
|
12
|
+
export * from "./ProviderType";
|
|
13
|
+
export * from "./ProjectRef";
|
|
11
14
|
export * from "./Type";
|
|
12
15
|
export * from "./Volume";
|
|
13
|
-
export * from "./ProviderType";
|
|
14
16
|
export type {
|
|
15
17
|
/**
|
|
16
18
|
* @deprecated
|
package/lib/types/index.js
CHANGED
|
@@ -22,8 +22,10 @@ __exportStar(require("./ModuleMetadata"), exports);
|
|
|
22
22
|
__exportStar(require("./PackageManagerType"), exports);
|
|
23
23
|
__exportStar(require("./PickProperties"), exports);
|
|
24
24
|
__exportStar(require("./PluginMetadata"), exports);
|
|
25
|
+
__exportStar(require("./PluginRef"), exports);
|
|
25
26
|
__exportStar(require("./PresetRef"), exports);
|
|
26
27
|
__exportStar(require("./PresetSource"), exports);
|
|
28
|
+
__exportStar(require("./ProviderType"), exports);
|
|
29
|
+
__exportStar(require("./ProjectRef"), exports);
|
|
27
30
|
__exportStar(require("./Type"), exports);
|
|
28
31
|
__exportStar(require("./Volume"), exports);
|
|
29
|
-
__exportStar(require("./ProviderType"), exports);
|