@paretools/docker 0.2.0 → 0.5.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/README.md +87 -0
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/docker-runner.d.ts.map +1 -1
- package/dist/lib/docker-runner.js +4 -1
- package/dist/lib/docker-runner.js.map +1 -1
- package/dist/lib/formatters.d.ts +15 -1
- package/dist/lib/formatters.d.ts.map +1 -1
- package/dist/lib/formatters.js +41 -0
- package/dist/lib/formatters.js.map +1 -1
- package/dist/lib/parsers.d.ts +15 -1
- package/dist/lib/parsers.d.ts.map +1 -1
- package/dist/lib/parsers.js +93 -0
- package/dist/lib/parsers.js.map +1 -1
- package/dist/schemas/index.d.ts +82 -176
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +39 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/tools/build.js +1 -1
- package/dist/tools/build.js.map +1 -1
- package/dist/tools/compose-down.d.ts +3 -0
- package/dist/tools/compose-down.d.ts.map +1 -0
- package/dist/tools/compose-down.js +44 -0
- package/dist/tools/compose-down.js.map +1 -0
- package/dist/tools/compose-up.d.ts +3 -0
- package/dist/tools/compose-up.d.ts.map +1 -0
- package/dist/tools/compose-up.js +48 -0
- package/dist/tools/compose-up.js.map +1 -0
- package/dist/tools/exec.d.ts +3 -0
- package/dist/tools/exec.d.ts.map +1 -0
- package/dist/tools/exec.js +37 -0
- package/dist/tools/exec.js.map +1 -0
- package/dist/tools/images.d.ts.map +1 -1
- package/dist/tools/images.js +1 -1
- package/dist/tools/images.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +10 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/logs.d.ts.map +1 -1
- package/dist/tools/logs.js +1 -1
- package/dist/tools/logs.js.map +1 -1
- package/dist/tools/ps.d.ts.map +1 -1
- package/dist/tools/ps.js +1 -1
- package/dist/tools/ps.js.map +1 -1
- package/dist/tools/pull.d.ts +3 -0
- package/dist/tools/pull.d.ts.map +1 -0
- package/dist/tools/pull.js +35 -0
- package/dist/tools/pull.js.map +1 -0
- package/dist/tools/run.d.ts +3 -0
- package/dist/tools/run.d.ts.map +1 -0
- package/dist/tools/run.js +78 -0
- package/dist/tools/run.js.map +1 -0
- package/package.json +28 -5
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,187 +1,85 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/** Zod schema for a single Docker container with ID, name, image, state, and port mappings. */
|
|
2
3
|
export declare const ContainerSchema: z.ZodObject<{
|
|
3
4
|
id: z.ZodString;
|
|
4
5
|
name: z.ZodString;
|
|
5
6
|
image: z.ZodString;
|
|
6
7
|
status: z.ZodString;
|
|
7
|
-
state: z.ZodEnum<
|
|
8
|
+
state: z.ZodEnum<{
|
|
9
|
+
running: "running";
|
|
10
|
+
exited: "exited";
|
|
11
|
+
paused: "paused";
|
|
12
|
+
restarting: "restarting";
|
|
13
|
+
dead: "dead";
|
|
14
|
+
created: "created";
|
|
15
|
+
removing: "removing";
|
|
16
|
+
}>;
|
|
8
17
|
ports: z.ZodArray<z.ZodObject<{
|
|
9
18
|
host: z.ZodOptional<z.ZodNumber>;
|
|
10
19
|
container: z.ZodNumber;
|
|
11
|
-
protocol: z.ZodEnum<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}, {
|
|
17
|
-
container: number;
|
|
18
|
-
protocol: "tcp" | "udp";
|
|
19
|
-
host?: number | undefined;
|
|
20
|
-
}>, "many">;
|
|
20
|
+
protocol: z.ZodEnum<{
|
|
21
|
+
tcp: "tcp";
|
|
22
|
+
udp: "udp";
|
|
23
|
+
}>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
21
25
|
created: z.ZodString;
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
name: string;
|
|
25
|
-
image: string;
|
|
26
|
-
status: string;
|
|
27
|
-
state: "running" | "exited" | "paused" | "restarting" | "dead" | "created" | "removing";
|
|
28
|
-
created: string;
|
|
29
|
-
ports: {
|
|
30
|
-
container: number;
|
|
31
|
-
protocol: "tcp" | "udp";
|
|
32
|
-
host?: number | undefined;
|
|
33
|
-
}[];
|
|
34
|
-
}, {
|
|
35
|
-
id: string;
|
|
36
|
-
name: string;
|
|
37
|
-
image: string;
|
|
38
|
-
status: string;
|
|
39
|
-
state: "running" | "exited" | "paused" | "restarting" | "dead" | "created" | "removing";
|
|
40
|
-
created: string;
|
|
41
|
-
ports: {
|
|
42
|
-
container: number;
|
|
43
|
-
protocol: "tcp" | "udp";
|
|
44
|
-
host?: number | undefined;
|
|
45
|
-
}[];
|
|
46
|
-
}>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
/** Zod schema for structured docker ps output with container list and running/stopped counts. */
|
|
47
28
|
export declare const DockerPsSchema: z.ZodObject<{
|
|
48
29
|
containers: z.ZodArray<z.ZodObject<{
|
|
49
30
|
id: z.ZodString;
|
|
50
31
|
name: z.ZodString;
|
|
51
32
|
image: z.ZodString;
|
|
52
33
|
status: z.ZodString;
|
|
53
|
-
state: z.ZodEnum<
|
|
34
|
+
state: z.ZodEnum<{
|
|
35
|
+
running: "running";
|
|
36
|
+
exited: "exited";
|
|
37
|
+
paused: "paused";
|
|
38
|
+
restarting: "restarting";
|
|
39
|
+
dead: "dead";
|
|
40
|
+
created: "created";
|
|
41
|
+
removing: "removing";
|
|
42
|
+
}>;
|
|
54
43
|
ports: z.ZodArray<z.ZodObject<{
|
|
55
44
|
host: z.ZodOptional<z.ZodNumber>;
|
|
56
45
|
container: z.ZodNumber;
|
|
57
|
-
protocol: z.ZodEnum<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, {
|
|
63
|
-
container: number;
|
|
64
|
-
protocol: "tcp" | "udp";
|
|
65
|
-
host?: number | undefined;
|
|
66
|
-
}>, "many">;
|
|
46
|
+
protocol: z.ZodEnum<{
|
|
47
|
+
tcp: "tcp";
|
|
48
|
+
udp: "udp";
|
|
49
|
+
}>;
|
|
50
|
+
}, z.core.$strip>>;
|
|
67
51
|
created: z.ZodString;
|
|
68
|
-
},
|
|
69
|
-
id: string;
|
|
70
|
-
name: string;
|
|
71
|
-
image: string;
|
|
72
|
-
status: string;
|
|
73
|
-
state: "running" | "exited" | "paused" | "restarting" | "dead" | "created" | "removing";
|
|
74
|
-
created: string;
|
|
75
|
-
ports: {
|
|
76
|
-
container: number;
|
|
77
|
-
protocol: "tcp" | "udp";
|
|
78
|
-
host?: number | undefined;
|
|
79
|
-
}[];
|
|
80
|
-
}, {
|
|
81
|
-
id: string;
|
|
82
|
-
name: string;
|
|
83
|
-
image: string;
|
|
84
|
-
status: string;
|
|
85
|
-
state: "running" | "exited" | "paused" | "restarting" | "dead" | "created" | "removing";
|
|
86
|
-
created: string;
|
|
87
|
-
ports: {
|
|
88
|
-
container: number;
|
|
89
|
-
protocol: "tcp" | "udp";
|
|
90
|
-
host?: number | undefined;
|
|
91
|
-
}[];
|
|
92
|
-
}>, "many">;
|
|
52
|
+
}, z.core.$strip>>;
|
|
93
53
|
total: z.ZodNumber;
|
|
94
54
|
running: z.ZodNumber;
|
|
95
55
|
stopped: z.ZodNumber;
|
|
96
|
-
},
|
|
97
|
-
running: number;
|
|
98
|
-
containers: {
|
|
99
|
-
id: string;
|
|
100
|
-
name: string;
|
|
101
|
-
image: string;
|
|
102
|
-
status: string;
|
|
103
|
-
state: "running" | "exited" | "paused" | "restarting" | "dead" | "created" | "removing";
|
|
104
|
-
created: string;
|
|
105
|
-
ports: {
|
|
106
|
-
container: number;
|
|
107
|
-
protocol: "tcp" | "udp";
|
|
108
|
-
host?: number | undefined;
|
|
109
|
-
}[];
|
|
110
|
-
}[];
|
|
111
|
-
total: number;
|
|
112
|
-
stopped: number;
|
|
113
|
-
}, {
|
|
114
|
-
running: number;
|
|
115
|
-
containers: {
|
|
116
|
-
id: string;
|
|
117
|
-
name: string;
|
|
118
|
-
image: string;
|
|
119
|
-
status: string;
|
|
120
|
-
state: "running" | "exited" | "paused" | "restarting" | "dead" | "created" | "removing";
|
|
121
|
-
created: string;
|
|
122
|
-
ports: {
|
|
123
|
-
container: number;
|
|
124
|
-
protocol: "tcp" | "udp";
|
|
125
|
-
host?: number | undefined;
|
|
126
|
-
}[];
|
|
127
|
-
}[];
|
|
128
|
-
total: number;
|
|
129
|
-
stopped: number;
|
|
130
|
-
}>;
|
|
56
|
+
}, z.core.$strip>;
|
|
131
57
|
export type DockerPs = z.infer<typeof DockerPsSchema>;
|
|
58
|
+
/** Zod schema for structured docker build output with success status, image ID, and build errors. */
|
|
132
59
|
export declare const DockerBuildSchema: z.ZodObject<{
|
|
133
60
|
success: z.ZodBoolean;
|
|
134
61
|
imageId: z.ZodOptional<z.ZodString>;
|
|
135
62
|
duration: z.ZodNumber;
|
|
136
63
|
steps: z.ZodOptional<z.ZodNumber>;
|
|
137
|
-
errors: z.ZodArray<z.ZodString
|
|
138
|
-
},
|
|
139
|
-
success: boolean;
|
|
140
|
-
duration: number;
|
|
141
|
-
errors: string[];
|
|
142
|
-
imageId?: string | undefined;
|
|
143
|
-
steps?: number | undefined;
|
|
144
|
-
}, {
|
|
145
|
-
success: boolean;
|
|
146
|
-
duration: number;
|
|
147
|
-
errors: string[];
|
|
148
|
-
imageId?: string | undefined;
|
|
149
|
-
steps?: number | undefined;
|
|
150
|
-
}>;
|
|
64
|
+
errors: z.ZodArray<z.ZodString>;
|
|
65
|
+
}, z.core.$strip>;
|
|
151
66
|
export type DockerBuild = z.infer<typeof DockerBuildSchema>;
|
|
67
|
+
/** Zod schema for structured docker logs output with container name, log lines, and total count. */
|
|
152
68
|
export declare const DockerLogsSchema: z.ZodObject<{
|
|
153
69
|
container: z.ZodString;
|
|
154
|
-
lines: z.ZodArray<z.ZodString
|
|
70
|
+
lines: z.ZodArray<z.ZodString>;
|
|
155
71
|
total: z.ZodNumber;
|
|
156
|
-
},
|
|
157
|
-
container: string;
|
|
158
|
-
total: number;
|
|
159
|
-
lines: string[];
|
|
160
|
-
}, {
|
|
161
|
-
container: string;
|
|
162
|
-
total: number;
|
|
163
|
-
lines: string[];
|
|
164
|
-
}>;
|
|
72
|
+
}, z.core.$strip>;
|
|
165
73
|
export type DockerLogs = z.infer<typeof DockerLogsSchema>;
|
|
74
|
+
/** Zod schema for a single Docker image with ID, repository, tag, size, and creation time. */
|
|
166
75
|
export declare const ImageSchema: z.ZodObject<{
|
|
167
76
|
id: z.ZodString;
|
|
168
77
|
repository: z.ZodString;
|
|
169
78
|
tag: z.ZodString;
|
|
170
79
|
size: z.ZodString;
|
|
171
80
|
created: z.ZodString;
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
created: string;
|
|
175
|
-
repository: string;
|
|
176
|
-
tag: string;
|
|
177
|
-
size: string;
|
|
178
|
-
}, {
|
|
179
|
-
id: string;
|
|
180
|
-
created: string;
|
|
181
|
-
repository: string;
|
|
182
|
-
tag: string;
|
|
183
|
-
size: string;
|
|
184
|
-
}>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
/** Zod schema for structured docker images output with image list and total count. */
|
|
185
83
|
export declare const DockerImagesSchema: z.ZodObject<{
|
|
186
84
|
images: z.ZodArray<z.ZodObject<{
|
|
187
85
|
id: z.ZodString;
|
|
@@ -189,38 +87,46 @@ export declare const DockerImagesSchema: z.ZodObject<{
|
|
|
189
87
|
tag: z.ZodString;
|
|
190
88
|
size: z.ZodString;
|
|
191
89
|
created: z.ZodString;
|
|
192
|
-
},
|
|
193
|
-
id: string;
|
|
194
|
-
created: string;
|
|
195
|
-
repository: string;
|
|
196
|
-
tag: string;
|
|
197
|
-
size: string;
|
|
198
|
-
}, {
|
|
199
|
-
id: string;
|
|
200
|
-
created: string;
|
|
201
|
-
repository: string;
|
|
202
|
-
tag: string;
|
|
203
|
-
size: string;
|
|
204
|
-
}>, "many">;
|
|
90
|
+
}, z.core.$strip>>;
|
|
205
91
|
total: z.ZodNumber;
|
|
206
|
-
},
|
|
207
|
-
total: number;
|
|
208
|
-
images: {
|
|
209
|
-
id: string;
|
|
210
|
-
created: string;
|
|
211
|
-
repository: string;
|
|
212
|
-
tag: string;
|
|
213
|
-
size: string;
|
|
214
|
-
}[];
|
|
215
|
-
}, {
|
|
216
|
-
total: number;
|
|
217
|
-
images: {
|
|
218
|
-
id: string;
|
|
219
|
-
created: string;
|
|
220
|
-
repository: string;
|
|
221
|
-
tag: string;
|
|
222
|
-
size: string;
|
|
223
|
-
}[];
|
|
224
|
-
}>;
|
|
92
|
+
}, z.core.$strip>;
|
|
225
93
|
export type DockerImages = z.infer<typeof DockerImagesSchema>;
|
|
94
|
+
/** Zod schema for structured docker run output with container ID, image, and detach status. */
|
|
95
|
+
export declare const DockerRunSchema: z.ZodObject<{
|
|
96
|
+
containerId: z.ZodString;
|
|
97
|
+
image: z.ZodString;
|
|
98
|
+
detached: z.ZodBoolean;
|
|
99
|
+
name: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
export type DockerRun = z.infer<typeof DockerRunSchema>;
|
|
102
|
+
/** Zod schema for structured docker exec output with exit code, stdout, stderr, and success flag. */
|
|
103
|
+
export declare const DockerExecSchema: z.ZodObject<{
|
|
104
|
+
exitCode: z.ZodNumber;
|
|
105
|
+
stdout: z.ZodString;
|
|
106
|
+
stderr: z.ZodString;
|
|
107
|
+
success: z.ZodBoolean;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
export type DockerExec = z.infer<typeof DockerExecSchema>;
|
|
110
|
+
/** Zod schema for structured docker compose up output with service list and started count. */
|
|
111
|
+
export declare const DockerComposeUpSchema: z.ZodObject<{
|
|
112
|
+
success: z.ZodBoolean;
|
|
113
|
+
services: z.ZodArray<z.ZodString>;
|
|
114
|
+
started: z.ZodNumber;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
export type DockerComposeUp = z.infer<typeof DockerComposeUpSchema>;
|
|
117
|
+
/** Zod schema for structured docker compose down output with stopped and removed counts. */
|
|
118
|
+
export declare const DockerComposeDownSchema: z.ZodObject<{
|
|
119
|
+
success: z.ZodBoolean;
|
|
120
|
+
stopped: z.ZodNumber;
|
|
121
|
+
removed: z.ZodNumber;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
export type DockerComposeDown = z.infer<typeof DockerComposeDownSchema>;
|
|
124
|
+
/** Zod schema for structured docker pull output with image, tag, digest, and success flag. */
|
|
125
|
+
export declare const DockerPullSchema: z.ZodObject<{
|
|
126
|
+
image: z.ZodString;
|
|
127
|
+
tag: z.ZodString;
|
|
128
|
+
digest: z.ZodOptional<z.ZodString>;
|
|
129
|
+
success: z.ZodBoolean;
|
|
130
|
+
}, z.core.$strip>;
|
|
131
|
+
export type DockerPull = z.infer<typeof DockerPullSchema>;
|
|
226
132
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+FAA+F;AAC/F,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;iBAc1B,CAAC;AAEH,iGAAiG;AACjG,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,qGAAqG;AACrG,eAAO,MAAM,iBAAiB;;;;;;iBAM5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,oGAAoG;AACpG,eAAO,MAAM,gBAAgB;;;;iBAI3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,8FAA8F;AAC9F,eAAO,MAAM,WAAW;;;;;;iBAMtB,CAAC;AAEH,sFAAsF;AACtF,eAAO,MAAM,kBAAkB;;;;;;;;;iBAG7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,+FAA+F;AAC/F,eAAO,MAAM,eAAe;;;;;iBAK1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,qGAAqG;AACrG,eAAO,MAAM,gBAAgB;;;;;iBAK3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,8FAA8F;AAC9F,eAAO,MAAM,qBAAqB;;;;iBAIhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,4FAA4F;AAC5F,eAAO,MAAM,uBAAuB;;;;iBAIlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,8FAA8F;AAC9F,eAAO,MAAM,gBAAgB;;;;;iBAK3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/** Zod schema for a single Docker container with ID, name, image, state, and port mappings. */
|
|
2
3
|
export const ContainerSchema = z.object({
|
|
3
4
|
id: z.string(),
|
|
4
5
|
name: z.string(),
|
|
@@ -12,12 +13,14 @@ export const ContainerSchema = z.object({
|
|
|
12
13
|
})),
|
|
13
14
|
created: z.string(),
|
|
14
15
|
});
|
|
16
|
+
/** Zod schema for structured docker ps output with container list and running/stopped counts. */
|
|
15
17
|
export const DockerPsSchema = z.object({
|
|
16
18
|
containers: z.array(ContainerSchema),
|
|
17
19
|
total: z.number(),
|
|
18
20
|
running: z.number(),
|
|
19
21
|
stopped: z.number(),
|
|
20
22
|
});
|
|
23
|
+
/** Zod schema for structured docker build output with success status, image ID, and build errors. */
|
|
21
24
|
export const DockerBuildSchema = z.object({
|
|
22
25
|
success: z.boolean(),
|
|
23
26
|
imageId: z.string().optional(),
|
|
@@ -25,11 +28,13 @@ export const DockerBuildSchema = z.object({
|
|
|
25
28
|
steps: z.number().optional(),
|
|
26
29
|
errors: z.array(z.string()),
|
|
27
30
|
});
|
|
31
|
+
/** Zod schema for structured docker logs output with container name, log lines, and total count. */
|
|
28
32
|
export const DockerLogsSchema = z.object({
|
|
29
33
|
container: z.string(),
|
|
30
34
|
lines: z.array(z.string()),
|
|
31
35
|
total: z.number(),
|
|
32
36
|
});
|
|
37
|
+
/** Zod schema for a single Docker image with ID, repository, tag, size, and creation time. */
|
|
33
38
|
export const ImageSchema = z.object({
|
|
34
39
|
id: z.string(),
|
|
35
40
|
repository: z.string(),
|
|
@@ -37,8 +42,42 @@ export const ImageSchema = z.object({
|
|
|
37
42
|
size: z.string(),
|
|
38
43
|
created: z.string(),
|
|
39
44
|
});
|
|
45
|
+
/** Zod schema for structured docker images output with image list and total count. */
|
|
40
46
|
export const DockerImagesSchema = z.object({
|
|
41
47
|
images: z.array(ImageSchema),
|
|
42
48
|
total: z.number(),
|
|
43
49
|
});
|
|
50
|
+
/** Zod schema for structured docker run output with container ID, image, and detach status. */
|
|
51
|
+
export const DockerRunSchema = z.object({
|
|
52
|
+
containerId: z.string(),
|
|
53
|
+
image: z.string(),
|
|
54
|
+
detached: z.boolean(),
|
|
55
|
+
name: z.string().optional(),
|
|
56
|
+
});
|
|
57
|
+
/** Zod schema for structured docker exec output with exit code, stdout, stderr, and success flag. */
|
|
58
|
+
export const DockerExecSchema = z.object({
|
|
59
|
+
exitCode: z.number(),
|
|
60
|
+
stdout: z.string(),
|
|
61
|
+
stderr: z.string(),
|
|
62
|
+
success: z.boolean(),
|
|
63
|
+
});
|
|
64
|
+
/** Zod schema for structured docker compose up output with service list and started count. */
|
|
65
|
+
export const DockerComposeUpSchema = z.object({
|
|
66
|
+
success: z.boolean(),
|
|
67
|
+
services: z.array(z.string()),
|
|
68
|
+
started: z.number(),
|
|
69
|
+
});
|
|
70
|
+
/** Zod schema for structured docker compose down output with stopped and removed counts. */
|
|
71
|
+
export const DockerComposeDownSchema = z.object({
|
|
72
|
+
success: z.boolean(),
|
|
73
|
+
stopped: z.number(),
|
|
74
|
+
removed: z.number(),
|
|
75
|
+
});
|
|
76
|
+
/** Zod schema for structured docker pull output with image, tag, digest, and success flag. */
|
|
77
|
+
export const DockerPullSchema = z.object({
|
|
78
|
+
image: z.string(),
|
|
79
|
+
tag: z.string(),
|
|
80
|
+
digest: z.string().optional(),
|
|
81
|
+
success: z.boolean(),
|
|
82
|
+
});
|
|
44
83
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,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,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAIH,8FAA8F;AAC9F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACrB,CAAC,CAAC"}
|
package/dist/tools/build.js
CHANGED
|
@@ -7,7 +7,7 @@ import { DockerBuildSchema } from "../schemas/index.js";
|
|
|
7
7
|
export function registerBuildTool(server) {
|
|
8
8
|
server.registerTool("build", {
|
|
9
9
|
title: "Docker Build",
|
|
10
|
-
description: "Builds a Docker image and returns structured build results including image ID, duration, and errors",
|
|
10
|
+
description: "Builds a Docker image and returns structured build results including image ID, duration, and errors. Use instead of running `docker build` in the terminal.",
|
|
11
11
|
inputSchema: {
|
|
12
12
|
path: z.string().optional().describe("Build context path (default: cwd)"),
|
|
13
13
|
tag: z.string().optional().describe("Image tag (e.g., myapp:latest)"),
|
package/dist/tools/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/tools/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,MAAM,CAAC,YAA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,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAClC,IAAI,GAAG;YAAE,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACpC,IAAI,IAAI;YAAE,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACtC,IAAI,IAAI;YAAE,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAEnC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;QAE7D,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACvF,OAAO,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACvC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-down.d.ts","sourceRoot":"","sources":["../../src/tools/compose-down.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,QAyCxD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { docker } from "../lib/docker-runner.js";
|
|
4
|
+
import { parseComposeDownOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatComposeDown } from "../lib/formatters.js";
|
|
6
|
+
import { DockerComposeDownSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerComposeDownTool(server) {
|
|
8
|
+
server.registerTool("compose-down", {
|
|
9
|
+
title: "Docker Compose Down",
|
|
10
|
+
description: "Stops Docker Compose services and returns structured status. Use instead of running `docker compose down` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().describe("Directory containing docker-compose.yml"),
|
|
13
|
+
volumes: z
|
|
14
|
+
.boolean()
|
|
15
|
+
.optional()
|
|
16
|
+
.default(false)
|
|
17
|
+
.describe("Also remove named volumes (default: false)"),
|
|
18
|
+
removeOrphans: z
|
|
19
|
+
.boolean()
|
|
20
|
+
.optional()
|
|
21
|
+
.default(false)
|
|
22
|
+
.describe("Remove orphan containers (default: false)"),
|
|
23
|
+
file: z.string().optional().describe("Compose file path (default: docker-compose.yml)"),
|
|
24
|
+
},
|
|
25
|
+
outputSchema: DockerComposeDownSchema,
|
|
26
|
+
}, async ({ path, volumes, removeOrphans, file }) => {
|
|
27
|
+
const args = ["compose"];
|
|
28
|
+
if (file)
|
|
29
|
+
args.push("-f", file);
|
|
30
|
+
args.push("down");
|
|
31
|
+
if (volumes)
|
|
32
|
+
args.push("--volumes");
|
|
33
|
+
if (removeOrphans)
|
|
34
|
+
args.push("--remove-orphans");
|
|
35
|
+
const result = await docker(args, path);
|
|
36
|
+
const data = parseComposeDownOutput(result.stdout, result.stderr, result.exitCode);
|
|
37
|
+
if (result.exitCode !== 0 && data.stopped === 0 && data.removed === 0) {
|
|
38
|
+
const errorMsg = result.stderr || result.stdout || "Unknown error";
|
|
39
|
+
throw new Error(`docker compose down failed: ${errorMsg.trim()}`);
|
|
40
|
+
}
|
|
41
|
+
return dualOutput(data, formatComposeDown);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=compose-down.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-down.js","sourceRoot":"","sources":["../../src/tools/compose-down.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAA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Aa;YAAE,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAEjD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,sBAAsB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEnF,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;YACtE,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,eAAe,CAAC;YACnE,MAAM,IAAI,KAAK,CAAC,+BAA+B,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,OAAO,UAAU,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IAC7C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-up.d.ts","sourceRoot":"","sources":["../../src/tools/compose-up.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,QA6CtD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { docker } from "../lib/docker-runner.js";
|
|
4
|
+
import { parseComposeUpOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatComposeUp } from "../lib/formatters.js";
|
|
6
|
+
import { DockerComposeUpSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerComposeUpTool(server) {
|
|
8
|
+
server.registerTool("compose-up", {
|
|
9
|
+
title: "Docker Compose Up",
|
|
10
|
+
description: "Starts Docker Compose services and returns structured status. Use instead of running `docker compose up` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().describe("Directory containing docker-compose.yml"),
|
|
13
|
+
services: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.optional()
|
|
16
|
+
.default([])
|
|
17
|
+
.describe("Specific services to start (default: all)"),
|
|
18
|
+
detach: z.boolean().optional().default(true).describe("Run in background (default: true)"),
|
|
19
|
+
build: z
|
|
20
|
+
.boolean()
|
|
21
|
+
.optional()
|
|
22
|
+
.default(false)
|
|
23
|
+
.describe("Build images before starting (default: false)"),
|
|
24
|
+
file: z.string().optional().describe("Compose file path (default: docker-compose.yml)"),
|
|
25
|
+
},
|
|
26
|
+
outputSchema: DockerComposeUpSchema,
|
|
27
|
+
}, async ({ path, services, detach, build, file }) => {
|
|
28
|
+
const args = ["compose"];
|
|
29
|
+
if (file)
|
|
30
|
+
args.push("-f", file);
|
|
31
|
+
args.push("up");
|
|
32
|
+
if (detach)
|
|
33
|
+
args.push("-d");
|
|
34
|
+
if (build)
|
|
35
|
+
args.push("--build");
|
|
36
|
+
if (services && services.length > 0) {
|
|
37
|
+
args.push(...services);
|
|
38
|
+
}
|
|
39
|
+
const result = await docker(args, path);
|
|
40
|
+
const data = parseComposeUpOutput(result.stdout, result.stderr, result.exitCode);
|
|
41
|
+
if (result.exitCode !== 0 && data.started === 0) {
|
|
42
|
+
const errorMsg = result.stderr || result.stdout || "Unknown error";
|
|
43
|
+
throw new Error(`docker compose up failed: ${errorMsg.trim()}`);
|
|
44
|
+
}
|
|
45
|
+
return dualOutput(data, formatComposeUp);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=compose-up.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-up.js","sourceRoot":"","sources":["../../src/tools/compose-up.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU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ChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChB,IAAI,MAAM;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,KAAK;YAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAChC,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;QACzB,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,oBAAoB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEjF,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;YAChD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,eAAe,CAAC;YACnE,MAAM,IAAI,KAAK,CAAC,6BAA6B,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,UAAU,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAC3C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../src/tools/exec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAmCjD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput, assertNoFlagInjection } from "@paretools/shared";
|
|
3
|
+
import { docker } from "../lib/docker-runner.js";
|
|
4
|
+
import { parseExecOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatExec } from "../lib/formatters.js";
|
|
6
|
+
import { DockerExecSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerExecTool(server) {
|
|
8
|
+
server.registerTool("exec", {
|
|
9
|
+
title: "Docker Exec",
|
|
10
|
+
description: "Executes a command in a running Docker container and returns structured output. Use instead of running `docker exec` in the terminal.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
container: z.string().describe("Container name or ID"),
|
|
13
|
+
command: z.array(z.string()).describe('Command to execute (e.g., ["ls", "-la"])'),
|
|
14
|
+
workdir: z.string().optional().describe("Working directory inside the container"),
|
|
15
|
+
env: z
|
|
16
|
+
.array(z.string())
|
|
17
|
+
.optional()
|
|
18
|
+
.default([])
|
|
19
|
+
.describe('Environment variables (e.g., ["KEY=VALUE"])'),
|
|
20
|
+
path: z.string().optional().describe("Host working directory (default: cwd)"),
|
|
21
|
+
},
|
|
22
|
+
outputSchema: DockerExecSchema,
|
|
23
|
+
}, async ({ container, command, workdir, env, path }) => {
|
|
24
|
+
assertNoFlagInjection(container, "container");
|
|
25
|
+
const args = ["exec"];
|
|
26
|
+
if (workdir)
|
|
27
|
+
args.push("-w", workdir);
|
|
28
|
+
for (const e of env ?? []) {
|
|
29
|
+
args.push("-e", e);
|
|
30
|
+
}
|
|
31
|
+
args.push(container, ...command);
|
|
32
|
+
const result = await docker(args, path);
|
|
33
|
+
const data = parseExecOutput(result.stdout, result.stderr, result.exitCode);
|
|
34
|
+
return dualOutput(data, formatExec);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/tools/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACtE,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AE,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACrB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,OAAO,CAAC,CAAC;QAEjC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5E,OAAO,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../../src/tools/images.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../../src/tools/images.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QA2BnD"}
|
package/dist/tools/images.js
CHANGED
|
@@ -7,7 +7,7 @@ import { DockerImagesSchema } from "../schemas/index.js";
|
|
|
7
7
|
export function registerImagesTool(server) {
|
|
8
8
|
server.registerTool("images", {
|
|
9
9
|
title: "Docker Images",
|
|
10
|
-
description: "Lists Docker images with structured repository, tag, size, and creation info",
|
|
10
|
+
description: "Lists Docker images with structured repository, tag, size, and creation info. Use instead of running `docker images` in the terminal.",
|
|
11
11
|
inputSchema: {
|
|
12
12
|
all: z
|
|
13
13
|
.boolean()
|
package/dist/tools/images.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"images.js","sourceRoot":"","sources":["../../src/tools/images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,CAAC,YAAY,CACjB,QAAQ,EACR;QACE,KAAK,EAAE,eAAe;QACtB,WAAW,
|
|
1
|
+
{"version":3,"file":"images.js","sourceRoot":"","sources":["../../src/tools/images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,CAAC,YAAY,CACjB,QAAQ,EACR;QACE,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,uIAAuI;QACzI,WAAW,EAAE;YACX,GAAG,EAAE,CAAC;iBACH,OAAO,EAAE;iBACT,QAAQ,EAAE;iBACV,OAAO,CAAC,KAAK,CAAC;iBACd,QAAQ,CAAC,yCAAyC,CAAC;YACtD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gDAAgD,CAAC;SACzF;QACD,YAAY,EAAE,kBAAkB;KACjC,EACD,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE;QACxB,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QAC5C,IAAI,GAAG;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,MAAM;YAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE9B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IACxC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAWzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAUjD"}
|