Skip to main content

API Reference

Classes

Array

Immutable Array.

Methods

NameDescription
atGet the value at the given index.
concatMerge arr to the end of this array.
containsChecks if this array includes searchElement.
copyMutCreate a mutable shallow copy of this array.
indexOfReturns the index of the first occurrence of searchElement found.
joinReturns a new string containing the concatenated values in this array, separated by commas or a specified separator string.
lastIndexOfReturns the index of the last occurrence of searchElement found.
tryAtGet the value at the given index, returning nil if the index is out of bounds.

at
at(index: num): <T>

Get the value at the given index.

indexRequired
  • Type: num

index of the value to get.


concat
concat(arr: Array): Array

Merge arr to the end of this array.

arrRequired

array to merge.


contains
contains(searchElement: <T>): bool

Checks if this array includes searchElement.

searchElementRequired

to search for.


copyMut
copyMut(): MutArray

Create a mutable shallow copy of this array.

indexOf
indexOf(searchElement: <T>): num

Returns the index of the first occurrence of searchElement found.

searchElementRequired

to search for.


join
join(separator?: str): str

Returns a new string containing the concatenated values in this array, separated by commas or a specified separator string.

If the array has only one item, then that item will be returned without using the separator.

separatorOptional
  • Type: str

lastIndexOf
lastIndexOf(searchElement: <T>): num

Returns the index of the last occurrence of searchElement found.

searchElementRequired

to search for.


tryAt
tryAt(index: num): <T>

Get the value at the given index, returning nil if the index is out of bounds.

indexRequired
  • Type: num

index of the value to get.


Properties

NameTypeDescription
lengthnumThe length of the array.

lengthRequired
length: num;
  • Type: num

The length of the array.


Boolean

Boolean.

Static Functions

NameDescription
fromJsonParse a boolean from Json.

fromJson
bool.fromJson(json: Json);

Parse a boolean from Json.

jsonRequired

to parse boolean from.


Datetime

Represents a local or UTC date object.

Methods

NameDescription
toIsoReturns ISO-8601 string.
toUtcReturns a Datetime represents the same date in utc.

toIso
toIso(): str

Returns ISO-8601 string.

toUtc
toUtc(): datetime

Returns a Datetime represents the same date in utc.

Static Functions

NameDescription
fromComponentsCreate a Datetime from Datetime components.
fromIsoCreate a Datetime from an ISO-8601 string.
systemNowCreate a Datetime from local system timezone.
utcNowCreate a Datetime from UTC timezone.

fromComponents
datetime.fromComponents(c: DatetimeComponents);

Create a Datetime from Datetime components.

cRequired

DatetimeComponents.


fromIso
datetime.fromIso(iso: str);

Create a Datetime from an ISO-8601 string.

isoRequired
  • Type: str

ISO-8601 string.


systemNow
datetime.systemNow();

Create a Datetime from local system timezone.

utcNow
datetime.utcNow();

Create a Datetime from UTC timezone.

Properties

NameTypeDescription
dayOfMonthnumReturns the day of month in the local machine time or in utc (1 - 31).
dayOfWeeknumReturns the day in month of the local machine time or in utc (0 - 6).
hoursnumReturns the hour of the local machine time or in utc.
minnumReturns the minute of the local machine time or in utc.
monthnumReturns the month of the local machine time or in utc (0 - 11).
msnumReturns the milliseconds of the local machine time or in utc *.
secnumReturns the seconds of the local machine time or in utc.
timestampnumReturn a timestamp of non-leap year seconds since epoch.
timestampMsnumReturn a timestamp of non-leap year milliseconds since epoch.
timezonenumReturns the offset in minutes from UTC.
yearnumReturns the year of the local machine time or in utc.

dayOfMonthRequired
dayOfMonth: num;
  • Type: num

Returns the day of month in the local machine time or in utc (1 - 31).


dayOfWeekRequired
dayOfWeek: num;
  • Type: num

Returns the day in month of the local machine time or in utc (0 - 6).


hoursRequired
hours: num;
  • Type: num

