Contact Us 1-800-596-4880

Runtime Types (dw::Runtime)

Type Definition Description

DataFormatDescriptor

type DataFormatDescriptor = { name: String, binary: Boolean, defaultEncoding?: String, extensions: Array<String>, defaultMimeType: String, acceptedMimeTypes: Array<String>, readerProperties: Array<DataFormatProperty>, writerProperties: Array<DataFormatProperty> }

Description of a DataFormat that provides all metadata information.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

DataFormatProperty

type DataFormatProperty = { name: String, optional: Boolean, defaultValue?: Any, description: String, possibleValues: Array<Any> }

Type that describes a data format property. The fields include a name, description, array of possible values (possibleValues), an optional default value (defaultValue), and an optional flag that indicates whether the property is required or not.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

EvalResult

type EvalResult = Result<EvalSuccess, ExecutionFailure>

Data type of the data that returns when an eval function executes successfully.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

Introduced in DataWeave version 2.7.0.

EvalSuccess

type EvalSuccess = { value: Any, logs: Array<LogEntry> }

Data type of the data that returns when an eval function executes successfully.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

ExecutionFailure

type ExecutionFailure = { message: String, kind: String, stack?: Array<String>, location: Location, logs: Array<LogEntry> }

Data type of the data that returns when a run or eval function fails.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

Location

type Location = { start?: Position, end?: Position, locationString: String, text?: String, sourceIdentifier?: String }

Type that represents the location of an expression in a DataWeave file.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

LogEntry

type LogEntry = { level: LogLevel, timestamp: String, message: String }

Type for a log entry, which consists of a level for a LogLevel value, a timestamp, and message.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

LogLevel

type LogLevel = "INFO" | "ERROR" | "WARN"

Identifies the different kinds of log levels (INFO, ERROR, or WARN).

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

LoggerService

type LoggerService = { initialize?: () -> Object, log: (level: LogLevel, msg: String, context: Object) -> Any, shutdown?: () -> Boolean }

Service that handles all logging:

  • initialize: Function called when the execution starts. DataWeave sends the result to every log call through the context parameter, so that, for example, a logging header can be sent at initialization and recovered in each log.

  • log: Function that is called on every log message.

  • shutdown: Function called when the execution completes, which is a common time to flush any buffer or to log out gracefully.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

MimeType

type MimeType = String

A String representation of a MIME type.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

Position

type Position = { index: Number, line: Number, column: Number }

Type that represents a position in a file by its index and its line and column.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

ReaderInput

type ReaderInput = { value: Binary, encoding?: String, properties?: Dictionary<SimpleType>, mimeType: MimeType }

Input to the DataWeave reader created for the specified MIME type, which includes the Binary input and MIME type, as well as optional encoding and properties values.

  • value: The input, in Binary format.

  • encoding: The encoding for the reader to use.

  • properties: The reader properties used to parse the input.

  • mimeType: The MIME type of the input.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

RunResult

type RunResult = Result<RunSuccess, ExecutionFailure>

Data type of the data that returns when a run function executes successfully.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

Introduced in DataWeave version 2.7.0.

RunSuccess

type RunSuccess = { value: Binary, mimeType: MimeType, encoding?: String, logs: Array<LogEntry> }

Data type of the data that returns when a run function executes successfully.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

RuntimeExecutionConfiguration

type RuntimeExecutionConfiguration = { timeOut?: Number, outputMimeType?: MimeType, writerProperties?: Dictionary<SimpleType>, onException?: "HANDLE" | "FAIL", securityManager?: SecurityManager, loggerService?: LoggerService, maxStackSize?: Number, onUnhandledTimeout?: (threadName: String, javaStackTrace: String, code: String) -> Any }

Configuration of the runtime execution that has advanced parameters.

  • timeOut: Maximum amount of time the DataWeave script takes before timing out.

  • outputMimeType: Default output MIME type if not specified in the DataWeave script.

  • writerProperties: Writer properties to use with the specified the outputMimeType property.

  • onException Specifies the behavior that occurs when the execution fails:

    • HANDLE (default value) returns ExecutionFailure.

    • FAIL propagates an exception.

  • securityManager: Identifies the SecurityManager to use in this execution. This security manager is composed by the current SecurityManager.

  • loggerService: The LoggerService to use in this execution.

  • maxStackSize: The maximum stack size.

  • onUnhandledTimeout: Callback that is called when the watchdog was not able to stop the execution after a timeout, which is useful for logging or reporting the problem. The callback is called with the following:

    • threadName: Name of the thread that hanged.

    • javaStackTrace: Java stack trace where the hang occurred.

    • code: The DataWeave code that caused the hang.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

SecurityManager

type SecurityManager = (grant: String, args: Array<Any>) -> Boolean

Function that is called when a privilege must be granted to the current execution.

  • grant is the name of the privilege, such as Resource.

  • args provides a list of parameters that the function requesting the privilege calls.

Experimental: This type is an experimental feature that is subject to change or removal from future versions of DataWeave.

TryResult

type TryResult = Result<T, TryResultFailure>

Object with a result or error message. If success is false, data type provides the error. If true, the data type provides the result.

TryResultFailure

type TryResultFailure = { kind: String, message: String, stack?: Array<String>, stackTrace?: String, location?: String }

A type for representing failed execution from try.

Supports the following fields:

  • kind: The error kind.

  • message: The error message.

  • stack: The stacktrace error (optional).

  • stackTrace: The stacktrace string value representation (optional).

  • location: The error location (optional).

Starting in Mule 4.4.0, if the stack is not present, the stackTrace field is available with the native Java stack trace.

Introduced in DataWeave version 2.7.0.