Environment
Hierarchy
- AModel<EnvironmentSchema, Environment>
- Environment
Index
Constructors
constructor
Parameters
environmentName: string
The name of the environment, unique within its region.
Returns Environment
Properties
readonlyinheritedanchors
The anchors attached to this model, whether declared on it or borrowed from another model.
readonlyenvironmentName
readonlyenvironmentVariables
staticreadonlyinheritedNODE_NAME
The name of the node. All nodes with same name are of the same category.
staticreadonlyinheritedNODE_PACKAGE
The package of the node.
staticreadonlyinheritedNODE_SCHEMA
The schema of the node.
staticreadonlyinheritedNODE_TYPE
The type of the node.
Methods
inheritedaddAnchor
To attach an AAnchor to this model. An anchor is only added once - re-adding the same anchor, identified by its ID and parent, throws.
Parameters
anchor: MatchingAnchor<BaseAnchorSchema> | UnknownAnchor
Returns void
inheritedgetAnchor
To get an attached anchor by its ID.
Parameters
anchorId: string
The ID of the anchor.
optionalparent: UnknownModel
The model that declared the anchor. Defaults to self.
Returns UnknownAnchor | undefined
inheritedgetAnchorIndex
The position of an attached anchor in AModel.anchors, or
-1when it is not attached.Parameters
anchorId: string
The ID of the anchor.
optionalparent: UnknownModel
The model that declared the anchor. Defaults to self.
Returns number
inheritedgetAnchors
To get all attached anchors, narrowed by anchor class and/or by the value of their properties.
Parameters
filters: { key: string; value: unknown }[] = []
Each filter is a property
keythe anchor must carry with the givenvalue.types: Constructable<MatchingAnchor<BaseAnchorSchema> | UnknownAnchor>[] = []
The anchor classes to keep. An empty list keeps every class.
Returns UnknownAnchor[]
inheritedgetAnchorsMatchingSchema
To find anchors by their schema rather than by their class.
This is how a module consumes what another module produced without importing its classes - you match on the shape you need, and any anchor satisfying that shape is returned. Anchors that do not satisfy the schema are skipped, not reported as errors.
Type parameters
Parameters
from: Constructable<S>
The anchor schema to match against.
propertyFilters: ObjectKeyValue<S[properties]>[] = []
Each filter is a property
keythe anchor must carry with the givenvalue.options: { searchBoundaryMembers?: boolean } = {}
searchBoundaryMemberssearches the whole boundary this model belongs to. Set it tofalseto search only this model.optionalsearchBoundaryMembers: boolean = true
Returns Promise<MatchingAnchor<S>[]>
inheritedgetModelsMatchingSchema
To find models by their schema. See AModel.getAnchorsMatchingSchema.
Type parameters
- S: object
Parameters
schema: Constructable<S>
The model schema to match against.
filters: ObjectKeyValue<S>[] = []
Each filter is a schema
keythe model must carry with the givenvalue.options: { searchBoundaryMembers?: boolean } = {}
searchBoundaryMemberssearches the whole boundary this model belongs to. Set it tofalseto search only this model.optionalsearchBoundaryMembers: boolean = true
Returns Promise<MatchingModel<S>[]>
inheritedgetOverlaysMatchingSchema
To find overlays by their schema. See AModel.getAnchorsMatchingSchema.
Type parameters
Parameters
schema: Constructable<S>
The overlay schema to match against.
propertyFilters: ObjectKeyValue<S[properties]>[] = []
Each filter is a property
keythe overlay must carry with the givenvalue.options: { searchBoundaryMembers?: boolean } = {}
searchBoundaryMemberssearches the whole boundary this model belongs to. Set it tofalseto search only this model.optionalsearchBoundaryMembers: boolean = true
Returns Promise<MatchingModel<S>[]>
inheritedgetResourcesMatchingSchema
To find resources by their schema. See AModel.getAnchorsMatchingSchema.
Only resources produced by the modules that own the searched models are considered, so this returns another module's resources rather than every resource in the run.
Type parameters
Parameters
schema: Constructable<S>
The resource schema to match against.
propertyFilters: ObjectKeyValue<S[properties]>[] = []
Each filter is a property
keythe resource must carry with the givenvalue.responseFilters: ObjectKeyValue<S[response]>[] = []
Each filter is a response
keythe resource must carry with the givenvalue.options: { searchBoundaryMembers?: boolean } = {}
searchBoundaryMemberssearches the whole boundary this model belongs to. Set it tofalseto search only this model.optionalsearchBoundaryMembers: boolean = true
Returns Promise<MatchingResource<S>[]>
inheritedremoveAllAnchors
To detach every anchor from this model.
Returns void
inheritedremoveAnchor
To detach an anchor from this model. Detaching an anchor that is not attached is a no-op.
Parameters
anchor: MatchingAnchor<BaseAnchorSchema> | UnknownAnchor
Returns void
An Environment model is the logical sub-section of a Region which isolates one runtime environment from another. E.g. development, staging, production, etc.
Models/Environment
Definition of Default Models.