Returns the hour of the local machine time or in utc.


minRequired
min: num;
  • Type: num

Returns the minute of the local machine time or in utc.


monthRequired
month: num;
  • Type: num

Returns the month of the local machine time or in utc (0 - 11).


msRequired
ms: num;
  • Type: num

Returns the milliseconds of the local machine time or in utc *.


secRequired
sec: num;
  • Type: num

Returns the seconds of the local machine time or in utc.


timestampRequired
timestamp: num;
  • Type: num

Return a timestamp of non-leap year seconds since epoch.


timestampMsRequired
timestampMs: num;
  • Type: num

Return a timestamp of non-leap year milliseconds since epoch.


timezoneRequired
timezone: num;
  • Type: num

Returns the offset in minutes from UTC.


yearRequired
year: num;
  • Type: num

Returns the year of the local machine time or in utc.


Duration

Represents a length of time.

Static Functions

NameDescription
fromDaysCreate a Duration representing an amount of days.
fromHoursCreate a Duration representing an amount of hours.
fromMillisecondsCreate a Duration representing an amount of milliseconds.
fromMinutesCreate a Duration representing an amount of minutes.
fromMonthsCreate a Duration representing an amount of months.
fromSecondsCreate a Duration representing an amount of seconds.
fromYearsCreate a Duration representing an amount of years.

fromDays
duration.fromDays(amount: num);

Create a Duration representing an amount of days.

amountRequired
  • Type: num

the amount of Days the Duration will represent.


fromHours
duration.fromHours(amount: num);

Create a Duration representing an amount of hours.

amountRequired
  • Type: num

the amount of Hours the Duration will represent.


fromMilliseconds
duration.fromMilliseconds(amount: num);

Create a Duration representing an amount of milliseconds.

amountRequired
  • Type: num

the amount of Milliseconds the Duration will represent.


fromMinutes
duration.fromMinutes(amount: num);

Create a Duration representing an amount of minutes.

amountRequired
  • Type: num

the amount of Minutes the Duration will represent.


fromMonths
duration.fromMonths(amount: num);

Create a Duration representing an amount of months.

amountRequired
  • Type: num

the amount of Months the Duration will represent.


fromSeconds
duration.fromSeconds(amount: num);

Create a Duration representing an amount of seconds.

amountRequired
  • Type: num

the amount of Seconds the Duration will represent.


fromYears
duration.fromYears(amount: num);

Create a Duration representing an amount of years.

amountRequired
  • Type: num

the amount of Years the Duration will represent.


Properties

NameTypeDescription
daysnumReturn the total number of days in this Duration.
hoursnumReturn the total number of hours in this Duration.
millisecondsnumReturn the total number of milliseconds in this Duration.
minutesnumReturn the total number of minutes in this Duration.
monthsnumReturn the total number of months in this Duration.
secondsnumReturn the total number of seconds in this Duration.
yearsnumReturn the total number of years in this Duration.

daysRequired
days: num;
  • Type: num

Return the total number of days in this Duration.


hoursRequired
hours: num;
  • Type: num

Return the total number of hours in this Duration.


millisecondsRequired
milliseconds: num;
  • Type: num

Return the total number of milliseconds in this Duration.


minutesRequired
minutes: num;
  • Type: num

Return the total number of minutes in this Duration.


monthsRequired
months: num;
  • Type: num

Return the total number of months in this Duration.


secondsRequired
seconds: num;
  • Type: num

Return the total number of seconds in this Duration.


yearsRequired
years: num;
  • Type: num

Return the total number of years in this Duration.


Json

Immutable Json.

Methods

NameDescription
asBoolConvert Json element to boolean if possible.
asNumConvert Json element to number if possible.
asStrConvert Json element to string if possible.
getReturns the value associated with the specified Json key.
getAtReturns a specified element at a given index from Json Array.
tryAsBoolConvert Json element to boolean if possible.
tryAsNumConvert Json element to number if possible.
tryAsStrConvert Json element to string if possible.
tryGetOptionally returns an specified element from the Json.
tryGetAtOptionally returns a specified element at a given index from Json Array.

