TypeScript Function API • Docs
TypeScript Function API / asset_builder / SocketDefinitionBuilder
Class: SocketDefinitionBuilder
Defines an input or output socket for passing values between components
Example
const regionSocket = new SocketDefinitionBuilder()
.setName("Region")
.setArity("one")
.build();
Implements
Constructors
new SocketDefinitionBuilder()
new SocketDefinitionBuilder():
SocketDefinitionBuilder
Returns
Defined in
Properties
socket
socket:
SocketDefinition
Defined in
connectionAnnotations
connectionAnnotations:
string
[] =[]
Defined in
Methods
build()
build():
SocketDefinition
Build the object
Returns
Example
.build()
Implementation of
ISocketDefinitionBuilder
.build
Defined in
setArity()
setArity(
arity
):this
Specify the number of connections the socket can support
Parameters
• arity: SocketDefinitionArityType
[one | many]
Returns
this
this
Example
.setArity("one")
Implementation of
ISocketDefinitionBuilder
.setArity
Defined in
setConnectionAnnotation()
setConnectionAnnotation(
annotation
):this
Add a field to the connection annotations array for the socket. The input should be sequence of word chars (\w regex matcher), optionally followed by any <identifier>
, which makes it a supertype of identifier
. This can be repeated recursively as many times as necessary (see example). At socket connecting time an input socket can receive a connection of any output socket that has a compatible connection annotation.
e.g. An input socket with the Port<string>
connection annotation can receive a connection from an output socket with the Docker<Port<string>>
annotation, but not one with just string
.
The socket's name is always one of the connection annotations.
Parameters
• annotation: string
Returns
this
this
Example
.setConnectionAnnotation("EC2<IAM<string>>")
Implementation of
ISocketDefinitionBuilder
.setConnectionAnnotation
Defined in
setName()
setName(
name
):this
The name of the socket. Note that this will be used to connect sockets and to reference the socket within the asset.
Parameters
• name: string
Returns
this
this
Example
.setName("Subnet ID")
Implementation of
ISocketDefinitionBuilder
.setName
Defined in
setUiHidden()
setUiHidden(
hidden
):this
Should this socket show in the UI. Note that the socket can still be connected when the component is placed in a frame.
Parameters
• hidden: boolean
Returns
this
this
Example
.setName("Subnet ID")
Implementation of
ISocketDefinitionBuilder
.setUiHidden
Defined in
setValueFrom()
setValueFrom(
valueFrom
):this
DEPRECATED: Set the value of this socket using a ValueFromBuilder. The recommended way to do this is to attach an attribute function.
Parameters
• valueFrom: ValueFrom
Returns
this
this
Example
.setValueFrom(new ValueFromBuilder()
.setKind("inputSocket")
.setSocketName("Region")
.build())
Implementation of
ISocketDefinitionBuilder
.setValueFrom