lakutata
Version:
An IoC-based universal application framework.
1,483 lines (1,313 loc) • 133 kB
TypeScript
/// <reference types="node" />
import '../vendor/TypeDef.2.js';
import { P as Provider, C as Component } from '../vendor/TypeDef.3.js';
import { ClientRequest, IncomingMessage, Agent, OutgoingHttpHeaders, RequestOptions } from 'http';
import { Socket } from 'net';
import * as stream from 'stream';
import stream__default, { Duplex, Readable, DuplexOptions } from 'stream';
import * as events from 'events';
import { T as Time } from '../vendor/TypeDef.1.js';
import { D as DTO } from '../vendor/TypeDef.5.js';
import { Logger } from './logger.js';
import { Writable } from 'node:stream';
import { C as ComponentOptionsBuilder } from '../vendor/TypeDef.6.js';
import { E as Exception } from '../vendor/TypeDef.8.js';
interface Prompt {
prompt: string;
echo?: boolean;
}
/**
* Possible Key Exchange Algorithms
*/
type KexAlgorithm =
| "curve25519-sha256"
| "curve25519-sha256@libssh.org"
| "ecdh-sha2-nistp256"
| "ecdh-sha2-nistp384"
| "ecdh-sha2-nistp521"
| "diffie-hellman-group-exchange-sha256"
| "diffie-hellman-group14-sha256"
| "diffie-hellman-group15-sha512"
| "diffie-hellman-group16-sha512"
| "diffie-hellman-group17-sha512"
| "diffie-hellman-group18-sha512"
| "diffie-hellman-group-exchange-sha1"
| "diffie-hellman-group14-sha1"
| "diffie-hellman-group1-sha1";
type ServerHostKeyAlgorithm =
| "ssh-ed25519"
| "ecdsa-sha2-nistp256"
| "ecdsa-sha2-nistp384"
| "ecdsa-sha2-nistp521"
| "rsa-sha2-512"
| "rsa-sha2-256"
| "ssh-rsa"
| "ssh-dss";
type CompressionAlgorithm = "none" | "zlib" | "zlib@openssh.com";
type CipherAlgorithm =
| "chacha20-poly1305@openssh.com"
| "aes128-gcm"
| "aes128-gcm@openssh.com"
| "aes256-gcm"
| "aes256-gcm@openssh.com"
| "aes128-ctr"
| "aes192-ctr"
| "aes256-ctr"
| "aes256-cbc"
| "aes192-cbc"
| "aes128-cbc"
| "blowfish-cbc"
| "3des-cbc"
| "arcfour256"
| "arcfour128"
| "cast128-cbc"
| "arcfour";
type MacAlgorithm =
| "hmac-sha2-256-etm@openssh.com"
| "hmac-sha2-512-etm@openssh.com"
| "hmac-sha1-etm@openssh.com"
| "hmac-sha2-256"
| "hmac-sha2-512"
| "hmac-sha1"
| "hmac-md5"
| "hmac-sha2-256-96"
| "hmac-sha2-512-96"
| "hmac-ripemd160"
| "hmac-sha1-96"
| "hmac-md5-96";
/**
* Lists of supported algorithms can either be an ordered array of all supported algorithms,
* OR a map of algorithms to manipulate the default list
*/
type AlgorithmList<T> = T[] | Record<"append" | "prepend" | "remove", T | T[]>;
/**
* Overrides for the default transport layer algorithms used for the connection.
*
* The order of the algorithms in the arrays are important, with the most favorable being first.
*/
interface Algorithms {
kex?: AlgorithmList<KexAlgorithm>;
cipher?: AlgorithmList<CipherAlgorithm>;
serverHostKey?: AlgorithmList<ServerHostKeyAlgorithm>;
hmac?: AlgorithmList<MacAlgorithm>;
compress?: AlgorithmList<CompressionAlgorithm>;
}
type KeyType =
| "ssh-rsa"
| "ssh-dss"
| "ssh-ed25519"
| "ecdsa-sha2-nistp256"
| "ecdsa-sha2-nistp384"
| "ecdsa-sha2-nistp521";
interface ParsedKey {
type: KeyType;
comment: string;
sign(data: Buffer | string, algo?: string): Buffer;
verify(data: Buffer | string, signature: Buffer, algo?: string): boolean;
isPrivateKey(): boolean;
getPrivatePEM(): string;
getPublicPEM(): string;
getPublicSSH(): Buffer;
equals(key: Buffer | string | ParsedKey): boolean;
}
type HostVerifier = (key: Buffer, verify: VerifyCallback) => void;
type SyncHostVerifier = (key: Buffer) => boolean;
type HostFingerprintVerifier = (fingerprint: string, verify: VerifyCallback) => boolean;
type SyncHostFingerprintVerifier = (fingerprint: string) => boolean;
type DebugFunction = (message: string) => void;
type AuthenticationType = "password" | "publickey" | "hostbased" | "agent" | "keyboard-interactive" | "none";
interface ConnectConfig {
/** Hostname or IP address of the server. */
host?: string;
/** Port number of the server. */
port?: number;
/** Only connect via resolved IPv4 address for `host`. */
forceIPv4?: boolean;
/** Only connect via resolved IPv6 address for `host`. */
forceIPv6?: boolean;
/** The host's key is hashed using this method and passed to `hostVerifier`. */
hostHash?: string;
/** Verifies a hexadecimal hash of the host's key. */
hostVerifier?: HostVerifier | SyncHostVerifier | HostFingerprintVerifier | SyncHostFingerprintVerifier;
/** Username for authentication. */
username?: string;
/** Password for password-based user authentication. */
password?: string;
/** Path to ssh-agent's UNIX socket for ssh-agent-based user authentication (or 'pageant' when using Pagent on Windows). */
agent?: BaseAgent | string;
/** Buffer or string that contains a private key for either key-based or hostbased user authentication (OpenSSH format). */
privateKey?: Buffer | string;
/** For an encrypted private key, this is the passphrase used to decrypt it. */
passphrase?: Buffer | string;
/** Along with `localUsername` and `privateKey`, set this to a non-empty string for hostbased user authentication. */
localHostname?: string;
/** Along with `localHostname` and `privateKey`, set this to a non-empty string for hostbased user authentication. */
localUsername?: string;
/** Try keyboard-interactive user authentication if primary user authentication method fails. */
tryKeyboard?: boolean;
/** How often (in milliseconds) to send SSH-level keepalive packets to the server. Set to 0 to disable. */
keepaliveInterval?: number;
/** How many consecutive, unanswered SSH-level keepalive packets that can be sent to the server before disconnection. */
keepaliveCountMax?: number;
/** * How long (in milliseconds) to wait for the SSH handshake to complete. */
readyTimeout?: number;
/** Performs a strict server vendor check before sending vendor-specific requests. */
strictVendor?: boolean;
/** A `ReadableStream` to use for communicating with the server instead of creating and using a new TCP connection (useful for connection hopping). */
sock?: Readable;
/** Set to `true` to use OpenSSH agent forwarding (`auth-agent@openssh.com`) for the life of the connection. */
agentForward?: boolean;
/** Explicit overrides for the default transport layer algorithms used for the connection. */
algorithms?: Algorithms;
/** A function that receives a single string argument to get detailed (local) debug information. */
debug?: DebugFunction;
/** Function with parameters (methodsLeft, partialSuccess, callback) where methodsLeft and partialSuccess are null on the first authentication attempt, otherwise are an array and boolean respectively. Return or call callback() with the name of the authentication method to try next (pass false to signal no more methods to try). Valid method names are: 'none', 'password', 'publickey', 'agent', 'keyboard-interactive', 'hostbased'. Default: function that follows a set method order: None -> Password -> Private Key -> Agent (-> keyboard-interactive if tryKeyboard is true) -> Hostbased. */
authHandler?: AuthenticationType[] | AuthHandlerMiddleware | AuthMethod[];
/** IP address of the network interface to use to connect to the server. Default: (none -- determined by OS) */
localAddress?: string;
/** The local port number to connect from. Default: (none -- determined by OS) */
localPort?: number;
/** The underlying socket timeout in ms. Default: none) */
timeout?: number;
/** A custom server software name/version identifier. Default: 'ssh2js' + moduleVersion + 'srv' */
ident?: Buffer | string;
}
interface AuthMethod {
type: AuthenticationType;
username: string;
}
/**
* Strategy returned from the {@link ConnectConfig.authHandler} to connect without authentication.
*/
interface NoAuthMethod extends AuthMethod {
type: "none";
}
/**
* Strategy returned from the {@link ConnectConfig.authHandler} to connect with a password.
*/
interface PasswordAuthMethod extends AuthMethod {
type: "password";
password: string;
}
/**
* Strategy returned from the {@link ConnectConfig.authHandler} to connect with a public key.
*/
interface PublicKeyAuthMethod extends AuthMethod {
type: "publickey";
key: ParsedKey | Buffer | string;
passphrase?: Buffer | string;
}
/**
* Strategy returned from the {@link ConnectConfig.authHandler} to connect with host-based authentication.
*/
interface HostBasedAuthMethod extends AuthMethod {
type: "hostbased";
localHostname: string;
localUsername: string;
/**
* Can be a string, Buffer, or parsed key containing a private key
*/
key: ParsedKey | Buffer | string;
/**
* `passphrase` only required for encrypted keys
*/
passphrase?: Buffer | string;
}
/**
* Strategy returned from the {@link ConnectConfig.authHandler} to connect with an agent.
*/
interface AgentAuthMethod extends AuthMethod {
type: "agent";
/**
* Can be a string that is interpreted exactly like the `agent` connection config
* option or can be a custom agent object/instance that extends and implements `BaseAgent`
*/
agent: BaseAgent | string;
}
/**
* Strategy returned from the {@link ConnectConfig.authHandler} to connect with an agent.
*/
interface KeyboardInteractiveAuthMethod extends AuthMethod {
type: "keyboard-interactive";
/**
* This works exactly the same way as a 'keyboard-interactive' client event handler
*/
prompt(
name: string,
instructions: string,
lang: string,
prompts: Prompt[],
finish: KeyboardInteractiveCallback,
): void;
}
type AnyAuthMethod =
| NoAuthMethod
| PasswordAuthMethod
| HostBasedAuthMethod
| PublicKeyAuthMethod
| AgentAuthMethod
| KeyboardInteractiveAuthMethod;
type NextAuthHandler = (authName: AuthenticationType | AnyAuthMethod) => void;
type AuthHandlerMiddleware = (
authsLeft: AuthenticationType[],
partialSuccess: boolean,
next: NextAuthHandler,
) => void;
interface PublicKeyEntry {
pubKey:
| ParsedKey
| {
pubKey: ParsedKey | Buffer | string;
comment?: string;
};
}
type KnownPublicKeys<T extends string | Buffer | ParsedKey = string | Buffer | ParsedKey> = Array<
| T
| PublicKeyEntry
>;
type IdentityCallback<T extends string | Buffer | ParsedKey = string | Buffer | ParsedKey> = (
err?: Error | null,
keys?: KnownPublicKeys<T>,
) => void;
type SignCallback = (err?: Error | null, signature?: Buffer) => void;
type GetStreamCallback = (err?: Error | null, stream?: Duplex) => void;
interface SigningRequestOptions {
hash?: "sha1" | "sha256" | "sha512";
}
declare abstract class BaseAgent<TPublicKey extends string | Buffer | ParsedKey = string | Buffer | ParsedKey> {
/**
* Retrieves user identities, where `keys` is a possible array of public
* keys for authentication.
*/
abstract getIdentities(cb: IdentityCallback<TPublicKey>): void;
/**
* Signs the datawith the given public key, and calls back with its signature.
* Note that, in the current implementation, "options" is always an empty object.
*/
abstract sign(pubKey: TPublicKey, data: Buffer, options: SigningRequestOptions, cb?: SignCallback): void;
abstract sign(pubKey: TPublicKey, data: Buffer, cb: SignCallback): void;
/**
* Optional method that may be implemented to support agent forwarding. Callback
* should be invoked with a Duplex stream to be used to communicate with your agent/
* You will probably want to utilize `AgentProtocol` as agent forwarding is an
* OpenSSH feature, so the `stream` needs to be able to
* transmit/receive OpenSSH agent protocol packets.
*/
getStream?(cb: GetStreamCallback): void;
}
type VerifyCallback = (valid: boolean) => void;
type KeyboardInteractiveCallback = (answers: string[]) => void;
declare namespace DockerModem {
class HttpDuplex extends Duplex {
constructor(request: ClientRequest, response: IncomingMessage, options?: DuplexOptions);
connect(request: ClientRequest, response: IncomingMessage): void;
}
interface KeyObject {
pem: string | Buffer;
passphrase?: string | undefined;
}
interface ConstructorOptions {
socketPath?: string | undefined;
host?: string | undefined;
port?: number | string | undefined;
username?: string | undefined;
ca?: string | string[] | Buffer | Buffer[] | undefined;
cert?: string | string[] | Buffer | Buffer[] | undefined;
key?: string | string[] | Buffer | Buffer[] | KeyObject[] | undefined;
protocol?: "https" | "http" | "ssh" | undefined;
sshOptions?: ConnectConfig | undefined;
timeout?: number | undefined;
version?: string | undefined;
connectionTimeout?: number | undefined;
checkServerIdentity?: boolean | undefined;
agent?: Agent | undefined;
headers?: OutgoingHttpHeaders | undefined;
Promise?: typeof Promise | undefined;
}
interface DialOptions {
path: string;
method?: string | undefined;
headers?: OutgoingHttpHeaders | undefined;
allowEmpty?: boolean | undefined;
options?: {
_query?: object | undefined;
_body?: any;
[key: string]: any;
} | undefined;
authconfig?: {
key?: string | undefined;
base64?: string | undefined;
[key: string]: any;
} | undefined;
registryconfig?: {
base64?: string | undefined;
[key: string]: any;
} | undefined;
file?: string | Buffer | NodeJS.ReadableStream | undefined;
hijack?: boolean | undefined;
openStdin?: boolean | undefined;
isStream?: boolean | undefined;
statusCodes?: StatusCodes | undefined;
abortSignal?: AbortSignal;
}
interface StatusCodes {
[statusCode: number]: string | boolean;
}
interface RequestCallback {
(
err: Error | null,
result: IncomingMessage | HttpDuplex | Socket | Buffer | object | null,
): void;
}
}
declare class DockerModem {
Promise: typeof Promise;
constructor(options?: DockerModem.ConstructorOptions);
dial(options: DockerModem.DialOptions, callback?: DockerModem.RequestCallback): void;
demuxStream(stream: NodeJS.ReadableStream, stdout: NodeJS.WritableStream, stderr: NodeJS.WritableStream): void;
followProgress(
stream: NodeJS.ReadableStream,
onFinished: (error: Error | null, result: any[]) => void,
onProgress?: (obj: any) => void,
): void;
private buildRequest(
options: RequestOptions,
context: DockerModem.DialOptions,
data: string | Buffer | NodeJS.ReadableStream | undefined,
callback?: DockerModem.RequestCallback,
): void;
private buildPayload(
error: Error | undefined,
isStream: boolean,
statusCode: DockerModem.StatusCodes,
openStdin: boolean,
req: ClientRequest,
res: IncomingMessage,
json: Buffer | object | null,
callback?: DockerModem.RequestCallback,
): void;
private buildQuerystring(options: object): string;
}
declare namespace DockerModem$1 {
export {
DockerModem as default,
};
}
type Callback<T> = (error?: any, result?: T) => void;
declare namespace Dockerode {
class Container {
constructor(modem: any, id: string);
modem: any;
id: string;
inspect(options: ContainerInspectOptions, callback: Callback<ContainerInspectInfo>): void;
inspect(callback: Callback<ContainerInspectInfo>): void;
inspect(options?: ContainerInspectOptions): Promise<ContainerInspectInfo>;
rename(options: {}, callback: Callback<any>): void;
rename(options: {}): Promise<any>;
update(options: {}, callback: Callback<any>): void;
update(options: {}): Promise<any>;
top(options: {}, callback: Callback<any>): void;
top(callback: Callback<any>): void;
top(options?: {}): Promise<any>;
changes(options: {}, callback: Callback<any>): void;
changes(callback: Callback<any>): void;
changes(options?: {}): Promise<any>;
export(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
export(callback: Callback<NodeJS.ReadableStream>): void;
export(options?: {}): Promise<NodeJS.ReadableStream>;
start(options: ContainerStartOptions, callback: Callback<any>): void;
start(callback: Callback<any>): void;
start(options?: ContainerStartOptions): Promise<any>;
pause(options: {}, callback: Callback<any>): void;
pause(callback: Callback<any>): void;
pause(options?: {}): Promise<any>;
unpause(options: {}, callback: Callback<any>): void;
unpause(callback: Callback<any>): void;
unpause(options?: {}): Promise<any>;
exec(options: ExecCreateOptions, callback: Callback<Exec>): void;
exec(options: ExecCreateOptions): Promise<Exec>;
commit(options: {}, callback: Callback<any>): void;
commit(callback: Callback<any>): void;
commit(options?: {}): Promise<any>;
stop(options: ContainerStopOptions, callback: Callback<any>): void;
stop(callback: Callback<any>): void;
stop(options?: ContainerStopOptions): Promise<any>;
restart(options: {}, callback: Callback<any>): void;
restart(callback: Callback<any>): void;
restart(options?: {}): Promise<any>;
kill(options: {}, callback: Callback<any>): void;
kill(callback: Callback<any>): void;
kill(options?: {}): Promise<any>;
resize(options: {}, callback: Callback<any>): void;
resize(callback: Callback<any>): void;
resize(options?: {}): Promise<any>;
wait(options: ContainerWaitOptions, callback: Callback<any>): void;
wait(callback: Callback<any>): void;
wait(options?: ContainerWaitOptions): Promise<any>;
remove(options: ContainerRemoveOptions, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
remove(options?: {}): Promise<any>;
/** Deprecated since RAPI v1.20 */
copy(options: {}, callback: Callback<any>): void;
/** Deprecated since RAPI v1.20 */
copy(callback: Callback<any>): void;
/** Deprecated since RAPI v1.20 */
copy(options?: {}): Promise<any>;
getArchive(options: {}, callback: Callback<NodeJS.ReadableStream>): void;
getArchive(options: {}): Promise<NodeJS.ReadableStream>;
infoArchive(options: {}, callback: Callback<any>): void;
infoArchive(options: {}): Promise<any>;
/** @param file Filename (will read synchronously), Buffer or stream */
putArchive(
file: string | Buffer | NodeJS.ReadableStream,
options: {},
callback: Callback<NodeJS.WritableStream>,
): void;
putArchive(file: string | Buffer | NodeJS.ReadableStream, options: {}): Promise<NodeJS.ReadWriteStream>;
logs(options: ContainerLogsOptions & { follow?: false }, callback: Callback<Buffer>): void;
logs(options: ContainerLogsOptions & { follow: true }, callback: Callback<NodeJS.ReadableStream>): void;
logs(callback: Callback<Buffer>): void;
logs(options?: ContainerLogsOptions & { follow?: false }): Promise<Buffer>;
logs(options?: ContainerLogsOptions & { follow: true }): Promise<NodeJS.ReadableStream>;
stats(options: { stream?: false; "one-shot"?: boolean }, callback: Callback<ContainerStats>): void;
stats(options: { stream: true }, callback: Callback<NodeJS.ReadableStream>): void;
stats(callback: Callback<ContainerStats>): void;
stats(options?: { stream?: false; "one-shot"?: boolean }): Promise<ContainerStats>;
stats(options?: { stream: true }): Promise<NodeJS.ReadableStream>;
attach(options: ContainerAttachOptions, callback: Callback<NodeJS.ReadWriteStream>): void;
attach(options: ContainerAttachOptions): Promise<NodeJS.ReadWriteStream>;
}
class Image {
constructor(modem: any, name: string);
modem: any;
id: string;
inspect(options: ImageInspectOptions, callback: Callback<ImageInspectInfo>): void;
inspect(callback: Callback<ImageInspectInfo>): void;
inspect(options?: ImageInspectOptions): Promise<ImageInspectInfo>;
history(callback: Callback<any>): void;
history(): Promise<any>;
get(callback: Callback<NodeJS.ReadableStream>): void;
get(): Promise<NodeJS.ReadableStream>;
push(options: ImagePushOptions, callback: Callback<NodeJS.ReadableStream>): void;
push(callback: Callback<NodeJS.ReadableStream>): void;
push(options?: ImagePushOptions): Promise<NodeJS.ReadableStream>;
tag(options: ImageTagOptions, callback: Callback<any>): void;
tag(callback: Callback<any>): void;
tag(options?: ImageTagOptions): Promise<any>;
remove(options: ImageRemoveOptions, callback: Callback<ImageRemoveInfo>): void;
remove(callback: Callback<ImageRemoveInfo>): void;
remove(options?: {}): Promise<any>;
distribution(options: ImageDistributionOptions, callback: Callback<ImageDistributionInfo>): void;
distribution(callback: Callback<ImageDistributionInfo>): void;
distribution(options?: ImageDistributionOptions): Promise<ImageDistributionInfo>;
}
class Volume {
constructor(modem: any, name: string);
modem: any;
name: string;
inspect(options: {}, callback: Callback<VolumeInspectInfo>): void;
inspect(callback: Callback<VolumeInspectInfo>): void;
inspect(options?: {}): Promise<VolumeInspectInfo>;
remove(options: VolumeRemoveOptions, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
remove(options?: VolumeRemoveOptions): Promise<any>;
}
class Service {
constructor(modem: any, id: string);
modem: any;
id: string;
inspect(options: {}, callback: Callback<any>): void;
inspect(callback: Callback<any>): void;
inspect(options?: {}): Promise<any>;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
remove(options?: {}): Promise<any>;
update(options: {}, callback: Callback<any>): void;
update(options: {}): Promise<any>;
logs(options: ContainerLogsOptions, callback: Callback<NodeJS.ReadableStream>): void;
logs(callback: Callback<NodeJS.ReadableStream>): void;
logs(options?: ContainerLogsOptions): Promise<NodeJS.ReadableStream>;
}
class Task {
constructor(modem: any, id: string);
modem: any;
id: string;
inspect(options: {}, callback: Callback<any>): void;
inspect(callback: Callback<any>): void;
inspect(options?: {}): Promise<any>;
}
class Node {
constructor(modem: any, id: string);
modem: any;
id: string;
inspect(options: {}, callback: Callback<any>): void;
inspect(callback: Callback<any>): void;
inspect(options?: {}): Promise<any>;
update(options: {}, callback: Callback<any>): void;
update(callback: Callback<any>): void;
update(options?: {}): Promise<any>;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
remove(options?: {}): Promise<any>;
}
class Plugin {
constructor(modem: any, name: string, remote?: any);
modem: any;
name: string;
remote: any;
inspect(options: {}, callback: Callback<PluginInspectInfo>): void;
inspect(callback: Callback<PluginInspectInfo>): void;
inspect(options?: {}): Promise<PluginInspectInfo>;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
remove(options?: {}): Promise<any>;
privileges(options: {}, callback: Callback<any>): void;
privileges(callback: Callback<any>): void;
privileges(options?: {}): Promise<any>;
pull(options: {}, callback: Callback<any>): void;
pull(options: {}): Promise<any>;
enable(options: {}, callback: Callback<any>): void;
enable(callback: Callback<any>): void;
enable(options?: {}): Promise<any>;
disable(options: {}, callback: Callback<any>): void;
disable(callback: Callback<any>): void;
disable(options?: {}): Promise<any>;
push(options: {}, callback: Callback<any>): void;
push(callback: Callback<any>): void;
push(options?: {}): Promise<any>;
configure(options: {}, callback: Callback<any>): void;
configure(callback: Callback<any>): void;
configure(options?: {}): Promise<any>;
upgrade(auth: any, options: {}, callback: Callback<any>): void;
upgrade(auth: any, callback: Callback<any>): void;
upgrade(auth: any, options?: {}): Promise<any>;
}
class Secret {
constructor(modem: any, id: string);
modem: any;
id: string;
inspect(options: {}, callback: Callback<Secret>): void;
inspect(callback: Callback<Secret>): void;
inspect(options?: {}): Promise<Secret>;
update(options: {}, callback: Callback<any>): void;
update(callback: Callback<any>): void;
update(options?: {}): Promise<any>;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
remove(options?: {}): Promise<any>;
}
class Network {
constructor(modem: any, id: string);
modem: any;
id: string;
inspect(callback: Callback<any>): void;
inspect(): Promise<any>;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
remove(options?: {}): Promise<any>;
connect(options: NetworkConnectOptions, callback: Callback<any>): void;
connect(callback: Callback<any>): void;
connect(options?: NetworkConnectOptions): Promise<any>;
disconnect(options: {}, callback: Callback<any>): void;
disconnect(callback: Callback<any>): void;
disconnect(options?: {}): Promise<any>;
}
class Exec {
constructor(modem: any, id: string);
modem: any;
id: string;
inspect(options: ExecInspectOptions, callback: Callback<ExecInspectInfo>): void;
inspect(callback: Callback<ExecInspectInfo>): void;
inspect(options?: ExecInspectOptions): Promise<ExecInspectInfo>;
start(options: ExecStartOptions, callback: Callback<stream.Duplex>): void;
start(options: ExecStartOptions): Promise<stream.Duplex>;
resize(options: {}, callback: Callback<any>): void;
resize(options: {}): Promise<any>;
}
class Config {
constructor(modem: any, id: string);
modem: any;
id: string;
inspect(options: {}, callback: Callback<ConfigInfo>): void;
inspect(callback: Callback<ConfigInfo>): void;
inspect(options?: {}): Promise<ConfigInfo>;
update(options: {}, callback: Callback<any>): void;
update(callback: Callback<any>): void;
update(options?: {}): Promise<any>;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
remove(options?: {}): Promise<any>;
}
type Duration = number;
interface ImageDescriptor {
mediaType: string;
digest: string;
size: number;
urls?: string[] | undefined;
annotations?: { [key: string]: string } | undefined;
data?: string | undefined;
platform?:
| {
architecture: string;
os: string;
"os.version"?: string | undefined;
"os.features"?: string[] | undefined;
variant?: string | undefined;
}
| undefined;
artifactType?: string | undefined;
}
interface ImageInfo {
Id: string;
ParentId: string;
RepoTags: string[] | undefined;
RepoDigests?: string[] | undefined;
Created: number;
Size: number;
VirtualSize: number;
SharedSize: number;
Labels: { [label: string]: string };
Containers: number;
Descriptor?: ImageDescriptor | undefined;
Manifests?:
| {
ID: string;
Descriptor: ImageDescriptor;
Available: boolean;
Size: {
Total: number;
Content: number;
};
Kind: "image" | "attestation" | "unknown";
ImageData?:
| {
Platform: {
architecture: string;
os: string;
"os.version"?: string | undefined;
"os.features"?: string[] | undefined;
variant?: string | undefined;
};
Containers: string[];
Size: {
Unpacked: number;
};
}
| undefined;
AttestationData?:
| {
For: string;
}
| undefined;
}[]
| undefined;
}
interface ContainerInfo {
Id: string;
Names: string[];
Image: string;
ImageID: string;
Command: string;
Created: number;
Ports: Port[];
Labels: { [label: string]: string };
State: string;
Status: string;
HostConfig: {
NetworkMode: string;
};
NetworkSettings: {
Networks: { [networkType: string]: NetworkInfo };
};
Mounts: Array<{
Name?: string | undefined;
Type: string;
Source: string;
Destination: string;
Driver?: string | undefined;
Mode: string;
RW: boolean;
Propagation: string;
}>;
}
interface Port {
IP: string;
PrivatePort: number;
PublicPort: number;
Type: string;
}
interface NetworkInfo {
IPAMConfig?: any;
Links?: any;
Aliases?: any;
NetworkID: string;
EndpointID: string;
Gateway: string;
IPAddress: string;
IPPrefixLen: number;
IPv6Gateway: string;
GlobalIPv6Address: string;
GlobalIPv6PrefixLen: number;
MacAddress: string;
}
// Information returned from inspecting a network
interface NetworkInspectInfo {
Name: string;
Id: string;
Created: string;
Scope: string;
Driver: string;
EnableIPv6: boolean;
IPAM?: IPAM | undefined;
Internal: boolean;
Attachable: boolean;
Ingress: boolean;
ConfigFrom?: { Network: string } | undefined;
ConfigOnly: boolean;
Containers?: { [id: string]: NetworkContainer } | undefined;
Options?: { [key: string]: string } | undefined;
Labels?: { [key: string]: string } | undefined;
}
interface NetworkCreateOptions {
Name: string;
CheckDuplicate?: boolean | undefined;
Driver?: string | undefined;
Internal?: boolean | undefined;
Attachable?: boolean | undefined;
Ingress?: boolean | undefined;
IPAM?: IPAM | undefined;
EnableIPv6?: boolean | undefined;
Options?: { [option: string]: string } | undefined;
Labels?: { [label: string]: string } | undefined;
abortSignal?: AbortSignal;
}
interface NetworkConnectOptions {
Container?: string;
EndpointConfig?: EndpointSettings | undefined;
}
interface NetworkContainer {
Name: string;
EndpointID: string;
MacAddress: string;
IPv4Address: string;
IPv6Address: string;
}
/* tslint:disable:interface-name */
interface IPAM {
Driver: string;
Config?: Array<{ [key: string]: string }> | undefined;
Options?: { [key: string]: string } | undefined;
}
/* tslint:enable:interface-name */
interface VolumeCreateOptions {
Name?: string | undefined;
Driver?: string | undefined;
DriverOpts?: { [key: string]: string } | undefined;
Labels?: { [label: string]: string } | undefined;
abortSignal?: AbortSignal;
}
interface VolumePruneOptions {
abortSignal?: AbortSignal;
/**
* Filters to process on the prune list, encoded as JSON (a `map[string][]string`).
* A dictionary of key/value list is also accepted.
*/
filters?: string | { [key: string]: string[] };
}
interface VolumeRemoveOptions {
abortSignal?: AbortSignal;
force?: boolean | undefined;
}
interface VolumeCreateResponse {
Name: string;
Driver: string;
Mountpoint: string;
CreatedAt?: string | undefined;
Status?: { [key: string]: string } | undefined;
Labels: { [label: string]: string };
Scope: string;
Options: { [key: string]: string };
// Field is sometimes present, and sometimes null
UsageData?:
| {
Size: number;
RefCount: number;
}
| null
| undefined;
}
interface VolumeInspectInfo {
Name: string;
Driver: string;
Mountpoint: string;
Status?: { [key: string]: string } | undefined;
Labels: { [key: string]: string };
Scope: "local" | "global";
// Field is always present, but sometimes is null
Options: { [key: string]: string } | null;
// Field is sometimes present, and sometimes null
UsageData?:
| {
Size: number;
RefCount: number;
}
| null
| undefined;
}
interface ContainerInspectInfo {
Id: string;
Created: string;
Path: string;
Args: string[];
State: {
Status: string;
Running: boolean;
Paused: boolean;
Restarting: boolean;
OOMKilled: boolean;
Dead: boolean;
Pid: number;
ExitCode: number;
Error: string;
StartedAt: string;
FinishedAt: string;
Health?:
| {
Status: string;
FailingStreak: number;
Log: Array<{
Start: string;
End: string;
ExitCode: number;
Output: string;
}>;
}
| undefined;
};
Image: string;
ResolvConfPath: string;
HostnamePath: string;
HostsPath: string;
LogPath: string;
Name: string;
RestartCount: number;
Driver: string;
Platform: string;
MountLabel: string;
ProcessLabel: string;
AppArmorProfile: string;
ExecIDs?: string[] | undefined;
HostConfig: HostConfig;
GraphDriver: {
Name: string;
Data: {
DeviceId: string;
DeviceName: string;
DeviceSize: string;
};
};
Mounts: Array<{
Type: "bind" | "volume" | "image" | "tmpfs" | "npipe" | "cluster";
Name?: string | undefined;
Source: string;
Destination: string;
Driver?: string | undefined;
Mode: string;
RW: boolean;
Propagation: string;
}>;
Config: {
Hostname: string;
Domainname: string;
User: string;
AttachStdin: boolean;
AttachStdout: boolean;
AttachStderr: boolean;
ExposedPorts: { [portAndProtocol: string]: {} };
Tty: boolean;
OpenStdin: boolean;
StdinOnce: boolean;
Env: string[];
Cmd: string[];
Image: string;
Volumes: { [volume: string]: {} };
WorkingDir: string;
Entrypoint?: string | string[] | undefined;
OnBuild?: any;
Labels: { [label: string]: string };
};
NetworkSettings: {
Bridge: string;
SandboxID: string;
HairpinMode: boolean;
LinkLocalIPv6Address: string;
LinkLocalIPv6PrefixLen: number;
Ports: {
[portAndProtocol: string]: Array<{
HostIp: string;
HostPort: string;
}>;
};
SandboxKey: string;
SecondaryIPAddresses?: any;
SecondaryIPv6Addresses?: any;
EndpointID: string;
Gateway: string;
GlobalIPv6Address: string;
GlobalIPv6PrefixLen: number;
IPAddress: string;
IPPrefixLen: number;
IPv6Gateway: string;
MacAddress: string;
Networks: {
[type: string]: {
IPAMConfig?: any;
Links?: any;
Aliases?: any;
NetworkID: string;
EndpointID: string;
Gateway: string;
IPAddress: string;
IPPrefixLen: number;
IPv6Gateway: string;
GlobalIPv6Address: string;
GlobalIPv6PrefixLen: number;
MacAddress: string;
};
};
Node?:
| {
ID: string;
IP: string;
Addr: string;
Name: string;
Cpus: number;
Memory: number;
Labels: any;
}
| undefined;
};
}
interface NetworkListOptions {
/**
* JSON encoded value of the filters (a `map[string][]string`) to process on the networks list.
* A dictionary of key/value list is also accepted.
*/
filters?: string | { [key: string]: string[] };
abortSignal?: AbortSignal;
}
interface NetworkStats {
[name: string]: {
rx_bytes: number;
rx_dropped: number;
rx_errors: number;
rx_packets: number;
tx_bytes: number;
tx_dropped: number;
tx_errors: number;
tx_packets: number;
endpoint_id?: string; // not used on linux
instance_id?: string; // not used on linux
};
}
interface VolumeListOptions {
abortSignal?: AbortSignal;
/**
* A JSON encoded value of the filters (a map[string][]string) to process on the volume list.
*/
filters?: string | { [key: string]: string[] };
/**
* Show digest information as a RepoDigests field on each image.
* @default false
*/
digests?: boolean;
}
interface NodeListOptions {
abortSignal?: AbortSignal;
/**
* Filters to process on the nodes list, encoded as JSON (a `map[string][]string`).
*/
filters?: string;
}
interface CPUUsage {
percpu_usage: number[];
usage_in_usermode: number;
total_usage: number;
usage_in_kernelmode: number;
}
interface ThrottlingData {
periods: number;
throttled_periods: number;
throttled_time: number;
}
interface CPUStats {
cpu_usage: CPUUsage;
system_cpu_usage: number;
online_cpus: number;
throttling_data: ThrottlingData;
}
interface MemoryStats {
// Linux Memory Stats
stats: {
total_pgmajfault: number;
cache: number;
mapped_file: number;
total_inactive_file: number;
pgpgout: number;
rss: number;
total_mapped_file: number;
writeback: number;
unevictable: number;
pgpgin: number;
total_unevictable: number;
pgmajfault: number;
total_rss: number;
total_rss_huge: number;
total_writeback: number;
total_inactive_anon: number;
rss_huge: number;
hierarchical_memory_limit: number;
total_pgfault: number;
total_active_file: number;
active_anon: number;
total_active_anon: number;
total_pgpgout: number;
total_cache: number;
inactive_anon: number;
active_file: number;
pgfault: number;
inactive_file: number;
total_pgpgin: number;
};
max_usage: number;
usage: number;
failcnt: number;
limit: number;
// Windows Memory Stats
commitbytes?: number;
commitpeakbytes?: number;
privateworkingset?: number;
}
interface BlkioStatEntry {
major: number;
minor: number;
op: string;
value: number;
}
interface BlkioStats {
io_service_bytes_recursive: BlkioStatEntry[];
io_serviced_recursive: BlkioStatEntry[];
io_queue_recursive: BlkioStatEntry[];
io_service_time_recursive: BlkioStatEntry[];
io_wait_time_recursive: BlkioStatEntry[];
io_merged_recursive: BlkioStatEntry[];
io_time_recursive: BlkioStatEntry[];
sectors_recursive: BlkioStatEntry[];
}
interface StorageStats {
read_count_normalized?: number;
read_size_bytes?: number;
write_count_normalized?: number;
write_size_bytes?: number;
}
interface PidsStats {
current?: number;
limit?: number;
}
interface ContainerStats {
read: string;
preread: string;
pids_stats?: PidsStats;
blkio_stats?: BlkioStats;
num_procs: number;
storage_stats?: StorageStats;
networks: NetworkStats;
memory_stats: MemoryStats;
cpu_stats: CPUStats;
precpu_stats: CPUStats;
}
interface HostConfig {
AutoRemove?: boolean | undefined;
Binds?: string[] | undefined;
ContainerIDFile?: string | undefined;
LogConfig?:
| {
Type: string;
Config: any;
}
| undefined;
NetworkMode?: string | undefined;
PortBindings?: any;
RestartPolicy?: HostRestartPolicy | undefined;
VolumeDriver?: string | undefined;
VolumesFrom?: any;
Mounts?: MountConfig | undefined;
CapAdd?: any;
CapDrop?: any;
Dns?: any[] | undefined;
DnsOptions?: any[] | undefined;
DnsSearch?: string[] | undefined;
ExtraHosts?: any;
GroupAdd?: string[] | undefined;
IpcMode?: string | undefined;
Cgroup?: string | undefined;
Links?: any;
OomScoreAdj?: number | undefined;
PidMode?: string | undefined;
Privileged?: boolean | undefined;
PublishAllPorts?: boolean | undefined;
ReadonlyRootfs?: boolean | undefined;
SecurityOpt?: any;
StorageOpt?: { [option: string]: string } | undefined;
Tmpfs?: { [dir: string]: string } | undefined;
UTSMode?: string | undefined;
UsernsMode?: string | undefined;
ShmSize?: number | undefined;
Sysctls?: { [index: string]: string } | undefined;
Runtime?: string | undefined;
ConsoleSize?: number[] | undefined;
Isolation?: string | undefined;
MaskedPaths?: string[] | undefined;
ReadonlyPaths?: string[] | undefined;
CpuShares?: number | undefined;
CgroupParent?: string | undefined;
BlkioWeight?: number | undefined;
BlkioWeightDevice?: any;
BlkioDeviceReadBps?: any;
BlkioDeviceWriteBps?: any;
BlkioDeviceReadIOps?: any;
BlkioDeviceWriteIOps?: any;
CpuPeriod?: number | undefined;
CpuQuota?: number | undefined;
CpusetCpus?: string | undefined;
CpusetMems?: string | undefined;
Devices?: any;
DeviceCgroupRules?: string[] | undefined;
DeviceRequests?: DeviceRequest[] | undefined;
DiskQuota?: number | undefined;
KernelMemory?: number | undefined;
Memory?: number | undefined;
MemoryReservation?: number | undefined;
MemorySwap?: number | undefined;
MemorySwappiness?: number | undefined;
NanoCpus?: number | undefined;
OomKillDisable?: boolean | undefined;
Init?: boolean | undefined;
PidsLimit?: number | undefined;
Ulimits?: Ulimit[] | undefined;
CpuCount?: number | undefined;
CpuPercent?: number | undefined;
CpuRealtimePeriod?: number | undefined;
CpuRealtimeRuntime?: number | undefined;
}
interface ImageInspectInfo {
Id: string;
RepoTags: string[];
RepoDigests: string[];
Parent: string;
Comment: string;
Created: string;
Container: string;
ContainerConfig: {
Hostname: string;
Domainname: string;
User: string;
AttachStdin: boolean;
AttachStdout: boolean;
AttachStderr: boolean;
ExposedPorts: { [portAndProtocol: string]: {} };
Tty: boolean;
OpenStdin: boolean;
StdinOnce: boolean;
Env: string[];
Cmd: string[];
ArgsEscaped: boolean;
Image: string;
Volumes: { [path: string]: {} };
WorkingDir: string;
Entrypoint?: string | string[] | undefined;
OnBuild?: any[] | undefined;
Labels: { [label: string]: string };
};
DockerVersion: string;
Author: string;
Config: {
Hostname: string;
Domainname: string;
User: string;
AttachStdin: boolean;
AttachStdout: boolean;
AttachStderr: boolean;
ExposedPorts: { [portAndProtocol: string]: {} };
Tty: boolean;
OpenStdin: boolean;
StdinOnce: boolean;
Env: string[];
Cmd: string[];
ArgsEscaped: boolean;
Image: string;
Volumes: { [path: string]: {} };
WorkingDir: string;
Entrypoint?: string | string[] | undefined;
OnBuild: any[];
Labels: { [label: string]: string };
};
Architecture: string;
Variant?: string | undefined;
Os: string;
OsVersion?: string | undefined;
Size: number;
VirtualSize: number;
GraphDriver: {
Name: string;
Data: {
DeviceId: string;
DeviceName: string;
DeviceSize: string;
};
};
RootFS: {
Type: string;
Layers?: string[] | undefined;
BaseLayer?: string | undefined;
};
Descriptor?:
| {
mediaType: string;
digest: string;
size: number;
urls?: string[] | undefined;
annotations?: { [key: string]: string } | undefined;
data?: string | undefined;
platform?:
| {
architecture: string;
os: string;
"os.version"?: string | undefined;
"os.features"?: string[] | undefined;
variant?: string | undefined;
}
| undefined;
artifactType?: string | undefined;
}
| undefined;
Manifests?:
| {
ID: string;
Descriptor: {
mediaType: string;
digest: string;
size: number;
urls?: string[] | undefined;
annotations?: { [key: string]: string } | undefined;
data?: string | undefined;
platform?:
| {
architecture: string;
os: string;
"os.version"?: string | undefined;
"os.features"?: string[] | undefined;
variant?: string | undefined;
}
| undefined;
artifactType?: string | undefined;