asBool
asBool(): bool

Convert Json element to boolean if possible.

asNum
asNum(): num

Convert Json element to number if possible.

asStr
asStr(): str

Convert Json element to string if possible.

get
get(key: str): Json

Returns the value associated with the specified Json key.

keyRequired
  • Type: str

The key of the Json property.


getAt
getAt(index: num): Json

Returns a specified element at a given index from Json Array.

indexRequired
  • Type: num

The index of the element in the Json Array to return.


tryAsBool
tryAsBool(): bool

Convert Json element to boolean if possible.

tryAsNum
tryAsNum(): num

Convert Json element to number if possible.

tryAsStr
tryAsStr(): str

Convert Json element to string if possible.

tryGet
tryGet(key: str): Json

Optionally returns an specified element from the Json.

keyRequired
  • Type: str

The key of the element to return.


tryGetAt
tryGetAt(index: num): Json

Optionally returns a specified element at a given index from Json Array.

indexRequired
  • Type: num

The index of the element in the Json Array to return.


Static Functions

NameDescription
deepCopyCreates an immutable deep copy of the Json.
deepCopyMutCreates a mutable deep copy of the Json.
deleteDeletes a key in a given Json.
entriesReturns the entries from the Json.
hasChecks if a Json object has a given key.
keysReturns the keys from the Json.
parseParse a string into a Json.
stringifyFormats Json as string.
tryParseTry to parse a string into a Json.
valuesReturns the values from the Json.

deepCopy
Json.deepCopy(json: MutJson);

Creates an immutable deep copy of the Json.

jsonRequired

to copy.


deepCopyMut
Json.deepCopyMut(json: Json);

Creates a mutable deep copy of the Json.

jsonRequired

to copy.


delete
Json.delete(json: MutJson, key: str);

Deletes a key in a given Json.

jsonRequired

to delete key from.


keyRequired
  • Type: str

the key to delete.


entries
Json.entries(json: Json);

Returns the entries from the Json.

jsonRequired

map to get the entries from.


has
Json.has(json: Json, key: str);

Checks if a Json object has a given key.

jsonRequired

The json object to inspect.


keyRequired
  • Type: str

The key to check.


keys
Json.keys(json: any);

Returns the keys from the Json.

jsonRequired
  • Type: any

map to get the keys from.


parse
Json.parse(str: str);

Parse a string into a Json.

strRequired
  • Type: str

to parse as Json.


stringify
Json.stringify(json: any, options?: JsonStringifyOptions);

Formats Json as string.

jsonRequired
  • Type: any

to format as string.


optionsOptional

tryParse
Json.tryParse(str?: str);

Try to parse a string into a Json.

strOptional
  • Type: str

to parse as Json.


values
Json.values(json: Json);

Returns the values from the Json.

jsonRequired

map to get the values from.


JsonSchema

Struct Schema.

Initializers

new JsonSchema(schema: Json);
NameTypeDescription
schemaJsonNo description.

schemaRequired

Methods

NameDescription
asStrRetrieve the json schema as a string.
validateAttempt to validate a json object against the schema.

asStr
asStr(): str

Retrieve the json schema as a string.

validate
validate(obj: Json): void

Attempt to validate a json object against the schema.

objRequired

the Json object to validate.


Map

Immutable Map.

Methods

NameDescription
copyMutCreate a mutable shallow copy of this map.
getReturns a specified element from the map.
hasReturns a boolean indicating whether an element with the specified key exists or not.
keysReturns the keys of this map.
sizeReturns the number of elements in the map.
valuesReturns the values of this map.

copyMut
copyMut(): MutMap

Create a mutable shallow copy of this map.

get
get(key: str): <T>

Returns a specified element from the map.

If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the map.

keyRequired
  • Type: str

The key of the element to return.


has
has(key: str): bool

Returns a boolean indicating whether an element with the specified key exists or not.

keyRequired
  • Type: str

The key of the element to test for presence.


keys
keys(): MutArray<str>

Returns the keys of this map.

