@wocker/pgsql-plugin
Advanced tools
Comparing version 1.0.8 to 1.0.9-beta.1
@@ -9,4 +9,7 @@ import { AppConfigService, DockerService } from "@wocker/core"; | ||
protected init(email?: string, password?: string, skipPassword?: boolean): Promise<void>; | ||
pgsql(name?: string): Promise<void>; | ||
protected create(service: string, user: string, password: string, host: string, port: string): Promise<void>; | ||
protected upgrade(name?: string, image?: string, imageVersion?: string): Promise<void>; | ||
protected destroy(service: string): Promise<void>; | ||
list(): Promise<string>; | ||
protected start(service?: string, restart?: boolean): Promise<void>; | ||
@@ -13,0 +16,0 @@ protected stop(service?: string): Promise<void>; |
@@ -39,2 +39,6 @@ "use strict"; | ||
} | ||
pgsql(name) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
}); | ||
} | ||
create(service, user, password, host, port) { | ||
@@ -48,2 +52,7 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
upgrade(name, image, imageVersion) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.pgSqlService.upgrade(name, image, imageVersion); | ||
}); | ||
} | ||
destroy(service) { | ||
@@ -54,2 +63,7 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
list() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.pgSqlService.listTable(); | ||
}); | ||
} | ||
start(service, restart) { | ||
@@ -98,2 +112,9 @@ return __awaiter(this, void 0, void 0, function* () { | ||
__decorate([ | ||
(0, core_1.Command)("pgsql [service]"), | ||
__param(0, (0, core_1.Param)("service")), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [String]), | ||
__metadata("design:returntype", Promise) | ||
], PgSqlController.prototype, "pgsql", null); | ||
__decorate([ | ||
(0, core_1.Command)("pgsql:create <service>"), | ||
@@ -126,2 +147,19 @@ __param(0, (0, core_1.Param)("service")), | ||
__decorate([ | ||
(0, core_1.Command)("pgsql:upgrade [service]"), | ||
__param(0, (0, core_1.Param)("service")), | ||
__param(1, (0, core_1.Option)("image", { | ||
type: "string", | ||
alias: "i", | ||
description: "Image name" | ||
})), | ||
__param(2, (0, core_1.Option)("image-version", { | ||
type: "string", | ||
alias: "I", | ||
description: "Image version" | ||
})), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [String, String, String]), | ||
__metadata("design:returntype", Promise) | ||
], PgSqlController.prototype, "upgrade", null); | ||
__decorate([ | ||
(0, core_1.Command)("pgsql:destroy <service>"), | ||
@@ -134,2 +172,9 @@ __param(0, (0, core_1.Param)("service")), | ||
__decorate([ | ||
(0, core_1.Command)("pgsql:ls"), | ||
(0, core_1.Description)(""), | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", []), | ||
__metadata("design:returntype", Promise) | ||
], PgSqlController.prototype, "list", null); | ||
__decorate([ | ||
(0, core_1.Command)("pgsql:start [service]"), | ||
@@ -136,0 +181,0 @@ __param(0, (0, core_1.Param)("service")), |
@@ -9,2 +9,4 @@ import { PickProperties } from "@wocker/core"; | ||
port?: string | number; | ||
image?: string; | ||
imageVersion?: string; | ||
constructor(data: ServiceProps); | ||
@@ -11,0 +13,0 @@ get containerName(): string; |
@@ -6,3 +6,3 @@ "use strict"; | ||
constructor(data) { | ||
const { name, host, port, user, password } = data; | ||
const { name, host, port, user, password, image = "postgres", imageVersion = "latest" } = data; | ||
this.name = name; | ||
@@ -13,2 +13,4 @@ this.host = host; | ||
this.password = password; | ||
this.image = image; | ||
this.imageVersion = imageVersion; | ||
} | ||
@@ -24,3 +26,5 @@ get containerName() { | ||
user: this.user, | ||
password: this.password | ||
password: this.password, | ||
image: this.image, | ||
imageVersion: this.imageVersion | ||
}; | ||
@@ -27,0 +31,0 @@ } |
@@ -15,3 +15,5 @@ import { AppConfigService, PluginConfigService, DockerService, ProxyService } from "@wocker/core"; | ||
create(name: string, user?: string, password?: string, host?: string, port?: string): Promise<void>; | ||
upgrade(name?: string, image?: string, imageVersion?: string): Promise<void>; | ||
destroy(service: string): Promise<void>; | ||
listTable(): Promise<string>; | ||
start(name?: string, restart?: boolean): Promise<void>; | ||
@@ -18,0 +20,0 @@ stop(name?: string): Promise<void>; |
@@ -53,2 +53,5 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -58,2 +61,3 @@ exports.PgSqlService = void 0; | ||
const utils_1 = require("@wocker/utils"); | ||
const cli_table3_1 = __importDefault(require("cli-table3")); | ||
const Path = __importStar(require("path")); | ||
@@ -139,2 +143,16 @@ const Config_1 = require("../makes/Config"); | ||
} | ||
upgrade(name, image, imageVersion) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const config = yield this.getConfig(); | ||
const service = config.getServiceOrDefault(name); | ||
if (image) { | ||
service.image = image; | ||
} | ||
if (imageVersion) { | ||
service.imageVersion = imageVersion; | ||
} | ||
config.setService(service); | ||
yield config.save(); | ||
}); | ||
} | ||
destroy(service) { | ||
@@ -147,2 +165,17 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
listTable() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const table = new cli_table3_1.default({ | ||
head: ["Name", "Host"] | ||
}); | ||
const config = yield this.getConfig(); | ||
for (const service of config.services) { | ||
table.push([ | ||
service.name + (config.default === service.name ? " (default)" : ""), | ||
service.host || service.containerName | ||
]); | ||
} | ||
return table.toString(); | ||
}); | ||
} | ||
start(name, restart) { | ||
@@ -160,3 +193,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
name: service.containerName, | ||
image: "postgres:latest", | ||
image: `${service.image}:${service.imageVersion}`, | ||
restart: "always", | ||
@@ -163,0 +196,0 @@ volumes: [ |
{ | ||
"name": "@wocker/pgsql-plugin", | ||
"version": "1.0.8", | ||
"version": "1.0.9-beta.1", | ||
"author": "Kris Papercut <krispcut@gmail.com>", | ||
"description": "PostgresSQL plugin for wocker", | ||
"license": "MIT", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"main": "./lib/index.js", | ||
"types": "./lib/index.d.ts", | ||
"keywords": [ | ||
@@ -17,3 +17,3 @@ "docker", | ||
], | ||
"homepage": "https://kearisp.github.io/wocker/plugins/pgsql", | ||
"homepage": "https://kearisp.github.io/wocker/docs/plugins/pgsql", | ||
"repository": { | ||
@@ -34,8 +34,9 @@ "type": "git", | ||
"@wocker/core": "^1.0.20", | ||
"@wocker/utils": "^1.0.7" | ||
"@wocker/utils": "^1.0.7", | ||
"cli-table3": "^0.6.5" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.11.20", | ||
"@types/node": "^22.7.8", | ||
"typescript": "^5.5.4" | ||
} | ||
} |
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
Unpopular package
QualityThis package is not very popular.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
34117
773
0
3
3
1
+ Addedcli-table3@^0.6.5
+ Added@colors/colors@1.5.0(transitive)
+ Addedcli-table3@0.6.5(transitive)