Skip to main content

Class: Client

The root of the DAG.

Extends

  • BaseClient

Constructors

new Client()

new Client(parent?, _defaultPlatform?, _version?): Client

Constructor is used for internal usage only, do not create object from it.

Parameters

parent?

parent.ctx?: Context

parent.queryTree?: QueryTree[]

_defaultPlatform?: Platform

_version?: string

Returns

Client

Overrides

BaseClient.constructor

Methods

blob()

blob(digest, size, mediaType, uncompressed): Directory

Retrieves a content-addressed blob.

Parameters

digest: string

Digest of the blob

size: number

Size of the blob

mediaType: string

Media type of the blob

uncompressed: string

Digest of the uncompressed blob

Returns

Directory


builtinContainer()

builtinContainer(digest): Container

Retrieves a container builtin to the engine.

Parameters

digest: string

Digest of the image manifest

Returns

Container


cacheVolume()

cacheVolume(key): CacheVolume

Constructs a cache volume for a given cache key.

Parameters

key: string

A string identifier to target this cache volume (e.g., "modules-cache").

Returns

CacheVolume


container()

container(opts?): Container

Creates a scratch container.

Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.

Parameters

opts?: ClientContainerOpts

Returns

Container


currentFunctionCall()

currentFunctionCall(): FunctionCall

The FunctionCall context that the SDK caller is currently executing in.

If the caller is not currently executing in a function, this will return an error.

Returns

FunctionCall


currentModule()

currentModule(): CurrentModule

The module currently being served in the session, if any.

Returns

CurrentModule


currentTypeDefs()

currentTypeDefs(): Promise<TypeDef[]>

The TypeDef representations of the objects currently being served in the session.

Returns

Promise<TypeDef[]>


daggerEngine()

daggerEngine(): DaggerEngine

The Dagger engine container configuration and state

Returns

DaggerEngine


defaultPlatform()

defaultPlatform(): Promise<Platform>

The default platform of the engine.

Returns

Promise<Platform>


directory()

directory(): Directory

Creates an empty directory.

Returns

Directory


function_()

function_(name, returnType): Function_

Creates a function.

Parameters

name: string

Name of the function, in its original format from the implementation language.

returnType: TypeDef

Return type of the function.

Returns

Function_


generatedCode()

generatedCode(code): GeneratedCode

Create a code generation result, given a directory containing the generated code.

Parameters

code: Directory

Returns

GeneratedCode


getGQLClient()

getGQLClient(): GraphQLClient

Get the Raw GraphQL client.

Returns

GraphQLClient


git()

git(url, opts?): GitRepository

Queries a Git repository.

Parameters

url: string

URL of the git repository.

Can be formatted as https://{host}/{owner}/{repo}, git@{host}:{owner}/{repo}.

Suffix ".git" is optional.

opts?: ClientGitOpts

Returns

GitRepository


host()

host(): Host

Queries the host environment.

Returns

Host


http()

http(url, opts?): File

Returns a file containing an http remote url content.

Parameters

url: string

HTTP url to get the content from (e.g., "https://docs.dagger.io").

opts?: ClientHttpOpts

Returns

File


loadCacheVolumeFromID()

loadCacheVolumeFromID(id): CacheVolume

Load a CacheVolume from its ID.

Parameters

id: CacheVolumeID

Returns

CacheVolume


loadContainerFromID()

loadContainerFromID(id): Container

Load a Container from its ID.

Parameters

id: ContainerID

Returns

Container


loadCurrentModuleFromID()

loadCurrentModuleFromID(id): CurrentModule

Load a CurrentModule from its ID.

Parameters

id: CurrentModuleID

Returns

CurrentModule


loadDaggerEngineCacheEntryFromID()

loadDaggerEngineCacheEntryFromID(id): DaggerEngineCacheEntry

Load a DaggerEngineCacheEntry from its ID.

Parameters

id: DaggerEngineCacheEntryID

Returns

DaggerEngineCacheEntry