size
size(): num

Returns the number of elements in the map.

TODO: For now this has to be a method rather than a getter as macros only work on methods https://github.com/winglang/wing/issues/1658

values
values(): Array

Returns the values of this map.

MutArray

Mutable Array.

Methods

NameDescription
atGet the value at the given index.
concatMerge arr to the end of this array.
containsChecks if this array includes searchElement.
copyCreate an immutable shallow copy of this array.
indexOfReturns the index of the first occurrence of searchElement found.
insertInserts a new value at the given index of an array.
joinReturns a new string containing the concatenated values in this array, separated by commas or a specified separator string.
lastIndexOfReturns the index of the last occurrence of searchElement found.
popRemove value from end of array.
popAtRemoves value from the given index of an array.
pushAdd value to end of array.
removeFirstRemoves first occurence of a given value in an array.
setSets a new value at the given index of an array.

at
at(index: num): <T>

Get the value at the given index.

indexRequired
  • Type: num

index of the value to get.


concat
concat(arr: MutArray): MutArray

Merge arr to the end of this array.

arrRequired

array to merge.


contains
contains(searchElement: <T>): bool

Checks if this array includes searchElement.

searchElementRequired

to search for.


copy
copy(): Array

Create an immutable shallow copy of this array.

indexOf
indexOf(searchElement: <T>): num

Returns the index of the first occurrence of searchElement found.

searchElementRequired

to search for.


insert
insert(index: num, value: <T>): void

Inserts a new value at the given index of an array.

indexRequired
  • Type: num

the index to insert the value at.


valueRequired

the value to insert at the given index.


join
join(separator?: str): str

Returns a new string containing the concatenated values in this array, separated by commas or a specified separator string.

If the array has only one item, then that item will be returned without using the separator.

separatorOptional
  • Type: str

lastIndexOf
lastIndexOf(searchElement: <T>): num

Returns the index of the last occurrence of searchElement found.

searchElementRequired

to search for.


pop
pop(): <T>

Remove value from end of array.

popAt
popAt(index: num): <T>

Removes value from the given index of an array.

indexRequired
  • Type: num

the index to remove the value at.


push
push(value: <T>): void

Add value to end of array.

valueRequired

value to add.


removeFirst
removeFirst(value: <T>): bool

Removes first occurence of a given value in an array.

valueRequired

the value to remove.


set
set(index: num, value: <T>): void

Sets a new value at the given index of an array.

indexRequired
  • Type: num

the index to set the value at.


valueRequired

the value to set at the given index.


Properties

NameTypeDescription
lengthnumThe length of the array.

lengthRequired
length: num;
  • Type: num

The length of the array.


MutJson

Mutable Json.

Methods

NameDescription
asBoolConvert Json element to boolean if possible.
asNumConvert Json element to number if possible.
asStrConvert Json element to string if possible.
getReturns the value associated with the specified Json key.
getAtReturns a specified element at a given index from MutJson Array.
setAdds or updates an element in MutJson with a specific key and value.
setAtSet element in MutJson Array with a specific key and value.
tryAsBoolConvert Json element to boolean if possible.
tryAsNumConvert Json element to number if possible.
tryAsStrConvert Json element to string if possible.
tryGetOptionally returns an specified element from the Json.
tryGetAtOptionally returns a specified element at a given index from Json Array.

asBool
asBool(): bool

Convert Json element to boolean if possible.

asNum
asNum(): num

Convert Json element to number if possible.

asStr
asStr(): str

Convert Json element to string if possible.

get
get(key: str): MutJson

Returns the value associated with the specified Json key.

keyRequired
  • Type: str

The key of the Json property.


getAt
getAt(index: num): MutJson

Returns a specified element at a given index from MutJson Array.

indexRequired
  • Type: num

The index of the element in the MutJson Array to return.


set
set(key: str, value: MutJson): void

Adds or updates an element in MutJson with a specific key and value.

keyRequired
  • Type: str

The key of the element to add.


valueRequired

The value of the element to add.


setAt
setAt(index: num, value: MutJson): void

