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?

ID

_description?

string

_name?

string

_serve?

Void

_sync?

ID

Returns

Module_

Overrides

BaseClient.constructor

Methods

check()

check(name): Check

Experimental

Return the check defined by the module with the given name. Must match to exactly one check.

Parameters

name

string

The name of the check to retrieve

Returns

Check


checks()

checks(opts?): CheckGroup

Experimental

Return all checks defined by the module

Parameters

opts?

ModuleChecksOpts

Returns

CheckGroup


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


generator()

generator(name): Generator

Experimental

Return the generator defined by the module with the given name. Must match to exactly one generator.

Parameters

name

string

The name of the generator to retrieve

Returns

Generator


generators()

generators(opts?): GeneratorGroup

Experimental

Return all generators defined by the module

Parameters

opts?

ModuleGeneratorsOpts

Returns

GeneratorGroup


id()

id(): Promise<ID>

A unique identifier for this Module.

Returns

Promise<ID>


interfaces()

interfaces(): Promise<TypeDef[]>

Interfaces served by this module.

Returns

Promise<TypeDef[]>


introspectionSchemaJSON()

introspectionSchemaJSON(): File

The introspection schema JSON file for this module.

This file represents the schema visible to the module's source code, including all core types and those from the dependencies.

Note: this is in the context of a module, so some core types may be hidden.

Returns

File


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>


services()

services(opts?): UpGroup

Experimental

Return all services defined by the module

Parameters

opts?

ModuleServicesOpts

Returns

UpGroup


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_>


userDefaults()

userDefaults(): EnvFile

User-defined default values, loaded from local .env files.

Returns

EnvFile


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_