@elvatis_com/openclaw-ispconfig 0.1.2

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.
@@ -0,0 +1,21 @@
1
+ import { JsonMap } from "./types";
2
+ interface ParamRule {
3
+ /** Expected value type */
4
+ type?: "string" | "number" | "boolean";
5
+ /** Field must be present and non-null */
6
+ required?: boolean;
7
+ /** String value must not be empty/whitespace-only */
8
+ notEmpty?: boolean;
9
+ /** Allowed values (compared case-insensitively for strings) */
10
+ enum?: string[];
11
+ }
12
+ interface ToolParamSchema {
13
+ /** Per-field validation rules */
14
+ fields?: Record<string, ParamRule>;
15
+ /** At least one key from each group must be present (OR logic within group) */
16
+ anyOf?: string[][];
17
+ }
18
+ export declare const TOOL_SCHEMAS: Record<string, ToolParamSchema>;
19
+ export declare function validateParams(toolName: string, params: JsonMap): void;
20
+ export {};
21
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAMlC,UAAU,SAAS;IACjB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACvC,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,UAAU,eAAe;IACvB,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnC,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;CACpB;AAQD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAkCxD,CAAC;AAMF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAkDtE"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TOOL_SCHEMAS = void 0;
4
+ exports.validateParams = validateParams;
5
+ const errors_1 = require("./errors");
6
+ // ---------------------------------------------------------------------------
7
+ // Schemas
8
+ // ---------------------------------------------------------------------------
9
+ const DNS_TYPES = ["A", "AAAA", "MX", "TXT", "CNAME"];
10
+ exports.TOOL_SCHEMAS = {
11
+ isp_provision_site: {
12
+ fields: {
13
+ domain: { type: "string", required: true, notEmpty: true },
14
+ clientName: { type: "string", required: true, notEmpty: true },
15
+ clientEmail: { type: "string", required: true, notEmpty: true },
16
+ serverIp: { type: "string" },
17
+ createMail: { type: "boolean" },
18
+ createDb: { type: "boolean" },
19
+ serverId: { type: "number" },
20
+ },
21
+ },
22
+ isp_client_get: {
23
+ anyOf: [["client_id", "clientId"]],
24
+ },
25
+ isp_site_get: {
26
+ anyOf: [["primary_id", "domain_id", "site_id"]],
27
+ },
28
+ isp_dns_record_list: {
29
+ anyOf: [["zone_id", "zoneId"]],
30
+ },
31
+ isp_dns_record_add: {
32
+ fields: {
33
+ type: { type: "string", required: true, notEmpty: true, enum: DNS_TYPES },
34
+ },
35
+ },
36
+ isp_dns_record_delete: {
37
+ fields: {
38
+ type: { type: "string", required: true, notEmpty: true, enum: DNS_TYPES },
39
+ },
40
+ },
41
+ isp_quota_check: {
42
+ anyOf: [["client_id", "clientId"]],
43
+ },
44
+ };
45
+ // ---------------------------------------------------------------------------
46
+ // Validator
47
+ // ---------------------------------------------------------------------------
48
+ function validateParams(toolName, params) {
49
+ const schema = exports.TOOL_SCHEMAS[toolName];
50
+ if (!schema)
51
+ return;
52
+ const errors = [];
53
+ if (schema.fields) {
54
+ for (const [key, rule] of Object.entries(schema.fields)) {
55
+ const value = params[key];
56
+ const present = value !== undefined && value !== null;
57
+ if (rule.required && !present) {
58
+ errors.push(`Missing required parameter: ${key}`);
59
+ continue;
60
+ }
61
+ if (!present)
62
+ continue;
63
+ if (rule.notEmpty && String(value).trim() === "") {
64
+ errors.push(`Parameter '${key}' must not be empty`);
65
+ }
66
+ if (rule.type === "number" && !Number.isFinite(Number(value))) {
67
+ errors.push(`Parameter '${key}' must be a valid number, got: ${String(value)}`);
68
+ }
69
+ if (rule.enum) {
70
+ const normalized = String(value).toUpperCase();
71
+ if (!rule.enum.includes(normalized)) {
72
+ errors.push(`Parameter '${key}' must be one of [${rule.enum.join(", ")}], got: ${String(value)}`);
73
+ }
74
+ }
75
+ }
76
+ }
77
+ if (schema.anyOf) {
78
+ for (const group of schema.anyOf) {
79
+ const found = group.some((key) => params[key] !== undefined && params[key] !== null);
80
+ if (!found) {
81
+ errors.push(`One of [${group.join(", ")}] is required`);
82
+ }
83
+ }
84
+ }
85
+ if (errors.length > 0) {
86
+ throw new errors_1.ISPConfigError("validation_error", `Validation failed for ${toolName}: ${errors.join("; ")}`, { statusCode: 400 });
87
+ }
88
+ }
89
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":";;;AAuEA,wCAkDC;AAzHD,qCAA0C;AAyB1C,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAEzC,QAAA,YAAY,GAAoC;IAC3D,kBAAkB,EAAE;QAClB,MAAM,EAAE;YACN,MAAM,EAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC/D,UAAU,EAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC/D,WAAW,EAAE,E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H,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC;YACrF,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,uBAAc,CAAC,kBAAkB,EACzC,yBAAyB,QAAQ,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EACzD,EAAE,UAAU,EAAE,GAAG,EAAE,CACpB,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "ISPConfig",
3
+ "version": "0.1.2",
4
+ "description": "Manage ISPConfig servers: automated site provisioning, domains, mailboxes, DNS, databases, SSL, backups, and more.",
5
+ "config": {
6
+ "apiUrl": {
7
+ "type": "string",
8
+ "description": "ISPConfig Remote JSON API URL (e.g. https://server:8080/remote/json.php)",
9
+ "required": true
10
+ },
11
+ "username": {
12
+ "type": "string",
13
+ "description": "ISPConfig remote API username",
14
+ "required": true
15
+ },
16
+ "password": {
17
+ "type": "string",
18
+ "description": "ISPConfig remote API password",
19
+ "required": true,
20
+ "secret": true
21
+ },
22
+ "serverId": {
23
+ "type": "number",
24
+ "description": "Default ISPConfig server ID (usually 1 for single-server setups)",
25
+ "default": 1
26
+ },
27
+ "defaultServerIp": {
28
+ "type": "string",
29
+ "description": "Default server IP for DNS A records"
30
+ },
31
+ "readOnly": {
32
+ "type": "boolean",
33
+ "description": "If true, only read operations are allowed",
34
+ "default": false
35
+ },
36
+ "allowedOperations": {
37
+ "type": "array",
38
+ "description": "Whitelist of allowed tool names. Empty = all allowed.",
39
+ "items": { "type": "string" },
40
+ "default": []
41
+ },
42
+ "verifySsl": {
43
+ "type": "boolean",
44
+ "description": "Verify SSL certificate of ISPConfig server",
45
+ "default": true
46
+ }
47
+ },
48
+ "tools": [
49
+ "isp_methods_list",
50
+ "isp_system_info",
51
+ "isp_provision_site",
52
+ "isp_client_list",
53
+ "isp_client_add",
54
+ "isp_client_get",
55
+ "isp_sites_list",
56
+ "isp_site_get",
57
+ "isp_site_add",
58
+ "isp_domains_list",
59
+ "isp_domain_add",
60
+ "isp_dns_zone_list",
61
+ "isp_dns_zone_add",
62
+ "isp_dns_record_list",
63
+ "isp_dns_record_add",
64
+ "isp_dns_record_delete",
65
+ "isp_mail_domain_list",
66
+ "isp_mail_domain_add",
67
+ "isp_mail_user_list",
68
+ "isp_mail_user_add",
69
+ "isp_mail_user_delete",
70
+ "isp_db_list",
71
+ "isp_db_add",
72
+ "isp_db_user_add",
73
+ "isp_ssl_status",
74
+ "isp_quota_check",
75
+ "isp_backup_list",
76
+ "isp_shell_user_add",
77
+ "isp_ftp_user_add",
78
+ "isp_cron_list",
79
+ "isp_cron_add"
80
+ ]
81
+ }
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@elvatis_com/openclaw-ispconfig",
3
+ "version": "0.1.2",
4
+ "description": "OpenClaw plugin for ISPConfig server management - domains, mailboxes, databases, DNS, websites",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "test": "jest",
10
+ "prepublishOnly": "npm run build"
11
+ },
12
+ "files": [
13
+ "dist",
14
+ "openclaw.plugin.json",
15
+ "README.md"
16
+ ],
17
+ "keywords": [
18
+ "openclaw",
19
+ "ispconfig",
20
+ "hosting",
21
+ "dns",
22
+ "mailbox",
23
+ "server-management"
24
+ ],
25
+ "author": "Elvatis <info@example.invalid>",
26
+ "license": "MIT",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/elvatis/openclaw-ispconfig.git"
30
+ },
31
+ "dependencies": {},
32
+ "devDependencies": {
33
+ "typescript": "^5.7.0",
34
+ "@types/node": "^22.0.0",
35
+ "jest": "^29.7.0",
36
+ "ts-jest": "^29.2.0",
37
+ "@types/jest": "^29.5.0"
38
+ },
39
+ "openclaw": {
40
+ "extensions": [
41
+ "./src/index.ts"
42
+ ]
43
+ }
44
+ }