Skip to content

TypeScript Function APIDocs


TypeScript Function API / asset_builder / SocketDefinitionBuilder

Class: SocketDefinitionBuilder

Defines an input or output socket for passing values between components

Example

ts
const regionSocket = new SocketDefinitionBuilder()
 .setName("Region")
 .setArity("one")
 .build();

Implements

Constructors

new SocketDefinitionBuilder()

new SocketDefinitionBuilder(): SocketDefinitionBuilder

Returns

SocketDefinitionBuilder

Defined in

asset_builder.ts:141

Properties

socket

socket: SocketDefinition

Defined in

asset_builder.ts:138


connectionAnnotations

connectionAnnotations: string[] = []

Defined in

asset_builder.ts:139

Methods

build()

build(): SocketDefinition

Build the object

Returns

SocketDefinition

Example

ts
.build()

Implementation of

ISocketDefinitionBuilder.build

Defined in

asset_builder.ts:151


setArity()

setArity(arity): this

Specify the number of connections the socket can support

Parameters

arity: SocketDefinitionArityType

[one | many]

Returns

this

this

Example

ts
.setArity("one")

Implementation of

ISocketDefinitionBuilder.setArity

Defined in

asset_builder.ts:175


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

ts
.setConnectionAnnotation("EC2<IAM<string>>")

Implementation of

ISocketDefinitionBuilder.setConnectionAnnotation

Defined in

asset_builder.ts:202


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

ts
.setName("Subnet ID")

Implementation of

ISocketDefinitionBuilder.setName

Defined in

asset_builder.ts:221


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

ts
.setName("Subnet ID")

Implementation of

ISocketDefinitionBuilder.setUiHidden

Defined in

asset_builder.ts:236


setValueFrom()

setValueFrom(valueFrom): this

DEPRECATED: this method no longer does anything. It will be ignored when executing the asset function. Please use the asset editing interface to perform equivalent functionality.

If the socket is new, you will need to regenerate the asset first!

In the past, this was used to set the value of this socket using a ValueFromBuilder.

Parameters

valueFrom: ValueFrom

Returns

this

this

Example

ts
.setValueFrom(new ValueFromBuilder()
   .setKind("inputSocket")
   .setSocketName("Region")
   .build())

Implementation of

ISocketDefinitionBuilder.setValueFrom

Defined in

asset_builder.ts:255