Set element in MutJson Array with a specific key and value.

indexRequired
  • Type: num

valueRequired

The value of the element to set.


tryAsBool
tryAsBool(): bool

Convert Json element to boolean if possible.

tryAsNum
tryAsNum(): num

Convert Json element to number if possible.

tryAsStr
tryAsStr(): str

Convert Json element to string if possible.

tryGet
tryGet(key: str): MutJson

Optionally returns an specified element from the Json.

keyRequired
  • Type: str

The key of the element to return.


tryGetAt
tryGetAt(index: num): MutJson

Optionally returns a specified element at a given index from Json Array.

indexRequired
  • Type: num

The index of the element in the Json Array to return.


MutMap

Mutable Map.

Methods

NameDescription
clearRemoves all elements.
copyCreate an immutable shallow copy of this map.
deleteRemoves the specified element from a map.
getReturns a specified element from the map.
hasReturns a boolean indicating whether an element with the specified key exists or not.
keysReturns the keys of this map.
setAdds or updates an entry in a Map object with a specified key and a value.
sizeReturns the number of elements in the map.
valuesReturns the values of this map.

clear
clear(): void

Removes all elements.

copy
copy(): Map

Create an immutable shallow copy of this map.

delete
delete(key: str): bool

Removes the specified element from a map.

keyRequired
  • Type: str

The key.


get
get(key: str): <T>

Returns a specified element from the map.

If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the map.

keyRequired
  • Type: str

The key of the element to return.


has
has(key: str): bool

Returns a boolean indicating whether an element with the specified key exists or not.

keyRequired
  • Type: str

The key of the element to test for presence.


keys
keys(): MutArray<str>

Returns the keys of this map.

set
set(key: str, value: <T>): void

Adds or updates an entry in a Map object with a specified key and a value.

TODO: revisit this macro after we support indexed args https://github.com/winglang/wing/issues/1659

keyRequired
  • Type: str

The key of the element to add.


valueRequired

The value of the element to add.


size
size(): num

Returns the number of elements in the map.

TODO: For now this has to be a method rather than a getter as macros only work on methods https://github.com/winglang/wing/issues/1658

values
values(): Array

Returns the values of this map.

MutSet

Mutable Set.

Methods

NameDescription
addAdd value to set.
clearThe clear() method removes all elements from a set.
copyCreate an immutable shallow copy of this set.
deleteRemoves a specified value from a set, if it is in the set.
hasReturns a boolean indicating whether an element with the specified value exists in the set.
toArrayCreate an immutable array shallow copy of this set.

add
add(value: <T>): MutSet

Add value to set.

valueRequired

value to add.


clear
clear(): void

The clear() method removes all elements from a set.

copy
copy(): Set

Create an immutable shallow copy of this set.

delete
delete(value: <T>): bool

Removes a specified value from a set, if it is in the set.

valueRequired

The value to remove from the set.


has
has(value: <T>): bool

Returns a boolean indicating whether an element with the specified value exists in the set.

valueRequired

The value to test for presence in the Set object.


toArray
toArray(): Array

Create an immutable array shallow copy of this set.

Properties

NameTypeDescription
sizenumThe length of the set.

sizeRequired
size: num;
  • Type: num

The length of the set.


Node

The internal node of a construct.

Methods

NameDescription
addConnectionAdds a connection between two constructs.
addDependencyAdd an ordering dependency on another construct.
addMetadataAdds a metadata entry to this construct.
addValidationAdds a validation to this construct.
findAllReturn this construct and all of its children in the given order.
findChildReturn a direct child by id.
getContextRetrieves a value from tree context if present. Otherwise, would throw an error.
lockLocks this construct from allowing more children to be added.
setContextThis can be used to set contextual values.
tryFindChildReturn a direct child by id, or undefined.
tryGetContextRetrieves a value from tree context.
tryRemoveChildRemove the child with the given name, if present.
validateValidates this construct.

addConnection
addConnection(props: AddConnectionProps): void

Adds a connection between two constructs.

A connection is a piece of metadata describing how one construct is related to another construct.

