wedos-cli 1.0.1 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wedos-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "CLI nástroj pro správu domén a DNS přes WEDOS WAPI",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.js CHANGED
@@ -20,7 +20,7 @@ const program = new Command();
20
20
  program
21
21
  .name('wedos')
22
22
  .description('CLI nástroj pro WEDOS WAPI - registrace domén, správa DNS a další')
23
- .version('1.0.1')
23
+ .version('1.0.2')
24
24
  .hook('preAction', (thisCommand) => {
25
25
  // Show banner for main commands (not subcommands)
26
26
  const commandName = thisCommand.args[0];
package/src/lib/wapi.js CHANGED
@@ -103,11 +103,22 @@ export class WapiClient {
103
103
  }
104
104
 
105
105
  async domainCreate(options) {
106
+ // Parse rules - can be "Jméno Příjmení" string or {fname, lname} object
107
+ let rules = options.rules;
108
+ if (typeof rules === 'string') {
109
+ const parts = rules.trim().split(/\s+/);
110
+ if (parts.length >= 2) {
111
+ rules = { fname: parts[0], lname: parts.slice(1).join(' ') };
112
+ } else {
113
+ rules = { fname: parts[0], lname: parts[0] };
114
+ }
115
+ }
116
+
106
117
  const data = {
107
118
  name: options.name,
108
119
  period: options.period || 1,
109
120
  owner_c: options.ownerContact,
110
- rules: options.rules,
121
+ rules: rules,
111
122
  };
112
123
 
113
124
  if (options.adminContact) {
@@ -118,7 +129,16 @@ export class WapiClient {
118
129
  if (options.nsset) {
119
130
  data.nsset = options.nsset;
120
131
  } else if (options.dns) {
121
- data.dns = options.dns;
132
+ // Convert array of {name: "..."} to {server1: {name: "..."}, server2: {name: "..."}}
133
+ if (Array.isArray(options.dns)) {
134
+ const dnsObj = {};
135
+ options.dns.forEach((server, index) => {
136
+ dnsObj[`server${index + 1}`] = server;
137
+ });
138
+ data.dns = dnsObj;
139
+ } else {
140
+ data.dns = options.dns;
141
+ }
122
142
  } else {
123
143
  // Default to WEDOS NSSET
124
144
  data.nsset = 'WEDOS';