@wocker/mongodb-plugin 1.0.3 → 1.0.4

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.
@@ -2,7 +2,8 @@ import { MongodbService } from "../services/MongodbService";
2
2
  export declare class MongodbController {
3
3
  protected readonly mongodbService: MongodbService;
4
4
  constructor(mongodbService: MongodbService);
5
- create(name?: string, imageName?: string, imageVersion?: string): Promise<void>;
5
+ create(name?: string, username?: string, password?: string, imageName?: string, imageVersion?: string): Promise<void>;
6
+ upgrade(name?: string, imageName?: string, imageVersion?: string): Promise<void>;
6
7
  destroy(name: string, yes?: boolean, force?: boolean): Promise<void>;
7
8
  use(name: string): Promise<void>;
8
9
  start(name?: string, restart?: boolean): Promise<void>;
@@ -28,9 +28,20 @@ let MongodbController = class MongodbController {
28
28
  constructor(mongodbService) {
29
29
  this.mongodbService = mongodbService;
30
30
  }
31
- create(name, imageName, imageVersion) {
31
+ create(name, username, password, imageName, imageVersion) {
32
32
  return __awaiter(this, void 0, void 0, function* () {
33
33
  yield this.mongodbService.create({
34
+ name,
35
+ username,
36
+ password,
37
+ imageName,
38
+ imageVersion
39
+ });
40
+ });
41
+ }
42
+ upgrade(name, imageName, imageVersion) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ yield this.mongodbService.upgrade({
34
45
  name,
35
46
  imageName,
36
47
  imageVersion
@@ -79,11 +90,39 @@ __decorate([
79
90
  (0, core_1.Command)("mongodb:create [name]"),
80
91
  (0, core_1.Description)("Creates a MongoDB service with configurable credentials, host, and storage options."),
81
92
  __param(0, (0, core_1.Param)("name")),
82
- __param(1, (0, core_1.Option)("image", {
93
+ __param(1, (0, core_1.Option)("user", {
94
+ type: "string",
95
+ alias: "u",
96
+ description: "The username to start the service with"
97
+ })),
98
+ __param(2, (0, core_1.Option)("password", {
99
+ type: "string",
100
+ alias: "p",
101
+ description: "The password to start the service with"
102
+ })),
103
+ __param(3, (0, core_1.Option)("image", {
83
104
  type: "string",
84
105
  alias: "i",
85
106
  description: "The image name to start the service with",
86
107
  })),
108
+ __param(4, (0, core_1.Option)("image-version", {
109
+ type: "string",
110
+ alias: "I",
111
+ description: "The image version to start the service with"
112
+ })),
113
+ __metadata("design:type", Function),
114
+ __metadata("design:paramtypes", [String, String, String, String, String]),
115
+ __metadata("design:returntype", Promise)
116
+ ], MongodbController.prototype, "create", null);
117
+ __decorate([
118
+ (0, core_1.Command)("mongodb:upgrade [name]"),
119
+ (0, core_1.Description)("Upgrades a specified MongoDB service instance."),
120
+ __param(0, (0, core_1.Param)("name")),
121
+ __param(1, (0, core_1.Option)("image", {
122
+ type: "string",
123
+ alias: "i",
124
+ description: "The image name to start the service with"
125
+ })),
87
126
  __param(2, (0, core_1.Option)("image-version", {
88
127
  type: "string",
89
128
  alias: "I",
@@ -92,7 +131,7 @@ __decorate([
92
131
  __metadata("design:type", Function),
93
132
  __metadata("design:paramtypes", [String, String, String]),
94
133
  __metadata("design:returntype", Promise)
95
- ], MongodbController.prototype, "create", null);
134
+ ], MongodbController.prototype, "upgrade", null);
96
135
  __decorate([
97
136
  (0, core_1.Command)("mongodb:destroy <name>"),
98
137
  (0, core_1.Description)("Destroys a specified MongodbDB service instance with an option to force deletion."),
@@ -11,7 +11,7 @@ export declare class MongodbService {
11
11
  constructor(appConfigService: AppConfigService, pluginConfigService: PluginConfigService, dockerService: DockerService, proxyService: ProxyService);
12
12
  get config(): Config;
13
13
  create(props?: Partial<DatabaseProps>): Promise<void>;
14
- upgrade(name?: string, imageName?: string, imageVersion?: string): Promise<void>;
14
+ upgrade(props: Partial<DatabaseProps>): Promise<void>;
15
15
  destroy(name: string, yes?: boolean, force?: boolean): Promise<void>;
16
16
  use(name: string): void;
17
17
  start(name?: string, restart?: boolean): Promise<void>;
@@ -108,16 +108,16 @@ let MongodbService = class MongodbService {
108
108
  this.config.save();
109
109
  });
110
110
  }
111
- upgrade(name, imageName, imageVersion) {
111
+ upgrade(props) {
112
112
  return __awaiter(this, void 0, void 0, function* () {
113
- const service = this.config.getDatabaseOrDefault(name);
113
+ const service = this.config.getDatabaseOrDefault(props.name);
114
114
  let changed = false;
115
- if (imageName) {
116
- service.imageName = imageName;
115
+ if (props.imageName) {
116
+ service.imageName = props.imageName;
117
117
  changed = true;
118
118
  }
119
- if (imageVersion) {
120
- service.imageVersion = imageVersion;
119
+ if (props.imageVersion) {
120
+ service.imageVersion = props.imageVersion;
121
121
  changed = true;
122
122
  }
123
123
  if (changed) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wocker/mongodb-plugin",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "author": "Kris Papercut <krispcut@gmail.com>",
5
5
  "description": "Mongodb plugin for wocker",
6
6
  "license": "MIT",