@figulus/schema 0.4.0-alpha-dev → 0.5.0-alpha-dev-2
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/.openapi-meta/index.ts +12 -0
- package/dist/core/entities/figspec.d.ts +659 -0
- package/dist/core/entities/figspec.d.ts.map +1 -0
- package/dist/core/entities/figspec.js +73 -0
- package/dist/core/entities/figspec.js.map +1 -0
- package/dist/core/entities/figstack.d.ts +139 -0
- package/dist/core/entities/figstack.d.ts.map +1 -0
- package/dist/core/entities/figstack.js +79 -0
- package/dist/core/entities/figstack.js.map +1 -0
- package/dist/core/entities/index.d.ts +3 -0
- package/dist/core/entities/index.d.ts.map +1 -0
- package/dist/core/entities/index.js +3 -0
- package/dist/core/entities/index.js.map +1 -0
- package/dist/core/execute.d.ts +64 -0
- package/dist/core/execute.d.ts.map +1 -0
- package/dist/core/execute.js +45 -0
- package/dist/core/execute.js.map +1 -0
- package/dist/core/generic.d.ts +35 -0
- package/dist/core/generic.d.ts.map +1 -0
- package/dist/core/generic.js +28 -0
- package/dist/core/generic.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/primitives.d.ts +3 -0
- package/dist/core/primitives.d.ts.map +1 -0
- package/dist/core/primitives.js +11 -0
- package/dist/core/primitives.js.map +1 -0
- package/dist/core/volumes.d.ts +160 -0
- package/dist/core/volumes.d.ts.map +1 -0
- package/dist/core/volumes.js +100 -0
- package/dist/core/volumes.js.map +1 -0
- package/dist/engine/deprecated/index.d.ts +2 -0
- package/dist/engine/deprecated/index.d.ts.map +1 -0
- package/dist/engine/deprecated/index.js +2 -0
- package/dist/engine/deprecated/index.js.map +1 -0
- package/dist/engine/deprecated/run-request.d.ts +73 -0
- package/dist/engine/deprecated/run-request.d.ts.map +1 -0
- package/dist/engine/deprecated/run-request.js +47 -0
- package/dist/engine/deprecated/run-request.js.map +1 -0
- package/dist/engine/dry-run.d.ts +15 -0
- package/dist/engine/dry-run.d.ts.map +1 -0
- package/dist/engine/dry-run.js +12 -0
- package/dist/engine/dry-run.js.map +1 -0
- package/dist/engine/health.d.ts +11 -0
- package/dist/engine/health.d.ts.map +1 -0
- package/dist/engine/health.js +9 -0
- package/dist/engine/health.js.map +1 -0
- package/dist/engine/images.d.ts +49 -0
- package/dist/engine/images.d.ts.map +1 -0
- package/dist/engine/images.js +44 -0
- package/dist/engine/images.js.map +1 -0
- package/dist/engine/index.d.ts +9 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +9 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/paths/containers.d.ts +8 -0
- package/dist/engine/paths/containers.d.ts.map +1 -0
- package/dist/engine/paths/containers.js +297 -0
- package/dist/engine/paths/containers.js.map +1 -0
- package/dist/engine/paths/dry-run.d.ts +3 -0
- package/dist/engine/paths/dry-run.d.ts.map +1 -0
- package/dist/engine/paths/dry-run.js +43 -0
- package/dist/engine/paths/dry-run.js.map +1 -0
- package/dist/engine/paths/health.d.ts +3 -0
- package/dist/engine/paths/health.d.ts.map +1 -0
- package/dist/engine/paths/health.js +36 -0
- package/dist/engine/paths/health.js.map +1 -0
- package/dist/engine/paths/images.d.ts +5 -0
- package/dist/engine/paths/images.d.ts.map +1 -0
- package/dist/engine/paths/images.js +144 -0
- package/dist/engine/paths/images.js.map +1 -0
- package/dist/engine/paths/index.d.ts +8 -0
- package/dist/engine/paths/index.d.ts.map +1 -0
- package/dist/engine/paths/index.js +8 -0
- package/dist/engine/paths/index.js.map +1 -0
- package/dist/engine/paths/sessions.d.ts +10 -0
- package/dist/engine/paths/sessions.d.ts.map +1 -0
- package/dist/engine/paths/sessions.js +484 -0
- package/dist/engine/paths/sessions.js.map +1 -0
- package/dist/engine/paths/stacks.d.ts +6 -0
- package/dist/engine/paths/stacks.d.ts.map +1 -0
- package/dist/engine/paths/stacks.js +175 -0
- package/dist/engine/paths/stacks.js.map +1 -0
- package/dist/engine/paths/volumes.d.ts +6 -0
- package/dist/engine/paths/volumes.d.ts.map +1 -0
- package/dist/engine/paths/volumes.js +164 -0
- package/dist/engine/paths/volumes.js.map +1 -0
- package/dist/engine/response.d.ts +8 -0
- package/dist/engine/response.d.ts.map +1 -0
- package/dist/engine/response.js +9 -0
- package/dist/engine/response.js.map +1 -0
- package/dist/engine/sessions.d.ts +343 -0
- package/dist/engine/sessions.d.ts.map +1 -0
- package/dist/engine/sessions.js +118 -0
- package/dist/engine/sessions.js.map +1 -0
- package/dist/engine/volumes.d.ts +52 -0
- package/dist/engine/volumes.d.ts.map +1 -0
- package/dist/engine/volumes.js +39 -0
- package/dist/engine/volumes.js.map +1 -0
- package/dist/index.d.ts +2 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -8
- package/dist/index.js.map +1 -1
- package/dist/registry/index.d.ts +3 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +3 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/json-schema.d.ts +82 -0
- package/dist/registry/json-schema.d.ts.map +1 -0
- package/dist/registry/json-schema.js +149 -0
- package/dist/registry/json-schema.js.map +1 -0
- package/dist/registry/metadata.d.ts +216 -0
- package/dist/registry/metadata.d.ts.map +1 -0
- package/dist/registry/metadata.js +143 -0
- package/dist/registry/metadata.js.map +1 -0
- package/package.json +12 -4
- package/scripts/fix-openapi-3.1.ts +183 -0
- package/scripts/generate-openapi-data.ts +51 -0
- package/scripts/generate-openapi-meta.ts +540 -0
- package/src/core/entities/figspec.ts +94 -0
- package/src/core/entities/figstack.ts +101 -0
- package/src/core/entities/index.ts +2 -0
- package/src/core/execute.ts +66 -0
- package/src/core/generic.ts +38 -0
- package/src/core/index.ts +5 -0
- package/src/core/primitives.ts +12 -0
- package/src/core/volumes.ts +124 -0
- package/src/engine/deprecated/index.ts +1 -0
- package/src/engine/deprecated/run-request.ts +53 -0
- package/src/engine/dry-run.ts +14 -0
- package/src/engine/health.ts +11 -0
- package/src/engine/images.ts +58 -0
- package/src/engine/index.ts +8 -0
- package/src/engine/paths/containers.ts +304 -0
- package/src/engine/paths/dry-run.ts +44 -0
- package/src/engine/paths/health.ts +37 -0
- package/src/engine/paths/images.ts +148 -0
- package/src/engine/paths/index.ts +7 -0
- package/src/engine/paths/sessions.ts +493 -0
- package/src/engine/paths/stacks.ts +179 -0
- package/src/engine/paths/volumes.ts +168 -0
- package/src/engine/response.ts +11 -0
- package/src/engine/sessions.ts +146 -0
- package/src/engine/volumes.ts +53 -0
- package/src/index.ts +3 -8
- package/src/registry/index.ts +2 -0
- package/src/registry/json-schema.ts +178 -0
- package/src/registry/metadata.ts +181 -0
- package/tests/figspec.test.ts +1 -1
- package/tests/schemas.test.ts +31 -31
- package/dist/figspec.d.ts +0 -4394
- package/dist/figspec.d.ts.map +0 -1
- package/dist/figspec.js +0 -214
- package/dist/figspec.js.map +0 -1
- package/dist/figstack.d.ts +0 -419
- package/dist/figstack.d.ts.map +0 -1
- package/dist/figstack.js +0 -72
- package/dist/figstack.js.map +0 -1
- package/dist/health.d.ts +0 -16
- package/dist/health.d.ts.map +0 -1
- package/dist/health.js +0 -7
- package/dist/health.js.map +0 -1
- package/dist/image.d.ts +0 -115
- package/dist/image.d.ts.map +0 -1
- package/dist/image.js +0 -42
- package/dist/image.js.map +0 -1
- package/dist/run-request.d.ts +0 -244
- package/dist/run-request.d.ts.map +0 -1
- package/dist/run-request.js +0 -43
- package/dist/run-request.js.map +0 -1
- package/dist/session.d.ts +0 -447
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -78
- package/dist/session.js.map +0 -1
- package/dist/shared.d.ts +0 -90
- package/dist/shared.d.ts.map +0 -1
- package/dist/shared.js +0 -41
- package/dist/shared.js.map +0 -1
- package/dist/volume.d.ts +0 -140
- package/dist/volume.d.ts.map +0 -1
- package/dist/volume.js +0 -37
- package/dist/volume.js.map +0 -1
- package/src/figspec.ts +0 -279
- package/src/figstack.ts +0 -92
- package/src/health.ts +0 -8
- package/src/image.ts +0 -55
- package/src/run-request.ts +0 -55
- package/src/session.ts +0 -101
- package/src/shared.ts +0 -56
- package/src/volume.ts +0 -50
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { RouteConfig } from "@asteasolutions/zod-to-openapi";
|
|
2
|
+
import { extractArtifactsRequestSchema, extractArtifactsResponseSchema } from "../images.js";
|
|
3
|
+
import z from "zod";
|
|
4
|
+
import { extendZodWithOpenApi } from "@asteasolutions/zod-to-openapi";
|
|
5
|
+
import { runRequestSchema, runResponseSchema } from "../deprecated/run-request.js";
|
|
6
|
+
import { errorResponseSchema } from "../response.js";
|
|
7
|
+
|
|
8
|
+
extendZodWithOpenApi(z);
|
|
9
|
+
|
|
10
|
+
export const runContainerRouteSchema: RouteConfig = {
|
|
11
|
+
method: "post",
|
|
12
|
+
path: "/api/v1/containers/run",
|
|
13
|
+
operationId: "runContainer",
|
|
14
|
+
summary: "Run a container job (removed — returns 410)",
|
|
15
|
+
description: "**Removed in v0.2.0.** This endpoint always returns 410 Gone. Use POST /api/v1/sessions with config.auto_cleanup: true and block_until_complete: true instead.",
|
|
16
|
+
tags: [
|
|
17
|
+
"containers"
|
|
18
|
+
],
|
|
19
|
+
deprecated: true,
|
|
20
|
+
request: {
|
|
21
|
+
body: {
|
|
22
|
+
description: undefined,
|
|
23
|
+
content: {
|
|
24
|
+
"application/json": {
|
|
25
|
+
schema: runRequestSchema
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
required: true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
responses: {
|
|
32
|
+
202: {
|
|
33
|
+
description: "Job accepted and queued",
|
|
34
|
+
content: {
|
|
35
|
+
"application/json": {
|
|
36
|
+
schema: runResponseSchema,
|
|
37
|
+
example: {
|
|
38
|
+
job_id: "job-abc123",
|
|
39
|
+
status: "pending",
|
|
40
|
+
message: "Job accepted and queued"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
400: {
|
|
46
|
+
description: "Invalid request body or validation failure",
|
|
47
|
+
content: {
|
|
48
|
+
"application/json": {
|
|
49
|
+
schema: errorResponseSchema
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
500: {
|
|
54
|
+
description: "Failed to start job",
|
|
55
|
+
content: {
|
|
56
|
+
"application/json": {
|
|
57
|
+
schema: errorResponseSchema
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const getContainerStatusRouteSchema: RouteConfig = {
|
|
65
|
+
method: "get",
|
|
66
|
+
path: "/api/v1/containers/{job_id}",
|
|
67
|
+
operationId: "getContainerStatus",
|
|
68
|
+
summary: "Get job status",
|
|
69
|
+
description: "Returns the current status and output of a container job.",
|
|
70
|
+
tags: [
|
|
71
|
+
"containers"
|
|
72
|
+
],
|
|
73
|
+
parameters: [
|
|
74
|
+
{
|
|
75
|
+
name: "job_id",
|
|
76
|
+
in: "path",
|
|
77
|
+
required: true,
|
|
78
|
+
schema: {
|
|
79
|
+
type: "string"
|
|
80
|
+
},
|
|
81
|
+
example: "job-abc123"
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
deprecated: true,
|
|
85
|
+
responses: {
|
|
86
|
+
200: {
|
|
87
|
+
description: "Job found",
|
|
88
|
+
content: {
|
|
89
|
+
"application/json": {
|
|
90
|
+
schema: runResponseSchema
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
400: {
|
|
95
|
+
description: "Missing job_id",
|
|
96
|
+
content: {
|
|
97
|
+
"application/json": {
|
|
98
|
+
schema: errorResponseSchema
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
404: {
|
|
103
|
+
description: "Job not found",
|
|
104
|
+
content: {
|
|
105
|
+
"application/json": {
|
|
106
|
+
schema: errorResponseSchema
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const cancelContainerRouteSchema: RouteConfig = {
|
|
114
|
+
method: "delete",
|
|
115
|
+
path: "/api/v1/containers/{job_id}",
|
|
116
|
+
operationId: "cancelContainer",
|
|
117
|
+
summary: "Cancel a running job",
|
|
118
|
+
description: "Cancels an in-progress container job. No-ops if already completed.",
|
|
119
|
+
tags: [
|
|
120
|
+
"containers"
|
|
121
|
+
],
|
|
122
|
+
parameters: [
|
|
123
|
+
{
|
|
124
|
+
name: "job_id",
|
|
125
|
+
in: "path",
|
|
126
|
+
required: true,
|
|
127
|
+
schema: {
|
|
128
|
+
type: "string"
|
|
129
|
+
},
|
|
130
|
+
example: "job-abc123"
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
deprecated: true,
|
|
134
|
+
responses: {
|
|
135
|
+
200: {
|
|
136
|
+
description: "Job cancelled",
|
|
137
|
+
content: {
|
|
138
|
+
"application/json": {
|
|
139
|
+
schema: z.object({
|
|
140
|
+
job_id: z.string(),
|
|
141
|
+
message: z.string(),
|
|
142
|
+
}),
|
|
143
|
+
example: {
|
|
144
|
+
job_id: "job-abc123",
|
|
145
|
+
message: "Job cancelled successfully"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
400: {
|
|
151
|
+
description: "Missing job_id",
|
|
152
|
+
content: {
|
|
153
|
+
"application/json": {
|
|
154
|
+
schema: errorResponseSchema
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
500: {
|
|
159
|
+
description: "Cancel failed",
|
|
160
|
+
content: {
|
|
161
|
+
"application/json": {
|
|
162
|
+
schema: errorResponseSchema
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const cleanupContainerRouteSchema: RouteConfig = {
|
|
170
|
+
method: "post",
|
|
171
|
+
path: "/api/v1/containers/{job_id}/cleanup",
|
|
172
|
+
operationId: "cleanupContainer",
|
|
173
|
+
summary: "Clean up a specific container",
|
|
174
|
+
description: "Removes the container associated with a job after artifact extraction.",
|
|
175
|
+
tags: [
|
|
176
|
+
"containers"
|
|
177
|
+
],
|
|
178
|
+
parameters: [
|
|
179
|
+
{
|
|
180
|
+
name: "job_id",
|
|
181
|
+
in: "path",
|
|
182
|
+
required: true,
|
|
183
|
+
schema: {
|
|
184
|
+
type: "string"
|
|
185
|
+
},
|
|
186
|
+
example: "job-abc123"
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
deprecated: true,
|
|
190
|
+
responses: {
|
|
191
|
+
200: {
|
|
192
|
+
description: "Container cleaned up",
|
|
193
|
+
content: {
|
|
194
|
+
"application/json": {
|
|
195
|
+
schema: z.object({
|
|
196
|
+
job_id: z.string(),
|
|
197
|
+
message: z.string(),
|
|
198
|
+
}),
|
|
199
|
+
example: {
|
|
200
|
+
job_id: "job-abc123",
|
|
201
|
+
message: "Container cleaned up successfully"
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
400: {
|
|
207
|
+
description: "Missing job_id",
|
|
208
|
+
content: {
|
|
209
|
+
"application/json": {
|
|
210
|
+
schema: errorResponseSchema
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
500: {
|
|
215
|
+
description: "Cleanup failed",
|
|
216
|
+
content: {
|
|
217
|
+
"application/json": {
|
|
218
|
+
schema: errorResponseSchema
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
export const cleanupOrphanedContainersRouteSchema: RouteConfig = {
|
|
226
|
+
method: "post",
|
|
227
|
+
path: "/api/v1/containers/cleanup",
|
|
228
|
+
operationId: "cleanupOrphanedContainers",
|
|
229
|
+
summary: "Clean up all orphaned containers",
|
|
230
|
+
description: "Removes all Figulus-managed containers that are no longer tracked.",
|
|
231
|
+
tags: [
|
|
232
|
+
"containers"
|
|
233
|
+
],
|
|
234
|
+
deprecated: true,
|
|
235
|
+
responses: {
|
|
236
|
+
200: {
|
|
237
|
+
description: "Orphaned containers removed",
|
|
238
|
+
content: {
|
|
239
|
+
"application/json": {
|
|
240
|
+
schema: z.object({
|
|
241
|
+
removed: z.int().describe("Number of containers removed"),
|
|
242
|
+
message: z.string(),
|
|
243
|
+
}),
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
500: {
|
|
248
|
+
description: "Cleanup failed",
|
|
249
|
+
content: {
|
|
250
|
+
"application/json": {
|
|
251
|
+
schema: errorResponseSchema
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
export const extractArtifactsRouteSchema: RouteConfig = {
|
|
259
|
+
method: "post",
|
|
260
|
+
path: "/api/v1/containers/extract",
|
|
261
|
+
operationId: "extractArtifacts",
|
|
262
|
+
summary: "Extract files from a container",
|
|
263
|
+
description: "Copies files from a container path to a host path.",
|
|
264
|
+
tags: [
|
|
265
|
+
"containers"
|
|
266
|
+
],
|
|
267
|
+
request: {
|
|
268
|
+
body: {
|
|
269
|
+
description: undefined,
|
|
270
|
+
content: {
|
|
271
|
+
"application/json": {
|
|
272
|
+
schema: extractArtifactsRequestSchema
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
required: true
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
responses: {
|
|
279
|
+
200: {
|
|
280
|
+
description: "Artifacts extracted",
|
|
281
|
+
content: {
|
|
282
|
+
"application/json": {
|
|
283
|
+
schema: extractArtifactsResponseSchema
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
400: {
|
|
288
|
+
description: "Validation failure",
|
|
289
|
+
content: {
|
|
290
|
+
"application/json": {
|
|
291
|
+
schema: errorResponseSchema
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
500: {
|
|
296
|
+
description: "Extraction failed (container not found, path not found, etc.)",
|
|
297
|
+
content: {
|
|
298
|
+
"application/json": {
|
|
299
|
+
schema: errorResponseSchema
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { RouteConfig } from "@asteasolutions/zod-to-openapi";
|
|
2
|
+
import { runRequestSchema } from "../deprecated/run-request.js";
|
|
3
|
+
import { dryRunResponseSchema } from "../dry-run.js";
|
|
4
|
+
import { errorResponseSchema } from "../response.js";
|
|
5
|
+
|
|
6
|
+
export const dryRunContainerRouteSchema: RouteConfig = {
|
|
7
|
+
method: "post",
|
|
8
|
+
path: "/api/v1/dryRun",
|
|
9
|
+
operationId: "dryRunContainer",
|
|
10
|
+
summary: "Dry-run a container command",
|
|
11
|
+
description: "Returns the resolved final command without executing it. Requires image and command fields; other RunRequest fields are optional.",
|
|
12
|
+
tags: [
|
|
13
|
+
"containers"
|
|
14
|
+
],
|
|
15
|
+
request: {
|
|
16
|
+
body: {
|
|
17
|
+
description: undefined,
|
|
18
|
+
content: {
|
|
19
|
+
"application/json": {
|
|
20
|
+
schema: runRequestSchema
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
required: true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
responses: {
|
|
27
|
+
200: {
|
|
28
|
+
description: "Resolved command",
|
|
29
|
+
content: {
|
|
30
|
+
"application/json": {
|
|
31
|
+
schema: dryRunResponseSchema
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
400: {
|
|
36
|
+
description: "Missing image or command",
|
|
37
|
+
content: {
|
|
38
|
+
"application/json": {
|
|
39
|
+
schema: errorResponseSchema
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { RouteConfig } from "@asteasolutions/zod-to-openapi";
|
|
2
|
+
import { healthResponseSchema } from "../health.js";
|
|
3
|
+
|
|
4
|
+
export const healthRouteSchema: RouteConfig = {
|
|
5
|
+
method: "get",
|
|
6
|
+
path: "/health",
|
|
7
|
+
operationId: "getHealth",
|
|
8
|
+
summary: "Engine health check",
|
|
9
|
+
description: "Returns engine health and Docker connectivity status. Returns 503 if the Docker daemon is unreachable.",
|
|
10
|
+
tags: ["health"],
|
|
11
|
+
responses: {
|
|
12
|
+
200: {
|
|
13
|
+
description: "Engine is healthy",
|
|
14
|
+
content: {
|
|
15
|
+
"application/json": {
|
|
16
|
+
schema: healthResponseSchema,
|
|
17
|
+
example: {
|
|
18
|
+
status: "healthy",
|
|
19
|
+
docker_api: "1.47",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
503: {
|
|
25
|
+
description: "Docker daemon unreachable",
|
|
26
|
+
content: {
|
|
27
|
+
"application/json": {
|
|
28
|
+
schema: healthResponseSchema,
|
|
29
|
+
example: {
|
|
30
|
+
status: "unhealthy",
|
|
31
|
+
message: "Docker daemon unreachable: connection refused"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { RouteConfig } from "@asteasolutions/zod-to-openapi";
|
|
2
|
+
import z from "zod";
|
|
3
|
+
import { buildImageRequestSchema, buildImageResponseSchema, pruneImagesRequestSchema, pruneImagesResponseSchema } from "../images.js";
|
|
4
|
+
import { bigIntSchema } from "../../core/primitives.js";
|
|
5
|
+
import { extendZodWithOpenApi } from "@asteasolutions/zod-to-openapi";
|
|
6
|
+
import { errorResponseSchema } from "../response.js";
|
|
7
|
+
|
|
8
|
+
extendZodWithOpenApi(z);
|
|
9
|
+
|
|
10
|
+
export const buildImageRouteSchema: RouteConfig = {
|
|
11
|
+
method: "post",
|
|
12
|
+
path: "/api/v1/images/build",
|
|
13
|
+
operationId: "buildImage",
|
|
14
|
+
summary: "Build a Docker image from a RunnerParts spec",
|
|
15
|
+
description: "Content-addressable image build. Returns immediately with a cache hit if the spec hash matches an existing image; otherwise builds and pushes.",
|
|
16
|
+
tags: [
|
|
17
|
+
"images"
|
|
18
|
+
],
|
|
19
|
+
request: {
|
|
20
|
+
body: {
|
|
21
|
+
description: undefined,
|
|
22
|
+
content: {
|
|
23
|
+
"application/json": {
|
|
24
|
+
schema: buildImageRequestSchema
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
required: true
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
responses: {
|
|
31
|
+
200: {
|
|
32
|
+
description: "Image built or found in cache",
|
|
33
|
+
content: {
|
|
34
|
+
"application/json": {
|
|
35
|
+
schema: buildImageResponseSchema
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
400: {
|
|
40
|
+
description: "Invalid spec or request",
|
|
41
|
+
content: {
|
|
42
|
+
"application/json": {
|
|
43
|
+
schema: errorResponseSchema
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
500: {
|
|
48
|
+
description: "Build or push failed",
|
|
49
|
+
content: {
|
|
50
|
+
"application/json": {
|
|
51
|
+
schema: errorResponseSchema
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const pruneImagesRouteSchema: RouteConfig = {
|
|
59
|
+
method: "post",
|
|
60
|
+
path: "/api/v1/images/prune",
|
|
61
|
+
operationId: "pruneImages",
|
|
62
|
+
summary: "Garbage-collect unused Figulus images",
|
|
63
|
+
description: "Removes images that have not been used within the retention window. When `all` is true, also prunes all unused Docker images (equivalent to `docker image prune -a`).",
|
|
64
|
+
tags: [
|
|
65
|
+
"images"
|
|
66
|
+
],
|
|
67
|
+
parameters: [
|
|
68
|
+
{
|
|
69
|
+
name: "retention_days",
|
|
70
|
+
in: "query",
|
|
71
|
+
required: false,
|
|
72
|
+
schema: {
|
|
73
|
+
type: "integer",
|
|
74
|
+
minimum: 1,
|
|
75
|
+
default: 30
|
|
76
|
+
},
|
|
77
|
+
description: "Images unused for longer than this many days are removed"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
request: {
|
|
81
|
+
body: {
|
|
82
|
+
description: undefined,
|
|
83
|
+
content: {
|
|
84
|
+
"application/json": {
|
|
85
|
+
schema: pruneImagesRequestSchema
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
required: false
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
responses: {
|
|
92
|
+
200: {
|
|
93
|
+
description: "GC completed",
|
|
94
|
+
content: {
|
|
95
|
+
"application/json": {
|
|
96
|
+
schema: pruneImagesResponseSchema
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
400: {
|
|
101
|
+
description: "Invalid retention_days value",
|
|
102
|
+
content: {
|
|
103
|
+
"application/json": {
|
|
104
|
+
schema: errorResponseSchema
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
500: {
|
|
109
|
+
description: "GC failed",
|
|
110
|
+
content: {
|
|
111
|
+
"application/json": {
|
|
112
|
+
schema: errorResponseSchema
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const pruneCacheRouteSchema: RouteConfig = {
|
|
120
|
+
method: "post",
|
|
121
|
+
path: "/api/v1/images/prune-cache",
|
|
122
|
+
operationId: "pruneCache",
|
|
123
|
+
summary: "Prune Docker build cache",
|
|
124
|
+
description: "Removes all unused Docker build cache entries. Equivalent to `docker buildx prune -a`.",
|
|
125
|
+
tags: [
|
|
126
|
+
"images"
|
|
127
|
+
],
|
|
128
|
+
responses: {
|
|
129
|
+
200: {
|
|
130
|
+
description: "Build cache pruned",
|
|
131
|
+
content: {
|
|
132
|
+
"application/json": {
|
|
133
|
+
schema: z.object({
|
|
134
|
+
freed_bytes: bigIntSchema.describe("Bytes freed from build cache")
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
500: {
|
|
140
|
+
description: "Prune failed",
|
|
141
|
+
content: {
|
|
142
|
+
"application/json": {
|
|
143
|
+
schema: errorResponseSchema
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|