propsRequired

addDependency
addDependency(...deps: Array<IDependable>): void

Add an ordering dependency on another construct.

An IDependable

depsRequired
  • Type: constructs.IDependable

addMetadata
addMetadata(type: str, data: any, options?: MetadataOptions): void

Adds a metadata entry to this construct.

Entries are arbitrary values and will also include a stack trace to allow tracing back to the code location for when the entry was added. It can be used, for example, to include source mapping in CloudFormation templates to improve diagnostics.

typeRequired
  • Type: str

a string denoting the type of metadata.


dataRequired
  • Type: any

the value of the metadata (can be a Token).

If null/undefined, metadata will not be added.


optionsOptional
  • Type: constructs.MetadataOptions

options.


addValidation
addValidation(validation: IValidation): void

Adds a validation to this construct.

When node.validate() is called, the validate() method will be called on all validations and all errors will be returned.

validationRequired
  • Type: constructs.IValidation

The validation object.


findAll
findAll(order?: ConstructOrder): MutArray<IConstruct>

Return this construct and all of its children in the given order.

orderOptional
  • Type: constructs.ConstructOrder

findChild
findChild(): IConstruct

Return a direct child by id.

Throws an error if the child is not found.

getContext
getContext(key: str): any

Retrieves a value from tree context if present. Otherwise, would throw an error.

Context is usually initialized at the root, but can be overridden at any point in the tree.

keyRequired
  • Type: str

The context key.


lock
lock(): void

Locks this construct from allowing more children to be added.

After this call, no more children can be added to this construct or to any children.

setContext
setContext(key: str, value: any): void

This can be used to set contextual values.

Context must be set before any children are added, since children may consult context info during construction. If the key already exists, it will be overridden.

keyRequired
  • Type: str

The context key.


valueRequired
  • Type: any

The context value.


tryFindChild
tryFindChild(): IConstruct

Return a direct child by id, or undefined.

tryGetContext
tryGetContext(key: str): any

Retrieves a value from tree context.

Context is usually initialized at the root, but can be overridden at any point in the tree.

keyRequired
  • Type: str

The context key.


tryRemoveChild
tryRemoveChild(childName: str): bool

Remove the child with the given name, if present.

childNameRequired
  • Type: str

validate
validate(): MutArray<str>

Validates this construct.

Invokes the validate() method on all validations added through addValidation().

Properties

NameTypeDescription
addrstrReturns an opaque tree-unique address for this construct.
childrenMutArray<constructs.IConstruct>All direct children of this construct.
dependenciesMutArray<constructs.IConstruct>Return all dependencies registered on this node (non-recursive).
idstrThe id of this construct within the current scope.
lockedboolReturns true if this construct or the scopes in which it is defined are locked.
metadataMutArray<constructs.MetadataEntry>An immutable array of metadata objects associated with this construct.
pathstrThe full, absolute path of this construct in the tree.
rootconstructs.IConstructReturns the root of the construct tree.
scopesMutArray<constructs.IConstruct>All parent scopes of this construct.
scopeconstructs.IConstructReturns the scope in which this construct is defined.
defaultChildconstructs.IConstructReturns the child construct that has the id Default or Resource".
descriptionstrDescription of the construct for display purposes.
hiddenboolWhether the construct should be hidden by default in tree visualizations.
sourceModulestrThe source file or library where the construct was defined.
titlestrTitle of the construct for display purposes.

addrRequired
addr: str;
  • Type: str

Returns an opaque tree-unique address for this construct.

Addresses are 42 characters hexadecimal strings. They begin with "c8" followed by 40 lowercase hexadecimal characters (0-9a-f).

Addresses are calculated using a SHA-1 of the components of the construct path.

To enable refactorings of construct trees, constructs with the ID Default will be excluded from the calculation. In those cases constructs in the same tree may have the same addreess.


Example

c83a2846e506bcc5f10682b564084bca2d275709ee
childrenRequired
children: MutArray<IConstruct>;
  • Type: MutArray<constructs.IConstruct>

