abstractAModule <S, T>
Implements
- IModule<S, T>
Index
Constructors
Properties
Methods
Constructors
constructor
Type parameters
- S
- T: UnknownModel
Parameters
moduleId: string
The ID this module is loaded under.
Returns AModule<S, T>
Properties
readonlymoduleId
The ID this module was loaded under. It scopes everything the module produces, so the same module class can be loaded more than once.
staticreadonlyMODULE_PACKAGE
staticreadonlyMODULE_SCHEMA
Methods
abstractonInit
Builds this module's infrastructure. It is where you construct models, attach anchors, and create overlays.
Validate inputs here and throw a ModuleError on anything you cannot satisfy - failing in
onInitcosts nothing, while failing later costs a half-built stack.Parameters
inputs: S
The inputs this module was loaded with, already validated against its schema.
Returns Promise<T | UnknownModel[]>
The nodes this module produced. Return them all, including overlays - they are what later modules resolve against.
registerHooks
To hook custom behavior into Octo's lifecycle for the duration of this module. Override it to return the callbacks you want run.
Returns { postCommitHooks?: PostHookSignature[]; postModelActionHooks?: PostHookSignature[]; postResourceActionHooks?: PostHookSignature[]; preCommitHooks?: PreHookSignature[]; preModelActionHooks?: PreHookSignature[]; preResourceActionHooks?: PreHookSignature[] }
optionalpostCommitHooks?: PostHookSignature[]
optionalpostModelActionHooks?: PostHookSignature[]
optionalpostResourceActionHooks?: PostHookSignature[]
optionalpreCommitHooks?: PreHookSignature[]
optionalpreModelActionHooks?: PreHookSignature[]
optionalpreResourceActionHooks?: PreHookSignature[]
registerMetadata
To derive values that both AModule.onInit and this module's actions need - typically facts resolved from another module's anchors, such as an account ID or a region's availability zones. Override it, and the returned object is handed to every action of this module as
actionInputs.metadata.Parameters
inputs: S
The inputs this module was loaded with.
Returns Promise<Record<string, unknown>>
The base class of every module - the unit you actually assemble infrastructure from.
A module takes typed inputs, and produces models, overlays, and anchors. It is the reusable piece: you publish one, someone else loads it with Octo.loadModule and their own inputs, and the models it built become available to the modules that run after it.
Everything a module needs from another module it finds by schema - see AModel.getAnchorsMatchingSchema - so modules compose without importing each other's classes.
Modules
Definition of Modules.