@wocker/ws 1.0.31 → 1.1.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.
Files changed (70) hide show
  1. package/lib/AppModule.js +1 -2
  2. package/lib/main.js +2 -2
  3. package/lib/makes/GithubClient.d.ts +3 -2
  4. package/lib/makes/GithubClient.js +27 -27
  5. package/lib/makes/index.d.ts +0 -3
  6. package/lib/makes/index.js +0 -3
  7. package/lib/modules/core/controllers/DebugController.d.ts +3 -4
  8. package/lib/modules/core/controllers/DebugController.js +5 -22
  9. package/lib/modules/core/controllers/ExperimentalController.d.ts +3 -3
  10. package/lib/modules/core/controllers/ExperimentalController.js +1 -1
  11. package/lib/modules/dns/index.js +3 -3
  12. package/lib/modules/keystore/controllers/KeystoreController.d.ts +3 -3
  13. package/lib/modules/keystore/controllers/KeystoreController.js +8 -8
  14. package/lib/modules/keystore/providers/FileKeystoreProvider.js +8 -8
  15. package/lib/modules/keystore/services/KeystoreService.d.ts +3 -3
  16. package/lib/modules/keystore/services/KeystoreService.js +4 -4
  17. package/lib/modules/package-manager/service/PackageManager.d.ts +3 -3
  18. package/lib/modules/package-manager/service/PackageManager.js +8 -8
  19. package/lib/modules/package-manager/service/RegistryService.js +5 -4
  20. package/lib/modules/plugin/controllers/PluginController.d.ts +3 -3
  21. package/lib/modules/plugin/controllers/PluginController.js +4 -4
  22. package/lib/modules/plugin/index.js +4 -5
  23. package/lib/modules/plugin/services/PluginService.d.ts +3 -3
  24. package/lib/modules/plugin/services/PluginService.js +11 -13
  25. package/lib/modules/preset/controllers/PresetController.d.ts +3 -3
  26. package/lib/modules/preset/controllers/PresetController.js +6 -6
  27. package/lib/modules/preset/controllers/PresetListener.d.ts +5 -3
  28. package/lib/modules/preset/controllers/PresetListener.js +21 -30
  29. package/lib/modules/preset/repositories/PresetRepository.d.ts +3 -3
  30. package/lib/modules/preset/repositories/PresetRepository.js +7 -7
  31. package/lib/modules/preset/services/PresetService.d.ts +4 -3
  32. package/lib/modules/preset/services/PresetService.js +33 -33
  33. package/lib/modules/project/controllers/MetadataController.d.ts +8 -0
  34. package/lib/modules/project/controllers/MetadataController.js +89 -0
  35. package/lib/modules/project/controllers/ProjectController.d.ts +6 -6
  36. package/lib/modules/project/controllers/ProjectController.js +63 -49
  37. package/lib/modules/project/controllers/SecretsController.js +2 -2
  38. package/lib/modules/project/index.d.ts +1 -2
  39. package/lib/modules/project/index.js +4 -6
  40. package/lib/modules/project/services/ProjectService.d.ts +5 -6
  41. package/lib/modules/project/services/ProjectService.js +38 -39
  42. package/lib/modules/proxy/controllers/CertController.js +6 -0
  43. package/lib/modules/proxy/controllers/HttpAuthController.d.ts +15 -0
  44. package/lib/modules/proxy/controllers/HttpAuthController.js +137 -0
  45. package/lib/modules/proxy/controllers/ProxyController.d.ts +3 -3
  46. package/lib/modules/proxy/controllers/ProxyController.js +11 -11
  47. package/lib/modules/proxy/index.js +4 -0
  48. package/lib/modules/proxy/services/CertService.d.ts +6 -5
  49. package/lib/modules/proxy/services/CertService.js +1 -2
  50. package/lib/modules/proxy/services/HttpAuthService.d.ts +23 -0
  51. package/lib/modules/proxy/services/HttpAuthService.js +137 -0
  52. package/lib/modules/proxy/services/ProxyService.d.ts +4 -3
  53. package/lib/modules/proxy/services/ProxyService.js +31 -19
  54. package/lib/utils/index.d.ts +0 -1
  55. package/lib/utils/index.js +0 -1
  56. package/package.json +5 -13
  57. package/plugins/proxy/Dockerfile +14 -4
  58. package/plugins/proxy/wocker-entrypoint.sh +11 -0
  59. package/lib/makes/Http.d.ts +0 -18
  60. package/lib/makes/Http.js +0 -82
  61. package/lib/makes/Version.d.ts +0 -22
  62. package/lib/makes/Version.js +0 -59
  63. package/lib/makes/VersionRange.d.ts +0 -6
  64. package/lib/makes/VersionRange.js +0 -18
  65. package/lib/makes/VersionRule.d.ts +0 -24
  66. package/lib/makes/VersionRule.js +0 -68
  67. package/lib/modules/project/repositories/ProjectRepository.d.ts +0 -10
  68. package/lib/modules/project/repositories/ProjectRepository.js +0 -71
  69. package/lib/utils/injectVariables.d.ts +0 -5
  70. package/lib/utils/injectVariables.js +0 -10
