@ostanin/podman 0.1.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.
Files changed (142) hide show
  1. package/README.md +432 -0
  2. package/esm/_dnt.polyfills.d.ts +7 -0
  3. package/esm/_dnt.polyfills.d.ts.map +1 -0
  4. package/esm/_dnt.polyfills.js +1 -0
  5. package/esm/api/artifacts.d.ts +25 -0
  6. package/esm/api/artifacts.d.ts.map +1 -0
  7. package/esm/api/artifacts.js +89 -0
  8. package/esm/api/containers.d.ts +71 -0
  9. package/esm/api/containers.d.ts.map +1 -0
  10. package/esm/api/containers.js +234 -0
  11. package/esm/api/exec.d.ts +15 -0
  12. package/esm/api/exec.d.ts.map +1 -0
  13. package/esm/api/exec.js +45 -0
  14. package/esm/api/generate.d.ts +11 -0
  15. package/esm/api/generate.d.ts.map +1 -0
  16. package/esm/api/generate.js +24 -0
  17. package/esm/api/images.d.ts +55 -0
  18. package/esm/api/images.d.ts.map +1 -0
  19. package/esm/api/images.js +212 -0
  20. package/esm/api/kube.d.ts +13 -0
  21. package/esm/api/kube.d.ts.map +1 -0
  22. package/esm/api/kube.js +38 -0
  23. package/esm/api/manifests.d.ts +19 -0
  24. package/esm/api/manifests.d.ts.map +1 -0
  25. package/esm/api/manifests.js +60 -0
  26. package/esm/api/networks.d.ts +25 -0
  27. package/esm/api/networks.d.ts.map +1 -0
  28. package/esm/api/networks.js +95 -0
  29. package/esm/api/pods.d.ts +35 -0
  30. package/esm/api/pods.d.ts.map +1 -0
  31. package/esm/api/pods.js +120 -0
  32. package/esm/api/quadlets.d.ts +23 -0
  33. package/esm/api/quadlets.d.ts.map +1 -0
  34. package/esm/api/quadlets.js +56 -0
  35. package/esm/api/secrets.d.ts +17 -0
  36. package/esm/api/secrets.d.ts.map +1 -0
  37. package/esm/api/secrets.js +49 -0
  38. package/esm/api/system.d.ts +23 -0
  39. package/esm/api/system.d.ts.map +1 -0
  40. package/esm/api/system.js +98 -0
  41. package/esm/api/volumes.d.ts +23 -0
  42. package/esm/api/volumes.d.ts.map +1 -0
  43. package/esm/api/volumes.js +69 -0
  44. package/esm/client.d.ts +56 -0
  45. package/esm/client.d.ts.map +1 -0
  46. package/esm/client.js +63 -0
  47. package/esm/internal/query.d.ts +2 -0
  48. package/esm/internal/query.d.ts.map +1 -0
  49. package/esm/internal/query.js +24 -0
  50. package/esm/mod.d.ts +22 -0
  51. package/esm/mod.d.ts.map +1 -0
  52. package/esm/mod.js +18 -0
  53. package/esm/package.json +3 -0
  54. package/esm/ssh_transport.d.ts +14 -0
  55. package/esm/ssh_transport.d.ts.map +1 -0
  56. package/esm/ssh_transport.js +85 -0
  57. package/esm/transport.d.ts +23 -0
  58. package/esm/transport.d.ts.map +1 -0
  59. package/esm/transport.js +112 -0
  60. package/esm/transport_core.d.ts +31 -0
  61. package/esm/transport_core.d.ts.map +1 -0
  62. package/esm/transport_core.js +75 -0
  63. package/esm/types/api.d.ts +61 -0
  64. package/esm/types/api.d.ts.map +1 -0
  65. package/esm/types/api.js +5 -0
  66. package/esm/types/errors.d.ts +21 -0
  67. package/esm/types/errors.d.ts.map +1 -0
  68. package/esm/types/errors.js +47 -0
  69. package/esm/types/openapi.d.ts +19552 -0
  70. package/esm/types/openapi.d.ts.map +1 -0
  71. package/esm/types/openapi.js +5 -0
  72. package/package.json +36 -0
  73. package/script/_dnt.polyfills.d.ts +7 -0
  74. package/script/_dnt.polyfills.d.ts.map +1 -0
  75. package/script/_dnt.polyfills.js +2 -0
  76. package/script/api/artifacts.d.ts +25 -0
  77. package/script/api/artifacts.d.ts.map +1 -0
  78. package/script/api/artifacts.js +93 -0
  79. package/script/api/containers.d.ts +71 -0
  80. package/script/api/containers.d.ts.map +1 -0
  81. package/script/api/containers.js +238 -0
  82. package/script/api/exec.d.ts +15 -0
  83. package/script/api/exec.d.ts.map +1 -0
  84. package/script/api/exec.js +49 -0
  85. package/script/api/generate.d.ts +11 -0
  86. package/script/api/generate.d.ts.map +1 -0
  87. package/script/api/generate.js +28 -0
  88. package/script/api/images.d.ts +55 -0
  89. package/script/api/images.d.ts.map +1 -0
  90. package/script/api/images.js +216 -0
  91. package/script/api/kube.d.ts +13 -0
  92. package/script/api/kube.d.ts.map +1 -0
  93. package/script/api/kube.js +42 -0
  94. package/script/api/manifests.d.ts +19 -0
  95. package/script/api/manifests.d.ts.map +1 -0
  96. package/script/api/manifests.js +64 -0
  97. package/script/api/networks.d.ts +25 -0
  98. package/script/api/networks.d.ts.map +1 -0
  99. package/script/api/networks.js +99 -0
  100. package/script/api/pods.d.ts +35 -0
  101. package/script/api/pods.d.ts.map +1 -0
  102. package/script/api/pods.js +124 -0
  103. package/script/api/quadlets.d.ts +23 -0
  104. package/script/api/quadlets.d.ts.map +1 -0
  105. package/script/api/quadlets.js +60 -0
  106. package/script/api/secrets.d.ts +17 -0
  107. package/script/api/secrets.d.ts.map +1 -0
  108. package/script/api/secrets.js +53 -0
  109. package/script/api/system.d.ts +23 -0
  110. package/script/api/system.d.ts.map +1 -0
  111. package/script/api/system.js +102 -0
  112. package/script/api/volumes.d.ts +23 -0
  113. package/script/api/volumes.d.ts.map +1 -0
  114. package/script/api/volumes.js +73 -0
  115. package/script/client.d.ts +56 -0
  116. package/script/client.d.ts.map +1 -0
  117. package/script/client.js +67 -0
  118. package/script/internal/query.d.ts +2 -0
  119. package/script/internal/query.d.ts.map +1 -0
  120. package/script/internal/query.js +27 -0
  121. package/script/mod.d.ts +22 -0
  122. package/script/mod.d.ts.map +1 -0
  123. package/script/mod.js +42 -0
  124. package/script/package.json +3 -0
  125. package/script/ssh_transport.d.ts +14 -0
  126. package/script/ssh_transport.d.ts.map +1 -0
  127. package/script/ssh_transport.js +121 -0
  128. package/script/transport.d.ts +23 -0
  129. package/script/transport.d.ts.map +1 -0
  130. package/script/transport.js +149 -0
  131. package/script/transport_core.d.ts +31 -0
  132. package/script/transport_core.d.ts.map +1 -0
  133. package/script/transport_core.js +78 -0
  134. package/script/types/api.d.ts +61 -0
  135. package/script/types/api.d.ts.map +1 -0
  136. package/script/types/api.js +6 -0
  137. package/script/types/errors.d.ts +21 -0
  138. package/script/types/errors.d.ts.map +1 -0
  139. package/script/types/errors.js +54 -0
  140. package/script/types/openapi.d.ts +19552 -0
  141. package/script/types/openapi.d.ts.map +1 -0
  142. package/script/types/openapi.js +6 -0
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+ export {};
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@ostanin/podman",
3
+ "version": "0.1.0",
4
+ "description": "Typed Podman client for Node.js. Full libpod API — containers, images, pods, networks, volumes, secrets, exec, manifests, kube, artifacts, quadlets.",
5
+ "keywords": [
6
+ "podman",
7
+ "containers",
8
+ "libpod",
9
+ "docker",
10
+ "api",
11
+ "client",
12
+ "typescript"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/podman-deno/podman.git"
17
+ },
18
+ "license": "MIT",
19
+ "main": "./script/mod.js",
20
+ "module": "./esm/mod.js",
21
+ "exports": {
22
+ ".": {
23
+ "import": "./esm/mod.js",
24
+ "require": "./script/mod.js"
25
+ }
26
+ },
27
+ "scripts": {},
28
+ "engines": {
29
+ "node": ">=18.0.0"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^22.5.0"
33
+ },
34
+ "_generatedBy": "dnt@dev",
35
+ "types": "./esm/mod.d.ts"
36
+ }
@@ -0,0 +1,7 @@
1
+ declare global {
2
+ interface Error {
3
+ cause?: unknown;
4
+ }
5
+ }
6
+ export {};
7
+ //# sourceMappingURL=_dnt.polyfills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK;QACb,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB;CACF;AAED,OAAO,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,25 @@
1
+ import type { Transport } from "../transport.js";
2
+ import type { ArtifactAddQuery, ArtifactAddReport, ArtifactRemoveAllQuery, ArtifactExtractQuery, ArtifactInspectReport, ArtifactListReport, ArtifactLocalQuery, ArtifactPullQuery, ArtifactPullReport, ArtifactPushQuery, ArtifactPushReport, ArtifactRemoveReport } from "../types/api.js";
3
+ export declare class ArtifactsApi {
4
+ #private;
5
+ constructor(transport: Transport);
6
+ /** Remove a single artifact by name or ID. */
7
+ remove(nameOrId: string): Promise<ArtifactRemoveReport>;
8
+ /** Extract an artifact's contents as a tar archive stream. */
9
+ extract(nameOrId: string, query?: ArtifactExtractQuery): Promise<ReadableStream<Uint8Array>>;
10
+ /** Inspect an artifact. Returns `null` if not found. */
11
+ inspect(nameOrId: string): Promise<ArtifactInspectReport | null>;
12
+ /** Push an artifact to a remote registry. */
13
+ push(nameOrId: string, query?: ArtifactPushQuery): Promise<ArtifactPushReport>;
14
+ /** Add a file as a new artifact. */
15
+ add(body: ReadableStream<Uint8Array>, query: ArtifactAddQuery): Promise<ArtifactAddReport>;
16
+ /** List all artifacts. */
17
+ list(): Promise<ArtifactListReport[]>;
18
+ /** Add a local file as an artifact. */
19
+ addLocal(query: ArtifactLocalQuery): Promise<ArtifactAddReport>;
20
+ /** Pull an artifact from a remote registry. */
21
+ pull(query: ArtifactPullQuery): Promise<ArtifactPullReport>;
22
+ /** Remove one or more artifacts. */
23
+ removeAll(query?: ArtifactRemoveAllQuery): Promise<ArtifactRemoveReport>;
24
+ }
25
+ //# sourceMappingURL=artifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/api/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OA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ports.ArtifactsApi = void 0;
4
+ const errors_js_1 = require("../types/errors.js");
5
+ const query_js_1 = require("../internal/query.js");
6
+ class ArtifactsApi {
7
+ #t;
8
+ constructor(transport) {
9
+ this.#t = transport;
10
+ }
11
+ /** Remove a single artifact by name or ID. */
12
+ async remove(nameOrId) {
13
+ const path = `/artifacts/${encodeURIComponent(nameOrId)}`;
14
+ const { status, json } = await this.#t.request("DELETE", path);
15
+ if (status !== 200)
16
+ throw (0, errors_js_1.createPodmanError)(status, json, "DELETE", path);
17
+ return json;
18
+ }
19
+ /** Extract an artifact's contents as a tar archive stream. */
20
+ async extract(nameOrId, query) {
21
+ const path = `/artifacts/${encodeURIComponent(nameOrId)}/extract${(0, query_js_1.buildQuery)(query)}`;
22
+ return await this.#t.requestStream("GET", path);
23
+ }
24
+ /** Inspect an artifact. Returns `null` if not found. */
25
+ async inspect(nameOrId) {
26
+ const path = `/artifacts/${encodeURIComponent(nameOrId)}/json`;
27
+ const { status, json } = await this.#t.request("GET", path);
28
+ if (status === 404)
29
+ return null;
30
+ if (status !== 200)
31
+ throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
32
+ return json;
33
+ }
34
+ /** Push an artifact to a remote registry. */
35
+ async push(nameOrId, query) {
36
+ const path = `/artifacts/${encodeURIComponent(nameOrId)}/push${(0, query_js_1.buildQuery)(query)}`;
37
+ const headers = {};
38
+ const authHeader = this.#t.getAuthHeader();
39
+ if (authHeader)
40
+ headers["X-Registry-Auth"] = authHeader;
41
+ const res = await this.#t.requestRaw("POST", path, undefined, headers);
42
+ if (res.status !== 200)
43
+ await (0, errors_js_1.throwRawError)(res, "POST", path);
44
+ return (await res.json());
45
+ }
46
+ /** Add a file as a new artifact. */
47
+ async add(body, query) {
48
+ const path = `/artifacts/add${(0, query_js_1.buildQuery)(query)}`;
49
+ const res = await this.#t.requestRaw("POST", path, body, {
50
+ "Content-Type": "application/octet-stream",
51
+ });
52
+ if (res.status !== 201)
53
+ await (0, errors_js_1.throwRawError)(res, "POST", path);
54
+ return (await res.json());
55
+ }
56
+ /** List all artifacts. */
57
+ async list() {
58
+ const path = "/artifacts/json";
59
+ const { status, json } = await this.#t.request("GET", path);
60
+ if (status !== 200)
61
+ throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
62
+ return (json ?? []);
63
+ }
64
+ /** Add a local file as an artifact. */
65
+ async addLocal(query) {
66
+ const path = `/artifacts/local/add${(0, query_js_1.buildQuery)(query)}`;
67
+ const { status, json } = await this.#t.request("POST", path);
68
+ if (status !== 201)
69
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
70
+ return json;
71
+ }
72
+ /** Pull an artifact from a remote registry. */
73
+ async pull(query) {
74
+ const path = `/artifacts/pull${(0, query_js_1.buildQuery)(query)}`;
75
+ const headers = {};
76
+ const authHeader = this.#t.getAuthHeader();
77
+ if (authHeader)
78
+ headers["X-Registry-Auth"] = authHeader;
79
+ const res = await this.#t.requestRaw("POST", path, undefined, headers);
80
+ if (res.status !== 200)
81
+ await (0, errors_js_1.throwRawError)(res, "POST", path);
82
+ return (await res.json());
83
+ }
84
+ /** Remove one or more artifacts. */
85
+ async removeAll(query) {
86
+ const path = `/artifacts/remove${(0, query_js_1.buildQuery)(query)}`;
87
+ const { status, json } = await this.#t.request("DELETE", path);
88
+ if (status !== 200)
89
+ throw (0, errors_js_1.createPodmanError)(status, json, "DELETE", path);
90
+ return json;
91
+ }
92
+ }
93
+ exports.ArtifactsApi = ArtifactsApi;
@@ -0,0 +1,71 @@
1
+ import type { Transport } from "../transport.js";
2
+ import type { ContainerArchiveQuery, ContainerArchivePutQuery, ContainerAttachQuery, ContainerChange, ContainerChangesQuery, ContainerCheckpointQuery, ContainerCreateResponse, ContainerStatsAllQuery, ContainerKillQuery, ContainerListQuery, ContainerLogsQuery, ContainerPruneQuery, ContainerRemoveQuery, ContainerResizeQuery, ContainerRestartQuery, ContainerRestoreQuery, ContainersPruneReport, ContainerStatsQuery, ContainerStopQuery, ContainerTopQuery, ContainerTopResponse, ContainerUpdateQuery, ContainerWaitQuery, HealthCheckResults, InspectContainerData, ListContainer, SpecGenerator, UpdateEntities } from "../types/api.js";
3
+ export declare class ContainersApi {
4
+ #private;
5
+ constructor(transport: Transport);
6
+ /** Create a new container from the given spec. */
7
+ create(spec: SpecGenerator): Promise<ContainerCreateResponse>;
8
+ /** Inspect a container. Returns `null` if the container is not found. */
9
+ inspect(nameOrId: string): Promise<InspectContainerData | null>;
10
+ /** List containers, optionally filtered by the given query. */
11
+ list(query?: ContainerListQuery): Promise<ListContainer[]>;
12
+ /** Start a container. */
13
+ start(nameOrId: string): Promise<void>;
14
+ /** Stop a container with an optional timeout. */
15
+ stop(nameOrId: string, query?: ContainerStopQuery): Promise<void>;
16
+ /** Restart a container with an optional timeout. */
17
+ restart(nameOrId: string, query?: ContainerRestartQuery): Promise<void>;
18
+ /** Send a signal to a container (default SIGTERM). */
19
+ kill(nameOrId: string, query?: ContainerKillQuery): Promise<void>;
20
+ /** Pause all processes in a container. */
21
+ pause(nameOrId: string): Promise<void>;
22
+ /** Unpause all processes in a container. */
23
+ unpause(nameOrId: string): Promise<void>;
24
+ /** Remove a container. Use query options to force-remove or remove volumes. */
25
+ remove(nameOrId: string, query?: ContainerRemoveQuery): Promise<void>;
26
+ /** Stream container logs as raw bytes. */
27
+ logs(nameOrId: string, query?: ContainerLogsQuery): Promise<ReadableStream<Uint8Array>>;
28
+ /** List processes running inside a container. */
29
+ top(nameOrId: string, query?: ContainerTopQuery): Promise<ContainerTopResponse>;
30
+ /** Wait for a container to meet a given condition. Returns the exit code. */
31
+ wait(nameOrId: string, query?: ContainerWaitQuery): Promise<number>;
32
+ /** Rename a container. */
33
+ rename(nameOrId: string, newName: string): Promise<void>;
34
+ /** Resize a container's TTY dimensions. */
35
+ resize(nameOrId: string, query: ContainerResizeQuery): Promise<void>;
36
+ /** Export a container's filesystem as a tar stream. */
37
+ export(nameOrId: string): Promise<ReadableStream<Uint8Array>>;
38
+ /** Checkpoint a running container using CRIU. */
39
+ checkpoint(nameOrId: string, query?: ContainerCheckpointQuery): Promise<void>;
40
+ /** Restore a previously checkpointed container. */
41
+ restore(nameOrId: string, query?: ContainerRestoreQuery): Promise<void>;
42
+ /** Check if a container exists. Returns `true` on 204, `false` otherwise. */
43
+ exists(nameOrId: string): Promise<boolean>;
44
+ /** Remove stopped containers. Returns a list of pruned containers. */
45
+ prune(query?: ContainerPruneQuery): Promise<ContainersPruneReport[]>;
46
+ /** Stream resource usage statistics for a container. */
47
+ stats(nameOrId: string, query?: ContainerStatsQuery): Promise<ReadableStream<Uint8Array>>;
48
+ /** Attach to a container and stream its output. */
49
+ attach(nameOrId: string, query?: ContainerAttachQuery): Promise<ReadableStream<Uint8Array>>;
50
+ /** Download a file or directory from a container as a tar archive stream. */
51
+ getArchive(nameOrId: string, query: ContainerArchiveQuery): Promise<ReadableStream<Uint8Array>>;
52
+ /** Upload a tar archive stream into a container at the specified path. */
53
+ putArchive(nameOrId: string, body: ReadableStream<Uint8Array>, query: ContainerArchivePutQuery): Promise<void>;
54
+ /** Run a container health check and return the results. */
55
+ healthcheck(nameOrId: string): Promise<HealthCheckResults>;
56
+ /** Initialize a container, preparing it to be started. */
57
+ init(nameOrId: string): Promise<void>;
58
+ /** Update a container's resource limits. */
59
+ update(nameOrId: string, resources: UpdateEntities, query?: ContainerUpdateQuery): Promise<void>;
60
+ /** List filesystem changes made inside a container. */
61
+ changes(nameOrId: string, query?: ContainerChangesQuery): Promise<ContainerChange[]>;
62
+ /** Mount a container's filesystem. Returns the mount path. */
63
+ mount(nameOrId: string): Promise<string>;
64
+ /** Unmount a container's filesystem. */
65
+ unmount(nameOrId: string): Promise<void>;
66
+ /** List all mounted containers and their mount points. */
67
+ showMounted(): Promise<Record<string, string>>;
68
+ /** Stream resource usage statistics for all containers. */
69
+ statsAll(query?: ContainerStatsAllQuery): Promise<ReadableStream<Uint8Array>>;
70
+ }
71
+ //# sourceMappingURL=containers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3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Q,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAO9C,wCAAwC;IAClC,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAM9C,0DAA0D;IACpD,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAOpD,2DAA2D;IACrD,QAAQ,CACZ,KAAK,CAAC,EAAE,sBAAsB,GAC7B,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;CAIvC"}
@@ -0,0 +1,238 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContainersApi = void 0;
4
+ const errors_js_1 = require("../types/errors.js");
5
+ const query_js_1 = require("../internal/query.js");
6
+ class ContainersApi {
7
+ #t;
8
+ constructor(transport) {
9
+ this.#t = transport;
10
+ }
11
+ /** Create a new container from the given spec. */
12
+ async create(spec) {
13
+ const path = "/containers/create";
14
+ const { status, json } = await this.#t.request("POST", path, spec);
15
+ if (status !== 201)
16
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
17
+ return json;
18
+ }
19
+ /** Inspect a container. Returns `null` if the container is not found. */
20
+ async inspect(nameOrId) {
21
+ const path = `/containers/${encodeURIComponent(nameOrId)}/json`;
22
+ const { status, json } = await this.#t.request("GET", path);
23
+ if (status === 404)
24
+ return null;
25
+ if (status !== 200)
26
+ throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
27
+ return json;
28
+ }
29
+ /** List containers, optionally filtered by the given query. */
30
+ async list(query) {
31
+ const path = `/containers/json${(0, query_js_1.buildQuery)(query)}`;
32
+ const { status, json } = await this.#t.request("GET", path);
33
+ if (status !== 200)
34
+ throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
35
+ return (json ?? []);
36
+ }
37
+ /** Start a container. */
38
+ async start(nameOrId) {
39
+ const path = `/containers/${encodeURIComponent(nameOrId)}/start`;
40
+ const { status, json } = await this.#t.request("POST", path);
41
+ if (status !== 204 && status !== 304)
42
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
43
+ }
44
+ /** Stop a container with an optional timeout. */
45
+ async stop(nameOrId, query) {
46
+ const path = `/containers/${encodeURIComponent(nameOrId)}/stop${(0, query_js_1.buildQuery)(query)}`;
47
+ const { status, json } = await this.#t.request("POST", path);
48
+ if (status !== 204 && status !== 304)
49
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
50
+ }
51
+ /** Restart a container with an optional timeout. */
52
+ async restart(nameOrId, query) {
53
+ const path = `/containers/${encodeURIComponent(nameOrId)}/restart${(0, query_js_1.buildQuery)(query)}`;
54
+ const { status, json } = await this.#t.request("POST", path);
55
+ if (status !== 204)
56
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
57
+ }
58
+ /** Send a signal to a container (default SIGTERM). */
59
+ async kill(nameOrId, query) {
60
+ const path = `/containers/${encodeURIComponent(nameOrId)}/kill${(0, query_js_1.buildQuery)(query)}`;
61
+ const { status, json } = await this.#t.request("POST", path);
62
+ if (status !== 204)
63
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
64
+ }
65
+ /** Pause all processes in a container. */
66
+ async pause(nameOrId) {
67
+ const path = `/containers/${encodeURIComponent(nameOrId)}/pause`;
68
+ const { status, json } = await this.#t.request("POST", path);
69
+ if (status !== 204)
70
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
71
+ }
72
+ /** Unpause all processes in a container. */
73
+ async unpause(nameOrId) {
74
+ const path = `/containers/${encodeURIComponent(nameOrId)}/unpause`;
75
+ const { status, json } = await this.#t.request("POST", path);
76
+ if (status !== 204)
77
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
78
+ }
79
+ /** Remove a container. Use query options to force-remove or remove volumes. */
80
+ async remove(nameOrId, query) {
81
+ const path = `/containers/${encodeURIComponent(nameOrId)}${(0, query_js_1.buildQuery)(query)}`;
82
+ const { status, json } = await this.#t.request("DELETE", path);
83
+ if (status !== 200 && status !== 204) {
84
+ throw (0, errors_js_1.createPodmanError)(status, json, "DELETE", path);
85
+ }
86
+ }
87
+ /** Stream container logs as raw bytes. */
88
+ async logs(nameOrId, query) {
89
+ const path = `/containers/${encodeURIComponent(nameOrId)}/logs${(0, query_js_1.buildQuery)(query)}`;
90
+ return await this.#t.requestStream("GET", path);
91
+ }
92
+ /** List processes running inside a container. */
93
+ async top(nameOrId, query) {
94
+ const path = `/containers/${encodeURIComponent(nameOrId)}/top${(0, query_js_1.buildQuery)(query)}`;
95
+ const { status, json } = await this.#t.request("GET", path);
96
+ if (status !== 200)
97
+ throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
98
+ return json;
99
+ }
100
+ /** Wait for a container to meet a given condition. Returns the exit code. */
101
+ async wait(nameOrId, query) {
102
+ const path = `/containers/${encodeURIComponent(nameOrId)}/wait${(0, query_js_1.buildQuery)(query)}`;
103
+ const { status, json } = await this.#t.request("POST", path);
104
+ if (status !== 200)
105
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
106
+ return json;
107
+ }
108
+ /** Rename a container. */
109
+ async rename(nameOrId, newName) {
110
+ const path = `/containers/${encodeURIComponent(nameOrId)}/rename${(0, query_js_1.buildQuery)({ name: newName })}`;
111
+ const { status, json } = await this.#t.request("POST", path);
112
+ if (status !== 204)
113
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
114
+ }
115
+ /** Resize a container's TTY dimensions. */
116
+ async resize(nameOrId, query) {
117
+ const path = `/containers/${encodeURIComponent(nameOrId)}/resize${(0, query_js_1.buildQuery)(query)}`;
118
+ const { status, json } = await this.#t.request("POST", path);
119
+ if (status !== 200)
120
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
121
+ }
122
+ /** Export a container's filesystem as a tar stream. */
123
+ async export(nameOrId) {
124
+ const path = `/containers/${encodeURIComponent(nameOrId)}/export`;
125
+ return await this.#t.requestStream("GET", path);
126
+ }
127
+ /** Checkpoint a running container using CRIU. */
128
+ async checkpoint(nameOrId, query) {
129
+ const path = `/containers/${encodeURIComponent(nameOrId)}/checkpoint${(0, query_js_1.buildQuery)(query)}`;
130
+ const { status, json } = await this.#t.request("POST", path);
131
+ if (status !== 200)
132
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
133
+ }
134
+ /** Restore a previously checkpointed container. */
135
+ async restore(nameOrId, query) {
136
+ const path = `/containers/${encodeURIComponent(nameOrId)}/restore${(0, query_js_1.buildQuery)(query)}`;
137
+ const { status, json } = await this.#t.request("POST", path);
138
+ if (status !== 200)
139
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
140
+ }
141
+ /** Check if a container exists. Returns `true` on 204, `false` otherwise. */
142
+ async exists(nameOrId) {
143
+ const path = `/containers/${encodeURIComponent(nameOrId)}/exists`;
144
+ const { status } = await this.#t.request("GET", path);
145
+ return status === 204;
146
+ }
147
+ /** Remove stopped containers. Returns a list of pruned containers. */
148
+ async prune(query) {
149
+ const path = `/containers/prune${(0, query_js_1.buildQuery)(query)}`;
150
+ const { status, json } = await this.#t.request("POST", path);
151
+ if (status !== 200)
152
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
153
+ return (json ?? []);
154
+ }
155
+ /** Stream resource usage statistics for a container. */
156
+ async stats(nameOrId, query) {
157
+ const path = `/containers/${encodeURIComponent(nameOrId)}/stats${(0, query_js_1.buildQuery)(query)}`;
158
+ return await this.#t.requestStream("GET", path);
159
+ }
160
+ /** Attach to a container and stream its output. */
161
+ async attach(nameOrId, query) {
162
+ const path = `/containers/${encodeURIComponent(nameOrId)}/attach${(0, query_js_1.buildQuery)(query)}`;
163
+ return await this.#t.requestStream("POST", path);
164
+ }
165
+ /** Download a file or directory from a container as a tar archive stream. */
166
+ async getArchive(nameOrId, query) {
167
+ const path = `/containers/${encodeURIComponent(nameOrId)}/archive${(0, query_js_1.buildQuery)(query)}`;
168
+ return await this.#t.requestStream("GET", path);
169
+ }
170
+ /** Upload a tar archive stream into a container at the specified path. */
171
+ async putArchive(nameOrId, body, query) {
172
+ const path = `/containers/${encodeURIComponent(nameOrId)}/archive${(0, query_js_1.buildQuery)(query)}`;
173
+ const res = await this.#t.requestRaw("PUT", path, body, {
174
+ "Content-Type": "application/x-tar",
175
+ });
176
+ if (res.status !== 200)
177
+ await (0, errors_js_1.throwRawError)(res, "PUT", path);
178
+ }
179
+ /** Run a container health check and return the results. */
180
+ async healthcheck(nameOrId) {
181
+ const path = `/containers/${encodeURIComponent(nameOrId)}/healthcheck`;
182
+ const { status, json } = await this.#t.request("GET", path);
183
+ if (status !== 200)
184
+ throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
185
+ return json;
186
+ }
187
+ /** Initialize a container, preparing it to be started. */
188
+ async init(nameOrId) {
189
+ const path = `/containers/${encodeURIComponent(nameOrId)}/init`;
190
+ const { status, json } = await this.#t.request("POST", path);
191
+ if (status !== 204 && status !== 304)
192
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
193
+ }
194
+ /** Update a container's resource limits. */
195
+ async update(nameOrId, resources, query) {
196
+ const path = `/containers/${encodeURIComponent(nameOrId)}/update${(0, query_js_1.buildQuery)(query)}`;
197
+ const { status, json } = await this.#t.request("POST", path, resources);
198
+ if (status !== 201)
199
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
200
+ }
201
+ /** List filesystem changes made inside a container. */
202
+ async changes(nameOrId, query) {
203
+ const path = `/containers/${encodeURIComponent(nameOrId)}/changes${(0, query_js_1.buildQuery)(query)}`;
204
+ const { status, json } = await this.#t.request("GET", path);
205
+ if (status !== 200)
206
+ throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
207
+ return (json ?? []);
208
+ }
209
+ /** Mount a container's filesystem. Returns the mount path. */
210
+ async mount(nameOrId) {
211
+ const path = `/containers/${encodeURIComponent(nameOrId)}/mount`;
212
+ const { status, json } = await this.#t.request("POST", path);
213
+ if (status !== 200)
214
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
215
+ return json;
216
+ }
217
+ /** Unmount a container's filesystem. */
218
+ async unmount(nameOrId) {
219
+ const path = `/containers/${encodeURIComponent(nameOrId)}/unmount`;
220
+ const { status, json } = await this.#t.request("POST", path);
221
+ if (status !== 204)
222
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
223
+ }
224
+ /** List all mounted containers and their mount points. */
225
+ async showMounted() {
226
+ const path = "/containers/showmounted";
227
+ const { status, json } = await this.#t.request("GET", path);
228
+ if (status !== 200)
229
+ throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
230
+ return json;
231
+ }
232
+ /** Stream resource usage statistics for all containers. */
233
+ async statsAll(query) {
234
+ const path = `/containers/stats${(0, query_js_1.buildQuery)(query)}`;
235
+ return await this.#t.requestStream("GET", path);
236
+ }
237
+ }
238
+ exports.ContainersApi = ContainersApi;
@@ -0,0 +1,15 @@
1
+ import type { Transport } from "../transport.js";
2
+ import type { ExecCreateConfig, ExecResizeQuery, ExecStartConfig, InspectExecSession } from "../types/api.js";
3
+ export declare class ExecApi {
4
+ #private;
5
+ constructor(transport: Transport);
6
+ /** Create an exec session inside a container. Returns the exec session ID. */
7
+ create(nameOrId: string, config: ExecCreateConfig): Promise<string>;
8
+ /** Start an exec session and stream its output. */
9
+ start(id: string, config?: ExecStartConfig): Promise<ReadableStream<Uint8Array>>;
10
+ /** Inspect an exec session. */
11
+ inspect(id: string): Promise<InspectExecSession>;
12
+ /** Resize an exec session's TTY dimensions. */
13
+ resize(id: string, query: ExecResizeQuery): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=exec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/api/exec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,qBAAa,OAAO;;gBAEN,SAAS,EAAE,SAAS;IAIhC,8EAA8E;IACxE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAUzE,mDAAmD;IAC7C,KAAK,CACT,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAetC,+BAA+B;IACzB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOtD,+CAA+C;IACzC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAMhE"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExecApi = void 0;
4
+ const errors_js_1 = require("../types/errors.js");
5
+ const query_js_1 = require("../internal/query.js");
6
+ class ExecApi {
7
+ #t;
8
+ constructor(transport) {
9
+ this.#t = transport;
10
+ }
11
+ /** Create an exec session inside a container. Returns the exec session ID. */
12
+ async create(nameOrId, config) {
13
+ const path = `/containers/${encodeURIComponent(nameOrId)}/exec`;
14
+ const res = await this.#t.requestRaw("POST", path, JSON.stringify(config), {
15
+ "Content-Type": "application/json",
16
+ });
17
+ if (res.status !== 201)
18
+ await (0, errors_js_1.throwRawError)(res, "POST", path);
19
+ const result = await res.json();
20
+ return result.Id;
21
+ }
22
+ /** Start an exec session and stream its output. */
23
+ async start(id, config) {
24
+ const path = `/exec/${encodeURIComponent(id)}/start`;
25
+ const res = await this.#t.requestRaw("POST", path, JSON.stringify(config ?? {}), { "Content-Type": "application/json" });
26
+ if (res.status >= 400)
27
+ await (0, errors_js_1.throwRawError)(res, "POST", path);
28
+ if (!res.body) {
29
+ throw new Error(`No response body for POST ${path}`);
30
+ }
31
+ return res.body;
32
+ }
33
+ /** Inspect an exec session. */
34
+ async inspect(id) {
35
+ const path = `/exec/${encodeURIComponent(id)}/json`;
36
+ const { status, json } = await this.#t.request("GET", path);
37
+ if (status !== 200)
38
+ throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
39
+ return json;
40
+ }
41
+ /** Resize an exec session's TTY dimensions. */
42
+ async resize(id, query) {
43
+ const path = `/exec/${encodeURIComponent(id)}/resize${(0, query_js_1.buildQuery)(query)}`;
44
+ const { status, json } = await this.#t.request("POST", path);
45
+ if (status !== 201)
46
+ throw (0, errors_js_1.createPodmanError)(status, json, "POST", path);
47
+ }
48
+ }
49
+ exports.ExecApi = ExecApi;
@@ -0,0 +1,11 @@
1
+ import type { Transport } from "../transport.js";
2
+ import type { GenerateKubeQuery, GenerateSystemdQuery } from "../types/api.js";
3
+ export declare class GenerateApi {
4
+ #private;
5
+ constructor(transport: Transport);
6
+ /** Generate systemd unit files for a container or pod. Returns a map of unit name to content. */
7
+ systemd(nameOrId: string, query?: GenerateSystemdQuery): Promise<Record<string, string>>;
8
+ /** Generate a Kubernetes YAML manifest for a container or pod. */
9
+ kube(query: GenerateKubeQuery): Promise<string>;
10
+ }
11
+ //# sourceMappingURL=generate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/api/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB,qBAAa,WAAW;;gBAEV,SAAS,EAAE,SAAS;IAIhC,iGAAiG;IAC3F,OAAO,CACX,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,oBAAoB,GAC3B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAQlC,kEAAkE;IAC5D,IAAI,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;CAMtD"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenerateApi = void 0;
4
+ const errors_js_1 = require("../types/errors.js");
5
+ const query_js_1 = require("../internal/query.js");
6
+ class GenerateApi {
7
+ #t;
8
+ constructor(transport) {
9
+ this.#t = transport;
10
+ }
11
+ /** Generate systemd unit files for a container or pod. Returns a map of unit name to content. */
12
+ async systemd(nameOrId, query) {
13
+ const path = `/generate/${encodeURIComponent(nameOrId)}/systemd${(0, query_js_1.buildQuery)(query)}`;
14
+ const { status, json } = await this.#t.request("GET", path);
15
+ if (status !== 200)
16
+ throw (0, errors_js_1.createPodmanError)(status, json, "GET", path);
17
+ return json;
18
+ }
19
+ /** Generate a Kubernetes YAML manifest for a container or pod. */
20
+ async kube(query) {
21
+ const path = `/generate/kube${(0, query_js_1.buildQuery)(query)}`;
22
+ const res = await this.#t.requestRaw("GET", path);
23
+ if (res.status >= 400)
24
+ await (0, errors_js_1.throwRawError)(res, "GET", path);
25
+ return await res.text();
26
+ }
27
+ }
28
+ exports.GenerateApi = GenerateApi;