Skip to main content

Dagger NodeJS SDK

api/client.gen.Client

The root of the DAG.

Hierarchy

  • BaseClient

    Client

Constructors

constructor

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

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

Parameters

NameType
parent?Object
parent.ctxContext
parent.queryTree?QueryTree[]
_checkVersionCompatibility?boolean
_defaultPlatform?Platform

Returns

Client

Overrides

BaseClient.constructor

Properties

_checkVersionCompatibility

Private Optional Readonly _checkVersionCompatibility: boolean = undefined


_defaultPlatform

Private Optional Readonly _defaultPlatform: Platform = undefined

Methods

blob

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

Retrieves a content-addressed blob.

Parameters

NameTypeDescription
digeststringDigest of the blob
sizenumberSize of the blob
mediaTypestringMedia type of the blob
uncompressedstringDigest of the uncompressed blob

Returns

Directory


cacheVolume

cacheVolume(key): CacheVolume

Constructs a cache volume for a given cache key.

Parameters

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

Returns

CacheVolume


checkVersionCompatibility

checkVersionCompatibility(version): Promise<boolean>

Checks if the current Dagger Engine is compatible with an SDK's required version.

Parameters

NameTypeDescription
versionstringVersion required by the SDK.

Returns

Promise<boolean>


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

NameType
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[]>


defaultPlatform

defaultPlatform(): Promise<Platform>

The default platform of the engine.

Returns

Promise<Platform>


directory

directory(opts?): Directory

Creates an empty directory.

Parameters

NameType
opts?ClientDirectoryOpts

Returns

Directory


file

file(id): File

Parameters

NameType
idFileID

Returns

File

Deprecated

Use loadFileFromID instead.


function_

function_(name, returnType): Function_

Creates a function.

Parameters

NameTypeDescription
namestringName of the function, in its original format from the implementation language.
returnTypeTypeDefReturn type of the function.

Returns

Function_


generatedCode

generatedCode(code): GeneratedCode

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

Parameters

NameType
codeDirectory

Returns

GeneratedCode


git

git(url, opts?): GitRepository

Queries a Git repository.

Parameters

NameTypeDescription
urlstringURL 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

NameTypeDescription
urlstringHTTP 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

NameType
idCacheVolumeID

Returns

CacheVolume


loadContainerFromID

loadContainerFromID(id): Container

Load a Container from its ID.

Parameters

NameType
idContainerID

Returns

Container


loadCurrentModuleFromID

loadCurrentModuleFromID(id): CurrentModule

Load a CurrentModule from its ID.

Parameters

NameType
idCurrentModuleID

Returns

CurrentModule


loadDirectoryFromID

loadDirectoryFromID(id): Directory

Load a Directory from its ID.

Parameters

NameType
idDirectoryID

Returns

Directory


loadEnvVariableFromID

loadEnvVariableFromID(id): EnvVariable

Load a EnvVariable from its ID.

Parameters

NameType
idEnvVariableID

Returns

EnvVariable


loadFieldTypeDefFromID

loadFieldTypeDefFromID(id): FieldTypeDef

Load a FieldTypeDef from its ID.

Parameters

NameType
idFieldTypeDefID

Returns

FieldTypeDef


loadFileFromID

loadFileFromID(id): File

Load a File from its ID.

Parameters

NameType
idFileID

Returns

File


loadFunctionArgFromID

loadFunctionArgFromID(id): FunctionArg

Load a FunctionArg from its ID.

Parameters

NameType
idFunctionArgID

Returns

FunctionArg


loadFunctionCallArgValueFromID

loadFunctionCallArgValueFromID(id): FunctionCallArgValue

Load a FunctionCallArgValue from its ID.

Parameters

NameType
idFunctionCallArgValueID

Returns

FunctionCallArgValue


loadFunctionCallFromID

loadFunctionCallFromID(id): FunctionCall

Load a FunctionCall from its ID.

Parameters

NameType
idFunctionCallID

Returns

FunctionCall


loadFunctionFromID

loadFunctionFromID(id): Function_

Load a Function from its ID.

Parameters

NameType
idFunctionID

Returns

Function_


loadGeneratedCodeFromID

loadGeneratedCodeFromID(id): GeneratedCode

Load a GeneratedCode from its ID.

Parameters

NameType
idGeneratedCodeID

Returns

GeneratedCode


loadGitModuleSourceFromID

loadGitModuleSourceFromID(id): GitModuleSource

Load a GitModuleSource from its ID.

Parameters

