@virtbase/proxmox-api 2.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.
package/dist/client.js ADDED
@@ -0,0 +1,47 @@
1
+ // Proxmox-API Interactive proxmox API for developpers how do not like reading docs
2
+ // Copyright (C) 2020-2022 Chemouni Uriel <uchemouni@gmail.com>
3
+ //
4
+ // This program is free software: you can redistribute it and/or modify
5
+ // it under the terms of the GNU General Public License as published by
6
+ // the Free Software Foundation, either version 3 of the License, or
7
+ // (at your option) any later version.
8
+ //
9
+ // This program is distributed in the hope that it will be useful,
10
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ // GNU General Public License for more details.
13
+ //
14
+ // You should have received a copy of the GNU General Public License
15
+ // along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ import { ProxmoxEngine } from "./proxmox-engine.js";
17
+ import { buildApiProxy } from "./proxy.js";
18
+ /** Every path this client builds hangs off the JSON API root. */
19
+ const BASE_PATH = "/api2/json";
20
+ function isRequestable(value) {
21
+ return "doRequest" in value;
22
+ }
23
+ /**
24
+ * Build a typed Proxmox API client.
25
+ *
26
+ * @param options Connection options, or any {@link ApiRequestable} to send
27
+ * requests through - a pre-built {@link ProxmoxEngine} whose session you
28
+ * want to keep, or a stub for tests.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const proxmox = proxmoxApi({
33
+ * host: "192.0.2.10",
34
+ * port: 8006,
35
+ * tokenID: "root@pam!automation",
36
+ * tokenSecret: "12345678-1234-1234-1234-1234567890ab",
37
+ * });
38
+ *
39
+ * const nodes = await proxmox.nodes.$get();
40
+ * ```
41
+ */
42
+ export function proxmoxApi(options) {
43
+ const engine = isRequestable(options) ? options : new ProxmoxEngine(options);
44
+ return buildApiProxy(engine, BASE_PATH);
45
+ }
46
+ export default proxmoxApi;
47
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,gEAAgE;AAChE,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;AAIxE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,iEAAiE;AACjE,MAAM,SAAS,GAAG,YAAY,CAAC;AAE/B,SAAS,aAAa,CACpB,KAA4C;IAE5C,OAAO,WAAW,IAAI,KAAK,CAAC;AAC9B,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,UAAU,CACxB,OAA8C;IAE9C,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;IAC7E,OAAO,aAAa,CAAc,MAAM,EAAE,SAAS,CAAC,CAAC;AACvD,CAAC;AAED,eAAe,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { proxmoxApi as default, proxmoxApi } from "./client.js";
2
+ export type { Proxmox } from "./model.js";
3
+ export { ProxmoxEngine, type ProxmoxEngineOptions, type ProxmoxEngineOptionsCommon, type ProxmoxEngineOptionsPass, type ProxmoxEngineOptionsToken, } from "./proxmox-engine.js";
4
+ export type { ApiParamType, ApiRequestable } from "./proxy.js";
5
+ export { QmMonitor, type USBHostFilter, type USBHostInfo, type USBInfo, } from "./qm-monitor.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,IAAI,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAChE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,GAC/B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EACL,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,OAAO,GACb,MAAM,iBAAiB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ // Proxmox-API Interactive proxmox API for developpers how do not like reading docs
2
+ // Copyright (C) 2020-2022 Chemouni Uriel <uchemouni@gmail.com>
3
+ //
4
+ // This program is free software: you can redistribute it and/or modify
5
+ // it under the terms of the GNU General Public License as published by
6
+ // the Free Software Foundation, either version 3 of the License, or
7
+ // (at your option) any later version.
8
+ //
9
+ // This program is distributed in the hope that it will be useful,
10
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ // GNU General Public License for more details.
13
+ //
14
+ // You should have received a copy of the GNU General Public License
15
+ // along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ export { proxmoxApi as default, proxmoxApi } from "./client.js";
17
+ export { ProxmoxEngine, } from "./proxmox-engine.js";
18
+ export { QmMonitor, } from "./qm-monitor.js";
19
+ // for stress test
20
+ // export { buildApiProxy } from './proxy';
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,gEAAgE;AAChE,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,oEAAoE;AACpE,sCAAsC;AACtC,EAAE;AACF,kEAAkE;AAClE,iEAAiE;AACjE,gEAAgE;AAChE,+CAA+C;AAC/C,EAAE;AACF,oEAAoE;AACpE,wEAAwE;AACxE,OAAO,EAAE,UAAU,IAAI,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,EACL,aAAa,GAKd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,SAAS,GAIV,MAAM,iBAAiB,CAAC;AAEzB,kBAAkB;AAClB,2CAA2C"}