@homeflare/distilled-proxmox 0.3.1 → 0.3.3

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.
Files changed (39) hide show
  1. package/README.md +27 -5
  2. package/dist/config-not-found.test.js +29 -0
  3. package/dist/config-not-found.test.js.map +1 -1
  4. package/dist/lxc-config-errors.test.d.ts +2 -0
  5. package/dist/lxc-config-errors.test.d.ts.map +1 -0
  6. package/dist/lxc-config-errors.test.js +48 -0
  7. package/dist/lxc-config-errors.test.js.map +1 -0
  8. package/dist/network-changes.test.d.ts +2 -0
  9. package/dist/network-changes.test.d.ts.map +1 -0
  10. package/dist/network-changes.test.js +42 -0
  11. package/dist/network-changes.test.js.map +1 -0
  12. package/dist/protocol.d.ts.map +1 -1
  13. package/dist/protocol.js +24 -9
  14. package/dist/protocol.js.map +1 -1
  15. package/dist/qemu-config-absence.test.d.ts +2 -0
  16. package/dist/qemu-config-absence.test.d.ts.map +1 -0
  17. package/dist/qemu-config-absence.test.js +41 -0
  18. package/dist/qemu-config-absence.test.js.map +1 -0
  19. package/dist/replication-firewall-errors.test.d.ts +2 -0
  20. package/dist/replication-firewall-errors.test.d.ts.map +1 -0
  21. package/dist/replication-firewall-errors.test.js +76 -0
  22. package/dist/replication-firewall-errors.test.js.map +1 -0
  23. package/dist/services/cluster.d.ts +25 -5
  24. package/dist/services/cluster.d.ts.map +1 -1
  25. package/dist/services/cluster.js +24 -5
  26. package/dist/services/cluster.js.map +1 -1
  27. package/dist/services/nodes.d.ts +44 -8
  28. package/dist/services/nodes.d.ts.map +1 -1
  29. package/dist/services/nodes.js +49 -8
  30. package/dist/services/nodes.js.map +1 -1
  31. package/package.json +1 -1
  32. package/src/config-not-found.test.ts +49 -0
  33. package/src/lxc-config-errors.test.ts +100 -0
  34. package/src/network-changes.test.ts +60 -0
  35. package/src/protocol.ts +26 -9
  36. package/src/qemu-config-absence.test.ts +75 -0
  37. package/src/replication-firewall-errors.test.ts +126 -0
  38. package/src/services/cluster.ts +51 -10
  39. package/src/services/nodes.ts +81 -16
@@ -50,6 +50,52 @@ export class ClusterNodeUnreachable
50
50
  [{ status: 595 }],
51
51
  ) {}
52
52
 