NameType
idGitModuleSourceID

Returns

GitModuleSource


loadGitRefFromID

loadGitRefFromID(id): GitRef

Load a GitRef from its ID.

Parameters

NameType
idGitRefID

Returns

GitRef


loadGitRepositoryFromID

loadGitRepositoryFromID(id): GitRepository

Load a GitRepository from its ID.

Parameters

NameType
idGitRepositoryID

Returns

GitRepository


loadHostFromID

loadHostFromID(id): Host

Load a Host from its ID.

Parameters

NameType
idHostID

Returns

Host


loadInputTypeDefFromID

loadInputTypeDefFromID(id): InputTypeDef

Load a InputTypeDef from its ID.

Parameters

NameType
idInputTypeDefID

Returns

InputTypeDef


loadInterfaceTypeDefFromID

loadInterfaceTypeDefFromID(id): InterfaceTypeDef

Load a InterfaceTypeDef from its ID.

Parameters

NameType
idInterfaceTypeDefID

Returns

InterfaceTypeDef


loadLabelFromID

loadLabelFromID(id): Label

Load a Label from its ID.

Parameters

NameType
idLabelID

Returns

Label


loadListTypeDefFromID

loadListTypeDefFromID(id): ListTypeDef

Load a ListTypeDef from its ID.

Parameters

NameType
idListTypeDefID

Returns

ListTypeDef


loadLocalModuleSourceFromID

loadLocalModuleSourceFromID(id): LocalModuleSource

Load a LocalModuleSource from its ID.

Parameters

NameType
idLocalModuleSourceID

Returns

LocalModuleSource


loadModuleDependencyFromID

loadModuleDependencyFromID(id): ModuleDependency

Load a ModuleDependency from its ID.

Parameters

NameType
idModuleDependencyID

Returns

ModuleDependency


loadModuleFromID

loadModuleFromID(id): Module_

Load a Module from its ID.

Parameters

NameType
idModuleID

Returns

Module_


loadModuleSourceFromID

loadModuleSourceFromID(id): ModuleSource

Load a ModuleSource from its ID.

Parameters

NameType
idModuleSourceID

Returns

ModuleSource


loadObjectTypeDefFromID

loadObjectTypeDefFromID(id): ObjectTypeDef

Load a ObjectTypeDef from its ID.

Parameters

NameType
idObjectTypeDefID

Returns

ObjectTypeDef


loadPortFromID

loadPortFromID(id): Port

Load a Port from its ID.

Parameters

NameType
idPortID

Returns

Port


loadSecretFromID

loadSecretFromID(id): Secret

Load a Secret from its ID.

Parameters

NameType
idSecretID

Returns

Secret


loadServiceFromID

loadServiceFromID(id): Service

Load a Service from its ID.

Parameters

NameType
idServiceID

Returns

Service


loadSocketFromID

loadSocketFromID(id): Socket

Load a Socket from its ID.

Parameters

NameType
idSocketID

Returns

Socket


loadTerminalFromID

loadTerminalFromID(id): Terminal

Load a Terminal from its ID.

Parameters

NameType
idTerminalID

Returns

Terminal


loadTypeDefFromID

loadTypeDefFromID(id): TypeDef

Load a TypeDef from its ID.

Parameters

NameType
idTypeDefID

Returns

TypeDef


moduleDependency

moduleDependency(source, opts?): ModuleDependency

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

Parameters

NameTypeDescription
sourceModuleSourceThe 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

NameTypeDescription
refStringstringThe string ref representation of the module source
opts?ClientModuleSourceOpts-

Returns

ModuleSource


module_

module_(): Module_

Create a new module.

Returns

Module_


pipeline

pipeline(name, opts?): Client

Creates a named sub-pipeline.

Parameters

NameTypeDescription
namestringName of the sub-pipeline.
opts?ClientPipelineOpts-

Returns

Client


secret

secret(name): Secret

Reference a secret by name.

Parameters

NameType
namestring

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

NameTypeDescription
namestringThe user defined name for this secret
plaintextstringThe plaintext of the secret

Returns

Secret


socket

socket(id): Socket

Loads a socket by its ID.

Parameters

NameType
idSocketID

Returns

Socket

Deprecated

Use loadSocketFromID instead.


typeDef

typeDef(): TypeDef

Create a new TypeDef.

Returns

TypeDef


with

with(arg): Client

Call the provided function with current Client.

This is useful for reusability and readability by not breaking the calling chain.

Parameters

NameType
arg(param: Client) => Client

Returns

Client