loadDaggerEngineCacheEntrySetFromID()

loadDaggerEngineCacheEntrySetFromID(id): DaggerEngineCacheEntrySet

Load a DaggerEngineCacheEntrySet from its ID.

Parameters

id: DaggerEngineCacheEntrySetID

Returns

DaggerEngineCacheEntrySet


loadDaggerEngineCacheFromID()

loadDaggerEngineCacheFromID(id): DaggerEngineCache

Load a DaggerEngineCache from its ID.

Parameters

id: DaggerEngineCacheID

Returns

DaggerEngineCache


loadDaggerEngineFromID()

loadDaggerEngineFromID(id): DaggerEngine

Load a DaggerEngine from its ID.

Parameters

id: DaggerEngineID

Returns

DaggerEngine


loadDirectoryFromID()

loadDirectoryFromID(id): Directory

Load a Directory from its ID.

Parameters

id: DirectoryID

Returns

Directory


loadEnumTypeDefFromID()

loadEnumTypeDefFromID(id): EnumTypeDef

Load a EnumTypeDef from its ID.

Parameters

id: EnumTypeDefID

Returns

EnumTypeDef


loadEnumValueTypeDefFromID()

loadEnumValueTypeDefFromID(id): EnumValueTypeDef

Load a EnumValueTypeDef from its ID.

Parameters

id: EnumValueTypeDefID

Returns

EnumValueTypeDef


loadEnvVariableFromID()

loadEnvVariableFromID(id): EnvVariable

Load a EnvVariable from its ID.

Parameters

id: EnvVariableID

Returns

EnvVariable


loadFieldTypeDefFromID()

loadFieldTypeDefFromID(id): FieldTypeDef

Load a FieldTypeDef from its ID.

Parameters

id: FieldTypeDefID

Returns

FieldTypeDef


loadFileFromID()

loadFileFromID(id): File

Load a File from its ID.

Parameters

id: FileID

Returns

File


loadFunctionArgFromID()

loadFunctionArgFromID(id): FunctionArg

Load a FunctionArg from its ID.

Parameters

id: FunctionArgID

Returns

FunctionArg


loadFunctionCallArgValueFromID()

loadFunctionCallArgValueFromID(id): FunctionCallArgValue

Load a FunctionCallArgValue from its ID.

Parameters

id: FunctionCallArgValueID

Returns

FunctionCallArgValue


loadFunctionCallFromID()

loadFunctionCallFromID(id): FunctionCall

Load a FunctionCall from its ID.

Parameters

id: FunctionCallID

Returns

FunctionCall


loadFunctionFromID()

loadFunctionFromID(id): Function_

Load a Function from its ID.

Parameters

id: FunctionID

Returns

Function_


loadGeneratedCodeFromID()

loadGeneratedCodeFromID(id): GeneratedCode

Load a GeneratedCode from its ID.

Parameters

id: GeneratedCodeID

Returns

GeneratedCode


loadGitModuleSourceFromID()

loadGitModuleSourceFromID(id): GitModuleSource

Load a GitModuleSource from its ID.

Parameters

id: GitModuleSourceID

Returns

GitModuleSource


loadGitRefFromID()

loadGitRefFromID(id): GitRef

Load a GitRef from its ID.

Parameters

id: GitRefID

Returns

GitRef


loadGitRepositoryFromID()

loadGitRepositoryFromID(id): GitRepository

Load a GitRepository from its ID.

Parameters

id: GitRepositoryID

Returns

GitRepository


loadHostFromID()

loadHostFromID(id): Host

Load a Host from its ID.

Parameters

id: HostID

Returns

Host


loadInputTypeDefFromID()

loadInputTypeDefFromID(id): InputTypeDef

Load a InputTypeDef from its ID.

Parameters

id: InputTypeDefID

Returns

InputTypeDef


loadInterfaceTypeDefFromID()

loadInterfaceTypeDefFromID(id): InterfaceTypeDef

Load a InterfaceTypeDef from its ID.

