Dagger NodeJS SDK
api/client.gen.ModuleSource
The source needed to load and run a module, along with any metadata about the source such as versions/urls/etc.
Hierarchy
-
BaseClient
↳
ModuleSource
Constructors
constructor
new ModuleSource(parent?
, _id?
, _asString?
, _configExists?
, _kind?
, _moduleName?
, _moduleOriginalName?
, _resolveContextPathFromCaller?
, _sourceRootSubpath?
, _sourceSubpath?
): ModuleSource
Constructor is used for internal usage only, do not create object from it.
Parameters
Name | Type |
---|---|
parent? | Object |
parent.ctx | Context |
parent.queryTree? | QueryTree [] |
_id? | ModuleSourceID |
_asString? | string |
_configExists? | boolean |
_kind? | ModuleSourceKind |
_moduleName? | string |
_moduleOriginalName? | string |
_resolveContextPathFromCaller? | string |
_sourceRootSubpath? | string |
_sourceSubpath? | string |
Returns
Overrides
BaseClient.constructor
Properties
_asString
Private
Optional
Readonly
_asString: string
= undefined
_configExists
Private
Optional
Readonly
_configExists: boolean
= undefined
_id
Private
Optional
Readonly
_id: ModuleSourceID
= undefined
_kind
Private
Optional
Readonly
_kind: ModuleSourceKind
= undefined
_moduleName
Private
Optional
Readonly
_moduleName: string
= undefined
_moduleOriginalName
Private
Optional
Readonly
_moduleOriginalName: string
= undefined
_resolveContextPathFromCaller
Private
Optional
Readonly
_resolveContextPathFromCaller: string
= undefined
_sourceRootSubpath
Private
Optional
Readonly
_sourceRootSubpath: string
= undefined
_sourceSubpath
Private
Optional
Readonly
_sourceSubpath: string
= undefined
Methods
asGitSource
asGitSource(): GitModuleSource
If the source is a of kind git, the git source representation of it.
Returns
asLocalSource
asLocalSource(): LocalModuleSource
If the source is of kind local, the local source representation of it.
Returns
asModule
asModule(): Module_
Load the source as a module. If this is a local source, the parent directory must have been provided during module source creation
Returns
asString
asString(): Promise
<string
>
A human readable ref string representation of this module source.
Returns
Promise
<string
>
configExists
configExists(): Promise
<boolean
>
Returns whether the module source has a configuration file.
Returns
Promise
<boolean
>
contextDirectory
contextDirectory(): Directory
The directory containing everything needed to load load and use the module.
Returns
dependencies
dependencies(): Promise
<ModuleDependency
[]>
The dependencies of the module source. Includes dependencies from the configuration and any extras from withDependencies calls.
Returns
Promise
<ModuleDependency
[]>
directory
directory(path
): Directory
The directory containing the module configuration and source code (source code may be in a subdir).
Parameters
Name | Type | Description |
---|---|---|
path | string | The path from the source directory to select. |
Returns
id
id(): Promise
<ModuleSourceID
>
A unique identifier for this ModuleSource.
Returns
Promise
<ModuleSourceID
>
kind
kind(): Promise
<ModuleSourceKind
>
The kind of source (e.g. local, git, etc.)
Returns
Promise
<ModuleSourceKind
>
moduleName
moduleName(): Promise
<string
>
If set, the name of the module this source references, including any overrides at runtime by callers.
Returns
Promise
<string
>
moduleOriginalName
moduleOriginalName(): Promise
<string
>
The original name of the module this source references, as defined in the module configuration.
Returns
Promise
<string
>
resolveContextPathFromCaller
resolveContextPathFromCaller(): Promise
<string
>
The path to the module source's context directory on the caller's filesystem. Only valid for local sources.
Returns
Promise
<string
>
resolveDependency
resolveDependency(dep
): ModuleSource
Resolve the provided module source arg as a dependency relative to this module source.
Parameters
Name | Type | Description |
---|---|---|
dep | ModuleSource | The dependency module source to resolve. |
Returns
resolveFromCaller
resolveFromCaller(): ModuleSource
Load the source from its path on the caller's filesystem, including only needed+configured files and directories. Only valid for local sources.
Returns
sourceRootSubpath
sourceRootSubpath(): Promise
<string
>
The path relative to context of the root of the module source, which contains dagger.json. It also contains the module implementation source code, but that may or may not being a subdir of this root.
Returns
Promise
<string
>
sourceSubpath
sourceSubpath(): Promise
<string
>
The path relative to context of the module implementation source code.
Returns
Promise
<string
>
with
with(arg
): ModuleSource
Call the provided function with current ModuleSource.
This is useful for reusability and readability by not breaking the calling chain.
Parameters
Name | Type |
---|---|
arg | (param : ModuleSource ) => ModuleSource |
Returns
withContextDirectory
withContextDirectory(dir
): ModuleSource
Update the module source with a new context directory. Only valid for local sources.
Parameters
Name | Type | Description |
---|---|---|
dir | Directory | The directory to set as the context directory. |
Returns
withDependencies
withDependencies(dependencies
): ModuleSource
Append the provided dependencies to the module source's dependency list.
Parameters
Name | Type | Description |
---|---|---|
dependencies | ModuleDependency [] | The dependencies to append. |
Returns
withName
withName(name
): ModuleSource
Update the module source with a new name.
Parameters
Name | Type | Description |
---|---|---|
name | string | The name to set. |
Returns
withSDK
withSDK(sdk
): ModuleSource
Update the module source with a new SDK.
Parameters
Name | Type | Description |
---|---|---|
sdk | string | The SDK to set. |
Returns
withSourceSubpath
withSourceSubpath(path
): ModuleSource
Update the module source with a new source subpath.
Parameters
Name | Type | Description |
---|---|---|
path | string | The path to set as the source subpath. |