53
+ /** The requested container config is absent on this node. VM IDs are cluster-wide: callers must still check whether another node or QEMU guest holds the ID before creating. Also raised by PUT (update_vm) and DELETE (destroy_vm), which both call the same load_config first. This GET requires VM.Audit on /vms/{vmid}; retain its credential for any permission-filtered cluster index read. */
54
+ export class LxcConfigNotFound
55
+ extends /*@__PURE__*/ T.applyErrorMatchers(
56
+ /*@__PURE__*/ S.TaggedError<LxcConfigNotFound>()("LxcConfigNotFound", {
57
+ message: S.String,
58
+ }).pipe(C.withBadRequestError),
59
+ [
60
+ {
61
+ status: 500,
62
+ message: {
63
+ matches:
64
+ "^Configuration file 'nodes/[^/']+/lxc/[0-9]+\\.conf' does not exist\\n?$",
65
+ },
66
+ },
67
+ ],
68
+ ) {}
69
+
70
+ /** qemu-server PVE/API2/Qemu.pm vm_config GET and destroy_vm both call QemuConfig->load_config. pve-guest-common AbstractConfig.pm load_config dies when the cfs file is missing: Configuration file '$cfspath' does not exist. QemuConfig's path is nodes/$node/qemu-server/$vmid.conf, HTTP 500. A missing file on this node is not a free cluster-wide vmid. */
71
+ export class QemuConfigNotFound
72
+ extends /*@__PURE__*/ T.applyErrorMatchers(
73
+ /*@__PURE__*/ S.TaggedError<QemuConfigNotFound>()("QemuConfigNotFound", {
74
+ message: S.String,
75
+ }).pipe(C.withBadRequestError),
76
+ [
77
+ {
78
+ status: 500,
79
+ message: {
80
+ matches:
81
+ "^Configuration file 'nodes/[^/']+/qemu-server/[0-9]+\\.conf' does not exist\\n?$",
82
+ },
83
+ },
84
+ ],
85
+ ) {}
86
+
87
+ /** pve-manager 9.2.11, PVE/API2/Network.pm. GET (network_config) and PUT (update_network) both raise HTTP 400 with exactly errors.iface = interface does not exist -- verified against the live n2 source on 2026-09-25. DELETE (delete_network) raises it too but is left untyped: no generated deleteNodeNetwork2 caller exists yet. Only the exact sole-field detail is normalized for operation matching; all other validation errors remain ParameterVerificationFailed. Attached to GET and PUT. */
88
+ export class NetworkInterfaceNotFound
89
+ extends /*@__PURE__*/ T.applyErrorMatchers(
90
+ /*@__PURE__*/ S.TaggedError<NetworkInterfaceNotFound>()(
91
+ "NetworkInterfaceNotFound",
92
+ {
93
+ message: S.String,
94
+ },
95
+ ).pipe(C.withBadRequestError),
96
+ [{ status: 400, message: { matches: "^interface does not exist$" } }],
97
+ ) {}
98
+
53
99
  export interface CloneNodesLxcRequest {
54
100
  node: string;
55
101
  vmid: string;
@@ -12545,9 +12591,28 @@ export const ListNodeNetworkResponseBodyList = /*@__PURE__*/ S.Array(
12545
12591
  ListNodeNetworkResponseBodyItem,
12546
12592
  ) as any as S.Schema<ListNodeNetworkResponseBodyList>;
12547
12593
 
12548
- export type ListNodeNetworkResponse = ListNodeNetworkResponseBodyList;
12594
+ /** Present only when PVE staged an interfaces diff. The string can contain secrets. */
12595
+ export interface ListNodeNetworkPendingResponse {
12596
+ data: ListNodeNetworkResponseBodyList;
12597
+ changes: string;
12598
+ }
12599
+ export const ListNodeNetworkPendingResponse = /*@__PURE__*/ S.suspend(() =>
12600
+ S.Struct({
12601
+ data: ListNodeNetworkResponseBodyList,
12602
+ changes: S.String,
12603
+ }),
12604
+ ).annotate({
12605
+ identifier: "ListNodeNetworkPendingResponse",
12606
+ }) as any as S.Schema<ListNodeNetworkPendingResponse>;
12607
+
12608
+ export type ListNodeNetworkResponse =
12609
+ | ListNodeNetworkResponseBodyList
12610
+ | ListNodeNetworkPendingResponse;
12549
12611
  export const ListNodeNetworkResponse = /*@__PURE__*/ S.suspend(() =>
12550
- ListNodeNetworkResponseBodyList.pipe(T.RawResponseRoot()),
12612
+ S.Union([
12613
+ ListNodeNetworkResponseBodyList.pipe(T.RawResponseRoot()),
12614
+ ListNodeNetworkPendingResponse,
12615
+ ]),
12551
12616
  ).annotate({
12552
12617
  identifier: "ListNodeNetworkResponse",
12553
12618
  }) as any as S.Schema<ListNodeNetworkResponse>;
@@ -21398,7 +21463,7 @@ export const deleteNodeFirewallRule: API.OperationMethod<
21398
21463
  retry: Retry.Retry,
21399
21464
  }));
21400
21465
 
21401
- export type DeleteNodeLxcError = ProxmoxOpError;
21466
+ export type DeleteNodeLxcError = LxcConfigNotFound | ProxmoxOpError;
21402
21467
  /** Destroy the container (also delete all uses files). (root-privileged endpoint) */
21403
21468
  export const deleteNodeLxc: API.OperationMethod<
21404
21469
  DeleteNodeLxcRequest,
@@ -21408,7 +21473,7 @@ export const deleteNodeLxc: API.OperationMethod<
21408
21473
  > = /*@__PURE__*/ API.make(() => ({
21409
21474
  input: DeleteNodeLxcRequest,
21410
21475
  output: DeleteNodeLxcResponse,
21411
- errors: [],
21476
+ errors: [LxcConfigNotFound],
21412
21477
  protocol: ProxmoxProtocol,
21413
21478
  retry: Retry.Retry,
21414
21479
  }));
@@ -21518,7 +21583,7 @@ export const deleteNodeNetwork2: API.OperationMethod<
21518
21583
  retry: Retry.Retry,
21519
21584
  }));
21520
21585
 
21521
- export type DeleteNodeQemuError = ProxmoxOpError;
21586
+ export type DeleteNodeQemuError = QemuConfigNotFound | ProxmoxOpError;
21522
21587
  /** Destroy the VM and all used/owned volumes. Removes any VM specific permissions and firewall rules (root-privileged endpoint) */
21523
21588
  export const deleteNodeQemu: API.OperationMethod<
21524
21589
  DeleteNodeQemuRequest,
@@ -21528,7 +21593,7 @@ export const deleteNodeQemu: API.OperationMethod<
21528
21593
  > = /*@__PURE__*/ API.make(() => ({
21529
21594
  input: DeleteNodeQemuRequest,
21530
21595
  output: DeleteNodeQemuResponse,
21531
- errors: [],
21596
+ errors: [QemuConfigNotFound],
21532
21597
  protocol: ProxmoxProtocol,
21533
21598
  retry: Retry.Retry,
21534
21599
  }));
@@ -22088,7 +22153,7 @@ export const getNodeLxc: API.OperationMethod<
22088
22153
  retry: Retry.Retry,
22089
22154
  }));
22090
22155
 
22091
- export type GetNodeLxcConfigError = ProxmoxOpError;
22156
+ export type GetNodeLxcConfigError = LxcConfigNotFound | ProxmoxOpError;
22092
22157
  /** Get container configuration. */