Parameters

id: InterfaceTypeDefID

Returns

InterfaceTypeDef


loadLabelFromID()

loadLabelFromID(id): Label

Load a Label from its ID.

Parameters

id: LabelID

Returns

Label


loadListTypeDefFromID()

loadListTypeDefFromID(id): ListTypeDef

Load a ListTypeDef from its ID.

Parameters

id: ListTypeDefID

Returns

ListTypeDef


loadLocalModuleSourceFromID()

loadLocalModuleSourceFromID(id): LocalModuleSource

Load a LocalModuleSource from its ID.

Parameters

id: LocalModuleSourceID

Returns

LocalModuleSource


loadModuleDependencyFromID()

loadModuleDependencyFromID(id): ModuleDependency

Load a ModuleDependency from its ID.

Parameters

id: ModuleDependencyID

Returns

ModuleDependency


loadModuleFromID()

loadModuleFromID(id): Module_

Load a Module from its ID.

Parameters

id: ModuleID

Returns

Module_


loadModuleSourceFromID()

loadModuleSourceFromID(id): ModuleSource

Load a ModuleSource from its ID.

Parameters

id: ModuleSourceID

Returns

ModuleSource


loadModuleSourceViewFromID()

loadModuleSourceViewFromID(id): ModuleSourceView

Load a ModuleSourceView from its ID.

Parameters

id: ModuleSourceViewID

Returns

ModuleSourceView


loadObjectTypeDefFromID()

loadObjectTypeDefFromID(id): ObjectTypeDef

Load a ObjectTypeDef from its ID.

Parameters

id: ObjectTypeDefID

Returns

ObjectTypeDef


loadPortFromID()

loadPortFromID(id): Port

Load a Port from its ID.

Parameters

id: PortID

Returns

Port


loadScalarTypeDefFromID()

loadScalarTypeDefFromID(id): ScalarTypeDef

Load a ScalarTypeDef from its ID.

Parameters

id: ScalarTypeDefID

Returns

ScalarTypeDef


loadSecretFromID()

loadSecretFromID(id): Secret

Load a Secret from its ID.

Parameters

id: SecretID

Returns

Secret


loadServiceFromID()

loadServiceFromID(id): Service

Load a Service from its ID.

Parameters

id: ServiceID

Returns

Service


loadSocketFromID()

loadSocketFromID(id): Socket

Load a Socket from its ID.

Parameters

id: SocketID

Returns

Socket


loadTerminalFromID()

loadTerminalFromID(id): Terminal

Load a Terminal from its ID.

Parameters

id: TerminalID

Returns

Terminal


loadTypeDefFromID()

loadTypeDefFromID(id): TypeDef

Load a TypeDef from its ID.

Parameters

id: TypeDefID

Returns

TypeDef


module_()

module_(): Module_

Create a new module.

Returns

Module_


moduleDependency()

moduleDependency(source, opts?): ModuleDependency

Create a new module dependency configuration from a module source and name

Parameters

source: ModuleSource

The source of the dependency

opts?: ClientModuleDependencyOpts

Returns

ModuleDependency


moduleSource()

moduleSource(refString, opts?): ModuleSource

Create a new module source instance from a source ref string.

Parameters

refString: string

The string ref representation of the module source

opts?: ClientModuleSourceOpts

Returns

ModuleSource


secret()

secret(name, opts?): Secret

Reference a secret by name.

Parameters

name: string

opts?: ClientSecretOpts

Returns

Secret


setSecret()

setSecret(name, plaintext): Secret

Sets a secret given a user defined name to its plaintext and returns the secret.

The plaintext value is limited to a size of 128000 bytes.

Parameters

name: string

The user defined name for this secret

plaintext: string

The plaintext of the secret

Returns

Secret


typeDef()

typeDef(): TypeDef

Create a new TypeDef.

Returns

TypeDef


version()

version(): Promise<string>

Get the current Dagger Engine version.

Returns

Promise<string>