@wocker/core 1.1.7 → 1.1.8-beta.0

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/env.js CHANGED
@@ -12,8 +12,7 @@ exports.WOCKER_DATA_DIR = process.env.WS_DIR || path_1.default.join(os_1.default
12
12
  exports.WOCKER_DATA_DIR_KEY = "__WOCKER_DATA_DIR__";
13
13
  exports.WOCKER_INTERNAL_ALLOWED_MOUNTS = [
14
14
  "/var/run/docker.sock",
15
- "/var/run/docker.sock.raw",
16
- exports.WOCKER_DATA_DIR
15
+ "/var/run/docker.sock.raw"
17
16
  ];
18
17
  exports.FILE_SYSTEM_DRIVER_KEY = "__FILE_SYSTEM_DRIVER_";
19
18
  exports.PLUGIN_DIR_KEY = "PLUGIN_DIR";
@@ -28,7 +28,7 @@ export declare abstract class AppConfig {
28
28
  getEnv(key: string, byDefault: string): string;
29
29
  setEnv(name: string, value: string): void;
30
30
  unsetEnv(name: string): void;
31
- isMountAllowed(path: string, internal?: boolean): boolean;
31
+ isMountAllowed(path: string, internalAllow?: string[]): boolean;
32
32
  addMountAllow(path: string): void;
33
33
  removeMountAllow(path: string): void;
34
34
  addMountDeny(path: string): void;
@@ -13,7 +13,6 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.AppConfig = void 0;
15
15
  const isPathAllowed_1 = require("../utils/isPathAllowed");
16
- const env_1 = require("../env");
17
16
  class AppConfig {
18
17
  constructor(data) {
19
18
  const { plugins = [], presets = [], projects = [] } = data, rest = __rest(data, ["plugins", "presets", "projects"]);
@@ -161,11 +160,11 @@ class AppConfig {
161
160
  delete this.env;
162
161
  }
163
162
  }
164
- isMountAllowed(path, internal = false) {
163
+ isMountAllowed(path, internalAllow = []) {
165
164
  var _a, _b, _c, _d;
166
165
  return (0, isPathAllowed_1.isPathAllowed)(path, [
167
166
  ...((_b = (_a = this.permissions) === null || _a === void 0 ? void 0 : _a.mounts) === null || _b === void 0 ? void 0 : _b.allow) || [],
168
- ...internal ? env_1.WOCKER_INTERNAL_ALLOWED_MOUNTS : []
167
+ ...internalAllow
169
168
  ], (_d = (_c = this.permissions) === null || _c === void 0 ? void 0 : _c.mounts) === null || _d === void 0 ? void 0 : _d.deny);
170
169
  }
171
170
  addMountAllow(path) {
@@ -24,6 +24,10 @@ export declare abstract class DockerService {
24
24
  export declare namespace DockerService {
25
25
  type CreateContainerParams = ContainerService.CreateParams;
26
26
  type ListContainerParams = ContainerService.ListParams;
27
+ type BuildContext = {
28
+ path: string;
29
+ ignore?: string[];
30
+ };
27
31
  type BuildImageParams = {
28
32
  version?: "1" | "2";
29
33
  tag: string;
@@ -33,7 +37,7 @@ export declare namespace DockerService {
33
37
  labels?: {
34
38
  [key: string]: string;
35
39
  };
36
- context: string | string[];
40
+ context: string | BuildContext | (string | BuildContext)[];
37
41
  } & ({
38
42
  /** @deprecated */
39
43
  src: string;
@@ -8,12 +8,13 @@ type TypeMap = {
8
8
  };
9
9
  export declare class AppService {
10
10
  readonly version: string;
11
+ protected readonly dataDir: string;
11
12
  readonly fs: AppFileSystemService;
12
13
  protected readonly processService: ProcessService;
13
14
  protected readonly logService: LogService;
14
15
  protected _config?: AppConfig;
15
16
  protected readonly mapTypes: TypeMap;
16
- constructor(version: string, fs: AppFileSystemService, processService: ProcessService, logService: LogService);
17
+ constructor(version: string, dataDir: string, fs: AppFileSystemService, processService: ProcessService, logService: LogService);
17
18
  get config(): AppConfig;
18
19
  get debug(): boolean;
19
20
  set debug(debug: boolean);
@@ -22,8 +22,9 @@ const LogService_1 = require("./LogService");
22
22
  const types_1 = require("../types");
23
23
  const env_1 = require("../env");
24
24
  let AppService = class AppService {
25
- constructor(version, fs, processService, logService) {
25
+ constructor(version, dataDir, fs, processService, logService) {
26
26
  this.version = version;
27
+ this.dataDir = dataDir;
27
28
  this.fs = fs;
28
29
  this.processService = processService;
29
30
  this.logService = logService;
@@ -127,7 +128,7 @@ let AppService = class AppService {
127
128
  return this.config.getMeta(`experimental.${key}`) === "enabled";
128
129
  }
129
130
  isAllowedPath(path, internal = false) {
130
- return this.config.isMountAllowed(path, internal);
131
+ return this.config.isMountAllowed(path, internal ? [...env_1.WOCKER_INTERNAL_ALLOWED_MOUNTS, this.dataDir] : []);
131
132
  }
132
133
  save() {
133
134
  this.config.save();
@@ -137,7 +138,8 @@ exports.AppService = AppService;
137
138
  exports.AppService = AppService = __decorate([
138
139
  (0, decorators_1.Injectable)("APP_SERVICE"),
139
140
  __param(0, (0, decorators_1.Inject)(env_1.WOCKER_VERSION_KEY)),
140
- __metadata("design:paramtypes", [String, AppFileSystemService_1.AppFileSystemService,
141
+ __param(1, (0, decorators_1.Inject)(env_1.WOCKER_DATA_DIR_KEY)),
142
+ __metadata("design:paramtypes", [String, String, AppFileSystemService_1.AppFileSystemService,
141
143
  ProcessService_1.ProcessService,
142
144
  LogService_1.LogService])
143
145
  ], AppService);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wocker/core",
3
3
  "type": "commonjs",
4
- "version": "1.1.7",
4
+ "version": "1.1.8-beta.0",
5
5
  "author": "Kris Papercut <krispcut@gmail.com>",
6
6
  "description": "Core of the Wocker",
7
7
  "license": "MIT",