UNPKG

the-moby-effect

Version:
351 lines 21.1 kB
/** * Docker engine callbacks api * * @since 1.0.0 */ import type * as Exit from "effect/Exit"; import type * as Layer from "effect/Layer"; import type * as MobySchemas from "./MobySchemas.js"; import * as Effect from "effect/Effect"; import * as Function from "effect/Function"; import * as Runtime from "effect/Runtime"; import * as Stream from "effect/Stream"; import * as DockerEngine from "./DockerEngine.js"; /** * @since 1.0.0 * @category Callbacks */ export declare const runCallbackForEffect: <R = never>(runtime: Runtime.Runtime<R>) => <A = void, E = never>(effect: Effect.Effect<A, E, R>) => (callback: (exit: Exit.Exit<A, E>) => void) => (fiberId?: import("effect/FiberId").FiberId, options?: Runtime.RunCallbackOptions<A, E> | undefined) => void; /** * @since 1.0.0 * @category Callbacks */ export declare function runCallback<R = never>(runtime: Runtime.Runtime<R>, arity: 0): <A = void, E = never>(function_: () => Effect.Effect<A, E, R>) => (callback: (exit: Exit.Exit<A, E>) => void) => void; export declare function runCallback<R = never>(runtime: Runtime.Runtime<R>, arity: 1): <Z, A = void, E = never>(function_: (z: Z) => Effect.Effect<A, E, R>) => (z: Z, callback: (exit: Exit.Exit<A, E>) => void) => void; export declare function runCallback<R = never>(runtime: Runtime.Runtime<R>, arity: 2): <Y, Z, A = void, E = never>(function_: (y: Y, z: Z) => Effect.Effect<A, E, R>) => (y: Y, z: Z, callback: (exit: Exit.Exit<A, E>) => void) => void; export declare function runCallback<R = never>(runtime: Runtime.Runtime<R>, arity: 3): <X, Y, Z, A = void, E = never>(function_: (x: X, y: Y, z: Z) => Effect.Effect<A, E, R>) => (x: X, y: Y, z: Z, callback: (exit: Exit.Exit<A, E>) => void) => void; export declare function runCallback<R = never>(runtime: Runtime.Runtime<R>, arity: 4): <W, X, Y, Z, A = void, E = never>(function_: (w: W, x: X, y: Y, z: Z) => Effect.Effect<A, E, R>) => (w: W, x: X, y: Y, z: Z, callback: (exit: Exit.Exit<A, E>) => void) => void; export declare function runCallback<R = never>(runtime: Runtime.Runtime<R>, arity: 5): <V, W, X, Y, Z, A = void, E = never>(function_: (v: V, w: W, x: X, y: Y, z: Z) => Effect.Effect<A, E, R>) => (v: V, w: W, x: X, y: Y, z: Z, callback: (exit: Exit.Exit<A, E>) => void) => void; /** * Create a callback client for the docker engine * * @since 1.0.0 * @category Callbacks */ export declare const callbackClient: <E>(layer: Layer.Layer<Layer.Layer.Success<DockerEngine.DockerLayer>, Layer.Layer.Error<DockerEngine.DockerLayer> | E, Layer.Layer.Context<DockerEngine.DockerLayer>>) => Promise<{ pull: (a: { image: string; auth?: string | undefined; platform?: string | undefined; }) => ReadableStream<MobySchemas.JSONMessage>; build: <E1>(a: { tag: string; auth?: string | undefined; platform?: string | undefined; dockerfile?: string | undefined; context: Stream.Stream<Uint8Array, E1, never>; buildArgs?: Record<string, string | undefined> | undefined; }) => ReadableStream<MobySchemas.JSONMessage>; stop: (z: string, callback: (exit: Exit.Exit<void, import("./MobyEndpoints.js").ContainersError>) => void) => void; start: (z: string, callback: (exit: Exit.Exit<void, import("./MobyEndpoints.js").ContainersError>) => void) => void; run: (z: { readonly name?: string | undefined; readonly platform?: string | undefined; readonly spec: { readonly Image: string; readonly MacAddress?: string | null | undefined; readonly Hostname?: string | null | undefined; readonly Domainname?: string | null | undefined; readonly User?: string | null | undefined; readonly AttachStdin?: boolean | null | undefined; readonly AttachStdout?: boolean | null | undefined; readonly AttachStderr?: boolean | null | undefined; readonly Tty?: boolean | null | undefined; readonly OpenStdin?: boolean | null | undefined; readonly StdinOnce?: boolean | null | undefined; readonly WorkingDir?: string | null | undefined; readonly ExposedPorts?: { readonly [x: `${number}`]: object; readonly [x: `${number}/tcp`]: object; readonly [x: `${number}/udp`]: object; } | null | undefined; readonly Env?: readonly string[] | null | undefined; readonly Cmd?: readonly string[] | null | undefined; readonly Healthcheck?: { readonly Test?: readonly string[] | null | undefined; readonly Interval?: number | undefined; readonly Timeout?: number | undefined; readonly StartPeriod?: number | undefined; readonly StartInterval?: number | undefined; readonly Retries?: number | undefined; } | null | undefined; readonly ArgsEscaped?: boolean | null | undefined; readonly Volumes?: { readonly [x: string]: object; } | null | undefined; readonly Entrypoint?: readonly string[] | null | undefined; readonly NetworkDisabled?: boolean | null | undefined; readonly OnBuild?: readonly string[] | null | undefined; readonly Labels?: { readonly [x: string]: string; } | null | undefined; readonly StopSignal?: string | null | undefined; readonly StopTimeout?: number | null | undefined; readonly Shell?: readonly string[] | null | undefined; readonly HostConfig?: { readonly Links?: readonly string[] | null | undefined; readonly Binds?: readonly string[] | null | undefined; readonly ContainerIDFile?: string | null | undefined; readonly LogConfig?: { readonly Type: string; readonly Config: { readonly [x: string]: string; } | null; } | null | undefined; readonly NetworkMode?: "default" | "none" | "host" | "bridge" | "nat" | null | undefined; readonly PortBindings?: { readonly [x: `${number}`]: readonly { readonly HostPort: string; readonly HostIp?: string | null | undefined; }[]; readonly [x: `${number}/tcp`]: readonly { readonly HostPort: string; readonly HostIp?: string | null | undefined; }[]; readonly [x: `${number}/udp`]: readonly { readonly HostPort: string; readonly HostIp?: string | null | undefined; }[]; } | null | undefined; readonly RestartPolicy?: { readonly Name: "no" | "always" | "unless-stopped" | "on-failure"; readonly MaximumRetryCount: number; } | null | undefined; readonly AutoRemove?: boolean | null | undefined; readonly VolumeDriver?: string | null | undefined; readonly VolumesFrom?: readonly string[] | null | undefined; readonly ConsoleSize?: readonly number[] | null | undefined; readonly Annotations?: { readonly [x: string]: string; } | null | undefined; readonly CapAdd?: readonly string[] | null | undefined; readonly CapDrop?: readonly string[] | null | undefined; readonly CgroupnsMode?: "" | "private" | "host" | null | undefined; readonly Dns?: readonly string[] | null | undefined; readonly DnsOptions?: readonly string[] | null | undefined; readonly DnsSearch?: readonly string[] | null | undefined; readonly ExtraHosts?: readonly string[] | null | undefined; readonly GroupAdd?: readonly string[] | null | undefined; readonly IpcMode?: "private" | "none" | "host" | "container" | "shareable" | null | undefined; readonly Cgroup?: string | null | undefined; readonly OomScoreAdj?: number | null | undefined; readonly PidMode?: string | null | undefined; readonly Privileged?: boolean | null | undefined; readonly PublishAllPorts?: boolean | null | undefined; readonly ReadonlyRootfs?: boolean | null | undefined; readonly SecurityOpt?: readonly string[] | null | undefined; readonly StorageOpt?: { readonly [x: string]: string; } | null | undefined; readonly Tmpfs?: { readonly [x: string]: string; } | null | undefined; readonly UTSMode?: string | null | undefined; readonly UsernsMode?: string | null | undefined; readonly ShmSize?: number | null | undefined; readonly Sysctls?: { readonly [x: string]: string; } | null | undefined; readonly Runtime?: string | null | undefined; readonly Isolation?: "" | "default" | "process" | "hyperv" | null | undefined; readonly CpuShares?: number | null | undefined; readonly Memory?: number | null | undefined; readonly NanoCpus?: number | null | undefined; readonly CgroupParent?: string | null | undefined; readonly BlkioWeight?: number | null | undefined; readonly BlkioWeightDevice?: readonly ({ readonly Path: string; readonly Weight: number; } | null)[] | null | undefined; readonly BlkioDeviceReadBps?: readonly ({ readonly Path: string; readonly Rate: number; } | null)[] | null | undefined; readonly BlkioDeviceWriteBps?: readonly ({ readonly Path: string; readonly Rate: number; } | null)[] | null | undefined; readonly BlkioDeviceReadIOps?: readonly ({ readonly Path: string; readonly Rate: number; } | null)[] | null | undefined; readonly BlkioDeviceWriteIOps?: readonly ({ readonly Path: string; readonly Rate: number; } | null)[] | null | undefined; readonly CpuPeriod?: number | null | undefined; readonly CpuQuota?: number | null | undefined; readonly CpuRealtimePeriod?: number | null | undefined; readonly CpuRealtimeRuntime?: number | null | undefined; readonly CpusetCpus?: string | null | undefined; readonly CpusetMems?: string | null | undefined; readonly Devices?: readonly ({ readonly PathOnHost: string; readonly PathInContainer: string; readonly CgroupPermissions: string; } | null)[] | null | undefined; readonly DeviceCgroupRules?: readonly string[] | null | undefined; readonly DeviceRequests?: readonly ({ readonly Driver: string; readonly Count: number; readonly DeviceIDs: readonly string[] | null; readonly Capabilities: readonly (readonly string[] | null)[] | null; readonly Options: { readonly [x: string]: string; } | null; } | null)[] | null | undefined; readonly KernelMemory?: number | null | undefined; readonly KernelMemoryTCP?: number | null | undefined; readonly MemoryReservation?: number | null | undefined; readonly MemorySwap?: number | null | undefined; readonly MemorySwappiness?: number | null | undefined; readonly OomKillDisable?: boolean | null | undefined; readonly PidsLimit?: number | null | undefined; readonly Ulimits?: readonly ({ readonly Name: string; readonly Hard: number; readonly Soft: number; } | null)[] | null | undefined; readonly CpuCount?: number | null | undefined; readonly CpuPercent?: number | null | undefined; readonly IOMaximumIOps?: number | null | undefined; readonly IOMaximumBandwidth?: number | null | undefined; readonly Mounts?: readonly ({ readonly BindOptions?: { readonly Propagation?: "rprivate" | "private" | "rshared" | "shared" | "rslave" | "slave" | undefined; readonly NonRecursive?: boolean | undefined; readonly CreateMountpoint?: boolean | undefined; readonly ReadOnlyNonRecursive?: boolean | undefined; readonly ReadOnlyForceRecursive?: boolean | undefined; } | null | undefined; readonly Type?: "bind" | "volume" | "tmpfs" | "npipe" | "cluster" | undefined; readonly ClusterOptions?: {} | null | undefined; readonly TmpfsOptions?: { readonly Options?: readonly (readonly string[] | null)[] | null | undefined; readonly SizeBytes?: number | undefined; readonly Mode?: number | undefined; } | null | undefined; readonly VolumeOptions?: { readonly Labels?: { readonly [x: string]: string; } | null | undefined; readonly NoCopy?: boolean | undefined; readonly Subpath?: string | undefined; readonly DriverConfig?: { readonly Name?: string | undefined; readonly Options?: { readonly [x: string]: string; } | null | undefined; } | null | undefined; } | null | undefined; readonly Source?: string | undefined; readonly Target?: string | undefined; readonly ReadOnly?: boolean | undefined; readonly Consistency?: "default" | "consistent" | "cached" | "delegated" | undefined; } | null)[] | null | undefined; readonly MaskedPaths?: readonly string[] | null | undefined; readonly ReadonlyPaths?: readonly string[] | null | undefined; readonly Init?: boolean | null | undefined; } | null | undefined; readonly NetworkingConfig?: { readonly EndpointsConfig: { readonly [x: string]: { readonly MacAddress: string; readonly NetworkID: string; readonly EndpointID: string; readonly Gateway: string; readonly IPPrefixLen: number; readonly IPv6Gateway: string; readonly GlobalIPv6Address: string; readonly GlobalIPv6PrefixLen: number; readonly IPAMConfig: { readonly IPv4Address?: string | undefined; readonly IPv6Address?: string | undefined; readonly LinkLocalIPs?: readonly string[] | null | undefined; } | null; readonly Links: readonly string[] | null; readonly Aliases: readonly string[] | null; readonly DriverOpts: { readonly [x: string]: string; } | null; readonly IPAddress: string; readonly DNSNames: readonly string[] | null; } | null; } | null; } | null | undefined; }; }, callback: (exit: Exit.Exit<MobySchemas.ContainerInspectResponse, import("./MobyEndpoints.js").ContainersError>) => void) => void; exec: (z: { containerId: string; command: string | Array<string>; }, callback: (exit: Exit.Exit<readonly [exitCode: number, output: string], import("effect/ParseResult").ParseError | import("@effect/platform/Socket").SocketError | import("./MobyEndpoints.js").ExecsError>) => void) => void; execNonBlocking: <T extends boolean | undefined = undefined>(z: { detach?: T; containerId: string; command: string | Array<string>; }, callback: (exit: Exit.Exit<[socket: T extends true ? void : import("./MobyDemux.js").MultiplexedSocket | import("./MobyDemux.js").RawSocket, execId: string], import("./MobyEndpoints.js").ExecsError>) => void) => void; execWebsockets: (z: { command: string | Array<string>; containerId: string; }, callback: (exit: Exit.Exit<readonly [stdout: string, stderr: string], import("effect/ParseResult").ParseError | import("@effect/platform/Socket").SocketError | import("./MobyEndpoints.js").ContainersError>) => void) => void; execWebsocketsNonBlocking: (a: { command: string | Array<string>; containerId: string; }) => ReadableStream<import("./MobyDemux.js").MultiplexedChannel<never, import("@effect/platform/Socket").SocketError | import("./MobyEndpoints.js").ContainersError, never>>; ps: (z: { readonly all?: boolean | undefined; readonly limit?: number | undefined; readonly size?: boolean | undefined; readonly filters?: { ancestor?: string | undefined; before?: string | undefined; expose?: `${number}/${string}` | `${number}-${number}/${string}` | undefined; exited?: number | undefined; health?: "starting" | "healthy" | "unhealthy" | "none" | undefined; id?: string | undefined; isolation?: "default" | "process" | "hyperv" | undefined; "is-task"?: true | false | undefined; label?: Record<string, string> | undefined; name?: string | undefined; network?: string | undefined; publish?: `${number}/${string}` | `${number}-${number}/${string}` | undefined; since?: string | undefined; status?: "created" | "restarting" | "running" | "removing" | "paused" | "exited" | "dead" | undefined; volume?: string | undefined; } | undefined; } | undefined, callback: (exit: Exit.Exit<readonly MobySchemas.ContainerListResponseItem[], import("./MobyEndpoints.js").ContainersError>) => void) => void; push: (a: { readonly name: string; readonly tag?: string; readonly "X-Registry-Auth": string; }) => ReadableStream<string>; images: (z: { readonly all?: boolean; readonly filters?: string | undefined; readonly "shared-size"?: boolean | undefined; readonly digests?: boolean | undefined; } | undefined, callback: (exit: Exit.Exit<readonly MobySchemas.ImageSummary[], import("./MobyEndpoints.js").ImagesError>) => void) => void; search: (z: { readonly term: string; readonly limit?: number | undefined; readonly stars?: number | undefined; readonly "is-official"?: boolean | undefined; }, callback: (exit: Exit.Exit<readonly MobySchemas.RegistrySearchResponse[], import("./MobyEndpoints.js").ImagesError>) => void) => void; version: (callback: (exit: Exit.Exit<Readonly<MobySchemas.SystemVersionResponse>, import("./MobyEndpoints.js").SystemsError>) => void) => void; info: (callback: (exit: Exit.Exit<Readonly<MobySchemas.SystemInfoResponse>, import("./MobyEndpoints.js").SystemsError>) => void) => void; ping: (callback: (exit: Exit.Exit<"OK", import("./MobyEndpoints.js").SystemsError>) => void) => void; pingHead: (callback: (exit: Exit.Exit<void, import("./MobyEndpoints.js").SystemsError>) => void) => void; followProgressInConsole: (y: Function.LazyArg<ReadableStream<MobySchemas.JSONMessage>>, z: (error: unknown) => unknown, callback: (exit: Exit.Exit<readonly MobySchemas.JSONMessage[], unknown>) => void) => void; waitForProgressToComplete: (y: Function.LazyArg<ReadableStream<MobySchemas.JSONMessage>>, z: (error: unknown) => unknown, callback: (exit: Exit.Exit<readonly MobySchemas.JSONMessage[], unknown>) => void) => void; }>; //# sourceMappingURL=Callbacks.d.ts.map