@infrapilot-jur/sdk 0.0.0-stage → 0.2.5

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/dist/index.cjs ADDED
@@ -0,0 +1,787 @@
1
+ 'use strict';
2
+
3
+ var createClient = require('openapi-fetch');
4
+
5
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
+
7
+ var createClient__default = /*#__PURE__*/_interopDefault(createClient);
8
+
9
+ // src/http.ts
10
+
11
+ // src/errors.ts
12
+ var AuthErrorCodes = {
13
+ API_KEY_INVALID: "API_KEY_INVALID",
14
+ API_KEY_EXPIRED: "API_KEY_EXPIRED",
15
+ API_KEY_REVOKED: "API_KEY_REVOKED",
16
+ CLIENT_SUSPENDED: "CLIENT_SUSPENDED",
17
+ CLIENT_ACCESS_EXPIRED: "CLIENT_ACCESS_EXPIRED",
18
+ PERMISSION_DENIED: "PERMISSION_DENIED",
19
+ RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED",
20
+ INVALID_SCOPE: "INVALID_SCOPE",
21
+ INVALID_EXPIRATION: "INVALID_EXPIRATION",
22
+ CLIENT_NOT_FOUND: "CLIENT_NOT_FOUND",
23
+ API_KEY_NOT_FOUND: "API_KEY_NOT_FOUND",
24
+ AUTH_STORAGE_UNAVAILABLE: "AUTH_STORAGE_UNAVAILABLE"
25
+ };
26
+ var InfraPilotError = class extends Error {
27
+ constructor(message) {
28
+ super(message);
29
+ this.name = "InfraPilotError";
30
+ }
31
+ };
32
+ var InfraPilotHttpError = class extends InfraPilotError {
33
+ status;
34
+ statusText;
35
+ body;
36
+ operationId;
37
+ /** Machine-readable `code` from the error JSON body when present. */
38
+ code;
39
+ /**
40
+ * Parsed `Retry-After` header in seconds when the server returned 429.
41
+ * Callers decide whether to wait; the SDK does not auto-retry.
42
+ */
43
+ retryAfter;
44
+ constructor(input) {
45
+ const fromBody = input.body && typeof input.body === "object" && input.body !== null && "error" in input.body && typeof input.body.error === "string" ? input.body.error : void 0;
46
+ super(
47
+ input.message ?? fromBody ?? `HTTP ${input.status} ${input.statusText}${input.operationId ? ` (${input.operationId})` : ""}`
48
+ );
49
+ this.name = "InfraPilotHttpError";
50
+ this.status = input.status;
51
+ this.statusText = input.statusText;
52
+ this.body = input.body;
53
+ if (input.operationId !== void 0) this.operationId = input.operationId;
54
+ if (input.retryAfter !== void 0) this.retryAfter = input.retryAfter;
55
+ const bodyCode = input.body && typeof input.body === "object" && input.body !== null && "code" in input.body && typeof input.body.code === "string" ? input.body.code : void 0;
56
+ if (bodyCode !== void 0) this.code = bodyCode;
57
+ }
58
+ };
59
+ var InfraPilotTransportError = class extends InfraPilotError {
60
+ cause;
61
+ operationId;
62
+ timedOut;
63
+ aborted;
64
+ constructor(input) {
65
+ super(input.message);
66
+ this.name = "InfraPilotTransportError";
67
+ if (input.cause !== void 0) this.cause = input.cause;
68
+ if (input.operationId !== void 0) this.operationId = input.operationId;
69
+ this.timedOut = input.timedOut ?? false;
70
+ this.aborted = input.aborted ?? false;
71
+ }
72
+ };
73
+ function parseRetryAfter(header) {
74
+ if (!header) return void 0;
75
+ const asInt = Number.parseInt(header, 10);
76
+ if (Number.isFinite(asInt) && asInt >= 0) return asInt;
77
+ const when = Date.parse(header);
78
+ if (!Number.isNaN(when)) {
79
+ const seconds = Math.ceil((when - Date.now()) / 1e3);
80
+ return seconds > 0 ? seconds : 0;
81
+ }
82
+ return void 0;
83
+ }
84
+ function retryAfterFromResponse(response) {
85
+ return parseRetryAfter(response.headers.get("Retry-After"));
86
+ }
87
+
88
+ // src/request.ts
89
+ function buildInit(signal, headers, extra = {}) {
90
+ const init = { ...extra };
91
+ if (signal) init.signal = signal;
92
+ if (headers) init.headers = headers;
93
+ return init;
94
+ }
95
+
96
+ // src/http.ts
97
+ function composeAbortSignals(signals) {
98
+ const active = signals.filter((s) => Boolean(s));
99
+ if (active.length === 0) return void 0;
100
+ if (active.length === 1) return active[0];
101
+ if (typeof AbortSignal.any === "function") {
102
+ return AbortSignal.any(active);
103
+ }
104
+ const controller = new AbortController();
105
+ for (const signal of active) {
106
+ if (signal.aborted) {
107
+ controller.abort(signal.reason);
108
+ return controller.signal;
109
+ }
110
+ signal.addEventListener("abort", () => controller.abort(signal.reason), { once: true });
111
+ }
112
+ return controller.signal;
113
+ }
114
+ function createTimeout(timeoutMs) {
115
+ if (!timeoutMs || timeoutMs <= 0) return { cleanup: () => void 0 };
116
+ if (typeof AbortSignal.timeout === "function") {
117
+ return { signal: AbortSignal.timeout(timeoutMs), cleanup: () => void 0 };
118
+ }
119
+ const controller = new AbortController();
120
+ const id = setTimeout(
121
+ () => controller.abort(Object.assign(new Error("TimeoutError"), { name: "TimeoutError" })),
122
+ timeoutMs
123
+ );
124
+ return { signal: controller.signal, cleanup: () => clearTimeout(id) };
125
+ }
126
+ function createInfraFetch(options) {
127
+ const baseFetch = options.fetch ?? globalThis.fetch.bind(globalThis);
128
+ const redirect = options.redirect ?? "error";
129
+ const defaultCredentials = options.credentials ?? (options.authMode === "session" ? "same-origin" : "omit");
130
+ return async (input, init = {}) => {
131
+ const headers = new Headers(init.headers);
132
+ const wantBearer = options.authMode !== "session" || Boolean(options.apiKey || options.getAccessToken);
133
+ if (wantBearer) {
134
+ const token = options.getAccessToken ? await options.getAccessToken() : options.apiKey;
135
+ if (token) headers.set("Authorization", `Bearer ${token}`);
136
+ }
137
+ const csrf = options.getCsrfToken ? await options.getCsrfToken() : options.csrfToken;
138
+ if (csrf) headers.set(options.csrfHeaderName ?? "X-CSRF-Token", csrf);
139
+ if (options.headers) {
140
+ new Headers(options.headers).forEach((value, key) => {
141
+ if (!headers.has(key)) headers.set(key, value);
142
+ });
143
+ }
144
+ try {
145
+ return await baseFetch(input, {
146
+ ...init,
147
+ headers,
148
+ credentials: init.credentials ?? defaultCredentials,
149
+ redirect: init.redirect ?? redirect
150
+ });
151
+ } catch (cause) {
152
+ const name = cause instanceof Error ? cause.name : "";
153
+ const aborted = name === "AbortError";
154
+ const timedOut = name === "TimeoutError";
155
+ throw new InfraPilotTransportError({
156
+ message: timedOut ? "Request timed out" : aborted ? "Request aborted" : "Network request failed",
157
+ cause,
158
+ timedOut,
159
+ aborted
160
+ });
161
+ }
162
+ };
163
+ }
164
+ function createOpenAPIClient(options) {
165
+ const clientOptions = {
166
+ baseUrl: options.baseUrl.replace(/\/$/, ""),
167
+ fetch: createInfraFetch(options)
168
+ };
169
+ return createClient__default.default(clientOptions);
170
+ }
171
+ async function execute(operationId, defaultTimeoutMs, ctx, run) {
172
+ const timeout = createTimeout(ctx?.timeoutMs ?? defaultTimeoutMs);
173
+ const signal = composeAbortSignals([ctx?.signal, timeout.signal]);
174
+ try {
175
+ const result = await run(signal, ctx?.headers);
176
+ if (!result.response.ok || result.error !== void 0) {
177
+ let body = result.error ?? null;
178
+ if (body == null) {
179
+ const ct = result.response.headers.get("content-type") ?? "";
180
+ if (ct.includes("application/json")) {
181
+ try {
182
+ body = await result.response.clone().json();
183
+ } catch {
184
+ body = null;
185
+ }
186
+ } else {
187
+ try {
188
+ const text = await result.response.clone().text();
189
+ body = text === "" ? null : text;
190
+ } catch {
191
+ body = null;
192
+ }
193
+ }
194
+ }
195
+ const errorInput = {
196
+ status: result.response.status,
197
+ statusText: result.response.statusText,
198
+ body,
199
+ operationId
200
+ };
201
+ if (result.response.status === 429) {
202
+ const retryAfter = retryAfterFromResponse(result.response);
203
+ if (retryAfter !== void 0) errorInput.retryAfter = retryAfter;
204
+ }
205
+ throw new InfraPilotHttpError(errorInput);
206
+ }
207
+ return result.data;
208
+ } catch (err) {
209
+ if (err instanceof InfraPilotHttpError) throw err;
210
+ if (err instanceof InfraPilotTransportError) {
211
+ throw new InfraPilotTransportError({
212
+ message: err.message,
213
+ cause: err.cause,
214
+ operationId,
215
+ timedOut: err.timedOut || Boolean(timeout.signal?.aborted),
216
+ aborted: err.aborted
217
+ });
218
+ }
219
+ throw new InfraPilotTransportError({
220
+ message: err instanceof Error ? err.message : "Request failed",
221
+ cause: err,
222
+ operationId
223
+ });
224
+ } finally {
225
+ timeout.cleanup();
226
+ }
227
+ }
228
+
229
+ // src/resources/apikeys.ts
230
+ var ApiKeysResource = class {
231
+ constructor(client, timeoutMs) {
232
+ this.client = client;
233
+ this.timeoutMs = timeoutMs;
234
+ }
235
+ client;
236
+ timeoutMs;
237
+ list(params, ctx) {
238
+ const query = {};
239
+ if (params?.client_id !== void 0) query.client_id = params.client_id;
240
+ if (params?.status !== void 0) query.status = params.status;
241
+ if (params?.limit !== void 0) query.limit = params.limit;
242
+ if (params?.offset !== void 0) query.offset = params.offset;
243
+ return execute(
244
+ "listAPIKeys",
245
+ this.timeoutMs,
246
+ ctx,
247
+ (signal, headers) => this.client.GET(
248
+ "/api/v1/admin/keys",
249
+ buildInit(signal, headers, { params: { query } })
250
+ )
251
+ );
252
+ }
253
+ create(body, ctx) {
254
+ return execute(
255
+ "createAPIKey",
256
+ this.timeoutMs,
257
+ ctx,
258
+ (signal, headers) => this.client.POST(
259
+ "/api/v1/admin/keys",
260
+ buildInit(signal, headers, { body })
261
+ )
262
+ );
263
+ }
264
+ get(id, ctx) {
265
+ return execute(
266
+ "getAPIKey",
267
+ this.timeoutMs,
268
+ ctx,
269
+ (signal, headers) => this.client.GET(
270
+ "/api/v1/admin/keys/{id}",
271
+ buildInit(signal, headers, { params: { path: { id } } })
272
+ )
273
+ );
274
+ }
275
+ update(id, body, ctx) {
276
+ return execute(
277
+ "updateAPIKey",
278
+ this.timeoutMs,
279
+ ctx,
280
+ (signal, headers) => this.client.PATCH(
281
+ "/api/v1/admin/keys/{id}",
282
+ buildInit(signal, headers, { params: { path: { id } }, body })
283
+ )
284
+ );
285
+ }
286
+ revoke(id, ctx) {
287
+ return execute(
288
+ "revokeAPIKey",
289
+ this.timeoutMs,
290
+ ctx,
291
+ (signal, headers) => this.client.POST(
292
+ "/api/v1/admin/keys/{id}/revoke",
293
+ buildInit(signal, headers, { params: { path: { id } } })
294
+ )
295
+ );
296
+ }
297
+ rotate(id, ctx) {
298
+ return execute(
299
+ "rotateAPIKey",
300
+ this.timeoutMs,
301
+ ctx,
302
+ (signal, headers) => this.client.POST(
303
+ "/api/v1/admin/keys/{id}/rotate",
304
+ buildInit(signal, headers, { params: { path: { id } } })
305
+ )
306
+ );
307
+ }
308
+ };
309
+
310
+ // src/resources/auth.ts
311
+ var AuthResource = class {
312
+ constructor(client, timeoutMs) {
313
+ this.client = client;
314
+ this.timeoutMs = timeoutMs;
315
+ }
316
+ client;
317
+ timeoutMs;
318
+ /**
319
+ * Exchange an API key for an HttpOnly session cookie + CSRF token.
320
+ * Keep `csrf_token` in memory only. Never persist the API key in localStorage.
321
+ */
322
+ login(body, ctx) {
323
+ return execute(
324
+ "loginAuth",
325
+ this.timeoutMs,
326
+ ctx,
327
+ (signal, headers) => this.client.POST("/api/v1/auth/login", {
328
+ ...buildInit(signal, headers),
329
+ body
330
+ })
331
+ );
332
+ }
333
+ /** End the current web session (requires CSRF when using cookie auth). */
334
+ logout(ctx) {
335
+ return execute(
336
+ "logoutAuth",
337
+ this.timeoutMs,
338
+ ctx,
339
+ (signal, headers) => this.client.POST("/api/v1/auth/logout", buildInit(signal, headers))
340
+ );
341
+ }
342
+ me(ctx) {
343
+ return execute(
344
+ "getAuthMe",
345
+ this.timeoutMs,
346
+ ctx,
347
+ (signal, headers) => this.client.GET("/api/v1/auth/me", buildInit(signal, headers))
348
+ );
349
+ }
350
+ };
351
+
352
+ // src/resources/backups.ts
353
+ var BackupsResource = class {
354
+ constructor(client, timeoutMs) {
355
+ this.client = client;
356
+ this.timeoutMs = timeoutMs;
357
+ }
358
+ client;
359
+ timeoutMs;
360
+ list(ctx) {
361
+ return execute(
362
+ "listBackups",
363
+ this.timeoutMs,
364
+ ctx,
365
+ (signal, headers) => this.client.GET("/api/v1/backups", buildInit(signal, headers))
366
+ );
367
+ }
368
+ restore(name, ctx) {
369
+ return execute(
370
+ "restoreBackup",
371
+ this.timeoutMs,
372
+ ctx,
373
+ (signal, headers) => this.client.POST(
374
+ "/api/v1/backups/{name}/restore",
375
+ buildInit(signal, headers, { params: { path: { name } } })
376
+ )
377
+ );
378
+ }
379
+ };
380
+
381
+ // src/resources/caddy.ts
382
+ var CaddyResource = class {
383
+ constructor(client, timeoutMs) {
384
+ this.client = client;
385
+ this.timeoutMs = timeoutMs;
386
+ }
387
+ client;
388
+ timeoutMs;
389
+ getStatus(ctx) {
390
+ return execute(
391
+ "getCaddyStatus",
392
+ this.timeoutMs,
393
+ ctx,
394
+ (signal, headers) => this.client.GET("/api/v1/caddy/status", buildInit(signal, headers))
395
+ );
396
+ }
397
+ storage(ctx) {
398
+ return execute(
399
+ "getCaddyStorage",
400
+ this.timeoutMs,
401
+ ctx,
402
+ (signal, headers) => this.client.GET("/api/v1/caddy/storage", buildInit(signal, headers))
403
+ );
404
+ }
405
+ getLogs(params, ctx) {
406
+ const query = {};
407
+ if (params?.limit !== void 0) query.limit = params.limit;
408
+ if (params?.cursor !== void 0) query.cursor = params.cursor;
409
+ return execute(
410
+ "getCaddyLogs",
411
+ this.timeoutMs,
412
+ ctx,
413
+ (signal, headers) => this.client.GET(
414
+ "/api/v1/caddy/logs",
415
+ buildInit(signal, headers, { params: { query } })
416
+ )
417
+ );
418
+ }
419
+ };
420
+
421
+ // src/resources/clients.ts
422
+ var ClientsResource = class {
423
+ constructor(client, timeoutMs) {
424
+ this.client = client;
425
+ this.timeoutMs = timeoutMs;
426
+ }
427
+ client;
428
+ timeoutMs;
429
+ list(params, ctx) {
430
+ const query = {};
431
+ if (params?.status !== void 0) query.status = params.status;
432
+ if (params?.limit !== void 0) query.limit = params.limit;
433
+ if (params?.offset !== void 0) query.offset = params.offset;
434
+ return execute(
435
+ "listClients",
436
+ this.timeoutMs,
437
+ ctx,
438
+ (signal, headers) => this.client.GET(
439
+ "/api/v1/admin/clients",
440
+ buildInit(signal, headers, { params: { query } })
441
+ )
442
+ );
443
+ }
444
+ create(body, ctx) {
445
+ return execute(
446
+ "createClient",
447
+ this.timeoutMs,
448
+ ctx,
449
+ (signal, headers) => this.client.POST(
450
+ "/api/v1/admin/clients",
451
+ buildInit(signal, headers, { body })
452
+ )
453
+ );
454
+ }
455
+ get(id, ctx) {
456
+ return execute(
457
+ "getClient",
458
+ this.timeoutMs,
459
+ ctx,
460
+ (signal, headers) => this.client.GET(
461
+ "/api/v1/admin/clients/{id}",
462
+ buildInit(signal, headers, { params: { path: { id } } })
463
+ )
464
+ );
465
+ }
466
+ update(id, body, ctx) {
467
+ return execute(
468
+ "updateClient",
469
+ this.timeoutMs,
470
+ ctx,
471
+ (signal, headers) => this.client.PATCH(
472
+ "/api/v1/admin/clients/{id}",
473
+ buildInit(signal, headers, { params: { path: { id } }, body })
474
+ )
475
+ );
476
+ }
477
+ suspend(id, ctx) {
478
+ return execute(
479
+ "suspendClient",
480
+ this.timeoutMs,
481
+ ctx,
482
+ (signal, headers) => this.client.POST(
483
+ "/api/v1/admin/clients/{id}/suspend",
484
+ buildInit(signal, headers, { params: { path: { id } } })
485
+ )
486
+ );
487
+ }
488
+ activate(id, ctx) {
489
+ return execute(
490
+ "activateClient",
491
+ this.timeoutMs,
492
+ ctx,
493
+ (signal, headers) => this.client.POST(
494
+ "/api/v1/admin/clients/{id}/activate",
495
+ buildInit(signal, headers, { params: { path: { id } } })
496
+ )
497
+ );
498
+ }
499
+ };
500
+
501
+ // src/resources/domains.ts
502
+ var DomainsResource = class {
503
+ constructor(client, timeoutMs) {
504
+ this.client = client;
505
+ this.timeoutMs = timeoutMs;
506
+ }
507
+ client;
508
+ timeoutMs;
509
+ list(ctx) {
510
+ return execute(
511
+ "listDomains",
512
+ this.timeoutMs,
513
+ ctx,
514
+ (signal, headers) => this.client.GET("/api/v1/domains", buildInit(signal, headers))
515
+ );
516
+ }
517
+ create(body, ctx) {
518
+ return execute(
519
+ "createDomain",
520
+ this.timeoutMs,
521
+ ctx,
522
+ (signal, headers) => this.client.POST("/api/v1/domains", buildInit(signal, headers, { body }))
523
+ );
524
+ }
525
+ get(hostname, ctx) {
526
+ return execute(
527
+ "getDomain",
528
+ this.timeoutMs,
529
+ ctx,
530
+ (signal, headers) => this.client.GET(
531
+ "/api/v1/domains/{hostname}",
532
+ buildInit(signal, headers, { params: { path: { hostname } } })
533
+ )
534
+ );
535
+ }
536
+ update(hostname, body, ctx) {
537
+ return execute(
538
+ "updateDomain",
539
+ this.timeoutMs,
540
+ ctx,
541
+ (signal, headers) => this.client.PATCH(
542
+ "/api/v1/domains/{hostname}",
543
+ buildInit(signal, headers, { params: { path: { hostname } }, body })
544
+ )
545
+ );
546
+ }
547
+ delete(hostname, ctx) {
548
+ return execute(
549
+ "deleteDomain",
550
+ this.timeoutMs,
551
+ ctx,
552
+ (signal, headers) => this.client.DELETE(
553
+ "/api/v1/domains/{hostname}",
554
+ buildInit(signal, headers, { params: { path: { hostname } } })
555
+ )
556
+ );
557
+ }
558
+ getConfig(hostname, ctx) {
559
+ return execute(
560
+ "getDomainConfig",
561
+ this.timeoutMs,
562
+ ctx,
563
+ (signal, headers) => this.client.GET(
564
+ "/api/v1/domains/{hostname}/config",
565
+ buildInit(signal, headers, { params: { path: { hostname } } })
566
+ )
567
+ );
568
+ }
569
+ getAvailability(hostname, ctx) {
570
+ return execute(
571
+ "getDomainAvailability",
572
+ this.timeoutMs,
573
+ ctx,
574
+ (signal, headers) => this.client.GET(
575
+ "/api/v1/domains/{hostname}/availability",
576
+ buildInit(signal, headers, { params: { path: { hostname } } })
577
+ )
578
+ );
579
+ }
580
+ getHealth(hostname, ctx) {
581
+ return execute(
582
+ "getDomainHealth",
583
+ this.timeoutMs,
584
+ ctx,
585
+ (signal, headers) => this.client.GET(
586
+ "/api/v1/domains/{hostname}/health",
587
+ buildInit(signal, headers, { params: { path: { hostname } } })
588
+ )
589
+ );
590
+ }
591
+ preview(body, ctx) {
592
+ return execute(
593
+ "previewDomainChange",
594
+ this.timeoutMs,
595
+ ctx,
596
+ (signal, headers) => this.client.POST(
597
+ "/api/v1/domains/preview",
598
+ buildInit(signal, headers, { body })
599
+ )
600
+ );
601
+ }
602
+ backups = {
603
+ list: (hostname, ctx) => execute(
604
+ "listDomainBackups",
605
+ this.timeoutMs,
606
+ ctx,
607
+ (signal, headers) => this.client.GET(
608
+ "/api/v1/domains/{hostname}/backups",
609
+ buildInit(signal, headers, { params: { path: { hostname } } })
610
+ )
611
+ ),
612
+ restore: (hostname, backupId, ctx) => execute(
613
+ "restoreDomainBackup",
614
+ this.timeoutMs,
615
+ ctx,
616
+ (signal, headers) => this.client.POST(
617
+ "/api/v1/domains/{hostname}/backups/{backup_id}/restore",
618
+ buildInit(signal, headers, {
619
+ params: { path: { hostname, backup_id: backupId } }
620
+ })
621
+ )
622
+ )
623
+ };
624
+ };
625
+
626
+ // src/resources/node.ts
627
+ var NodeResource = class {
628
+ constructor(client, timeoutMs) {
629
+ this.client = client;
630
+ this.timeoutMs = timeoutMs;
631
+ }
632
+ client;
633
+ timeoutMs;
634
+ get(ctx) {
635
+ return execute(
636
+ "getNode",
637
+ this.timeoutMs,
638
+ ctx,
639
+ (signal, headers) => this.client.GET("/api/v1/node", buildInit(signal, headers))
640
+ );
641
+ }
642
+ update(body, ctx) {
643
+ return execute(
644
+ "updateNode",
645
+ this.timeoutMs,
646
+ ctx,
647
+ (signal, headers) => this.client.PATCH("/api/v1/node", buildInit(signal, headers, { body }))
648
+ );
649
+ }
650
+ capabilities(ctx) {
651
+ return execute(
652
+ "getNodeCapabilities",
653
+ this.timeoutMs,
654
+ ctx,
655
+ (signal, headers) => this.client.GET("/api/v1/node/capabilities", buildInit(signal, headers))
656
+ );
657
+ }
658
+ };
659
+
660
+ // src/resources/operations.ts
661
+ var OperationsResource = class {
662
+ constructor(client, timeoutMs) {
663
+ this.client = client;
664
+ this.timeoutMs = timeoutMs;
665
+ }
666
+ client;
667
+ timeoutMs;
668
+ list(params, ctx) {
669
+ const query = {};
670
+ if (params?.limit !== void 0) query.limit = params.limit;
671
+ if (params?.offset !== void 0) query.offset = params.offset;
672
+ return execute(
673
+ "listOperations",
674
+ this.timeoutMs,
675
+ ctx,
676
+ (signal, headers) => this.client.GET(
677
+ "/api/v1/operations",
678
+ buildInit(signal, headers, { params: { query } })
679
+ )
680
+ );
681
+ }
682
+ };
683
+
684
+ // src/resources/system.ts
685
+ var SystemResource = class {
686
+ constructor(client, timeoutMs) {
687
+ this.client = client;
688
+ this.timeoutMs = timeoutMs;
689
+ }
690
+ client;
691
+ timeoutMs;
692
+ getHealthz(ctx) {
693
+ return execute(
694
+ "getHealthz",
695
+ this.timeoutMs,
696
+ ctx,
697
+ (signal, headers) => this.client.GET("/healthz", buildInit(signal, headers))
698
+ );
699
+ }
700
+ getSystemHealth(ctx) {
701
+ return execute(
702
+ "getSystemHealth",
703
+ this.timeoutMs,
704
+ ctx,
705
+ (signal, headers) => this.client.GET("/api/v1/system/health", buildInit(signal, headers))
706
+ );
707
+ }
708
+ getOpenAPISpec(ctx) {
709
+ return execute(
710
+ "getOpenAPISpec",
711
+ this.timeoutMs,
712
+ ctx,
713
+ (signal, headers) => this.client.GET("/openapi.yaml", buildInit(signal, headers, { parseAs: "text" }))
714
+ );
715
+ }
716
+ getSwaggerUI(ctx) {
717
+ return execute(
718
+ "getSwaggerUI",
719
+ this.timeoutMs,
720
+ ctx,
721
+ (signal, headers) => this.client.GET("/docs", buildInit(signal, headers, { parseAs: "text" }))
722
+ );
723
+ }
724
+ getSwaggerUISlash(ctx) {
725
+ return execute(
726
+ "getSwaggerUISlash",
727
+ this.timeoutMs,
728
+ ctx,
729
+ (signal, headers) => this.client.GET("/docs/", buildInit(signal, headers, { parseAs: "text" }))
730
+ );
731
+ }
732
+ };
733
+
734
+ // src/client.ts
735
+ var InfraPilot = class _InfraPilot {
736
+ domains;
737
+ caddy;
738
+ backups;
739
+ operations;
740
+ system;
741
+ clients;
742
+ apiKeys;
743
+ auth;
744
+ node;
745
+ client;
746
+ options;
747
+ constructor(options) {
748
+ if (!options.baseUrl) {
749
+ throw new Error("baseUrl is required");
750
+ }
751
+ this.options = options;
752
+ this.client = createOpenAPIClient(options);
753
+ const timeoutMs = options.timeoutMs;
754
+ this.domains = new DomainsResource(this.client, timeoutMs);
755
+ this.caddy = new CaddyResource(this.client, timeoutMs);
756
+ this.backups = new BackupsResource(this.client, timeoutMs);
757
+ this.operations = new OperationsResource(this.client, timeoutMs);
758
+ this.system = new SystemResource(this.client, timeoutMs);
759
+ this.clients = new ClientsResource(this.client, timeoutMs);
760
+ this.apiKeys = new ApiKeysResource(this.client, timeoutMs);
761
+ this.auth = new AuthResource(this.client, timeoutMs);
762
+ this.node = new NodeResource(this.client, timeoutMs);
763
+ }
764
+ get baseUrl() {
765
+ return this.options.baseUrl.replace(/\/$/, "");
766
+ }
767
+ /** Create an independent client instance with overridden options. */
768
+ withOptions(patch) {
769
+ return new _InfraPilot({ ...this.options, ...patch });
770
+ }
771
+ };
772
+
773
+ // src/generated/meta.ts
774
+ var openapiSourcePath = "../../services/domains/docs/openapi.yaml";
775
+ var openapiSha256 = "7a482ed2a43126d033f41366cc5718fc499257eeb21faa063338eb5f4fe5cbfa";
776
+ var generatedAt = "2026-12-01T17:07:43.859Z";
777
+
778
+ exports.AuthErrorCodes = AuthErrorCodes;
779
+ exports.InfraPilot = InfraPilot;
780
+ exports.InfraPilotError = InfraPilotError;
781
+ exports.InfraPilotHttpError = InfraPilotHttpError;
782
+ exports.InfraPilotTransportError = InfraPilotTransportError;
783
+ exports.generatedAt = generatedAt;
784
+ exports.openapiSha256 = openapiSha256;
785
+ exports.openapiSourcePath = openapiSourcePath;
786
+ //# sourceMappingURL=index.cjs.map
787
+ //# sourceMappingURL=index.cjs.map