napbox 0.0.0-stage → 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.
@@ -0,0 +1,508 @@
1
+ import { z } from "zod";
2
+ /** 错误码,napboxd 原样给什么这里就是什么 */
3
+ export declare const errorCodes: readonly ["daemon_unavailable", "bad_request", "unknown_method", "protocol_error", "usage_error", "internal_error", "compose_not_found", "compose_invalid", "compose_unsupported", "not_in_repository", "port_unavailable", "state_corrupted", "environment_not_found", "runtime_unavailable", "image_unavailable", "image_build_failed", "service_failed", "service_not_found", "volume_not_found", "healthcheck_timeout", "address_unavailable", "name_taken", "owner_mismatch"];
4
+ export type ErrorCode = (typeof errorCodes)[number];
5
+ export declare const methods: {
6
+ readonly status: "status";
7
+ readonly up: "up";
8
+ readonly down: "down";
9
+ readonly sleep: "sleep";
10
+ readonly egress: "egress";
11
+ readonly environment: "environment";
12
+ readonly logs: "logs";
13
+ readonly exec: "exec";
14
+ readonly subscribe: "subscribe";
15
+ readonly run: "run";
16
+ readonly reset: "reset";
17
+ readonly imageImport: "image.import";
18
+ readonly create: "create";
19
+ readonly wake: "wake";
20
+ readonly runs: "runs";
21
+ };
22
+ export declare const NapboxErrorBody: z.ZodObject<{
23
+ code: z.ZodString;
24
+ message: z.ZodString;
25
+ }, z.core.$strip>;
26
+ export declare const EnvironmentState: z.ZodEnum<{
27
+ running: "running";
28
+ sleeping: "sleeping";
29
+ }>;
30
+ export declare const EgressMode: z.ZodEnum<{
31
+ none: "none";
32
+ open: "open";
33
+ }>;
34
+ export declare const ServiceExitRestart: z.ZodEnum<{
35
+ gave_up: "gave_up";
36
+ none: "none";
37
+ restarting: "restarting";
38
+ }>;
39
+ export declare const RunPurpose: z.ZodEnum<{
40
+ reset: "reset";
41
+ restart: "restart";
42
+ up: "up";
43
+ wake: "wake";
44
+ }>;
45
+ export declare const Readiness: z.ZodEnum<{
46
+ healthcheck: "healthcheck";
47
+ port: "port";
48
+ process: "process";
49
+ }>;
50
+ export declare const OutputStream: z.ZodEnum<{
51
+ stderr: "stderr";
52
+ stdout: "stdout";
53
+ }>;
54
+ export declare const EventKind: z.ZodEnum<{
55
+ destroyed: "destroyed";
56
+ service_exited: "service_exited";
57
+ slept: "slept";
58
+ start_failed: "start_failed";
59
+ started: "started";
60
+ }>;
61
+ export declare const SleepReason: z.ZodEnum<{
62
+ host_address: "host_address";
63
+ idle: "idle";
64
+ request: "request";
65
+ shutdown: "shutdown";
66
+ vm_lost: "vm_lost";
67
+ }>;
68
+ export declare const PortInfo: z.ZodObject<{
69
+ service: z.ZodString;
70
+ containerPort: z.ZodInt;
71
+ hostPort: z.ZodInt;
72
+ variable: z.ZodString;
73
+ }, z.core.$strip>;
74
+ export declare const ServiceExit: z.ZodObject<{
75
+ service: z.ZodString;
76
+ exitCode: z.ZodInt;
77
+ at: z.ZodISODateTime;
78
+ restart: z.ZodEnum<{
79
+ gave_up: "gave_up";
80
+ none: "none";
81
+ restarting: "restarting";
82
+ }>;
83
+ }, z.core.$strip>;
84
+ export declare const EnvironmentInfo: z.ZodObject<{
85
+ name: z.ZodString;
86
+ owner: z.ZodOptional<z.ZodString>;
87
+ state: z.ZodEnum<{
88
+ running: "running";
89
+ sleeping: "sleeping";
90
+ }>;
91
+ worktree: z.ZodString;
92
+ ports: z.ZodArray<z.ZodObject<{
93
+ service: z.ZodString;
94
+ containerPort: z.ZodInt;
95
+ hostPort: z.ZodInt;
96
+ variable: z.ZodString;
97
+ }, z.core.$strip>>;
98
+ egress: z.ZodEnum<{
99
+ none: "none";
100
+ open: "open";
101
+ }>;
102
+ variables: z.ZodRecord<z.ZodString, z.ZodString>;
103
+ unsetVariables: z.ZodArray<z.ZodString>;
104
+ lastError: z.ZodOptional<z.ZodString>;
105
+ watchError: z.ZodOptional<z.ZodString>;
106
+ serviceExits: z.ZodArray<z.ZodObject<{
107
+ service: z.ZodString;
108
+ exitCode: z.ZodInt;
109
+ at: z.ZodISODateTime;
110
+ restart: z.ZodEnum<{
111
+ gave_up: "gave_up";
112
+ none: "none";
113
+ restarting: "restarting";
114
+ }>;
115
+ }, z.core.$strip>>;
116
+ }, z.core.$strip>;
117
+ export declare const StatusResult: z.ZodObject<{
118
+ version: z.ZodString;
119
+ pid: z.ZodInt;
120
+ startedAt: z.ZodISODateTime;
121
+ environments: z.ZodArray<z.ZodObject<{
122
+ name: z.ZodString;
123
+ owner: z.ZodOptional<z.ZodString>;
124
+ state: z.ZodEnum<{
125
+ running: "running";
126
+ sleeping: "sleeping";
127
+ }>;
128
+ worktree: z.ZodString;
129
+ ports: z.ZodArray<z.ZodObject<{
130
+ service: z.ZodString;
131
+ containerPort: z.ZodInt;
132
+ hostPort: z.ZodInt;
133
+ variable: z.ZodString;
134
+ }, z.core.$strip>>;
135
+ egress: z.ZodEnum<{
136
+ none: "none";
137
+ open: "open";
138
+ }>;
139
+ variables: z.ZodRecord<z.ZodString, z.ZodString>;
140
+ unsetVariables: z.ZodArray<z.ZodString>;
141
+ lastError: z.ZodOptional<z.ZodString>;
142
+ watchError: z.ZodOptional<z.ZodString>;
143
+ serviceExits: z.ZodArray<z.ZodObject<{
144
+ service: z.ZodString;
145
+ exitCode: z.ZodInt;
146
+ at: z.ZodISODateTime;
147
+ restart: z.ZodEnum<{
148
+ gave_up: "gave_up";
149
+ none: "none";
150
+ restarting: "restarting";
151
+ }>;
152
+ }, z.core.$strip>>;
153
+ }, z.core.$strip>>;
154
+ }, z.core.$strip>;
155
+ /** 操作哪个环境:worktree 持有的写 `{ cwd }`(它的临时环境再带上 `temp`),调用方持有的写 `{ name, owner }` */
156
+ export declare const EnvironmentTarget: z.ZodUnion<readonly [z.ZodObject<{
157
+ cwd: z.ZodString;
158
+ temp: z.ZodOptional<z.ZodString>;
159
+ }, z.core.$strip>, z.ZodObject<{
160
+ name: z.ZodString;
161
+ owner: z.ZodString;
162
+ }, z.core.$strip>]>;
163
+ export declare const UpParams: z.ZodObject<{
164
+ cwd: z.ZodString;
165
+ files: z.ZodArray<z.ZodString>;
166
+ profiles: z.ZodArray<z.ZodString>;
167
+ environment: z.ZodRecord<z.ZodString, z.ZodString>;
168
+ build: z.ZodBoolean;
169
+ temp: z.ZodOptional<z.ZodString>;
170
+ }, z.core.$strip>;
171
+ export declare const RunParams: z.ZodObject<{
172
+ cwd: z.ZodString;
173
+ files: z.ZodArray<z.ZodString>;
174
+ profiles: z.ZodArray<z.ZodString>;
175
+ environment: z.ZodRecord<z.ZodString, z.ZodString>;
176
+ build: z.ZodBoolean;
177
+ egress: z.ZodOptional<z.ZodEnum<{
178
+ none: "none";
179
+ open: "open";
180
+ }>>;
181
+ service: z.ZodString;
182
+ command: z.ZodArray<z.ZodString>;
183
+ noDeps: z.ZodBoolean;
184
+ }, z.core.$strip>;
185
+ export declare const EnvironmentParams: z.ZodObject<{
186
+ target: z.ZodUnion<readonly [z.ZodObject<{
187
+ cwd: z.ZodString;
188
+ temp: z.ZodOptional<z.ZodString>;
189
+ }, z.core.$strip>, z.ZodObject<{
190
+ name: z.ZodString;
191
+ owner: z.ZodString;
192
+ }, z.core.$strip>]>;
193
+ }, z.core.$strip>;
194
+ export declare const CreateParams: z.ZodObject<{
195
+ name: z.ZodString;
196
+ owner: z.ZodString;
197
+ directory: z.ZodString;
198
+ files: z.ZodArray<z.ZodString>;
199
+ profiles: z.ZodArray<z.ZodString>;
200
+ environment: z.ZodRecord<z.ZodString, z.ZodString>;
201
+ egress: z.ZodOptional<z.ZodEnum<{
202
+ none: "none";
203
+ open: "open";
204
+ }>>;
205
+ }, z.core.$strip>;
206
+ export declare const ResetParams: z.ZodObject<{
207
+ target: z.ZodUnion<readonly [z.ZodObject<{
208
+ cwd: z.ZodString;
209
+ temp: z.ZodOptional<z.ZodString>;
210
+ }, z.core.$strip>, z.ZodObject<{
211
+ name: z.ZodString;
212
+ owner: z.ZodString;
213
+ }, z.core.$strip>]>;
214
+ volume: z.ZodString;
215
+ }, z.core.$strip>;
216
+ export declare const EgressParams: z.ZodObject<{
217
+ target: z.ZodUnion<readonly [z.ZodObject<{
218
+ cwd: z.ZodString;
219
+ temp: z.ZodOptional<z.ZodString>;
220
+ }, z.core.$strip>, z.ZodObject<{
221
+ name: z.ZodString;
222
+ owner: z.ZodString;
223
+ }, z.core.$strip>]>;
224
+ mode: z.ZodEnum<{
225
+ none: "none";
226
+ open: "open";
227
+ }>;
228
+ }, z.core.$strip>;
229
+ export declare const DownResult: z.ZodObject<{
230
+ name: z.ZodString;
231
+ releasedPorts: z.ZodArray<z.ZodInt>;
232
+ keptDataAt: z.ZodOptional<z.ZodString>;
233
+ }, z.core.$strip>;
234
+ export declare const ImageImportParams: z.ZodObject<{
235
+ reference: z.ZodString;
236
+ }, z.core.$strip>;
237
+ export declare const ImageImportResult: z.ZodObject<{
238
+ reference: z.ZodString;
239
+ digest: z.ZodString;
240
+ }, z.core.$strip>;
241
+ export declare const StreamOutput: z.ZodObject<{
242
+ stream: z.ZodEnum<{
243
+ stderr: "stderr";
244
+ stdout: "stdout";
245
+ }>;
246
+ data: z.ZodBase64;
247
+ }, z.core.$strip>;
248
+ export declare const StdinMessage: z.ZodObject<{
249
+ data: z.ZodOptional<z.ZodBase64>;
250
+ end: z.ZodOptional<z.ZodBoolean>;
251
+ }, z.core.$strip>;
252
+ export declare const LogsParams: z.ZodObject<{
253
+ target: z.ZodUnion<readonly [z.ZodObject<{
254
+ cwd: z.ZodString;
255
+ temp: z.ZodOptional<z.ZodString>;
256
+ }, z.core.$strip>, z.ZodObject<{
257
+ name: z.ZodString;
258
+ owner: z.ZodString;
259
+ }, z.core.$strip>]>;
260
+ service: z.ZodString;
261
+ tail: z.ZodOptional<z.ZodInt>;
262
+ follow: z.ZodBoolean;
263
+ }, z.core.$strip>;
264
+ export declare const LogsResult: z.ZodObject<{
265
+ ended: z.ZodOptional<z.ZodString>;
266
+ }, z.core.$strip>;
267
+ export declare const ExecParams: z.ZodObject<{
268
+ target: z.ZodUnion<readonly [z.ZodObject<{
269
+ cwd: z.ZodString;
270
+ temp: z.ZodOptional<z.ZodString>;
271
+ }, z.core.$strip>, z.ZodObject<{
272
+ name: z.ZodString;
273
+ owner: z.ZodString;
274
+ }, z.core.$strip>]>;
275
+ service: z.ZodString;
276
+ command: z.ZodArray<z.ZodString>;
277
+ }, z.core.$strip>;
278
+ export declare const ExecResult: z.ZodObject<{
279
+ exitCode: z.ZodInt;
280
+ }, z.core.$strip>;
281
+ export declare const ServiceRun: z.ZodObject<{
282
+ service: z.ZodString;
283
+ image: z.ZodString;
284
+ digest: z.ZodString;
285
+ platformDigest: z.ZodString;
286
+ skipped: z.ZodBoolean;
287
+ startedAt: z.ZodOptional<z.ZodISODateTime>;
288
+ readyAt: z.ZodOptional<z.ZodISODateTime>;
289
+ readiness: z.ZodOptional<z.ZodEnum<{
290
+ healthcheck: "healthcheck";
291
+ port: "port";
292
+ process: "process";
293
+ }>>;
294
+ }, z.core.$strip>;
295
+ export declare const RunRecord: z.ZodObject<{
296
+ id: z.ZodString;
297
+ environment: z.ZodString;
298
+ purpose: z.ZodEnum<{
299
+ reset: "reset";
300
+ restart: "restart";
301
+ up: "up";
302
+ wake: "wake";
303
+ }>;
304
+ startedAt: z.ZodISODateTime;
305
+ finishedAt: z.ZodISODateTime;
306
+ error: z.ZodOptional<z.ZodObject<{
307
+ code: z.ZodString;
308
+ message: z.ZodString;
309
+ }, z.core.$strip>>;
310
+ definitionDigest: z.ZodString;
311
+ egress: z.ZodEnum<{
312
+ none: "none";
313
+ open: "open";
314
+ }>;
315
+ ports: z.ZodArray<z.ZodObject<{
316
+ service: z.ZodString;
317
+ containerPort: z.ZodInt;
318
+ hostPort: z.ZodInt;
319
+ variable: z.ZodString;
320
+ }, z.core.$strip>>;
321
+ services: z.ZodArray<z.ZodObject<{
322
+ service: z.ZodString;
323
+ image: z.ZodString;
324
+ digest: z.ZodString;
325
+ platformDigest: z.ZodString;
326
+ skipped: z.ZodBoolean;
327
+ startedAt: z.ZodOptional<z.ZodISODateTime>;
328
+ readyAt: z.ZodOptional<z.ZodISODateTime>;
329
+ readiness: z.ZodOptional<z.ZodEnum<{
330
+ healthcheck: "healthcheck";
331
+ port: "port";
332
+ process: "process";
333
+ }>>;
334
+ }, z.core.$strip>>;
335
+ }, z.core.$strip>;
336
+ export declare const RunsResult: z.ZodObject<{
337
+ runs: z.ZodArray<z.ZodObject<{
338
+ id: z.ZodString;
339
+ environment: z.ZodString;
340
+ purpose: z.ZodEnum<{
341
+ reset: "reset";
342
+ restart: "restart";
343
+ up: "up";
344
+ wake: "wake";
345
+ }>;
346
+ startedAt: z.ZodISODateTime;
347
+ finishedAt: z.ZodISODateTime;
348
+ error: z.ZodOptional<z.ZodObject<{
349
+ code: z.ZodString;
350
+ message: z.ZodString;
351
+ }, z.core.$strip>>;
352
+ definitionDigest: z.ZodString;
353
+ egress: z.ZodEnum<{
354
+ none: "none";
355
+ open: "open";
356
+ }>;
357
+ ports: z.ZodArray<z.ZodObject<{
358
+ service: z.ZodString;
359
+ containerPort: z.ZodInt;
360
+ hostPort: z.ZodInt;
361
+ variable: z.ZodString;
362
+ }, z.core.$strip>>;
363
+ services: z.ZodArray<z.ZodObject<{
364
+ service: z.ZodString;
365
+ image: z.ZodString;
366
+ digest: z.ZodString;
367
+ platformDigest: z.ZodString;
368
+ skipped: z.ZodBoolean;
369
+ startedAt: z.ZodOptional<z.ZodISODateTime>;
370
+ readyAt: z.ZodOptional<z.ZodISODateTime>;
371
+ readiness: z.ZodOptional<z.ZodEnum<{
372
+ healthcheck: "healthcheck";
373
+ port: "port";
374
+ process: "process";
375
+ }>>;
376
+ }, z.core.$strip>>;
377
+ }, z.core.$strip>>;
378
+ }, z.core.$strip>;
379
+ export declare const SubscribeParams: z.ZodObject<{
380
+ owner: z.ZodOptional<z.ZodString>;
381
+ names: z.ZodOptional<z.ZodArray<z.ZodString>>;
382
+ }, z.core.$strip>;
383
+ export declare const EnvironmentEvent: z.ZodObject<{
384
+ at: z.ZodISODateTime;
385
+ environment: z.ZodString;
386
+ owner: z.ZodOptional<z.ZodString>;
387
+ type: z.ZodEnum<{
388
+ destroyed: "destroyed";
389
+ service_exited: "service_exited";
390
+ slept: "slept";
391
+ start_failed: "start_failed";
392
+ started: "started";
393
+ }>;
394
+ purpose: z.ZodOptional<z.ZodEnum<{
395
+ reset: "reset";
396
+ restart: "restart";
397
+ up: "up";
398
+ wake: "wake";
399
+ }>>;
400
+ runId: z.ZodOptional<z.ZodString>;
401
+ error: z.ZodOptional<z.ZodObject<{
402
+ code: z.ZodString;
403
+ message: z.ZodString;
404
+ }, z.core.$strip>>;
405
+ sleepReason: z.ZodOptional<z.ZodEnum<{
406
+ host_address: "host_address";
407
+ idle: "idle";
408
+ request: "request";
409
+ shutdown: "shutdown";
410
+ vm_lost: "vm_lost";
411
+ }>>;
412
+ reason: z.ZodOptional<z.ZodString>;
413
+ service: z.ZodOptional<z.ZodString>;
414
+ exitCode: z.ZodOptional<z.ZodInt>;
415
+ restart: z.ZodOptional<z.ZodEnum<{
416
+ gave_up: "gave_up";
417
+ none: "none";
418
+ restarting: "restarting";
419
+ }>>;
420
+ }, z.core.$strip>;
421
+ /** subscribe 正常结束时的结果(调用方先断开写端才会有,这个客户端不这样断开) */
422
+ export declare const EmptyResult: z.ZodObject<{}, z.core.$strip>;
423
+ export declare const Request: z.ZodObject<{
424
+ id: z.ZodInt;
425
+ method: z.ZodString;
426
+ params: z.ZodOptional<z.ZodUnknown>;
427
+ }, z.core.$strip>;
428
+ export declare const Response: z.ZodObject<{
429
+ id: z.ZodInt;
430
+ result: z.ZodOptional<z.ZodUnknown>;
431
+ error: z.ZodOptional<z.ZodObject<{
432
+ code: z.ZodString;
433
+ message: z.ZodString;
434
+ }, z.core.$strip>>;
435
+ output: z.ZodOptional<z.ZodObject<{
436
+ stream: z.ZodEnum<{
437
+ stderr: "stderr";
438
+ stdout: "stdout";
439
+ }>;
440
+ data: z.ZodBase64;
441
+ }, z.core.$strip>>;
442
+ subscribed: z.ZodOptional<z.ZodBoolean>;
443
+ event: z.ZodOptional<z.ZodObject<{
444
+ at: z.ZodISODateTime;
445
+ environment: z.ZodString;
446
+ owner: z.ZodOptional<z.ZodString>;
447
+ type: z.ZodEnum<{
448
+ destroyed: "destroyed";
449
+ service_exited: "service_exited";
450
+ slept: "slept";
451
+ start_failed: "start_failed";
452
+ started: "started";
453
+ }>;
454
+ purpose: z.ZodOptional<z.ZodEnum<{
455
+ reset: "reset";
456
+ restart: "restart";
457
+ up: "up";
458
+ wake: "wake";
459
+ }>>;
460
+ runId: z.ZodOptional<z.ZodString>;
461
+ error: z.ZodOptional<z.ZodObject<{
462
+ code: z.ZodString;
463
+ message: z.ZodString;
464
+ }, z.core.$strip>>;
465
+ sleepReason: z.ZodOptional<z.ZodEnum<{
466
+ host_address: "host_address";
467
+ idle: "idle";
468
+ request: "request";
469
+ shutdown: "shutdown";
470
+ vm_lost: "vm_lost";
471
+ }>>;
472
+ reason: z.ZodOptional<z.ZodString>;
473
+ service: z.ZodOptional<z.ZodString>;
474
+ exitCode: z.ZodOptional<z.ZodInt>;
475
+ restart: z.ZodOptional<z.ZodEnum<{
476
+ gave_up: "gave_up";
477
+ none: "none";
478
+ restarting: "restarting";
479
+ }>>;
480
+ }, z.core.$strip>>;
481
+ }, z.core.$strip>;
482
+ export type Response = z.infer<typeof Response>;
483
+ export type EnvironmentState = z.infer<typeof EnvironmentState>;
484
+ export type EgressMode = z.infer<typeof EgressMode>;
485
+ export type ServiceExitRestart = z.infer<typeof ServiceExitRestart>;
486
+ export type RunPurpose = z.infer<typeof RunPurpose>;
487
+ export type Readiness = z.infer<typeof Readiness>;
488
+ export type OutputStream = z.infer<typeof OutputStream>;
489
+ export type EventKind = z.infer<typeof EventKind>;
490
+ export type SleepReason = z.infer<typeof SleepReason>;
491
+ export type NapboxErrorBody = z.infer<typeof NapboxErrorBody>;
492
+ export type PortInfo = z.infer<typeof PortInfo>;
493
+ export type ServiceExit = z.infer<typeof ServiceExit>;
494
+ export type EnvironmentInfo = z.infer<typeof EnvironmentInfo>;
495
+ export type StatusResult = z.infer<typeof StatusResult>;
496
+ export type EnvironmentTarget = z.infer<typeof EnvironmentTarget>;
497
+ export type UpParams = z.infer<typeof UpParams>;
498
+ export type RunParams = z.infer<typeof RunParams>;
499
+ export type CreateParams = z.infer<typeof CreateParams>;
500
+ export type DownResult = z.infer<typeof DownResult>;
501
+ export type ImageImportResult = z.infer<typeof ImageImportResult>;
502
+ export type LogsResult = z.infer<typeof LogsResult>;
503
+ export type ExecResult = z.infer<typeof ExecResult>;
504
+ export type ServiceRun = z.infer<typeof ServiceRun>;
505
+ export type RunRecord = z.infer<typeof RunRecord>;
506
+ export type RunsResult = z.infer<typeof RunsResult>;
507
+ export type SubscribeParams = z.infer<typeof SubscribeParams>;
508
+ export type EnvironmentEvent = z.infer<typeof EnvironmentEvent>;