TypeScript Function API • Docs
TypeScript Function API / asset_builder / PropBuilder
Class: PropBuilder
Creates a prop to attach values to an asset
Example
const propName = new PropBuilder()
.setName("name")
.setKind("string")
.setDocumentation("This is the documentation for the prop")
.setWidget(new PropWidgetDefinitionBuilder().setKind("text").build())
.build();
Implements
Constructors
new PropBuilder()
new PropBuilder():
PropBuilder
Returns
Properties
prop
prop:
PropDefinition
Defined in
Methods
addChild()
addChild(
child
):this
Adds a child to an object type prop
Parameters
• child: PropDefinition
Returns
this
this
Example
.addChild(new PropBuilder()
.setKind("string")
.setName("sweetChildProp")
.setWidget(new PropWidgetDefinitionBuilder().setKind("text").build())
.build())
Implementation of
Defined in
setEntry()
setEntry(
entry
):this
Adds an entry to array or map type props
Parameters
• entry: PropDefinition
Returns
this
this
Example
.setEntry(new PropBuilder()
.setKind("string")
.setName("iamanentryprop")
.setWidget(new PropWidgetDefinitionBuilder().setKind("text").build())
.build())
Implementation of
Defined in
addMapKeyFunc()
addMapKeyFunc(
func
):this
Add a button for putting entries into maps
Parameters
• func: MapKeyFunc
Returns
this
this
Example
.addMapKeyFunc(new MapKeyFuncBuilder()
.setKey("Name")
.build()
Implementation of
Defined in
setValidationFormat()
setValidationFormat(
format
):this
Add joi validation schema to this prop
Parameters
• format: Schema
<any
>
{Joi.Schema} - A joi schema object
Returns
this
this
Example
.setValidationFormat(Joi.string().required())
Implementation of
IPropBuilder
.setValidationFormat
Defined in
build()
build():
PropDefinition
Build the object
Returns
Example
.build()
Implementation of
Defined in
setDefaultValue()
setDefaultValue(
value
):this
Set a value to be automatically populated in the prop
Parameters
• value: any
Returns
this
this
Example
.setDefaultValue("cats")
Implementation of
Defined in
setDocLink()
setDocLink(
link
):this
Set a link to external documentation that will appear beneath the prop
Parameters
• link: string
Returns
this
this
Example
.setDocLink("https://www.systeminit.com/")
Implementation of
Defined in
setDocumentation()
setDocumentation(
docs
):this
Sets inline documentation for the prop
Parameters
• docs: string
Returns
this
this
Example
.setDocumentation("This is documentation for the prop")
Implementation of
Defined in
setDocLinkRef()
setDocLinkRef(
ref
):this
Parameters
• ref: string
Returns
this
Implementation of
Defined in
setHidden()
setHidden(
hidden
):this
Whether the prop should be displayed in th UI or not
Parameters
• hidden: boolean
Returns
this
this
Example
.setHidden(true)
Implementation of
Defined in
setKind()
setKind(
kind
):this
The type of the prop
Parameters
• kind: PropDefinitionKind
{PropDefinitionKind} [array | boolean | integer | map | object | string]
Returns
this
this
Example
.setKind("text")
Implementation of
Defined in
setName()
setName(
name
):this
The prop name. This will appear in the model UI
Parameters
• name: string
the name of the prop
Returns
this
this
Example
.setName("Region")
Implementation of
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
Defined in
setWidget()
setWidget(
widget
):this
The type of widget for the prop, determing how it is displayed in the UI
Parameters
• widget: PropWidgetDefinition
Returns
this
this
Example
setWidget(new PropWidgetDefinitionBuilder()
.setKind("text")
.build())