@impz/client 2.6.0 → 2.8.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
@@ -20838,6 +20838,10 @@ interface ServerCheck {
20838
20838
  readonly clientVersion: string;
20839
20839
  readonly serverVersion: string;
20840
20840
  readonly compatible: boolean;
20841
+ readonly info: SystemInfo;
20842
+ }
20843
+ interface CheckServerOptions {
20844
+ readonly signal?: Readonly<AbortSignal>;
20841
20845
  }
20842
20846
  //#endregion
20843
20847
  //#region src/build-image.d.ts
@@ -20986,7 +20990,7 @@ interface ImpClientOptions {
20986
20990
  }
20987
20991
  interface ImpClient extends RpcClient {
20988
20992
  readonly requireAwake: (name: string, options?: RequireAwakeOptions) => Promise<Imp>;
20989
- readonly checkServer: () => Promise<ServerCheck>;
20993
+ readonly checkServer: (options?: CheckServerOptions) => Promise<ServerCheck>;
20990
20994
  readonly buildImage: (name: string, context: BuildContext, options?: BuildImageOptions) => Promise<Image>;
20991
20995
  readonly openExec: (name: string, argv: readonly string[], options?: ExecOptions) => Promise<ExecHandle>;
20992
20996
  readonly run: (name: string, argv: readonly string[], options?: RunOptions) => Promise<RunResult>;
@@ -21182,4 +21186,4 @@ export declare class NoSessionError extends ExecError {
21182
21186
  constructor(message: string, data: NoSessionData | undefined);
21183
21187
  }
21184
21188
  //#endregion
21185
- 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.6.0";
9
- async function checkServer(rpc) {
10
- const info = await rpc.system.info();
8
+ const CLIENT_VERSION = "2.8.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) {
@@ -1736,7 +1739,7 @@ function createImpClient(options) {
1736
1739
  openConsole: (name, consoleOptions) => openConsole(execDeps, name, consoleOptions),
1737
1740
  openAttach: (name, session, attachOptions) => openAttach(execDeps, name, session, attachOptions),
1738
1741
  requireAwake: (name, awakeOptions) => requireAwake(rpc, name, awakeOptions),
1739
- checkServer: () => checkServer(rpc),
1742
+ checkServer: (checkOptions) => checkServer(rpc, checkOptions),
1740
1743
  buildImage: (name, context, buildOptions) => buildImage(execDeps, name, context, buildOptions)
1741
1744
  };
1742
1745
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impz/client",
3
- "version": "2.6.0",
3
+ "version": "2.8.0",
4
4
  "description": "Typed client for impd, the imp host daemon: imps, checkpoints, images and exec",
5
5
  "license": "MIT",
6
6
  "repository": {