22093
22158
  export const getNodeLxcConfig: API.OperationMethod<
22094
22159
  GetNodeLxcConfigRequest,
@@ -22098,7 +22163,7 @@ export const getNodeLxcConfig: API.OperationMethod<
22098
22163
  > = /*@__PURE__*/ API.make(() => ({
22099
22164
  input: GetNodeLxcConfigRequest,
22100
22165
  output: GetNodeLxcConfigResponse,
22101
- errors: [],
22166
+ errors: [LxcConfigNotFound],
22102
22167
  protocol: ProxmoxProtocol,
22103
22168
  retry: Retry.Retry,
22104
22169
  }));
@@ -22297,7 +22362,7 @@ export const getNodeLxcVncwebsocket: API.OperationMethod<
22297
22362
  retry: Retry.Retry,
22298
22363
  }));
22299
22364
 
22300
- export type GetNodeNetworkError = ProxmoxOpError;
22365
+ export type GetNodeNetworkError = NetworkInterfaceNotFound | ProxmoxOpError;
22301
22366
  /** Read network device configuration */
22302
22367
  export const getNodeNetwork: API.OperationMethod<
22303
22368
  GetNodeNetworkRequest,
@@ -22307,7 +22372,7 @@ export const getNodeNetwork: API.OperationMethod<
22307
22372
  > = /*@__PURE__*/ API.make(() => ({
22308
22373
  input: GetNodeNetworkRequest,
22309
22374
  output: GetNodeNetworkResponse,
22310
- errors: [],
22375
+ errors: [NetworkInterfaceNotFound],
22311
22376
  protocol: ProxmoxProtocol,
22312
22377
  retry: Retry.Retry,
22313
22378
  }));
@@ -22537,7 +22602,7 @@ export const getNodeQemuCloudinitDump: API.OperationMethod<
22537
22602
  retry: Retry.Retry,
22538
22603
  }));
22539
22604
 
22540
- export type GetNodeQemuConfigError = ProxmoxOpError;
22605
+ export type GetNodeQemuConfigError = QemuConfigNotFound | ProxmoxOpError;
22541
22606
  /** Get the virtual machine configuration with pending configuration changes applied. Set the 'current' parameter to get the current configuration instead. */
22542
22607
  export const getNodeQemuConfig: API.OperationMethod<
22543
22608
  GetNodeQemuConfigRequest,
@@ -22547,7 +22612,7 @@ export const getNodeQemuConfig: API.OperationMethod<
22547
22612
  > = /*@__PURE__*/ API.make(() => ({
22548
22613
  input: GetNodeQemuConfigRequest,
22549
22614
  output: GetNodeQemuConfigResponse,
22550
- errors: [],
22615
+ errors: [QemuConfigNotFound],
22551
22616
  protocol: ProxmoxProtocol,
22552
22617
  retry: Retry.Retry,
22553
22618
  }));
@@ -24738,7 +24803,7 @@ export const putNodeFirewallRule: API.OperationMethod<
24738
24803
  retry: Retry.Retry,
24739
24804
  }));
24740
24805
 
24741
- export type PutNodeLxcConfigError = ProxmoxOpError;
24806
+ export type PutNodeLxcConfigError = LxcConfigNotFound | ProxmoxOpError;
24742
24807
  /** Set container options. (root-privileged endpoint) */
24743
24808
  export const putNodeLxcConfig: API.OperationMethod<
24744
24809
  PutNodeLxcConfigRequest,
@@ -24748,7 +24813,7 @@ export const putNodeLxcConfig: API.OperationMethod<
24748
24813
  > = /*@__PURE__*/ API.make(() => ({
24749
24814
  input: PutNodeLxcConfigRequest,
24750
24815
  output: PutNodeLxcConfigResponse,
24751
- errors: [],
24816
+ errors: [LxcConfigNotFound],
24752
24817
  protocol: ProxmoxProtocol,
24753
24818
  retry: Retry.Retry,
24754
24819
  }));
@@ -24858,7 +24923,7 @@ export const putNodeNetwork: API.OperationMethod<
24858
24923
  retry: Retry.Retry,
24859
24924
  }));
24860
24925
 
24861
- export type PutNodeNetwork2Error = ProxmoxOpError;
24926
+ export type PutNodeNetwork2Error = NetworkInterfaceNotFound | ProxmoxOpError;
24862
24927
  /** Update network device configuration (root-privileged endpoint) */
24863
24928
  export const putNodeNetwork2: API.OperationMethod<
24864
24929
  PutNodeNetwork2Request,
@@ -24868,7 +24933,7 @@ export const putNodeNetwork2: API.OperationMethod<
24868
24933
  > = /*@__PURE__*/ API.make(() => ({
24869
24934
  input: PutNodeNetwork2Request,
24870
24935
  output: PutNodeNetwork2Response,
24871
- errors: [],
24936
+ errors: [NetworkInterfaceNotFound],
24872
24937
  protocol: ProxmoxProtocol,
24873
24938
  retry: Retry.Retry,
24874
24939
  }));