Skip to main content

Class: Module_

A Dagger module.

Extends​

  • BaseClient

Constructors​

Constructor​

new Module_(ctx?, _id?, _description?, _name?, _serve?, _sync?): Module_

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

Parameters​

ctx?​

Context

_id?​

ModuleID

_description?​

string

_name?​

string

_serve?​

Void

_sync?​

ModuleID

Returns​

Module_

Overrides​

BaseClient.constructor

Methods​

dependencies()​

dependencies(): Promise<Module_[]>

The dependencies of the module.

Returns​

Promise<Module_[]>


description()​

description(): Promise<string>

The doc string of the module, if any

Returns​

Promise<string>


enums()​

enums(): Promise<TypeDef[]>

Enumerations served by this module.

Returns​

Promise<TypeDef[]>


generatedContextDirectory()​

generatedContextDirectory(): Directory

The generated files and directories made on top of the module source's context directory.

Returns​

Directory


id()​

id(): Promise<ModuleID>

A unique identifier for this Module.

Returns​

Promise<ModuleID>


interfaces()​

interfaces(): Promise<TypeDef[]>

Interfaces served by this module.

Returns​

Promise<TypeDef[]>


name()​

name(): Promise<string>

The name of the module

Returns​

Promise<string>


objects()​

objects(): Promise<TypeDef[]>

Objects served by this module.

Returns​

Promise<TypeDef[]>


runtime()​

runtime(): Container

The container that runs the module's entrypoint. It will fail to execute if the module doesn't compile.

Returns​

Container


sdk()​

sdk(): SDKConfig

The SDK config used by this module.

Returns​

SDKConfig


serve()​

serve(opts?): Promise<void>

Serve a module's API in the current session.

Note: this can only be called once per session. In the future, it could return a stream or service to remove the side effect.

Parameters​

opts?​

ModuleServeOpts

Returns​

Promise<void>


source()​

source(): ModuleSource

The source for the module.

Returns​

ModuleSource


sync()​

sync(): Promise<Module_>

Forces evaluation of the module, including any loading into the engine and associated validation.

Returns​

Promise<Module_>


with()​

with(arg): Module_

Call the provided function with current Module.

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

Parameters​

arg​

(param) => Module_

Returns​

Module_


withDescription()​

withDescription(description): Module_

Retrieves the module with the given description

Parameters​

description​

string

The description to set

Returns​

Module_


withEnum()​

withEnum(enum_): Module_

This module plus the given Enum type and associated values

Parameters​

enum_​

TypeDef

Returns​

Module_


withInterface()​

withInterface(iface): Module_

This module plus the given Interface type and associated functions

Parameters​

iface​

TypeDef

Returns​

Module_


withObject()​

withObject(object): Module_

This module plus the given Object type and associated functions.

Parameters​

object​

TypeDef

Returns​

Module_