@impz/client 6.3.2 → 6.4.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/dist/index.d.ts +24 -76
- package/dist/index.js +38 -74
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ORPCError, isDefinedError, safe } from "@orpc/client";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { ContractRouterClient } from "@orpc/contract";
|
|
4
|
-
//#region ../api/src/schemas/api-call-schema.d.ts
|
|
5
4
|
declare const ApiCallSchema: z.ZodObject<{
|
|
6
5
|
at: z.ZodDate;
|
|
7
6
|
procedure: z.ZodString;
|
|
@@ -19,8 +18,6 @@ declare const ApiCallSchema: z.ZodObject<{
|
|
|
19
18
|
detail: z.ZodOptional<z.ZodString>;
|
|
20
19
|
}, z.core.$strip>;
|
|
21
20
|
type ApiCall = z.infer<typeof ApiCallSchema>;
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region ../api/src/schemas/checkpoint-schema.d.ts
|
|
24
21
|
declare const CheckpointSchema: z.ZodObject<{
|
|
25
22
|
id: z.ZodString;
|
|
26
23
|
label: z.ZodOptional<z.ZodString>;
|
|
@@ -29,8 +26,6 @@ declare const CheckpointSchema: z.ZodObject<{
|
|
|
29
26
|
diskMib: z.ZodInt;
|
|
30
27
|
}, z.core.$strip>;
|
|
31
28
|
type Checkpoint = z.infer<typeof CheckpointSchema>;
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region ../api/src/schemas/image-op-event-schema.d.ts
|
|
34
29
|
declare const ImageBuildPhaseSchema: z.ZodEnum<{
|
|
35
30
|
build: "build";
|
|
36
31
|
copy: "copy";
|
|
@@ -54,8 +49,6 @@ declare const ImageBuildProgressSchema: z.ZodObject<{
|
|
|
54
49
|
}, z.core.$strip>;
|
|
55
50
|
type ImageBuildPhase = z.infer<typeof ImageBuildPhaseSchema>;
|
|
56
51
|
type ImageBuildProgress = z.infer<typeof ImageBuildProgressSchema>;
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region ../api/src/protocols/exec-protocol.d.ts
|
|
59
52
|
declare const EXEC_TOOLS: readonly ['tar'];
|
|
60
53
|
type ExecTool = (typeof EXEC_TOOLS)[number];
|
|
61
54
|
export declare const EXEC_REQUIREMENTS: readonly ['broker'];
|
|
@@ -99,8 +92,6 @@ declare const ExecAttachMessageSchema: z.ZodObject<{
|
|
|
99
92
|
}, z.core.$strip>;
|
|
100
93
|
declare const DETACH_REASONS: readonly ['taken_over', 'slow', 'lost'];
|
|
101
94
|
type DetachReason = (typeof DETACH_REASONS)[number];
|
|
102
|
-
//#endregion
|
|
103
|
-
//#region ../api/src/schemas/event-schema.d.ts
|
|
104
95
|
declare const ImpEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
105
96
|
v: z.ZodLiteral<1>;
|
|
106
97
|
at: z.ZodDate;
|
|
@@ -151,6 +142,7 @@ declare const ImpEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
151
142
|
}, z.core.$strip>>;
|
|
152
143
|
createdAt: z.ZodDate;
|
|
153
144
|
lastActiveAt: z.ZodDate;
|
|
145
|
+
lastRequestAt: z.ZodOptional<z.ZodDate>;
|
|
154
146
|
ramMib: z.ZodOptional<z.ZodInt>;
|
|
155
147
|
rssMib: z.ZodOptional<z.ZodInt>;
|
|
156
148
|
sleptAt: z.ZodOptional<z.ZodDate>;
|
|
@@ -266,6 +258,7 @@ declare const ImpEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
266
258
|
}, z.core.$strip>>;
|
|
267
259
|
createdAt: z.ZodDate;
|
|
268
260
|
lastActiveAt: z.ZodDate;
|
|
261
|
+
lastRequestAt: z.ZodOptional<z.ZodDate>;
|
|
269
262
|
ramMib: z.ZodOptional<z.ZodInt>;
|
|
270
263
|
rssMib: z.ZodOptional<z.ZodInt>;
|
|
271
264
|
sleptAt: z.ZodOptional<z.ZodDate>;
|
|
@@ -375,6 +368,7 @@ declare const ImpEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
375
368
|
}, z.core.$strip>>;
|
|
376
369
|
createdAt: z.ZodDate;
|
|
377
370
|
lastActiveAt: z.ZodDate;
|
|
371
|
+
lastRequestAt: z.ZodOptional<z.ZodDate>;
|
|
378
372
|
ramMib: z.ZodOptional<z.ZodInt>;
|
|
379
373
|
rssMib: z.ZodOptional<z.ZodInt>;
|
|
380
374
|
sleptAt: z.ZodOptional<z.ZodDate>;
|
|
@@ -486,8 +480,6 @@ declare const ImpEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
486
480
|
command: z.ZodString;
|
|
487
481
|
}, z.core.$strip>], "ev">;
|
|
488
482
|
type ImpEvent = z.infer<typeof ImpEventSchema>;
|
|
489
|
-
//#endregion
|
|
490
|
-
//#region ../api/src/protocols/tunnel-protocol.d.ts
|
|
491
483
|
declare const TunnelListenSchema: z.ZodObject<{
|
|
492
484
|
type: z.ZodLiteral<"listen">;
|
|
493
485
|
name: z.ZodString;
|
|
@@ -499,8 +491,6 @@ declare const TunnelListenSchema: z.ZodObject<{
|
|
|
499
491
|
port: z.ZodOptional<z.ZodInt>;
|
|
500
492
|
}, z.core.$strip>;
|
|
501
493
|
type TunnelListen = z.infer<typeof TunnelListenSchema>;
|
|
502
|
-
//#endregion
|
|
503
|
-
//#region ../api/src/schemas/image-schema.d.ts
|
|
504
494
|
declare const ImageSchema: z.ZodObject<{
|
|
505
495
|
id: z.ZodString;
|
|
506
496
|
name: z.ZodString;
|
|
@@ -515,8 +505,6 @@ declare const ImageSchema: z.ZodObject<{
|
|
|
515
505
|
pinned: z.ZodDefault<z.ZodBoolean>;
|
|
516
506
|
}, z.core.$strip>;
|
|
517
507
|
type Image = z.infer<typeof ImageSchema>;
|
|
518
|
-
//#endregion
|
|
519
|
-
//#region ../api/src/schemas/procedure-access-schema.d.ts
|
|
520
508
|
declare const ProcedureAccessSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
521
509
|
on: z.ZodLiteral<"none">;
|
|
522
510
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -566,13 +554,9 @@ declare const ProcedureAccessSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
566
554
|
audit: z.ZodOptional<z.ZodLiteral<false>>;
|
|
567
555
|
}, z.core.$strip>], "on">;
|
|
568
556
|
type ProcedureAccess = z.infer<typeof ProcedureAccessSchema>;
|
|
569
|
-
//#endregion
|
|
570
|
-
//#region ../api/src/contract/contract-base.d.ts
|
|
571
557
|
interface ProcedureMeta {
|
|
572
558
|
readonly access?: ProcedureAccess;
|
|
573
559
|
}
|
|
574
|
-
//#endregion
|
|
575
|
-
//#region ../api/src/contract/imp-contract.d.ts
|
|
576
560
|
declare const impContract: {
|
|
577
561
|
imps: {
|
|
578
562
|
create: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<import("zod").ZodObject<{
|
|
@@ -638,6 +622,7 @@ declare const impContract: {
|
|
|
638
622
|
}, import("zod/v4/core").$strip>>;
|
|
639
623
|
createdAt: import("zod").ZodDate;
|
|
640
624
|
lastActiveAt: import("zod").ZodDate;
|
|
625
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
641
626
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
642
627
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
643
628
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -909,6 +894,7 @@ declare const impContract: {
|
|
|
909
894
|
}, import("zod/v4/core").$strip>>;
|
|
910
895
|
createdAt: import("zod").ZodDate;
|
|
911
896
|
lastActiveAt: import("zod").ZodDate;
|
|
897
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
912
898
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
913
899
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
914
900
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -1180,6 +1166,7 @@ declare const impContract: {
|
|
|
1180
1166
|
}, import("zod/v4/core").$strip>>;
|
|
1181
1167
|
createdAt: import("zod").ZodDate;
|
|
1182
1168
|
lastActiveAt: import("zod").ZodDate;
|
|
1169
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
1183
1170
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
1184
1171
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
1185
1172
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -1627,6 +1614,7 @@ declare const impContract: {
|
|
|
1627
1614
|
}, import("zod/v4/core").$strip>>;
|
|
1628
1615
|
createdAt: import("zod").ZodDate;
|
|
1629
1616
|
lastActiveAt: import("zod").ZodDate;
|
|
1617
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
1630
1618
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
1631
1619
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
1632
1620
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -1899,6 +1887,7 @@ declare const impContract: {
|
|
|
1899
1887
|
}, import("zod/v4/core").$strip>>;
|
|
1900
1888
|
createdAt: import("zod").ZodDate;
|
|
1901
1889
|
lastActiveAt: import("zod").ZodDate;
|
|
1890
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
1902
1891
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
1903
1892
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
1904
1893
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -2171,6 +2160,7 @@ declare const impContract: {
|
|
|
2171
2160
|
}, import("zod/v4/core").$strip>>;
|
|
2172
2161
|
createdAt: import("zod").ZodDate;
|
|
2173
2162
|
lastActiveAt: import("zod").ZodDate;
|
|
2163
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
2174
2164
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
2175
2165
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
2176
2166
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -2443,6 +2433,7 @@ declare const impContract: {
|
|
|
2443
2433
|
}, import("zod/v4/core").$strip>>;
|
|
2444
2434
|
createdAt: import("zod").ZodDate;
|
|
2445
2435
|
lastActiveAt: import("zod").ZodDate;
|
|
2436
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
2446
2437
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
2447
2438
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
2448
2439
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -2715,6 +2706,7 @@ declare const impContract: {
|
|
|
2715
2706
|
}, import("zod/v4/core").$strip>>;
|
|
2716
2707
|
createdAt: import("zod").ZodDate;
|
|
2717
2708
|
lastActiveAt: import("zod").ZodDate;
|
|
2709
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
2718
2710
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
2719
2711
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
2720
2712
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -2987,6 +2979,7 @@ declare const impContract: {
|
|
|
2987
2979
|
}, import("zod/v4/core").$strip>>;
|
|
2988
2980
|
createdAt: import("zod").ZodDate;
|
|
2989
2981
|
lastActiveAt: import("zod").ZodDate;
|
|
2982
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
2990
2983
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
2991
2984
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
2992
2985
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -4009,6 +4002,7 @@ declare const impContract: {
|
|
|
4009
4002
|
}, import("zod/v4/core").$strip>>;
|
|
4010
4003
|
createdAt: import("zod").ZodDate;
|
|
4011
4004
|
lastActiveAt: import("zod").ZodDate;
|
|
4005
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
4012
4006
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
4013
4007
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
4014
4008
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -4282,6 +4276,7 @@ declare const impContract: {
|
|
|
4282
4276
|
}, import("zod/v4/core").$strip>>;
|
|
4283
4277
|
createdAt: import("zod").ZodDate;
|
|
4284
4278
|
lastActiveAt: import("zod").ZodDate;
|
|
4279
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
4285
4280
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
4286
4281
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
4287
4282
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -4566,6 +4561,7 @@ declare const impContract: {
|
|
|
4566
4561
|
}, import("zod/v4/core").$strip>>;
|
|
4567
4562
|
createdAt: import("zod").ZodDate;
|
|
4568
4563
|
lastActiveAt: import("zod").ZodDate;
|
|
4564
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
4569
4565
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
4570
4566
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
4571
4567
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -7491,6 +7487,7 @@ declare const impContract: {
|
|
|
7491
7487
|
}, import("zod/v4/core").$strip>>;
|
|
7492
7488
|
createdAt: import("zod").ZodDate;
|
|
7493
7489
|
lastActiveAt: import("zod").ZodDate;
|
|
7490
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
7494
7491
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
7495
7492
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
7496
7493
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -8319,6 +8316,7 @@ declare const impContract: {
|
|
|
8319
8316
|
}, import("zod/v4/core").$strip>>;
|
|
8320
8317
|
createdAt: import("zod").ZodDate;
|
|
8321
8318
|
lastActiveAt: import("zod").ZodDate;
|
|
8319
|
+
lastRequestAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
8322
8320
|
ramMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
8323
8321
|
rssMib: import("zod").ZodOptional<import("zod").ZodInt>;
|
|
8324
8322
|
sleptAt: import("zod").ZodOptional<import("zod").ZodDate>;
|
|
@@ -16261,6 +16259,7 @@ declare const impContract: {
|
|
|
16261
16259
|
} | undefined;
|
|
16262
16260
|
createdAt: Date;
|
|
16263
16261
|
lastActiveAt: Date;
|
|
16262
|
+
lastRequestAt?: Date | undefined;
|
|
16264
16263
|
ramMib?: number | undefined;
|
|
16265
16264
|
rssMib?: number | undefined;
|
|
16266
16265
|
sleptAt?: Date | undefined;
|
|
@@ -16339,6 +16338,7 @@ declare const impContract: {
|
|
|
16339
16338
|
} | undefined;
|
|
16340
16339
|
createdAt: Date;
|
|
16341
16340
|
lastActiveAt: Date;
|
|
16341
|
+
lastRequestAt?: Date | undefined;
|
|
16342
16342
|
ramMib?: number | undefined;
|
|
16343
16343
|
rssMib?: number | undefined;
|
|
16344
16344
|
sleptAt?: Date | undefined;
|
|
@@ -16425,6 +16425,7 @@ declare const impContract: {
|
|
|
16425
16425
|
} | undefined;
|
|
16426
16426
|
createdAt: Date;
|
|
16427
16427
|
lastActiveAt: Date;
|
|
16428
|
+
lastRequestAt?: Date | undefined;
|
|
16428
16429
|
ramMib?: number | undefined;
|
|
16429
16430
|
rssMib?: number | undefined;
|
|
16430
16431
|
sleptAt?: Date | undefined;
|
|
@@ -16548,6 +16549,7 @@ declare const impContract: {
|
|
|
16548
16549
|
} | undefined;
|
|
16549
16550
|
createdAt: Date;
|
|
16550
16551
|
lastActiveAt: Date;
|
|
16552
|
+
lastRequestAt?: Date | undefined;
|
|
16551
16553
|
ramMib?: number | undefined;
|
|
16552
16554
|
rssMib?: number | undefined;
|
|
16553
16555
|
sleptAt?: Date | undefined;
|
|
@@ -16626,6 +16628,7 @@ declare const impContract: {
|
|
|
16626
16628
|
} | undefined;
|
|
16627
16629
|
createdAt: Date;
|
|
16628
16630
|
lastActiveAt: Date;
|
|
16631
|
+
lastRequestAt?: Date | undefined;
|
|
16629
16632
|
ramMib?: number | undefined;
|
|
16630
16633
|
rssMib?: number | undefined;
|
|
16631
16634
|
sleptAt?: Date | undefined;
|
|
@@ -16712,6 +16715,7 @@ declare const impContract: {
|
|
|
16712
16715
|
} | undefined;
|
|
16713
16716
|
createdAt: Date;
|
|
16714
16717
|
lastActiveAt: Date;
|
|
16718
|
+
lastRequestAt?: Date | undefined;
|
|
16715
16719
|
ramMib?: number | undefined;
|
|
16716
16720
|
rssMib?: number | undefined;
|
|
16717
16721
|
sleptAt?: Date | undefined;
|
|
@@ -21009,8 +21013,6 @@ declare const impContract: {
|
|
|
21009
21013
|
};
|
|
21010
21014
|
};
|
|
21011
21015
|
type ImpContract = typeof impContract;
|
|
21012
|
-
//#endregion
|
|
21013
|
-
//#region ../api/src/contract/imp-errors.d.ts
|
|
21014
21016
|
declare const IMP_ERRORS: {
|
|
21015
21017
|
NOT_FOUND: {
|
|
21016
21018
|
readonly message: "Not found";
|
|
@@ -21185,8 +21187,6 @@ declare const IMP_ERRORS: {
|
|
|
21185
21187
|
}, z.core.$strip>;
|
|
21186
21188
|
};
|
|
21187
21189
|
};
|
|
21188
|
-
//#endregion
|
|
21189
|
-
//#region ../api/src/schemas/imp-schema.d.ts
|
|
21190
21190
|
declare const ImpStateSchema: z.ZodEnum<{
|
|
21191
21191
|
creating: "creating";
|
|
21192
21192
|
error: "error";
|
|
@@ -21237,6 +21237,7 @@ declare const ImpSchema: z.ZodObject<{
|
|
|
21237
21237
|
}, z.core.$strip>>;
|
|
21238
21238
|
createdAt: z.ZodDate;
|
|
21239
21239
|
lastActiveAt: z.ZodDate;
|
|
21240
|
+
lastRequestAt: z.ZodOptional<z.ZodDate>;
|
|
21240
21241
|
ramMib: z.ZodOptional<z.ZodInt>;
|
|
21241
21242
|
rssMib: z.ZodOptional<z.ZodInt>;
|
|
21242
21243
|
sleptAt: z.ZodOptional<z.ZodDate>;
|
|
@@ -21292,11 +21293,7 @@ declare const ImpSchema: z.ZodObject<{
|
|
|
21292
21293
|
}>>;
|
|
21293
21294
|
}, z.core.$strip>;
|
|
21294
21295
|
type Imp = z.infer<typeof ImpSchema>;
|
|
21295
|
-
//#endregion
|
|
21296
|
-
//#region ../api/src/protocols/login-shell.d.ts
|
|
21297
21296
|
export declare const CONSOLE_SHELL: string;
|
|
21298
|
-
//#endregion
|
|
21299
|
-
//#region ../api/src/schemas/session-schema.d.ts
|
|
21300
21297
|
declare const SessionSchema: z.ZodObject<{
|
|
21301
21298
|
name: z.ZodString;
|
|
21302
21299
|
pid: z.ZodInt;
|
|
@@ -21324,8 +21321,6 @@ declare const SessionSchema: z.ZodObject<{
|
|
|
21324
21321
|
log: z.ZodOptional<z.ZodBoolean>;
|
|
21325
21322
|
}, z.core.$strip>;
|
|
21326
21323
|
type Session = z.infer<typeof SessionSchema>;
|
|
21327
|
-
//#endregion
|
|
21328
|
-
//#region ../api/src/schemas/session-output-schema.d.ts
|
|
21329
21324
|
declare const ColdBootCauseSchema: z.ZodEnum<{
|
|
21330
21325
|
recovery: "recovery";
|
|
21331
21326
|
restore: "restore";
|
|
@@ -21440,8 +21435,6 @@ declare const InvalidResumeDataSchema: z.ZodReadonly<z.ZodObject<{
|
|
|
21440
21435
|
bufferStart: z.ZodInt;
|
|
21441
21436
|
}, z.core.$strip>>;
|
|
21442
21437
|
type InvalidResumeData = z.infer<typeof InvalidResumeDataSchema>;
|
|
21443
|
-
//#endregion
|
|
21444
|
-
//#region ../api/src/schemas/session-log-schema.d.ts
|
|
21445
21438
|
declare const SessionLogSchema: z.ZodReadonly<z.ZodObject<{
|
|
21446
21439
|
session: z.ZodString;
|
|
21447
21440
|
executionGeneration: z.ZodString;
|
|
@@ -21494,8 +21487,6 @@ declare const SessionLogReadSchema: z.ZodReadonly<z.ZodObject<{
|
|
|
21494
21487
|
}, z.core.$strip>>;
|
|
21495
21488
|
}, z.core.$strip>>;
|
|
21496
21489
|
type SessionLogRead = z.infer<typeof SessionLogReadSchema>;
|
|
21497
|
-
//#endregion
|
|
21498
|
-
//#region ../api/src/schemas/system-info-schema.d.ts
|
|
21499
21490
|
declare const SystemInfoSchema: z.ZodObject<{
|
|
21500
21491
|
version: z.ZodString;
|
|
21501
21492
|
ramBudgetMib: z.ZodInt;
|
|
@@ -21663,8 +21654,6 @@ declare const SystemFeaturesInfoSchema: z.ZodObject<{
|
|
|
21663
21654
|
}, z.core.$strip>;
|
|
21664
21655
|
}, z.core.$strip>;
|
|
21665
21656
|
type SystemFeaturesInfo = z.infer<typeof SystemFeaturesInfoSchema>;
|
|
21666
|
-
//#endregion
|
|
21667
|
-
//#region ../api/src/schemas/token-schema.d.ts
|
|
21668
21657
|
declare const ScopeSchema: z.ZodEnum<{
|
|
21669
21658
|
exec: "exec";
|
|
21670
21659
|
manage: "manage";
|
|
@@ -21714,8 +21703,6 @@ declare const IdentitySchema: z.ZodObject<{
|
|
|
21714
21703
|
imageRefPrefix: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
21715
21704
|
}, z.core.$strip>;
|
|
21716
21705
|
type Identity = z.infer<typeof IdentitySchema>;
|
|
21717
|
-
//#endregion
|
|
21718
|
-
//#region src/check-server.d.ts
|
|
21719
21706
|
export declare const CLIENT_VERSION: string;
|
|
21720
21707
|
interface ServerCheck {
|
|
21721
21708
|
readonly clientVersion: string;
|
|
@@ -21726,12 +21713,8 @@ interface ServerCheck {
|
|
|
21726
21713
|
interface CheckServerOptions {
|
|
21727
21714
|
readonly signal?: Readonly<AbortSignal>;
|
|
21728
21715
|
}
|
|
21729
|
-
//#endregion
|
|
21730
|
-
//#region ../shared/src/readonly-fields.d.ts
|
|
21731
21716
|
type ReadonlyFields<T> = { readonly [Key in keyof T]: ToReadonly<T[Key]>; };
|
|
21732
21717
|
type ToReadonly<T> = T extends readonly (infer Item)[] ? readonly Item[] : T extends object ? Readonly<T> : T;
|
|
21733
|
-
//#endregion
|
|
21734
|
-
//#region src/exec/open-exec-session.d.ts
|
|
21735
21718
|
type ExecStart = ReadonlyFields<Omit<z.input<typeof ExecStartMessageSchema>, 'type' | 'tool' | 'outer'>>;
|
|
21736
21719
|
type ExecAttach = ReadonlyFields<Omit<z.input<typeof ExecAttachMessageSchema>, 'type'>>;
|
|
21737
21720
|
interface ExecStarted {
|
|
@@ -21794,8 +21777,6 @@ interface ExecSession {
|
|
|
21794
21777
|
readonly stop: () => void;
|
|
21795
21778
|
}
|
|
21796
21779
|
export declare function openExecSession(options: Readonly<ExecSessionOptions>): ExecSession;
|
|
21797
|
-
//#endregion
|
|
21798
|
-
//#region src/exec/open-exec.d.ts
|
|
21799
21780
|
interface ExecOptions {
|
|
21800
21781
|
readonly tty?: boolean;
|
|
21801
21782
|
readonly env?: Readonly<Record<string, string>>;
|
|
@@ -21838,8 +21819,6 @@ interface RunResult extends ExecExit {
|
|
|
21838
21819
|
interface RunOptions extends Omit<ExecOptions, 'tty' | 'cols' | 'rows'> {
|
|
21839
21820
|
readonly stdin?: string | Uint8Array;
|
|
21840
21821
|
}
|
|
21841
|
-
//#endregion
|
|
21842
|
-
//#region src/require-awake.d.ts
|
|
21843
21822
|
interface RequireAwakeOptions {
|
|
21844
21823
|
readonly restartError?: boolean;
|
|
21845
21824
|
readonly retryUnavailable?: {
|
|
@@ -21848,8 +21827,6 @@ interface RequireAwakeOptions {
|
|
|
21848
21827
|
};
|
|
21849
21828
|
readonly signal?: Readonly<AbortSignal>;
|
|
21850
21829
|
}
|
|
21851
|
-
//#endregion
|
|
21852
|
-
//#region src/run-image-build.d.ts
|
|
21853
21830
|
type BuildContext = Blob | Uint8Array<ArrayBuffer> | ReadableStream<Uint8Array>;
|
|
21854
21831
|
interface BuildImageOptions {
|
|
21855
21832
|
readonly dockerfile?: string;
|
|
@@ -21858,11 +21835,7 @@ interface BuildImageOptions {
|
|
|
21858
21835
|
readonly onProgress?: (progress: ImageBuildProgress) => void;
|
|
21859
21836
|
readonly onLog?: (line: string) => void;
|
|
21860
21837
|
}
|
|
21861
|
-
//#endregion
|
|
21862
|
-
//#region src/send-long-call.d.ts
|
|
21863
21838
|
type StartTimer = (fire: () => void, durationMs: number) => () => void;
|
|
21864
|
-
//#endregion
|
|
21865
|
-
//#region src/create-imp-client.d.ts
|
|
21866
21839
|
type RpcClient = ContractRouterClient<ImpContract>;
|
|
21867
21840
|
interface ImpClientOptions {
|
|
21868
21841
|
readonly url: string;
|
|
@@ -21881,8 +21854,6 @@ interface ImpClient extends RpcClient {
|
|
|
21881
21854
|
readonly openAttach: (name: string, session: string, options?: AttachOptions) => Promise<ExecHandle>;
|
|
21882
21855
|
}
|
|
21883
21856
|
export declare function createImpClient(options: Readonly<ImpClientOptions>): ImpClient;
|
|
21884
|
-
//#endregion
|
|
21885
|
-
//#region src/exec/open-tool-exec.d.ts
|
|
21886
21857
|
interface ToolExec {
|
|
21887
21858
|
readonly writeStdin: (data: Uint8Array) => Promise<void>;
|
|
21888
21859
|
readonly endStdin: () => void;
|
|
@@ -21900,22 +21871,14 @@ interface ToolExecOptions {
|
|
|
21900
21871
|
readonly connect: (url: string, headers: Readonly<Record<string, string>>) => ExecSocket;
|
|
21901
21872
|
}
|
|
21902
21873
|
export declare function openToolExec(options: ToolExecOptions): Promise<ToolExec>;
|
|
21903
|
-
//#endregion
|
|
21904
|
-
//#region src/unknown-procedure-error.d.ts
|
|
21905
21874
|
export declare class UnknownProcedureError extends Error {
|
|
21906
21875
|
readonly procedure: string;
|
|
21907
21876
|
constructor(procedure: string);
|
|
21908
21877
|
}
|
|
21909
|
-
//#endregion
|
|
21910
|
-
//#region src/resolve-impd-web-socket-url.d.ts
|
|
21911
21878
|
export declare function resolveImpdWebSocketUrl(base: string, path: string): URL;
|
|
21912
|
-
//#endregion
|
|
21913
|
-
//#region src/types.d.ts
|
|
21914
21879
|
interface CallOptions {
|
|
21915
21880
|
readonly signal?: AbortSignal;
|
|
21916
21881
|
}
|
|
21917
|
-
//#endregion
|
|
21918
|
-
//#region src/events/watch-events.d.ts
|
|
21919
21882
|
interface EventSource {
|
|
21920
21883
|
readonly events: {
|
|
21921
21884
|
readonly stream: (input?: undefined, options?: CallOptions) => Promise<AsyncIterable<ImpEvent>>;
|
|
@@ -21933,8 +21896,6 @@ interface WatchEventsOptions {
|
|
|
21933
21896
|
readonly reconnect?: WatchReconnect;
|
|
21934
21897
|
}
|
|
21935
21898
|
export declare function watchEvents(client: EventSource, options: Readonly<WatchEventsOptions>): Promise<void>;
|
|
21936
|
-
//#endregion
|
|
21937
|
-
//#region src/require-features.d.ts
|
|
21938
21899
|
type ImpdFeatures = SystemFeaturesInfo['features'];
|
|
21939
21900
|
type ImpdFeature = keyof ImpdFeatures;
|
|
21940
21901
|
interface FeatureSource {
|
|
@@ -21954,8 +21915,6 @@ export declare class MissingFeatureError extends Error {
|
|
|
21954
21915
|
export declare function requireFeatures(client: FeatureSource, needs: FeatureNeeds, options?: CallOptions): Promise<void>;
|
|
21955
21916
|
export declare function readFeatures(client: FeatureSource, options?: CallOptions): Promise<Partial<ImpdFeatures>>;
|
|
21956
21917
|
declare function collectMissingFeatures(info: Pick<SystemInfo, 'features'>, wanted: readonly ImpdFeature[]): ImpdFeature[];
|
|
21957
|
-
//#endregion
|
|
21958
|
-
//#region src/tunnel/open-forward-tunnel.d.ts
|
|
21959
21918
|
type ForwardTunnelEnd = {
|
|
21960
21919
|
readonly kind: 'done';
|
|
21961
21920
|
} | {
|
|
@@ -21987,8 +21946,6 @@ interface ForwardTunnel {
|
|
|
21987
21946
|
readonly close: () => void;
|
|
21988
21947
|
}
|
|
21989
21948
|
export declare function openForwardTunnel(options: Readonly<ForwardTunnelOptions>): ForwardTunnel;
|
|
21990
|
-
//#endregion
|
|
21991
|
-
//#region src/tunnel/open-reverse-forward.d.ts
|
|
21992
21949
|
type ReverseGuest = {
|
|
21993
21950
|
readonly network: 'unix';
|
|
21994
21951
|
readonly path: Exclude<TunnelListen['path'], undefined>;
|
|
@@ -22038,8 +21995,6 @@ interface ReverseForward {
|
|
|
22038
21995
|
readonly stop: () => void;
|
|
22039
21996
|
}
|
|
22040
21997
|
export declare function openReverseForward(options: Readonly<ReverseForwardOptions>): ReverseForward;
|
|
22041
|
-
//#endregion
|
|
22042
|
-
//#region src/exec/exec-error.d.ts
|
|
22043
21998
|
type ExecClientErrorCode = 'UNAUTHORIZED' | 'UNREACHABLE' | 'RESTARTING' | 'CONNECTION_CLOSED' | 'DETACHED' | 'BAD_MESSAGE' | 'CLOSED' | 'OUTPUT_OVERFLOW' | 'LOCAL_ERROR';
|
|
22044
21999
|
export declare class ExecError extends Error {
|
|
22045
22000
|
readonly code: string;
|
|
@@ -22049,24 +22004,17 @@ export declare class ExecError extends Error {
|
|
|
22049
22004
|
cause?: unknown;
|
|
22050
22005
|
}>);
|
|
22051
22006
|
}
|
|
22052
|
-
//#endregion
|
|
22053
|
-
//#region src/exec/invalid-resume-error.d.ts
|
|
22054
22007
|
export declare class InvalidResumeError extends ExecError {
|
|
22055
22008
|
readonly data: InvalidResumeData;
|
|
22056
22009
|
constructor(message: string, data: InvalidResumeData);
|
|
22057
22010
|
}
|
|
22058
|
-
//#endregion
|
|
22059
|
-
//#region src/exec/invalid-state-error.d.ts
|
|
22060
22011
|
type InvalidStateData = ReadonlyFields<z.infer<typeof IMP_ERRORS.INVALID_STATE.data>>;
|
|
22061
22012
|
export declare class InvalidStateError extends ExecError {
|
|
22062
22013
|
readonly data: InvalidStateData;
|
|
22063
22014
|
constructor(message: string, data: Readonly<InvalidStateData>);
|
|
22064
22015
|
}
|
|
22065
|
-
//#endregion
|
|
22066
|
-
//#region src/exec/no-session-error.d.ts
|
|
22067
22016
|
export declare class NoSessionError extends ExecError {
|
|
22068
22017
|
readonly data: NoSessionData | undefined;
|
|
22069
22018
|
constructor(message: string, data: NoSessionData | undefined);
|
|
22070
22019
|
}
|
|
22071
|
-
//#endregion
|
|
22072
22020
|
export { type ApiCall, type AttachOptions, type BuildContext, type BuildImageOptions, type CheckServerOptions, type Checkpoint, type ColdBoot, type ColdBootCause, type ConsoleOptions, type DetachReason, type EventSource, type ExecClientErrorCode, type ExecExit, type ExecHandle, type ExecOptions, type ExecOutcome, type ExecRequirement, type ExecSession, type ExecSessionOptions, type ExecSocket, type ExecStarted, type FeatureNeeds, type FeatureSource, type ForwardTunnel, type ForwardTunnelEnd, type ForwardTunnelOptions, type Identity, type Image, type ImageBuildPhase, type ImageBuildProgress, type Imp, type ImpClient, type ImpClientOptions, type ImpEvent, type ImpState, type ImpdFeature, type ImpdFeatures, type InvalidResumeData, type InvalidStateData, type NoSessionData, ORPCError, type PreviousGeneration, type RequireAwakeOptions, type ResumeFrom, type ResumeResult, type ReverseForward, type ReverseForwardEnd, type ReverseForwardOptions, type ReverseGuest, type ReverseListening, type ReverseRelay, type ReverseRelayHandlers, type RunOptions, type RunResult, type Scope, type ServerCheck, type Session, type SessionLog, type SessionLogRead, type SessionOutput, type SshKey, type SystemInfo, type Token, type ToolExec, type ToolExecOptions, type WatchEventsOptions, type WatchReconnect, collectMissingFeatures as findMissingFeatures, isDefinedError, safe };
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,8 @@ import { RPCLink } from "@orpc/client/fetch";
|
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { P, match } from "ts-pattern";
|
|
5
5
|
import pRetry, { AbortError } from "p-retry";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const CLIENT_VERSION = "6.3.2";
|
|
6
|
+
// src/check-server.ts
|
|
7
|
+
const CLIENT_VERSION = "6.4.1";
|
|
9
8
|
async function checkServer(rpc, options = {}) {
|
|
10
9
|
const signal = options.signal;
|
|
11
10
|
const callOptions = signal === void 0 ? {} : { signal };
|
|
@@ -30,8 +29,7 @@ function parseVersion(version) {
|
|
|
30
29
|
minor: Number(groups["minor"])
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
|
-
|
|
34
|
-
//#region ../api/src/schemas/name-schema.ts
|
|
32
|
+
// ../api/src/schemas/name-schema.ts
|
|
35
33
|
const NameSchema = z.string().regex(/^[a-z][a-z0-9-]{0,30}$/u, "must be a lowercase letter followed by up to 30 lowercase letters, digits or hyphens");
|
|
36
34
|
z.string().regex(/^[\w.:-]{1,64}$/u, "must be 1–64 letters, digits, dots, underscores, colons or hyphens");
|
|
37
35
|
z.int().min(10).max(3600);
|
|
@@ -49,8 +47,7 @@ const LeaseSummarySchema = z.object({
|
|
|
49
47
|
leases: z.array(LeaseSchema).readonly(),
|
|
50
48
|
otherCount: z.int().nonnegative()
|
|
51
49
|
});
|
|
52
|
-
|
|
53
|
-
//#region ../api/src/protocols/build-context-protocol.ts
|
|
50
|
+
// ../api/src/protocols/build-context-protocol.ts
|
|
54
51
|
const BUILD_CONTEXT_PATH = "/images/build-context";
|
|
55
52
|
const DockerfilePathSchema = z.string().min(1).refine((path) => !path.startsWith("/") && !path.split(/[/\\]/u).includes(".."), { message: "the Dockerfile path must be relative and stay inside the build context" });
|
|
56
53
|
z.object({
|
|
@@ -65,11 +62,9 @@ const BuildContextErrorSchema = z.object({
|
|
|
65
62
|
code: z.string(),
|
|
66
63
|
message: z.string()
|
|
67
64
|
});
|
|
68
|
-
|
|
69
|
-
//#region ../api/src/schemas/offset-schema.ts
|
|
65
|
+
// ../api/src/schemas/offset-schema.ts
|
|
70
66
|
const OffsetSchema = z.int().nonnegative();
|
|
71
|
-
|
|
72
|
-
//#region ../api/src/schemas/session-output-schema.ts
|
|
67
|
+
// ../api/src/schemas/session-output-schema.ts
|
|
73
68
|
const ExecutionGenerationSchema = z.string().regex(/^[0-9a-f]{32}$/u);
|
|
74
69
|
const ColdBootCauseSchema = z.enum([
|
|
75
70
|
"start",
|
|
@@ -152,8 +147,7 @@ z.object({
|
|
|
152
147
|
endObservedAt: z.date().optional(),
|
|
153
148
|
log: z.boolean().optional()
|
|
154
149
|
});
|
|
155
|
-
|
|
156
|
-
//#region ../api/src/protocols/exec-protocol.ts
|
|
150
|
+
// ../api/src/protocols/exec-protocol.ts
|
|
157
151
|
const EXEC_PATH = "/exec";
|
|
158
152
|
const EXEC_TICKET_PARAM = "ticket";
|
|
159
153
|
const EXEC_CHANNELS = {
|
|
@@ -309,8 +303,7 @@ z.object({
|
|
|
309
303
|
credential: z.string().nullable(),
|
|
310
304
|
warning: z.string().optional()
|
|
311
305
|
});
|
|
312
|
-
|
|
313
|
-
//#region ../api/src/schemas/move-schema.ts
|
|
306
|
+
// ../api/src/schemas/move-schema.ts
|
|
314
307
|
const MoveStateSchema = z.enum([
|
|
315
308
|
"sending",
|
|
316
309
|
"moved",
|
|
@@ -367,8 +360,7 @@ z.object({
|
|
|
367
360
|
isDone: z.boolean(),
|
|
368
361
|
error: z.string().nullable()
|
|
369
362
|
});
|
|
370
|
-
|
|
371
|
-
//#region ../api/src/schemas/secret-schema.ts
|
|
363
|
+
// ../api/src/schemas/secret-schema.ts
|
|
372
364
|
const SecretNameSchema = NameSchema;
|
|
373
365
|
const PrintableSchema = z.string().regex(/^[!-~]+$/u, "must be printable ASCII without spaces");
|
|
374
366
|
PrintableSchema.min(1).max(8192);
|
|
@@ -513,8 +505,7 @@ z.object({
|
|
|
513
505
|
durationMs: z.int().nonnegative(),
|
|
514
506
|
reason: AuditRefusalSchema
|
|
515
507
|
});
|
|
516
|
-
|
|
517
|
-
//#region ../api/src/schemas/imp-schema.ts
|
|
508
|
+
// ../api/src/schemas/imp-schema.ts
|
|
518
509
|
const ImpStateSchema = z.enum([
|
|
519
510
|
"creating",
|
|
520
511
|
"running",
|
|
@@ -569,6 +560,7 @@ const ImpSchema = z.object({
|
|
|
569
560
|
public: z.object({ auth: PublicAuthSchema }).optional(),
|
|
570
561
|
createdAt: z.date(),
|
|
571
562
|
lastActiveAt: z.date(),
|
|
563
|
+
lastRequestAt: z.date().optional(),
|
|
572
564
|
ramMib: z.int().nonnegative().optional(),
|
|
573
565
|
rssMib: z.int().nonnegative().optional(),
|
|
574
566
|
sleptAt: z.date().optional(),
|
|
@@ -604,8 +596,7 @@ ImpSchema.extend({
|
|
|
604
596
|
grantsNotCopied: z.array(GrantNotCopiedSchema).readonly().optional(),
|
|
605
597
|
grantsError: z.string().optional()
|
|
606
598
|
});
|
|
607
|
-
|
|
608
|
-
//#region ../api/src/protocols/tunnel-protocol.ts
|
|
599
|
+
// ../api/src/protocols/tunnel-protocol.ts
|
|
609
600
|
const TUNNEL_PATH = "/tunnel";
|
|
610
601
|
const TUNNEL_CLOSE_NORMAL = 1e3;
|
|
611
602
|
const TUNNEL_CLOSE_PROTOCOL = 1002;
|
|
@@ -661,13 +652,11 @@ const TunnelServerMessageSchema = z.discriminatedUnion("type", [
|
|
|
661
652
|
code: z.string().optional()
|
|
662
653
|
})
|
|
663
654
|
]);
|
|
664
|
-
|
|
665
|
-
//#region ../api/src/contract/define-errors.ts
|
|
655
|
+
// ../api/src/contract/define-errors.ts
|
|
666
656
|
function defineErrors(errors) {
|
|
667
657
|
return errors;
|
|
668
658
|
}
|
|
669
|
-
|
|
670
|
-
//#region ../api/src/contract/imp-errors.ts
|
|
659
|
+
// ../api/src/contract/imp-errors.ts
|
|
671
660
|
const ResourceKindSchema = z.enum([
|
|
672
661
|
"imp",
|
|
673
662
|
"image",
|
|
@@ -778,8 +767,7 @@ const IMP_ERRORS = defineErrors({
|
|
|
778
767
|
data: z.object({ retryAfterS: z.int().positive() })
|
|
779
768
|
}
|
|
780
769
|
});
|
|
781
|
-
|
|
782
|
-
//#region ../api/src/protocols/login-shell.ts
|
|
770
|
+
// ../api/src/protocols/login-shell.ts
|
|
783
771
|
const CONSOLE_SHELL = buildConsoleShell("/etc/passwd", ["/bin/bash", "/bin/sh"]);
|
|
784
772
|
function buildConsoleShell(passwdPath, fallbacks) {
|
|
785
773
|
return [
|
|
@@ -792,8 +780,7 @@ function buildConsoleShell(passwdPath, fallbacks) {
|
|
|
792
780
|
"exec \"$shell\" -l"
|
|
793
781
|
].join("\n");
|
|
794
782
|
}
|
|
795
|
-
|
|
796
|
-
//#region src/exec/exec-error.ts
|
|
783
|
+
// src/exec/exec-error.ts
|
|
797
784
|
var ExecError = class extends Error {
|
|
798
785
|
code;
|
|
799
786
|
data;
|
|
@@ -805,15 +792,13 @@ var ExecError = class extends Error {
|
|
|
805
792
|
this.data = options.data;
|
|
806
793
|
}
|
|
807
794
|
};
|
|
808
|
-
|
|
809
|
-
//#region src/resolve-impd-url.ts
|
|
795
|
+
// src/resolve-impd-url.ts
|
|
810
796
|
function resolveImpdUrl(base, path) {
|
|
811
797
|
const url = new URL(base);
|
|
812
798
|
url.pathname = `${url.pathname.replace(/\/+$/u, "")}${path}`;
|
|
813
799
|
return url;
|
|
814
800
|
}
|
|
815
|
-
|
|
816
|
-
//#region src/create-rpc-client.ts
|
|
801
|
+
// src/create-rpc-client.ts
|
|
817
802
|
function createRpcClient(options) {
|
|
818
803
|
const customFetch = options.fetch;
|
|
819
804
|
const sendRequest = async (request, init) => {
|
|
@@ -834,15 +819,13 @@ function createRpcClient(options) {
|
|
|
834
819
|
function isJson(contentType) {
|
|
835
820
|
return (contentType ?? "").startsWith("application/json");
|
|
836
821
|
}
|
|
837
|
-
|
|
838
|
-
//#region src/resolve-impd-web-socket-url.ts
|
|
822
|
+
// src/resolve-impd-web-socket-url.ts
|
|
839
823
|
function resolveImpdWebSocketUrl(base, path) {
|
|
840
824
|
const url = resolveImpdUrl(base, path);
|
|
841
825
|
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
842
826
|
return url;
|
|
843
827
|
}
|
|
844
|
-
|
|
845
|
-
//#region src/unknown-procedure-error.ts
|
|
828
|
+
// src/unknown-procedure-error.ts
|
|
846
829
|
var UnknownProcedureError = class extends Error {
|
|
847
830
|
procedure;
|
|
848
831
|
constructor(procedure) {
|
|
@@ -851,8 +834,7 @@ var UnknownProcedureError = class extends Error {
|
|
|
851
834
|
this.procedure = procedure;
|
|
852
835
|
}
|
|
853
836
|
};
|
|
854
|
-
|
|
855
|
-
//#region src/require-features.ts
|
|
837
|
+
// src/require-features.ts
|
|
856
838
|
const FEATURE_GAPS = {
|
|
857
839
|
sessionOffsets: "has no session offsets",
|
|
858
840
|
leases: "has no leases",
|
|
@@ -914,8 +896,7 @@ function isMissingProcedure(error) {
|
|
|
914
896
|
function isImpdFeature(key) {
|
|
915
897
|
return Object.hasOwn(FEATURE_GAPS, key);
|
|
916
898
|
}
|
|
917
|
-
|
|
918
|
-
//#region src/exec/check-exec-features.ts
|
|
899
|
+
// src/exec/check-exec-features.ts
|
|
919
900
|
const CHECK_TIMEOUT_MS$1 = 5e3;
|
|
920
901
|
async function checkExecFeatures(rpc, needs) {
|
|
921
902
|
try {
|
|
@@ -949,8 +930,7 @@ function buildRefusal(error) {
|
|
|
949
930
|
detail: `feature check: ${error instanceof Error ? error.message : String(error)}`
|
|
950
931
|
};
|
|
951
932
|
}
|
|
952
|
-
|
|
953
|
-
//#region src/exec/check-impd-access.ts
|
|
933
|
+
// src/exec/check-impd-access.ts
|
|
954
934
|
const CHECK_TIMEOUT_MS = 5e3;
|
|
955
935
|
async function checkImpdAccess(rpc) {
|
|
956
936
|
try {
|
|
@@ -961,8 +941,7 @@ async function checkImpdAccess(rpc) {
|
|
|
961
941
|
return error.status === 401 ? "unauthorized" : "reachable";
|
|
962
942
|
}
|
|
963
943
|
}
|
|
964
|
-
|
|
965
|
-
//#region src/exec/open-exec-session.ts
|
|
944
|
+
// src/exec/open-exec-session.ts
|
|
966
945
|
const OPEN_TIMEOUT_MS = 1e4;
|
|
967
946
|
const DRAIN_POLL_MS = 50;
|
|
968
947
|
var BadMessageError = class extends Error {
|
|
@@ -1188,32 +1167,28 @@ function buildOpenMessage(start) {
|
|
|
1188
1167
|
...start
|
|
1189
1168
|
};
|
|
1190
1169
|
}
|
|
1191
|
-
|
|
1192
|
-
//#region src/exec/invalid-resume-error.ts
|
|
1170
|
+
// src/exec/invalid-resume-error.ts
|
|
1193
1171
|
var InvalidResumeError = class extends ExecError {
|
|
1194
1172
|
constructor(message, data) {
|
|
1195
1173
|
super("INVALID_RESUME", message, { data });
|
|
1196
1174
|
this.name = "InvalidResumeError";
|
|
1197
1175
|
}
|
|
1198
1176
|
};
|
|
1199
|
-
|
|
1200
|
-
//#region src/exec/invalid-state-error.ts
|
|
1177
|
+
// src/exec/invalid-state-error.ts
|
|
1201
1178
|
var InvalidStateError = class extends ExecError {
|
|
1202
1179
|
constructor(message, data) {
|
|
1203
1180
|
super("INVALID_STATE", message, { data });
|
|
1204
1181
|
this.name = "InvalidStateError";
|
|
1205
1182
|
}
|
|
1206
1183
|
};
|
|
1207
|
-
|
|
1208
|
-
//#region src/exec/no-session-error.ts
|
|
1184
|
+
// src/exec/no-session-error.ts
|
|
1209
1185
|
var NoSessionError = class extends ExecError {
|
|
1210
1186
|
constructor(message, data) {
|
|
1211
1187
|
super("NO_SESSION", message, { data });
|
|
1212
1188
|
this.name = "NoSessionError";
|
|
1213
1189
|
}
|
|
1214
1190
|
};
|
|
1215
|
-
|
|
1216
|
-
//#region src/exec/to-exec-error.ts
|
|
1191
|
+
// src/exec/to-exec-error.ts
|
|
1217
1192
|
function toExecError(outcome) {
|
|
1218
1193
|
return match(outcome).with({ kind: "failed" }, (failed) => toFailedError(failed.code, failed.message, failed.data)).with({ kind: "unauthorized" }, (refused) => {
|
|
1219
1194
|
return new ExecError("UNAUTHORIZED", refused.ticketRefused === true ? "impd refused the exec ticket: it expired (30 s) or was used already" : "impd rejected the token");
|
|
@@ -1237,8 +1212,7 @@ function toFailedError(code, message, data) {
|
|
|
1237
1212
|
}
|
|
1238
1213
|
return new ExecError(code ?? "EXEC_ERROR", message, { data });
|
|
1239
1214
|
}
|
|
1240
|
-
|
|
1241
|
-
//#region src/exec/open-exec.ts
|
|
1215
|
+
// src/exec/open-exec.ts
|
|
1242
1216
|
function openExec(deps, name, argv, options = {}) {
|
|
1243
1217
|
const tty = options.tty ?? false;
|
|
1244
1218
|
return openHandle(deps, options, tty, {
|
|
@@ -1489,8 +1463,7 @@ async function readAll(stream) {
|
|
|
1489
1463
|
const buffer = await new Response(stream).arrayBuffer();
|
|
1490
1464
|
return new Uint8Array(buffer);
|
|
1491
1465
|
}
|
|
1492
|
-
|
|
1493
|
-
//#region src/require-awake.ts
|
|
1466
|
+
// src/require-awake.ts
|
|
1494
1467
|
async function requireAwake(rpc, name, options = {}) {
|
|
1495
1468
|
const signal = options.signal;
|
|
1496
1469
|
const callOptions = signal === void 0 ? {} : { signal };
|
|
@@ -1534,8 +1507,7 @@ function isUnavailable(error) {
|
|
|
1534
1507
|
if (error instanceof ORPCError$1) return error.code === "SERVICE_UNAVAILABLE";
|
|
1535
1508
|
return error instanceof TypeError;
|
|
1536
1509
|
}
|
|
1537
|
-
|
|
1538
|
-
//#region src/run-image-build.ts
|
|
1510
|
+
// src/run-image-build.ts
|
|
1539
1511
|
async function runImageBuild(deps, name, context, options = {}) {
|
|
1540
1512
|
const call = { ...options.signal !== void 0 && { signal: options.signal } };
|
|
1541
1513
|
await requireFeatures(deps.rpc, { buildContextUpload: "answer the upload with not found" }, call);
|
|
@@ -1579,8 +1551,7 @@ async function writeBuildContext(deps, name, context, options) {
|
|
|
1579
1551
|
message: `impd answered ${String(response.status)} to the build context upload`
|
|
1580
1552
|
});
|
|
1581
1553
|
}
|
|
1582
|
-
|
|
1583
|
-
//#region src/send-long-call.ts
|
|
1554
|
+
// src/send-long-call.ts
|
|
1584
1555
|
const HOUR_MS = 36e5;
|
|
1585
1556
|
const LONG_CALL_DEADLINES_MS = /* @__PURE__ */ new Map([
|
|
1586
1557
|
["backups.run", 24 * HOUR_MS],
|
|
@@ -1623,8 +1594,7 @@ function formatHours(durationMs) {
|
|
|
1623
1594
|
const hours = durationMs / HOUR_MS;
|
|
1624
1595
|
return hours === 1 ? "an hour" : `${String(hours)} hours`;
|
|
1625
1596
|
}
|
|
1626
|
-
|
|
1627
|
-
//#region src/create-imp-client.ts
|
|
1597
|
+
// src/create-imp-client.ts
|
|
1628
1598
|
function createImpClient(options) {
|
|
1629
1599
|
const token = options.token;
|
|
1630
1600
|
const customFetch = options.fetch;
|
|
@@ -1699,8 +1669,7 @@ function startRealTimer(fire, durationMs) {
|
|
|
1699
1669
|
function isUnknownProcedure(status, contentType) {
|
|
1700
1670
|
return status === 404 && !(contentType ?? "").startsWith("application/json");
|
|
1701
1671
|
}
|
|
1702
|
-
|
|
1703
|
-
//#region src/exec/open-tool-exec.ts
|
|
1672
|
+
// src/exec/open-tool-exec.ts
|
|
1704
1673
|
var ToolExecError = class extends Error {
|
|
1705
1674
|
name = "ToolExecError";
|
|
1706
1675
|
};
|
|
@@ -1815,8 +1784,7 @@ function parseServerMessage(text) {
|
|
|
1815
1784
|
return null;
|
|
1816
1785
|
}
|
|
1817
1786
|
}
|
|
1818
|
-
|
|
1819
|
-
//#region src/events/watch-events.ts
|
|
1787
|
+
// src/events/watch-events.ts
|
|
1820
1788
|
async function watchEvents(client, options) {
|
|
1821
1789
|
const signal = options.signal;
|
|
1822
1790
|
const reconnect = options.reconnect;
|
|
@@ -1895,8 +1863,7 @@ function requireCleanEnd(error, signal) {
|
|
|
1895
1863
|
if (error.reason instanceof Error) throw error.reason;
|
|
1896
1864
|
if (error.reason !== null) throw new Error("the event stream failed", { cause: error.reason });
|
|
1897
1865
|
}
|
|
1898
|
-
|
|
1899
|
-
//#region src/tunnel/parse-tunnel-server-message.ts
|
|
1866
|
+
// src/tunnel/parse-tunnel-server-message.ts
|
|
1900
1867
|
function parseTunnelServerMessage(text) {
|
|
1901
1868
|
try {
|
|
1902
1869
|
const parsed = TunnelServerMessageSchema.safeParse(JSON.parse(text));
|
|
@@ -1905,8 +1872,7 @@ function parseTunnelServerMessage(text) {
|
|
|
1905
1872
|
return null;
|
|
1906
1873
|
}
|
|
1907
1874
|
}
|
|
1908
|
-
|
|
1909
|
-
//#region src/tunnel/open-forward-tunnel.ts
|
|
1875
|
+
// src/tunnel/open-forward-tunnel.ts
|
|
1910
1876
|
const CLOSE_ABNORMAL = 1006;
|
|
1911
1877
|
function openForwardTunnel(options) {
|
|
1912
1878
|
const url = resolveImpdWebSocketUrl(options.baseUrl, TUNNEL_PATH);
|
|
@@ -2026,8 +1992,7 @@ function openForwardTunnel(options) {
|
|
|
2026
1992
|
}
|
|
2027
1993
|
};
|
|
2028
1994
|
}
|
|
2029
|
-
|
|
2030
|
-
//#region src/tunnel/open-reverse-forward.ts
|
|
1995
|
+
// src/tunnel/open-reverse-forward.ts
|
|
2031
1996
|
function openReverseForward(options) {
|
|
2032
1997
|
const url = resolveImpdWebSocketUrl(options.baseUrl, TUNNEL_PATH);
|
|
2033
1998
|
const headers = options.token === null ? {} : { authorization: `Bearer ${options.token}` };
|
|
@@ -2227,5 +2192,4 @@ function buildListenMessage(name, guest) {
|
|
|
2227
2192
|
path: guest.path
|
|
2228
2193
|
};
|
|
2229
2194
|
}
|
|
2230
|
-
//#endregion
|
|
2231
2195
|
export { CLIENT_VERSION, CONSOLE_SHELL, EXEC_REQUIREMENTS, ExecError, InvalidResumeError, InvalidStateError, MissingFeatureError, NoSessionError, ORPCError, UnknownProcedureError, createImpClient, collectMissingFeatures as findMissingFeatures, isDefinedError, openExecSession, openForwardTunnel, openReverseForward, openToolExec, readFeatures, requireFeatures, resolveImpdWebSocketUrl, safe, watchEvents };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@impz/client",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.1",
|
|
4
4
|
"description": "Typed client for impd, the imp host daemon: imps, checkpoints, images and exec",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@orpc/client": "^1.16.
|
|
20
|
-
"@orpc/contract": "^1.16.
|
|
19
|
+
"@orpc/client": "^1.16.1",
|
|
20
|
+
"@orpc/contract": "^1.16.1",
|
|
21
21
|
"p-retry": "^8.0.1",
|
|
22
22
|
"ts-pattern": "^5.9.2",
|
|
23
23
|
"zod": "^4.6.7"
|