All direct children of this construct.


dependenciesRequired
dependencies: MutArray<IConstruct>;
  • Type: MutArray<constructs.IConstruct>

Return all dependencies registered on this node (non-recursive).


idRequired
id: str;
  • Type: str

The id of this construct within the current scope.

This is a a scope-unique id. To obtain an app-unique id for this construct, use addr.


lockedRequired
locked: bool;
  • Type: bool

Returns true if this construct or the scopes in which it is defined are locked.


metadataRequired
metadata: MutArray<MetadataEntry>;
  • Type: MutArray<constructs.MetadataEntry>

An immutable array of metadata objects associated with this construct.

This can be used, for example, to implement support for deprecation notices, source mapping, etc.


pathRequired
path: str;
  • Type: str

The full, absolute path of this construct in the tree.

Components are separated by '/'.


rootRequired
root: IConstruct;
  • Type: constructs.IConstruct

Returns the root of the construct tree.


scopesRequired
scopes: MutArray<IConstruct>;
  • Type: MutArray<constructs.IConstruct>

All parent scopes of this construct.


scopeOptional
scope: IConstruct;
  • Type: constructs.IConstruct

Returns the scope in which this construct is defined.

The value is undefined at the root of the construct scope tree.


defaultChildOptional
defaultChild: IConstruct;
  • Type: constructs.IConstruct

Returns the child construct that has the id Default or Resource".

This is usually the construct that provides the bulk of the underlying functionality. Useful for modifications of the underlying construct that are not available at the higher levels. Override the defaultChild property.

This should only be used in the cases where the correct default child is not named 'Resource' or 'Default' as it should be.

If you set this to undefined, the default behavior of finding the child named 'Resource' or 'Default' will be used.


descriptionOptional
description: str;
  • Type: str

Description of the construct for display purposes.


hiddenOptional
hidden: bool;
  • Type: bool

Whether the construct should be hidden by default in tree visualizations.


sourceModuleOptional
sourceModule: str;
  • Type: str

The source file or library where the construct was defined.


titleOptional
title: str;
  • Type: str

Title of the construct for display purposes.


Number

Number.

Static Functions

NameDescription
fromJsonParse a number from Json.
fromStrParse a number from string.

fromJson
num.fromJson(json: Json);

Parse a number from Json.

jsonRequired

to parse number from.


fromStr
num.fromStr(str: str);

Parse a number from string.

strRequired
  • Type: str

to parse number from.


Range

Range.

Set

Immutable Set.

Methods

NameDescription
copyMutCreate a mutable shallow copy of this set.
hasReturns a boolean indicating whether an element with the specified value exists in the set.
toArrayCreate an immutable array shallow copy of this set.

copyMut
copyMut(): MutSet

Create a mutable shallow copy of this set.

has
has(value: <T>): bool

Returns a boolean indicating whether an element with the specified value exists in the set.

valueRequired

The value to test for presence in the Set object.


toArray
toArray(): Array

Create an immutable array shallow copy of this set.

Properties

NameTypeDescription
sizenumThe length of the set.

sizeRequired
size: num;
  • Type: num

The length of the set.


String

String.

Methods

NameDescription
atReturns the character at the specified index.
concatCombines the text of two (or more) strings and returns a new string.
containsChecks if string includes substring.
endsWithDoes this string end with the given searchString?
indexOfReturns the index of the first occurrence of searchString found.
lowercaseReturns this string in lower case.
replaceReplaces occurrences of a substring within a string.
splitSplits string by separator.
startsWithDoes this string start with the given searchString?
substringReturns a string between indexStart, indexEnd.
trimRemoves white spaces from start and end of this string.
uppercaseReturns this string in upper case.

at
at(index: num): str

Returns the character at the specified index.

indexRequired
  • Type: num

position of the character.


concat
concat(strN: str): str

Combines the text of two (or more) strings and returns a new string.

strNRequired
  • Type: str

one or more strings to concatenate to this string.


contains
contains(searchString: str): bool

Checks if string includes substring.

searchStringRequired
  • Type: str

