API Reference
Classes
Array
Immutable Array.
Methods
Name | Description |
---|---|
at | Get the value at the given index. |
concat | Merge arr to the end of this array. |
contains | Checks if this array includes searchElement. |
copyMut | Create a mutable shallow copy of this array. |
indexOf | Returns the index of the first occurrence of searchElement found. |
join | Returns a new string containing the concatenated values in this array, separated by commas or a specified separator string. |
lastIndexOf | Returns the index of the last occurrence of searchElement found. |
tryAt | Get 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.
index
Required
- Type: num
index of the value to get.
concat
concat(arr: Array): Array
Merge arr to the end of this array.
arr
Required
- Type: Array
array to merge.
contains
contains(searchElement: <T>): bool
Checks if this array includes searchElement.
searchElement
Required
- Type: <T>
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.
searchElement
Required
- Type: <T>
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.
separator
Optional
- Type: str
lastIndexOf
lastIndexOf(searchElement: <T>): num
Returns the index of the last occurrence of searchElement found.
searchElement
Required
- Type: <T>
to search for.
tryAt
tryAt(index: num): <T>
Get the value at the given index, returning nil if the index is out of bounds.
index
Required
- Type: num
index of the value to get.
Properties
Name | Type | Description |
---|---|---|
length | num | The length of the array. |
length
Required
length: num;
- Type: num
The length of the array.
Boolean
Boolean.
Static Functions
Name | Description |
---|---|
fromJson | Parse a boolean from Json. |
fromJson
bool.fromJson(json: Json);
Parse a boolean from Json.
json
Required
- Type: Json
to parse boolean from.
Datetime
Represents a local or UTC date object.
Methods
Name | Description |
---|---|
toIso | Returns ISO-8601 string. |
toUtc | Returns 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
Name | Description |
---|---|
fromComponents | Create a Datetime from Datetime components. |
fromIso | Create a Datetime from an ISO-8601 string. |
systemNow | Create a Datetime from local system timezone. |
utcNow | Create a Datetime from UTC timezone. |
fromComponents
datetime.fromComponents(c: DatetimeComponents);
Create a Datetime from Datetime components.
c
Required
- Type: DatetimeComponents
DatetimeComponents.
fromIso
datetime.fromIso(iso: str);
Create a Datetime from an ISO-8601 string.
iso
Required
- 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
Name | Type | Description |
---|---|---|
dayOfMonth | num | Returns the day of month in the local machine time or in utc (1 - 31). |
dayOfWeek | num | Returns the day in month of the local machine time or in utc (0 - 6). |
hours | num | Returns the hour of the local machine time or in utc. |
min | num | Returns the minute of the local machine time or in utc. |
month | num | Returns the month of the local machine time or in utc (0 - 11). |
ms | num | Returns the milliseconds of the local machine time or in utc *. |
sec | num | Returns the seconds of the local machine time or in utc. |
timestamp | num | Return a timestamp of non-leap year seconds since epoch. |
timestampMs | num | Return a timestamp of non-leap year milliseconds since epoch. |
timezone | num | Returns the offset in minutes from UTC. |
year | num | Returns the year of the local machine time or in utc. |
dayOfMonth
Required
dayOfMonth: num;
- Type: num
Returns the day of month in the local machine time or in utc (1 - 31).
dayOfWeek
Required
dayOfWeek: num;
- Type: num
Returns the day in month of the local machine time or in utc (0 - 6).
hours
Required
hours: num;
- Type: num
Returns the hour of the local machine time or in utc.
min
Required
min: num;
- Type: num
Returns the minute of the local machine time or in utc.
month
Required
month: num;
- Type: num
Returns the month of the local machine time or in utc (0 - 11).
ms
Required
ms: num;
- Type: num
Returns the milliseconds of the local machine time or in utc *.
sec
Required
sec: num;
- Type: num
Returns the seconds of the local machine time or in utc.
timestamp
Required
timestamp: num;
- Type: num
Return a timestamp of non-leap year seconds since epoch.
timestampMs
Required
timestampMs: num;
- Type: num
Return a timestamp of non-leap year milliseconds since epoch.
timezone
Required
timezone: num;
- Type: num
Returns the offset in minutes from UTC.
year
Required
year: num;
- Type: num
Returns the year of the local machine time or in utc.
Duration
Represents a length of time.
Static Functions
Name | Description |
---|---|
fromDays | Create a Duration representing an amount of days. |
fromHours | Create a Duration representing an amount of hours. |
fromMilliseconds | Create a Duration representing an amount of milliseconds. |
fromMinutes | Create a Duration representing an amount of minutes. |
fromMonths | Create a Duration representing an amount of months. |
fromSeconds | Create a Duration representing an amount of seconds. |
fromYears | Create a Duration representing an amount of years. |
fromDays
duration.fromDays(amount: num);
Create a Duration representing an amount of days.
amount
Required
- Type: num
the amount of Days the Duration
will represent.
fromHours
duration.fromHours(amount: num);
Create a Duration representing an amount of hours.
amount
Required
- Type: num
the amount of Hours the Duration
will represent.
fromMilliseconds
duration.fromMilliseconds(amount: num);
Create a Duration representing an amount of milliseconds.
amount
Required
- Type: num
the amount of Milliseconds the Duration
will represent.
fromMinutes
duration.fromMinutes(amount: num);
Create a Duration representing an amount of minutes.
amount
Required
- Type: num
the amount of Minutes the Duration
will represent.
fromMonths
duration.fromMonths(amount: num);
Create a Duration representing an amount of months.
amount
Required
- Type: num
the amount of Months the Duration
will represent.
fromSeconds
duration.fromSeconds(amount: num);
Create a Duration representing an amount of seconds.
amount
Required
- Type: num
the amount of Seconds the Duration
will represent.
fromYears
duration.fromYears(amount: num);
Create a Duration representing an amount of years.
amount
Required
- Type: num
the amount of Years the Duration
will represent.
Properties
Name | Type | Description |
---|---|---|
days | num | Return the total number of days in this Duration. |
hours | num | Return the total number of hours in this Duration. |
milliseconds | num | Return the total number of milliseconds in this Duration. |
minutes | num | Return the total number of minutes in this Duration. |
months | num | Return the total number of months in this Duration. |
seconds | num | Return the total number of seconds in this Duration. |
years | num | Return the total number of years in this Duration. |
days
Required
days: num;
- Type: num
Return the total number of days in this Duration.
hours
Required
hours: num;
- Type: num
Return the total number of hours in this Duration.
milliseconds
Required
milliseconds: num;
- Type: num
Return the total number of milliseconds in this Duration.
minutes
Required
minutes: num;
- Type: num
Return the total number of minutes in this Duration.
months
Required
months: num;
- Type: num
Return the total number of months in this Duration.
seconds
Required
seconds: num;
- Type: num
Return the total number of seconds in this Duration.
years
Required
years: num;
- Type: num
Return the total number of years in this Duration.
Json
Immutable Json.
Methods
Name | Description |
---|---|
asBool | Convert Json element to boolean if possible. |
asNum | Convert Json element to number if possible. |
asStr | Convert Json element to string if possible. |
get | Returns the value associated with the specified Json key. |
getAt | Returns a specified element at a given index from Json Array. |
tryAsBool | Convert Json element to boolean if possible. |
tryAsNum | Convert Json element to number if possible. |
tryAsStr | Convert Json element to string if possible. |
tryGet | Optionally returns an specified element from the Json. |
tryGetAt | Optionally 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.
key
Required
- Type: str
The key of the Json property.
getAt
getAt(index: num): Json
Returns a specified element at a given index from Json Array.
index
Required
- 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.
key
Required
- 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.
index
Required
- Type: num
The index of the element in the Json Array to return.
Static Functions
Name | Description |
---|---|
deepCopy | Creates an immutable deep copy of the Json. |
deepCopyMut | Creates a mutable deep copy of the Json. |
delete | Deletes a key in a given Json. |
entries | Returns the entries from the Json. |
has | Checks if a Json object has a given key. |
keys | Returns the keys from the Json. |
parse | Parse a string into a Json. |
stringify | Formats Json as string. |
tryParse | Try to parse a string into a Json. |
values | Returns the values from the Json. |
deepCopy
Json.deepCopy(json: MutJson);
Creates an immutable deep copy of the Json.
json
Required
- Type: MutJson
to copy.
deepCopyMut
Json.deepCopyMut(json: Json);
Creates a mutable deep copy of the Json.
json
Required
- Type: Json
to copy.
delete
Json.delete(json: MutJson, key: str);
Deletes a key in a given Json.
json
Required
- Type: MutJson
to delete key from.
key
Required
- Type: str
the key to delete.
entries
Json.entries(json: Json);
Returns the entries from the Json.
json
Required
- Type: Json
map to get the entries from.
has
Json.has(json: Json, key: str);
Checks if a Json object has a given key.
json
Required
- Type: Json
The json object to inspect.
key
Required
- Type: str
The key to check.
keys
Json.keys(json: any);
Returns the keys from the Json.
json
Required
- Type: any
map to get the keys from.
parse
Json.parse(str: str);
Parse a string into a Json.
str
Required
- Type: str
to parse as Json.
stringify
Json.stringify(json: any, options?: JsonStringifyOptions);
Formats Json as string.
json
Required
- Type: any
to format as string.
options
Optional
- Type: JsonStringifyOptions
tryParse
Json.tryParse(str?: str);
Try to parse a string into a Json.
str
Optional
- Type: str
to parse as Json.
values
Json.values(json: Json);
Returns the values from the Json.
json
Required
- Type: Json
map to get the values from.
JsonSchema
Struct Schema.
Initializers
new JsonSchema(schema: Json);
Name | Type | Description |
---|---|---|
schema | Json | No description. |
schema
Required
- Type: Json
Methods
Name | Description |
---|---|
asStr | Retrieve the json schema as a string. |
validate | Attempt 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.
obj
Required
- Type: Json
the Json object to validate.
Map
Immutable Map.
Methods
Name | Description |
---|---|
copyMut | Create a mutable shallow copy of this map. |
get | Returns a specified element from the map. |
has | Returns a boolean indicating whether an element with the specified key exists or not. |
keys | Returns the keys of this map. |
size | Returns the number of elements in the map. |
values | Returns 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.
key
Required
- 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.
key
Required
- 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
Name | Description |
---|---|
at | Get the value at the given index. |
concat | Merge arr to the end of this array. |
contains | Checks if this array includes searchElement. |
copy | Create an immutable shallow copy of this array. |
indexOf | Returns the index of the first occurrence of searchElement found. |
insert | Inserts a new value at the given index of an array. |
join | Returns a new string containing the concatenated values in this array, separated by commas or a specified separator string. |
lastIndexOf | Returns the index of the last occurrence of searchElement found. |
pop | Remove value from end of array. |
popAt | Removes value from the given index of an array. |
push | Add value to end of array. |
removeFirst | Removes first occurence of a given value in an array. |
set | Sets a new value at the given index of an array. |
at
at(index: num): <T>
Get the value at the given index.
index
Required
- Type: num
index of the value to get.
concat
concat(arr: MutArray): MutArray
Merge arr to the end of this array.
arr
Required
- Type: MutArray
array to merge.
contains
contains(searchElement: <T>): bool
Checks if this array includes searchElement.
searchElement
Required
- Type: <T>
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.
searchElement
Required
- Type: <T>
to search for.
insert
insert(index: num, value: <T>): void
Inserts a new value at the given index of an array.
index
Required
- Type: num
the index to insert the value at.
value
Required
- Type: <T>
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.
separator
Optional
- Type: str
lastIndexOf
lastIndexOf(searchElement: <T>): num
Returns the index of the last occurrence of searchElement found.
searchElement
Required
- Type: <T>
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.
index
Required
- Type: num
the index to remove the value at.
push
push(value: <T>): void
Add value to end of array.
value
Required
- Type: <T>
value to add.
removeFirst
removeFirst(value: <T>): bool
Removes first occurence of a given value in an array.
value
Required
- Type: <T>
the value to remove.
set
set(index: num, value: <T>): void
Sets a new value at the given index of an array.
index
Required
- Type: num
the index to set the value at.
value
Required
- Type: <T>
the value to set at the given index.
Properties
Name | Type | Description |
---|---|---|
length | num | The length of the array. |
length
Required
length: num;
- Type: num
The length of the array.
MutJson
Mutable Json.
Methods
Name | Description |
---|---|
asBool | Convert Json element to boolean if possible. |
asNum | Convert Json element to number if possible. |
asStr | Convert Json element to string if possible. |
get | Returns the value associated with the specified Json key. |
getAt | Returns a specified element at a given index from MutJson Array. |
set | Adds or updates an element in MutJson with a specific key and value. |
setAt | Set element in MutJson Array with a specific key and value. |
tryAsBool | Convert Json element to boolean if possible. |
tryAsNum | Convert Json element to number if possible. |
tryAsStr | Convert Json element to string if possible. |
tryGet | Optionally returns an specified element from the Json. |
tryGetAt | Optionally 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.
key
Required
- Type: str
The key of the Json property.
getAt
getAt(index: num): MutJson
Returns a specified element at a given index from MutJson Array.
index
Required
- 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.
key
Required
- Type: str
The key of the element to add.
value
Required
- Type: MutJson
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.
index
Required
- Type: num
value
Required
- Type: MutJson
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.
key
Required
- 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.
index
Required
- Type: num
The index of the element in the Json Array to return.
MutMap
Mutable Map.
Methods
Name | Description |
---|---|
clear | Removes all elements. |
copy | Create an immutable shallow copy of this map. |
delete | Removes the specified element from a map. |
get | Returns a specified element from the map. |
has | Returns a boolean indicating whether an element with the specified key exists or not. |
keys | Returns the keys of this map. |
set | Adds or updates an entry in a Map object with a specified key and a value. |
size | Returns the number of elements in the map. |
values | Returns 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.
key
Required
- 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.
key
Required
- 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.
key
Required
- 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
key
Required
- Type: str
The key of the element to add.
value
Required
- Type: <T>
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
Name | Description |
---|---|
add | Add value to set. |
clear | The clear() method removes all elements from a set. |
copy | Create an immutable shallow copy of this set. |
delete | Removes a specified value from a set, if it is in the set. |
has | Returns a boolean indicating whether an element with the specified value exists in the set. |
toArray | Create an immutable array shallow copy of this set. |
add
add(value: <T>): MutSet
Add value to set.
value
Required
- Type: <T>
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.
value
Required
- Type: <T>
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.
value
Required
- Type: <T>
The value to test for presence in the Set object.
toArray
toArray(): Array
Create an immutable array shallow copy of this set.
Properties
Name | Type | Description |
---|---|---|
size | num | The length of the set. |
size
Required
size: num;
- Type: num
The length of the set.
Node
The internal node of a construct.
Methods
Name | Description |
---|---|
addConnection | Adds a connection between two constructs. |
addDependency | Add an ordering dependency on another construct. |
addMetadata | Adds a metadata entry to this construct. |
addValidation | Adds a validation to this construct. |
findAll | Return this construct and all of its children in the given order. |
findChild | Return a direct child by id. |
getContext | Retrieves a value from tree context if present. Otherwise, would throw an error. |
lock | Locks this construct from allowing more children to be added. |
setContext | This can be used to set contextual values. |
tryFindChild | Return a direct child by id, or undefined. |
tryGetContext | Retrieves a value from tree context. |
tryRemoveChild | Remove the child with the given name, if present. |
validate | Validates 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.
props
Required
- Type: AddConnectionProps
addDependency
addDependency(...deps: Array<IDependable>): void
Add an ordering dependency on another construct.
An IDependable
deps
Required
- 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.
type
Required
- Type: str
a string denoting the type of metadata.
data
Required
- Type: any
the value of the metadata (can be a Token).
If null/undefined, metadata will not be added.
options
Optional
- 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.
validation
Required
- Type: constructs.IValidation
The validation object.
findAll
findAll(order?: ConstructOrder): MutArray<IConstruct>
Return this construct and all of its children in the given order.
order
Optional
- 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.
key
Required
- 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.
key
Required
- Type: str
The context key.
value
Required
- 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.
key
Required
- Type: str
The context key.
tryRemoveChild
tryRemoveChild(childName: str): bool
Remove the child with the given name, if present.
childName
Required
- Type: str
validate
validate(): MutArray<str>
Validates this construct.
Invokes the validate()
method on all validations added through
addValidation()
.
Properties
Name | Type | Description |
---|---|---|
addr | str | Returns an opaque tree-unique address for this construct. |
children | MutArray<constructs.IConstruct> | All direct children of this construct. |
dependencies | MutArray<constructs.IConstruct> | Return all dependencies registered on this node (non-recursive). |
id | str | The id of this construct within the current scope. |
locked | bool | Returns true if this construct or the scopes in which it is defined are locked. |
metadata | MutArray<constructs.MetadataEntry> | An immutable array of metadata objects associated with this construct. |
path | str | The full, absolute path of this construct in the tree. |
root | constructs.IConstruct | Returns the root of the construct tree. |
scopes | MutArray<constructs.IConstruct> | All parent scopes of this construct. |
scope | constructs.IConstruct | Returns the scope in which this construct is defined. |
defaultChild | constructs.IConstruct | Returns the child construct that has the id Default or Resource" . |
description | str | Description of the construct for display purposes. |
hidden | bool | Whether the construct should be hidden by default in tree visualizations. |
sourceModule | str | The source file or library where the construct was defined. |
title | str | Title of the construct for display purposes. |
addr
Required
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
children
Required
children: MutArray<IConstruct>;
- Type: MutArray<constructs.IConstruct>
All direct children of this construct.
dependencies
Required
dependencies: MutArray<IConstruct>;
- Type: MutArray<constructs.IConstruct>
Return all dependencies registered on this node (non-recursive).
id
Required
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
.
locked
Required
locked: bool;
- Type: bool
Returns true if this construct or the scopes in which it is defined are locked.
metadata
Required
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.
path
Required
path: str;
- Type: str
The full, absolute path of this construct in the tree.
Components are separated by '/'.
root
Required
root: IConstruct;
- Type: constructs.IConstruct
Returns the root of the construct tree.
scopes
Required
scopes: MutArray<IConstruct>;
- Type: MutArray<constructs.IConstruct>
All parent scopes of this construct.
scope
Optional
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.
defaultChild
Optional
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.
description
Optional
description: str;
- Type: str
Description of the construct for display purposes.
hidden
Optional
hidden: bool;
- Type: bool
Whether the construct should be hidden by default in tree visualizations.
sourceModule
Optional
sourceModule: str;
- Type: str
The source file or library where the construct was defined.
title
Optional
title: str;
- Type: str
Title of the construct for display purposes.
Number
Number.
Static Functions
Name | Description |
---|---|
fromJson | Parse a number from Json. |
fromStr | Parse a number from string. |
fromJson
num.fromJson(json: Json);
Parse a number from Json.
json
Required
- Type: Json
to parse number from.
fromStr
num.fromStr(str: str);
Parse a number from string.
str
Required
- Type: str
to parse number from.
Range
Range.
Set
Immutable Set.
Methods
Name | Description |
---|---|
copyMut | Create a mutable shallow copy of this set. |
has | Returns a boolean indicating whether an element with the specified value exists in the set. |
toArray | Create 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.
value
Required
- Type: <T>
The value to test for presence in the Set object.
toArray
toArray(): Array
Create an immutable array shallow copy of this set.
Properties
Name | Type | Description |
---|---|---|
size | num | The length of the set. |
size
Required
size: num;
- Type: num
The length of the set.
String
String.
Methods
Name | Description |
---|---|
at | Returns the character at the specified index. |
concat | Combines the text of two (or more) strings and returns a new string. |
contains | Checks if string includes substring. |
endsWith | Does this string end with the given searchString? |
indexOf | Returns the index of the first occurrence of searchString found. |
lowercase | Returns this string in lower case. |
replace | Replaces occurrences of a substring within a string. |
split | Splits string by separator. |
startsWith | Does this string start with the given searchString? |
substring | Returns a string between indexStart, indexEnd. |
trim | Removes white spaces from start and end of this string. |
uppercase | Returns this string in upper case. |
at
at(index: num): str
Returns the character at the specified index.
index
Required
- Type: num
position of the character.
concat
concat(strN: str): str
Combines the text of two (or more) strings and returns a new string.
strN
Required
- Type: str
one or more strings to concatenate to this string.
contains
contains(searchString: str): bool
Checks if string includes substring.
searchString
Required
- Type: str
substring to search for.
endsWith
endsWith(searchString: str): bool
Does this string end with the given searchString?
searchString
Required
- Type: str
substring to search for.
indexOf
indexOf(searchString: str): num
Returns the index of the first occurrence of searchString found.
searchString
Required
- 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.
searchString
Required
- Type: str
The substring to search for.
replaceString
Required
- Type: str
The replacement substring.
split
split(separator: str): MutArray<str>
Splits string by separator.
separator
Required
- Type: str
separator to split by.
startsWith
startsWith(searchString: str): bool
Does this string start with the given searchString?
searchString
Required
- Type: str
substring to search for.
substring
substring(indexStart: num, indexEnd?: num): str
Returns a string between indexStart, indexEnd.
indexStart
Required
- Type: num
index of the character we slice at.
indexEnd
Optional
- 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
Name | Description |
---|---|
fromJson | Parse string from Json. |
fromJson
str.fromJson(json: Json);
Parse string from Json.
json
Required
- Type: Json
to create string from.
Properties
Name | Type | Description |
---|---|---|
length | num | The length of the string. |
length
Required
length: num;
- Type: num
The length of the string.
Struct
Shared behavior for all structs.
Static Functions
Name | Description |
---|---|
fromJson | Converts a Json to a Struct. |
schema | Retrieve the schema for this struct. |
tryFromJson | Converts a Json to a Struct, returning nil if the Json is not valid. |
fromJson
Struct.fromJson(json: Json);
Converts a Json to a Struct.
json
Required
- Type: Json
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.
json
Required
- Type: Json
Structs
AddConnectionProps
Props for Node.addConnection
.
Initializer
let AddConnectionProps = AddConnectionProps{ ... };
Properties
Name | Type | Description |
---|---|---|
name | str | A name for the connection. |
source | constructs.IConstruct | The source of the connection. |
target | constructs.IConstruct | The target of the connection. |
name
Required
name: str;
- Type: str
A name for the connection.
source
Required
source: IConstruct;
- Type: constructs.IConstruct
The source of the connection.
target
Required
target: IConstruct;
- Type: constructs.IConstruct
The target of the connection.
DatetimeComponents
Interface that is used for setting Datetime date.
Initializer
let DatetimeComponents = DatetimeComponents{ ... };
Properties
Name | Type | Description |
---|---|---|
day | num | Day. |
hour | num | Hours. |
min | num | Minutes. |
month | num | Month. |
ms | num | Milliseconds. |
sec | num | Seconds. |
tz | num | Timezone offset in minutes from UTC. |
year | num | Year. |
day
Required
day: num;
- Type: num
Day.
hour
Required
hour: num;
- Type: num
Hours.
min
Required
min: num;
- Type: num
Minutes.
month
Required
month: num;
- Type: num
Month.
ms
Required
ms: num;
- Type: num
Milliseconds.
sec
Required
sec: num;
- Type: num
Seconds.
tz
Required
tz: num;
- Type: num
Timezone offset in minutes from UTC.
year
Required
year: num;
- Type: num
Year.
JsonEntry
Json entry representation.
Initializer
let JsonEntry = JsonEntry{ ... };
Properties
Name | Type | Description |
---|---|---|
key | str | The entry key. |
value | Json | The entry value. |
key
Required
key: str;
- Type: str
The entry key.
value
Required
value: Json;
- Type: Json
The entry value.
JsonStringifyOptions
Options for stringify() method.
Initializer
let JsonStringifyOptions = JsonStringifyOptions{ ... };
Properties
Name | Type | Description |
---|---|---|
indent | num | Indentation spaces number. |
indent
Required
indent: num;
- Type: num
Indentation spaces number.