Class: Module_
A Dagger module.
Extends
BaseClient
Constructors
new Module_()
new Module_(
parent
?,_id
?,_description
?,_name
?,_sdk
?,_serve
?):Module_
Constructor is used for internal usage only, do not create object from it.
Parameters
• parent?
• parent.ctx?: Context
• parent.queryTree?: QueryTree
[]
• _id?: ModuleID
• _description?: string
• _name?: string
• _sdk?: string
• _serve?: Void
Returns
Overrides
BaseClient.constructor
Methods
dependencies()
dependencies():
Promise
<Module_
[]>
Modules used by this module.
Returns
Promise
<Module_
[]>
dependencyConfig()
dependencyConfig():
Promise
<ModuleDependency
[]>
The dependencies as configured by the module.
Returns
Promise
<ModuleDependency
[]>
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
[]>
generatedContextDiff()
generatedContextDiff():
Directory
The generated files and directories made on top of the module source's context directory.
Returns
generatedContextDirectory()
generatedContextDirectory():
Directory
The module source's context plus any configuration and source files created by codegen.
Returns
id()
id():
Promise
<ModuleID
>
A unique identifier for this Module.
Returns
Promise
<ModuleID
>
initialize()
initialize():
Module_
Retrieves the module with the objects loaded via its SDK.
Returns
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
sdk()
sdk():
Promise
<string
>
The SDK used by this module. Either a name of a builtin SDK or a module source ref string pointing to the SDK's implementation.
Returns
Promise
<string
>
serve()
serve():
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.
Returns
Promise
<void
>
source()
source():
ModuleSource
The source for the module.
Returns
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
Returns
withDescription()
withDescription(
description
):Module_
Retrieves the module with the given description
Parameters
• description: string
The description to set
Returns
withEnum()
withEnum(
enum_
):Module_
This module plus the given Enum type and associated values
Parameters
• enum_: TypeDef
Returns
withInterface()
withInterface(
iface
):Module_
This module plus the given Interface type and associated functions
Parameters
• iface: TypeDef
Returns
withObject()
withObject(
object
):Module_
This module plus the given Object type and associated functions.
Parameters
• object: TypeDef
Returns
withSource()
withSource(
source
,opts
?):Module_
Retrieves the module with basic configuration loaded if present.
Parameters
• source: ModuleSource
The module source to initialize from.
• opts?: ModuleWithSourceOpts