substring to search for.


endsWith
endsWith(searchString: str): bool

Does this string end with the given searchString?

searchStringRequired
  • Type: str

substring to search for.


indexOf
indexOf(searchString: str): num

Returns the index of the first occurrence of searchString found.

searchStringRequired
  • Type: str

substring to search for.


lowercase
lowercase(): str

Returns this string in lower case.

replace
replace(searchString: str, replaceString: str): str

Replaces occurrences of a substring within a string.

searchStringRequired
  • Type: str

The substring to search for.


replaceStringRequired
  • Type: str

The replacement substring.


split
split(separator: str): MutArray<str>

Splits string by separator.

separatorRequired
  • Type: str

separator to split by.


startsWith
startsWith(searchString: str): bool

Does this string start with the given searchString?

searchStringRequired
  • Type: str

substring to search for.


substring
substring(indexStart: num, indexEnd?: num): str

Returns a string between indexStart, indexEnd.

indexStartRequired
  • Type: num

index of the character we slice at.


indexEndOptional
  • Type: num

optional - index of the character we end slicing at.


trim
trim(): str

Removes white spaces from start and end of this string.

uppercase
uppercase(): str

Returns this string in upper case.

Static Functions

NameDescription
fromJsonParse string from Json.

fromJson
str.fromJson(json: Json);

Parse string from Json.

jsonRequired

to create string from.


Properties

NameTypeDescription
lengthnumThe length of the string.

lengthRequired
length: num;
  • Type: num

The length of the string.


Struct

Shared behavior for all structs.

Static Functions

NameDescription
fromJsonConverts a Json to a Struct.
schemaRetrieve the schema for this struct.
tryFromJsonConverts a Json to a Struct, returning nil if the Json is not valid.

fromJson
Struct.fromJson(json: Json);

Converts a Json to a Struct.

jsonRequired

schema
Struct.schema();

Retrieve the schema for this struct.

tryFromJson
Struct.tryFromJson(json: Json);

Converts a Json to a Struct, returning nil if the Json is not valid.

jsonRequired

Structs

AddConnectionProps

Props for Node.addConnection.

Initializer

let AddConnectionProps = AddConnectionProps{ ... };

Properties

NameTypeDescription
namestrA name for the connection.
sourceconstructs.IConstructThe source of the connection.
targetconstructs.IConstructThe target of the connection.

nameRequired
name: str;
  • Type: str

A name for the connection.


sourceRequired
source: IConstruct;
  • Type: constructs.IConstruct

The source of the connection.


targetRequired
target: IConstruct;
  • Type: constructs.IConstruct

The target of the connection.


DatetimeComponents

Interface that is used for setting Datetime date.

Initializer

let DatetimeComponents = DatetimeComponents{ ... };

Properties

NameTypeDescription
daynumDay.
hournumHours.
minnumMinutes.
monthnumMonth.
msnumMilliseconds.
secnumSeconds.
tznumTimezone offset in minutes from UTC.
yearnumYear.

dayRequired
day: num;
  • Type: num

Day.


hourRequired
hour: num;
  • Type: num

Hours.


minRequired
min: num;
  • Type: num

Minutes.


monthRequired
month: num;
  • Type: num

Month.


msRequired
ms: num;
  • Type: num

Milliseconds.


secRequired
sec: num;
  • Type: num

Seconds.


tzRequired
tz: num;
  • Type: num

Timezone offset in minutes from UTC.


yearRequired
year: num;
  • Type: num

Year.


JsonEntry

Json entry representation.

Initializer

let JsonEntry = JsonEntry{ ... };

Properties

NameTypeDescription
keystrThe entry key.
valueJsonThe entry value.

keyRequired
key: str;
  • Type: str

The entry key.


valueRequired
value: Json;

The entry value.


JsonStringifyOptions

Options for stringify() method.

Initializer

let JsonStringifyOptions = JsonStringifyOptions{ ... };

Properties

NameTypeDescription
indentnumIndentation spaces number.

indentRequired
indent: num;
  • Type: num

Indentation spaces number.