hetzner-robot-cli 1.0.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.
@@ -0,0 +1,352 @@
1
+ export interface Server {
2
+ server_ip: string;
3
+ server_ipv6_net: string;
4
+ server_number: number;
5
+ server_name: string;
6
+ product: string;
7
+ dc: string;
8
+ traffic: string;
9
+ status: 'ready' | 'installing' | 'maintenance';
10
+ cancelled: boolean;
11
+ paid_until: string;
12
+ ip: string[];
13
+ subnet: ServerSubnet[];
14
+ }
15
+ export interface ServerSubnet {
16
+ ip: string;
17
+ mask: string;
18
+ }
19
+ export interface ServerDetails extends Server {
20
+ reset: boolean;
21
+ rescue: boolean;
22
+ vnc: boolean;
23
+ windows: boolean;
24
+ plesk: boolean;
25
+ cpanel: boolean;
26
+ wol: boolean;
27
+ hot_swap: boolean;
28
+ }
29
+ export interface Cancellation {
30
+ server_ip: string;
31
+ server_ipv6_net: string;
32
+ server_number: number;
33
+ server_name: string;
34
+ earliest_cancellation_date: string;
35
+ cancelled: boolean;
36
+ cancellation_date: string | null;
37
+ cancellation_reason: string[] | null;
38
+ }
39
+ export type ResetType = 'sw' | 'hw' | 'man' | 'power' | 'power_long';
40
+ export interface Reset {
41
+ server_ip: string;
42
+ server_ipv6_net: string;
43
+ server_number: number;
44
+ type: ResetType[];
45
+ operating_status: string;
46
+ }
47
+ export interface BootConfig {
48
+ rescue: RescueConfig | null;
49
+ linux: LinuxConfig | null;
50
+ vnc: VncConfig | null;
51
+ windows: WindowsConfig | null;
52
+ plesk: PleskConfig | null;
53
+ cpanel: CpanelConfig | null;
54
+ }
55
+ interface BaseBootConfig {
56
+ server_ip: string;
57
+ server_ipv6_net: string;
58
+ server_number: number;
59
+ active: boolean;
60
+ password: string | null;
61
+ }
62
+ export interface RescueConfig extends BaseBootConfig {
63
+ os: string[];
64
+ arch: number[];
65
+ authorized_key: string[];
66
+ host_key: string[];
67
+ }
68
+ export interface LinuxConfig extends BaseBootConfig {
69
+ dist: string[];
70
+ arch: number[];
71
+ lang: string[];
72
+ authorized_key: string[];
73
+ host_key: string[];
74
+ }
75
+ export interface VncConfig extends BaseBootConfig {
76
+ dist: string[];
77
+ arch: number[];
78
+ lang: string[];
79
+ }
80
+ export interface WindowsConfig extends BaseBootConfig {
81
+ dist: string[];
82
+ lang: string[];
83
+ }
84
+ export interface PleskConfig extends BaseBootConfig {
85
+ dist: string[];
86
+ arch: number[];
87
+ lang: string[];
88
+ hostname: string | null;
89
+ }
90
+ export interface CpanelConfig extends BaseBootConfig {
91
+ dist: string[];
92
+ arch: number[];
93
+ lang: string[];
94
+ hostname: string | null;
95
+ }
96
+ export interface IP {
97
+ ip: string;
98
+ server_ip: string;
99
+ server_number: number;
100
+ locked: boolean;
101
+ separate_mac: string | null;
102
+ traffic_warnings: boolean;
103
+ traffic_hourly: number;
104
+ traffic_daily: number;
105
+ traffic_monthly: number;
106
+ }
107
+ export interface Mac {
108
+ ip: string;
109
+ mac: string;
110
+ }
111
+ export interface Subnet {
112
+ ip: string;
113
+ mask: string;
114
+ gateway: string;
115
+ server_ip: string;
116
+ server_number: number;
117
+ failover: boolean;
118
+ locked: boolean;
119
+ traffic_warnings: boolean;
120
+ traffic_hourly: number;
121
+ traffic_daily: number;
122
+ traffic_monthly: number;
123
+ }
124
+ export interface Failover {
125
+ ip: string;
126
+ netmask: string;
127
+ server_ip: string;
128
+ server_number: number;
129
+ active_server_ip: string;
130
+ }
131
+ export interface Rdns {
132
+ ip: string;
133
+ ptr: string;
134
+ }
135
+ export interface SshKey {
136
+ name: string;
137
+ fingerprint: string;
138
+ type: string;
139
+ size: number;
140
+ data: string;
141
+ }
142
+ export interface Firewall {
143
+ server_ip: string;
144
+ server_number: number;
145
+ status: 'active' | 'disabled' | 'in process';
146
+ filter_ipv6: boolean;
147
+ whitelist_hos: boolean;
148
+ port: 'main' | 'kvm';
149
+ rules: {
150
+ input: FirewallRule[];
151
+ output?: FirewallRule[];
152
+ };
153
+ }
154
+ export interface FirewallRule {
155
+ ip_version: string;
156
+ name: string;
157
+ dst_ip: string | null;
158
+ dst_port: string | null;
159
+ src_ip: string | null;
160
+ src_port: string | null;
161
+ protocol: string | null;
162
+ tcp_flags: string | null;
163
+ action: 'accept' | 'discard';
164
+ }
165
+ export interface FirewallTemplate {
166
+ id: number;
167
+ name: string;
168
+ filter_ipv6: boolean;
169
+ whitelist_hos: boolean;
170
+ is_default: boolean;
171
+ rules: {
172
+ input: FirewallRule[];
173
+ output?: FirewallRule[];
174
+ };
175
+ }
176
+ export interface VSwitch {
177
+ id: number;
178
+ name: string;
179
+ vlan: number;
180
+ cancelled: boolean;
181
+ server: VSwitchServer[];
182
+ subnet: VSwitchSubnet[];
183
+ cloud_network: VSwitchCloudNetwork[];
184
+ }
185
+ export interface VSwitchServer {
186
+ server_ip: string;
187
+ server_ipv6_net: string;
188
+ server_number: number;
189
+ status: 'ready' | 'in process' | 'failed';
190
+ }
191
+ export interface VSwitchSubnet {
192
+ ip: string;
193
+ mask: number;
194
+ gateway: string;
195
+ }
196
+ export interface VSwitchCloudNetwork {
197
+ id: number;
198
+ ip: string;
199
+ mask: number;
200
+ gateway: string;
201
+ }
202
+ export interface StorageBox {
203
+ id: number;
204
+ login: string;
205
+ name: string;
206
+ product: string;
207
+ cancelled: boolean;
208
+ locked: boolean;
209
+ location: string;
210
+ linked_server: number | null;
211
+ paid_until: string;
212
+ disk_quota: number;
213
+ disk_usage: number;
214
+ disk_usage_data: number;
215
+ disk_usage_snapshots: number;
216
+ webdav: boolean;
217
+ samba: boolean;
218
+ ssh: boolean;
219
+ external_reachability: boolean;
220
+ zfs: boolean;
221
+ server: string;
222
+ host_system: string;
223
+ }
224
+ export interface StorageBoxSnapshot {
225
+ name: string;
226
+ timestamp: string;
227
+ size: number;
228
+ size_formatted: string;
229
+ }
230
+ export interface StorageBoxSnapshotPlan {
231
+ status: 'enabled' | 'disabled';
232
+ minute: number;
233
+ hour: number;
234
+ day_of_week: number;
235
+ day_of_month: number;
236
+ max_snapshots: number;
237
+ }
238
+ export interface StorageBoxSubaccount {
239
+ username: string;
240
+ accountid: string;
241
+ server: string;
242
+ homedirectory: string;
243
+ samba: boolean;
244
+ ssh: boolean;
245
+ external_reachability: boolean;
246
+ webdav: boolean;
247
+ readonly: boolean;
248
+ createtime: string;
249
+ comment: string;
250
+ }
251
+ export interface Traffic {
252
+ ip: string;
253
+ type: 'day' | 'month' | 'year';
254
+ from: string;
255
+ to: string;
256
+ data: TrafficData[];
257
+ }
258
+ export interface TrafficData {
259
+ in: number;
260
+ out: number;
261
+ sum: number;
262
+ date?: string;
263
+ }
264
+ export interface Wol {
265
+ server_ip: string;
266
+ server_ipv6_net: string;
267
+ server_number: number;
268
+ }
269
+ export interface ServerProduct {
270
+ id: string;
271
+ name: string;
272
+ description: string[];
273
+ traffic: string;
274
+ dist: string[];
275
+ arch: number[];
276
+ lang: string[];
277
+ location: string[];
278
+ prices: ProductPrice[];
279
+ orderable_addons: string[];
280
+ }
281
+ export interface ProductPrice {
282
+ location: string;
283
+ price: {
284
+ net: string;
285
+ gross: string;
286
+ };
287
+ price_setup: {
288
+ net: string;
289
+ gross: string;
290
+ };
291
+ price_vat: {
292
+ net: string;
293
+ gross: string;
294
+ };
295
+ price_setup_vat: {
296
+ net: string;
297
+ gross: string;
298
+ };
299
+ }
300
+ export interface ServerMarketProduct {
301
+ id: number;
302
+ name: string;
303
+ description: string[];
304
+ traffic: string;
305
+ dist: string[];
306
+ arch: number[];
307
+ lang: string[];
308
+ cpu: string;
309
+ cpu_benchmark: number;
310
+ memory_size: number;
311
+ hdd_size: number;
312
+ hdd_text: string;
313
+ hdd_count: number;
314
+ datacenter: string;
315
+ network_speed: string;
316
+ price: string;
317
+ price_setup: string;
318
+ fixed_price: boolean;
319
+ next_reduce: number;
320
+ next_reduce_date: string;
321
+ orderable_addons: string[];
322
+ }
323
+ export interface ServerTransaction {
324
+ id: string;
325
+ date: string;
326
+ status: 'ready' | 'in process' | 'cancelled';
327
+ server_number: number | null;
328
+ server_ip: string | null;
329
+ authorized_key: string[];
330
+ host_key: string[];
331
+ comment: string;
332
+ product: ServerTransactionProduct;
333
+ }
334
+ export interface ServerTransactionProduct {
335
+ id: string;
336
+ name: string;
337
+ description: string[];
338
+ traffic: string;
339
+ dist: string;
340
+ arch: number;
341
+ lang: string;
342
+ location: string;
343
+ }
344
+ export type ApiResponse<T> = Record<string, T>;
345
+ export interface ApiError {
346
+ error: {
347
+ status: number;
348
+ code: string;
349
+ message: string;
350
+ };
351
+ }
352
+ export {};
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ // ============================================================================
2
+ // Hetzner Robot API Types
3
+ // Based on: https://robot.hetzner.com/doc/webservice/en.html
4
+ // ============================================================================
5
+ export {};
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "hetzner-robot-cli",
3
+ "version": "1.0.0",
4
+ "description": "Feature-complete CLI and Node.js library for the Hetzner Robot API (dedicated servers)",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./client": {
14
+ "types": "./dist/client.d.ts",
15
+ "import": "./dist/client.js"
16
+ },
17
+ "./types": {
18
+ "types": "./dist/types.d.ts",
19
+ "import": "./dist/types.js"
20
+ }
21
+ },
22
+ "bin": {
23
+ "hetzner": "./dist/cli.js"
24
+ },
25
+ "files": [
26
+ "dist/**/*.js",
27
+ "dist/**/*.d.ts",
28
+ "!dist/**/*.test.js",
29
+ "!dist/**/*.test.d.ts",
30
+ "README.md",
31
+ "LICENSE"
32
+ ],
33
+ "scripts": {
34
+ "build": "tsc",
35
+ "dev": "tsc --watch",
36
+ "start": "node dist/cli.js",
37
+ "typecheck": "tsc --noEmit",
38
+ "lint": "eslint src/",
39
+ "lint:fix": "eslint src/ --fix",
40
+ "test": "vitest run",
41
+ "test:watch": "vitest",
42
+ "test:coverage": "vitest run --coverage",
43
+ "audit": "npm audit",
44
+ "check": "npm run typecheck && npm run lint && npm run test",
45
+ "prepublishOnly": "npm run check && npm run build"
46
+ },
47
+ "keywords": [
48
+ "hetzner",
49
+ "robot",
50
+ "api",
51
+ "cli",
52
+ "dedicated-server",
53
+ "server-management",
54
+ "hetzner-robot",
55
+ "datacenter",
56
+ "hosting",
57
+ "cloud",
58
+ "infrastructure"
59
+ ],
60
+ "author": "",
61
+ "license": "MIT",
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "git+https://github.com/ytspar/hetzner-robot-cli.git"
65
+ },
66
+ "bugs": {
67
+ "url": "https://github.com/ytspar/hetzner-robot-cli/issues"
68
+ },
69
+ "homepage": "https://github.com/ytspar/hetzner-robot-cli#readme",
70
+ "dependencies": {
71
+ "@inquirer/prompts": "^7.0.0",
72
+ "cli-table3": "^0.6.5",
73
+ "commander": "^14.0.2",
74
+ "dotenv": "^16.4.7"
75
+ },
76
+ "devDependencies": {
77
+ "@eslint/js": "^9.0.0",
78
+ "@types/node": "^22.0.0",
79
+ "@vitest/coverage-v8": "^2.1.0",
80
+ "eslint": "^9.0.0",
81
+ "eslint-plugin-security": "^3.0.0",
82
+ "typescript": "^5.7.0",
83
+ "typescript-eslint": "^8.0.0",
84
+ "vitest": "^2.1.0"
85
+ },
86
+ "engines": {
87
+ "node": ">=18.0.0"
88
+ }
89
+ }