@procedures/docker 0.34.0 → 0.35.1

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/src/types.ts CHANGED
@@ -5,23 +5,14 @@
5
5
  */
6
6
 
7
7
  import { z } from "zod";
8
+ import { cliToolOutputFields, cliToolOutputSchema, type CliToolOutput } from "@procedures/shell/cli";
8
9
 
9
10
  // =============================================================================
10
11
  // Shared Output Type
11
12
  // =============================================================================
12
13
 
13
- export interface DockerCommandOutput {
14
- /** Exit code of the command */
15
- exitCode: number;
16
- /** Standard output */
17
- stdout: string;
18
- /** Standard error */
19
- stderr: string;
20
- /** Whether command succeeded (exit code 0) */
21
- success: boolean;
22
- /** Duration in milliseconds */
23
- duration: number;
24
- }
14
+ /** The result of a docker command: the shared result of a CLI tool (`@procedures/shell/cli`). */
15
+ export interface DockerCommandOutput extends CliToolOutput {}
25
16
 
26
17
  /** One item of a followed log: a line of the container, or the end of `docker logs` (the last item). */
27
18
  export type DockerLogItem =
@@ -39,13 +30,7 @@ export type DockerLogItem =
39
30
  // result (a strict schema would remove it when the output is validated).
40
31
 
41
32
  /** The result of a docker command: every docker.* procedure gives it. */
42
- export const DockerCommandOutputSchema: z.ZodType<DockerCommandOutput> = z.looseObject({
43
- exitCode: z.number().describe("The exit code of docker (0 is success)"),
44
- stdout: z.string().describe("The standard output of docker"),
45
- stderr: z.string().describe("The standard error of docker, or the error message when docker did not start"),
46
- success: z.boolean().describe("True when the exit code is 0"),
47
- duration: z.number().describe("The time of the command, in milliseconds"),
48
- });
33
+ export const DockerCommandOutputSchema: z.ZodType<DockerCommandOutput> = cliToolOutputSchema("docker");
49
34
 
50
35
  /** docker.logs: one result, or with follow a stream of lines and one last exit item. */
51
36
  export const DockerLogsOutputSchema: z.ZodType<DockerCommandOutput | DockerLogItem> = z.union([
@@ -697,10 +682,6 @@ export const DockerPushOutputSchema: z.ZodType<DockerPushOutput> = DockerCommand
697
682
  export const DockerPruneOutputSchema: z.ZodType<DockerPruneOutput> = DockerCommandOutputSchema;
698
683
 
699
684
  export const DockerInspectOutputSchema: z.ZodType<DockerInspectOutput> = z.looseObject({
700
- exitCode: z.number().describe("The exit code of docker (0 is success)"),
701
- stdout: z.string().describe("The standard output of docker"),
702
- stderr: z.string().describe("The standard error of docker, or the error message when docker did not start"),
703
- success: z.boolean().describe("True when the exit code is 0"),
704
- duration: z.number().describe("The time of the command, in milliseconds"),
685
+ ...cliToolOutputFields("docker"),
705
686
  data: z.unknown().optional().describe("The parsed JSON of docker: one object for each target"),
706
687
  });