@homeflare/distilled-proxmox-backup 0.2.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.
- package/LICENSE +201 -0
- package/README.md +102 -0
- package/dist/credentials.d.ts +50 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +105 -0
- package/dist/credentials.js.map +1 -0
- package/dist/errors.d.ts +100 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +73 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.d.ts +19 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +158 -0
- package/dist/protocol.js.map +1 -0
- package/dist/protocol.test.d.ts +2 -0
- package/dist/protocol.test.d.ts.map +1 -0
- package/dist/protocol.test.js +75 -0
- package/dist/protocol.test.js.map +1 -0
- package/dist/retry.d.ts +53 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +46 -0
- package/dist/retry.js.map +1 -0
- package/dist/services/access.d.ts +587 -0
- package/dist/services/access.d.ts.map +1 -0
- package/dist/services/access.js +787 -0
- package/dist/services/access.js.map +1 -0
- package/dist/services/admin.d.ts +1110 -0
- package/dist/services/admin.d.ts.map +1 -0
- package/dist/services/admin.js +1428 -0
- package/dist/services/admin.js.map +1 -0
- package/dist/services/backup.d.ts +224 -0
- package/dist/services/backup.d.ts.map +1 -0
- package/dist/services/backup.js +325 -0
- package/dist/services/backup.js.map +1 -0
- package/dist/services/config.d.ts +3662 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/config.js +4445 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/index.d.ts +14 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +15 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/nodes.d.ts +1441 -0
- package/dist/services/nodes.d.ts.map +1 -0
- package/dist/services/nodes.js +1829 -0
- package/dist/services/nodes.js.map +1 -0
- package/dist/services/ping.d.ts +15 -0
- package/dist/services/ping.d.ts.map +1 -0
- package/dist/services/ping.js +21 -0
- package/dist/services/ping.js.map +1 -0
- package/dist/services/pull.d.ts +54 -0
- package/dist/services/pull.d.ts.map +1 -0
- package/dist/services/pull.js +47 -0
- package/dist/services/pull.js.map +1 -0
- package/dist/services/push.d.ts +50 -0
- package/dist/services/push.d.ts.map +1 -0
- package/dist/services/push.js +45 -0
- package/dist/services/push.js.map +1 -0
- package/dist/services/reader.d.ts +68 -0
- package/dist/services/reader.d.ts.map +1 -0
- package/dist/services/reader.js +89 -0
- package/dist/services/reader.js.map +1 -0
- package/dist/services/root.d.ts +14 -0
- package/dist/services/root.d.ts.map +1 -0
- package/dist/services/root.js +19 -0
- package/dist/services/root.js.map +1 -0
- package/dist/services/status.d.ts +78 -0
- package/dist/services/status.d.ts.map +1 -0
- package/dist/services/status.js +97 -0
- package/dist/services/status.js.map +1 -0
- package/dist/services/tape.d.ts +711 -0
- package/dist/services/tape.d.ts.map +1 -0
- package/dist/services/tape.js +986 -0
- package/dist/services/tape.js.map +1 -0
- package/dist/services/version.d.ts +17 -0
- package/dist/services/version.d.ts.map +1 -0
- package/dist/services/version.js +25 -0
- package/dist/services/version.js.map +1 -0
- package/dist/task.d.ts +48 -0
- package/dist/task.d.ts.map +1 -0
- package/dist/task.js +57 -0
- package/dist/task.js.map +1 -0
- package/dist/traits.d.ts +13 -0
- package/dist/traits.d.ts.map +1 -0
- package/dist/traits.js +15 -0
- package/dist/traits.js.map +1 -0
- package/package.json +81 -0
- package/src/credentials.ts +139 -0
- package/src/errors.ts +126 -0
- package/src/index.ts +36 -0
- package/src/protocol.test.ts +128 -0
- package/src/protocol.ts +196 -0
- package/src/retry.ts +79 -0
- package/src/services/access.ts +1787 -0
- package/src/services/admin.ts +3258 -0
- package/src/services/backup.ts +698 -0
- package/src/services/config.ts +10561 -0
- package/src/services/index.ts +14 -0
- package/src/services/nodes.ts +4313 -0
- package/src/services/ping.ts +43 -0
- package/src/services/pull.ts +118 -0
- package/src/services/push.ts +108 -0
- package/src/services/reader.ts +196 -0
- package/src/services/root.ts +39 -0
- package/src/services/status.ts +233 -0
- package/src/services/tape.ts +2257 -0
- package/src/services/version.ts +49 -0
- package/src/task.ts +84 -0
- package/src/traits.ts +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# @homeflare/distilled-proxmox-backup
|
|
2
|
+
|
|
3
|
+
This package is **not a HomeFlare SDK**. It is an unmodified copy of
|
|
4
|
+
`@distilled.cloud/proxmox-backup`, generated by the
|
|
5
|
+
[distilled](https://github.com/alchemy-run/distilled) pipeline from Proxmox
|
|
6
|
+
Backup Server's own `apidoc.js` (the api-viewer's schema — PBS, like PVE,
|
|
7
|
+
publishes no OpenAPI document), pinned to the vendor schema at
|
|
8
|
+
`proxmox-backup-server` version `4.2.6-1` (sha256
|
|
9
|
+
`274ab9f6fc075aeafb827370e6b65545507e3348a404f1c0b181fc2d9589458a`, per the
|
|
10
|
+
house schema manifest's `pbs-apidoc` entry), published here under its own
|
|
11
|
+
name only because `@distilled.cloud/proxmox-backup` does not exist on npm
|
|
12
|
+
yet. See [`../alchemy/docs/distilled-interim.md`](../alchemy/docs/distilled-interim.md)
|
|
13
|
+
for the full route every distilled-sourced vendor package follows.
|
|
14
|
+
|
|
15
|
+
⛔ **Do not hand-edit anything under `src/`.** A fix belongs in the
|
|
16
|
+
distilled clone's `packages/proxmox-backup/`, regenerated, then copied back
|
|
17
|
+
here.
|
|
18
|
+
|
|
19
|
+
⚠️ **License.** Apache-2.0, not the kit's usual MIT — see `LICENSE`.
|
|
20
|
+
|
|
21
|
+
⚠️ **No live PBS call has ever exercised this package.** The estate has no
|
|
22
|
+
PBS host or credential yet. Every trap and header format documented below
|
|
23
|
+
is either confirmed against the pinned static schema (cited inline in the
|
|
24
|
+
distilled clone's source) or carried forward from the same-vendor PVE
|
|
25
|
+
package's measured behavior — never from a live PBS response. Re-verify the
|
|
26
|
+
auth header and envelope shape against the first real PBS token this estate
|
|
27
|
+
gets, before trusting this package in anything that writes.
|
|
28
|
+
|
|
29
|
+
## What's in it
|
|
30
|
+
|
|
31
|
+
367 operations across 13 service modules, one per PBS top-level path
|
|
32
|
+
segment — `access`, `admin`, `backup`, `config`, `nodes`, `ping`, `pull`,
|
|
33
|
+
`push`, `reader`, `root`, `status`, `tape`, `version` — 0 skipped. Typed
|
|
34
|
+
errors: the shared HTTP status classes and PBS's global
|
|
35
|
+
`ParameterVerificationFailed`/non-retryable `BadRequest` fallback for a 400.
|
|
36
|
+
|
|
37
|
+
**No `ClusterNodeUnreachable`.** PVE's sibling package adds a typed 595 for
|
|
38
|
+
cluster-forwarded requests; PBS is not a cluster product and the pinned
|
|
39
|
+
schema has zero `proxyto` occurrences, so this package's `awaitTask` has a
|
|
40
|
+
narrower error union than PVE's.
|
|
41
|
+
|
|
42
|
+
Also ships `awaitTask` (`./Task`): a PBS POST/PUT/DELETE that queues a
|
|
43
|
+
long-running action (backup, sync, GC, tape write, …) answers 200 with a
|
|
44
|
+
bare UPID the moment it is QUEUED — confirmed in the pinned schema
|
|
45
|
+
(`GET /nodes/{node}/tasks/{upid}/status` exists, UPID-shaped `pattern`
|
|
46
|
+
appears 44 times). `awaitTask` polls it until `exitstatus` appears and
|
|
47
|
+
fails unless it is EXACTLY `"OK"`.
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import * as ProxmoxBackup from '@distilled.cloud/proxmox-backup'; // aliased onto this package
|
|
51
|
+
import * as Effect from 'effect/Effect';
|
|
52
|
+
|
|
53
|
+
const program = ProxmoxBackup.Services.version.getVersion({}).pipe(
|
|
54
|
+
Effect.provide(ProxmoxBackup.ProxmoxBackupProtocol),
|
|
55
|
+
Effect.provide(
|
|
56
|
+
ProxmoxBackup.credentials({
|
|
57
|
+
tokenId: 'backup@pbs!terraform',
|
|
58
|
+
secret: '...',
|
|
59
|
+
baseUrl: 'https://pbs1.example.com:8007',
|
|
60
|
+
}),
|
|
61
|
+
),
|
|
62
|
+
);
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
⚠️ **The auth header is `PBSAPIToken=<id>:<secret>` — a COLON, not the `=`
|
|
66
|
+
PVE's `PVEAPIToken` uses.** `credentials()` builds this correctly; the risk
|
|
67
|
+
is a caller who copy-pastes PVE integration code and expects the same
|
|
68
|
+
separator. See `src/credentials.ts`'s header for the two independent,
|
|
69
|
+
doc-based (not live-measured) citations this was built from.
|
|
70
|
+
|
|
71
|
+
Kit code never imports `@homeflare/distilled-proxmox-backup` directly —
|
|
72
|
+
always `@distilled.cloud/proxmox-backup`, aliased in the consuming
|
|
73
|
+
package's `package.json`.
|
|
74
|
+
|
|
75
|
+
## Updating it
|
|
76
|
+
|
|
77
|
+
From the distilled clone's `homeflare/proxmox-backup` worktree:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
DISTILLED_SPECS_LOCAL=1 pnpm --filter @distilled.cloud/proxmox-backup run convert
|
|
81
|
+
DISTILLED_SPECS_LOCAL=1 pnpm --filter @distilled.cloud/proxmox-backup run generate
|
|
82
|
+
pnpm --filter @distilled.cloud/proxmox-backup run typecheck
|
|
83
|
+
pnpm format
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`pnpm specs:check` currently FAILS for this package — see
|
|
87
|
+
`packages/proxmox-backup/specs/.local/readme.md` in the distilled clone:
|
|
88
|
+
PBS has no public docs mirror the way PVE does, and there is no PBS host
|
|
89
|
+
in the estate yet to fetch a live schema from. Regenerating today means
|
|
90
|
+
re-copying the same pinned file; a real refresh needs one of those two
|
|
91
|
+
gaps closed first.
|
|
92
|
+
|
|
93
|
+
Then copy `src/` here verbatim, bump this package's own `version`, add a
|
|
94
|
+
changeset, and let the kit's normal release flow publish it.
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
Apache-2.0 (see `LICENSE`) — not the kit's usual MIT. `src/` is an
|
|
99
|
+
unmodified copy of `@distilled.cloud/proxmox-backup`'s own output from
|
|
100
|
+
`alchemy-run/distilled`, which is itself Apache-2.0; this package's own
|
|
101
|
+
files (`package.json`, `tsconfig.json`, `scripts/smoke.ts`, this README)
|
|
102
|
+
are offered under the same terms.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Redacted from "effect/Redacted";
|
|
5
|
+
/**
|
|
6
|
+
* PBS's own API root, relative to the host origin. Always `/api2/json` —
|
|
7
|
+
* the same path PVE uses (both products share the same underlying
|
|
8
|
+
* `proxmox-rest-server`-family REST framework; measured: the pinned PBS
|
|
9
|
+
* schema's own endpoints are all rooted the same way PVE's are). The
|
|
10
|
+
* default PORT differs (PBS is 8007, PVE 8006 — see
|
|
11
|
+
* `taslabs-net/homeflare-kit`'s `docs/pbs-notifications.md` and its
|
|
12
|
+
* `*.test.ts` fixtures, all `https://pbs.example.com:8007/api2/json`), but
|
|
13
|
+
* this package never hardcodes a port: like PVE's own credentials.ts, the
|
|
14
|
+
* instance URL (port included) is always part of the caller's credential.
|
|
15
|
+
*/
|
|
16
|
+
export declare const API_PATH = "/api2/json";
|
|
17
|
+
/**
|
|
18
|
+
* Normalize a host origin (or an already-complete API root) into the API
|
|
19
|
+
* base URL: trailing slashes dropped, {@link API_PATH} appended exactly
|
|
20
|
+
* once. Does NOT default the port — `https://pbs.example.com:8007` (or a
|
|
21
|
+
* bare host, which the caller must have already put a scheme+port on) is
|
|
22
|
+
* expected.
|
|
23
|
+
*
|
|
24
|
+
* ⛔ THE TRIM IS A LOOP, NEVER `/\/+$/` — copied unchanged from
|
|
25
|
+
* `packages/proxmox/src/credentials.ts`: that regex backtracks
|
|
26
|
+
* polynomially on a long run of trailing `/` (CodeQL
|
|
27
|
+
* `js/polynomial-redos`), a real caller-input DoS surface, not a
|
|
28
|
+
* hypothetical one, and the fix already landed twice elsewhere in this
|
|
29
|
+
* clone (PVE, `@homeflare/distilled-netbox`).
|
|
30
|
+
*/
|
|
31
|
+
export declare const normalizeBaseUrl: (baseUrl: string) => string;
|
|
32
|
+
export interface Config {
|
|
33
|
+
/** The full `<user>@<realm>!<tokenid>` string, e.g. `root@pam!terraform`. */
|
|
34
|
+
readonly tokenId: string;
|
|
35
|
+
readonly secret: Redacted.Redacted<string>;
|
|
36
|
+
/** Fully-qualified API root, e.g. `https://pbs1.example.com:8007/api2/json`. */
|
|
37
|
+
readonly apiBaseUrl: string;
|
|
38
|
+
}
|
|
39
|
+
declare const Credentials_base: Context.ServiceClass<Credentials, "ProxmoxBackupCredentials", Effect.Effect<Config, never, never>>;
|
|
40
|
+
export declare class Credentials extends Credentials_base {
|
|
41
|
+
}
|
|
42
|
+
export declare const CredentialsFromEnv: Layer.Layer<Credentials, never, never>;
|
|
43
|
+
/** Convenience layer from a plain token and the host origin (or API root). */
|
|
44
|
+
export declare const credentials: (config: {
|
|
45
|
+
readonly tokenId: string;
|
|
46
|
+
readonly secret: string | Redacted.Redacted<string>;
|
|
47
|
+
readonly baseUrl: string;
|
|
48
|
+
}) => Layer.Layer<Credentials>;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAG5C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB,YAAa,MAAM,KAAG,MAKlD,CAAC;AAEF,MAAM,WAAW,MAAM;IACrB,6EAA6E;IAC7E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WAAY,SAAQ,gBAGF;CAAG;AAmBlC,eAAO,MAAM,kBAAkB,wCAiB9B,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,WAAW,WAAY;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAWxB,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proxmox Backup Server credentials — hand-written.
|
|
3
|
+
*
|
|
4
|
+
* The `Credentials` service resolves `{ tokenId, secret, apiBaseUrl }` per
|
|
5
|
+
* request; the protocol layer formats the `Authorization` header from it.
|
|
6
|
+
*
|
|
7
|
+
* ⛔ THE HEADER SCHEME IS NOT `PVEAPIToken=<id>=<secret>` — DO NOT COPY
|
|
8
|
+
* `packages/proxmox/src/credentials.ts`'s header-building line unchanged.
|
|
9
|
+
* PBS spells it `PBSAPIToken=<id>:<secret>`: a different prefix AND a
|
|
10
|
+
* different separator (colon, not `=`). Measured in
|
|
11
|
+
* `taslabs-net/homeflare-kit`'s `packages/alchemy/src/proxmox/
|
|
12
|
+
* credentials.ts` (`PBSAPIToken=${tokenId}:${secret}`, used unchanged
|
|
13
|
+
* since PVE/PBS share one client there) and independently in that same
|
|
14
|
+
* repo's `pbs-prune-job.ts` ("PBS's documented form is `Authorization:
|
|
15
|
+
* PBSAPIToken=TOKENID:TOKENSECRET`, measured from the published PBS
|
|
16
|
+
* documentation, 2026-09-13"). ⚠️ Both citations are REASONED FROM PBS'S
|
|
17
|
+
* DOCUMENTED SCHEME, NOT FROM A LIVE CALL — the kit's own comment says so
|
|
18
|
+
* explicitly ("the estate has no PBS credential yet ... an
|
|
19
|
+
* unauthenticated probe cannot tell the schemes apart"), and this
|
|
20
|
+
* package inherits that same caveat: nothing here has been exercised
|
|
21
|
+
* against a running PBS instance either (out of scope for this build —
|
|
22
|
+
* "No live PBS calls"). A wrong separator answers 401 "authentication
|
|
23
|
+
* failure", which reads as a bad credential rather than a malformed
|
|
24
|
+
* header — the first real token is what actually confirms this.
|
|
25
|
+
*
|
|
26
|
+
* PBS is self-hosted (a backup datastore host, not a single-tenant SaaS),
|
|
27
|
+
* so — like PVE and `@distilled.cloud/forgejo` — there is no default API
|
|
28
|
+
* root: the instance URL is part of the credential. `tokenId` is the FULL
|
|
29
|
+
* `<user>@<realm>!<tokenid>` string PBS prints when an API token is created
|
|
30
|
+
* (`proxmox-backup-manager user generate-token …`); `secret` is the value
|
|
31
|
+
* shown exactly once at creation time.
|
|
32
|
+
*/
|
|
33
|
+
import * as EffectConfig from "effect/Config";
|
|
34
|
+
import * as Context from "effect/Context";
|
|
35
|
+
import * as Effect from "effect/Effect";
|
|
36
|
+
import * as Layer from "effect/Layer";
|
|
37
|
+
import * as Redacted from "effect/Redacted";
|
|
38
|
+
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
39
|
+
/**
|
|
40
|
+
* PBS's own API root, relative to the host origin. Always `/api2/json` —
|
|
41
|
+
* the same path PVE uses (both products share the same underlying
|
|
42
|
+
* `proxmox-rest-server`-family REST framework; measured: the pinned PBS
|
|
43
|
+
* schema's own endpoints are all rooted the same way PVE's are). The
|
|
44
|
+
* default PORT differs (PBS is 8007, PVE 8006 — see
|
|
45
|
+
* `taslabs-net/homeflare-kit`'s `docs/pbs-notifications.md` and its
|
|
46
|
+
* `*.test.ts` fixtures, all `https://pbs.example.com:8007/api2/json`), but
|
|
47
|
+
* this package never hardcodes a port: like PVE's own credentials.ts, the
|
|
48
|
+
* instance URL (port included) is always part of the caller's credential.
|
|
49
|
+
*/
|
|
50
|
+
export const API_PATH = "/api2/json";
|
|
51
|
+
/**
|
|
52
|
+
* Normalize a host origin (or an already-complete API root) into the API
|
|
53
|
+
* base URL: trailing slashes dropped, {@link API_PATH} appended exactly
|
|
54
|
+
* once. Does NOT default the port — `https://pbs.example.com:8007` (or a
|
|
55
|
+
* bare host, which the caller must have already put a scheme+port on) is
|
|
56
|
+
* expected.
|
|
57
|
+
*
|
|
58
|
+
* ⛔ THE TRIM IS A LOOP, NEVER `/\/+$/` — copied unchanged from
|
|
59
|
+
* `packages/proxmox/src/credentials.ts`: that regex backtracks
|
|
60
|
+
* polynomially on a long run of trailing `/` (CodeQL
|
|
61
|
+
* `js/polynomial-redos`), a real caller-input DoS surface, not a
|
|
62
|
+
* hypothetical one, and the fix already landed twice elsewhere in this
|
|
63
|
+
* clone (PVE, `@homeflare/distilled-netbox`).
|
|
64
|
+
*/
|
|
65
|
+
export const normalizeBaseUrl = (baseUrl) => {
|
|
66
|
+
let end = baseUrl.length;
|
|
67
|
+
while (end > 0 && baseUrl.charCodeAt(end - 1) === 47 /* "/" */)
|
|
68
|
+
end--;
|
|
69
|
+
const trimmed = baseUrl.slice(0, end);
|
|
70
|
+
return trimmed.endsWith(API_PATH) ? trimmed : `${trimmed}${API_PATH}`;
|
|
71
|
+
};
|
|
72
|
+
export class Credentials extends Context.Service()("ProxmoxBackupCredentials") {
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* ⚠️ Distinct env var names from `@distilled.cloud/proxmox`'s
|
|
76
|
+
* `PROXMOX_TOKEN_ID`/`PROXMOX_TOKEN_SECRET`/`PROXMOX_URL`, on purpose — a
|
|
77
|
+
* process that talks to both a PVE cluster and a PBS datastore (a very
|
|
78
|
+
* plausible pairing: PBS backs up PVE) needs both sets live at once
|
|
79
|
+
* without collision. `PROXMOX_BACKUP_*` mirrors the package's own name,
|
|
80
|
+
* `@distilled.cloud/proxmox-backup`, rather than inventing a `PBS_*`
|
|
81
|
+
* prefix the vendor itself never uses in its own docs. This naming is
|
|
82
|
+
* this package's own choice, not a vendor-mandated one — flagged for
|
|
83
|
+
* confirmation in the build report.
|
|
84
|
+
*/
|
|
85
|
+
const envConfig = EffectConfig.all({
|
|
86
|
+
tokenId: EffectConfig.String("PROXMOX_BACKUP_TOKEN_ID"),
|
|
87
|
+
secret: EffectConfig.Redacted("PROXMOX_BACKUP_TOKEN_SECRET"),
|
|
88
|
+
baseUrl: EffectConfig.String("PROXMOX_BACKUP_URL"),
|
|
89
|
+
});
|
|
90
|
+
export const CredentialsFromEnv = Layer.succeed(Credentials, envConfig.pipe(Effect.mapError(() => new ConfigError({
|
|
91
|
+
message: "PROXMOX_BACKUP_URL, PROXMOX_BACKUP_TOKEN_ID and PROXMOX_BACKUP_TOKEN_SECRET environment variables are required",
|
|
92
|
+
})), Effect.map(({ tokenId, secret, baseUrl }) => ({
|
|
93
|
+
tokenId,
|
|
94
|
+
secret,
|
|
95
|
+
apiBaseUrl: normalizeBaseUrl(baseUrl),
|
|
96
|
+
})), Effect.orDie));
|
|
97
|
+
/** Convenience layer from a plain token and the host origin (or API root). */
|
|
98
|
+
export const credentials = (config) => Layer.succeed(Credentials, Effect.succeed({
|
|
99
|
+
tokenId: config.tokenId,
|
|
100
|
+
secret: typeof config.secret === "string"
|
|
101
|
+
? Redacted.make(config.secret)
|
|
102
|
+
: config.secret,
|
|
103
|
+
apiBaseUrl: normalizeBaseUrl(config.baseUrl),
|
|
104
|
+
}));
|
|
105
|
+
//# sourceMappingURL=credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC;AAErC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAU,EAAE;IAC1D,IAAI,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IACzB,OAAO,GAAG,GAAG,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,SAAS;QAAE,GAAG,EAAE,CAAC;IACtE,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACtC,OAAO,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,QAAQ,EAAE,CAAC;AACxE,CAAC,CAAC;AAUF,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,OAAO,EAG7C,CAAC,0BAA0B,CAAC;CAAG;AAElC;;;;;;;;;;GAUG;AACH,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC;IACjC,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,yBAAyB,CAAC;IACvD,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAC5D,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,oBAAoB,CAAC;CACnD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAC7C,WAAW,EACX,SAAS,CAAC,IAAI,CACZ,MAAM,CAAC,QAAQ,CACb,GAAG,EAAE,CACH,IAAI,WAAW,CAAC;IACd,OAAO,EACL,gHAAgH;CACnH,CAAC,CACL,EACD,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5C,OAAO;IACP,MAAM;IACN,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC;CACtC,CAAC,CAAC,EACH,MAAM,CAAC,KAAK,CACb,CACF,CAAC;AAEF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAI3B,EAA4B,EAAE,CAC7B,KAAK,CAAC,OAAO,CACX,WAAW,EACX,MAAM,CAAC,OAAO,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,OAAO;IACvB,MAAM,EACJ,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ;QAC/B,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAC9B,CAAC,CAAC,MAAM,CAAC,MAAM;IACnB,UAAU,EAAE,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC;CAC7C,CAAC,CACH,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proxmox Backup Server-specific error types.
|
|
3
|
+
*
|
|
4
|
+
* Ported from `packages/proxmox/src/errors.ts` in this same distilled
|
|
5
|
+
* clone, with one deliberate omission — see the ⛔ below.
|
|
6
|
+
*
|
|
7
|
+
* ⛔ NO `ClusterNodeUnreachable`, NO `patches/nodes/task-polling.json`.
|
|
8
|
+
* PVE's version of this file adds a `ClusterNodeUnreachable` (HTTP 595)
|
|
9
|
+
* error via an RFC-6902 patch to the four `/nodes/{node}/tasks/…`
|
|
10
|
+
* operations the VENDOR SCHEMA marks `proxyto: "node"` (PVE forwards a
|
|
11
|
+
* request to whichever cluster member actually owns the task). MEASURED:
|
|
12
|
+
* the pinned PBS schema (`~/.cache/homeflare/schemas/proxmox/
|
|
13
|
+
* pbs_4.2.6-1_apidoc.js`) has ZERO occurrences of `"proxyto"` anywhere —
|
|
14
|
+
* `grep -c '"proxyto"'` on the full 1.5 MB file returns 0. This is
|
|
15
|
+
* expected, not a gap: PBS is a single-host backup datastore product,
|
|
16
|
+
* not a cluster, so there is nothing for a request to be forwarded to.
|
|
17
|
+
* Carrying the 595 error and its patch forward would assert a failure
|
|
18
|
+
* mode the vendor schema gives no evidence for. `src/task.ts`'s
|
|
19
|
+
* `awaitTask` here therefore has a narrower error union than PVE's.
|
|
20
|
+
*/
|
|
21
|
+
export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
|
|
22
|
+
import type { BadRequest, DefaultErrors as CoreDefaultErrors } from "@distilled.cloud/core/errors";
|
|
23
|
+
import * as Schema from "effect/Schema";
|
|
24
|
+
declare const ParameterVerificationFailed_base: Schema.Class<ParameterVerificationFailed, Schema.TaggedStruct<"ParameterVerificationFailed", {
|
|
25
|
+
readonly message: Schema.String;
|
|
26
|
+
readonly errors: Schema.$Record<Schema.String, Schema.String>;
|
|
27
|
+
}>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
|
|
28
|
+
"@distilled.cloud/error/categories": {
|
|
29
|
+
BadRequestError: true;
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* PBS's generic parameter-validation failure: `400` with `{"data":null,
|
|
34
|
+
* "errors":{"<param>":"<message>", …}, "message":"parameter verification
|
|
35
|
+
* failed"}`. ⚠️ NOT INDEPENDENTLY MEASURED AGAINST A LIVE PBS HOST (this
|
|
36
|
+
* build makes no live PBS calls). Carried forward from PVE's identical,
|
|
37
|
+
* measured shape on the strength of same-vendor architecture: PBS's own
|
|
38
|
+
* api-viewer/apidoc.js is the same schema-driven tooling PVE's is (the
|
|
39
|
+
* `apidoc.ts` parser in this package reads both with only a declaration-
|
|
40
|
+
* syntax and terminator difference — see that file's header), and
|
|
41
|
+
* `taslabs-net/homeflare-kit`'s `packages/alchemy/src/proxmox/
|
|
42
|
+
* credentials.ts` documents PBS and PVE as literally sharing one HTTP
|
|
43
|
+
* client because "PBS is the same client with a different Authorization
|
|
44
|
+
* header" — i.e. the `{"data": …}` envelope and error shape are asserted
|
|
45
|
+
* identical there too, also without a live PBS credential to confirm
|
|
46
|
+
* against. Flagged here as INFERRED, not measured, so a future caller who
|
|
47
|
+
* DOES get a live token knows to re-check this specific claim first.
|
|
48
|
+
*/
|
|
49
|
+
export declare class ParameterVerificationFailed extends ParameterVerificationFailed_base {
|
|
50
|
+
}
|
|
51
|
+
declare const UnknownProxmoxBackupError_base: Schema.Class<UnknownProxmoxBackupError, Schema.TaggedStruct<"UnknownProxmoxBackupError", {
|
|
52
|
+
readonly status: Schema.optional<Schema.Number>;
|
|
53
|
+
readonly message: Schema.optional<Schema.String>;
|
|
54
|
+
readonly body: Schema.Unknown;
|
|
55
|
+
}>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
|
|
56
|
+
"@distilled.cloud/error/categories": {
|
|
57
|
+
ServerError: true;
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* Unknown Proxmox Backup Server error — returned when a failed response's
|
|
62
|
+
* HTTP status has no mapped error class. Carries the raw body for later
|
|
63
|
+
* cataloging.
|
|
64
|
+
*/
|
|
65
|
+
export declare class UnknownProxmoxBackupError extends UnknownProxmoxBackupError_base {
|
|
66
|
+
}
|
|
67
|
+
declare const ProxmoxBackupParseError_base: Schema.Class<ProxmoxBackupParseError, Schema.TaggedStruct<"ProxmoxBackupParseError", {
|
|
68
|
+
readonly body: Schema.Unknown;
|
|
69
|
+
readonly cause: Schema.Unknown;
|
|
70
|
+
}>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
|
|
71
|
+
"@distilled.cloud/error/categories": {
|
|
72
|
+
ParseError: true;
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
/** Schema parse error wrapper. */
|
|
76
|
+
export declare class ProxmoxBackupParseError extends ProxmoxBackupParseError_base {
|
|
77
|
+
}
|
|
78
|
+
declare const ProxmoxBackupTaskFailed_base: Schema.Class<ProxmoxBackupTaskFailed, Schema.TaggedStruct<"ProxmoxBackupTaskFailed", {
|
|
79
|
+
readonly node: Schema.String;
|
|
80
|
+
readonly upid: Schema.String;
|
|
81
|
+
readonly exitstatus: Schema.String;
|
|
82
|
+
}>, import("effect/Cause").YieldableError>;
|
|
83
|
+
/**
|
|
84
|
+
* A polled task ended with an `exitstatus` other than exactly `"OK"` — see
|
|
85
|
+
* `src/task.ts`. `exitstatus` carries PBS's own failure text verbatim.
|
|
86
|
+
*/
|
|
87
|
+
export declare class ProxmoxBackupTaskFailed extends ProxmoxBackupTaskFailed_base {
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Errors any Proxmox Backup Server operation may surface in addition to
|
|
91
|
+
* the per-operation typed status errors.
|
|
92
|
+
*/
|
|
93
|
+
export type ClientErrors = UnknownProxmoxBackupError | ProxmoxBackupParseError;
|
|
94
|
+
/**
|
|
95
|
+
* Default Proxmox Backup Server operation errors: the shared HTTP status
|
|
96
|
+
* errors from core, PBS's global parameter-verification failure, plus the
|
|
97
|
+
* client-level fallback/decode errors.
|
|
98
|
+
*/
|
|
99
|
+
export type DefaultErrors = CoreDefaultErrors | BadRequest | ParameterVerificationFailed | ClientErrors;
|
|
100
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AAItC,OAAO,KAAK,EACV,UAAU,EACV,aAAa,IAAI,iBAAiB,EACnC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;;;;;;;;AAGxC;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,2BAA4B,SAAQ,gCAMb;CAAG;;;;;;;;;;AAEvC;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,8BAOf;CAAG;;;;;;;;;AAEnC,kCAAkC;AAClC,qBAAa,uBAAwB,SAAQ,4BAMd;CAAG;;;;;;AAElC;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,4BAO5C;CAAG;AAEJ;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,yBAAyB,GAAG,uBAAuB,CAAC;AAE/E;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACrB,iBAAiB,GACjB,UAAU,GACV,2BAA2B,GAC3B,YAAY,CAAC"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proxmox Backup Server-specific error types.
|
|
3
|
+
*
|
|
4
|
+
* Ported from `packages/proxmox/src/errors.ts` in this same distilled
|
|
5
|
+
* clone, with one deliberate omission — see the ⛔ below.
|
|
6
|
+
*
|
|
7
|
+
* ⛔ NO `ClusterNodeUnreachable`, NO `patches/nodes/task-polling.json`.
|
|
8
|
+
* PVE's version of this file adds a `ClusterNodeUnreachable` (HTTP 595)
|
|
9
|
+
* error via an RFC-6902 patch to the four `/nodes/{node}/tasks/…`
|
|
10
|
+
* operations the VENDOR SCHEMA marks `proxyto: "node"` (PVE forwards a
|
|
11
|
+
* request to whichever cluster member actually owns the task). MEASURED:
|
|
12
|
+
* the pinned PBS schema (`~/.cache/homeflare/schemas/proxmox/
|
|
13
|
+
* pbs_4.2.6-1_apidoc.js`) has ZERO occurrences of `"proxyto"` anywhere —
|
|
14
|
+
* `grep -c '"proxyto"'` on the full 1.5 MB file returns 0. This is
|
|
15
|
+
* expected, not a gap: PBS is a single-host backup datastore product,
|
|
16
|
+
* not a cluster, so there is nothing for a request to be forwarded to.
|
|
17
|
+
* Carrying the 595 error and its patch forward would assert a failure
|
|
18
|
+
* mode the vendor schema gives no evidence for. `src/task.ts`'s
|
|
19
|
+
* `awaitTask` here therefore has a narrower error union than PVE's.
|
|
20
|
+
*/
|
|
21
|
+
export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
|
|
22
|
+
import * as Schema from "effect/Schema";
|
|
23
|
+
import * as Category from "@distilled.cloud/core/category";
|
|
24
|
+
/**
|
|
25
|
+
* PBS's generic parameter-validation failure: `400` with `{"data":null,
|
|
26
|
+
* "errors":{"<param>":"<message>", …}, "message":"parameter verification
|
|
27
|
+
* failed"}`. ⚠️ NOT INDEPENDENTLY MEASURED AGAINST A LIVE PBS HOST (this
|
|
28
|
+
* build makes no live PBS calls). Carried forward from PVE's identical,
|
|
29
|
+
* measured shape on the strength of same-vendor architecture: PBS's own
|
|
30
|
+
* api-viewer/apidoc.js is the same schema-driven tooling PVE's is (the
|
|
31
|
+
* `apidoc.ts` parser in this package reads both with only a declaration-
|
|
32
|
+
* syntax and terminator difference — see that file's header), and
|
|
33
|
+
* `taslabs-net/homeflare-kit`'s `packages/alchemy/src/proxmox/
|
|
34
|
+
* credentials.ts` documents PBS and PVE as literally sharing one HTTP
|
|
35
|
+
* client because "PBS is the same client with a different Authorization
|
|
36
|
+
* header" — i.e. the `{"data": …}` envelope and error shape are asserted
|
|
37
|
+
* identical there too, also without a live PBS credential to confirm
|
|
38
|
+
* against. Flagged here as INFERRED, not measured, so a future caller who
|
|
39
|
+
* DOES get a live token knows to re-check this specific claim first.
|
|
40
|
+
*/
|
|
41
|
+
export class ParameterVerificationFailed extends Schema.TaggedError()("ParameterVerificationFailed", {
|
|
42
|
+
message: Schema.String,
|
|
43
|
+
errors: Schema.Record(Schema.String, Schema.String),
|
|
44
|
+
}).pipe(Category.withBadRequestError) {
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Unknown Proxmox Backup Server error — returned when a failed response's
|
|
48
|
+
* HTTP status has no mapped error class. Carries the raw body for later
|
|
49
|
+
* cataloging.
|
|
50
|
+
*/
|
|
51
|
+
export class UnknownProxmoxBackupError extends Schema.TaggedError()("UnknownProxmoxBackupError", {
|
|
52
|
+
status: Schema.optional(Schema.Number),
|
|
53
|
+
message: Schema.optional(Schema.String),
|
|
54
|
+
body: Schema.Unknown,
|
|
55
|
+
}).pipe(Category.withServerError) {
|
|
56
|
+
}
|
|
57
|
+
/** Schema parse error wrapper. */
|
|
58
|
+
export class ProxmoxBackupParseError extends Schema.TaggedError()("ProxmoxBackupParseError", {
|
|
59
|
+
body: Schema.Unknown,
|
|
60
|
+
cause: Schema.Unknown,
|
|
61
|
+
}).pipe(Category.withParseError) {
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A polled task ended with an `exitstatus` other than exactly `"OK"` — see
|
|
65
|
+
* `src/task.ts`. `exitstatus` carries PBS's own failure text verbatim.
|
|
66
|
+
*/
|
|
67
|
+
export class ProxmoxBackupTaskFailed extends Schema.TaggedError()("ProxmoxBackupTaskFailed", {
|
|
68
|
+
node: Schema.String,
|
|
69
|
+
upid: Schema.String,
|
|
70
|
+
exitstatus: Schema.String,
|
|
71
|
+
}) {
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AAStC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,gCAAgC,CAAC;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,2BAA4B,SAAQ,MAAM,CAAC,WAAW,EAA+B,CAChG,6BAA6B,EAC7B;IACE,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;CACpD,CACF,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC;CAAG;AAEvC;;;;GAIG;AACH,MAAM,OAAO,yBAA0B,SAAQ,MAAM,CAAC,WAAW,EAA6B,CAC5F,2BAA2B,EAC3B;IACE,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC,OAAO;CACrB,CACF,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC;CAAG;AAEnC,kCAAkC;AAClC,MAAM,OAAO,uBAAwB,SAAQ,MAAM,CAAC,WAAW,EAA2B,CACxF,yBAAyB,EACzB;IACE,IAAI,EAAE,MAAM,CAAC,OAAO;IACpB,KAAK,EAAE,MAAM,CAAC,OAAO;CACtB,CACF,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;CAAG;AAElC;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,MAAM,CAAC,WAAW,EAA2B,CACxF,yBAAyB,EACzB;IACE,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,UAAU,EAAE,MAAM,CAAC,MAAM;CAC1B,CACF;CAAG"}
|