@impz/client 2.5.5 → 2.7.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 CHANGED
@@ -237,9 +237,11 @@ same way with `reason: 'impd_outdated'` before it sends the start. See
237
237
 
238
238
  The client and impd are released together with the same version. `imp.checkServer()` tells whether
239
239
  impd speaks this client's API: the major version must match, and before 1.0 the minor version too.
240
+ Its optional `signal` ends the call, and the check rejects with the signal's reason. `check.info`
241
+ holds the `system.info` answer it read, features included.
240
242
 
241
243
  ```ts
242
- const check = await imp.checkServer();
244
+ const check = await imp.checkServer({ signal: AbortSignal.timeout(5000) });
243
245
 
244
246
  if (!check.compatible) {
245
247
  throw new Error(`impd ${check.serverVersion} does not match client ${check.clientVersion}`);
package/dist/index.d.ts CHANGED
@@ -16513,6 +16513,10 @@ declare const impContract: {
16513
16513
  systemDrive: z.ZodObject<{
16514
16514
  sha256: z.ZodString;
16515
16515
  }, z.core.$strip>;
16516
+ guest: z.ZodOptional<z.ZodObject<{
16517
+ scratchDir: z.ZodString;
16518
+ isClearedOnBoot: z.ZodBoolean;
16519
+ }, z.core.$strip>>;
16516
16520
  storage: z.ZodObject<{
16517
16521
  backend: z.ZodEnum<{
16518
16522
  xfs: "xfs";
@@ -16598,6 +16602,7 @@ declare const impContract: {
16598
16602
  grantFilters: z.ZodOptional<z.ZodBoolean>;
16599
16603
  readOnlyFiles: z.ZodOptional<z.ZodBoolean>;
16600
16604
  execDropSysAdmin: z.ZodOptional<z.ZodBoolean>;
16605
+ guestScratch: z.ZodOptional<z.ZodBoolean>;
16601
16606
  }, z.core.$strip>>;
16602
16607
  }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
16603
16608
  NOT_FOUND: {
@@ -16798,6 +16803,7 @@ declare const impContract: {
16798
16803
  grantFilters: z.ZodOptional<z.ZodBoolean>;
16799
16804
  readOnlyFiles: z.ZodOptional<z.ZodBoolean>;
16800
16805
  execDropSysAdmin: z.ZodOptional<z.ZodBoolean>;
16806
+ guestScratch: z.ZodOptional<z.ZodBoolean>;
16801
16807
  }, z.core.$strip>;
16802
16808
  }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, {
16803
16809
  NOT_FOUND: {
@@ -20652,6 +20658,10 @@ declare const SystemInfoSchema: z.ZodObject<{
20652
20658
  systemDrive: z.ZodObject<{
20653
20659
  sha256: z.ZodString;
20654
20660
  }, z.core.$strip>;
20661
+ guest: z.ZodOptional<z.ZodObject<{
20662
+ scratchDir: z.ZodString;
20663
+ isClearedOnBoot: z.ZodBoolean;
20664
+ }, z.core.$strip>>;
20655
20665
  storage: z.ZodObject<{
20656
20666
  backend: z.ZodEnum<{
20657
20667
  xfs: "xfs";
@@ -20737,6 +20747,7 @@ declare const SystemInfoSchema: z.ZodObject<{
20737
20747
  grantFilters: z.ZodOptional<z.ZodBoolean>;
20738
20748
  readOnlyFiles: z.ZodOptional<z.ZodBoolean>;
20739
20749
  execDropSysAdmin: z.ZodOptional<z.ZodBoolean>;
20750
+ guestScratch: z.ZodOptional<z.ZodBoolean>;
20740
20751
  }, z.core.$strip>>;
20741
20752
  }, z.core.$strip>;
20742
20753
  type SystemInfo = z.infer<typeof SystemInfoSchema>;
@@ -20765,6 +20776,7 @@ declare const SystemFeaturesInfoSchema: z.ZodObject<{
20765
20776
  grantFilters: z.ZodOptional<z.ZodBoolean>;
20766
20777
  readOnlyFiles: z.ZodOptional<z.ZodBoolean>;
20767
20778
  execDropSysAdmin: z.ZodOptional<z.ZodBoolean>;
20779
+ guestScratch: z.ZodOptional<z.ZodBoolean>;
20768
20780
  }, z.core.$strip>;
20769
20781
  }, z.core.$strip>;
20770
20782
  type SystemFeaturesInfo = z.infer<typeof SystemFeaturesInfoSchema>;
@@ -20826,6 +20838,10 @@ interface ServerCheck {
20826
20838
  readonly clientVersion: string;
20827
20839
  readonly serverVersion: string;
20828
20840
  readonly compatible: boolean;
20841
+ readonly info: SystemInfo;
20842
+ }
20843
+ interface CheckServerOptions {
20844
+ readonly signal?: Readonly<AbortSignal>;
20829
20845
  }
20830
20846
  //#endregion
20831
20847
  //#region src/build-image.d.ts
@@ -20974,7 +20990,7 @@ interface ImpClientOptions {
20974
20990
  }
20975
20991
  interface ImpClient extends RpcClient {
20976
20992
  readonly requireAwake: (name: string, options?: RequireAwakeOptions) => Promise<Imp>;
20977
- readonly checkServer: () => Promise<ServerCheck>;
20993
+ readonly checkServer: (options?: CheckServerOptions) => Promise<ServerCheck>;
20978
20994
  readonly buildImage: (name: string, context: BuildContext, options?: BuildImageOptions) => Promise<Image>;
20979
20995
  readonly openExec: (name: string, argv: readonly string[], options?: ExecOptions) => Promise<ExecHandle>;
20980
20996
  readonly run: (name: string, argv: readonly string[], options?: RunOptions) => Promise<RunResult>;
@@ -21170,4 +21186,4 @@ export declare class NoSessionError extends ExecError {
21170
21186
  constructor(message: string, data: NoSessionData | undefined);
21171
21187
  }
21172
21188
  //#endregion
21173
- export { type ApiCall, type AttachOptions, type BuildContext, type BuildImageOptions, 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, isDefinedError, safe };
21189
+ 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, isDefinedError, safe };
package/dist/index.js CHANGED
@@ -5,13 +5,16 @@ import { P, match } from "ts-pattern";
5
5
  import pRetry, { AbortError } from "p-retry";
6
6
  //#endregion
7
7
  //#region src/check-server.ts
8
- const CLIENT_VERSION = "2.5.5";
9
- async function checkServer(rpc) {
10
- const info = await rpc.system.info();
8
+ const CLIENT_VERSION = "2.7.0";
9
+ async function checkServer(rpc, options = {}) {
10
+ const signal = options.signal;
11
+ const callOptions = signal === void 0 ? {} : { signal };
12
+ const info = await rpc.system.info(void 0, callOptions);
11
13
  return {
12
14
  clientVersion: CLIENT_VERSION,
13
15
  serverVersion: info.version,
14
- compatible: isCompatibleVersion(CLIENT_VERSION, info.version)
16
+ compatible: isCompatibleVersion(CLIENT_VERSION, info.version),
17
+ info
15
18
  };
16
19
  }
17
20
  function isCompatibleVersion(client, server) {
@@ -974,7 +977,8 @@ const FEATURE_GAPS = {
974
977
  brokerRefusals: "has no audit of refused broker requests",
975
978
  grantFilters: "has no grant filters",
976
979
  readOnlyFiles: "has no read-only files",
977
- execDropSysAdmin: "cannot drop CAP_SYS_ADMIN from a command"
980
+ execDropSysAdmin: "cannot drop CAP_SYS_ADMIN from a command",
981
+ guestScratch: "does not name the guest scratch folder"
978
982
  };
979
983
  var MissingFeatureError = class extends Error {
980
984
  name = "MissingFeatureError";
@@ -1735,7 +1739,7 @@ function createImpClient(options) {
1735
1739
  openConsole: (name, consoleOptions) => openConsole(execDeps, name, consoleOptions),
1736
1740
  openAttach: (name, session, attachOptions) => openAttach(execDeps, name, session, attachOptions),
1737
1741
  requireAwake: (name, awakeOptions) => requireAwake(rpc, name, awakeOptions),
1738
- checkServer: () => checkServer(rpc),
1742
+ checkServer: (checkOptions) => checkServer(rpc, checkOptions),
1739
1743
  buildImage: (name, context, buildOptions) => buildImage(execDeps, name, context, buildOptions)
1740
1744
  };
1741
1745
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impz/client",
3
- "version": "2.5.5",
3
+ "version": "2.7.0",
4
4
  "description": "Typed client for impd, the imp host daemon: imps, checkpoints, images and exec",
5
5
  "license": "MIT",
6
6
  "repository": {