package/lib/AppModule.js CHANGED
@@ -69,8 +69,7 @@ exports.AppModule = AppModule = __decorate([
69
69
  modules_1.PresetRepository,
70
70
  modules_1.PresetService,
71
71
  modules_1.ProjectService,
72
- core_1.ProcessService,
73
- modules_1.ProjectRepository
72
+ core_1.ProcessService
74
73
  ]
75
74
  })
76
75
  ], AppModule);
package/lib/main.js CHANGED
@@ -8,7 +8,7 @@ const core_1 = require("@wocker/core");
8
8
  const yoctocolors_cjs_1 = __importDefault(require("yoctocolors-cjs"));
9
9
  const AppModule_1 = require("./AppModule");
10
10
  (async () => {
11
- const context = await core_1.Factory.create(AppModule_1.AppModule), appConfigService = context.get(core_1.AppConfigService), logService = context.get(core_1.LogService);
11
+ const context = await core_1.Factory.create(AppModule_1.AppModule), appService = context.get(core_1.AppService), logService = context.get(core_1.LogService);
12
12
  try {
13
13
  const res = await context.run(process.argv);
14
14
  if (res) {
@@ -27,7 +27,7 @@ const AppModule_1 = require("./AppModule");
27
27
  if (err instanceof core_1.CommandNotFoundError) {
28
28
  return;
29
29
  }
30
- if (appConfigService.debug) {
30
+ if (appService.debug) {
31
31
  logService.error(err.stack || err.toString());
32
32
  }
33
33
  }
@@ -1,4 +1,4 @@
1
- import { AxiosInstance } from "axios";
1
+ import { Http } from "@wocker/utils";
2
2
  type RepositoryInfo = {
3
3
  default_branch: string;
4
4
  };
@@ -24,7 +24,8 @@ export declare class GithubClient {
24
24
  readonly owner: string;
25
25
  readonly repository: string;
26
26
  constructor(owner: string, repository: string);
27
- get axios(): AxiosInstance;
27
+ get client(): Http;
28
+ get contentClient(): Http;
28
29
  getInfo(): Promise<RepositoryInfo>;
29
30
  getBranches(): Promise<GithubBranch[]>;
30
31
  getTags(): Promise<GithubTag[]>;
@@ -1,54 +1,54 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.GithubClient = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
4
  const core_1 = require("@wocker/core");
5
+ const utils_1 = require("@wocker/utils");
9
6
  class GithubClient {
10
7
  constructor(owner, repository) {
11
8
  this.owner = owner;
12
9
  this.repository = repository;
13
10
  }
14
- get axios() {
15
- return axios_1.default.create({
11
+ get client() {
12
+ return utils_1.Http.base("https://api.github.com", {
16
13
  headers: {
17
14
  "User-Agent": "Wocker"
18
15
  }
19
16
  });
20
17
  }
21
- async getInfo() {
22
- const response = await this.axios.get(`https://api.github.com/repos/${this.owner}/${this.repository}`, {
18
+ get contentClient() {
19
+ return utils_1.Http.base("https://raw.githubusercontent.com", {
23
20
  headers: {
24
- "Accept": "application/vnd.github+json"
21
+ "User-Agent": "Wocker"
25
22
  }
26
23
  });
27
- return response.data;
24
+ }
25
+ async getInfo() {
26
+ return this.contentClient.get(`/repos/${this.owner}/${this.repository}`)
27
+ .withHeader("Accept", "application/vnd.github+json")
28
+ .expectStatus(200)
29
+ .json();
28
30
  }
29
31
  async getBranches() {
30
- const response = await this.axios
31
- .get(`https://api.github.com/repos/${this.owner}/${this.repository}/branches`);
32
- return response.data;
32
+ return this.client
33
+ .get(`/repos/${this.owner}/${this.repository}/branches`)
34
+ .expectStatus(200)
35
+ .json();
33
36
  }
34
37
  async getTags() {
35
- const response = await this.axios
36
- .get(`https://api.github.com/repos/${this.owner}/${this.repository}/tags`);
37
- return response.data;
38
+ return this.client
39
+ .get(`/repos/${this.owner}/${this.repository}/tags`)
40
+ .expectStatus(200)
41
+ .json();
38
42
  }
39
43
  async getFile(ref, path) {
40
- const res = await this.axios
41
- .get(`https://raw.githubusercontent.com/${this.owner}/${this.repository}/${ref}/${path}`, {
42
- headers: {
43
- "Accept": "application/vnd.github+json"
44
- }
45
- });
46
- return res.data;
44
+ return this.contentClient
45
+ .get(`/${this.owner}/${this.repository}/${ref}/${path}`)
46
+ .withHeader("Accept", "application/vnd.github+json")
47
+ .expectStatus(200)
48
+ .json();
47
49
  }
48
50
  async downloadZipByUrl(url, dirPath) {
49
- const res = await this.axios.get(url, {
50
- responseType: "stream"
51
- });
51
+ const res = await utils_1.Http.base(url).expectStatus(200).send();
52
52
  const fs = new core_1.FileSystem(dirPath);
53
53
  if (!fs.exists()) {
54
54
  fs.mkdir("", {
@@ -56,7 +56,7 @@ class GithubClient {
56
56
  });
57
57
  }
58
58
  return new Promise((resolve, reject) => {
59
- const { Parse } = require("unzipper"), pipe = res.data.pipe(Parse());
59
+ const { Parse } = require("unzipper"), pipe = res.pipe(Parse());
60
60
  pipe.on("entry", (entry) => {
61
61
  const path = entry.path.replace(/^[^\/]+\//, "");
62
62
  if (entry.type === "File") {
@@ -1,4 +1 @@
1
- export * from "./Http";
2
1
  export * from "./Plugin";
3
- export * from "./Version";
4
- export * from "./VersionRule";
@@ -14,7 +14,4 @@ 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("./Http"), exports);
18
17
  __exportStar(require("./Plugin"), exports);
19
- __exportStar(require("./Version"), exports);
20
- __exportStar(require("./VersionRule"), exports);
@@ -1,11 +1,10 @@
1
- import { LogService, AppConfigService } from "@wocker/core";
1
+ import { LogService, AppService } from "@wocker/core";
2
2
  export declare class DebugController {
3
- protected readonly appConfigService: AppConfigService;
3
+ protected readonly appService: AppService;
4
4
  protected readonly logService: LogService;
5
- constructor(appConfigService: AppConfigService, logService: LogService);
5
+ constructor(appService: AppService, logService: LogService);
6
6
  debug(): Promise<string>;
7
7
  setDebug(status: string): Promise<void>;
8
- setLog(level: string): Promise<void>;
9
8
  testLog(level: string, args: string[]): Promise<void>;
10
9
  debugCompletion(): Promise<string[]>;
11
10
  getLevels(): string[];
@@ -15,24 +15,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.DebugController = void 0;
16
16
  const core_1 = require("@wocker/core");
17
17
  let DebugController = class DebugController {
18
- constructor(appConfigService, logService) {
19
- this.appConfigService = appConfigService;
18
+ constructor(appService, logService) {
19
+ this.appService = appService;
20
20
  this.logService = logService;
21
21
  }
22
22
  async debug() {
23
- return this.appConfigService.debug ? "on" : "off";
23
+ return this.appService.debug ? "on" : "off";
24
24
  }
25
25
  async setDebug(status) {
26
- this.appConfigService.debug = status === "on";
27
- this.appConfigService.save();
28
- }
29
- async setLog(level) {
30
- const validLevels = this.getLevels();
31
- if (!validLevels.includes(level)) {
32
- throw new Error(`Invalid log level: ${level}. Valid options are ${validLevels.join(', ')}`);
33
- }
34
- this.appConfigService.config.logLevel = level;
35
- this.appConfigService.save();
26
+ this.appService.debug = status === "on";
36
27
  }
37
28
  async testLog(level, args) {
38
29
  this.logService._log(level, ...args);
@@ -59,14 +50,6 @@ __decorate([
59
50
  __metadata("design:paramtypes", [String]),
60
51
  __metadata("design:returntype", Promise)
61
52
  ], DebugController.prototype, "setDebug", null);
62
- __decorate([
63
- (0, core_1.Description)("Set the log level (options: debug, log, info, warn, error)"),
64
- (0, core_1.Command)("loglevel <level>"),
65
- __param(0, (0, core_1.Param)("level")),
66
- __metadata("design:type", Function),
67
- __metadata("design:paramtypes", [String]),
68
- __metadata("design:returntype", Promise)
69
- ], DebugController.prototype, "setLog", null);
70
53
  __decorate([
71
54
  (0, core_1.Command)("log:<level> [...args]"),
72
55
  __param(0, (0, core_1.Param)("level")),
@@ -89,6 +72,6 @@ __decorate([
89
72
  ], DebugController.prototype, "getLevels", null);
90
73
  exports.DebugController = DebugController = __decorate([
91
74
  (0, core_1.Controller)(),
92
- __metadata("design:paramtypes", [core_1.AppConfigService,
75
+ __metadata("design:paramtypes", [core_1.AppService,
93
76
  core_1.LogService])
94
77
  ], DebugController);
@@ -1,7 +1,7 @@
1
- import { AppConfigService } from "@wocker/core";
1
+ import { AppService } from "@wocker/core";
2
2
  export declare class ExperimentalController {
3
- protected readonly appService: AppConfigService;
4
- constructor(appService: AppConfigService);
3
+ protected readonly appService: AppService;
4
+ constructor(appService: AppService);
5
5
  enable(feature?: string): void;
6
6
  disable(feature?: string): void;
7
7
  getFeatures(): string[];
@@ -72,5 +72,5 @@ __decorate([
72
72
  exports.ExperimentalController = ExperimentalController = __decorate([
73
73
  (0, core_1.Controller)(),
74
74
  (0, core_1.Description)("Manage experimental features"),
75
- __metadata("design:paramtypes", [core_1.AppConfigService])
75
+ __metadata("design:paramtypes", [core_1.AppService])
76
76
  ], ExperimentalController);
@@ -20,9 +20,9 @@ let DnsModule = DnsModule_1 = class DnsModule {
20
20
  static register() {
21
21
  return {
22
22
  module: DnsModule_1,
23
- inject: [core_1.AppConfigService],
24
- useFactory: (appConfigService) => {
25
- if (!appConfigService.isExperimentalEnabled("dns")) {
23
+ inject: [core_1.AppService],
24
+ useFactory: (appService) => {
25
+ if (!appService.isExperimentalEnabled("dns")) {
26
26
  return {};
27
27
  }
28
28
  return {
@@ -1,8 +1,8 @@
1
- import { AppConfigService } from "@wocker/core";
1
+ import { AppService } from "@wocker/core";
2
2
  import { KeystoreService } from "../services/KeystoreService";
3
3
  export declare class KeystoreController {
4
- protected readonly appConfigService: AppConfigService;
4
+ protected readonly appService: AppService;
5
5
  protected readonly keystoreService: KeystoreService;
6
- constructor(appConfigService: AppConfigService, keystoreService: KeystoreService);
6
+ constructor(appService: AppService, keystoreService: KeystoreService);
7
7
  init(provider?: string): Promise<void>;
8
8
  }
@@ -14,28 +14,28 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.KeystoreController = void 0;
16
16
  const core_1 = require("@wocker/core");
17
- const utils_1 = require("@wocker/utils");
17
+ const prompts_1 = require("@wocker/prompts");
18
18
  const KeystoreService_1 = require("../services/KeystoreService");
19
19
  let KeystoreController = class KeystoreController {
20
- constructor(appConfigService, keystoreService) {
21
- this.appConfigService = appConfigService;
20
+ constructor(appService, keystoreService) {
21
+ this.appService = appService;
22
22
  this.keystoreService = keystoreService;
23
23
  }
24
24
  async init(provider) {
25
25
  if (!provider) {
26
- provider = await (0, utils_1.promptSelect)({
26
+ provider = await (0, prompts_1.promptSelect)({
27
27
  required: true,
28
28
  message: "Keystore provider",
29
29
  type: "text",
30
30
  options: ["file", "keytar"],
31
- default: this.appConfigService.config.keystore
31
+ default: this.appService.config.keystore
32
32
  });
33
33
  }
34
34
  if (!this.keystoreService.hasProvider(provider)) {
35
35
  throw new Error(`Provider "${provider}" not found`);
36
36
  }
37
- this.appConfigService.config.keystore = provider;
38
- this.appConfigService.save();
37
+ this.appService.config.keystore = provider;
38
+ this.appService.save();
39
39
  }
40
40
  };
41
41
  exports.KeystoreController = KeystoreController;
@@ -51,6 +51,6 @@ __decorate([
51
51
  exports.KeystoreController = KeystoreController = __decorate([
52
52
  (0, core_1.Controller)(),
53
53
  (0, core_1.Description)("Keystore commands"),
54
- __metadata("design:paramtypes", [core_1.AppConfigService,
54
+ __metadata("design:paramtypes", [core_1.AppService,
55
55
  KeystoreService_1.KeystoreService])
56
56
  ], KeystoreController);
@@ -11,9 +11,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.FileKeystoreProvider = void 0;
13
13
  const core_1 = require("@wocker/core");
14
- const utils_1 = require("@wocker/utils");
14
+ const prompts_1 = require("@wocker/prompts");
15
15
  const FileKeystore_1 = require("../types/FileKeystore");
16
- const utils_2 = require("../utils");
16
+ const utils_1 = require("../utils");
17
17
  let FileKeystoreProvider = class FileKeystoreProvider extends core_1.KeystoreProvider {
18
18
  constructor(fs) {
19
19
  super();
@@ -50,24 +50,24 @@ let FileKeystoreProvider = class FileKeystoreProvider extends core_1.KeystorePro
50
50
  }
51
51
  async getEncryptionKey() {
52
52
  if (!this.encryptionKey) {
53
- const password = await (0, utils_1.promptInput)({
53
+ const password = await (0, prompts_1.promptInput)({
54
54
  required: true,
55
55
  min: 6,
56
56
  max: 32,
57
57
  message: "Keystore password",
58
58
  type: "password",
59
59
  validate: async (value) => {
60
- if (typeof value !== "string" || !this.passwordHash || (0, utils_2.verifyPasswordHash)(value, this.passwordHash)) {
60
+ if (typeof value !== "string" || !this.passwordHash || (0, utils_1.verifyPasswordHash)(value, this.passwordHash)) {
61
61
  return true;
62
62
  }
63
63
  return "Invalid password";
64
64
  }
65
65
  });
66
66
  if (!this.keystore.passwordHash) {
67
- this.keystore.passwordHash = (0, utils_2.createPasswordHash)(password);
67
+ this.keystore.passwordHash = (0, utils_1.createPasswordHash)(password);
68
68
  this.keystore.save();
69
69
  }
70
- this.encryptionKey = (0, utils_2.createEncryptionKey)(password, this.keystore.passwordHash);
70
+ this.encryptionKey = (0, utils_1.createEncryptionKey)(password, this.keystore.passwordHash);
71
71
  }
72
72
  return this.encryptionKey;
73
73
  }
@@ -77,11 +77,11 @@ let FileKeystoreProvider = class FileKeystoreProvider extends core_1.KeystorePro
77
77
  return defaultValue;
78
78
  }
79
79
  const encryptionKey = await this.getEncryptionKey();
80
- return (0, utils_2.decrypt)(encryptionKey, value);
80
+ return (0, utils_1.decrypt)(encryptionKey, value);
81
81
  }
82
82
  async set(key, value) {
83
83
  const encryptionKey = await this.getEncryptionKey();
84
- this.keystore.set(key, (0, utils_2.encrypt)(encryptionKey, value));
84
+ this.keystore.set(key, (0, utils_1.encrypt)(encryptionKey, value));
85
85
  this.keystore.save();
86
86
  }
87
87
  async delete(key) {
@@ -1,9 +1,9 @@
1
- import { AppConfigService, AppFileSystemService, KeystoreService as CoreKeystoreService, KeystoreProvider } from "@wocker/core";
1
+ import { AppService, AppFileSystemService, KeystoreService as CoreKeystoreService, KeystoreProvider } from "@wocker/core";
2
2
  export declare class KeystoreService extends CoreKeystoreService {
3
- protected readonly appConfigService: AppConfigService;
3
+ protected readonly appService: AppService;
4
4
  protected readonly fs: AppFileSystemService;
5
5
  protected providers: Map<string, KeystoreProvider>;
6
- constructor(appConfigService: AppConfigService, fs: AppFileSystemService);
6
+ constructor(appService: AppService, fs: AppFileSystemService);
7
7
  hasProvider(name: string): boolean;
8
8
  provider(name?: string): KeystoreProvider;
9
9
  get(keys: string | string[], byDefault?: string): Promise<string | undefined>;
@@ -14,9 +14,9 @@ const core_1 = require("@wocker/core");
14
14
  const KeytarKeystoreProvider_1 = require("../providers/KeytarKeystoreProvider");
15
15
  const FileKeystoreProvider_1 = require("../providers/FileKeystoreProvider");
16
16
  let KeystoreService = class KeystoreService extends core_1.KeystoreService {
17
- constructor(appConfigService, fs) {
17
+ constructor(appService, fs) {
18
18
  super();
19
- this.appConfigService = appConfigService;
19
+ this.appService = appService;
20
20
  this.fs = fs;
21
21
  this.providers = new Map();
22
22
  }
@@ -25,7 +25,7 @@ let KeystoreService = class KeystoreService extends core_1.KeystoreService {
25
25
  }
26
26
  provider(name) {
27
27
  if (!name) {
28
- name = this.appConfigService.config.keystore;
28
+ name = this.appService.config.keystore;
29
29
  }
30
30
  if (!name) {
31
31
  name = "file";
@@ -70,6 +70,6 @@ let KeystoreService = class KeystoreService extends core_1.KeystoreService {
70
70
  exports.KeystoreService = KeystoreService;
71
71
  exports.KeystoreService = KeystoreService = __decorate([
72
72
  (0, core_1.Injectable)("KEYSTORE_SERVICE"),
73
- __metadata("design:paramtypes", [core_1.AppConfigService,
73
+ __metadata("design:paramtypes", [core_1.AppService,
74
74
  core_1.AppFileSystemService])
75
75
  ], KeystoreService);
@@ -1,8 +1,8 @@
1
- import { AppConfigService } from "@wocker/core";
1
+ import { AppService } from "@wocker/core";
2
2
  import { PackageManagerProvider } from "../types/PackageManagerProvider";
3
3
  export declare class PackageManager {
4
- protected readonly appConfigService: AppConfigService;
5
- constructor(appConfigService: AppConfigService);
4
+ protected readonly appService: AppService;
5
+ constructor(appService: AppService);
6
6
  getManager(): Promise<PackageManagerProvider>;
7
7
  getPackages(global?: boolean): Promise<import("../types/Package").Package[]>;
8
8
  install(name: string, version?: string): Promise<void>;
@@ -11,17 +11,17 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PackageManager = void 0;
13
13
  const core_1 = require("@wocker/core");
14
- const utils_1 = require("@wocker/utils");
14
+ const prompts_1 = require("@wocker/prompts");
15
15
  const NpmProvider_1 = require("../providers/NpmProvider");
16
16
  const PnpmProvider_1 = require("../providers/PnpmProvider");
17
17
  const YarnProvider_1 = require("../providers/YarnProvider");
18
18
  let PackageManager = class PackageManager {
19
- constructor(appConfigService) {
20
- this.appConfigService = appConfigService;
19
+ constructor(appService) {
20
+ this.appService = appService;
21
21
  }
22
22
  async getManager() {
23
- if (!this.appConfigService.config.pm) {
24
- this.appConfigService.config.pm = await (0, utils_1.promptSelect)({
23
+ if (!this.appService.config.pm) {
24
+ this.appService.config.pm = await (0, prompts_1.promptSelect)({
25
25
  label: "Package manager:",
26
26
  options: [
27
27
  {
@@ -39,9 +39,9 @@ let PackageManager = class PackageManager {
39
39
  ],
40
40
  required: true
41
41
  });
42
- this.appConfigService.save();
42
+ this.appService.save();
43
43
  }
44
- switch (this.appConfigService.config.pm) {
44
+ switch (this.appService.config.pm) {
45
45
  case "npm":
46
46
  return new NpmProvider_1.NpmProvider();
47
47
  case "pnpm":
@@ -66,5 +66,5 @@ let PackageManager = class PackageManager {
66
66
  exports.PackageManager = PackageManager;
67
67
  exports.PackageManager = PackageManager = __decorate([
68
68
  (0, core_1.Injectable)("PACKAGE_MANAGER_SERVICE"),
69
- __metadata("design:paramtypes", [core_1.AppConfigService])
69
+ __metadata("design:paramtypes", [core_1.AppService])
70
70
  ], PackageManager);
@@ -8,18 +8,19 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.RegistryService = void 0;
10
10
  const core_1 = require("@wocker/core");
11
- const makes_1 = require("../../../makes");
11
+ const utils_1 = require("@wocker/utils");
12
12
  let RegistryService = class RegistryService {
13
13
  async getPackageInfo(name) {
14
- const res = await makes_1.Http.get("https://registry.npmjs.org")
15
- .send(name);
14
+ const res = await utils_1.Http.base("https://registry.npmjs.org")
15
+ .get(name)
16
+ .send();
16
17
  if (res.status === 404) {
17
18
  throw new Error("Package not found");
18
19
  }
19
20
  if (res.status !== 200) {
20
21
  throw new Error("Network error");
21
22
  }
22
- return res.data;
23
+ return res.json();
23
24
  }
24
25
  };
25
26
  exports.RegistryService = RegistryService;
@@ -1,9 +1,9 @@
1
- import { AppConfigService } from "@wocker/core";
1
+ import { AppService } from "@wocker/core";
2
2
  import { PluginService } from "../services/PluginService";
3
3
  export declare class PluginController {
4
- protected readonly appConfigService: AppConfigService;
4
+ protected readonly appService: AppService;
5
5
  protected readonly pluginService: PluginService;
6
- constructor(appConfigService: AppConfigService, pluginService: PluginService);
6
+ constructor(appService: AppService, pluginService: PluginService);
7
7
  list(): Promise<string>;
8
8
  add(names: string[]): Promise<void>;
9
9
  remove(names: string[]): Promise<void>;
@@ -16,8 +16,8 @@ exports.PluginController = void 0;
16
16
  const core_1 = require("@wocker/core");
17
17
  const PluginService_1 = require("../services/PluginService");
18
18
  let PluginController = class PluginController {
19
- constructor(appConfigService, pluginService) {
20
- this.appConfigService = appConfigService;
19
+ constructor(appService, pluginService) {
20
+ this.appService = appService;
21
21
  this.pluginService = pluginService;
22
22
  }
23
23
  async list() {
@@ -38,7 +38,7 @@ let PluginController = class PluginController {
38
38
  await this.pluginService.update();
39
39
  }
40
40
  getInstalledPlugins() {
41
- return this.appConfigService.plugins.map(pluginRef => pluginRef.name);
41
+ return this.appService.plugins.map(pluginRef => pluginRef.name);
42
42
  }
43
43
  };
44
44
  exports.PluginController = PluginController;
@@ -82,6 +82,6 @@ __decorate([
82
82
  exports.PluginController = PluginController = __decorate([
83
83
  (0, core_1.Controller)(),
84
84
  (0, core_1.Description)("Plugin commands"),
85
- __metadata("design:paramtypes", [core_1.AppConfigService,
85
+ __metadata("design:paramtypes", [core_1.AppService,
86
86
  PluginService_1.PluginService])
87
87
  ], PluginController);
@@ -18,14 +18,14 @@ let PluginModule = PluginModule_1 = class PluginModule {
18
18
  return {
19
19
  module: PluginModule_1,
20
20
  inject: [
21
- core_1.AppConfigService,
21
+ core_1.AppService,
22
22
  core_1.AppFileSystemService,
23
23
  core_1.LogService,
24
24
  PluginService_1.PluginService
25
25
  ],
26
- useFactory: async (appConfigService, fs, logService, pluginService) => {
26
+ useFactory: async (appService, fs, logService, pluginService) => {
27
27
  const imports = [];
28
- for (const pluginData of appConfigService.plugins) {
28
+ for (const pluginData of appService.plugins) {
29
29
  try {
30
30
  const plugin = await pluginService.import(pluginData.name);
31
31
  imports.push({
@@ -43,8 +43,7 @@ let PluginModule = PluginModule_1 = class PluginModule {
43
43
  pluginName: pluginData.name,
44
44
  pluginEnv: pluginData.env
45
45
  });
46
- appConfigService.removePlugin(pluginData.name);
47
- appConfigService.save();
46
+ appService.removePlugin(pluginData.name);
48
47
  }
49
48
  }
50
49
  return {
@@ -1,14 +1,14 @@
1
- import { Cli, AppConfigService, LogService } from "@wocker/core";
1
+ import { Cli, AppService, LogService } from "@wocker/core";
2
2
  import { PackageManager, RegistryService } from "../../package-manager";
3
3
  import { Plugin } from "../../../makes";
4
4
  export declare class PluginService {
5
- protected readonly appConfigService: AppConfigService;
5
+ protected readonly appService: AppService;
6
6
  protected readonly pm: PackageManager;
7
7
  protected readonly registryService: RegistryService;
8
8
  protected readonly logService: LogService;
9
9
  protected readonly cli: Cli;
10
10
  protected rule: string;
11
- constructor(appConfigService: AppConfigService, pm: PackageManager, registryService: RegistryService, logService: LogService, cli: Cli);
11
+ constructor(appService: AppService, pm: PackageManager, registryService: RegistryService, logService: LogService, cli: Cli);
12
12
  getPluginsTable(): string;
13
13
  checkPlugin(pluginName: string): Promise<boolean>;
14
14
  install(pluginName: string, version?: string): Promise<void>;