@wocker/core 1.1.0-beta.0 → 1.1.0-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.
@@ -1,9 +1,11 @@
1
- import { Type, InjectionToken } from "../types";
2
1
  import { Container } from "./Container";
2
+ import { Type, InjectionToken } from "../types";
3
+ import { ApplicationOptions } from "../types/ApplicationOptions";
3
4
  export declare class ApplicationContext {
4
5
  protected readonly module: Type;
5
6
  protected readonly container: Container;
6
- constructor(module: Type, container: Container);
7
+ protected readonly options: ApplicationOptions;
8
+ constructor(module: Type, container: Container, options?: ApplicationOptions);
7
9
  get<TInput = any, TResult = TInput>(typeOrToken: InjectionToken<TInput>): TResult;
8
10
  run(args: string[]): Promise<string>;
9
11
  }
@@ -14,9 +14,10 @@ const cli_1 = require("@kearisp/cli");
14
14
  const AsyncStorage_1 = require("./AsyncStorage");
15
15
  const env_1 = require("../env");
16
16
  class ApplicationContext {
17
- constructor(module, container) {
17
+ constructor(module, container, options = {}) {
18
18
  this.module = module;
19
19
  this.container = container;
20
+ this.options = options;
20
21
  }
21
22
  get(typeOrToken) {
22
23
  const module = this.container.getModule(this.module);
@@ -1,5 +1,6 @@
1
1
  import { ApplicationContext } from "./ApplicationContext";
2
2
  import { Type } from "../types";
3
+ import { ApplicationOptions } from "../types/ApplicationOptions";
3
4
  export declare class Factory {
4
- static create(module: Type): Promise<ApplicationContext>;
5
+ static create(module: Type, options?: ApplicationOptions): Promise<ApplicationContext>;
5
6
  }
@@ -14,11 +14,11 @@ const ApplicationContext_1 = require("./ApplicationContext");
14
14
  const Container_1 = require("./Container");
15
15
  const Scanner_1 = require("./Scanner");
16
16
  class Factory {
17
- static create(module) {
18
- return __awaiter(this, void 0, void 0, function* () {
17
+ static create(module_1) {
18
+ return __awaiter(this, arguments, void 0, function* (module, options = {}) {
19
19
  const container = new Container_1.Container(), scanner = new Scanner_1.Scanner(container);
20
20
  yield scanner.scan(module);
21
- return new ApplicationContext_1.ApplicationContext(module, container);
21
+ return new ApplicationContext_1.ApplicationContext(module, container, options);
22
22
  });
23
23
  }
24
24
  }
@@ -14,8 +14,8 @@ const cli_1 = require("@kearisp/cli");
14
14
  const Container_1 = require("./Container");
15
15
  const ModuleWrapper_1 = require("./ModuleWrapper");
16
16
  const CoreModule_1 = require("./CoreModule");
17
- const env_1 = require("../env");
18
17
  const InstanceWrapper_1 = require("./InstanceWrapper");
18
+ const env_1 = require("../env");
19
19
  class Scanner {
20
20
  constructor(container) {
21
21
  this.container = container || new Container_1.Container();
@@ -41,34 +41,5 @@ export declare abstract class AppConfig {
41
41
  abstract save(): void;
42
42
  toObject(): AppConfigProperties;
43
43
  toJsString(): string;
44
- static make(fs: FileSystem): {
45
- save(): void;
46
- debug?: boolean;
47
- pm?: PackageManagerType;
48
- keystore?: string;
49
- logLevel: "off" | "info" | "warn" | "error";
50
- plugins: PluginRef[];
51
- presets: PresetRef[];
52
- projects: ProjectRef[];
53
- meta?: EnvConfig;
54
- env?: EnvConfig;
55
- addPlugin(name: string, env?: PluginRef["env"]): void;
56
- removePlugin(name: string): void;
57
- getProject(name: string): ProjectRef | undefined;
58
- addProject(name: string, path: string): void;
59
- removeProject(name: string): void;
60
- registerPreset(name: string, source: PresetSource, path?: string): void;
61
- unregisterPreset(name: string): void;
62
- hasMeta(name: string): boolean;
63
- getMeta(name: string, defaultValue?: string): string | undefined;
64
- getMeta(name: string, defaultValue: string): string;
65
- setMeta(name: string, value: string): void;
66
- unsetMeta(name: string): void;
67
- getEnv(key: string, byDefault?: string): string | undefined;
68
- getEnv(key: string, byDefault: string): string;
69
- setEnv(name: string, value: string): void;
70
- unsetEnv(name: string): void;
71
- toObject(): AppConfigProperties;
72
- toJsString(): string;
73
- };
44
+ static make(fs: FileSystem): AppConfig;
74
45
  }
@@ -8,4 +8,7 @@ export declare class ProcessService {
8
8
  cd(path: string): void;
9
9
  chdir(path: string): void;
10
10
  write(chunk: string | Buffer): boolean;
11
+ getEnv(key: string, byDefault?: string): string | undefined;
12
+ getEnv(key: string, byDefault: string): string;
13
+ setEnv(key: string, value: string): void;
11
14
  }
@@ -14,16 +14,16 @@ const path_1 = __importDefault(require("path"));
14
14
  const decorators_1 = require("../decorators");
15
15
  let ProcessService = class ProcessService {
16
16
  get UID() {
17
- if (process.getuid) {
18
- return `${process.getuid()}`;
17
+ if (!process.getuid) {
18
+ return undefined;
19
19
  }
20
- return undefined;
20
+ return `${process.getuid()}`;
21
21
  }
22
22
  get GID() {
23
- if (process.getgid) {
24
- return `${process.getgid()}`;
23
+ if (!process.getgid) {
24
+ return undefined;
25
25
  }
26
- return undefined;
26
+ return `${process.getgid()}`;
27
27
  }
28
28
  get stdin() {
29
29
  return process.stdin;
@@ -46,6 +46,15 @@ let ProcessService = class ProcessService {
46
46
  write(chunk) {
47
47
  return this.stdout.write(chunk);
48
48
  }
49
+ getEnv(key, byDefault) {
50
+ if (key in process.env) {
51
+ return process.env[key];
52
+ }
53
+ return byDefault;
54
+ }
55
+ setEnv(key, value) {
56
+ process.env[key] = value;
57
+ }
49
58
  };
50
59
  exports.ProcessService = ProcessService;
51
60
  exports.ProcessService = ProcessService = __decorate([
@@ -0,0 +1 @@
1
+ export type ApplicationOptions = {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wocker/core",
3
3
  "type": "commonjs",
4
- "version": "1.1.0-beta.0",
4
+ "version": "1.1.0-beta.1",
5
5
  "author": "Kris Papercut <krispcut@gmail.com>",
6
6
  "description": "Core of the Wocker",
7
7
  "license": "MIT",
@@ -39,7 +39,6 @@
39
39
  "@types/dockerode": "^3.3.23",
40
40
  "@types/jest": "^30.0.0",
41
41
  "@types/node": "^24.5.2",
42
- "@wocker/testing": "^1.0.7",
43
42
  "jest": "^30.1.3",
44
43
  "make-coverage-badge": "^1.2.0",
45
44
  "memfs": "^4.17.1",